From 4bb28097ea4c784dc3368eea5f7de0ec2b244f23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A2=A8=E6=A2=93=E6=9F=92?= <1787882683@qq.com> Date: Tue, 30 Dec 2025 00:19:49 +0800 Subject: [PATCH] WebUI f346b1138481ffb9cfb2e49391854b471386a302 --- webui/dist/assets/icons-9Z4kBNLK.js | 1 + webui/dist/assets/icons-Dluc6IJB.js | 1 - webui/dist/assets/index-Bim71XYu.js | 90 +++++++++++++++++++ webui/dist/assets/index-C6yBaKb0.css | 1 + webui/dist/assets/index-Cg1tZrb2.js | 90 ------------------- webui/dist/assets/index-nIBlQvSe.css | 1 - .../{misc-Dw5FBFSX.js => misc-CJqnlRwD.js} | 2 +- webui/dist/assets/radix-core-CEUnGg09.js | 45 ---------- webui/dist/assets/radix-core-DyJi0yyw.js | 45 ++++++++++ ...ra-tU0cN6gS.js => radix-extra-DmmnfeQE.js} | 2 +- .../{uppy-wQRVMWCa.js => uppy-DFP_VzYR.js} | 2 +- webui/dist/index.html | 14 +-- 12 files changed, 147 insertions(+), 147 deletions(-) create mode 100644 webui/dist/assets/icons-9Z4kBNLK.js delete mode 100644 webui/dist/assets/icons-Dluc6IJB.js create mode 100644 webui/dist/assets/index-Bim71XYu.js create mode 100644 webui/dist/assets/index-C6yBaKb0.css delete mode 100644 webui/dist/assets/index-Cg1tZrb2.js delete mode 100644 webui/dist/assets/index-nIBlQvSe.css rename webui/dist/assets/{misc-Dw5FBFSX.js => misc-CJqnlRwD.js} (99%) delete mode 100644 webui/dist/assets/radix-core-CEUnGg09.js create mode 100644 webui/dist/assets/radix-core-DyJi0yyw.js rename webui/dist/assets/{radix-extra-tU0cN6gS.js => radix-extra-DmmnfeQE.js} (99%) rename webui/dist/assets/{uppy-wQRVMWCa.js => uppy-DFP_VzYR.js} (99%) diff --git a/webui/dist/assets/icons-9Z4kBNLK.js b/webui/dist/assets/icons-9Z4kBNLK.js new file mode 100644 index 00000000..1be32d04 --- /dev/null +++ b/webui/dist/assets/icons-9Z4kBNLK.js @@ -0,0 +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}; diff --git a/webui/dist/assets/icons-Dluc6IJB.js b/webui/dist/assets/icons-Dluc6IJB.js deleted file mode 100644 index 3f5e4a26..00000000 --- a/webui/dist/assets/icons-Dluc6IJB.js +++ /dev/null @@ -1 +0,0 @@ -import{r as y}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,(e,c,o)=>o?o.toUpperCase():c.toLowerCase()),d=t=>{const e=_(t);return e.charAt(0).toUpperCase()+e.slice(1)},k=(...t)=>t.filter((e,c,o)=>!!e&&e.trim()!==""&&o.indexOf(e)===c).join(" ").trim(),x=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="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=y.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:c=2,absoluteStrokeWidth:o,className:n="",children:h,iconNode:r,...s},p)=>y.createElement("svg",{ref:p,...m,width:e,height:e,stroke:t,strokeWidth:o?Number(c)*24/Number(e):c,className:k("lucide",n),...!h&&!x(s)&&{"aria-hidden":"true"},...s},[...r.map(([i,l])=>y.createElement(i,l)),...Array.isArray(h)?h:[h]]));const a=(t,e)=>{const c=y.forwardRef(({className:o,...n},h)=>y.createElement(v,{ref:h,iconNode:e,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"}]],j2=a("activity",g);const u=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],A2=a("arrow-left",u);const f=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],V2=a("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"}]],H2=a("arrow-up-down",w);const N=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],L2=a("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"}]],S2=a("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"}]],P2=a("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"}]],U2=a("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"}]],T2=a("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"}]],B2=a("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=a("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"}]],R2=a("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=a("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"}]],E2=a("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"}]],F2=a("chart-pie",L);const S=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],O2=a("check",S);const P=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],G2=a("chevron-down",P);const U=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],I2=a("chevron-left",U);const T=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],W2=a("chevron-right",T);const B=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],K2=a("chevron-up",B);const D=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],Q2=a("chevrons-left",D);const R=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],X2=a("chevrons-right",R);const Z=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],J2=a("chevrons-up-down",Z);const E=[["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"}]],Y2=a("circle-alert",E);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=a("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"}]],e0=a("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"}]],t0=a("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"}]],c0=a("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"}]],o0=a("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=a("circle-x",K);const Q=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],y0=a("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"}]],n0=a("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"}]],s0=a("clipboard-list",J);const Y=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],d0=a("clock",Y);const a1=[["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"}]],k0=a("code-xml",a1);const e1=[["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"}]],r0=a("container",e1);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"}]],p0=a("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"}]],i0=a("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"}]],l0=a("database",o1);const h1=[["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"}]],M0=a("dollar-sign",h1);const y1=[["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"}]],_0=a("download",y1);const n1=[["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"}]],x0=a("external-link",n1);const s1=[["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"}]],m0=a("eye-off",s1);const d1=[["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"}]],v0=a("eye",d1);const k1=[["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"}]],g0=a("file-question-mark",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:"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"}]],u0=a("file-search",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"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],f0=a("file-text",p1);const i1=[["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"}]],w0=a("folder-open",i1);const l1=[["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"}]],N0=a("funnel",l1);const M1=[["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"}]],$0=a("git-branch",M1);const _1=[["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"}]],z0=a("globe",_1);const x1=[["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"}]],q0=a("graduation-cap",x1);const m1=[["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"}]],b0=a("grip-vertical",m1);const v1=[["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"}]],C0=a("hard-drive",v1);const g1=[["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"}]],j0=a("hash",g1);const u1=[["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"}]],A0=a("heart",u1);const f1=[["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"}]],V0=a("house",f1);const w1=[["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"}]],H0=a("image",w1);const N1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],L0=a("info",N1);const $1=[["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"}]],S0=a("key",$1);const z1=[["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"}]],P0=a("layers",z1);const q1=[["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"}]],U0=a("layout-grid",q1);const b1=[["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"}]],T0=a("list-checks",b1);const C1=[["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"}]],B0=a("list",C1);const j1=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],D0=a("loader-circle",j1);const A1=[["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"}]],R0=a("lock",A1);const V1=[["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"}]],Z0=a("log-out",V1);const H1=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],E0=a("menu",H1);const L1=[["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"}]],F0=a("message-circle",L1);const S1=[["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"}]],O0=a("message-square-text",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"}]],G0=a("message-square",P1);const U1=[["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"}]],I0=a("moon",U1);const T1=[["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"}]],W0=a("network",T1);const B1=[["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"}]],K0=a("package",B1);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"}]],Q0=a("palette",D1);const R1=[["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"}]],X0=a("panels-top-left",R1);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"}]],J0=a("pause",Z1);const E1=[["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"}]],Y0=a("pen",E1);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"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],aa=a("pencil",F1);const O1=[["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"}]],ea=a("play",O1);const G1=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ta=a("plus",G1);const I1=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],ca=a("power",I1);const W1=[["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"}]],oa=a("puzzle",W1);const K1=[["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"}]],ha=a("refresh-cw",K1);const Q1=[["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"}]],ya=a("rotate-ccw",Q1);const X1=[["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"}]],na=a("rotate-cw",X1);const J1=[["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"}]],sa=a("save",J1);const Y1=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],da=a("search",Y1);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"}]],ka=a("send",a2);const e2=[["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"}]],ra=a("server",e2);const t2=[["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"}]],pa=a("settings-2",t2);const c2=[["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"}]],ia=a("settings",c2);const o2=[["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"}]],la=a("share-2",o2);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"}]],Ma=a("shield",h2);const y2=[["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"}]],_a=a("skip-forward",y2);const n2=[["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"}]],xa=a("sliders-vertical",n2);const s2=[["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"}]],ma=a("smile",s2);const d2=[["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"}]],va=a("sparkles",d2);const k2=[["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"}]],ga=a("square-pen",k2);const r2=[["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"}]],ua=a("star",r2);const p2=[["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"}]],fa=a("sun",p2);const i2=[["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"}]],wa=a("tag",i2);const l2=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Na=a("terminal",l2);const M2=[["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"}]],$a=a("thumbs-down",M2);const _2=[["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"}]],za=a("thumbs-up",_2);const x2=[["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"}]],qa=a("trash-2",x2);const m2=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],ba=a("trending-up",m2);const v2=[["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"}]],Ca=a("triangle-alert",v2);const g2=[["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"}]],ja=a("trophy",g2);const u2=[["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"}]],Aa=a("type",u2);const f2=[["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"}]],Va=a("upload",f2);const w2=[["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"}]],Ha=a("user",w2);const N2=[["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"}]],La=a("users",N2);const $2=[["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"}]],Sa=a("wifi-off",$2);const z2=[["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"}]],Pa=a("wifi",z2);const q2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ua=a("x",q2);const b2=[["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"}]],Ta=a("zap",b2);export{u0 as $,j2 as A,T2 as B,Y2 as C,M0 as D,m0 as E,f0 as F,va as G,C0 as H,L0 as I,ma as J,S0 as K,D0 as L,G0 as M,_a as N,V2 as O,ca as P,V0 as Q,ha as R,da as S,ba as T,Ha as U,A2 as V,ta as W,Ua as X,G2 as Y,Ta as Z,K2 as _,ya as a,b0 as a0,sa as a1,X0 as a2,k0 as a3,aa as a4,Q2 as a5,X2 as a6,J2 as a7,la as a8,K0 as a9,na as aA,pa as aB,ua as aC,U0 as aD,za as aE,$a as aF,$0 as aG,c0 as aH,Pa as aI,Sa as aJ,Y0 as aK,ka as aL,g0 as aM,S2 as aN,A0 as aO,ja as aP,H2 as aQ,B2 as aR,o0 as aS,E2 as aT,L2 as aU,xa as aV,E0 as aW,F2 as aX,U2 as aY,Z0 as aZ,R2 as a_,ra as aa,P0 as ab,T0 as ac,wa as ad,q0 as ae,r0 as af,w0 as ag,H0 as ah,N0 as ai,ga as aj,P2 as ak,j0 as al,y0 as am,F0 as an,z0 as ao,La as ap,W0 as aq,J0 as ar,ea as as,Z2 as at,Aa as au,D2 as av,B0 as aw,a0 as ax,i0 as ay,O0 as az,e0 as b,O2 as c,d0 as d,h0 as e,I2 as f,W2 as g,n0 as h,oa as i,ia as j,s0 as k,l0 as l,Q0 as m,Ma as n,Ca as o,p0 as p,v0 as q,qa as r,_0 as s,Va as t,fa as u,I0 as v,R0 as w,t0 as x,Na as y,x0 as z}; diff --git a/webui/dist/assets/index-Bim71XYu.js b/webui/dist/assets/index-Bim71XYu.js new file mode 100644 index 00000000..26d15b5f --- /dev/null +++ b/webui/dist/assets/index-Bim71XYu.js @@ -0,0 +1,90 @@ +import{r as d,j as e,L as Bn,e as ca,R as As,b as N0,f as b0,g as y0,h as w0,k as _0,l as Qs,m as S0,n as k0,O as Pg,o as C0}from"./router-9vIXuQkh.js";import{a as T0,b as E0,g as M0}from"./react-vendor-BmxF9s7Q.js";import{N as z0,c as A0,O as Qr,P as D0,g as vm}from"./utils-BqoaXoQ1.js";import{L as Hg,T as Fg,C as Gg,R as O0,a as Vg,V as R0,b as L0,S as qg,c as U0,d as Kg,I as $0,e as Qg,f as B0,g as Yg,h as I0,i as P0,j as H0,O as Jg,P as F0,k as Xg,l as Zg,D as Wg,A as ej,m as sj,n as G0,o as V0,p as tj,q as q0,r as aj,s as K0,t as Q0,u as lj,v as Y0,w as J0,x as nj,y as rj,F as ij,z as cj,B as X0,E as Z0,G as oj,H as W0,J as ew,K as sw,M as tw,N as aw,Q as lw,U as nw,W as rw,X as iw,Y as cw,Z as ow,_ as dw,$ as uw,a0 as mw,a1 as xw,a2 as dj,a3 as hw,a4 as fw}from"./radix-extra-DmmnfeQE.js";import{R as uj,T as mj,L as pw,g as gw,C as Fi,X as Gi,Y as $r,h as jw,B as zo,j as Vi,P as vw,k as Nw,l as bw}from"./charts-simvewUa.js";import{S as yw,O as xj,o as ww,C as hj,p as _w,T as fj,D as pj,R as Sw,q as kw,H as gj,I as Cw,J as jj,K as Tw,L as vj,M as Nj,N as Ew,Q as bj,V as Mw,U as yj,X as wj,Y as zw,Z as Aw,_ as _j,$ as Dw,a0 as Ow,a1 as Sj,e as kj,f as Ko,c as Qo,P as Yn,d as Yo,b as hn,h as Rw,l as Lw,m as Uw,u as Lm,r as $w,a as Bw,a2 as Iw,a3 as Cj,a4 as Pw,a5 as Hw,a6 as Fw,a7 as Tj,a8 as Ej,a9 as Mj,aa as zj,ab as Aj,ac as Dj,ad as Gw}from"./radix-core-DyJi0yyw.js";import{R as dt,a as Wi,C as _t,b as pt,L as Bs,X as Ea,c as Ct,d as Ma,e as Fr,f as Aa,g as Zt,E as Vw,h as na,i as Va,S as Tt,B as Pn,U as fn,P as oc,Z as Za,j as Oj,F as Ca,k as qw,l as pn,m as Kw,M as za,A as Gm,D as Qw,n as Gr,T as Vm,o as Yw,p as Rj,I as Ht,q as Jt,r as Lo,s as ec,t as ia,H as Jw,u as ns,v as sa,w as sc,x as qm,y as Yi,z as cg,K as Km,G as Lj,J as Xw,N as Ao,O as Zw,Q as Jo,V as Ww,W as e1,Y as Xo,_ as Ta,$ as et,a0 as Qm,a1 as Uj,a2 as dc,a3 as $j,a4 as Bj,a5 as Gn,a6 as gn,a7 as jn,a8 as Ym,a9 as Ij,aa as ra,ab as Ol,ac as Vn,ad as qn,ae as Zo,af as s1,ag as t1,ah as a1,ai as Jm,aj as Do,ak as Kn,al as l1,am as Vr,an as Uo,ao as n1,ap as $o,aq as tc,ar as Pj,as as r1,at as i1,au as Bo,av as c1,aw as Xm,ax as o1,ay as og,az as d1,aA as u1,aB as Hj,aC as m1,aD as dn,aE as Fj,aF as Nm,aG as dg,aH as x1,aI as bm,aJ as h1,aK as f1,aL as p1,aM as g1,aN as Gj,aO as j1,aP as qr,aQ as v1,aR as N1,aS as Vj,aT as qj,aU as b1,aV as y1,aW as ug,aX as w1,aY as _1,aZ as S1,a_ as k1,a$ as C1}from"./icons-9Z4kBNLK.js";import{S as T1,p as E1,j as M1,a as z1,E as mg,R as A1,o as D1}from"./codemirror-TZqPU532.js";import{u as Kj,a as Io,s as Qj,K as Yj,P as Jj,b as Xj,D as Zj,c as Wj,S as ev,v as O1,d as sv,C as tv,h as R1}from"./dnd-BiPfFtVp.js";import{_ as ga,c as L1,g as av,D as U1,z as To}from"./misc-CJqnlRwD.js";import{D as $1,U as B1}from"./uppy-DFP_VzYR.js";import{M as I1,r as P1,a as H1,b as F1}from"./markdown-CKA5gBQ9.js";import{c as G1,H as Po,P as Ho,u as V1,d as q1,R as K1,B as Q1,e as Y1,C as J1,M as X1,f as Z1}from"./reactflow-DtsZHOR4.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))c(u);new MutationObserver(u=>{for(const x of u)if(x.type==="childList")for(const h of x.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&c(h)}).observe(document,{childList:!0,subtree:!0});function i(u){const x={};return u.integrity&&(x.integrity=u.integrity),u.referrerPolicy&&(x.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?x.credentials="include":u.crossOrigin==="anonymous"?x.credentials="omit":x.credentials="same-origin",x}function c(u){if(u.ep)return;u.ep=!0;const x=i(u);fetch(u.href,x)}})();var ym={exports:{}},Ii={},wm={exports:{}},_m={};var xg;function W1(){return xg||(xg=1,(function(l){function n(E,K){var I=E.length;E.push(K);e:for(;0>>1,Q=E[ue];if(0>>1;ueu(Ce,I))zu(O,Ce)?(E[ue]=O,E[z]=I,ue=z):(E[ue]=Ce,E[pe]=I,ue=pe);else if(zu(O,I))E[ue]=O,E[z]=I,ue=z;else break e}}return K}function u(E,K){var I=E.sortIndex-K.sortIndex;return I!==0?I:E.id-K.id}if(l.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var x=performance;l.unstable_now=function(){return x.now()}}else{var h=Date,f=h.now();l.unstable_now=function(){return h.now()-f}}var p=[],g=[],N=1,v=null,b=3,w=!1,y=!1,R=!1,A=!1,S=typeof setTimeout=="function"?setTimeout:null,B=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;function C(E){for(var K=i(g);K!==null;){if(K.callback===null)c(g);else if(K.startTime<=E)c(g),K.sortIndex=K.expirationTime,n(p,K);else break;K=i(g)}}function D(E){if(R=!1,C(E),!y)if(i(p)!==null)y=!0,H||(H=!0,je());else{var K=i(g);K!==null&&ge(D,K.startTime-E)}}var H=!1,L=-1,J=5,U=-1;function oe(){return A?!0:!(l.unstable_now()-UE&&oe());){var ue=v.callback;if(typeof ue=="function"){v.callback=null,b=v.priorityLevel;var Q=ue(v.expirationTime<=E);if(E=l.unstable_now(),typeof Q=="function"){v.callback=Q,C(E),K=!0;break s}v===i(p)&&c(p),C(E)}else c(p);v=i(p)}if(v!==null)K=!0;else{var Se=i(g);Se!==null&&ge(D,Se.startTime-E),K=!1}}break e}finally{v=null,b=I,w=!1}K=void 0}}finally{K?je():H=!1}}}var je;if(typeof M=="function")je=function(){M(Ne)};else if(typeof MessageChannel<"u"){var re=new MessageChannel,fe=re.port2;re.port1.onmessage=Ne,je=function(){fe.postMessage(null)}}else je=function(){S(Ne,0)};function ge(E,K){L=S(function(){E(l.unstable_now())},K)}l.unstable_IdlePriority=5,l.unstable_ImmediatePriority=1,l.unstable_LowPriority=4,l.unstable_NormalPriority=3,l.unstable_Profiling=null,l.unstable_UserBlockingPriority=2,l.unstable_cancelCallback=function(E){E.callback=null},l.unstable_forceFrameRate=function(E){0>E||125ue?(E.sortIndex=I,n(g,E),i(p)===null&&E===i(g)&&(R?(B(L),L=-1):R=!0,ge(D,I-ue))):(E.sortIndex=Q,n(p,E),y||w||(y=!0,H||(H=!0,je()))),E},l.unstable_shouldYield=oe,l.unstable_wrapCallback=function(E){var K=b;return function(){var I=b;b=K;try{return E.apply(this,arguments)}finally{b=I}}}})(_m)),_m}var hg;function e_(){return hg||(hg=1,wm.exports=W1()),wm.exports}var fg;function s_(){if(fg)return Ii;fg=1;var l=e_(),n=T0(),i=E0();function c(s){var t="https://react.dev/errors/"+s;if(1Q||(s.current=ue[Q],ue[Q]=null,Q--)}function Ce(s,t){Q++,ue[Q]=s.current,s.current=t}var z=Se(null),O=Se(null),V=Se(null),de=Se(null);function De(s,t){switch(Ce(V,t),Ce(O,s),Ce(z,null),t.nodeType){case 9:case 11:s=(s=t.documentElement)&&(s=s.namespaceURI)?zp(s):0;break;default:if(s=t.tagName,t=t.namespaceURI)t=zp(t),s=Ap(t,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}pe(z),Ce(z,s)}function W(){pe(z),pe(O),pe(V)}function Y(s){s.memoizedState!==null&&Ce(de,s);var t=z.current,a=Ap(t,s.type);t!==a&&(Ce(O,s),Ce(z,a))}function He(s){O.current===s&&(pe(z),pe(O)),de.current===s&&(pe(de),Li._currentValue=I)}var F,ee;function Ue(s){if(F===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);F=t&&t[1]||"",ee=-1)":-1o||$[r]!==ae[o]){var ve=` +`+$[r].replace(" at new "," at ");return s.displayName&&ve.includes("")&&(ve=ve.replace("",s.displayName)),ve}while(1<=r&&0<=o);break}}}finally{ie=!1,Error.prepareStackTrace=a}return(a=s?s.displayName||s.name:"")?Ue(a):""}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 Me(s){try{var t="",a=null;do t+=me(s,a),a=s,s=s.return;while(s);return t}catch(r){return` +Error generating stack: `+r.message+` +`+r.stack}}var rs=Object.prototype.hasOwnProperty,Ut=l.unstable_scheduleCallback,aa=l.unstable_cancelCallback,Qa=l.unstable_shouldYield,Ft=l.unstable_requestPaint,mt=l.unstable_now,q=l.unstable_getCurrentPriorityLevel,qe=l.unstable_ImmediatePriority,Qe=l.unstable_UserBlockingPriority,es=l.unstable_NormalPriority,Ls=l.unstable_LowPriority,as=l.unstable_IdlePriority,Cs=l.log,ze=l.unstable_setDisableYieldValue,Ns=null,ls=null;function ss(s){if(typeof Cs=="function"&&ze(s),ls&&typeof ls.setStrictMode=="function")try{ls.setStrictMode(Ns,s)}catch{}}var bs=Math.clz32?Math.clz32:tt,gt=Math.log,$t=Math.LN2;function tt(s){return s>>>=0,s===0?32:31-(gt(s)/$t|0)|0}var Ms=256,Et=262144,Bt=4194304;function Da(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 tl(s,t,a){var r=s.pendingLanes;if(r===0)return 0;var o=0,m=s.suspendedLanes,j=s.pingedLanes;s=s.warmLanes;var k=r&134217727;return k!==0?(r=k&~m,r!==0?o=Da(r):(j&=k,j!==0?o=Da(j):a||(a=k&~s,a!==0&&(o=Da(a))))):(k=r&~m,k!==0?o=Da(k):j!==0?o=Da(j):a||(a=r&~s,a!==0&&(o=Da(a)))),o===0?0:t!==0&&t!==o&&(t&m)===0&&(m=o&-o,a=t&-t,m>=a||m===32&&(a&4194048)!==0)?t:o}function ul(s,t){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&t)===0}function Zn(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 se(){var s=Bt;return Bt<<=1,(Bt&62914560)===0&&(Bt=4194304),s}function we(s){for(var t=[],a=0;31>a;a++)t.push(s);return t}function Re(s,t){s.pendingLanes|=t,t!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function Hs(s,t,a,r,o,m){var j=s.pendingLanes;s.pendingLanes=a,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=a,s.entangledLanes&=a,s.errorRecoveryDisabledLanes&=a,s.shellSuspendCounter=0;var k=s.entanglements,$=s.expirationTimes,ae=s.hiddenUpdates;for(a=j&~a;0"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var hb=/[\n"\\]/g;function Ra(s){return s.replace(hb,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function xd(s,t,a,r,o,m,j,k){s.name="",j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?s.type=j:s.removeAttribute("type"),t!=null?j==="number"?(t===0&&s.value===""||s.value!=t)&&(s.value=""+Oa(t)):s.value!==""+Oa(t)&&(s.value=""+Oa(t)):j!=="submit"&&j!=="reset"||s.removeAttribute("value"),t!=null?hd(s,j,Oa(t)):a!=null?hd(s,j,Oa(a)):r!=null&&s.removeAttribute("value"),o==null&&m!=null&&(s.defaultChecked=!!m),o!=null&&(s.checked=o&&typeof o!="function"&&typeof o!="symbol"),k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?s.name=""+Oa(k):s.removeAttribute("name")}function _x(s,t,a,r,o,m,j,k){if(m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(s.type=m),t!=null||a!=null){if(!(m!=="submit"&&m!=="reset"||t!=null)){md(s);return}a=a!=null?""+Oa(a):"",t=t!=null?""+Oa(t):a,k||t===s.value||(s.value=t),s.defaultValue=t}r=r??o,r=typeof r!="function"&&typeof r!="symbol"&&!!r,s.checked=k?s.checked:!!r,s.defaultChecked=!!r,j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(s.name=j),md(s)}function hd(s,t,a){t==="number"&&gc(s.ownerDocument)===s||s.defaultValue===""+a||(s.defaultValue=""+a)}function lr(s,t,a,r){if(s=s.options,t){t={};for(var o=0;o"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),vd=!1;if(hl)try{var ei={};Object.defineProperty(ei,"passive",{get:function(){vd=!0}}),window.addEventListener("test",ei,ei),window.removeEventListener("test",ei,ei)}catch{vd=!1}var Il=null,Nd=null,vc=null;function zx(){if(vc)return vc;var s,t=Nd,a=t.length,r,o="value"in Il?Il.value:Il.textContent,m=o.length;for(s=0;s=ai),Ux=" ",$x=!1;function Bx(s,t){switch(s){case"keyup":return Hb.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ix(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var cr=!1;function Gb(s,t){switch(s){case"compositionend":return Ix(t);case"keypress":return t.which!==32?null:($x=!0,Ux);case"textInput":return s=t.data,s===Ux&&$x?null:s;default:return null}}function Vb(s,t){if(cr)return s==="compositionend"||!Sd&&Bx(s,t)?(s=zx(),vc=Nd=Il=null,cr=!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:a,offset:t-s};s=r}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Qx(a)}}function Jx(s,t){return s&&t?s===t?!0:s&&s.nodeType===3?!1:t&&t.nodeType===3?Jx(s,t.parentNode):"contains"in s?s.contains(t):s.compareDocumentPosition?!!(s.compareDocumentPosition(t)&16):!1:!1}function Xx(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var t=gc(s.document);t instanceof s.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)s=t.contentWindow;else break;t=gc(s.document)}return t}function Td(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 Wb=hl&&"documentMode"in document&&11>=document.documentMode,or=null,Ed=null,ii=null,Md=!1;function Zx(s,t,a){var r=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Md||or==null||or!==gc(r)||(r=or,"selectionStart"in r&&Td(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ii&&ri(ii,r)||(ii=r,r=xo(Ed,"onSelect"),0>=j,o-=j,al=1<<32-bs(t)+o|a<os?(Es=Ve,Ve=null):Es=Ve.sibling;var $s=ce(X,Ve,te[os],be);if($s===null){Ve===null&&(Ve=Es);break}s&&Ve&&$s.alternate===null&&t(X,Ve),G=m($s,G,os),Us===null?Ye=$s:Us.sibling=$s,Us=$s,Ve=Es}if(os===te.length)return a(X,Ve),zs&&pl(X,os),Ye;if(Ve===null){for(;osos?(Es=Ve,Ve=null):Es=Ve.sibling;var on=ce(X,Ve,$s.value,be);if(on===null){Ve===null&&(Ve=Es);break}s&&Ve&&on.alternate===null&&t(X,Ve),G=m(on,G,os),Us===null?Ye=on:Us.sibling=on,Us=on,Ve=Es}if($s.done)return a(X,Ve),zs&&pl(X,os),Ye;if(Ve===null){for(;!$s.done;os++,$s=te.next())$s=ye(X,$s.value,be),$s!==null&&(G=m($s,G,os),Us===null?Ye=$s:Us.sibling=$s,Us=$s);return zs&&pl(X,os),Ye}for(Ve=r(Ve);!$s.done;os++,$s=te.next())$s=xe(Ve,X,os,$s.value,be),$s!==null&&(s&&$s.alternate!==null&&Ve.delete($s.key===null?os:$s.key),G=m($s,G,os),Us===null?Ye=$s:Us.sibling=$s,Us=$s);return s&&Ve.forEach(function(v0){return t(X,v0)}),zs&&pl(X,os),Ye}function Xs(X,G,te,be){if(typeof te=="object"&&te!==null&&te.type===R&&te.key===null&&(te=te.props.children),typeof te=="object"&&te!==null){switch(te.$$typeof){case w:e:{for(var Ye=te.key;G!==null;){if(G.key===Ye){if(Ye=te.type,Ye===R){if(G.tag===7){a(X,G.sibling),be=o(G,te.props.children),be.return=X,X=be;break e}}else if(G.elementType===Ye||typeof Ye=="object"&&Ye!==null&&Ye.$$typeof===J&&An(Ye)===G.type){a(X,G.sibling),be=o(G,te.props),xi(be,te),be.return=X,X=be;break e}a(X,G);break}else t(X,G);G=G.sibling}te.type===R?(be=Cn(te.props.children,X.mode,be,te.key),be.return=X,X=be):(be=Ec(te.type,te.key,te.props,null,X.mode,be),xi(be,te),be.return=X,X=be)}return j(X);case y:e:{for(Ye=te.key;G!==null;){if(G.key===Ye)if(G.tag===4&&G.stateNode.containerInfo===te.containerInfo&&G.stateNode.implementation===te.implementation){a(X,G.sibling),be=o(G,te.children||[]),be.return=X,X=be;break e}else{a(X,G);break}else t(X,G);G=G.sibling}be=Ud(te,X.mode,be),be.return=X,X=be}return j(X);case J:return te=An(te),Xs(X,G,te,be)}if(ge(te))return Fe(X,G,te,be);if(je(te)){if(Ye=je(te),typeof Ye!="function")throw Error(c(150));return te=Ye.call(te),Ze(X,G,te,be)}if(typeof te.then=="function")return Xs(X,G,Lc(te),be);if(te.$$typeof===M)return Xs(X,G,Ac(X,te),be);Uc(X,te)}return typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint"?(te=""+te,G!==null&&G.tag===6?(a(X,G.sibling),be=o(G,te),be.return=X,X=be):(a(X,G),be=Ld(te,X.mode,be),be.return=X,X=be),j(X)):a(X,G)}return function(X,G,te,be){try{mi=0;var Ye=Xs(X,G,te,be);return Nr=null,Ye}catch(Ve){if(Ve===vr||Ve===Oc)throw Ve;var Us=Na(29,Ve,null,X.mode);return Us.lanes=be,Us.return=X,Us}finally{}}}var On=bh(!0),yh=bh(!1),Vl=!1;function Yd(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Jd(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 Kl(s,t,a){var r=s.updateQueue;if(r===null)return null;if(r=r.shared,(Ps&2)!==0){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,t=Tc(s),nh(s,null,a),t}return Cc(s,r,t,a),Tc(s)}function hi(s,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var r=t.lanes;r&=s.pendingLanes,a|=r,t.lanes=a,Wt(s,a)}}function Xd(s,t){var a=s.updateQueue,r=s.alternate;if(r!==null&&(r=r.updateQueue,a===r)){var o=null,m=null;if(a=a.firstBaseUpdate,a!==null){do{var j={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};m===null?o=m=j:m=m.next=j,a=a.next}while(a!==null);m===null?o=m=t:m=m.next=t}else o=m=t;a={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:m,shared:r.shared,callbacks:r.callbacks},s.updateQueue=a;return}s=a.lastBaseUpdate,s===null?a.firstBaseUpdate=t:s.next=t,a.lastBaseUpdate=t}var Zd=!1;function fi(){if(Zd){var s=jr;if(s!==null)throw s}}function pi(s,t,a,r){Zd=!1;var o=s.updateQueue;Vl=!1;var m=o.firstBaseUpdate,j=o.lastBaseUpdate,k=o.shared.pending;if(k!==null){o.shared.pending=null;var $=k,ae=$.next;$.next=null,j===null?m=ae:j.next=ae,j=$;var ve=s.alternate;ve!==null&&(ve=ve.updateQueue,k=ve.lastBaseUpdate,k!==j&&(k===null?ve.firstBaseUpdate=ae:k.next=ae,ve.lastBaseUpdate=$))}if(m!==null){var ye=o.baseState;j=0,ve=ae=$=null,k=m;do{var ce=k.lane&-536870913,xe=ce!==k.lane;if(xe?(Ts&ce)===ce:(r&ce)===ce){ce!==0&&ce===gr&&(Zd=!0),ve!==null&&(ve=ve.next={lane:0,tag:k.tag,payload:k.payload,callback:null,next:null});e:{var Fe=s,Ze=k;ce=t;var Xs=a;switch(Ze.tag){case 1:if(Fe=Ze.payload,typeof Fe=="function"){ye=Fe.call(Xs,ye,ce);break e}ye=Fe;break e;case 3:Fe.flags=Fe.flags&-65537|128;case 0:if(Fe=Ze.payload,ce=typeof Fe=="function"?Fe.call(Xs,ye,ce):Fe,ce==null)break e;ye=v({},ye,ce);break e;case 2:Vl=!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?(ae=ve=xe,$=ye):ve=ve.next=xe,j|=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&&($=ye),o.baseState=$,o.firstBaseUpdate=ae,o.lastBaseUpdate=ve,m===null&&(o.shared.lanes=0),Zl|=j,s.lanes=j,s.memoizedState=ye}}function wh(s,t){if(typeof s!="function")throw Error(c(191,s));s.call(t)}function _h(s,t){var a=s.callbacks;if(a!==null)for(s.callbacks=null,s=0;sm?m:8;var j=E.T,k={};E.T=k,gu(s,!1,t,a);try{var $=o(),ae=E.S;if(ae!==null&&ae(k,$),$!==null&&typeof $=="object"&&typeof $.then=="function"){var ve=cy($,r);vi(s,t,ve,Sa(s))}else vi(s,t,r,Sa(s))}catch(ye){vi(s,t,{then:function(){},status:"rejected",reason:ye},Sa())}finally{K.p=m,j!==null&&k.types!==null&&(j.types=k.types),E.T=j}}function hy(){}function fu(s,t,a,r){if(s.tag!==5)throw Error(c(476));var o=tf(s).queue;sf(s,o,t,I,a===null?hy:function(){return af(s),a(r)})}function tf(s){var t=s.memoizedState;if(t!==null)return t;t={memoizedState:I,baseState:I,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Nl,lastRenderedState:I},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Nl,lastRenderedState:a},next:null},s.memoizedState=t,s=s.alternate,s!==null&&(s.memoizedState=t),t}function af(s){var t=tf(s);t.next===null&&(t=s.alternate.memoizedState),vi(s,t.next.queue,{},Sa())}function pu(){return Vt(Li)}function lf(){return kt().memoizedState}function nf(){return kt().memoizedState}function fy(s){for(var t=s.return;t!==null;){switch(t.tag){case 24:case 3:var a=Sa();s=ql(a);var r=Kl(t,s,a);r!==null&&(fa(r,t,a),hi(r,t,a)),t={cache:Vd()},s.payload=t;return}t=t.return}}function py(s,t,a){var r=Sa();a={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Kc(s)?cf(t,a):(a=Od(s,t,a,r),a!==null&&(fa(a,s,r),of(a,t,r)))}function rf(s,t,a){var r=Sa();vi(s,t,a,r)}function vi(s,t,a,r){var o={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Kc(s))cf(t,o);else{var m=s.alternate;if(s.lanes===0&&(m===null||m.lanes===0)&&(m=t.lastRenderedReducer,m!==null))try{var j=t.lastRenderedState,k=m(j,a);if(o.hasEagerState=!0,o.eagerState=k,va(k,j))return Cc(s,t,o,0),Ws===null&&kc(),!1}catch{}finally{}if(a=Od(s,t,o,r),a!==null)return fa(a,s,r),of(a,t,r),!0}return!1}function gu(s,t,a,r){if(r={lane:2,revertLane:Yu(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Kc(s)){if(t)throw Error(c(479))}else t=Od(s,a,r,2),t!==null&&fa(t,s,2)}function Kc(s){var t=s.alternate;return s===cs||t!==null&&t===cs}function cf(s,t){yr=Ic=!0;var a=s.pending;a===null?t.next=t:(t.next=a.next,a.next=t),s.pending=t}function of(s,t,a){if((a&4194048)!==0){var r=t.lanes;r&=s.pendingLanes,a|=r,t.lanes=a,Wt(s,a)}}var Ni={readContext:Vt,use:Fc,useCallback:vt,useContext:vt,useEffect:vt,useImperativeHandle:vt,useLayoutEffect:vt,useInsertionEffect:vt,useMemo:vt,useReducer:vt,useRef:vt,useState:vt,useDebugValue:vt,useDeferredValue:vt,useTransition:vt,useSyncExternalStore:vt,useId:vt,useHostTransitionStatus:vt,useFormState:vt,useActionState:vt,useOptimistic:vt,useMemoCache:vt,useCacheRefresh:vt};Ni.useEffectEvent=vt;var df={readContext:Vt,use:Fc,useCallback:function(s,t){return la().memoizedState=[s,t===void 0?null:t],s},useContext:Vt,useEffect:qh,useImperativeHandle:function(s,t,a){a=a!=null?a.concat([s]):null,Vc(4194308,4,Jh.bind(null,t,s),a)},useLayoutEffect:function(s,t){return Vc(4194308,4,s,t)},useInsertionEffect:function(s,t){Vc(4,2,s,t)},useMemo:function(s,t){var a=la();t=t===void 0?null:t;var r=s();if(Rn){ss(!0);try{s()}finally{ss(!1)}}return a.memoizedState=[r,t],r},useReducer:function(s,t,a){var r=la();if(a!==void 0){var o=a(t);if(Rn){ss(!0);try{a(t)}finally{ss(!1)}}}else o=t;return r.memoizedState=r.baseState=o,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:o},r.queue=s,s=s.dispatch=py.bind(null,cs,s),[r.memoizedState,s]},useRef:function(s){var t=la();return s={current:s},t.memoizedState=s},useState:function(s){s=du(s);var t=s.queue,a=rf.bind(null,cs,t);return t.dispatch=a,[s.memoizedState,a]},useDebugValue:xu,useDeferredValue:function(s,t){var a=la();return hu(a,s,t)},useTransition:function(){var s=du(!1);return s=sf.bind(null,cs,s.queue,!0,!1),la().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,t,a){var r=cs,o=la();if(zs){if(a===void 0)throw Error(c(407));a=a()}else{if(a=t(),Ws===null)throw Error(c(349));(Ts&127)!==0||Mh(r,t,a)}o.memoizedState=a;var m={value:a,getSnapshot:t};return o.queue=m,qh(Ah.bind(null,r,m,s),[s]),r.flags|=2048,_r(9,{destroy:void 0},zh.bind(null,r,m,a,t),null),a},useId:function(){var s=la(),t=Ws.identifierPrefix;if(zs){var a=ll,r=al;a=(r&~(1<<32-bs(r)-1)).toString(32)+a,t="_"+t+"R_"+a,a=Pc++,0<\/script>",m=m.removeChild(m.firstChild);break;case"select":m=typeof r.is=="string"?j.createElement("select",{is:r.is}):j.createElement("select"),r.multiple?m.multiple=!0:r.size&&(m.size=r.size);break;default:m=typeof r.is=="string"?j.createElement(o,{is:r.is}):j.createElement(o)}}m[gs]=t,m[is]=r;e:for(j=t.child;j!==null;){if(j.tag===5||j.tag===6)m.appendChild(j.stateNode);else if(j.tag!==4&&j.tag!==27&&j.child!==null){j.child.return=j,j=j.child;continue}if(j===t)break e;for(;j.sibling===null;){if(j.return===null||j.return===t)break e;j=j.return}j.sibling.return=j.return,j=j.sibling}t.stateNode=m;e:switch(Kt(m,o,r),o){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&yl(t)}}return ct(t),zu(t,t.type,s===null?null:s.memoizedProps,t.pendingProps,a),null;case 6:if(s&&t.stateNode!=null)s.memoizedProps!==r&&yl(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(c(166));if(s=V.current,fr(t)){if(s=t.stateNode,a=t.memoizedProps,r=null,o=Gt,o!==null)switch(o.tag){case 27:case 5:r=o.memoizedProps}s[gs]=t,s=!!(s.nodeValue===a||r!==null&&r.suppressHydrationWarning===!0||Ep(s.nodeValue,a)),s||Fl(t,!0)}else s=ho(s).createTextNode(r),s[gs]=t,t.stateNode=s}return ct(t),null;case 31:if(a=t.memoizedState,s===null||s.memoizedState!==null){if(r=fr(t),a!==null){if(s===null){if(!r)throw Error(c(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(c(557));s[gs]=t}else Tn(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;ct(t),s=!1}else a=Pd(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=a),s=!0;if(!s)return t.flags&256?(ya(t),t):(ya(t),null);if((t.flags&128)!==0)throw Error(c(558))}return ct(t),null;case 13:if(r=t.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(o=fr(t),r!==null&&r.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[gs]=t}else Tn(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;ct(t),o=!1}else o=Pd(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?(ya(t),t):(ya(t),null)}return ya(t),(t.flags&128)!==0?(t.lanes=a,t):(a=r!==null,s=s!==null&&s.memoizedState!==null,a&&(r=t.child,o=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(o=r.alternate.memoizedState.cachePool.pool),m=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(m=r.memoizedState.cachePool.pool),m!==o&&(r.flags|=2048)),a!==s&&a&&(t.child.flags|=8192),Zc(t,t.updateQueue),ct(t),null);case 4:return W(),s===null&&Wu(t.stateNode.containerInfo),ct(t),null;case 10:return jl(t.type),ct(t),null;case 19:if(pe(St),r=t.memoizedState,r===null)return ct(t),null;if(o=(t.flags&128)!==0,m=r.rendering,m===null)if(o)yi(r,!1);else{if(Nt!==0||s!==null&&(s.flags&128)!==0)for(s=t.child;s!==null;){if(m=Bc(s),m!==null){for(t.flags|=128,yi(r,!1),s=m.updateQueue,t.updateQueue=s,Zc(t,s),t.subtreeFlags=0,s=a,a=t.child;a!==null;)rh(a,s),a=a.sibling;return Ce(St,St.current&1|2),zs&&pl(t,r.treeForkCount),t.child}s=s.sibling}r.tail!==null&&mt()>ao&&(t.flags|=128,o=!0,yi(r,!1),t.lanes=4194304)}else{if(!o)if(s=Bc(m),s!==null){if(t.flags|=128,o=!0,s=s.updateQueue,t.updateQueue=s,Zc(t,s),yi(r,!0),r.tail===null&&r.tailMode==="hidden"&&!m.alternate&&!zs)return ct(t),null}else 2*mt()-r.renderingStartTime>ao&&a!==536870912&&(t.flags|=128,o=!0,yi(r,!1),t.lanes=4194304);r.isBackwards?(m.sibling=t.child,t.child=m):(s=r.last,s!==null?s.sibling=m:t.child=m,r.last=m)}return r.tail!==null?(s=r.tail,r.rendering=s,r.tail=s.sibling,r.renderingStartTime=mt(),s.sibling=null,a=St.current,Ce(St,o?a&1|2:a&1),zs&&pl(t,r.treeForkCount),s):(ct(t),null);case 22:case 23:return ya(t),eu(),r=t.memoizedState!==null,s!==null?s.memoizedState!==null!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?(a&536870912)!==0&&(t.flags&128)===0&&(ct(t),t.subtreeFlags&6&&(t.flags|=8192)):ct(t),a=t.updateQueue,a!==null&&Zc(t,a.retryQueue),a=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(a=s.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==a&&(t.flags|=2048),s!==null&&pe(zn),null;case 24:return a=null,s!==null&&(a=s.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),jl(Mt),ct(t),null;case 25:return null;case 30:return null}throw Error(c(156,t.tag))}function by(s,t){switch(Bd(t),t.tag){case 1:return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 3:return jl(Mt),W(),s=t.flags,(s&65536)!==0&&(s&128)===0?(t.flags=s&-65537|128,t):null;case 26:case 27:case 5:return He(t),null;case 31:if(t.memoizedState!==null){if(ya(t),t.alternate===null)throw Error(c(340));Tn()}return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 13:if(ya(t),s=t.memoizedState,s!==null&&s.dehydrated!==null){if(t.alternate===null)throw Error(c(340));Tn()}return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 19:return pe(St),null;case 4:return W(),null;case 10:return jl(t.type),null;case 22:case 23:return ya(t),eu(),s!==null&&pe(zn),s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 24:return jl(Mt),null;case 25:return null;default:return null}}function Of(s,t){switch(Bd(t),t.tag){case 3:jl(Mt),W();break;case 26:case 27:case 5:He(t);break;case 4:W();break;case 31:t.memoizedState!==null&&ya(t);break;case 13:ya(t);break;case 19:pe(St);break;case 10:jl(t.type);break;case 22:case 23:ya(t),eu(),s!==null&&pe(zn);break;case 24:jl(Mt)}}function wi(s,t){try{var a=t.updateQueue,r=a!==null?a.lastEffect:null;if(r!==null){var o=r.next;a=o;do{if((a.tag&s)===s){r=void 0;var m=a.create,j=a.inst;r=m(),j.destroy=r}a=a.next}while(a!==o)}}catch(k){Vs(t,t.return,k)}}function Jl(s,t,a){try{var r=t.updateQueue,o=r!==null?r.lastEffect:null;if(o!==null){var m=o.next;r=m;do{if((r.tag&s)===s){var j=r.inst,k=j.destroy;if(k!==void 0){j.destroy=void 0,o=t;var $=a,ae=k;try{ae()}catch(ve){Vs(o,$,ve)}}}r=r.next}while(r!==m)}}catch(ve){Vs(t,t.return,ve)}}function Rf(s){var t=s.updateQueue;if(t!==null){var a=s.stateNode;try{_h(t,a)}catch(r){Vs(s,s.return,r)}}}function Lf(s,t,a){a.props=Ln(s.type,s.memoizedProps),a.state=s.memoizedState;try{a.componentWillUnmount()}catch(r){Vs(s,t,r)}}function _i(s,t){try{var a=s.ref;if(a!==null){switch(s.tag){case 26:case 27:case 5:var r=s.stateNode;break;case 30:r=s.stateNode;break;default:r=s.stateNode}typeof a=="function"?s.refCleanup=a(r):a.current=r}}catch(o){Vs(s,t,o)}}function nl(s,t){var a=s.ref,r=s.refCleanup;if(a!==null)if(typeof r=="function")try{r()}catch(o){Vs(s,t,o)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(o){Vs(s,t,o)}else a.current=null}function Uf(s){var t=s.type,a=s.memoizedProps,r=s.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&r.focus();break e;case"img":a.src?r.src=a.src:a.srcSet&&(r.srcset=a.srcSet)}}catch(o){Vs(s,s.return,o)}}function Au(s,t,a){try{var r=s.stateNode;Fy(r,s.type,a,t),r[is]=t}catch(o){Vs(s,s.return,o)}}function $f(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&an(s.type)||s.tag===4}function Du(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||$f(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&&an(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 Ou(s,t,a){var r=s.tag;if(r===5||r===6)s=s.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(s,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(s),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=xl));else if(r!==4&&(r===27&&an(s.type)&&(a=s.stateNode,t=null),s=s.child,s!==null))for(Ou(s,t,a),s=s.sibling;s!==null;)Ou(s,t,a),s=s.sibling}function Wc(s,t,a){var r=s.tag;if(r===5||r===6)s=s.stateNode,t?a.insertBefore(s,t):a.appendChild(s);else if(r!==4&&(r===27&&an(s.type)&&(a=s.stateNode),s=s.child,s!==null))for(Wc(s,t,a),s=s.sibling;s!==null;)Wc(s,t,a),s=s.sibling}function Bf(s){var t=s.stateNode,a=s.memoizedProps;try{for(var r=s.type,o=t.attributes;o.length;)t.removeAttributeNode(o[0]);Kt(t,r,a),t[gs]=s,t[is]=a}catch(m){Vs(s,s.return,m)}}var wl=!1,Dt=!1,Ru=!1,If=typeof WeakSet=="function"?WeakSet:Set,Pt=null;function yy(s,t){if(s=s.containerInfo,tm=bo,s=Xx(s),Td(s)){if("selectionStart"in s)var a={start:s.selectionStart,end:s.selectionEnd};else e:{a=(a=s.ownerDocument)&&a.defaultView||window;var r=a.getSelection&&a.getSelection();if(r&&r.rangeCount!==0){a=r.anchorNode;var o=r.anchorOffset,m=r.focusNode;r=r.focusOffset;try{a.nodeType,m.nodeType}catch{a=null;break e}var j=0,k=-1,$=-1,ae=0,ve=0,ye=s,ce=null;s:for(;;){for(var xe;ye!==a||o!==0&&ye.nodeType!==3||(k=j+o),ye!==m||r!==0&&ye.nodeType!==3||($=j+r),ye.nodeType===3&&(j+=ye.nodeValue.length),(xe=ye.firstChild)!==null;)ce=ye,ye=xe;for(;;){if(ye===s)break s;if(ce===a&&++ae===o&&(k=j),ce===m&&++ve===r&&($=j),(xe=ye.nextSibling)!==null)break;ye=ce,ce=ye.parentNode}ye=xe}a=k===-1||$===-1?null:{start:k,end:$}}else a=null}a=a||{start:0,end:0}}else a=null;for(am={focusedElem:s,selectionRange:a},bo=!1,Pt=t;Pt!==null;)if(t=Pt,s=t.child,(t.subtreeFlags&1028)!==0&&s!==null)s.return=t,Pt=s;else for(;Pt!==null;){switch(t=Pt,m=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(a=0;a title"))),Kt(m,r,a),m[gs]=s,It(m),r=m;break e;case"link":var j=qp("link","href",o).get(r+(a.href||""));if(j){for(var k=0;kXs&&(j=Xs,Xs=Ze,Ze=j);var X=Yx(k,Ze),G=Yx(k,Xs);if(X&&G&&(xe.rangeCount!==1||xe.anchorNode!==X.node||xe.anchorOffset!==X.offset||xe.focusNode!==G.node||xe.focusOffset!==G.offset)){var te=ye.createRange();te.setStart(X.node,X.offset),xe.removeAllRanges(),Ze>Xs?(xe.addRange(te),xe.extend(G.node,G.offset)):(te.setEnd(G.node,G.offset),xe.addRange(te))}}}}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;ka?32:a,E.T=null,a=Hu,Hu=null;var m=en,j=Tl;if(Rt=0,Er=en=null,Tl=0,(Ps&6)!==0)throw Error(c(331));var k=Ps;if(Ps|=4,Xf(m.current),Qf(m,m.current,j,a),Ps=k,Mi(0,!1),ls&&typeof ls.onPostCommitFiberRoot=="function")try{ls.onPostCommitFiberRoot(Ns,m)}catch{}return!0}finally{K.p=o,E.T=r,fp(s,t)}}function gp(s,t,a){t=Ua(a,t),t=bu(s.stateNode,t,2),s=Kl(s,t,2),s!==null&&(Re(s,2),rl(s))}function Vs(s,t,a){if(s.tag===3)gp(s,s,a);else for(;t!==null;){if(t.tag===3){gp(t,s,a);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Wl===null||!Wl.has(r))){s=Ua(a,s),a=jf(2),r=Kl(t,a,2),r!==null&&(vf(a,r,t,s),Re(r,2),rl(r));break}}t=t.return}}function qu(s,t,a){var r=s.pingCache;if(r===null){r=s.pingCache=new Sy;var o=new Set;r.set(t,o)}else o=r.get(t),o===void 0&&(o=new Set,r.set(t,o));o.has(a)||($u=!0,o.add(a),s=My.bind(null,s,t,a),t.then(s,s))}function My(s,t,a){var r=s.pingCache;r!==null&&r.delete(t),s.pingedLanes|=s.suspendedLanes&a,s.warmLanes&=~a,Ws===s&&(Ts&a)===a&&(Nt===4||Nt===3&&(Ts&62914560)===Ts&&300>mt()-to?(Ps&2)===0&&Mr(s,0):Bu|=a,Tr===Ts&&(Tr=0)),rl(s)}function jp(s,t){t===0&&(t=se()),s=kn(s,t),s!==null&&(Re(s,t),rl(s))}function zy(s){var t=s.memoizedState,a=0;t!==null&&(a=t.retryLane),jp(s,a)}function Ay(s,t){var a=0;switch(s.tag){case 31:case 13:var r=s.stateNode,o=s.memoizedState;o!==null&&(a=o.retryLane);break;case 19:r=s.stateNode;break;case 22:r=s.stateNode._retryCache;break;default:throw Error(c(314))}r!==null&&r.delete(t),jp(s,a)}function Dy(s,t){return Ut(s,t)}var oo=null,Ar=null,Ku=!1,uo=!1,Qu=!1,tn=0;function rl(s){s!==Ar&&s.next===null&&(Ar===null?oo=Ar=s:Ar=Ar.next=s),uo=!0,Ku||(Ku=!0,Ry())}function Mi(s,t){if(!Qu&&uo){Qu=!0;do for(var a=!1,r=oo;r!==null;){if(s!==0){var o=r.pendingLanes;if(o===0)var m=0;else{var j=r.suspendedLanes,k=r.pingedLanes;m=(1<<31-bs(42|s)+1)-1,m&=o&~(j&~k),m=m&201326741?m&201326741|1:m?m|2:0}m!==0&&(a=!0,yp(r,m))}else m=Ts,m=tl(r,r===Ws?m:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),(m&3)===0||ul(r,m)||(a=!0,yp(r,m));r=r.next}while(a);Qu=!1}}function Oy(){vp()}function vp(){uo=Ku=!1;var s=0;tn!==0&&Vy()&&(s=tn);for(var t=mt(),a=null,r=oo;r!==null;){var o=r.next,m=Np(r,t);m===0?(r.next=null,a===null?oo=o:a.next=o,o===null&&(Ar=a)):(a=r,(s!==0||(m&3)!==0)&&(uo=!0)),r=o}Rt!==0&&Rt!==5||Mi(s),tn!==0&&(tn=0)}function Np(s,t){for(var a=s.suspendedLanes,r=s.pingedLanes,o=s.expirationTimes,m=s.pendingLanes&-62914561;0k)break;var ve=$.transferSize,ye=$.initiatorType;ve&&Mp(ye)&&($=$.responseEnd,j+=ve*($"u"?null:document;function Hp(s,t,a){var r=Dr;if(r&&typeof t=="string"&&t){var o=Ra(t);o='link[rel="'+s+'"][href="'+o+'"]',typeof a=="string"&&(o+='[crossorigin="'+a+'"]'),Pp.has(o)||(Pp.add(o),s={rel:s,crossOrigin:a,href:t},r.querySelector(o)===null&&(t=r.createElement("link"),Kt(t,"link",s),It(t),r.head.appendChild(t)))}}function e0(s){El.D(s),Hp("dns-prefetch",s,null)}function s0(s,t){El.C(s,t),Hp("preconnect",s,t)}function t0(s,t,a){El.L(s,t,a);var r=Dr;if(r&&s&&t){var o='link[rel="preload"][as="'+Ra(t)+'"]';t==="image"&&a&&a.imageSrcSet?(o+='[imagesrcset="'+Ra(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(o+='[imagesizes="'+Ra(a.imageSizes)+'"]')):o+='[href="'+Ra(s)+'"]';var m=o;switch(t){case"style":m=Or(s);break;case"script":m=Rr(s)}Fa.has(m)||(s=v({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:s,as:t},a),Fa.set(m,s),r.querySelector(o)!==null||t==="style"&&r.querySelector(Oi(m))||t==="script"&&r.querySelector(Ri(m))||(t=r.createElement("link"),Kt(t,"link",s),It(t),r.head.appendChild(t)))}}function a0(s,t){El.m(s,t);var a=Dr;if(a&&s){var r=t&&typeof t.as=="string"?t.as:"script",o='link[rel="modulepreload"][as="'+Ra(r)+'"][href="'+Ra(s)+'"]',m=o;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":m=Rr(s)}if(!Fa.has(m)&&(s=v({rel:"modulepreload",href:s},t),Fa.set(m,s),a.querySelector(o)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Ri(m)))return}r=a.createElement("link"),Kt(r,"link",s),It(r),a.head.appendChild(r)}}}function l0(s,t,a){El.S(s,t,a);var r=Dr;if(r&&s){var o=tr(r).hoistableStyles,m=Or(s);t=t||"default";var j=o.get(m);if(!j){var k={loading:0,preload:null};if(j=r.querySelector(Oi(m)))k.loading=5;else{s=v({rel:"stylesheet",href:s,"data-precedence":t},a),(a=Fa.get(m))&&dm(s,a);var $=j=r.createElement("link");It($),Kt($,"link",s),$._p=new Promise(function(ae,ve){$.onload=ae,$.onerror=ve}),$.addEventListener("load",function(){k.loading|=1}),$.addEventListener("error",function(){k.loading|=2}),k.loading|=4,po(j,t,r)}j={type:"stylesheet",instance:j,count:1,state:k},o.set(m,j)}}}function n0(s,t){El.X(s,t);var a=Dr;if(a&&s){var r=tr(a).hoistableScripts,o=Rr(s),m=r.get(o);m||(m=a.querySelector(Ri(o)),m||(s=v({src:s,async:!0},t),(t=Fa.get(o))&&um(s,t),m=a.createElement("script"),It(m),Kt(m,"link",s),a.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},r.set(o,m))}}function r0(s,t){El.M(s,t);var a=Dr;if(a&&s){var r=tr(a).hoistableScripts,o=Rr(s),m=r.get(o);m||(m=a.querySelector(Ri(o)),m||(s=v({src:s,async:!0,type:"module"},t),(t=Fa.get(o))&&um(s,t),m=a.createElement("script"),It(m),Kt(m,"link",s),a.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},r.set(o,m))}}function Fp(s,t,a,r){var o=(o=V.current)?fo(o):null;if(!o)throw Error(c(446));switch(s){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=Or(a.href),a=tr(o).hoistableStyles,r=a.get(t),r||(r={type:"style",instance:null,count:0,state:null},a.set(t,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){s=Or(a.href);var m=tr(o).hoistableStyles,j=m.get(s);if(j||(o=o.ownerDocument||o,j={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},m.set(s,j),(m=o.querySelector(Oi(s)))&&!m._p&&(j.instance=m,j.state.loading=5),Fa.has(s)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Fa.set(s,a),m||i0(o,s,a,j.state))),t&&r===null)throw Error(c(528,""));return j}if(t&&r!==null)throw Error(c(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Rr(a),a=tr(o).hoistableScripts,r=a.get(t),r||(r={type:"script",instance:null,count:0,state:null},a.set(t,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(c(444,s))}}function Or(s){return'href="'+Ra(s)+'"'}function Oi(s){return'link[rel="stylesheet"]['+s+"]"}function Gp(s){return v({},s,{"data-precedence":s.precedence,precedence:null})}function i0(s,t,a,r){s.querySelector('link[rel="preload"][as="style"]['+t+"]")?r.loading=1:(t=s.createElement("link"),r.preload=t,t.addEventListener("load",function(){return r.loading|=1}),t.addEventListener("error",function(){return r.loading|=2}),Kt(t,"link",a),It(t),s.head.appendChild(t))}function Rr(s){return'[src="'+Ra(s)+'"]'}function Ri(s){return"script[async]"+s}function Vp(s,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var r=s.querySelector('style[data-href~="'+Ra(a.href)+'"]');if(r)return t.instance=r,It(r),r;var o=v({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return r=(s.ownerDocument||s).createElement("style"),It(r),Kt(r,"style",o),po(r,a.precedence,s),t.instance=r;case"stylesheet":o=Or(a.href);var m=s.querySelector(Oi(o));if(m)return t.state.loading|=4,t.instance=m,It(m),m;r=Gp(a),(o=Fa.get(o))&&dm(r,o),m=(s.ownerDocument||s).createElement("link"),It(m);var j=m;return j._p=new Promise(function(k,$){j.onload=k,j.onerror=$}),Kt(m,"link",r),t.state.loading|=4,po(m,a.precedence,s),t.instance=m;case"script":return m=Rr(a.src),(o=s.querySelector(Ri(m)))?(t.instance=o,It(o),o):(r=a,(o=Fa.get(m))&&(r=v({},a),um(r,o)),s=s.ownerDocument||s,o=s.createElement("script"),It(o),Kt(o,"link",r),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&&(r=t.instance,t.state.loading|=4,po(r,a.precedence,s));return t.instance}function po(s,t,a){for(var r=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),o=r.length?r[r.length-1]:null,m=o,j=0;j title"):null)}function c0(s,t,a){if(a===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 Qp(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function o0(s,t,a,r){if(a.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var o=Or(r.href),m=t.querySelector(Oi(o));if(m){t=m._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(s.count++,s=jo.bind(s),t.then(s,s)),a.state.loading|=4,a.instance=m,It(m);return}m=t.ownerDocument||t,r=Gp(r),(o=Fa.get(o))&&dm(r,o),m=m.createElement("link"),It(m);var j=m;j._p=new Promise(function(k,$){j.onload=k,j.onerror=$}),Kt(m,"link",r),a.instance=m}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(s.count++,a=jo.bind(s),t.addEventListener("load",a),t.addEventListener("error",a))}}var mm=0;function d0(s,t){return s.stylesheets&&s.count===0&&No(s,s.stylesheets),0mm?50:800)+t);return s.unsuspend=a,function(){s.unsuspend=null,clearTimeout(r),clearTimeout(o)}}:null}function jo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)No(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var vo=null;function No(s,t){s.stylesheets=null,s.unsuspend!==null&&(s.count++,vo=new Map,t.forEach(u0,s),vo=null,jo.call(s))}function u0(s,t){if(!(t.state.loading&4)){var a=vo.get(s);if(a)var r=a.get(null);else{a=new Map,vo.set(s,a);for(var o=s.querySelectorAll("link[data-precedence],style[data-precedence]"),m=0;m"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l)}catch(n){console.error(n)}}return l(),ym.exports=s_(),ym.exports}var a_=t_();function P(...l){return z0(A0(l))}const Te=d.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:P("rounded-xl border bg-card text-card-foreground shadow",l),...n}));Te.displayName="Card";const Oe=d.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:P("flex flex-col space-y-1.5 p-6",l),...n}));Oe.displayName="CardHeader";const Le=d.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:P("font-semibold leading-none tracking-tight",l),...n}));Le.displayName="CardTitle";const ws=d.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:P("text-sm text-muted-foreground",l),...n}));ws.displayName="CardDescription";const Ae=d.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:P("p-6 pt-0",l),...n}));Ae.displayName="CardContent";const Wo=d.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:P("flex items-center p-6 pt-0",l),...n}));Wo.displayName="CardFooter";const ta=O0,Xt=d.forwardRef(({className:l,...n},i)=>e.jsx(Hg,{ref:i,className:P("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",l),...n}));Xt.displayName=Hg.displayName;const Xe=d.forwardRef(({className:l,...n},i)=>e.jsx(Fg,{ref:i,className:P("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",l),...n}));Xe.displayName=Fg.displayName;const ys=d.forwardRef(({className:l,...n},i)=>e.jsx(Gg,{ref:i,className:P("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",l),...n}));ys.displayName=Gg.displayName;const Je=d.forwardRef(({className:l,children:n,viewportRef:i,...c},u)=>e.jsxs(Vg,{ref:u,className:P("relative overflow-hidden",l),...c,children:[e.jsx(R0,{ref:i,className:"h-full w-full rounded-[inherit]",children:n}),e.jsx(Um,{}),e.jsx(Um,{orientation:"horizontal"}),e.jsx(L0,{})]}));Je.displayName=Vg.displayName;const Um=d.forwardRef(({className:l,orientation:n="vertical",...i},c)=>e.jsx(qg,{ref:c,orientation:n,className:P("flex touch-none select-none transition-colors",n==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",n==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",l),...i,children:e.jsx(U0,{className:"relative flex-1 rounded-full bg-border"})}));Um.displayName=qg.displayName;function js({className:l,...n}){return e.jsx("div",{className:P("animate-pulse rounded-md bg-primary/10",l),...n})}const Qn=d.forwardRef(({className:l,value:n,...i},c)=>e.jsx(Kg,{ref:c,className:P("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",l),...i,children:e.jsx($0,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(n||0)}%)`}})}));Qn.displayName=Kg.displayName;async function _e(l,n){const c=n?.body instanceof FormData?{...n?.headers}:{"Content-Type":"application/json",...n?.headers},u={...n,credentials:"include",headers:c},x=await fetch(l,u);if(x.status===401)throw window.location.href="/auth",new Error("认证失败,请重新登录");return x}function Fs(){return{"Content-Type":"application/json"}}async function l_(){try{await fetch("/api/webui/auth/logout",{method:"POST",credentials:"include"})}catch(l){console.error("登出请求失败:",l)}window.location.href="/auth"}async function ac(){try{return(await(await fetch("/api/webui/auth/check",{method:"GET",credentials:"include"})).json()).authenticated===!0}catch{return!1}}const n_={light:"",dark:".dark"},lv=d.createContext(null);function nv(){const l=d.useContext(lv);if(!l)throw new Error("useChart must be used within a ");return l}const Br=d.forwardRef(({id:l,className:n,children:i,config:c,...u},x)=>{const h=d.useId(),f=`chart-${l||h.replace(/:/g,"")}`;return e.jsx(lv.Provider,{value:{config:c},children:e.jsxs("div",{"data-chart":f,ref:x,className:P("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",n),...u,children:[e.jsx(r_,{id:f,config:c}),e.jsx(uj,{children:i})]})})});Br.displayName="Chart";const r_=({id:l,config:n})=>{const i=Object.entries(n).filter(([,c])=>c.theme||c.color);return i.length?e.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(n_).map(([c,u])=>` +${u} [data-chart=${l}] { +${i.map(([x,h])=>{const f=h.theme?.[c]||h.color;return f?` --color-${x}: ${f};`:null}).join(` +`)} +} +`).join(` +`)}}):null},Pi=mj,Ir=d.forwardRef(({active:l,payload:n,className:i,indicator:c="dot",hideLabel:u=!1,hideIndicator:x=!1,label:h,labelFormatter:f,labelClassName:p,formatter:g,color:N,nameKey:v,labelKey:b},w)=>{const{config:y}=nv(),R=d.useMemo(()=>{if(u||!n?.length)return null;const[S]=n,B=`${b||S?.dataKey||S?.name||"value"}`,M=$m(y,S,B),C=!b&&typeof h=="string"?y[h]?.label||h:M?.label;return f?e.jsx("div",{className:P("font-medium",p),children:f(C,n)}):C?e.jsx("div",{className:P("font-medium",p),children:C}):null},[h,f,n,u,p,y,b]);if(!l||!n?.length)return null;const A=n.length===1&&c!=="dot";return e.jsxs("div",{ref:w,className:P("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",i),children:[A?null:R,e.jsx("div",{className:"grid gap-1.5",children:n.filter(S=>S.type!=="none").map((S,B)=>{const M=`${v||S.name||S.dataKey||"value"}`,C=$m(y,S,M),D=N||S.payload.fill||S.color;return e.jsx("div",{className:P("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,B,S.payload):e.jsxs(e.Fragment,{children:[C?.icon?e.jsx(C.icon,{}):!x&&e.jsx("div",{className:P("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:P("flex flex-1 justify-between leading-none",A?"items-end":"items-center"),children:[e.jsxs("div",{className:"grid gap-1.5",children:[A?R: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)})})]})});Ir.displayName="ChartTooltip";const i_=pw,rv=d.forwardRef(({className:l,hideIcon:n=!1,payload:i,verticalAlign:c="bottom",nameKey:u},x)=>{const{config:h}=nv();return i?.length?e.jsx("div",{ref:x,className:P("flex items-center justify-center gap-4",c==="top"?"pb-3":"pt-3",l),children:i.filter(f=>f.type!=="none").map(f=>{const p=`${u||f.dataKey||"value"}`,g=$m(h,f,p);return e.jsxs("div",{className:P("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[g?.icon&&!n?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});rv.displayName="ChartLegend";function $m(l,n,i){if(typeof n!="object"||n===null)return;const c="payload"in n&&typeof n.payload=="object"&&n.payload!==null?n.payload:void 0;let u=i;return i in n&&typeof n[i]=="string"?u=n[i]:c&&i in c&&typeof c[i]=="string"&&(u=c[i]),u in l?l[u]:l[i]}const Kr=Qr("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"}}),_=d.forwardRef(({className:l,variant:n,size:i,asChild:c=!1,...u},x)=>{const h=c?yw:"button";return e.jsx(h,{className:P(Kr({variant:n,size:i,className:l})),ref:x,...u})});_.displayName="Button";const c_=Qr("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:l,variant:n,...i}){return e.jsx("div",{className:P(c_({variant:n}),l),...i})}async function o_(){const l=await _e("/api/webui/system/restart",{method:"POST",headers:Fs()});if(!l.ok){const n=await l.json();throw new Error(n.detail||"重启失败")}return await l.json()}async function d_(){const l=await _e("/api/webui/system/status",{method:"GET",headers:Fs()});if(!l.ok){const n=await l.json();throw new Error(n.detail||"获取状态失败")}return await l.json()}const Ur={INITIAL_DELAY:3e3,CHECK_INTERVAL:2e3,CHECK_TIMEOUT:3e3,MAX_ATTEMPTS:60,PROGRESS_INTERVAL:200,SUCCESS_REDIRECT_DELAY:1500},iv=d.createContext(null);function Jn({children:l,onRestartComplete:n,onRestartFailed:i,healthCheckUrl:c="/api/webui/system/status",maxAttempts:u=Ur.MAX_ATTEMPTS}){const[x,h]=d.useState({status:"idle",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:u}),[f,p]=d.useState({}),g=d.useCallback(()=>{f.progress&&clearInterval(f.progress),f.elapsed&&clearInterval(f.elapsed),f.check&&clearTimeout(f.check),p({})},[f]),N=d.useCallback(()=>{g(),h({status:"idle",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:u})},[g,u]),v=d.useCallback(async()=>{try{const A=new AbortController,S=setTimeout(()=>A.abort(),Ur.CHECK_TIMEOUT),B=await fetch(c,{method:"GET",headers:{"Content-Type":"application/json"},credentials:"include",signal:A.signal});return clearTimeout(S),B.ok}catch{return!1}},[c]),b=d.useCallback(()=>{let A=0;const S=async()=>{if(A++,h(M=>({...M,status:"checking",checkAttempts:A})),await v())g(),h(M=>({...M,status:"success",progress:100})),setTimeout(()=>{n?.(),window.location.href="/auth"},Ur.SUCCESS_REDIRECT_DELAY);else if(A>=u){g();const M=`健康检查超时 (${A}/${u})`;h(C=>({...C,status:"failed",error:M})),i?.(M)}else{const M=setTimeout(S,Ur.CHECK_INTERVAL);p(C=>({...C,check:M}))}};S()},[v,g,u,n,i]),w=d.useCallback(()=>{h(A=>({...A,status:"checking",checkAttempts:0,error:void 0})),b()},[b]),y=d.useCallback(async A=>{const{delay:S=0,skipApiCall:B=!1}=A??{};if(x.status!=="idle"&&x.status!=="failed")return;if(g(),h({status:"requesting",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:u}),S>0&&await new Promise(D=>setTimeout(D,S)),B)h(D=>({...D,status:"restarting"}));else try{h(D=>({...D,status:"restarting"})),await Promise.race([o_(),new Promise(D=>setTimeout(D,5e3))])}catch{}const M=setInterval(()=>{h(D=>({...D,progress:D.progress>=90?D.progress:D.progress+1}))},Ur.PROGRESS_INTERVAL),C=setInterval(()=>{h(D=>({...D,elapsedTime:D.elapsedTime+1}))},1e3);p({progress:M,elapsed:C}),setTimeout(()=>{b()},Ur.INITIAL_DELAY)},[x.status,g,u,b]),R={state:x,isRestarting:x.status!=="idle",triggerRestart:y,resetState:N,retryHealthCheck:w};return e.jsx(iv.Provider,{value:R,children:l})}function vn(){const l=d.useContext(iv);if(!l)throw new Error("useRestart must be used within a RestartProvider");return l}function u_(){try{return vn()}catch{return null}}const m_=(l,n,i,c,u)=>({idle:{icon:null,title:"",description:"",tip:""},requesting:{icon:e.jsx(Bs,{className:"h-16 w-16 text-primary animate-spin"}),title:c??"准备重启",description:u??"正在发送重启请求...",tip:"🔄 正在准备重启麦麦..."},restarting:{icon:e.jsx(Bs,{className:"h-16 w-16 text-primary animate-spin"}),title:c??"正在重启麦麦",description:u??"请稍候,麦麦正在重启中...",tip:"🔄 配置已保存,正在重启主程序..."},checking:{icon:e.jsx(Bs,{className:"h-16 w-16 text-primary animate-spin"}),title:"检查服务状态",description:`等待服务恢复... (${n}/${i})`,tip:"⏳ 正在等待服务恢复,请勿关闭页面..."},success:{icon:e.jsx(pt,{className:"h-16 w-16 text-green-500"}),title:"重启成功",description:"正在跳转到登录页面...",tip:"✅ 配置已生效,服务运行正常"},failed:{icon:e.jsx(_t,{className:"h-16 w-16 text-destructive"}),title:"重启超时",description:"服务未能在预期时间内恢复",tip:"⚠️ 如果长时间无响应,请尝试手动重启"}})[l];function Xn({visible:l,onComplete:n,onFailed:i,title:c,description:u,showAnimation:x=!0,className:h}){const f=u_();return(f?f.isRestarting:l)?f?e.jsx(cv,{state:f.state,onRetry:f.retryHealthCheck,onComplete:n,onFailed:i,title:c,description:u,showAnimation:x,className:h}):e.jsx(x_,{onComplete:n,onFailed:i,title:c,description:u,showAnimation:x,className:h}):null}function cv({state:l,onRetry:n,onComplete:i,onFailed:c,title:u,description:x,showAnimation:h,className:f}){const{status:p,progress:g,elapsedTime:N,checkAttempts:v,maxAttempts:b}=l;d.useEffect(()=>{p==="success"&&i?i():p==="failed"&&c&&c()},[p,i,c]);const w=m_(p,v,b,u,x),y=R=>{const A=Math.floor(R/60),S=R%60;return`${A}:${S.toString().padStart(2,"0")}`};return e.jsxs("div",{className:P("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:[w.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:w.title}),e.jsx("p",{className:"text-muted-foreground text-center",children:w.description})]}),p!=="failed"&&p!=="idle"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(Qn,{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:["已用时: ",y(N)]})]})]}),e.jsx("div",{className:"bg-muted/50 rounded-lg p-4",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:w.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(dt,{className:"mr-2 h-4 w-4"}),"刷新页面"]}),e.jsxs(_,{onClick:n,variant:"secondary",className:"flex-1",children:[e.jsx(Wi,{className:"mr-2 h-4 w-4"}),"重试检测"]})]})]})]})}function x_({onComplete:l,onFailed:n,title:i,description:c,showAnimation:u,className:x}){const[h,f]=d.useState({status:"restarting",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:60}),p=d.useCallback(()=>{let g=0;const N=60,v=async()=>{g++,f(b=>({...b,status:"checking",checkAttempts:g}));try{if((await fetch("/api/webui/system/status",{method:"GET",signal:AbortSignal.timeout(3e3)})).ok){f(w=>({...w,status:"success",progress:100})),setTimeout(()=>{l?.(),window.location.href="/auth"},1500);return}}catch{}g>=N?(f(b=>({...b,status:"failed"})),n?.()):setTimeout(v,2e3)};v()},[l,n]);return d.useEffect(()=>{const g=setInterval(()=>{f(b=>({...b,progress:b.progress>=90?b.progress:b.progress+1}))},200),N=setInterval(()=>{f(b=>({...b,elapsedTime:b.elapsedTime+1}))},1e3),v=setTimeout(()=>{p()},3e3);return()=>{clearInterval(g),clearInterval(N),clearTimeout(v)}},[p]),e.jsx(cv,{state:h,onRetry:p,onComplete:l,onFailed:n,title:i,description:c,showAnimation:u,className:x})}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 Is=Sw,ed=kw,f_=ww,ov=d.forwardRef(({className:l,...n},i)=>e.jsx(xj,{ref:i,className:P("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",l),...n}));ov.displayName=xj.displayName;const Ds=d.forwardRef(({className:l,children:n,preventOutsideClose:i=!1,...c},u)=>e.jsxs(f_,{children:[e.jsx(ov,{}),e.jsxs(hj,{ref:u,className:P("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",l),onPointerDownOutside:i?x=>x.preventDefault():void 0,onInteractOutside:i?x=>x.preventDefault():void 0,...c,children:[n,e.jsxs(_w,{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(Ea,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ds.displayName=hj.displayName;const Os=({className:l,...n})=>e.jsx("div",{className:P("flex flex-col space-y-1.5 text-center sm:text-left",l),...n});Os.displayName="DialogHeader";const st=({className:l,...n})=>e.jsx("div",{className:P("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",l),...n});st.displayName="DialogFooter";const Rs=d.forwardRef(({className:l,...n},i)=>e.jsx(fj,{ref:i,className:P("text-lg font-semibold leading-none tracking-tight",l),...n}));Rs.displayName=fj.displayName;const Ks=d.forwardRef(({className:l,...n},i)=>e.jsx(pj,{ref:i,className:P("text-sm text-muted-foreground",l),...n}));Ks.displayName=pj.displayName;const le=d.forwardRef(({className:l,type:n,...i},c)=>e.jsx("input",{type:n,className:P("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",l),ref:c,...i}));le.displayName="Input";const qs=d.forwardRef(({className:l,...n},i)=>e.jsx(gj,{ref:i,className:P("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",l),...n,children:e.jsx(Cw,{className:P("grid place-content-center text-current"),children:e.jsx(Ct,{className:"h-4 w-4"})})}));qs.displayName=gj.displayName;const Ie=Dw,Pe=Ow,$e=d.forwardRef(({className:l,children:n,...i},c)=>e.jsxs(jj,{ref:c,className:P("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",l),...i,children:[n,e.jsx(Tw,{asChild:!0,children:e.jsx(Ma,{className:"h-4 w-4 opacity-50"})})]}));$e.displayName=jj.displayName;const dv=d.forwardRef(({className:l,...n},i)=>e.jsx(vj,{ref:i,className:P("flex cursor-default items-center justify-center py-1",l),...n,children:e.jsx(Fr,{className:"h-4 w-4"})}));dv.displayName=vj.displayName;const uv=d.forwardRef(({className:l,...n},i)=>e.jsx(Nj,{ref:i,className:P("flex cursor-default items-center justify-center py-1",l),...n,children:e.jsx(Ma,{className:"h-4 w-4"})}));uv.displayName=Nj.displayName;const Be=d.forwardRef(({className:l,children:n,position:i="popper",...c},u)=>e.jsx(Ew,{children:e.jsxs(bj,{ref:u,className:P("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]",i==="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",l),position:i,...c,children:[e.jsx(dv,{}),e.jsx(Mw,{className:P("p-1",i==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:n}),e.jsx(uv,{})]})}));Be.displayName=bj.displayName;const p_=d.forwardRef(({className:l,...n},i)=>e.jsx(yj,{ref:i,className:P("px-2 py-1.5 text-sm font-semibold",l),...n}));p_.displayName=yj.displayName;const Z=d.forwardRef(({className:l,children:n,...i},c)=>e.jsxs(wj,{ref:c,className:P("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",l),...i,children:[e.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(zw,{children:e.jsx(Ct,{className:"h-4 w-4"})})}),e.jsx(Aw,{children:n})]}));Z.displayName=wj.displayName;const g_=d.forwardRef(({className:l,...n},i)=>e.jsx(_j,{ref:i,className:P("-mx-1 my-1 h-px bg-muted",l),...n}));g_.displayName=_j.displayName;const Zm=({className:l,...n})=>e.jsx("nav",{role:"navigation","aria-label":"pagination",className:P("mx-auto flex w-full justify-center",l),...n});Zm.displayName="Pagination";const Wm=d.forwardRef(({className:l,...n},i)=>e.jsx("ul",{ref:i,className:P("flex flex-row items-center gap-1",l),...n}));Wm.displayName="PaginationContent";const Fn=d.forwardRef(({className:l,...n},i)=>e.jsx("li",{ref:i,className:P("",l),...n}));Fn.displayName="PaginationItem";const uc=({className:l,isActive:n,size:i="icon",...c})=>e.jsx("a",{"aria-current":n?"page":void 0,className:P(Kr({variant:n?"outline":"ghost",size:i}),l),...c});uc.displayName="PaginationLink";const mv=({className:l,...n})=>e.jsxs(uc,{"aria-label":"Go to previous page",size:"default",className:P("gap-1 pl-2.5",l),...n,children:[e.jsx(Aa,{className:"h-4 w-4"}),e.jsx("span",{children:"上一页"})]});mv.displayName="PaginationPrevious";const xv=({className:l,...n})=>e.jsxs(uc,{"aria-label":"Go to next page",size:"default",className:P("gap-1 pr-2.5",l),...n,children:[e.jsx("span",{children:"下一页"}),e.jsx(Zt,{className:"h-4 w-4"})]});xv.displayName="PaginationNext";const hv=({className:l,...n})=>e.jsxs("span",{"aria-hidden":!0,className:P("flex h-9 w-9 items-center justify-center",l),...n,children:[e.jsx(Vw,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"More pages"})]});hv.displayName="PaginationEllipsis";const j_=5,v_=5e3;let Sm=0;function N_(){return Sm=(Sm+1)%Number.MAX_SAFE_INTEGER,Sm.toString()}const km=new Map,gg=l=>{if(km.has(l))return;const n=setTimeout(()=>{km.delete(l),Ji({type:"REMOVE_TOAST",toastId:l})},v_);km.set(l,n)},b_=(l,n)=>{switch(n.type){case"ADD_TOAST":return{...l,toasts:[n.toast,...l.toasts].slice(0,j_)};case"UPDATE_TOAST":return{...l,toasts:l.toasts.map(i=>i.id===n.toast.id?{...i,...n.toast}:i)};case"DISMISS_TOAST":{const{toastId:i}=n;return i?gg(i):l.toasts.forEach(c=>{gg(c.id)}),{...l,toasts:l.toasts.map(c=>c.id===i||i===void 0?{...c,open:!1}:c)}}case"REMOVE_TOAST":return n.toastId===void 0?{...l,toasts:[]}:{...l,toasts:l.toasts.filter(i=>i.id!==n.toastId)}}},Oo=[];let Ro={toasts:[]};function Ji(l){Ro=b_(Ro,l),Oo.forEach(n=>{n(Ro)})}function Qt({...l}){const n=N_(),i=u=>Ji({type:"UPDATE_TOAST",toast:{...u,id:n}}),c=()=>Ji({type:"DISMISS_TOAST",toastId:n});return Ji({type:"ADD_TOAST",toast:{...l,id:n,open:!0,onOpenChange:u=>{u||c()}}}),{id:n,dismiss:c,update:i}}function Zs(){const[l,n]=d.useState(Ro);return d.useEffect(()=>(Oo.push(n),()=>{const i=Oo.indexOf(n);i>-1&&Oo.splice(i,1)}),[l]),{...l,toast:Qt,dismiss:i=>Ji({type:"DISMISS_TOAST",toastId:i})}}const el="/api/webui/expression";async function ex(){const l=await _e(`${el}/chats`,{});if(!l.ok){const n=await l.json();throw new Error(n.detail||"获取聊天列表失败")}return l.json()}async function y_(l){const n=new URLSearchParams;l.page&&n.append("page",l.page.toString()),l.page_size&&n.append("page_size",l.page_size.toString()),l.search&&n.append("search",l.search),l.chat_id&&n.append("chat_id",l.chat_id);const i=await _e(`${el}/list?${n}`,{});if(!i.ok){const c=await i.json();throw new Error(c.detail||"获取表达方式列表失败")}return i.json()}async function w_(l){const n=await _e(`${el}/${l}`,{});if(!n.ok){const i=await n.json();throw new Error(i.detail||"获取表达方式详情失败")}return n.json()}async function __(l){const n=await _e(`${el}/`,{method:"POST",body:JSON.stringify(l)});if(!n.ok){const i=await n.json();throw new Error(i.detail||"创建表达方式失败")}return n.json()}async function S_(l,n){const i=await _e(`${el}/${l}`,{method:"PATCH",body:JSON.stringify(n)});if(!i.ok){const c=await i.json();throw new Error(c.detail||"更新表达方式失败")}return i.json()}async function k_(l){const n=await _e(`${el}/${l}`,{method:"DELETE"});if(!n.ok){const i=await n.json();throw new Error(i.detail||"删除表达方式失败")}return n.json()}async function C_(l){const n=await _e(`${el}/batch/delete`,{method:"POST",body:JSON.stringify({ids:l})});if(!n.ok){const i=await n.json();throw new Error(i.detail||"批量删除表达方式失败")}return n.json()}async function T_(){const l=await _e(`${el}/stats/summary`,{});if(!l.ok){const n=await l.json();throw new Error(n.detail||"获取统计数据失败")}return l.json()}async function sx(){const l=await _e(`${el}/review/stats`);if(!l.ok){const n=await l.json();throw new Error(n.detail||"获取审核统计失败")}return l.json()}async function E_(l){const n=new URLSearchParams;l.page&&n.append("page",l.page.toString()),l.page_size&&n.append("page_size",l.page_size.toString()),l.filter_type&&n.append("filter_type",l.filter_type),l.search&&n.append("search",l.search),l.chat_id&&n.append("chat_id",l.chat_id);const i=await _e(`${el}/review/list?${n}`);if(!i.ok){const c=await i.json();throw new Error(c.detail||"获取审核列表失败")}return i.json()}async function jg(l){const n=await _e(`${el}/review/batch`,{method:"POST",body:JSON.stringify({items:l})});if(!n.ok){const i=await n.json();throw new Error(i.detail||"批量审核失败")}return n.json()}function fv({open:l,onOpenChange:n}){const[i,c]=d.useState(null),[u,x]=d.useState([]),[h,f]=d.useState(!1),[p,g]=d.useState(!1),[N,v]=d.useState(0),[b,w]=d.useState(1),[y,R]=d.useState(20),[A,S]=d.useState(""),[B,M]=d.useState("unchecked"),[C,D]=d.useState(""),[H,L]=d.useState(""),[J,U]=d.useState(new Set),[oe,Ne]=d.useState(new Set),[je,re]=d.useState(new Map),{toast:fe}=Zs(),ge=d.useCallback(async()=>{try{g(!0);const Y=await sx();c(Y)}catch(Y){console.error("加载统计失败:",Y)}finally{g(!1)}},[]),E=d.useCallback(async()=>{try{f(!0);const Y=await E_({page:b,page_size:y,filter_type:B,search:C||void 0});x(Y.data),v(Y.total)}catch(Y){fe({title:"加载失败",description:Y instanceof Error?Y.message:"无法加载列表",variant:"destructive"})}finally{f(!1)}},[b,y,B,C,fe]),K=d.useCallback(async()=>{try{const Y=await ex();if(Y?.data){const He=new Map;Y.data.forEach(F=>{He.set(F.chat_id,F.chat_name)}),re(He)}}catch(Y){console.error("加载聊天名称失败:",Y)}},[]);d.useEffect(()=>{l&&(ge(),E(),K())},[l,ge,E,K]),d.useEffect(()=>{w(1),U(new Set)},[B,C]);const I=()=>{D(H),w(1)},ue=Y=>je.get(Y)||Y,Q=async(Y,He)=>{try{Ne(ee=>new Set(ee).add(Y));const F=await jg([{id:Y,rejected:He,require_unchecked:B==="unchecked"}]);F.results[0]?.success?(fe({title:He?"已拒绝":"已通过",description:`表达方式 #${Y} ${He?"已拒绝":"已通过"}`}),E(),ge()):fe({title:"操作失败",description:F.results[0]?.message||"未知错误",variant:"destructive"})}catch(F){fe({title:"操作失败",description:F instanceof Error?F.message:"未知错误",variant:"destructive"})}finally{Ne(F=>{const ee=new Set(F);return ee.delete(Y),ee})}},Se=async Y=>{if(J.size===0){fe({title:"请选择",description:"请先选择要审核的表达方式",variant:"destructive"});return}try{f(!0);const He=Array.from(J).map(ee=>({id:ee,rejected:Y,require_unchecked:B==="unchecked"})),F=await jg(He);fe({title:"批量审核完成",description:`成功 ${F.succeeded} 条,失败 ${F.failed} 条`,variant:F.failed>0?"destructive":"default"}),U(new Set),E(),ge()}catch(He){fe({title:"批量审核失败",description:He instanceof Error?He.message:"未知错误",variant:"destructive"})}finally{f(!1)}},pe=()=>{J.size===u.length?U(new Set):U(new Set(u.map(Y=>Y.id)))},Ce=Y=>{U(He=>{const F=new Set(He);return F.has(Y)?F.delete(Y):F.add(Y),F})},z=Y=>Y?new Date(Y*1e3).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"-",O=Y=>Y.checked?Y.rejected?e.jsxs(ke,{variant:"destructive",className:"gap-1",children:[e.jsx(Va,{className:"h-3 w-3"}),"已拒绝"]}):e.jsxs(ke,{variant:"default",className:"gap-1 bg-green-600",children:[e.jsx(pt,{className:"h-3 w-3"}),"已通过"]}):e.jsxs(ke,{variant:"outline",className:"gap-1",children:[e.jsx(na,{className:"h-3 w-3"}),"待审核"]}),V=Y=>Y?Y==="ai"?e.jsxs(ke,{variant:"secondary",className:"gap-1 text-xs",children:[e.jsx(Pn,{className:"h-3 w-3"}),"AI"]}):e.jsxs(ke,{variant:"secondary",className:"gap-1 text-xs",children:[e.jsx(fn,{className:"h-3 w-3"}),"人工"]}):null,de=Math.ceil(N/y),De=()=>{const Y=[];if(de<=7)for(let He=1;He<=de;He++)Y.push(He);else{Y.push(1),b>3&&Y.push("ellipsis");const He=Math.max(2,b-1),F=Math.min(de-1,b+1);for(let ee=He;ee<=F;ee++)Y.push(ee);b1&&Y.push(de)}return Y},W=()=>{const Y=parseInt(A,10);!isNaN(Y)&&Y>=1&&Y<=de&&(w(Y),S(""))};return e.jsx(Is,{open:l,onOpenChange:n,children:e.jsxs(Ds,{className:"max-w-5xl w-[95vw] sm:w-full h-[90vh] sm:h-[85vh] flex flex-col p-0",children:[e.jsxs(Os,{className:"px-4 sm:px-6 pt-4 sm:pt-6 pb-4 border-b shrink-0",children:[e.jsx(Rs,{className:"text-lg sm:text-xl",children:"表达方式审核"}),e.jsx(Ks,{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?"-":i?.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?"-":i?.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?"-":i?.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?"-":i?.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(ta,{value:B,onValueChange:Y=>M(Y),className:"w-full",children:e.jsxs(Xt,{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:["(",i?.unchecked??0,")"]})]}),e.jsxs(Xe,{value:"passed",className:"gap-1 text-xs sm:text-sm px-1 sm:px-3",children:[e.jsx(pt,{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:["(",i?.passed??0,")"]})]}),e.jsxs(Xe,{value:"rejected",className:"gap-1 text-xs sm:text-sm px-1 sm:px-3",children:[e.jsx(Va,{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:["(",i?.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:["(",i?.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(Tt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(le,{placeholder:"搜索情景或风格...",value:H,onChange:Y=>L(Y.target.value),onKeyDown:Y=>Y.key==="Enter"&&I(),className:"pl-9"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"icon",onClick:I,children:e.jsx(Tt,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"icon",onClick:()=>{E(),ge()},disabled:h,children:e.jsx(dt,{className:P("h-4 w-4",h&&"animate-spin")})})]}),B==="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(pt,{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(Va,{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(Je,{className:"flex-1 px-4 sm:px-6",children:h&&u.length===0?e.jsx("div",{className:"flex items-center justify-center h-40",children:e.jsx(dt,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):u.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-40 text-muted-foreground",children:[e.jsx(_t,{className:"h-8 w-8 mb-2"}),e.jsx("p",{children:"没有找到表达方式"})]}):e.jsxs("div",{className:"space-y-2 py-2",children:[B==="unchecked"&&u.length>0&&e.jsxs("div",{className:"flex items-center gap-2 py-2 px-3 rounded-lg bg-muted/50",children:[e.jsx(qs,{checked:J.size===u.length&&u.length>0,onCheckedChange:pe}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["全选当前页 (",u.length," 条)"]})]}),u.map(Y=>e.jsx("div",{className:P("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:[B==="unchecked"&&e.jsx(qs,{checked:J.has(Y.id),onCheckedChange:()=>Ce(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:z(Y.create_date)}),e.jsxs("div",{className:"flex items-center gap-1",children:[O(Y),V(Y.modified_by)]})]})]}),e.jsx("div",{className:"flex flex-col gap-1 sm:gap-2 shrink-0",children:B==="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:()=>Q(Y.id,!1),disabled:oe.has(Y.id),children:[e.jsx(pt,{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:()=>Q(Y.id,!0),disabled:oe.has(Y.id),children:[e.jsx(Va,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"拒绝"})]})]}):B==="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:()=>Q(Y.id,!0),disabled:oe.has(Y.id),children:[e.jsx(Va,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"改为拒绝"})]}):B==="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:()=>Q(Y.id,!1),disabled:oe.has(Y.id),children:[e.jsx(pt,{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:()=>Q(Y.id,!1),disabled:oe.has(Y.id),children:[e.jsx(pt,{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:()=>Q(Y.id,!0),disabled:oe.has(Y.id),children:[e.jsx(Va,{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:()=>Q(Y.id,!1),disabled:oe.has(Y.id),children:[e.jsx(pt,{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:()=>Q(Y.id,!0),disabled:oe.has(Y.id),children:[e.jsx(Va,{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(Ie,{value:y.toString(),onValueChange:Y=>{R(parseInt(Y,10)),w(1)},children:[e.jsx($e,{className:"w-[70px] h-8",children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"10",children:"10"}),e.jsx(Z,{value:"20",children:"20"}),e.jsx(Z,{value:"50",children:"50"}),e.jsx(Z,{value:"100",children:"100"})]})]}),e.jsx("span",{className:"hidden sm:inline",children:"条"}),e.jsxs("span",{className:"text-muted-foreground",children:["共 ",N," 条"]})]}),e.jsx(Zm,{className:"mx-0 w-auto",children:e.jsxs(Wm,{children:[e.jsx(Fn,{children:e.jsx(_,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>w(Y=>Math.max(1,Y-1)),disabled:b<=1||h,children:e.jsx(Aa,{className:"h-4 w-4"})})}),De().map((Y,He)=>e.jsx(Fn,{children:Y==="ellipsis"?e.jsx(hv,{}):e.jsx(uc,{href:"#",isActive:Y===b,onClick:F=>{F.preventDefault(),w(Y)},className:"h-8 w-8 cursor-pointer",children:Y})},He)),e.jsx(Fn,{children:e.jsx(_,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>w(Y=>Math.min(de,Y+1)),disabled:b>=de||h,children:e.jsx(Zt,{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(le,{type:"number",min:1,max:de,value:A,onChange:Y=>S(Y.target.value),onKeyDown:Y=>Y.key==="Enter"&&W(),className:"w-16 h-8 text-center",placeholder:b.toString()}),e.jsx("span",{className:"text-muted-foreground",children:"页"}),e.jsx(_,{variant:"outline",size:"sm",className:"h-8",onClick:W,disabled:h,children:"跳转"})]})]})]})})}function M_(){return e.jsx(Jn,{children:e.jsx(A_,{})})}const z_=l=>{const n=[];for(let i=0;i{try{const z=await sx();M(z.unchecked)}catch(z){console.error("获取审核统计失败:",z)}},[]),L=d.useCallback(async()=>{try{w(!0);const z=await D0.get("https://v1.hitokoto.cn/?c=a&c=b&c=c&c=d&c=h&c=i&c=k");v({hitokoto:z.data.hitokoto,from:z.data.from||z.data.from_who||"未知"})}catch(z){console.error("获取一言失败:",z),v({hitokoto:"人生就像一盒巧克力,你永远不知道下一颗是什么味道。",from:"阿甘正传"})}finally{w(!1)}},[]),J=d.useCallback(async()=>{try{const z=await _e("/api/webui/system/status");if(z.ok){const O=await z.json();R(O)}else R(null)}catch(z){console.error("获取机器人状态失败:",z),R(null)}},[]),U=async()=>{await C()},oe=d.useCallback(async()=>{try{const z=await _e(`/api/webui/statistics/dashboard?hours=${h}`);if(z.ok){const O=await z.json();n(O)}c(!1),x(100)}catch(z){console.error("Failed to fetch dashboard data:",z),c(!1),x(100)}},[h]);if(d.useEffect(()=>{if(!i)return;x(0);const z=setTimeout(()=>x(15),200),O=setTimeout(()=>x(30),800),V=setTimeout(()=>x(45),2e3),de=setTimeout(()=>x(60),4e3),De=setTimeout(()=>x(75),6500),W=setTimeout(()=>x(85),9e3),Y=setTimeout(()=>x(92),11e3);return()=>{clearTimeout(z),clearTimeout(O),clearTimeout(V),clearTimeout(de),clearTimeout(De),clearTimeout(W),clearTimeout(Y)}},[i]),d.useEffect(()=>{oe(),L(),J(),H()},[oe,L,J,H]),d.useEffect(()=>{if(!p)return;const z=setInterval(()=>{oe(),J()},3e4);return()=>clearInterval(z)},[p,oe,J]),i||!l)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(dt,{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(Qn,{value:u,className:"h-2"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[u,"%"]})]})]})});const{summary:Ne,model_stats:je=[],hourly_data:re=[],daily_data:fe=[],recent_activity:ge=[]}=l,E=Ne??{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},K=z=>{const O=Math.floor(z/3600),V=Math.floor(z%3600/60);return`${O}小时${V}分钟`},I=z=>{const O=z.toLocaleString("zh-CN");return z>=1e9?{display:`${(z/1e9).toFixed(2)}B`,exact:O,needsExact:!0}:z>=1e6?{display:`${(z/1e6).toFixed(2)}M`,exact:O,needsExact:!0}:z>=1e4?{display:`${(z/1e3).toFixed(1)}K`,exact:O,needsExact:!0}:z>=1e3?{display:`${(z/1e3).toFixed(2)}K`,exact:O,needsExact:!0}:{display:O,exact:O,needsExact:!1}},ue=z=>{const O=`¥${z.toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2})}`;return z>=1e6?{display:`¥${(z/1e6).toFixed(2)}M`,exact:O,needsExact:!0}:z>=1e4?{display:`¥${(z/1e3).toFixed(1)}K`,exact:O,needsExact:!0}:z>=1e3?{display:`¥${(z/1e3).toFixed(2)}K`,exact:O,needsExact:!0}:{display:O,exact:O,needsExact:!1}},Q=z=>new Date(z).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),Se=z_(je.length),pe=je.map((z,O)=>({name:z.model_name,value:z.request_count,fill:Se[O]})),Ce={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(Je,{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(ta,{value:h.toString(),onValueChange:z=>f(Number(z)),children:e.jsxs(Xt,{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(dt,{className:`h-4 w-4 ${p?"animate-spin":""}`}),e.jsx("span",{className:"hidden sm:inline",children:"自动刷新"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:oe,children:e.jsx(dt,{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:[b?e.jsx(js,{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:b,children:e.jsx(dt,{className:`h-3.5 w-3.5 ${b?"animate-spin":""}`})})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-3",children:[e.jsxs(Te,{className:"lg:col-span-1",children:[e.jsx(Oe,{className:"pb-3",children:e.jsxs(Le,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(oc,{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:y?.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(pt,{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(_t,{className:"h-3 w-3 mr-1"}),"已停止"]})]})}),y&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:[e.jsxs("span",{children:["v",y.version]}),e.jsx("span",{className:"mx-2",children:"|"}),e.jsxs("span",{children:["运行 ",K(y.uptime)]})]})]})})]}),e.jsxs(Te,{children:[e.jsx(Oe,{className:"pb-3",children:e.jsxs(Le,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Za,{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:U,disabled:D,className:"gap-2",children:[e.jsx(Wi,{className:`h-4 w-4 ${D?"animate-spin":""}`}),D?"重启中...":"重启麦麦"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>S(!0),className:"gap-2",children:[e.jsx(Oj,{className:"h-4 w-4"}),"表达审核",B>0&&e.jsx("span",{className:"ml-1 px-1.5 py-0.5 text-xs rounded-full bg-orange-500 text-white",children:B>99?"99+":B})]}),e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Bn,{to:"/logs",children:[e.jsx(Ca,{className:"h-4 w-4"}),"查看日志"]})}),e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Bn,{to:"/plugins",children:[e.jsx(qw,{className:"h-4 w-4"}),"插件管理"]})}),e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Bn,{to:"/settings",children:[e.jsx(pn,{className:"h-4 w-4"}),"系统设置"]})})]})})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{className:"pb-3",children:[e.jsxs(Le,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Kw,{className:"h-4 w-4"}),"反馈问卷"]}),e.jsx(ws,{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(Bn,{to:"/survey/webui-feedback",children:[e.jsx(Ca,{className:"h-4 w-4"}),"WebUI 反馈"]})}),e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Bn,{to:"/survey/maibot-feedback",children:[e.jsx(za,{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(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Le,{className:"text-sm font-medium",children:"总请求数"}),e.jsx(Gm,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ae,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[I(E.total_requests).display,I(E.total_requests).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",I(E.total_requests).exact,")"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["最近",h<48?h+"小时":Math.floor(h/24)+"天"]})]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Le,{className:"text-sm font-medium",children:"总花费"}),e.jsx(Qw,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ae,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[ue(E.total_cost).display,ue(E.total_cost).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",ue(E.total_cost).exact,")"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:E.cost_per_hour>0?`¥${E.cost_per_hour.toFixed(2)}/小时`:"暂无数据"})]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Le,{className:"text-sm font-medium",children:"Token消耗"}),e.jsx(Gr,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ae,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[I(E.total_tokens).display,I(E.total_tokens).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",I(E.total_tokens).exact,")"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:E.tokens_per_hour>0?`${I(E.tokens_per_hour).display}/小时`:"暂无数据"})]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Le,{className:"text-sm font-medium",children:"平均响应"}),e.jsx(Za,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ae,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[E.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(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Le,{className:"text-sm font-medium",children:"在线时长"}),e.jsx(na,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(Ae,{children:e.jsxs("div",{className:"text-xl font-bold",children:[K(E.online_time),e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",E.online_time.toLocaleString(),"秒)"]})]})})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Le,{className:"text-sm font-medium",children:"消息处理"}),e.jsx(za,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ae,{children:[e.jsxs("div",{className:"text-xl font-bold",children:[I(E.total_messages).display,I(E.total_messages).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",I(E.total_messages).exact,")"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["回复 ",I(E.total_replies).display,I(E.total_replies).needsExact&&e.jsxs("span",{children:["(",I(E.total_replies).exact,")"]})," 条"]})]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Le,{className:"text-sm font-medium",children:"成本效率"}),e.jsx(Vm,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ae,{children:[e.jsx("div",{className:"text-xl font-bold",children:E.total_messages>0?`¥${(E.total_cost/E.total_messages*100).toFixed(2)}`:"¥0.00"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"每100条消息"})]})]})]}),e.jsxs(ta,{defaultValue:"trends",className:"space-y-4",children:[e.jsxs(Xt,{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(ys,{value:"trends",className:"space-y-4",children:[e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Le,{children:"请求趋势"}),e.jsxs(ws,{children:["最近",h,"小时的请求量变化"]})]}),e.jsx(Ae,{children:e.jsx(Br,{config:Ce,className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:e.jsxs(gw,{data:re,children:[e.jsx(Fi,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Gi,{dataKey:"timestamp",tickFormatter:z=>Q(z),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx($r,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Pi,{content:e.jsx(Ir,{labelFormatter:z=>Q(z)})}),e.jsx(jw,{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(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Le,{children:"花费趋势"}),e.jsx(ws,{children:"API调用成本变化"})]}),e.jsx(Ae,{children:e.jsx(Br,{config:Ce,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:e.jsxs(zo,{data:re,children:[e.jsx(Fi,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Gi,{dataKey:"timestamp",tickFormatter:z=>Q(z),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx($r,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Pi,{content:e.jsx(Ir,{labelFormatter:z=>Q(z)})}),e.jsx(Vi,{dataKey:"cost",fill:"var(--color-cost)"})]})})})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Le,{children:"Token消耗"}),e.jsx(ws,{children:"Token使用量变化"})]}),e.jsx(Ae,{children:e.jsx(Br,{config:Ce,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:e.jsxs(zo,{data:re,children:[e.jsx(Fi,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Gi,{dataKey:"timestamp",tickFormatter:z=>Q(z),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx($r,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Pi,{content:e.jsx(Ir,{labelFormatter:z=>Q(z)})}),e.jsx(Vi,{dataKey:"tokens",fill:"var(--color-tokens)"})]})})})]})]})]}),e.jsx(ys,{value:"models",className:"space-y-4",children:e.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Le,{children:"模型请求分布"}),e.jsxs(ws,{children:["各模型使用占比 (共 ",je.length," 个模型)"]})]}),e.jsx(Ae,{children:e.jsx(Br,{config:Object.fromEntries(je.map((z,O)=>[z.model_name,{label:z.model_name,color:Se[O]}])),className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:e.jsxs(vw,{children:[e.jsx(Pi,{content:e.jsx(Ir,{})}),e.jsx(Nw,{data:pe,cx:"50%",cy:"50%",labelLine:!1,label:({name:z,percent:O})=>O&&O<.05?"":`${z} ${O?(O*100).toFixed(0):0}%`,outerRadius:100,dataKey:"value",children:pe.map((z,O)=>e.jsx(bw,{fill:z.fill},`cell-${O}`))})]})})})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Le,{children:"模型详细统计"}),e.jsx(ws,{children:"请求数、花费和性能"})]}),e.jsx(Ae,{children:e.jsx(Je,{className:"h-[300px] sm:h-[400px]",children:e.jsx("div",{className:"space-y-3",children:je.map((z,O)=>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-${O%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"]})]})]})]},O))})})})]})]})}),e.jsx(ys,{value:"activity",children:e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Le,{children:"最近活动"}),e.jsx(ws,{children:"最新的API调用记录"})]}),e.jsx(Ae,{children:e.jsx(Je,{className:"h-[400px] sm:h-[500px]",children:e.jsx("div",{className:"space-y-2",children:ge.map((z,O)=>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:Q(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})]})]})]},O))})})})]})}),e.jsx(ys,{value:"daily",children:e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Le,{children:"每日统计"}),e.jsx(ws,{children:"最近7天的数据汇总"})]}),e.jsx(Ae,{children:e.jsx(Br,{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(zo,{data:fe,children:[e.jsx(Fi,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Gi,{dataKey:"timestamp",tickFormatter:z=>{const O=new Date(z);return`${O.getMonth()+1}/${O.getDate()}`},stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx($r,{yAxisId:"left",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx($r,{yAxisId:"right",orientation:"right",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Pi,{content:e.jsx(Ir,{labelFormatter:z=>new Date(z).toLocaleDateString("zh-CN")})}),e.jsx(i_,{content:e.jsx(rv,{})}),e.jsx(Vi,{yAxisId:"left",dataKey:"requests",fill:"var(--color-requests)"}),e.jsx(Vi,{yAxisId:"right",dataKey:"cost",fill:"var(--color-cost)"})]})})})]})})]}),e.jsx(Xn,{}),e.jsx(fv,{open:A,onOpenChange:z=>{S(z),z||H()}})]})})}const D_={theme:"system",setTheme:()=>null},pv=d.createContext(D_),tx=()=>{const l=d.useContext(pv);if(l===void 0)throw new Error("useTheme must be used within a ThemeProvider");return l},O_=(l,n,i)=>{const c=document.documentElement.classList.contains("no-animations");if(!document.startViewTransition||c){n(l);return}const u=i.clientX,x=i.clientY,h=Math.hypot(Math.max(u,innerWidth-u),Math.max(x,innerHeight-x));document.startViewTransition(()=>{n(l)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${u}px ${x}px)`,`circle(${h}px at ${u}px ${x}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},gv=d.createContext(void 0),jv=()=>{const l=d.useContext(gv);if(l===void 0)throw new Error("useAnimation must be used within an AnimationProvider");return l},Ge=d.forwardRef(({className:l,...n},i)=>e.jsx(Qg,{className:P("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",l),...n,ref:i,children:e.jsx(B0,{className:P("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=Qg.displayName;const R_=Qr("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),T=d.forwardRef(({className:l,...n},i)=>e.jsx(Sj,{ref:i,className:P(R_(),l),...n}));T.displayName=Sj.displayName;const L_=[{id:"minLength",label:"长度至少 10 位",description:"Token 长度必须大于等于 10 个字符",validate:l=>l.length>=10},{id:"hasUppercase",label:"包含大写字母",description:"至少包含一个大写字母 (A-Z)",validate:l=>/[A-Z]/.test(l)},{id:"hasLowercase",label:"包含小写字母",description:"至少包含一个小写字母 (a-z)",validate:l=>/[a-z]/.test(l)},{id:"hasSpecialChar",label:"包含特殊符号",description:"至少包含一个特殊符号 (!@#$%^&*()_+-=[]{}|;:,.<>?/)",validate:l=>/[!@#$%^&*()_+\-=[\]{}|;:,.<>?/]/.test(l)}];function U_(l){const n=L_.map(c=>({id:c.id,label:c.label,description:c.description,passed:c.validate(l)}));return{isValid:n.every(c=>c.passed),rules:n}}const sd="0.12.1",ax="MaiBot Dashboard",$_=`${ax} v${sd}`,B_=(l="v")=>`${l}${sd}`,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"},cl={theme:"system",accentColor:"blue",enableAnimations:!0,enableWavesBackground:!0,logCacheSize:1e3,logAutoScroll:!0,logFontSize:"xs",logLineSpacing:4,dataSyncInterval:30,wsReconnectInterval:3e3,wsMaxReconnectAttempts:10};function yt(l){const n=vv(l),i=localStorage.getItem(n);if(i===null)return cl[l];const c=cl[l];if(typeof c=="boolean")return i==="true";if(typeof c=="number"){const u=parseFloat(i);return isNaN(u)?c:u}return i}function Pr(l,n){const i=vv(l);localStorage.setItem(i,String(n)),window.dispatchEvent(new CustomEvent("maibot-settings-change",{detail:{key:l,value:n}}))}function I_(){return{theme:yt("theme"),accentColor:yt("accentColor"),enableAnimations:yt("enableAnimations"),enableWavesBackground:yt("enableWavesBackground"),logCacheSize:yt("logCacheSize"),logAutoScroll:yt("logAutoScroll"),logFontSize:yt("logFontSize"),logLineSpacing:yt("logLineSpacing"),dataSyncInterval:yt("dataSyncInterval"),wsReconnectInterval:yt("wsReconnectInterval"),wsMaxReconnectAttempts:yt("wsMaxReconnectAttempts")}}function P_(){const l=I_(),n=localStorage.getItem(pa.COMPLETED_TOURS),i=n?JSON.parse(n):[];return{...l,completedTours:i}}function H_(l){const n=[],i=[];for(const[c,u]of Object.entries(l)){if(c==="completedTours"){Array.isArray(u)?(localStorage.setItem(pa.COMPLETED_TOURS,JSON.stringify(u)),n.push("completedTours")):i.push("completedTours");continue}if(c in cl){const x=c,h=cl[x];if(typeof u==typeof h){if(x==="theme"&&!["light","dark","system"].includes(u)){i.push(c);continue}if(x==="logFontSize"&&!["xs","sm","base"].includes(u)){i.push(c);continue}Pr(x,u),n.push(c)}else i.push(c)}else i.push(c)}return{success:n.length>0,imported:n,skipped:i}}function F_(){for(const l of Object.keys(cl))Pr(l,cl[l]);localStorage.removeItem(pa.COMPLETED_TOURS),window.dispatchEvent(new CustomEvent("maibot-settings-reset"))}function G_(){const l=[],n=[],i=[];for(let c=0;cc.size-i.size),{used:l,items:localStorage.length,details:n}}function V_(l){if(l===0)return"0 B";const n=1024,i=["B","KB","MB"],c=Math.floor(Math.log(l)/Math.log(n));return parseFloat((l/Math.pow(n,c)).toFixed(2))+" "+i[c]}function vv(l){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}[l]}const qa=d.forwardRef(({className:l,...n},i)=>e.jsxs(Yg,{ref:i,className:P("relative flex w-full touch-none select-none items-center",l),...n,children:[e.jsx(I0,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:e.jsx(P0,{className:"absolute h-full bg-primary"})}),e.jsx(H0,{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=Yg.displayName;class q_{ws=null;reconnectTimeout=null;reconnectAttempts=0;heartbeatInterval=null;logCallbacks=new Set;connectionCallbacks=new Set;isConnected=!1;logCache=[];getMaxCacheSize(){return yt("logCacheSize")}getMaxReconnectAttempts(){return yt("wsMaxReconnectAttempts")}getReconnectInterval(){return yt("wsReconnectInterval")}getWebSocketUrl(n){let i;{const c=window.location.protocol==="https:"?"wss:":"ws:",u=window.location.host;i=`${c}//${u}/ws/logs`}return n?`${i}?token=${encodeURIComponent(n)}`:i}async getWsToken(){try{const n=await _e("/api/webui/ws-token",{method:"GET",credentials:"include"});if(!n.ok)return console.error("获取 WebSocket token 失败:",n.status),null;const i=await n.json();return i.success&&i.token?i.token:null}catch(n){return console.error("获取 WebSocket token 失败:",n),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 ac()){console.log("📡 未登录,跳过 WebSocket 连接");return}const i=await this.getWsToken();if(!i){console.log("📡 无法获取 WebSocket token,跳过连接");return}const c=this.getWebSocketUrl(i);try{this.ws=new WebSocket(c),this.ws.onopen=()=>{this.isConnected=!0,this.reconnectAttempts=0,this.notifyConnection(!0),this.startHeartbeat()},this.ws.onmessage=u=>{try{if(u.data==="pong")return;const x=JSON.parse(u.data);this.notifyLog(x)}catch(x){console.error("解析日志消息失败:",x)}},this.ws.onerror=u=>{console.error("❌ WebSocket 错误:",u),this.isConnected=!1,this.notifyConnection(!1)},this.ws.onclose=()=>{this.isConnected=!1,this.notifyConnection(!1),this.stopHeartbeat(),this.attemptReconnect()}}catch(u){console.error("创建 WebSocket 连接失败:",u),this.attemptReconnect()}}attemptReconnect(){const n=this.getMaxReconnectAttempts();if(this.reconnectAttempts>=n)return;this.reconnectAttempts+=1;const i=this.getReconnectInterval(),c=Math.min(i*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(n){return this.logCallbacks.add(n),()=>this.logCallbacks.delete(n)}onConnectionChange(n){return this.connectionCallbacks.add(n),n(this.isConnected),()=>this.connectionCallbacks.delete(n)}notifyLog(n){if(!this.logCache.some(c=>c.id===n.id)){this.logCache.push(n);const c=this.getMaxCacheSize();this.logCache.length>c&&(this.logCache=this.logCache.slice(-c)),this.logCallbacks.forEach(u=>{try{u(n)}catch(x){console.error("日志回调执行失败:",x)}})}}notifyConnection(n){this.connectionCallbacks.forEach(i=>{try{i(n)}catch(c){console.error("连接状态回调执行失败:",c)}})}getAllLogs(){return[...this.logCache]}clearLogs(){this.logCache=[]}getConnectionStatus(){return this.isConnected}}const In=new q_;typeof window<"u"&&setTimeout(()=>{In.connect()},100);const vs=G0,wt=V0,K_=F0,Nv=d.forwardRef(({className:l,...n},i)=>e.jsx(Jg,{className:P("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",l),...n,ref:i}));Nv.displayName=Jg.displayName;const ds=d.forwardRef(({className:l,...n},i)=>e.jsxs(K_,{children:[e.jsx(Nv,{}),e.jsx(Xg,{ref:i,className:P("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",l),...n})]}));ds.displayName=Xg.displayName;const us=({className:l,...n})=>e.jsx("div",{className:P("flex flex-col space-y-2 text-center sm:text-left",l),...n});us.displayName="AlertDialogHeader";const ms=({className:l,...n})=>e.jsx("div",{className:P("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",l),...n});ms.displayName="AlertDialogFooter";const xs=d.forwardRef(({className:l,...n},i)=>e.jsx(Zg,{ref:i,className:P("text-lg font-semibold",l),...n}));xs.displayName=Zg.displayName;const hs=d.forwardRef(({className:l,...n},i)=>e.jsx(Wg,{ref:i,className:P("text-sm text-muted-foreground",l),...n}));hs.displayName=Wg.displayName;const fs=d.forwardRef(({className:l,variant:n,...i},c)=>e.jsx(ej,{ref:c,className:P(Kr({variant:n}),l),...i}));fs.displayName=ej.displayName;const ps=d.forwardRef(({className:l,...n},i)=>e.jsx(sj,{ref:i,className:P(Kr({variant:"outline"}),"mt-2 sm:mt-0",l),...n}));ps.displayName=sj.displayName;function Q_(){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(ta,{defaultValue:"appearance",className:"w-full",children:[e.jsxs(Xt,{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(Yw,{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(Rj,{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(pn,{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(Ht,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"关于"})]})]}),e.jsxs(Je,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[e.jsx(ys,{value:"appearance",className:"mt-0",children:e.jsx(Y_,{})}),e.jsx(ys,{value:"security",className:"mt-0",children:e.jsx(J_,{})}),e.jsx(ys,{value:"other",className:"mt-0",children:e.jsx(X_,{})}),e.jsx(ys,{value:"about",className:"mt-0",children:e.jsx(Z_,{})})]})]})]})}function Ng(l){const n=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%)"}}[l];if(c)n.style.setProperty("--primary",c.hsl),c.gradient?(n.style.setProperty("--primary-gradient",c.gradient),n.classList.add("has-gradient")):(n.style.removeProperty("--primary-gradient"),n.classList.remove("has-gradient"));else if(l.startsWith("#")){const u=x=>{x=x.replace("#","");const h=parseInt(x.substring(0,2),16)/255,f=parseInt(x.substring(2,4),16)/255,p=parseInt(x.substring(4,6),16)/255,g=Math.max(h,f,p),N=Math.min(h,f,p);let v=0,b=0;const w=(g+N)/2;if(g!==N){const y=g-N;switch(b=w>.5?y/(2-g-N):y/(g+N),g){case h:v=((f-p)/y+(flocalStorage.getItem("accent-color")||"blue");d.useEffect(()=>{const g=localStorage.getItem("accent-color")||"blue";Ng(g)},[]);const p=g=>{f(g),localStorage.setItem("accent-color",g),Ng(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(Cm,{value:"light",current:l,onChange:n,label:"浅色",description:"始终使用浅色主题"}),e.jsx(Cm,{value:"dark",current:l,onChange:n,label:"深色",description:"始终使用深色主题"}),e.jsx(Cm,{value:"system",current:l,onChange:n,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(Ga,{value:"blue",current:h,onChange:p,label:"蓝色",colorClass:"bg-blue-500"}),e.jsx(Ga,{value:"purple",current:h,onChange:p,label:"紫色",colorClass:"bg-purple-500"}),e.jsx(Ga,{value:"green",current:h,onChange:p,label:"绿色",colorClass:"bg-green-500"}),e.jsx(Ga,{value:"orange",current:h,onChange:p,label:"橙色",colorClass:"bg-orange-500"}),e.jsx(Ga,{value:"pink",current:h,onChange:p,label:"粉色",colorClass:"bg-pink-500"}),e.jsx(Ga,{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(Ga,{value:"gradient-sunset",current:h,onChange:p,label:"日落",colorClass:"bg-gradient-to-r from-orange-500 to-pink-500"}),e.jsx(Ga,{value:"gradient-ocean",current:h,onChange:p,label:"海洋",colorClass:"bg-gradient-to-r from-blue-500 to-cyan-500"}),e.jsx(Ga,{value:"gradient-forest",current:h,onChange:p,label:"森林",colorClass:"bg-gradient-to-r from-green-500 to-emerald-500"}),e.jsx(Ga,{value:"gradient-aurora",current:h,onChange:p,label:"极光",colorClass:"bg-gradient-to-r from-purple-500 to-pink-500"}),e.jsx(Ga,{value:"gradient-fire",current:h,onChange:p,label:"烈焰",colorClass:"bg-gradient-to-r from-red-500 to-orange-500"}),e.jsx(Ga,{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(le,{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:i,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:u,onCheckedChange:x})]})})]})]})]})}function J_(){const l=ca(),[n,i]=d.useState(""),[c,u]=d.useState(""),[x,h]=d.useState(!1),[f,p]=d.useState(!1),[g,N]=d.useState(!1),[v,b]=d.useState(!1),[w,y]=d.useState(!1),[R,A]=d.useState(!1),[S,B]=d.useState(""),[M,C]=d.useState(!1),{toast:D}=Zs(),H=d.useMemo(()=>U_(c),[c]),L=async re=>{if(!n){D({title:"无法复制",description:"Token 存储在安全 Cookie 中,请重新生成以获取新 Token",variant:"destructive"});return}try{await navigator.clipboard.writeText(re),y(!0),D({title:"复制成功",description:"Token 已复制到剪贴板"}),setTimeout(()=>y(!1),2e3)}catch{D({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},J=async()=>{if(!c.trim()){D({title:"输入错误",description:"请输入新的 Token",variant:"destructive"});return}if(!H.isValid){const re=H.rules.filter(fe=>!fe.passed).map(fe=>fe.label).join(", ");D({title:"格式错误",description:`Token 不符合要求: ${re}`,variant:"destructive"});return}N(!0);try{const re=await fetch("/api/webui/auth/update",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({new_token:c.trim()})}),fe=await re.json();re.ok&&fe.success?(u(""),i(c.trim()),D({title:"更新成功",description:"Access Token 已更新,即将跳转到登录页"}),setTimeout(()=>{l({to:"/auth"})},1500)):D({title:"更新失败",description:fe.message||"无法更新 Token",variant:"destructive"})}catch(re){console.error("更新 Token 错误:",re),D({title:"更新失败",description:"连接服务器失败",variant:"destructive"})}finally{N(!1)}},U=async()=>{b(!0);try{const re=await fetch("/api/webui/auth/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"}),fe=await re.json();re.ok&&fe.success?(i(fe.token),B(fe.token),A(!0),C(!1),D({title:"生成成功",description:"新的 Access Token 已生成,请及时保存"})):D({title:"生成失败",description:fe.message||"无法生成新 Token",variant:"destructive"})}catch(re){console.error("生成 Token 错误:",re),D({title:"生成失败",description:"连接服务器失败",variant:"destructive"})}finally{b(!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(()=>{B(""),C(!1)},300),setTimeout(()=>{l({to:"/auth"})},500)},je=re=>{re||Ne()};return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsx(Is,{open:R,onOpenChange:je,children:e.jsxs(Ds,{className:"sm:max-w-md",children:[e.jsxs(Os,{children:[e.jsxs(Rs,{className:"flex items-center gap-2",children:[e.jsx(Jt,{className:"h-5 w-5 text-yellow-500"}),"新的 Access Token"]}),e.jsx(Ks,{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(Jt,{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(st,{className:"gap-2 sm:gap-0",children:[e.jsx(_,{variant:"outline",onClick:oe,className:"gap-2",children:M?e.jsxs(e.Fragment,{children:[e.jsx(Ct,{className:"h-4 w-4 text-green-500"}),"已复制"]}):e.jsxs(e.Fragment,{children:[e.jsx(Lo,{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(le,{id:"current-token",type:x?"text":"password",value:n||"••••••••••••••••••••••••••••••••",readOnly:!0,className:"pr-10 font-mono text-sm",placeholder:"Token 存储在安全 Cookie 中"}),e.jsx("button",{onClick:()=>{n?h(!x):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:x?"隐藏":"显示",children:x?e.jsx(ec,{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:()=>L(n),title:"复制到剪贴板",className:"flex-shrink-0",disabled:!n,children:w?e.jsx(Ct,{className:"h-4 w-4 text-green-500"}):e.jsx(Lo,{className:"h-4 w-4"})}),e.jsxs(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{variant:"outline",disabled:v,className:"gap-2 flex-1 sm:flex-none",children:[e.jsx(dt,{className:P("h-4 w-4",v&&"animate-spin")}),e.jsx("span",{className:"hidden sm:inline",children:"重新生成"}),e.jsx("span",{className:"sm:hidden",children:"生成"})]})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认重新生成 Token"}),e.jsx(hs,{children:"这将生成一个新的 64 位安全令牌,并使当前 Token 立即失效。 您需要使用新 Token 重新登录系统。此操作不可撤销,确定要继续吗?"})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:U,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(le,{id:"new-token",type:f?"text":"password",value:c,onChange:re=>u(re.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(ec,{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:H.rules.map(re=>e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[re.passed?e.jsx(pt,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):e.jsx(Va,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:P(re.passed?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:re.label})]},re.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(Ct,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:"Token 格式正确,可以使用"})]})})]})]}),e.jsx(_,{onClick:J,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 X_(){const l=ca(),{toast:n}=Zs(),[i,c]=d.useState(!1),[u,x]=d.useState(!1),[h,f]=d.useState(()=>yt("logCacheSize")),[p,g]=d.useState(()=>yt("wsReconnectInterval")),[N,v]=d.useState(()=>yt("wsMaxReconnectAttempts")),[b,w]=d.useState(()=>yt("dataSyncInterval")),[y,R]=d.useState(()=>vg()),[A,S]=d.useState(!1),[B,M]=d.useState(!1),C=d.useRef(null);if(u)throw new Error("这是一个手动触发的测试错误,用于验证错误边界组件是否正常工作。");const D=()=>{R(vg())},H=E=>{const K=E[0];f(K),Pr("logCacheSize",K)},L=E=>{const K=E[0];g(K),Pr("wsReconnectInterval",K)},J=E=>{const K=E[0];v(K),Pr("wsMaxReconnectAttempts",K)},U=E=>{const K=E[0];w(K),Pr("dataSyncInterval",K)},oe=()=>{In.clearLogs(),n({title:"日志已清除",description:"日志缓存已清空"})},Ne=()=>{const E=G_();D(),n({title:"缓存已清除",description:`已清除 ${E.clearedKeys.length} 项缓存数据`})},je=()=>{S(!0);try{const E=P_(),K=JSON.stringify(E,null,2),I=new Blob([K],{type:"application/json"}),ue=URL.createObjectURL(I),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),n({title:"导出成功",description:"设置已导出为 JSON 文件"})}catch(E){console.error("导出设置失败:",E),n({title:"导出失败",description:"无法导出设置",variant:"destructive"})}finally{S(!1)}},re=E=>{const K=E.target.files?.[0];if(!K)return;M(!0);const I=new FileReader;I.onload=ue=>{try{const Q=ue.target?.result,Se=JSON.parse(Q),pe=H_(Se);pe.success?(f(yt("logCacheSize")),g(yt("wsReconnectInterval")),v(yt("wsMaxReconnectAttempts")),w(yt("dataSyncInterval")),D(),n({title:"导入成功",description:`成功导入 ${pe.imported.length} 项设置${pe.skipped.length>0?`,跳过 ${pe.skipped.length} 项`:""}`}),(pe.imported.includes("theme")||pe.imported.includes("accentColor"))&&n({title:"提示",description:"部分设置需要刷新页面才能完全生效"})):n({title:"导入失败",description:"没有有效的设置项可导入",variant:"destructive"})}catch(Q){console.error("导入设置失败:",Q),n({title:"导入失败",description:"文件格式无效",variant:"destructive"})}finally{M(!1),C.current&&(C.current.value="")}},I.readAsText(K)},fe=()=>{F_(),f(cl.logCacheSize),g(cl.wsReconnectInterval),v(cl.wsMaxReconnectAttempts),w(cl.dataSyncInterval),D(),n({title:"已重置",description:"所有设置已恢复为默认值,刷新页面以应用更改"})},ge=async()=>{c(!0);try{const E=await _e("/api/webui/setup/reset",{method:"POST"}),K=await E.json();E.ok&&K.success?(n({title:"重置成功",description:"即将进入初次配置向导"}),setTimeout(()=>{l({to:"/setup"})},1e3)):n({title:"重置失败",description:K.message||"无法重置配置状态",variant:"destructive"})}catch(E){console.error("重置配置状态错误:",E),n({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(Gr,{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(Jw,{className:"h-4 w-4"}),"本地存储使用"]}),e.jsx(_,{variant:"ghost",size:"sm",onClick:D,className:"h-7 px-2",children:e.jsx(dt,{className:"h-3 w-3"})})]}),e.jsx("div",{className:"text-2xl font-bold text-primary",children:V_(y.used)}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[y.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: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:[b," 秒"]})]}),e.jsx(qa,{value:[b],onValueChange:U,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:L,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(qa,{value:[N],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(ns,{className:"h-4 w-4"}),"清除日志缓存"]}),e.jsxs(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:"gap-2",children:[e.jsx(ns,{className:"h-4 w-4"}),"清除本地缓存"]})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认清除本地缓存"}),e.jsx(hs,{children:"这将清除所有本地缓存的设置和数据(不包括登录凭证)。 您可能需要重新配置部分偏好设置。确定要继续吗?"})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{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(sa,{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(sa,{className:"h-4 w-4"}),A?"导出中...":"导出设置"]}),e.jsx("input",{ref:C,type:"file",accept:".json",onChange:re,className:"hidden"}),e.jsxs(_,{variant:"outline",onClick:()=>C.current?.click(),disabled:B,className:"gap-2",children:[e.jsx(sc,{className:"h-4 w-4"}),B?"导入中...":"导入设置"]})]}),e.jsx("div",{className:"pt-2 border-t",children:e.jsxs(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:"gap-2 text-destructive hover:text-destructive",children:[e.jsx(Wi,{className:"h-4 w-4"}),"重置所有设置为默认值"]})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认重置所有设置"}),e.jsx(hs,{children:"这将把所有界面设置恢复为默认值,包括主题、颜色、动画等偏好设置。 此操作不会影响您的登录状态。确定要继续吗?"})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:fe,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(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{variant:"outline",disabled:i,className:"gap-2",children:[e.jsx(Wi,{className:P("h-4 w-4",i&&"animate-spin")}),"重新进行初次配置"]})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认重新配置"}),e.jsx(hs,{children:"这将带您重新进入初次配置向导。您可以重新设置系统的基础配置项。确定要继续吗?"})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{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(Jt,{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(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{variant:"destructive",className:"gap-2",children:[e.jsx(Jt,{className:"h-4 w-4"}),"触发测试错误"]})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认触发错误"}),e.jsx(hs,{children:"这将手动触发一个 React 错误,用于测试错误边界组件的显示效果。 页面将显示错误界面,您可以通过刷新页面或点击返回首页来恢复。"})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>x(!0),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认触发"})]})]})]})]})]})]})}function Z_(){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:P("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:["关于 ",ax]}),e.jsxs("div",{className:"space-y-2 text-xs sm:text-sm text-muted-foreground",children:[e.jsxs("p",{children:["版本: ",sd]}),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(Je,{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(ft,{name:"React",description:"用户界面构建库",license:"MIT"}),e.jsx(ft,{name:"shadcn/ui",description:"优雅的 React 组件库",license:"MIT"}),e.jsx(ft,{name:"Radix UI",description:"无样式的可访问组件库",license:"MIT"}),e.jsx(ft,{name:"Tailwind CSS",description:"实用优先的 CSS 框架",license:"MIT"}),e.jsx(ft,{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(ft,{name:"TanStack Router",description:"类型安全的路由库",license:"MIT"}),e.jsx(ft,{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(ft,{name:"React Hook Form",description:"高性能表单库",license:"MIT"}),e.jsx(ft,{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(ft,{name:"clsx",description:"条件 className 构建工具",license:"MIT"}),e.jsx(ft,{name:"tailwind-merge",description:"Tailwind 类名合并工具",license:"MIT"}),e.jsx(ft,{name:"class-variance-authority",description:"组件变体管理",license:"Apache-2.0"}),e.jsx(ft,{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(ft,{name:"Framer Motion",description:"React 动画库",license:"MIT"}),e.jsx(ft,{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(ft,{name:"FastAPI",description:"现代化 Python Web 框架",license:"MIT"}),e.jsx(ft,{name:"Uvicorn",description:"ASGI 服务器",license:"BSD-3-Clause"}),e.jsx(ft,{name:"Pydantic",description:"数据验证库",license:"MIT"}),e.jsx(ft,{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(ft,{name:"TypeScript",description:"JavaScript 的超集",license:"Apache-2.0"}),e.jsx(ft,{name:"Vite",description:"下一代前端构建工具",license:"MIT"}),e.jsx(ft,{name:"ESLint",description:"JavaScript 代码检查工具",license:"MIT"}),e.jsx(ft,{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 ft({name:l,description:n,license:i}){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:l}),e.jsx("p",{className:"text-muted-foreground text-xs mt-0.5",children:n})]}),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:i})]})}function Cm({value:l,current:n,onChange:i,label:c,description:u}){const x=n===l;return e.jsxs("button",{onClick:()=>i(l),className:P("relative rounded-lg border-2 p-3 sm:p-4 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",x?"border-primary bg-accent":"border-border"),children:[x&&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:u})]}),e.jsxs("div",{className:"mt-2 sm:mt-3 flex gap-1",children:[l==="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"})]}),l==="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"})]}),l==="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 Ga({value:l,current:n,onChange:i,label:c,colorClass:u}){const x=n===l;return e.jsxs("button",{onClick:()=>i(l),className:P("relative rounded-lg border-2 p-2 sm:p-3 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",x?"border-primary bg-accent":"border-border"),children:[x&&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:P("h-8 w-8 sm:h-10 sm:w-10 rounded-full",u)}),e.jsx("div",{className:"text-[10px] sm:text-xs font-medium text-center",children:c})]})]})}const W_=Date.now()%1e6;class e2{grad3;p;perm;constructor(n=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 i=0;i<256;i++)this.p[i]=Math.floor(Math.random()*256);this.perm=[];for(let i=0;i<512;i++)this.perm[i]=this.p[i&255]}dot(n,i,c){return n[0]*i+n[1]*c}mix(n,i,c){return(1-c)*n+c*i}fade(n){return n*n*n*(n*(n*6-15)+10)}perlin2(n,i){const c=Math.floor(n)&255,u=Math.floor(i)&255;n-=Math.floor(n),i-=Math.floor(i);const x=this.fade(n),h=this.fade(i),f=this.perm[c]+u,p=this.perm[f],g=this.perm[f+1],N=this.perm[c+1]+u,v=this.perm[N],b=this.perm[N+1];return this.mix(this.mix(this.dot(this.grad3[p%12],n,i),this.dot(this.grad3[v%12],n-1,i),x),this.mix(this.dot(this.grad3[g%12],n,i-1),this.dot(this.grad3[b%12],n-1,i-1),x),h)}}function bg(){const l=d.useRef(null),n=d.useRef(null),i=d.useRef(void 0),[c]=d.useState(()=>new e2(W_)),u=d.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 d.useEffect(()=>{const x=n.current,h=l.current;if(!x||!h)return;const f=u.current;f.noise=c;const p=()=>{const A=x.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 B=10,M=32,C=A+200,D=S+30,H=Math.ceil(C/B),L=Math.ceil(D/M),J=(A-B*H)/2,U=(S-M*L)/2;for(let oe=0;oe<=H;oe++){const Ne=[];for(let re=0;re<=L;re++){const fe={x:J+B*oe,y:U+M*re,wave:{x:0,y:0},cursor:{x:0,y:0,vx:0,vy:0}};Ne.push(fe)}const je=document.createElementNS("http://www.w3.org/2000/svg","path");h.appendChild(je),f.paths.push(je),f.lines.push(Ne)}},N=A=>{const{lines:S,mouse:B,noise:M}=f;S.forEach(C=>{C.forEach(D=>{const H=M.perlin2((D.x+A*.0125)*.002,(D.y+A*.005)*.0015)*12;D.wave.x=Math.cos(H)*32,D.wave.y=Math.sin(H)*16;const L=D.x-B.sx,J=D.y-B.sy,U=Math.hypot(L,J),oe=Math.max(175,B.vs);if(U{const B={x:A.x+A.wave.x+(S?A.cursor.x:0),y:A.y+A.wave.y+(S?A.cursor.y:0)};return B.x=Math.round(B.x*10)/10,B.y=Math.round(B.y*10)/10,B},b=()=>{const{lines:A,paths:S}=f;A.forEach((B,M)=>{let C=v(B[0],!1),D=`M ${C.x} ${C.y}`;B.forEach((H,L)=>{const J=L===B.length-1;C=v(H,!J),D+=`L ${C.x} ${C.y}`}),S[M].setAttribute("d",D)})},w=A=>{const{mouse:S}=f;S.sx+=(S.x-S.sx)*.1,S.sy+=(S.y-S.sy)*.1;const B=S.x-S.lx,M=S.y-S.ly,C=Math.hypot(B,M);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(M,B),x&&(x.style.setProperty("--x",`${S.sx}px`),x.style.setProperty("--y",`${S.sy}px`)),N(A),b(),i.current=requestAnimationFrame(w)},y=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)},R=()=>{p(),g()};return p(),g(),window.addEventListener("resize",R),window.addEventListener("mousemove",y),i.current=requestAnimationFrame(w),()=>{window.removeEventListener("resize",R),window.removeEventListener("mousemove",y),i.current&&cancelAnimationFrame(i.current)}},[c]),e.jsxs("div",{ref:n,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:l,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 s2(){const[l,n]=d.useState(""),[i,c]=d.useState(!1),[u,x]=d.useState(""),[h,f]=d.useState(!0),p=ca(),{enableWavesBackground:g,setEnableWavesBackground:N}=jv(),{theme:v,setTheme:b}=tx();d.useEffect(()=>{(async()=>{try{await ac()&&p({to:"/"})}catch{}finally{f(!1)}})()},[p]);const y=v==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":v,R=()=>{b(y==="dark"?"light":"dark")},A=async S=>{if(S.preventDefault(),x(""),!l.trim()){x("请输入 Access Token");return}c(!0),console.log("开始验证 token...");try{const B=await fetch("/api/webui/auth/verify",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({token:l.trim()})});console.log("Token 验证响应状态:",B.status);const M=await B.json();if(console.log("Token 验证响应数据:",M),B.ok&&M.valid){console.log("Token 验证成功,准备跳转..."),console.log("is_first_setup:",M.is_first_setup),await new Promise(D=>setTimeout(D,100));const C=await ac();console.log("跳转前认证状态检查:",C),M.is_first_setup?(console.log("跳转到首次配置页面"),p({to:"/setup"})):(console.log("跳转到首页"),p({to:"/"}))}else console.error("Token 验证失败:",M.message),x(M.message||"Token 验证失败,请检查后重试")}catch(B){console.error("Token 验证错误:",B),x("连接服务器失败,请检查网络连接")}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(bg,{}),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(bg,{}),e.jsxs(Te,{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:R,className:"absolute right-4 top-4 rounded-lg p-2 hover:bg-accent transition-colors z-10 text-foreground",title:y==="dark"?"切换到浅色模式":"切换到深色模式",children:y==="dark"?e.jsx(qm,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"}):e.jsx(Yi,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"})}),e.jsxs(Oe,{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(cg,{className:"h-8 w-8 text-primary",strokeWidth:2,fill:"none"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Le,{className:"text-2xl font-bold",children:"欢迎使用 MaiBot"}),e.jsx(ws,{className:"text-base",children:"请输入您的 Access Token 以继续访问系统"})]})]}),e.jsx(Ae,{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(Km,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground",strokeWidth:2,fill:"none"}),e.jsx(le,{id:"token",type:"password",placeholder:"请输入您的 Access Token",value:l,onChange:S=>n(S.target.value),className:P("pl-10",u&&"border-red-500 focus-visible:ring-red-500"),disabled:i,autoFocus:!0,autoComplete:"off"})]})]}),u&&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(_t,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),e.jsx("span",{children:u})]}),e.jsx(_,{type:"submit",className:"w-full",disabled:i,children:i?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(Is,{children:[e.jsx(ed,{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(Lj,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我没有 Token,我该去哪里获得 Token?"]})}),e.jsxs(Ds,{className:"sm:max-w-md",children:[e.jsxs(Os,{children:[e.jsxs(Rs,{className:"flex items-center gap-2",children:[e.jsx(cg,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"如何获取 Access Token"]}),e.jsx(Ks,{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(Xw,{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(Ca,{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(_t,{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(vs,{children:[e.jsx(wt,{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(Za,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我觉得这个界面很卡怎么办?"]})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsxs(xs,{className:"flex items-center gap-2",children:[e.jsx(Za,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"关闭背景动画"]}),e.jsx(hs,{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(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{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:$_})})]})}const ot=d.forwardRef(({className:l,...n},i)=>e.jsx("textarea",{className:P("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),ref:i,...n}));ot.displayName="Textarea";const Yt=d.forwardRef(({className:l,orientation:n="horizontal",decorative:i=!0,...c},u)=>e.jsx(tj,{ref:u,decorative:i,orientation:n,className:P("shrink-0 bg-border",n==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",l),...c}));Yt.displayName=tj.displayName;function t2({config:l,onChange:n}){const i=u=>{u.trim()&&!l.alias_names.includes(u.trim())&&n({...l,alias_names:[...l.alias_names,u.trim()]})},c=u=>{n({...l,alias_names:l.alias_names.filter((x,h)=>h!==u)})};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(le,{id:"qq_account",type:"number",placeholder:"请输入机器人的QQ账号",value:l.qq_account||"",onChange:u=>n({...l,qq_account:Number(u.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(le,{id:"nickname",placeholder:"请输入机器人的昵称",value:l.nickname,onChange:u=>n({...l,nickname:u.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:l.alias_names.map((u,x)=>e.jsxs(ke,{variant:"secondary",className:"gap-1",children:[u,e.jsx("button",{type:"button",onClick:()=>c(x),className:"ml-1 hover:text-destructive",children:e.jsx(Ea,{className:"h-3 w-3"})})]},x))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(le,{id:"alias_input",placeholder:"输入别名后按回车添加",onKeyPress:u=>{u.key==="Enter"&&(i(u.target.value),u.target.value="")}}),e.jsx(_,{type:"button",variant:"outline",onClick:()=>{const u=document.getElementById("alias_input");u&&(i(u.value),u.value="")},children:"添加"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的其他称呼,可以添加多个"})]})]})}function a2({config:l,onChange:n}){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(ot,{id:"personality",placeholder:"描述机器人的人格特质和身份特征(建议120字以内)",value:l.personality,onChange:i=>n({...l,personality:i.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(ot,{id:"reply_style",placeholder:"描述机器人说话的表达风格、表达习惯",value:l.reply_style,onChange:i=>n({...l,reply_style:i.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(ot,{id:"interest",placeholder:"描述机器人感兴趣的话题",value:l.interest,onChange:i=>n({...l,interest:i.target.value}),rows:2}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"会影响机器人对什么话题进行回复"})]}),e.jsx(Yt,{}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"plan_style",children:"群聊说话规则 *"}),e.jsx(ot,{id:"plan_style",placeholder:"机器人在群聊中的行为风格和规则",value:l.plan_style,onChange:i=>n({...l,plan_style:i.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(ot,{id:"private_plan_style",placeholder:"机器人在私聊中的行为风格和规则",value:l.private_plan_style,onChange:i=>n({...l,private_plan_style:i.target.value}),rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在私聊中的行为方式"})]})]})}function l2({config:l,onChange:n}){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:[(l.emoji_chance*100).toFixed(0),"%"]})]}),e.jsx(le,{id:"emoji_chance",type:"range",min:"0",max:"1",step:"0.1",value:l.emoji_chance,onChange:i=>n({...l,emoji_chance:Number(i.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(le,{id:"max_reg_num",type:"number",min:"1",max:"200",value:l.max_reg_num,onChange:i=>n({...l,max_reg_num:Number(i.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:l.do_replace,onCheckedChange:i=>n({...l,do_replace:i})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),e.jsx(le,{id:"check_interval",type:"number",min:"1",max:"120",value:l.check_interval,onChange:i=>n({...l,check_interval:Number(i.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包注册、破损、删除的时间间隔"})]}),e.jsx(Yt,{}),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:l.steal_emoji,onCheckedChange:i=>n({...l,steal_emoji:i})})]}),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:l.content_filtration,onCheckedChange:i=>n({...l,content_filtration:i})})]}),l.content_filtration&&e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"filtration_prompt",children:"过滤要求"}),e.jsx(le,{id:"filtration_prompt",placeholder:"例如:符合公序良俗",value:l.filtration_prompt,onChange:i=>n({...l,filtration_prompt:i.target.value})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"描述表情包应该符合的要求"})]})]})}function n2({config:l,onChange:n}){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:l.enable_tool,onCheckedChange:i=>n({...l,enable_tool:i})})]}),e.jsx(Yt,{}),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:l.all_global,onCheckedChange:i=>n({...l,all_global:i})})]})]})}function r2({config:l,onChange:n}){const[i,c]=d.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(Ao,{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(le,{id:"siliconflow_api_key",type:i?"text":"password",placeholder:"sk-...",value:l.api_key,onChange:u=>n({api_key:u.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(!i),children:i?e.jsx(ec,{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 i2(){const l=await _e("/api/webui/config/bot",{method:"GET",headers:Fs()});if(!l.ok)throw new Error("读取Bot配置失败");const i=(await l.json()).config.bot||{};return{qq_account:i.qq_account||0,nickname:i.nickname||"",alias_names:i.alias_names||[]}}async function c2(){const l=await _e("/api/webui/config/bot",{method:"GET",headers:Fs()});if(!l.ok)throw new Error("读取人格配置失败");const i=(await l.json()).config.personality||{};return{personality:i.personality||"",reply_style:i.reply_style||"",interest:i.interest||"",plan_style:i.plan_style||"",private_plan_style:i.private_plan_style||""}}async function o2(){const l=await _e("/api/webui/config/bot",{method:"GET",headers:Fs()});if(!l.ok)throw new Error("读取表情包配置失败");const i=(await l.json()).config.emoji||{};return{emoji_chance:i.emoji_chance??.4,max_reg_num:i.max_reg_num??40,do_replace:i.do_replace??!0,check_interval:i.check_interval??10,steal_emoji:i.steal_emoji??!0,content_filtration:i.content_filtration??!1,filtration_prompt:i.filtration_prompt||""}}async function d2(){const l=await _e("/api/webui/config/bot",{method:"GET",headers:Fs()});if(!l.ok)throw new Error("读取其他配置失败");const i=(await l.json()).config,c=i.tool||{},u=i.expression||{};return{enable_tool:c.enable_tool??!0,all_global:u.all_global_jargon??!0}}async function u2(){const l=await _e("/api/webui/config/model",{method:"GET",headers:Fs()});if(!l.ok)throw new Error("读取模型配置失败");return{api_key:((await l.json()).config.api_providers||[]).find(x=>x.name==="SiliconFlow")?.api_key||""}}async function m2(l){const n=await _e("/api/webui/config/bot/section/bot",{method:"POST",headers:Fs(),body:JSON.stringify(l)});if(!n.ok){const i=await n.json();throw new Error(i.detail||"保存Bot基础配置失败")}return await n.json()}async function x2(l){const n=await _e("/api/webui/config/bot/section/personality",{method:"POST",headers:Fs(),body:JSON.stringify(l)});if(!n.ok){const i=await n.json();throw new Error(i.detail||"保存人格配置失败")}return await n.json()}async function h2(l){const n=await _e("/api/webui/config/bot/section/emoji",{method:"POST",headers:Fs(),body:JSON.stringify(l)});if(!n.ok){const i=await n.json();throw new Error(i.detail||"保存表情包配置失败")}return await n.json()}async function f2(l){const n=[];n.push(_e("/api/webui/config/bot/section/tool",{method:"POST",headers:Fs(),body:JSON.stringify({enable_tool:l.enable_tool})})),n.push(_e("/api/webui/config/bot/section/expression",{method:"POST",headers:Fs(),body:JSON.stringify({all_global_jargon:l.all_global})}));const i=await Promise.all(n);for(const c of i)if(!c.ok){const u=await c.json();throw new Error(u.detail||"保存其他配置失败")}return{success:!0}}async function p2(l){const n=await _e("/api/webui/config/model",{method:"GET",headers:Fs()});if(!n.ok)throw new Error("读取模型配置失败");const c=(await n.json()).config,u=c.api_providers||[],x=u.findIndex(p=>p.name==="SiliconFlow");x>=0?u[x]={...u[x],api_key:l.api_key}:u.push({name:"SiliconFlow",base_url:"https://api.siliconflow.cn/v1",api_key:l.api_key,client_type:"openai",max_retry:3,timeout:120,retry_interval:5});const h={...c,api_providers:u},f=await _e("/api/webui/config/model",{method:"POST",headers:Fs(),body:JSON.stringify(h)});if(!f.ok){const p=await f.json();throw new Error(p.detail||"保存模型配置失败")}return await f.json()}async function yg(){const l=await _e("/api/webui/setup/complete",{method:"POST"});if(!l.ok){const n=await l.json();throw new Error(n.message||"标记配置完成失败")}return await l.json()}function g2(){return e.jsx(Jn,{children:e.jsx(j2,{})})}function j2(){const l=ca(),{toast:n}=Zs(),{triggerRestart:i}=vn(),[c,u]=d.useState(0),[x,h]=d.useState(!1),[f,p]=d.useState(!1),[g,N]=d.useState(!0),[v,b]=d.useState({qq_account:0,nickname:"",alias_names:[]}),[w,y]=d.useState({personality:"是一个女大学生,现在在读大二,会刷贴吧。",reply_style:"请回复的平淡一些,简短一些,说中文,不要刻意突出自身学科背景。可以参考贴吧,知乎和微博的回复风格。",interest:"对技术相关话题,游戏和动漫相关话题感兴趣,也对日常话题感兴趣,不喜欢太过沉重严肃的话题",plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 +2.如果相同的内容已经被执行,请不要重复执行 +3.请控制你的发言频率,不要太过频繁的发言 +4.如果有人对你感到厌烦,请减少回复 +5.如果有人对你进行攻击,或者情绪激动,请你以合适的方法应对`,private_plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 +2.如果相同的内容已经被执行,请不要重复执行 +3.某句话如果已经被回复过,不要重复回复`}),[R,A]=d.useState({emoji_chance:.4,max_reg_num:40,do_replace:!0,check_interval:10,steal_emoji:!0,content_filtration:!1,filtration_prompt:"符合公序良俗"}),[S,B]=d.useState({enable_tool:!0,all_global:!0}),[M,C]=d.useState({api_key:""}),D=[{id:"bot-basic",title:"Bot基础",description:"配置机器人的基本信息",icon:Pn},{id:"personality",title:"人格配置",description:"定义机器人的性格和说话风格",icon:fn},{id:"emoji",title:"表情包",description:"配置表情包相关设置",icon:Jo},{id:"other",title:"其他设置",description:"工具、情绪系统等配置",icon:pn},{id:"siliconflow",title:"API配置",description:"配置硅基流动API密钥",icon:Km}],H=(c+1)/D.length*100;d.useEffect(()=>{(async()=>{try{N(!0);const[fe,ge,E,K,I]=await Promise.all([i2(),c2(),o2(),d2(),u2()]);b(fe),y(ge),A(E),B(K),C(I)}catch(fe){n({title:"加载配置失败",description:fe instanceof Error?fe.message:"无法加载现有配置,将使用默认值",variant:"destructive"})}finally{N(!1)}})()},[n]);const L=async()=>{p(!0);try{switch(c){case 0:await m2(v);break;case 1:await x2(w);break;case 2:await h2(R);break;case 3:await f2(S);break;case 4:await p2(M);break}return n({title:"保存成功",description:`${D[c].title}配置已保存`}),!0}catch(re){return n({title:"保存失败",description:re instanceof Error?re.message:"未知错误",variant:"destructive"}),!1}finally{p(!1)}},J=async()=>{await L()&&c{c>0&&u(c-1)},oe=async()=>{h(!0);try{if(!await L()){h(!1);return}await yg(),n({title:"配置完成",description:"麦麦正在重启以应用新配置..."}),await i()}catch(re){n({title:"配置失败",description:re instanceof Error?re.message:"未知错误",variant:"destructive"})}finally{h(!1)}},Ne=async()=>{try{await yg(),l({to:"/"})}catch(re){n({title:"跳过失败",description:re instanceof Error?re.message:"未知错误",variant:"destructive"})}},je=()=>{switch(c){case 0:return e.jsx(t2,{config:v,onChange:b});case 1:return e.jsx(a2,{config:w,onChange:y});case 2:return e.jsx(l2,{config:R,onChange:A});case 3:return e.jsx(n2,{config:S,onChange:B});case 4:return e.jsx(r2,{config:M,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(Xn,{}),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(Zw,{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:["让我们一起完成 ",ax," 的初始配置"]})]}),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(H),"%"]})]}),e.jsx(Qn,{value:H,className:"h-2"})]}),e.jsx("div",{className:"mb-6 md:mb-8 flex justify-between",children:D.map((re,fe)=>{const ge=re.icon;return e.jsxs("div",{className:P("flex flex-1 flex-col items-center gap-1 md:gap-2",fel({to:"/"}),className:"gap-2 w-full sm:w-auto",children:[e.jsx(Xo,{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(Ta,{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 v2=As.memo(function({config:n,onChange:i}){const c=n.platforms||[],u=n.alias_names||[],x=()=>{i({...n,platforms:[...c,""]})},h=v=>{i({...n,platforms:c.filter((b,w)=>w!==v)})},f=(v,b)=>{const w=[...c];w[v]=b,i({...n,platforms:w})},p=()=>{i({...n,alias_names:[...u,""]})},g=v=>{i({...n,alias_names:u.filter((b,w)=>w!==v)})},N=(v,b)=>{const w=[...u];w[v]=b,i({...n,alias_names:w})};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(le,{id:"platform",value:n.platform,onChange:v=>i({...n,platform:v.target.value}),placeholder:"qq"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"qq_account",children:"QQ账号"}),e.jsx(le,{id:"qq_account",value:n.qq_account,onChange:v=>i({...n,qq_account:v.target.value}),placeholder:"123456789"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"nickname",children:"昵称"}),e.jsx(le,{id:"nickname",value:n.nickname,onChange:v=>i({...n,nickname:v.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(et,{className:"h-4 w-4 mr-1"}),"添加"]})]}),e.jsxs("div",{className:"space-y-2",children:[u.map((v,b)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(le,{value:v,onChange:w=>N(b,w.target.value),placeholder:"小麦"}),e.jsxs(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(ns,{className:"h-4 w-4"})})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:['确定要删除别名 "',v||"(空)",'" 吗?此操作无法撤销。']})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>g(b),children:"删除"})]})]})]})]},b)),u.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:x,size:"sm",variant:"outline",children:[e.jsx(et,{className:"h-4 w-4 mr-1"}),"添加"]})]}),e.jsxs("div",{className:"space-y-2",children:[c.map((v,b)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(le,{value:v,onChange:w=>f(b,w.target.value),placeholder:"wx:114514"}),e.jsxs(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(ns,{className:"h-4 w-4"})})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:['确定要删除平台账号 "',v||"(空)",'" 吗?此操作无法撤销。']})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>h(b),children:"删除"})]})]})]})]},b)),c.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无其他平台账号"})]})]})]})]})})}),N2=As.memo(function({config:n,onChange:i}){const c=()=>{i({...n,states:[...n.states,""]})},u=h=>{i({...n,states:n.states.filter((f,p)=>p!==h)})},x=(h,f)=>{const p=[...n.states];p[h]=f,i({...n,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(ot,{id:"personality",value:n.personality,onChange:h=>i({...n,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(et,{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:n.states.map((h,f)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ot,{value:h,onChange:p=>x(f,p.target.value),placeholder:"描述一个人格状态",rows:2}),e.jsxs(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(ns,{className:"h-4 w-4"})})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsx(hs,{children:"确定要删除这个人格状态吗?此操作无法撤销。"})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>u(f),children:"删除"})]})]})]})]},f))})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"state_probability",children:"替换为多重人格概率"}),e.jsx(le,{id:"state_probability",type:"number",step:"0.1",min:"0",max:"1",value:n.state_probability,onChange:h=>i({...n,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(ot,{id:"reply_style",value:n.reply_style,onChange:h=>i({...n,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(ot,{id:"plan_style",value:n.plan_style,onChange:h=>i({...n,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(ot,{id:"visual_style",value:n.visual_style,onChange:h=>i({...n,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(ot,{id:"private_plan_style",value:n.private_plan_style,onChange:h=>i({...n,private_plan_style:h.target.value}),placeholder:"私聊的说话规则和行为风格",rows:4})]})]})]})})}),ol=K0,dl=Q0,Wa=d.forwardRef(({className:l,align:n="center",sideOffset:i=4,...c},u)=>e.jsx(q0,{children:e.jsx(aj,{ref:u,align:n,sideOffset:i,className:P("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]",l),...c})}));Wa.displayName=aj.displayName;const b2=As.memo(function({value:n,onChange:i}){const c=d.useMemo(()=>{const w=n.split("-");if(w.length===2){const[y,R]=w,[A,S]=y.split(":"),[B,M]=R.split(":");return{startHour:A?A.padStart(2,"0"):"00",startMinute:S?S.padStart(2,"0"):"00",endHour:B?B.padStart(2,"0"):"23",endMinute:M?M.padStart(2,"0"):"59"}}return{startHour:"00",startMinute:"00",endHour:"23",endMinute:"59"}},[n]),[u,x]=d.useState(c.startHour),[h,f]=d.useState(c.startMinute),[p,g]=d.useState(c.endHour),[N,v]=d.useState(c.endMinute);d.useEffect(()=>{x(c.startHour),f(c.startMinute),g(c.endHour),v(c.endMinute)},[c]);const b=(w,y,R,A)=>{const S=`${w}:${y}-${R}:${A}`;i(S)};return e.jsxs(ol,{children:[e.jsx(dl,{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"}),n||"选择时间段"]})}),e.jsx(Wa,{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(Ie,{value:u,onValueChange:w=>{x(w),b(w,h,p,N)},children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsx(Be,{children:Array.from({length:24},(w,y)=>y).map(w=>e.jsx(Z,{value:w.toString().padStart(2,"0"),children:w.toString().padStart(2,"0")},w))})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-xs",children:"分钟"}),e.jsxs(Ie,{value:h,onValueChange:w=>{f(w),b(u,w,p,N)},children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsx(Be,{children:Array.from({length:60},(w,y)=>y).map(w=>e.jsx(Z,{value:w.toString().padStart(2,"0"),children:w.toString().padStart(2,"0")},w))})]})]})]})]}),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(Ie,{value:p,onValueChange:w=>{g(w),b(u,h,w,N)},children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsx(Be,{children:Array.from({length:24},(w,y)=>y).map(w=>e.jsx(Z,{value:w.toString().padStart(2,"0"),children:w.toString().padStart(2,"0")},w))})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-xs",children:"分钟"}),e.jsxs(Ie,{value:N,onValueChange:w=>{v(w),b(u,h,p,w)},children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsx(Be,{children:Array.from({length:60},(w,y)=>y).map(w=>e.jsx(Z,{value:w.toString().padStart(2,"0"),children:w.toString().padStart(2,"0")},w))})]})]})]})]})]})})]})}),y2=As.memo(function({rule:n}){const i=`{ target = "${n.target}", time = "${n.time}", value = ${n.value.toFixed(1)} }`;return e.jsxs(ol,{children:[e.jsx(dl,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(ia,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Wa,{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:i}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})}),w2=As.memo(function({config:n,onChange:i}){const c=()=>{i({...n,talk_value_rules:[...n.talk_value_rules,{target:"",time:"00:00-23:59",value:1}]})},u=h=>{i({...n,talk_value_rules:n.talk_value_rules.filter((f,p)=>p!==h)})},x=(h,f,p)=>{const g=[...n.talk_value_rules];g[h]={...g[h],[f]:p},i({...n,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(le,{id:"talk_value",type:"number",step:"0.1",min:"0",max:"1",value:n.talk_value,onChange:h=>i({...n,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(Ie,{value:n.think_mode||"classic",onValueChange:h=>i({...n,think_mode:h}),children:[e.jsx($e,{id:"think_mode",children:e.jsx(Pe,{placeholder:"选择思考模式"})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"classic",children:"经典模式 - 浅度思考和回复"}),e.jsx(Z,{value:"deep",children:"深度模式 - 进行深度思考和回复"}),e.jsx(Z,{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:n.mentioned_bot_reply,onCheckedChange:h=>i({...n,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(le,{id:"max_context_size",type:"number",min:"1",value:n.max_context_size,onChange:h=>i({...n,max_context_size:parseInt(h.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"planner_smooth",children:"规划器平滑"}),e.jsx(le,{id:"planner_smooth",type:"number",step:"1",min:"0",value:n.planner_smooth,onChange:h=>i({...n,planner_smooth:parseFloat(h.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"增大数值会减小 planner 负荷,推荐 1-5,0 为关闭"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"enable_talk_value_rules",checked:n.enable_talk_value_rules,onCheckedChange:h=>i({...n,enable_talk_value_rules:h})}),e.jsx(T,{htmlFor:"enable_talk_value_rules",className:"cursor-pointer",children:"启用动态发言频率规则"})]})]})]}),n.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(et,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),n.talk_value_rules&&n.talk_value_rules.length>0?e.jsx("div",{className:"space-y-4",children:n.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(y2,{rule:h}),e.jsxs(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{variant:"ghost",size:"sm",children:e.jsx(ns,{className:"h-4 w-4 text-destructive"})})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:["确定要删除规则 #",f+1," 吗?此操作无法撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>u(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(Ie,{value:h.target===""?"global":"specific",onValueChange:p=>{p==="global"?x(f,"target",""):x(f,"target","qq::group")},children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"global",children:"全局配置"}),e.jsx(Z,{value:"specific",children:"详细配置"})]})]})]}),h.target!==""&&(()=>{const p=h.target.split(":"),g=p[0]||"qq",N=p[1]||"",v=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(Ie,{value:g,onValueChange:b=>{x(f,"target",`${b}:${N}:${v}`)},children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"qq",children:"QQ"}),e.jsx(Z,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"群 ID"}),e.jsx(le,{value:N,onChange:b=>{x(f,"target",`${g}:${b.target.value}:${v}`)},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(Ie,{value:v,onValueChange:b=>{x(f,"target",`${g}:${N}:${b}`)},children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"group",children:"群组(group)"}),e.jsx(Z,{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(b2,{value:h.time,onChange:p=>x(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(le,{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)||x(f,"value",Math.max(.01,Math.min(1,g)))},className:"w-20 h-8 text-xs"})]}),e.jsx(qa,{value:[h.value],onValueChange:p=>x(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 表示正常发言"]})]})]})]})]})}),_2=As.memo(function({config:n,onChange:i}){const c=S=>{if(!S||!S.includes(":"))return{platform:"qq",userId:""};const[B,M]=S.split(":");return{platform:B,userId:M}},{platform:u,userId:x}=c(n.dream_send),[h,f]=d.useState(u),[p,g]=d.useState(x),N=S=>{const[B,M]=S.split("-");return{startTime:B||"09:00",endTime:M||"22:00"}},v=(S,B)=>{const M=B?`${S}:${B}`:"";i({...n,dream_send:M})},b=S=>{f(S),v(S,p)},w=S=>{g(S),v(h,S)},y=()=>{i({...n,dream_time_ranges:[...n.dream_time_ranges,"09:00-22:00"]})},R=S=>{i({...n,dream_time_ranges:n.dream_time_ranges.filter((B,M)=>M!==S)})},A=(S,B,M)=>{const C=[...n.dream_time_ranges],D=N(C[S]);B==="startTime"?D.startTime=M:D.endTime=M,C[S]=`${D.startTime}-${D.endTime}`,i({...n,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(le,{id:"interval_minutes",type:"number",min:"1",value:n.interval_minutes,onChange:S=>i({...n,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(le,{id:"max_iterations",type:"number",min:"1",value:n.max_iterations,onChange:S=>i({...n,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(le,{id:"first_delay_seconds",type:"number",min:"0",value:n.first_delay_seconds,onChange:S=>i({...n,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(Ie,{value:h,onValueChange:b,children:[e.jsx($e,{className:"w-[120px]",children:e.jsx(Pe,{placeholder:"选择平台"})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"qq",children:"QQ"}),e.jsx(Z,{value:"wx",children:"微信"}),e.jsx(Z,{value:"webui",children:"WebUI"})]})]}),e.jsx(le,{type:"text",placeholder:"输入用户ID (例如: 123456)",value:p,onChange:S=>w(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:y,children:"添加时间段"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"设置允许做梦的时间段,支持跨夜区间(如 23:00 到次日 02:00)。列表为空则全天允许做梦"}),e.jsxs("div",{className:"space-y-2",children:[n.dream_time_ranges.map((S,B)=>{const{startTime:M,endTime:C}=N(S);return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(le,{type:"time",value:M,onChange:D=>A(B,"startTime",D.target.value),className:"w-[140px]"}),e.jsx("span",{className:"text-muted-foreground",children:"至"}),e.jsx(le,{type:"time",value:C,onChange:D=>A(B,"endTime",D.target.value),className:"w-[140px]"}),e.jsx(_,{type:"button",variant:"ghost",size:"icon",onClick:()=>R(B),children:e.jsx(Ea,{className:"h-4 w-4"})})]},B)}),n.dream_time_ranges.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"当前配置为全天允许做梦"})]})]})]})}),S2=As.memo(function({config:n,onChange:i}){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:n.enable,onCheckedChange:c=>i({...n,enable:c})}),e.jsx(T,{className:"cursor-pointer",children:"启用 LPMM 知识库"})]}),n.enable&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"LPMM 模式"}),e.jsxs(Ie,{value:n.lpmm_mode,onValueChange:c=>i({...n,lpmm_mode:c}),children:[e.jsx($e,{children:e.jsx(Pe,{placeholder:"选择 LPMM 模式"})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"classic",children:"经典模式"}),e.jsx(Z,{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(le,{type:"number",min:"1",value:n.rag_synonym_search_top_k,onChange:c=>i({...n,rag_synonym_search_top_k:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"同义词阈值"}),e.jsx(le,{type:"number",step:"0.1",min:"0",max:"1",value:n.rag_synonym_threshold,onChange:c=>i({...n,rag_synonym_threshold:parseFloat(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"实体提取线程数"}),e.jsx(le,{type:"number",min:"1",value:n.info_extraction_workers,onChange:c=>i({...n,info_extraction_workers:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"嵌入向量维度"}),e.jsx(le,{type:"number",min:"1",value:n.embedding_dimension,onChange:c=>i({...n,embedding_dimension:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"嵌入并发线程数"}),e.jsx(le,{type:"number",min:"1",value:n.max_embedding_workers,onChange:c=>i({...n,max_embedding_workers:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"每批嵌入条数"}),e.jsx(le,{type:"number",min:"1",value:n.embedding_chunk_size,onChange:c=>i({...n,embedding_chunk_size:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"同义实体数上限"}),e.jsx(le,{type:"number",min:"1",value:n.max_synonym_entities,onChange:c=>i({...n,max_synonym_entities:parseInt(c.target.value)})})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{checked:n.enable_ppr,onCheckedChange:c=>i({...n,enable_ppr:c})}),e.jsx(T,{className:"cursor-pointer",children:"启用 PPR (低配机器可关闭)"})]})]})]})]})}),k2=As.memo(function({config:n,onChange:i}){const[c,u]=d.useState(""),[x,h]=d.useState("WARNING"),f=()=>{c&&!n.suppress_libraries.includes(c)&&(i({...n,suppress_libraries:[...n.suppress_libraries,c]}),u(""))},p=y=>{i({...n,suppress_libraries:n.suppress_libraries.filter(R=>R!==y)})},g=()=>{c&&!n.library_log_levels[c]&&(i({...n,library_log_levels:{...n.library_log_levels,[c]:x}}),u(""),h("WARNING"))},N=y=>{const R={...n.library_log_levels};delete R[y],i({...n,library_log_levels:R})},v=["DEBUG","INFO","WARNING","ERROR","CRITICAL"],b=["FULL","compact","lite"],w=["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(le,{value:n.date_style,onChange:y=>i({...n,date_style:y.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(Ie,{value:n.log_level_style,onValueChange:y=>i({...n,log_level_style:y}),children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsx(Be,{children:b.map(y=>e.jsx(Z,{value:y,children:y},y))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"日志文本颜色"}),e.jsxs(Ie,{value:n.color_text,onValueChange:y=>i({...n,color_text:y}),children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsx(Be,{children:w.map(y=>e.jsx(Z,{value:y,children:y},y))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"全局日志级别"}),e.jsxs(Ie,{value:n.log_level,onValueChange:y=>i({...n,log_level:y}),children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsx(Be,{children:v.map(y=>e.jsx(Z,{value:y,children:y},y))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"控制台日志级别"}),e.jsxs(Ie,{value:n.console_log_level,onValueChange:y=>i({...n,console_log_level:y}),children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsx(Be,{children:v.map(y=>e.jsx(Z,{value:y,children:y},y))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"文件日志级别"}),e.jsxs(Ie,{value:n.file_log_level,onValueChange:y=>i({...n,file_log_level:y}),children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsx(Be,{children:v.map(y=>e.jsx(Z,{value:y,children:y},y))})]})]})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"mb-2 block",children:"完全屏蔽的库"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(le,{value:c,onChange:y=>u(y.target.value),placeholder:"输入库名",className:"flex-1",onKeyDown:y=>{y.key==="Enter"&&(y.preventDefault(),f())}}),e.jsx(_,{onClick:f,size:"sm",className:"flex-shrink-0",children:e.jsx(et,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:n.suppress_libraries.map(y=>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:y}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onClick:()=>p(y),children:e.jsx(ns,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},y))})]}),e.jsxs("div",{children:[e.jsx(T,{className:"mb-2 block",children:"特定库的日志级别"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(le,{value:c,onChange:y=>u(y.target.value),placeholder:"输入库名",className:"flex-1"}),e.jsxs(Ie,{value:x,onValueChange:h,children:[e.jsx($e,{className:"w-32",children:e.jsx(Pe,{})}),e.jsx(Be,{children:v.map(y=>e.jsx(Z,{value:y,children:y},y))})]}),e.jsx(_,{onClick:g,size:"sm",children:e.jsx(et,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"space-y-2",children:Object.entries(n.library_log_levels).map(([y,R])=>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:y}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:R}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>N(y),children:e.jsx(ns,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]})]},y))})]})]})}),C2=As.memo(function({config:n,onChange:i}){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:n.show_prompt,onCheckedChange:c=>i({...n,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:n.show_replyer_prompt,onCheckedChange:c=>i({...n,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:n.show_replyer_reasoning,onCheckedChange:c=>i({...n,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:n.show_jargon_prompt,onCheckedChange:c=>i({...n,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:n.show_memory_prompt,onCheckedChange:c=>i({...n,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:n.show_planner_prompt,onCheckedChange:c=>i({...n,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:n.show_lpmm_paragraph,onCheckedChange:c=>i({...n,show_lpmm_paragraph:c})})]})]})]})}),T2=As.memo(function({config:n,onChange:i}){const[c,u]=d.useState(""),[x,h]=d.useState(""),f=()=>{c&&!n.auth_token.includes(c)&&(i({...n,auth_token:[...n.auth_token,c]}),u(""))},p=v=>{i({...n,auth_token:n.auth_token.filter((b,w)=>w!==v)})},g=()=>{x&&!n.api_server_allowed_api_keys.includes(x)&&(i({...n,api_server_allowed_api_keys:[...n.api_server_allowed_api_keys,x]}),h(""))},N=v=>{i({...n,api_server_allowed_api_keys:n.api_server_allowed_api_keys.filter((b,w)=>w!==v)})};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(le,{value:c,onChange:v=>u(v.target.value),placeholder:"输入认证令牌",onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),f())}}),e.jsx(_,{onClick:f,size:"sm",children:e.jsx(et,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"space-y-2",children:n.auth_token.map((v,b)=>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:v}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>p(b),children:e.jsx(ns,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},b))})]}),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:n.enable_api_server,onCheckedChange:v=>i({...n,enable_api_server:v})})]}),n.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(le,{value:n.api_server_host,onChange:v=>i({...n,api_server_host:v.target.value}),placeholder:"0.0.0.0"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"端口号"}),e.jsx(le,{type:"number",value:n.api_server_port,onChange:v=>i({...n,api_server_port:parseInt(v.target.value)}),placeholder:"8090"})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{checked:n.api_server_use_wss,onCheckedChange:v=>i({...n,api_server_use_wss:v})}),e.jsx(T,{children:"启用 WSS 安全连接"})]}),n.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(le,{value:n.api_server_cert_file,onChange:v=>i({...n,api_server_cert_file:v.target.value}),placeholder:"cert.pem"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"SSL 密钥文件路径"}),e.jsx(le,{value:n.api_server_key_file,onChange:v=>i({...n,api_server_key_file:v.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(le,{value:x,onChange:v=>h(v.target.value),placeholder:"输入 API Key",onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),g())}}),e.jsx(_,{onClick:g,size:"sm",children:e.jsx(et,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"space-y-2",children:n.api_server_allowed_api_keys.map((v,b)=>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:v}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>N(b),children:e.jsx(ns,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},b))})]})]})]})]})]})}),E2=As.memo(function({config:n,onChange:i}){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:n.enable,onCheckedChange:c=>i({...n,enable:c})})]})]})}),M2=As.memo(function({emojiConfig:n,memoryConfig:i,toolConfig:c,voiceConfig:u,onEmojiChange:x,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:u.enable_asr,onCheckedChange:g=>p({...u,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(le,{id:"max_agent_iterations",type:"number",min:"1",value:i.max_agent_iterations,onChange:g=>h({...i,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(le,{id:"agent_timeout_seconds",type:"number",min:"1",step:"0.1",value:i.agent_timeout_seconds??120,onChange:g=>h({...i,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:i.enable_jargon_detection??!0,onCheckedChange:g=>h({...i,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:i.global_memory??!1,onCheckedChange:g=>h({...i,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(le,{id:"emoji_chance",type:"number",step:"0.1",min:"0",max:"1",value:n.emoji_chance,onChange:g=>x({...n,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(le,{id:"max_reg_num",type:"number",min:"1",value:n.max_reg_num,onChange:g=>x({...n,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(le,{id:"check_interval",type:"number",min:"1",value:n.check_interval,onChange:g=>x({...n,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:n.do_replace,onCheckedChange:g=>x({...n,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:n.steal_emoji,onCheckedChange:g=>x({...n,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:n.content_filtration,onCheckedChange:g=>x({...n,content_filtration:g})}),e.jsx(T,{htmlFor:"content_filtration",className:"cursor-pointer",children:"启用表情包过滤"})]}),n.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(le,{id:"filtration_prompt",value:n.filtration_prompt,onChange:g=>x({...n,filtration_prompt:g.target.value}),placeholder:"符合公序良俗"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"只有符合此要求的表情包才会被保存"})]})]})]})})]})}),z2=As.memo(function({member:n,groupIndex:i,memberIndex:c,availableChatIds:u,onUpdate:x,onRemove:h}){const f=u.includes(n)||n==="*",[p,g]=d.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(le,{value:n,onChange:N=>x(i,c,N.target.value),placeholder:'输入 "*" 或 "qq:123456:group"',className:"flex-1"}),u.length>0&&e.jsx(_,{size:"sm",variant:"outline",onClick:()=>g(!1),title:"切换到下拉选择",children:"下拉"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(Ie,{value:n,onValueChange:N=>x(i,c,N),children:[e.jsx($e,{className:"flex-1",children:e.jsx(Pe,{placeholder:"选择聊天流"})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"*",children:"* (全局共享)"}),u.map((N,v)=>e.jsx(Z,{value:N,children:N},v))]})]}),e.jsx(_,{size:"sm",variant:"outline",onClick:()=>g(!0),title:"切换到手动输入",children:"输入"})]})}),e.jsxs(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(ns,{className:"h-4 w-4"})})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:['确定要删除组成员 "',n||"(空)",'" 吗?此操作无法撤销。']})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>h(i,c),children:"删除"})]})]})]})]})}),A2=As.memo(function({config:n,onChange:i}){const c=()=>{i({...n,learning_list:[...n.learning_list,["","enable","enable","1.0"]]})},u=b=>{i({...n,learning_list:n.learning_list.filter((w,y)=>y!==b)})},x=(b,w,y)=>{const R=[...n.learning_list];R[b][w]=y,i({...n,learning_list:R})},h=({rule:b})=>{const w=`["${b[0]}", "${b[1]}", "${b[2]}", "${b[3]}"]`;return e.jsxs(ol,{children:[e.jsx(dl,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(ia,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Wa,{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:w}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},f=()=>{i({...n,expression_groups:[...n.expression_groups,[]]})},p=b=>{i({...n,expression_groups:n.expression_groups.filter((w,y)=>y!==b)})},g=b=>{const w=[...n.expression_groups];w[b]=[...w[b],""],i({...n,expression_groups:w})},N=(b,w)=>{const y=[...n.expression_groups];y[b]=y[b].filter((R,A)=>A!==w),i({...n,expression_groups:y})},v=(b,w,y)=>{const R=[...n.expression_groups];R[b][w]=y,i({...n,expression_groups:R})};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:n.all_global_jargon??!1,onCheckedChange:b=>i({...n,all_global_jargon:b})}),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:n.enable_jargon_explanation??!0,onCheckedChange:b=>i({...n,enable_jargon_explanation:b})}),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(Ie,{value:n.jargon_mode??"context",onValueChange:b=>i({...n,jargon_mode:b}),children:[e.jsx($e,{id:"jargon_mode",className:"mt-2",children:e.jsx(Pe,{placeholder:"选择黑话解释来源"})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"context",children:"上下文模式(自动匹配黑话)"}),e.jsx(Z,{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(et,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),e.jsxs("div",{className:"space-y-4",children:[n.learning_list.map((b,w)=>{const y=n.learning_list.some((C,D)=>D!==w&&C[0]===""),R=b[0]==="",A=b[0].split(":"),S=A[0]||"qq",B=A[1]||"",M=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:["规则 ",w+1," ",R&&"(全局配置)"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{rule:b}),e.jsxs(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"sm",variant:"ghost",children:e.jsx(ns,{className:"h-4 w-4"})})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:["确定要删除学习规则 ",w+1," 吗?此操作无法撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>u(w),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(Ie,{value:R?"global":"specific",onValueChange:C=>{C==="global"?x(w,0,""):x(w,0,"qq::group")},disabled:y&&!R,children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"global",children:"全局配置"}),e.jsx(Z,{value:"specific",disabled:y&&!R,children:"详细配置"})]})]}),y&&!R&&e.jsx("p",{className:"text-xs text-amber-600",children:"已存在全局配置,无法创建新的全局配置"})]}),!R&&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(Ie,{value:S,onValueChange:C=>{x(w,0,`${C}:${B}:${M}`)},children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"qq",children:"QQ"}),e.jsx(Z,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"群 ID"}),e.jsx(le,{value:B,onChange:C=>{x(w,0,`${S}:${C.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(Ie,{value:M,onValueChange:C=>{x(w,0,`${S}:${B}:${C}`)},children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"group",children:"群组(group)"}),e.jsx(Z,{value:"private",children:"私聊(private)"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",b[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:b[1]==="enable",onCheckedChange:C=>x(w,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:b[2]==="enable",onCheckedChange:C=>x(w,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:b[3]==="true"||b[3]==="enable",onCheckedChange:C=>x(w,3,C?"true":"false")})]})})]})]},w)}),n.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:n.expression_self_reflect??!1,onCheckedChange:b=>i({...n,expression_self_reflect:b})})]}),n.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(le,{id:"expression_auto_check_interval",type:"number",min:"60",value:n.expression_auto_check_interval??3600,onChange:b=>i({...n,expression_auto_check_interval:parseInt(b.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(le,{id:"expression_auto_check_count",type:"number",min:"1",max:"100",value:n.expression_auto_check_count??10,onChange:b=>i({...n,expression_auto_check_count:parseInt(b.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:()=>{i({...n,expression_auto_check_custom_criteria:[...n.expression_auto_check_custom_criteria||[],""]})},size:"sm",variant:"outline",children:[e.jsx(et,{className:"h-4 w-4 mr-1"}),"添加标准"]})]}),e.jsxs("div",{className:"space-y-2",children:[(n.expression_auto_check_custom_criteria||[]).map((b,w)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(le,{value:b,onChange:y=>{const R=[...n.expression_auto_check_custom_criteria||[]];R[w]=y.target.value,i({...n,expression_auto_check_custom_criteria:R})},placeholder:"输入评估标准,例如:是否符合角色人设",className:"flex-1"}),e.jsx(_,{onClick:()=>{i({...n,expression_auto_check_custom_criteria:(n.expression_auto_check_custom_criteria||[]).filter((y,R)=>R!==w)})},size:"icon",variant:"ghost",children:e.jsx(ns,{className:"h-4 w-4"})})]},w)),(!n.expression_auto_check_custom_criteria||n.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:n.expression_checked_only??!1,onCheckedChange:b=>i({...n,expression_checked_only:b})})]})}),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:n.expression_manual_reflect??!1,onCheckedChange:b=>i({...n,expression_manual_reflect:b})})]}),n.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 w=(n.manual_reflect_operator_id||"").split(":"),y=w[0]||"qq",R=w[1]||"",A=w[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(Ie,{value:y,onValueChange:S=>{i({...n,manual_reflect_operator_id:`${S}:${R}:${A}`})},children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"qq",children:"QQ"}),e.jsx(Z,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"用户/群 ID"}),e.jsx(le,{value:R,onChange:S=>{i({...n,manual_reflect_operator_id:`${y}:${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(Ie,{value:A,onValueChange:S=>{i({...n,manual_reflect_operator_id:`${y}:${R}:${S}`})},children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"private",children:"私聊(private)"}),e.jsx(Z,{value:"group",children:"群组(group)"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前操作员 ID:",n.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:()=>{i({...n,allow_reflect:[...n.allow_reflect||[],"qq::group"]})},size:"sm",variant:"outline",children:[e.jsx(et,{className:"h-4 w-4 mr-1"}),"添加聊天流"]})]}),e.jsxs("div",{className:"space-y-2",children:[(n.allow_reflect||[]).map((b,w)=>{const y=b.split(":"),R=y[0]||"qq",A=y[1]||"",S=y[2]||"group";return e.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg bg-muted/50",children:[e.jsxs(Ie,{value:R,onValueChange:B=>{const M=[...n.allow_reflect];M[w]=`${B}:${A}:${S}`,i({...n,allow_reflect:M})},children:[e.jsx($e,{className:"w-24",children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"qq",children:"QQ"}),e.jsx(Z,{value:"wx",children:"微信"})]})]}),e.jsx(le,{value:A,onChange:B=>{const M=[...n.allow_reflect];M[w]=`${R}:${B.target.value}:${S}`,i({...n,allow_reflect:M})},placeholder:"ID",className:"flex-1 font-mono text-sm"}),e.jsxs(Ie,{value:S,onValueChange:B=>{const M=[...n.allow_reflect];M[w]=`${R}:${A}:${B}`,i({...n,allow_reflect:M})},children:[e.jsx($e,{className:"w-32",children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"group",children:"群组"}),e.jsx(Z,{value:"private",children:"私聊"})]})]}),e.jsx(_,{onClick:()=>{i({...n,allow_reflect:n.allow_reflect.filter((B,M)=>M!==w)})},size:"sm",variant:"ghost",children:e.jsx(ns,{className:"h-4 w-4"})})]},w)}),(!n.allow_reflect||n.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(et,{className:"h-4 w-4 mr-1"}),"添加共享组"]})]}),e.jsxs("div",{className:"space-y-4",children:[n.expression_groups.map((b,w)=>{const y=n.learning_list.map(R=>R[0]).filter(R=>R!=="");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:["共享组 ",w+1,b.length===1&&b[0]==="*"&&"(全局共享)"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(_,{onClick:()=>g(w),size:"sm",variant:"outline",children:e.jsx(et,{className:"h-4 w-4"})}),e.jsxs(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"sm",variant:"ghost",children:e.jsx(ns,{className:"h-4 w-4"})})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:["确定要删除共享组 ",w+1," 吗?此操作无法撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>p(w),children:"删除"})]})]})]})]})]}),e.jsx("div",{className:"space-y-2",children:b.map((R,A)=>e.jsx(z2,{member:R,groupIndex:w,memberIndex:A,availableChatIds:y,onUpdate:v,onRemove:N},`${w}-${A}`))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:'提示:可以从下拉框选择已配置的聊天流,或手动输入。输入 "*" 启用全局共享'})]},w)}),n.expression_groups.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无共享组,点击"添加共享组"开始配置'})]})]})})]})});function D2({regex:l,reaction:n,onRegexChange:i,onReactionChange:c}){const[u,x]=d.useState(!1),[h,f]=d.useState(""),[p,g]=d.useState(null),[N,v]=d.useState(""),[b,w]=d.useState({}),[y,R]=d.useState(""),A=d.useRef(null),[S,B]=d.useState("build"),M=L=>L.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),C=(L,J=0)=>{const U=A.current;if(!U)return;const oe=U.selectionStart||0,Ne=U.selectionEnd||0,je=l.substring(0,oe)+L+l.substring(Ne);i(je),setTimeout(()=>{const re=oe+L.length+J;U.setSelectionRange(re,re),U.focus()},0)};d.useEffect(()=>{if(!l||!h){p!==null&&g(null),Object.keys(b).length>0&&w({}),y!==n&&R(n),N!==""&&v("");return}try{const L=M(l),J=new RegExp(L,"g"),U=h.match(J);g(U),v("");const Ne=new RegExp(L).exec(h);if(Ne&&Ne.groups){w(Ne.groups);let je=n;Object.entries(Ne.groups).forEach(([re,fe])=>{je=je.replace(new RegExp(`\\[${re}\\]`,"g"),fe||"")}),R(je)}else w({}),R(n)}catch(L){v(L.message),g(null),w({}),R(n)}},[l,h,n,p,b,y,N]);const D=()=>{if(!h||!p||p.length===0)return e.jsx("span",{className:"text-muted-foreground",children:h||"请输入测试文本"});try{const L=M(l),J=new RegExp(L,"g");let U=0;const oe=[];let Ne;for(;(Ne=J.exec(h))!==null;)Ne.index>U&&oe.push(e.jsx("span",{children:h.substring(U,Ne.index)},`text-${U}`)),oe.push(e.jsx("span",{className:"bg-yellow-200 dark:bg-yellow-900 font-semibold",children:Ne[0]},`match-${Ne.index}`)),U=Ne.index+Ne[0].length;return U)",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(Is,{open:u,onOpenChange:x,children:[e.jsx(ed,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(Qm,{className:"h-4 w-4 mr-1"}),"正则编辑器"]})}),e.jsxs(Ds,{className:"max-w-[95vw] sm:max-w-[900px] max-h-[90vh]",children:[e.jsxs(Os,{children:[e.jsx(Rs,{children:"正则表达式编辑器"}),e.jsx(Ks,{className:"text-sm",children:"使用可视化工具构建正则表达式,并实时测试效果"})]}),e.jsx(Je,{className:"max-h-[calc(90vh-120px)]",children:e.jsxs(ta,{value:S,onValueChange:L=>B(L),className:"w-full",children:[e.jsxs(Xt,{className:"grid w-full grid-cols-2",children:[e.jsx(Xe,{value:"build",children:"🔧 构建器"}),e.jsx(Xe,{value:"test",children:"🧪 测试器"})]}),e.jsxs(ys,{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(le,{ref:A,value:l,onChange:L=>i(L.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(ot,{value:n,onChange:L=>c(L.target.value),placeholder:"使用 [捕获组名] 引用捕获的内容...",rows:3,className:"text-sm"})]}),e.jsxs("div",{className:"space-y-4 border-t pt-4",children:[H.map(L=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("h5",{className:"text-xs font-semibold text-primary",children:L.category}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:L.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))})]},L.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:()=>i("^(?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:()=>i("(?:[^,。.\\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:()=>i("(?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(ys,{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:l||"(未设置)"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"test-text",className:"text-sm font-medium",children:"测试文本"}),e.jsx(ot,{id:"test-text",value:h,onChange:L=>f(L.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(Je,{className:"h-40 rounded-md bg-muted p-3",children:e.jsx("div",{className:"text-sm break-words",children:D()})})]}),Object.keys(b).length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"命名捕获组"}),e.jsx(Je,{className:"h-32 rounded-md border p-3",children:e.jsx("div",{className:"space-y-2",children:Object.entries(b).map(([L,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:["[",L,"]"]}),e.jsx("span",{className:"text-muted-foreground",children:"="}),e.jsx("span",{className:"font-mono bg-muted px-2 py-0.5 rounded",children:J})]},L))})})]}),Object.keys(b).length>0&&n&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"Reaction 替换预览"}),e.jsx(Je,{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:y})}),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 O2=As.memo(function({keywordReactionConfig:n,responsePostProcessConfig:i,chineseTypoConfig:c,responseSplitterConfig:u,onKeywordReactionChange:x,onResponsePostProcessChange:h,onChineseTypoChange:f,onResponseSplitterChange:p}){const g=()=>{x({...n,regex_rules:[...n.regex_rules,{regex:[""],reaction:""}]})},N=C=>{x({...n,regex_rules:n.regex_rules.filter((D,H)=>H!==C)})},v=(C,D,H)=>{const L=[...n.regex_rules];D==="regex"&&typeof H=="string"?L[C]={...L[C],regex:[H]}:D==="reaction"&&typeof H=="string"&&(L[C]={...L[C],reaction:H}),x({...n,regex_rules:L})},b=()=>{x({...n,keyword_rules:[...n.keyword_rules,{keywords:[],reaction:""}]})},w=C=>{x({...n,keyword_rules:n.keyword_rules.filter((D,H)=>H!==C)})},y=(C,D,H)=>{const L=[...n.keyword_rules];typeof H=="string"&&(L[C]={...L[C],reaction:H}),x({...n,keyword_rules:L})},R=C=>{const D=[...n.keyword_rules];D[C]={...D[C],keywords:[...D[C].keywords||[],""]},x({...n,keyword_rules:D})},A=(C,D)=>{const H=[...n.keyword_rules];H[C]={...H[C],keywords:(H[C].keywords||[]).filter((L,J)=>J!==D)},x({...n,keyword_rules:H})},S=(C,D,H)=>{const L=[...n.keyword_rules],J=[...L[C].keywords||[]];J[D]=H,L[C]={...L[C],keywords:J},x({...n,keyword_rules:L})},B=({rule:C})=>{const D=`{ regex = [${(C.regex||[]).map(H=>`"${H}"`).join(", ")}], reaction = "${C.reaction}" }`;return e.jsxs(ol,{children:[e.jsx(dl,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(ia,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Wa,{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(Je,{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 文件中的格式"})]})})]})},M=({rule:C})=>{const D=`[[keyword_reaction.keyword_rules]] +keywords = [${(C.keywords||[]).map(H=>`"${H}"`).join(", ")}] +reaction = "${C.reaction}"`;return e.jsxs(ol,{children:[e.jsx(dl,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(ia,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Wa,{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(Je,{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(et,{className:"h-4 w-4 mr-1"}),"添加正则规则"]})]}),e.jsxs("div",{className:"space-y-3",children:[n.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(D2,{regex:C.regex&&C.regex[0]||"",reaction:C.reaction,onRegexChange:H=>v(D,"regex",H),onReactionChange:H=>v(D,"reaction",H)}),e.jsx(B,{rule:C}),e.jsxs(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"sm",variant:"ghost",children:e.jsx(ns,{className:"h-4 w-4"})})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:["确定要删除正则规则 ",D+1," 吗?此操作无法撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>N(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(le,{value:C.regex&&C.regex[0]||"",onChange:H=>v(D,"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(ot,{value:C.reaction,onChange:H=>v(D,"reaction",H.target.value),placeholder:`触发后麦麦的反应... +可以使用 [捕获组名] 来引用正则表达式中的内容`,rows:3,className:"text-sm"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"使用 [捕获组名] 引用正则表达式中的命名捕获组,例如 [n] 会被替换为捕获的内容"})]})]})]},D)),n.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:b,size:"sm",variant:"outline",children:[e.jsx(et,{className:"h-4 w-4 mr-1"}),"添加关键词规则"]})]}),e.jsxs("div",{className:"space-y-3",children:[n.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(M,{rule:C}),e.jsxs(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"sm",variant:"ghost",children:e.jsx(ns,{className:"h-4 w-4"})})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:["确定要删除关键词规则 ",D+1," 吗?此操作无法撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>w(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:()=>R(D),size:"sm",variant:"ghost",children:[e.jsx(et,{className:"h-3 w-3 mr-1"}),"添加关键词"]})]}),e.jsxs("div",{className:"space-y-2",children:[(C.keywords||[]).map((H,L)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(le,{value:H,onChange:J=>S(D,L,J.target.value),placeholder:"关键词",className:"flex-1"}),e.jsx(_,{onClick:()=>A(D,L),size:"sm",variant:"ghost",children:e.jsx(ns,{className:"h-4 w-4"})})]},L)),(!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(ot,{value:C.reaction,onChange:H=>y(D,"reaction",H.target.value),placeholder:"触发后麦麦的反应...",rows:3,className:"text-sm"})]})]})]},D)),n.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:i.enable_response_post_process,onCheckedChange:C=>h({...i,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:"包括错别字生成器和回复分割器"})]}),i.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(le,{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(le,{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(le,{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(le,{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:u.enable,onCheckedChange:C=>p({...u,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:"控制回复的长度和句子数量"}),u.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(le,{id:"max_length",type:"number",min:"1",value:u.max_length,onChange:C=>p({...u,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(le,{id:"max_sentence_num",type:"number",min:"1",value:u.max_sentence_num,onChange:C=>p({...u,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:u.enable_kaomoji_protection,onCheckedChange:C=>p({...u,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:u.enable_overflow_return_all,onCheckedChange:C=>p({...u,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:"当句子数量超出限制时,合并后一次性返回所有内容"})]})]})})]})]})]})}),R2=As.memo(function({config:n,onChange:i}){const[c,u]=d.useState(""),[x,h]=d.useState(""),[f,p]=d.useState(!1),g=n.allowed_ips?n.allowed_ips.split(",").map(S=>S.trim()).filter(S=>S):[],N=n.trusted_proxies?n.trusted_proxies.split(",").map(S=>S.trim()).filter(S=>S):[],v=()=>{if(!c.trim())return;const S=[...g,c.trim()];i({...n,allowed_ips:S.join(",")}),u("")},b=S=>{const B=g.filter((M,C)=>C!==S);i({...n,allowed_ips:B.join(",")})},w=()=>{if(!x.trim())return;const S=[...N,x.trim()];i({...n,trusted_proxies:S.join(",")}),h("")},y=S=>{const B=N.filter((M,C)=>C!==S);i({...n,trusted_proxies:B.join(",")})},R=S=>{!S&&n.enabled?p(!0):i({...n,enabled:S})},A=()=>{i({...n,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:n.enabled,onCheckedChange:R}),e.jsx(T,{className:"cursor-pointer",children:"启用 WebUI"})]}),n.enabled&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"运行模式"}),e.jsxs(Ie,{value:n.mode,onValueChange:S=>i({...n,mode:S}),children:[e.jsx($e,{children:e.jsx(Pe,{placeholder:"选择运行模式"})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"development",children:"开发模式"}),e.jsx(Z,{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(Ie,{value:n.anti_crawler_mode,onValueChange:S=>i({...n,anti_crawler_mode:S}),children:[e.jsx($e,{children:e.jsx(Pe,{placeholder:"选择防爬虫模式"})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"false",children:"禁用"}),e.jsx(Z,{value:"basic",children:"基础(只记录不阻止)"}),e.jsx(Z,{value:"loose",children:"宽松"}),e.jsx(Z,{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(le,{value:c,onChange:S=>u(S.target.value),onKeyDown:S=>{S.key==="Enter"&&(S.preventDefault(),v())},placeholder:"输入IP地址后按回车或点击添加"}),e.jsx(_,{type:"button",size:"sm",onClick:v,disabled:!c.trim(),children:e.jsx(et,{className:"h-4 w-4"})})]}),g.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:g.map((S,B)=>e.jsxs(ke,{variant:"secondary",className:"flex items-center gap-1",children:[S,e.jsx("button",{type:"button",onClick:()=>b(B),className:"ml-1 hover:bg-destructive/20 rounded-full p-0.5",children:e.jsx(Ea,{className:"h-3 w-3"})})]},B))}),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(le,{value:x,onChange:S=>h(S.target.value),onKeyDown:S=>{S.key==="Enter"&&(S.preventDefault(),w())},placeholder:"输入代理IP后按回车或点击添加"}),e.jsx(_,{type:"button",size:"sm",onClick:w,disabled:!x.trim(),children:e.jsx(et,{className:"h-4 w-4"})})]}),N.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:N.map((S,B)=>e.jsxs(ke,{variant:"secondary",className:"flex items-center gap-1",children:[S,e.jsx("button",{type:"button",onClick:()=>y(B),className:"ml-1 hover:bg-destructive/20 rounded-full p-0.5",children:e.jsx(Ea,{className:"h-3 w-3"})})]},B))}),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:n.trust_xff,onCheckedChange:S=>i({...n,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:n.secure_cookie,onCheckedChange:S=>i({...n,secure_cookie:S})}),e.jsx(T,{className:"cursor-pointer",children:"启用安全 Cookie(仅 HTTPS)"})]})]})]}),e.jsx(vs,{open:f,onOpenChange:p,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"警告:即将关闭 WebUI"}),e.jsxs(hs,{children:["关闭 WebUI 后,在您下次重启麦麦之前,WebUI 界面将无法访问。",e.jsx("br",{}),e.jsx("br",{}),"您需要通过修改配置文件或命令行重新启用 WebUI 才能再次访问此界面。",e.jsx("br",{}),e.jsx("br",{}),"确定要关闭 WebUI 吗?"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{variant:"destructive",onClick:A,children:"确认关闭"})]})]})})]})}),Nn="/api/webui/config";async function wg(){const n=await(await _e(`${Nn}/bot`)).json();if(!n.success)throw new Error("获取配置数据失败");return n.config}async function un(){const n=await(await _e(`${Nn}/model`)).json();if(!n.success)throw new Error("获取模型配置数据失败");return n.config}async function _g(l){const i=await(await _e(`${Nn}/bot`,{method:"POST",body:JSON.stringify(l)})).json();if(!i.success)throw new Error(i.message||"保存配置失败")}async function L2(){const n=await(await _e(`${Nn}/bot/raw`)).json();if(!n.success)throw new Error("获取配置源代码失败");return n.content}async function U2(l){const i=await(await _e(`${Nn}/bot/raw`,{method:"POST",body:JSON.stringify({raw_content:l})})).json();if(!i.success)throw new Error(i.message||"保存配置失败")}async function Xi(l){const i=await(await _e(`${Nn}/model`,{method:"POST",body:JSON.stringify(l)})).json();if(!i.success)throw new Error(i.message||"保存配置失败")}async function $2(l,n){const c=await(await _e(`${Nn}/bot/section/${l}`,{method:"POST",body:JSON.stringify(n)})).json();if(!c.success)throw new Error(c.message||`保存配置节 ${l} 失败`)}async function Bm(l,n){const c=await(await _e(`${Nn}/model/section/${l}`,{method:"POST",body:JSON.stringify(n)})).json();if(!c.success)throw new Error(c.message||`保存配置节 ${l} 失败`)}async function B2(l,n="openai",i="/models"){const c=new URLSearchParams({provider_name:l,parser:n,endpoint:i}),u=await _e(`/api/webui/models/list?${c}`);if(!u.ok){const h=await u.json().catch(()=>({}));throw new Error(h.detail||`获取模型列表失败 (${u.status})`)}const x=await u.json();if(!x.success)throw new Error("获取模型列表失败");return x.models}async function I2(l){const n=new URLSearchParams({provider_name:l}),i=await _e(`/api/webui/models/test-connection-by-name?${n}`,{method:"POST"});if(!i.ok){const c=await i.json().catch(()=>({}));throw new Error(c.detail||`测试连接失败 (${i.status})`)}return await i.json()}const P2=Qr("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"}}),at=d.forwardRef(({className:l,variant:n,...i},c)=>e.jsx("div",{ref:c,role:"alert",className:P(P2({variant:n}),l),...i}));at.displayName="Alert";const Hn=d.forwardRef(({className:l,...n},i)=>e.jsx("h5",{ref:i,className:P("mb-1 font-medium leading-none tracking-tight",l),...n}));Hn.displayName="AlertTitle";const lt=d.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:P("text-sm [&_p]:leading-relaxed",l),...n}));lt.displayName="AlertDescription";const H2={name:"toml",startState:function(){return{inString:!1,stringType:"",lhs:!0,inArray:0}},token:function(l,n){let i;if(!n.inString&&(i=l.match(/^('''|"""|'|")/))&&(n.stringType=i[0],n.inString=!0),l.sol()&&!n.inString&&n.inArray===0&&(n.lhs=!0),n.inString){for(;n.inString;)if(l.match(n.stringType))n.inString=!1;else if(l.peek()==="\\")l.next(),l.next();else{if(l.eol())break;l.match(/^.[^\\\"\']*/)}return n.lhs?"property":"string"}else{if(n.inArray&&l.peek()==="]")return l.next(),n.inArray--,"bracket";if(n.lhs&&l.peek()==="["&&l.skipTo("]"))return l.next(),l.peek()==="]"&&l.next(),"atom";if(l.peek()==="#")return l.skipToEnd(),"comment";if(l.eatSpace())return null;if(n.lhs&&l.eatWhile(function(c){return c!="="&&c!=" "}))return"property";if(n.lhs&&l.peek()==="=")return l.next(),n.lhs=!1,null;if(!n.lhs&&l.match(/^\d\d\d\d[\d\-\:\.T]*Z/))return"atom";if(!n.lhs&&(l.match("true")||l.match("false")))return"atom";if(!n.lhs&&l.peek()==="[")return n.inArray++,l.next(),"bracket";if(!n.lhs&&l.match(/^\-?\d+(?:\.\d+)?/))return"number";l.eatSpace()||l.next()}return null},languageData:{commentTokens:{line:"#"}}},F2={python:[E1()],json:[M1(),z1()],toml:[T1.define(H2)],text:[]};function yv({value:l,onChange:n,language:i="text",readOnly:c=!1,height:u="400px",minHeight:x,maxHeight:h,placeholder:f,theme:p="dark",className:g=""}){const[N,v]=d.useState(!1);if(d.useEffect(()=>{v(!0)},[]),!N)return e.jsx("div",{className:`rounded-md border bg-muted animate-pulse ${g}`,style:{height:u,minHeight:x,maxHeight:h}});const b=[...F2[i]||[],mg.lineWrapping];return c&&b.push(mg.editable.of(!1)),e.jsx("div",{className:`rounded-md overflow-hidden border ${g}`,children:e.jsx(A1,{value:l,height:u,minHeight:x,maxHeight:h,theme:p==="dark"?D1:void 0,extensions:b,onChange:n,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 G2({id:l,index:n,itemType:i,itemFields:c,value:u,onChange:x,onRemove:h,disabled:f,canRemove:p,placeholder:g}){const{attributes:N,listeners:v,setNodeRef:b,transform:w,transition:y,isDragging:R}=sv({id:l,disabled:f}),A={transform:tv.Transform.toString(w),transition:y};return e.jsxs("div",{ref:b,style:A,className:P("flex items-start gap-2 group",R&&"opacity-50 z-50"),children:[e.jsx("button",{type:"button",className:P("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,...v,children:e.jsx(Uj,{className:"h-4 w-4"})}),e.jsx("div",{className:"flex-1 min-w-0",children:i==="object"&&c?e.jsx(V2,{value:u,onChange:x,fields:c,disabled:f}):i==="number"?e.jsx(le,{type:"number",value:u??"",onChange:S=>x(parseFloat(S.target.value)||0),placeholder:g??`第 ${n+1} 项`,disabled:f,className:"font-mono"}):e.jsx(le,{type:"text",value:u??"",onChange:S=>x(S.target.value),placeholder:g??`第 ${n+1} 项`,disabled:f})}),e.jsx(_,{type:"button",variant:"ghost",size:"icon",onClick:h,disabled:f||!p,className:P("flex-shrink-0 text-muted-foreground hover:text-destructive","opacity-0 group-hover:opacity-100 focus:opacity-100 transition-opacity"),children:e.jsx(ns,{className:"h-4 w-4"})})]})}function V2({value:l,onChange:n,fields:i,disabled:c}){const u=d.useCallback((h,f)=>{n({...l,[h]:f})},[l,n]),x=(h,f)=>{const p=l?.[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=>u(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:N=>u(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(Ie,{value:String(p??f.default??""),onValueChange:g=>u(h,g),disabled:c,children:[e.jsx($e,{className:"h-8 text-sm",children:e.jsx(Pe,{placeholder:f.placeholder??"请选择"})}),e.jsx(Be,{children:f.choices.map(g=>e.jsx(Z,{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(le,{type:"number",value:p??f.default??"",onChange:g=>u(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(le,{type:"text",value:p??f.default??"",onChange:g=>u(h,g.target.value),placeholder:f.placeholder,disabled:c,className:"h-8 text-sm"})]})};return e.jsx(Te,{className:"p-3 space-y-2 bg-muted/30",children:Object.entries(i).map(([h,f])=>e.jsx("div",{children:x(h,f)},h))})}function q2({value:l,onChange:n,itemType:i="string",itemFields:c,minItems:u,maxItems:x,disabled:h,placeholder:f}){const p=d.useMemo(()=>Array.isArray(l)?l:typeof l=="string"&&l.trim()?l.split(",").map(M=>M.trim()):[],[l]),[g]=d.useState(()=>new Map),N=d.useCallback(M=>(g.has(M)||g.set(M,`item-${Date.now()}-${M}-${Math.random().toString(36).slice(2)}`),g.get(M)),[g]),v=d.useMemo(()=>{const M=[];for(let C=0;C{const{active:C,over:D}=M;if(D&&C.id!==D.id){const H=v.indexOf(C.id),L=v.indexOf(D.id),J=Xj(p,H,L);n(J)}},[p,v,n]),y=d.useCallback(()=>{if(x!=null&&p.length>=x)return;let M;i==="object"&&c?M=Object.fromEntries(Object.entries(c).map(([C,D])=>[C,D.default??""])):i==="number"?M=0:M="",n([...p,M])},[p,x,i,c,n]),R=d.useCallback((M,C)=>{const D=[...p];D[M]=C,n(D)},[p,n]),A=d.useCallback(M=>{if(u!=null&&p.length<=u)return;const C=p.filter((D,H)=>H!==M);g.delete(M),n(C)},[p,u,g,n]),S=x==null||p.lengthu;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(_t,{className:"h-4 w-4"}),e.jsx("span",{children:"暂无数据,点击下方按钮添加"})]}):e.jsx(Zj,{sensors:b,collisionDetection:Wj,onDragEnd:w,children:e.jsx(ev,{items:v,strategy:O1,children:e.jsx("div",{className:"space-y-2",children:p.map((M,C)=>e.jsx(G2,{id:v[C],index:C,itemType:i,itemFields:c,value:M,onChange:D=>R(C,D),onRemove:()=>A(C),disabled:h,canRemove:B,placeholder:f},v[C]))})})}),e.jsxs(_,{type:"button",variant:"outline",size:"sm",onClick:y,disabled:h||!S,className:"w-full",children:[e.jsx(et,{className:"h-4 w-4 mr-1"}),"添加项目",x!==void 0&&e.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(",p.length,"/",x,")"]})]}),(u!=null||x!=null)&&(u!==null||x!==null)&&e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:u!=null&&x!=null?`允许 ${u} - ${x} 项`:u!=null?`至少 ${u} 项`:`最多 ${x} 项`})]})}function lx({content:l,className:n=""}){return e.jsx("div",{className:`prose prose-sm dark:prose-invert max-w-none ${n}`,children:e.jsx(I1,{remarkPlugins:[H1,F1],rehypePlugins:[P1],components:{code({inline:i,className:c,children:u,...x}){return i?e.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-sm font-mono",...x,children:u}):e.jsx("code",{className:`${c} block bg-muted p-4 rounded-lg overflow-x-auto`,...x,children:u})},table({children:i,...c}){return e.jsx("div",{className:"overflow-x-auto",children:e.jsx("table",{className:"border-collapse border border-border",...c,children:i})})},th({children:i,...c}){return e.jsx("th",{className:"border border-border bg-muted px-4 py-2 text-left font-semibold",...c,children:i})},td({children:i,...c}){return e.jsx("td",{className:"border border-border px-4 py-2",...c,children:i})},a({children:i,...c}){return e.jsx("a",{className:"text-primary hover:underline",target:"_blank",rel:"noopener noreferrer",...c,children:i})},blockquote({children:i,...c}){return e.jsx("blockquote",{className:"border-l-4 border-primary pl-4 italic text-muted-foreground",...c,children:i})},h1({children:i,...c}){return e.jsx("h1",{className:"text-3xl font-bold mt-6 mb-4",...c,children:i})},h2({children:i,...c}){return e.jsx("h2",{className:"text-2xl font-bold mt-5 mb-3",...c,children:i})},h3({children:i,...c}){return e.jsx("h3",{className:"text-xl font-bold mt-4 mb-2",...c,children:i})},h4({children:i,...c}){return e.jsx("h4",{className:"text-lg font-semibold mt-3 mb-2",...c,children:i})},ul({children:i,...c}){return e.jsx("ul",{className:"list-disc list-inside space-y-1 my-2",...c,children:i})},ol({children:i,...c}){return e.jsx("ol",{className:"list-decimal list-inside space-y-1 my-2",...c,children:i})},p({children:i,...c}){return e.jsx("p",{className:"my-2 leading-relaxed",...c,children:i})},hr({...i}){return e.jsx("hr",{className:"my-4 border-border",...i})}},children:l})})}function K2(l,n,i,c={}){const{debounceMs:u=2e3,onSaveSuccess:x,onSaveError:h}=c,f=d.useRef(null),p=d.useCallback(async(b,w)=>{try{n(!0),await $2(b,w),i(!1),x?.()}catch(y){console.error(`自动保存 ${b} 失败:`,y),i(!0),h?.(y instanceof Error?y:new Error(String(y)))}finally{n(!1)}},[n,i,x,h]),g=d.useCallback((b,w)=>{l||(i(!0),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{p(b,w)},u))},[l,i,p,u]),N=d.useCallback(async(b,w)=>{f.current&&(clearTimeout(f.current),f.current=null),await p(b,w)},[p]),v=d.useCallback(()=>{f.current&&(clearTimeout(f.current),f.current=null)},[]);return d.useEffect(()=>()=>{f.current&&clearTimeout(f.current)},[]),{triggerAutoSave:g,saveNow:N,cancelPendingAutoSave:v}}function Lt(l,n,i,c){d.useEffect(()=>{l&&!i&&c(n,l)},[l])}const Q2=500;function Y2(){return e.jsx(Jn,{children:e.jsx(J2,{})})}function J2(){const[l,n]=d.useState(!0),[i,c]=d.useState(!1),[u,x]=d.useState(!1),[h,f]=d.useState(!1),[p,g]=d.useState("visual"),[N,v]=d.useState(""),[b,w]=d.useState(!1),{toast:y}=Zs(),{triggerRestart:R,isRestarting:A}=vn(),[S,B]=d.useState(null),[M,C]=d.useState(null),[D,H]=d.useState(null),[L,J]=d.useState(null),[U,oe]=d.useState(null),[Ne,je]=d.useState(null),[re,fe]=d.useState(null),[ge,E]=d.useState(null),[K,I]=d.useState(null),[ue,Q]=d.useState(null),[Se,pe]=d.useState(null),[Ce,z]=d.useState(null),[O,V]=d.useState(null),[de,De]=d.useState(null),[W,Y]=d.useState(null),[He,F]=d.useState(null),[ee,Ue]=d.useState(null),[ie,Ee]=d.useState(null),[me,Me]=d.useState(null),rs=d.useRef(!0),Ut=d.useRef({}),aa=d.useCallback(ze=>{Ut.current=ze,B(ze.bot),C(ze.personality);const Ns=ze.chat;Ns.talk_value_rules||(Ns.talk_value_rules=[]),H(Ns),J(ze.expression),oe(ze.emoji),je(ze.memory),fe(ze.tool),E(ze.voice),I(ze.dream),Q(ze.lpmm_knowledge),pe(ze.keyword_reaction),z(ze.response_post_process),V(ze.chinese_typo),De(ze.response_splitter),Y(ze.log),F(ze.debug),Ue(ze.maim_message),Ee(ze.telemetry),Me(ze.webui)},[]),Qa=d.useCallback(()=>({...Ut.current,bot:S,personality:M,chat:D,expression:L,emoji:U,memory:Ne,tool:re,voice:ge,dream:K,lpmm_knowledge:ue,keyword_reaction:Se,response_post_process:Ce,chinese_typo:O,response_splitter:de,log:W,debug:He,maim_message:ee,telemetry:ie,webui:me}),[S,M,D,L,U,Ne,re,ge,K,ue,Se,Ce,O,de,W,He,ee,ie,me]),Ft=d.useCallback(async()=>{try{const Ns=(await L2()).replace(/"([^"]*)"/g,(ls,ss)=>`"${ss.replace(/\\n/g,` +`).replace(/\\t/g," ").replace(/\\r/g,"\r").replace(/\\"/g,'"').replace(/\\\\/g,"\\")}"`);v(Ns),w(!1)}catch(ze){y({variant:"destructive",title:"加载失败",description:ze instanceof Error?ze.message:"加载源代码失败"})}},[y]),mt=d.useCallback(async()=>{try{n(!0);const ze=await wg();aa(ze),f(!1),rs.current=!1,await Ft()}catch(ze){console.error("加载配置失败:",ze),y({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}finally{n(!1)}},[y,Ft,aa]);d.useEffect(()=>{mt()},[mt]);const{triggerAutoSave:q,cancelPendingAutoSave:qe}=K2(rs.current,x,f);Lt(S,"bot",rs.current,q),Lt(M,"personality",rs.current,q),Lt(D,"chat",rs.current,q),Lt(L,"expression",rs.current,q),Lt(U,"emoji",rs.current,q),Lt(Ne,"memory",rs.current,q),Lt(re,"tool",rs.current,q),Lt(ge,"voice",rs.current,q),Lt(K,"dream",rs.current,q),Lt(ue,"lpmm_knowledge",rs.current,q),Lt(Se,"keyword_reaction",rs.current,q),Lt(Ce,"response_post_process",rs.current,q),Lt(O,"chinese_typo",rs.current,q),Lt(de,"response_splitter",rs.current,q),Lt(W,"log",rs.current,q),Lt(He,"debug",rs.current,q),Lt(ee,"maim_message",rs.current,q),Lt(ie,"telemetry",rs.current,q),Lt(me,"webui",rs.current,q);const Qe=async()=>{try{c(!0);const ze=N.replace(/"([^"]*)"/g,(Ns,ls)=>`"${ls.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r")}"`);await U2(ze),f(!1),w(!1),y({title:"保存成功",description:"配置已保存"}),await mt()}catch(ze){w(!0),y({variant:"destructive",title:"保存失败",description:ze instanceof Error?ze.message:"保存配置失败"})}finally{c(!1)}},es=async ze=>{if(h){y({variant:"destructive",title:"切换失败",description:"请先保存当前更改"});return}if(g(ze),ze==="source")await Ft();else try{const Ns=await wg();aa(Ns),f(!1)}catch(Ns){console.error("加载配置失败:",Ns),y({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}},Ls=async()=>{try{c(!0),qe(),await _g(Qa()),f(!1),y({title:"保存成功",description:"麦麦主程序配置已保存"})}catch(ze){console.error("保存配置失败:",ze),y({title:"保存失败",description:ze.message,variant:"destructive"})}finally{c(!1)}},as=async()=>{await R()},Cs=async()=>{try{c(!0),qe(),await _g(Qa()),f(!1),y({title:"保存成功",description:"配置已保存,即将重启麦麦..."}),await new Promise(ze=>setTimeout(ze,Q2)),await as()}catch(ze){console.error("保存失败:",ze),y({title:"保存失败",description:ze.message,variant:"destructive"})}finally{c(!1)}};return l?e.jsx(Je,{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(Je,{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"?Ls:Qe,disabled:i||u||!h||A,size:"sm",variant:"outline",className:"w-20 sm:w-24",children:[e.jsx(dc,{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:i?"保存中":u?"自动":h?"保存":"已保存"})]}),e.jsxs(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{disabled:i||u||A,size:"sm",className:"w-20 sm:w-28",children:[e.jsx(oc,{className:"h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"ml-1 truncate text-xs sm:text-sm",children:A?"重启中":h?"保存重启":"重启"})]})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认重启麦麦?"}),e.jsx(hs,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:h?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})})})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:h?Cs:as,children:h?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsx("div",{className:"flex",children:e.jsx(ta,{value:p,onValueChange:ze=>es(ze),className:"w-full",children:e.jsxs(Xt,{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($j,{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(Bj,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"源代码编辑"]})]})})})]}),e.jsxs(at,{children:[e.jsx(Ht,{className:"h-4 w-4"}),e.jsxs(lt,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),p==="source"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(at,{children:[e.jsx(Ht,{className:"h-4 w-4"}),e.jsxs(lt,{children:[e.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。此功能仅适用于熟悉 TOML 语法的高级用户。保存时会在后端验证格式,只有格式完全正确才能保存。",b&&e.jsx("span",{className:"text-destructive font-semibold ml-2",children:"⚠️ 上次保存失败,请检查 TOML 格式"})]})]}),e.jsx(yv,{value:N,onChange:ze=>{v(ze),f(!0),b&&w(!1)},language:"toml",theme:"dark",height:"calc(100vh - 280px)",minHeight:"500px",placeholder:"TOML 配置内容"})]}),p==="visual"&&e.jsx(e.Fragment,{children:e.jsxs(ta,{defaultValue:"bot",className:"w-full",children:[e.jsxs(Xt,{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(ys,{value:"bot",className:"space-y-4",children:S&&e.jsx(v2,{config:S,onChange:B})}),e.jsx(ys,{value:"personality",className:"space-y-4",children:M&&e.jsx(N2,{config:M,onChange:C})}),e.jsx(ys,{value:"chat",className:"space-y-4",children:D&&e.jsx(w2,{config:D,onChange:H})}),e.jsx(ys,{value:"expression",className:"space-y-4",children:L&&e.jsx(A2,{config:L,onChange:J})}),e.jsx(ys,{value:"features",className:"space-y-4",children:U&&Ne&&re&&ge&&e.jsx(M2,{emojiConfig:U,memoryConfig:Ne,toolConfig:re,voiceConfig:ge,onEmojiChange:oe,onMemoryChange:je,onToolChange:fe,onVoiceChange:E})}),e.jsx(ys,{value:"processing",className:"space-y-4",children:Se&&Ce&&O&&de&&e.jsx(O2,{keywordReactionConfig:Se,responsePostProcessConfig:Ce,chineseTypoConfig:O,responseSplitterConfig:de,onKeywordReactionChange:pe,onResponsePostProcessChange:z,onChineseTypoChange:V,onResponseSplitterChange:De})}),e.jsx(ys,{value:"dream",className:"space-y-4",children:K&&e.jsx(_2,{config:K,onChange:I})}),e.jsx(ys,{value:"lpmm",className:"space-y-4",children:ue&&e.jsx(S2,{config:ue,onChange:Q})}),e.jsx(ys,{value:"webui",className:"space-y-4",children:me&&e.jsx(R2,{config:me,onChange:Me})}),e.jsxs(ys,{value:"other",className:"space-y-4",children:[W&&e.jsx(k2,{config:W,onChange:Y}),He&&e.jsx(C2,{config:He,onChange:F}),ee&&e.jsx(T2,{config:ee,onChange:Ue}),ie&&e.jsx(E2,{config:ie,onChange:Ee})]})]})}),e.jsx(Xn,{})]})})}const Rl=d.forwardRef(({className:l,...n},i)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:i,className:P("w-full caption-bottom text-sm",l),...n})}));Rl.displayName="Table";const Ll=d.forwardRef(({className:l,...n},i)=>e.jsx("thead",{ref:i,className:P("[&_tr]:border-b",l),...n}));Ll.displayName="TableHeader";const Ul=d.forwardRef(({className:l,...n},i)=>e.jsx("tbody",{ref:i,className:P("[&_tr:last-child]:border-0",l),...n}));Ul.displayName="TableBody";const X2=d.forwardRef(({className:l,...n},i)=>e.jsx("tfoot",{ref:i,className:P("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",l),...n}));X2.displayName="TableFooter";const ut=d.forwardRef(({className:l,...n},i)=>e.jsx("tr",{ref:i,className:P("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",l),...n}));ut.displayName="TableRow";const We=d.forwardRef(({className:l,...n},i)=>e.jsx("th",{ref:i,className:P("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",l),...n}));We.displayName="TableHead";const Ke=d.forwardRef(({className:l,...n},i)=>e.jsx("td",{ref:i,className:P("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",l),...n}));Ke.displayName="TableCell";const Z2=d.forwardRef(({className:l,...n},i)=>e.jsx("caption",{ref:i,className:P("mt-4 text-sm text-muted-foreground",l),...n}));Z2.displayName="TableCaption";const td=d.forwardRef(({className:l,...n},i)=>e.jsx(ga,{ref:i,className:P("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",l),...n}));td.displayName=ga.displayName;const ad=d.forwardRef(({className:l,...n},i)=>e.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[e.jsx(Tt,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(ga.Input,{ref:i,className:P("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",l),...n})]}));ad.displayName=ga.Input.displayName;const ld=d.forwardRef(({className:l,...n},i)=>e.jsx(ga.List,{ref:i,className:P("max-h-[300px] overflow-y-auto overflow-x-hidden",l),...n}));ld.displayName=ga.List.displayName;const nd=d.forwardRef((l,n)=>e.jsx(ga.Empty,{ref:n,className:"py-6 text-center text-sm",...l}));nd.displayName=ga.Empty.displayName;const lc=d.forwardRef(({className:l,...n},i)=>e.jsx(ga.Group,{ref:i,className:P("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",l),...n}));lc.displayName=ga.Group.displayName;const W2=d.forwardRef(({className:l,...n},i)=>e.jsx(ga.Separator,{ref:i,className:P("-mx-1 h-px bg-border",l),...n}));W2.displayName=ga.Separator.displayName;const nc=d.forwardRef(({className:l,...n},i)=>e.jsx(ga.Item,{ref:i,className:P("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",l),...n}));nc.displayName=ga.Item.displayName;const wv=d.createContext(null),_v="maibot-completed-tours";function eS(){try{const l=localStorage.getItem(_v);return l?new Set(JSON.parse(l)):new Set}catch{return new Set}}function Sg(l){localStorage.setItem(_v,JSON.stringify([...l]))}function sS({children:l}){const[n,i]=d.useState({activeTourId:null,stepIndex:0,isRunning:!1}),[c]=d.useState(()=>new Map),[u,x]=d.useState(eS),[,h]=d.useState(0),f=d.useCallback((M,C)=>{c.set(M,C),h(D=>D+1)},[c]),p=d.useCallback(M=>{c.delete(M),i(C=>C.activeTourId===M?{...C,activeTourId:null,isRunning:!1,stepIndex:0}:C)},[c]),g=d.useCallback((M,C=0)=>{c.has(M)&&i({activeTourId:M,stepIndex:C,isRunning:!0})},[c]),N=d.useCallback(()=>{i(M=>({...M,isRunning:!1}))},[]),v=d.useCallback(M=>{i(C=>({...C,stepIndex:M}))},[]),b=d.useCallback(()=>{i(M=>({...M,stepIndex:M.stepIndex+1}))},[]),w=d.useCallback(()=>{i(M=>({...M,stepIndex:Math.max(0,M.stepIndex-1)}))},[]),y=d.useCallback(()=>n.activeTourId?c.get(n.activeTourId)||[]:[],[n.activeTourId,c]),R=d.useCallback(M=>{x(C=>{const D=new Set(C);return D.add(M),Sg(D),D})},[]),A=d.useCallback(M=>{const{action:C,index:D,status:H,type:L}=M,J=["finished","skipped"];if(C==="close"){i(U=>({...U,isRunning:!1,stepIndex:0}));return}J.includes(H)?i(U=>(H==="finished"&&U.activeTourId&&setTimeout(()=>R(U.activeTourId),0),{...U,isRunning:!1,stepIndex:0})):L==="step:after"&&(C==="next"?i(U=>({...U,stepIndex:D+1})):C==="prev"&&i(U=>({...U,stepIndex:D-1})))},[R]),S=d.useCallback(M=>u.has(M),[u]),B=d.useCallback(M=>{x(C=>{const D=new Set(C);return D.delete(M),Sg(D),D})},[]);return e.jsx(wv.Provider,{value:{state:n,tours:c,registerTour:f,unregisterTour:p,startTour:g,stopTour:N,goToStep:v,nextStep:b,prevStep:w,getCurrentSteps:y,handleJoyrideCallback:A,isTourCompleted:S,markTourCompleted:R,resetTourCompleted:B},children:l})}function nx(){const l=d.useContext(wv);if(!l)throw new Error("useTour must be used within a TourProvider");return l}const tS={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)"}},aS={back:"上一步",close:"关闭",last:"完成",next:"下一步",nextLabelWithProgress:"下一步 ({step}/{steps})",open:"打开对话框",skip:"跳过"};function lS(){const{state:l,getCurrentSteps:n,handleJoyrideCallback:i}=nx(),c=n(),[u,x]=d.useState(!1),h=d.useRef(l.stepIndex),f=d.useRef(null);d.useEffect(()=>{h.current!==l.stepIndex&&(x(!1),h.current=l.stepIndex)},[l.stepIndex]),d.useEffect(()=>{if(!l.isRunning||c.length===0){x(!1);return}const v=c[l.stepIndex];if(!v){x(!1);return}const b=v.target;if(b==="body"){x(!0);return}x(!1);const w=setTimeout(()=>{const y=()=>{const B=document.querySelector(b);if(B){const M=B.getBoundingClientRect();if(M.width>0&&M.height>0)return!0}return!1};if(y()){setTimeout(()=>x(!0),100);return}const R=setInterval(()=>{y()&&(clearInterval(R),setTimeout(()=>x(!0),100))},100),A=setTimeout(()=>{clearInterval(R),x(!0)},5e3),S=()=>{clearInterval(R),clearTimeout(A)};f.current=S},150);return()=>{clearTimeout(w),f.current&&(f.current(),f.current=null)}},[l.isRunning,l.stepIndex,c]);const[p,g]=d.useState(null);if(d.useEffect(()=>{let v=document.getElementById("tour-portal-container");return v||(v=document.createElement("div"),v.id="tour-portal-container",v.style.cssText="position: fixed; top: 0; left: 0; z-index: 99999; pointer-events: none;",document.body.appendChild(v)),g(v),()=>{}},[]),!l.isRunning||c.length===0||!u)return null;const N=e.jsx(L1,{steps:c,stepIndex:l.stepIndex,run:l.isRunning,continuous:!0,showSkipButton:!0,showProgress:!0,disableOverlayClose:!0,disableScrolling:!1,disableScrollParentFix:!1,callback:i,styles:tS,locale:aS,scrollOffset:80,scrollToFirstStep:!0,floaterProps:{styles:{floater:{zIndex:99999}},disableAnimation:!0}},`tour-step-${l.stepIndex}`);return p?N0.createPortal(N,p):N}const il="model-assignment-tour",Sv=[{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}],kv={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"},qi=[{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 kg(l){return l?l.replace(/\/+$/,"").toLowerCase():""}function nS(l){if(!l)return null;const n=kg(l);return qi.find(i=>i.id!=="custom"&&kg(i.base_url)===n)||null}const Eo=l=>({...l,max_retry:l.max_retry??2,timeout:l.timeout??30,retry_interval:l.retry_interval??10}),rS=(l,n=[],i=null)=>{const c={};return l?(l.name?.trim()?n.some((x,h)=>i!==null&&h===i?!1:x.name.trim().toLowerCase()===l.name.trim().toLowerCase())&&(c.name="提供商名称已存在,请使用其他名称"):c.name="请输入提供商名称",l.base_url?.trim()||(c.base_url="请输入基础 URL"),l.api_key?.trim()||(c.api_key="请输入 API Key"),{isValid:Object.keys(c).length===0,errors:c}):{isValid:!1,errors:{name:"提供商数据为空"}}};function iS(){return e.jsx(Jn,{children:e.jsx(cS,{})})}function cS(){const[l,n]=d.useState([]),[i,c]=d.useState(!0),[u,x]=d.useState(!1),[h,f]=d.useState(!1),[p,g]=d.useState(!1),[N,v]=d.useState(!1),[b,w]=d.useState(null),[y,R]=d.useState(null),[A,S]=d.useState("custom"),[B,M]=d.useState(!1),[C,D]=d.useState(!1),[H,L]=d.useState(null),[J,U]=d.useState(!1),[oe,Ne]=d.useState(""),[je,re]=d.useState(new Set),[fe,ge]=d.useState(!1),[E,K]=d.useState(1),[I,ue]=d.useState(20),[Q,Se]=d.useState(""),[pe,Ce]=d.useState({isOpen:!1,providersToDelete:[],affectedModels:[],pendingProviders:[],context:"auto",oldProviders:[]}),[z,O]=d.useState({}),[V,de]=d.useState(new Set),[De,W]=d.useState(new Map),{toast:Y}=Zs(),He=ca(),{state:F,goToStep:ee,registerTour:Ue}=nx(),{triggerRestart:ie,isRestarting:Ee}=vn(),me=d.useRef(null),Me=d.useRef(!0);d.useEffect(()=>{Ue(il,Sv)},[Ue]),d.useEffect(()=>{if(F.activeTourId===il&&F.isRunning){const se=kv[F.stepIndex];se&&!window.location.pathname.endsWith(se.replace("/config/",""))&&He({to:se})}},[F.stepIndex,F.activeTourId,F.isRunning,He]);const rs=d.useRef(F.stepIndex);d.useEffect(()=>{if(F.activeTourId===il&&F.isRunning){const se=rs.current,we=F.stepIndex;se>=3&&se<=9&&we<3&&v(!1),se>=10&&we>=3&&we<=9&&(O({}),S("custom"),w({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10}),R(null),U(!1),v(!0)),rs.current=we}},[F.stepIndex,F.activeTourId,F.isRunning]),d.useEffect(()=>{if(F.activeTourId!==il||!F.isRunning)return;const se=we=>{const Re=we.target,Hs=F.stepIndex;Hs===2&&Re.closest('[data-tour="add-provider-button"]')?setTimeout(()=>ee(3),300):Hs===9&&Re.closest('[data-tour="provider-cancel-button"]')&&setTimeout(()=>ee(10),300)};return document.addEventListener("click",se,!0),()=>document.removeEventListener("click",se,!0)},[F,ee]),d.useEffect(()=>{Ut()},[]);const Ut=async()=>{try{c(!0);const se=await un();n(se.api_providers||[]),g(!1),Me.current=!1}catch(se){console.error("加载配置失败:",se)}finally{c(!1)}},aa=async()=>{await ie()},Qa=async()=>{try{x(!0),me.current&&clearTimeout(me.current);const se=l.map(rt=>({...rt,max_retry:rt.max_retry??2,timeout:rt.timeout??30,retry_interval:rt.retry_interval??10})),{shouldProceed:we}=await Ft(se,"restart");if(!we){x(!1);return}const Re=await un(),Hs=new Set(se.map(rt=>rt.name)),Wt=(Re.models||[]).filter(rt=>Hs.has(rt.api_provider));Re.api_providers=se,Re.models=Wt,await Xi(Re),g(!1),Y({title:"保存成功",description:"正在重启麦麦..."}),await aa()}catch(se){console.error("保存配置失败:",se),Y({title:"保存失败",description:se.message,variant:"destructive"}),x(!1)}},Ft=d.useCallback(async(se,we="auto")=>{try{const Re=await un(),Hs=new Set(l.map(xt=>xt.name)),Ot=new Set(se.map(xt=>xt.name)),Wt=Array.from(Hs).filter(xt=>!Ot.has(xt));if(Wt.length===0)return{shouldProceed:!0,providers:se};const ea=(Re.models||[]).filter(xt=>Wt.includes(xt.api_provider));return ea.length===0?{shouldProceed:!0,providers:se}:(Ce({isOpen:!0,providersToDelete:Wt,affectedModels:ea,pendingProviders:se,context:we,oldProviders:[...l]}),{shouldProceed:!1,providers:se})}catch(Re){return console.error("检查删除影响失败:",Re),{shouldProceed:!0,providers:se}}},[l]),mt=async()=>{try{(pe.context==="auto"?f:x)(!0),Ce(xt=>({...xt,isOpen:!1}));const we=await un(),Re=pe.pendingProviders.map(Eo),Hs=new Set(Re.map(xt=>xt.name)),Wt=(we.models||[]).filter(xt=>Hs.has(xt.api_provider)),rt=new Set(pe.affectedModels.map(xt=>xt.name)),ea=we.model_task_config;ea&&Object.keys(ea).forEach(xt=>{const ne=ea[xt];ne&&Array.isArray(ne.model_list)&&(ne.model_list=ne.model_list.filter(he=>!rt.has(he)))}),we.api_providers=Re,we.models=Wt,we.model_task_config=ea,await Xi(we),n(pe.pendingProviders),g(!1),Y({title:"删除成功",description:`已删除 ${pe.providersToDelete.length} 个提供商和 ${pe.affectedModels.length} 个关联模型`}),Ce({isOpen:!1,providersToDelete:[],affectedModels:[],pendingProviders:[],context:"auto",oldProviders:[]}),re(new Set),pe.context==="restart"&&await aa()}catch(se){console.error("删除失败:",se),Y({title:"删除失败",description:se.message,variant:"destructive"})}finally{pe.context==="auto"?f(!1):x(!1)}},q=()=>{pe.oldProviders.length>0&&n(pe.oldProviders),Ce({isOpen:!1,providersToDelete:[],affectedModels:[],pendingProviders:[],context:"auto",oldProviders:[]}),g(!1)},qe=d.useCallback(async se=>{if(Me.current)return;const{shouldProceed:we}=await Ft(se,"auto");if(!we){g(!0);return}try{f(!0);const Re=se.map(Eo);await Bm("api_providers",Re),g(!1)}catch(Re){console.error("自动保存失败:",Re),Y({title:"自动保存失败",description:Re.message,variant:"destructive"}),g(!0)}finally{f(!1)}},[l,Ft]);d.useEffect(()=>{if(!Me.current)return g(!0),me.current&&clearTimeout(me.current),me.current=setTimeout(()=>{qe(l)},2e3),()=>{me.current&&clearTimeout(me.current)}},[l,qe]);const Qe=async()=>{try{x(!0),me.current&&clearTimeout(me.current);const se=l.map(Eo),{shouldProceed:we}=await Ft(se,"manual");if(!we){x(!1);return}const Re=await un(),Hs=new Set(se.map(rt=>rt.name)),Ot=Re.models||[],Wt=Ot.filter(rt=>{const ea=Hs.has(rt.api_provider);return ea||console.warn(`模型 "${rt.name}" 引用了已删除的提供商 "${rt.api_provider}",将被移除`),ea});if(Ot.length!==Wt.length){const rt=Ot.length-Wt.length;Y({title:"注意",description:`已自动移除 ${rt} 个引用已删除提供商的模型`,variant:"default"})}console.log("发送的 providers 数据:",se),Re.api_providers=se,Re.models=Wt,console.log("完整配置数据:",Re),await Xi(Re),g(!1),Y({title:"保存成功",description:"模型提供商配置已保存"})}catch(se){console.error("保存配置失败:",se),Y({title:"保存失败",description:se.message,variant:"destructive"})}finally{x(!1)}},es=(se,we)=>{if(O({}),se){const Re=qi.find(Hs=>Hs.base_url===se.base_url&&Hs.client_type===se.client_type);S(Re?.id||"custom"),w(se)}else S("custom"),w({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10});R(we),U(!1),v(!0)},Ls=d.useCallback(se=>{S(se),M(!1);const we=qi.find(Re=>Re.id===se);we&&we.id!=="custom"?w(Re=>({...Re,name:we.name,base_url:we.base_url,client_type:we.client_type})):we?.id==="custom"&&w(Re=>({...Re,name:"",base_url:"",client_type:"openai"}))},[]),as=d.useMemo(()=>A!=="custom",[A]),Cs=d.useCallback(async()=>{if(b?.api_key)try{await navigator.clipboard.writeText(b.api_key),Y({title:"复制成功",description:"API Key 已复制到剪贴板"})}catch{Y({title:"复制失败",description:"无法访问剪贴板",variant:"destructive"})}},[b?.api_key,Y]),ze=()=>{if(!b)return;const{isValid:se,errors:we}=rS(b,l,y);if(!se){O(we);return}O({});const Re=Eo(b);if(y!==null){const Hs=[...l];Hs[y]=Re,n(Hs)}else n([...l,Re]);v(!1),w(null),R(null)},Ns=se=>{if(!se&&b){const we={...b,max_retry:b.max_retry??2,timeout:b.timeout??30,retry_interval:b.retry_interval??10};w(we)}v(se)},ls=se=>{L(se),D(!0)},ss=async()=>{if(H!==null){const se=l.filter((Re,Hs)=>Hs!==H),{shouldProceed:we}=await Ft(se,"manual");we&&(n(se),Y({title:"删除成功",description:"提供商已从列表中移除"}))}D(!1),L(null)},bs=se=>{const we=new Set(je);we.has(se)?we.delete(se):we.add(se),re(we)},gt=()=>{if(je.size===Ms.length)re(new Set);else{const se=Ms.map((we,Re)=>l.findIndex(Hs=>Hs===Ms[Re]));re(new Set(se))}},$t=()=>{if(je.size===0){Y({title:"提示",description:"请先选择要删除的提供商",variant:"default"});return}ge(!0)},tt=async()=>{const se=l.filter((Re,Hs)=>!je.has(Hs)),{shouldProceed:we}=await Ft(se,"manual");we&&(n(se),re(new Set),Y({title:"批量删除成功",description:`已删除 ${je.size} 个提供商`})),ge(!1)},Ms=d.useMemo(()=>{if(!oe)return l;const se=oe.toLowerCase();return l.filter(we=>we.name.toLowerCase().includes(se)||we.base_url.toLowerCase().includes(se)||we.client_type.toLowerCase().includes(se))},[l,oe]),{totalPages:Et,paginatedProviders:Bt}=d.useMemo(()=>{const se=Math.ceil(Ms.length/I),we=Ms.slice((E-1)*I,E*I);return{totalPages:se,paginatedProviders:we}},[Ms,E,I]),Da=d.useCallback(()=>{const se=parseInt(Q);se>=1&&se<=Et&&(K(se),Se(""))},[Q,Et]),tl=async se=>{de(we=>new Set(we).add(se));try{const we=await I2(se);W(Re=>new Map(Re).set(se,we)),we.network_ok?we.api_key_valid===!0?Y({title:"连接正常",description:`${se} 网络连接正常,API Key 有效 (${we.latency_ms}ms)`}):we.api_key_valid===!1?Y({title:"连接正常但 Key 无效",description:`${se} 网络连接正常,但 API Key 无效或已过期`,variant:"destructive"}):Y({title:"网络连接正常",description:`${se} 可以访问 (${we.latency_ms}ms)`}):Y({title:"连接失败",description:we.error||"无法连接到提供商",variant:"destructive"})}catch(we){Y({title:"测试失败",description:we.message,variant:"destructive"})}finally{de(we=>{const Re=new Set(we);return Re.delete(se),Re})}},ul=async()=>{for(const se of l)await tl(se.name)},Zn=se=>{const we=V.has(se),Re=De.get(se);return we?e.jsxs(ke,{variant:"secondary",className:"gap-1",children:[e.jsx(Bs,{className:"h-3 w-3 animate-spin"}),"测试中"]}):Re?Re.network_ok?Re.api_key_valid===!0?e.jsxs(ke,{className:"gap-1 bg-green-600 hover:bg-green-700",children:[e.jsx(pt,{className:"h-3 w-3"}),"正常"]}):Re.api_key_valid===!1?e.jsxs(ke,{variant:"destructive",className:"gap-1",children:[e.jsx(_t,{className:"h-3 w-3"}),"Key无效"]}):e.jsxs(ke,{className:"gap-1 bg-blue-600 hover:bg-blue-700",children:[e.jsx(pt,{className:"h-3 w-3"}),"可访问"]}):e.jsxs(ke,{variant:"destructive",className:"gap-1",children:[e.jsx(Va,{className:"h-3 w-3"}),"离线"]}):null};return i?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:$t,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(ns,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",je.size,")"]}),e.jsxs(_,{onClick:ul,size:"sm",variant:"outline",className:"w-full sm:w-auto",disabled:l.length===0||V.size>0,children:[e.jsx(Za,{className:"mr-2 h-4 w-4"}),V.size>0?`测试中 (${V.size})`:"测试全部"]}),e.jsxs(_,{onClick:()=>es(null,null),size:"sm",className:"w-full sm:w-auto","data-tour":"add-provider-button",children:[e.jsx(et,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加提供商"]}),e.jsxs(_,{onClick:Qe,disabled:u||h||!p||Ee,size:"sm",variant:"outline",className:"w-full sm:w-auto sm:min-w-[120px]",children:[e.jsx(dc,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),u?"保存中...":h?"自动保存中...":p?"保存配置":"已保存"]}),e.jsxs(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{disabled:u||h||Ee,size:"sm",className:"w-full sm:w-auto sm:min-w-[120px]",children:[e.jsx(oc,{className:"mr-2 h-4 w-4"}),Ee?"重启中...":p?"保存并重启":"重启麦麦"]})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认重启麦麦?"}),e.jsx(hs,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:p?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})})})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:p?Qa:aa,children:p?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsxs(at,{children:[e.jsx(Ht,{className:"h-4 w-4"}),e.jsxs(lt,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),e.jsxs(Je,{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(Tt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(le,{placeholder:"搜索提供商名称、URL 或类型...",value:oe,onChange:se=>Ne(se.target.value),className:"pl-9"})]}),oe&&e.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",Ms.length," 个结果"]})]}),e.jsx("div",{className:"md:hidden space-y-3",children:Ms.length===0?e.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:oe?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'}):Bt.map((se,we)=>{const Re=l.findIndex(Hs=>Hs===se);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:se.name}),Zn(se.name)]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:se.base_url})]}),e.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>tl(se.name),disabled:V.has(se.name),title:"测试连接",children:V.has(se.name)?e.jsx(Bs,{className:"h-4 w-4 animate-spin"}):e.jsx(Za,{className:"h-4 w-4"})}),e.jsx(_,{variant:"default",size:"sm",onClick:()=>es(se,Re),children:e.jsx(Gn,{className:"h-4 w-4",strokeWidth:2,fill:"none"})}),e.jsx(_,{size:"sm",onClick:()=>ls(Re),className:"bg-red-600 hover:bg-red-700 text-white",children:e.jsx(ns,{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:se.client_type})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"最大重试"}),e.jsx("p",{className:"font-medium",children:se.max_retry})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"超时(秒)"}),e.jsx("p",{className:"font-medium",children:se.timeout})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"重试间隔(秒)"}),e.jsx("p",{className:"font-medium",children:se.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(Rl,{children:[e.jsx(Ll,{children:e.jsxs(ut,{children:[e.jsx(We,{className:"w-12",children:e.jsx(qs,{checked:je.size===Ms.length&&Ms.length>0,onCheckedChange:gt})}),e.jsx(We,{children:"状态"}),e.jsx(We,{children:"名称"}),e.jsx(We,{children:"基础URL"}),e.jsx(We,{children:"客户端类型"}),e.jsx(We,{className:"text-right",children:"最大重试"}),e.jsx(We,{className:"text-right",children:"超时(秒)"}),e.jsx(We,{className:"text-right",children:"重试间隔(秒)"}),e.jsx(We,{className:"text-right",children:"操作"})]})}),e.jsx(Ul,{children:Bt.length===0?e.jsx(ut,{children:e.jsx(Ke,{colSpan:9,className:"text-center text-muted-foreground py-8",children:oe?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'})}):Bt.map((se,we)=>{const Re=l.findIndex(Hs=>Hs===se);return e.jsxs(ut,{children:[e.jsx(Ke,{children:e.jsx(qs,{checked:je.has(Re),onCheckedChange:()=>bs(Re)})}),e.jsx(Ke,{children:Zn(se.name)||e.jsx(ke,{variant:"outline",className:"text-muted-foreground",children:"未测试"})}),e.jsx(Ke,{className:"font-medium",children:se.name}),e.jsx(Ke,{className:"max-w-xs truncate",title:se.base_url,children:se.base_url}),e.jsx(Ke,{children:se.client_type}),e.jsx(Ke,{className:"text-right",children:se.max_retry}),e.jsx(Ke,{className:"text-right",children:se.timeout}),e.jsx(Ke,{className:"text-right",children:se.retry_interval}),e.jsx(Ke,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>tl(se.name),disabled:V.has(se.name),title:"测试连接",children:V.has(se.name)?e.jsx(Bs,{className:"h-4 w-4 animate-spin"}):e.jsx(Za,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"default",size:"sm",onClick:()=>es(se,Re),children:[e.jsx(Gn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(_,{size:"sm",onClick:()=>ls(Re),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(ns,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},we)})})]})})}),Ms.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(Ie,{value:I.toString(),onValueChange:se=>{ue(parseInt(se)),K(1),re(new Set)},children:[e.jsx($e,{id:"page-size-provider",className:"w-20",children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"10",children:"10"}),e.jsx(Z,{value:"20",children:"20"}),e.jsx(Z,{value:"50",children:"50"}),e.jsx(Z,{value:"100",children:"100"})]})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(E-1)*I+1," 到"," ",Math.min(E*I,Ms.length)," 条,共 ",Ms.length," 条"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>K(1),disabled:E===1,className:"hidden sm:flex",children:e.jsx(gn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>K(se=>Math.max(1,se-1)),disabled:E===1,children:[e.jsx(Aa,{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(le,{type:"number",value:Q,onChange:se=>Se(se.target.value),onKeyDown:se=>se.key==="Enter"&&Da(),placeholder:E.toString(),className:"w-16 h-8 text-center",min:1,max:Et}),e.jsx(_,{variant:"outline",size:"sm",onClick:Da,disabled:!Q,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>K(se=>se+1),disabled:E>=Et,children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Zt,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>K(Et),disabled:E>=Et,className:"hidden sm:flex",children:e.jsx(jn,{className:"h-4 w-4"})})]})]})]}),e.jsx(Is,{open:N,onOpenChange:Ns,children:e.jsxs(Ds,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto","data-tour":"provider-dialog",preventOutsideClose:F.isRunning,children:[e.jsxs(Os,{children:[e.jsx(Rs,{children:y!==null?"编辑提供商":"添加提供商"}),e.jsx(Ks,{children:"配置 API 提供商的连接信息和参数"})]}),e.jsxs("form",{onSubmit:se=>{se.preventDefault(),ze()},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(ol,{open:B,onOpenChange:M,children:[e.jsx(dl,{asChild:!0,children:e.jsxs(_,{variant:"outline",role:"combobox","aria-expanded":B,className:"w-full justify-between",children:[A?qi.find(se=>se.id===A)?.display_name:"选择提供商模板...",e.jsx(Ym,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(Wa,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:e.jsxs(td,{children:[e.jsx(ad,{placeholder:"搜索提供商模板..."}),e.jsx(Je,{className:"h-[300px]",children:e.jsxs(ld,{className:"max-h-none overflow-visible",children:[e.jsx(nd,{children:"未找到匹配的模板"}),e.jsx(lc,{children:qi.map(se=>e.jsxs(nc,{value:se.display_name,onSelect:()=>Ls(se.id),children:[e.jsx(Ct,{className:`mr-2 h-4 w-4 ${A===se.id?"opacity-100":"opacity-0"}`}),se.display_name]},se.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:z.name?"text-destructive":"",children:"名称 *"}),e.jsx(le,{id:"name",value:b?.name||"",onChange:se=>{w(we=>we?{...we,name:se.target.value}:null),z.name&&O(we=>({...we,name:void 0}))},placeholder:"例如: DeepSeek, SiliconFlow",className:z.name?"border-destructive focus-visible:ring-destructive":""}),z.name&&e.jsx("p",{className:"text-xs text-destructive",children:z.name})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-url-input",children:[e.jsx(T,{htmlFor:"base_url",className:z.base_url?"text-destructive":"",children:"基础 URL *"}),e.jsx(le,{id:"base_url",value:b?.base_url||"",onChange:se=>{w(we=>we?{...we,base_url:se.target.value}:null),z.base_url&&O(we=>({...we,base_url:void 0}))},placeholder:"https://api.example.com/v1",disabled:as,className:`${as?"bg-muted cursor-not-allowed":""} ${z.base_url?"border-destructive focus-visible:ring-destructive":""}`}),z.base_url&&e.jsx("p",{className:"text-xs text-destructive",children:z.base_url}),as&&!z.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:z.api_key?"text-destructive":"",children:"API Key *"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(le,{id:"api_key",type:J?"text":"password",value:b?.api_key||"",onChange:se=>{w(we=>we?{...we,api_key:se.target.value}:null),z.api_key&&O(we=>({...we,api_key:void 0}))},placeholder:"sk-...",className:`flex-1 ${z.api_key?"border-destructive focus-visible:ring-destructive":""}`}),e.jsx(_,{type:"button",variant:"outline",size:"icon",onClick:()=>U(!J),title:J?"隐藏密钥":"显示密钥",children:J?e.jsx(ec,{className:"h-4 w-4"}):e.jsx(ia,{className:"h-4 w-4"})}),e.jsx(_,{type:"button",variant:"outline",size:"icon",onClick:Cs,title:"复制密钥",children:e.jsx(Lo,{className:"h-4 w-4"})})]}),z.api_key&&e.jsx("p",{className:"text-xs text-destructive",children:z.api_key})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"client_type",children:"客户端类型"}),e.jsxs(Ie,{value:b?.client_type||"openai",onValueChange:se=>w(we=>we?{...we,client_type:se}:null),disabled:as,children:[e.jsx($e,{id:"client_type",className:as?"bg-muted cursor-not-allowed":"",children:e.jsx(Pe,{placeholder:"选择客户端类型"})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"openai",children:"OpenAI"}),e.jsx(Z,{value:"gemini",children:"Gemini"})]})]}),as&&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(le,{id:"max_retry",type:"number",min:"0",value:b?.max_retry??"",onChange:se=>{const we=se.target.value===""?null:parseInt(se.target.value);w(Re=>Re?{...Re,max_retry:we}:null)},placeholder:"默认: 2"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"timeout",children:"超时(秒)"}),e.jsx(le,{id:"timeout",type:"number",min:"1",value:b?.timeout??"",onChange:se=>{const we=se.target.value===""?null:parseInt(se.target.value);w(Re=>Re?{...Re,timeout:we}:null)},placeholder:"默认: 30"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"retry_interval",children:"重试间隔(秒)"}),e.jsx(le,{id:"retry_interval",type:"number",min:"1",value:b?.retry_interval??"",onChange:se=>{const we=se.target.value===""?null:parseInt(se.target.value);w(Re=>Re?{...Re,retry_interval:we}:null)},placeholder:"默认: 10"})]})]})]}),e.jsxs(st,{children:[e.jsx(_,{type:"button",variant:"outline",onClick:()=>v(!1),"data-tour":"provider-cancel-button",children:"取消"}),e.jsx(_,{type:"submit","data-tour":"provider-save-button",children:"保存"})]})]})]})}),e.jsx(vs,{open:C,onOpenChange:D,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:['确定要删除提供商 "',H!==null?l[H]?.name:"",'" 吗? 此操作无法撤销。']})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:ss,children:"删除"})]})]})}),e.jsx(vs,{open:fe,onOpenChange:ge,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认批量删除"}),e.jsxs(hs,{children:["确定要删除选中的 ",je.size," 个提供商吗? 此操作无法撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:tt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),e.jsx(vs,{open:pe.isOpen,onOpenChange:se=>Ce(we=>({...we,isOpen:se})),children:e.jsxs(ds,{className:"max-w-2xl",children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除提供商"}),e.jsx(hs,{asChild:!0,children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:["您即将删除以下提供商:",e.jsx("strong",{className:"text-foreground ml-1",children:pe.providersToDelete.join(", ")})]}),e.jsxs("p",{className:"text-yellow-600 dark:text-yellow-500 font-medium",children:["⚠️ 此操作将同时删除 ",pe.affectedModels.length," 个关联的模型:"]}),e.jsx(Je,{className:"h-32 w-full rounded border p-3",children:e.jsx("div",{className:"space-y-1",children:pe.affectedModels.map((se,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:se.name}),e.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(",se.model_identifier,")"]})]},we))})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"这些模型将从模型列表和所有任务分配中移除。此操作无法撤销。"})]})})]}),e.jsxs(ms,{children:[e.jsx(ps,{onClick:q,children:"取消"}),e.jsx(fs,{onClick:mt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})}),e.jsx(Xn,{})]})}function Zi(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).substring(2,11)}`}function Tm(l){return l===null?"null":Array.isArray(l)?"array":typeof l=="object"?"object":typeof l=="boolean"?"boolean":typeof l=="number"?"number":"string"}function Im(l){return Object.entries(l).map(([n,i])=>{const c=Tm(i),u={id:Zi(),key:n,value:i,type:c,expanded:!0};return c==="object"&&i&&typeof i=="object"?u.children=Im(i):c==="array"&&Array.isArray(i)&&(u.children=i.map((x,h)=>{const f=Tm(x),p={id:Zi(),key:String(h),value:x,type:f,expanded:!0};return f==="object"&&x&&typeof x=="object"?p.children=Im(x):f==="array"&&Array.isArray(x)&&(p.children=x.map((g,N)=>({id:Zi(),key:String(N),value:g,type:Tm(g),expanded:!0}))),p})),u})}function Pm(l){const n={};for(const i of l)i.key.trim()&&(i.type==="object"&&i.children?n[i.key]=Pm(i.children):i.type==="array"&&i.children?n[i.key]=i.children.map(c=>c.type==="object"&&c.children?Pm(c.children):c.type==="array"&&c.children?c.children.map(u=>u.value):c.value):i.type==="null"?n[i.key]=null:n[i.key]=i.value);return n}function Cg(l,n){switch(n){case"boolean":return l==="true";case"number":{const i=parseFloat(l);return isNaN(i)?0:i}case"null":return null;default:return l}}function Cv({node:l,level:n,onUpdate:i,onRemove:c,onAddChild:u,onToggleExpand:x}){const h=l.type==="object"||l.type==="array",f=l.children&&l.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:`${n*20}px`},children:[e.jsx(_,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>x(l.id),disabled:!h||!f,children:h&&f?l.expanded?e.jsx(Ma,{className:"h-4 w-4"}):e.jsx(Zt,{className:"h-4 w-4"}):e.jsx("span",{className:"w-4"})}),e.jsx(le,{value:l.key,onChange:p=>i(l.id,"key",p.target.value),placeholder:"key",className:"h-8 text-sm"}),!h&&e.jsx(e.Fragment,{children:l.type==="boolean"?e.jsxs("div",{className:"flex items-center h-8 px-3 border rounded-md bg-background",children:[e.jsx(Ge,{checked:l.value===!0,onCheckedChange:p=>i(l.id,"value",p)}),e.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:l.value?"true":"false"})]}):l.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(le,{type:l.type==="number"?"number":"text",value:l.value,onChange:p=>i(l.id,"value",p.target.value),placeholder:"value",className:"h-8 text-sm",step:l.type==="number"?"any":void 0})}),e.jsxs(Ie,{value:l.type,onValueChange:p=>i(l.id,"type",p),children:[e.jsx($e,{className:"h-8 text-xs",children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"string",children:"字符串"}),e.jsx(Z,{value:"number",children:"数字"}),e.jsx(Z,{value:"boolean",children:"布尔"}),e.jsx(Z,{value:"null",children:"Null"}),e.jsx(Z,{value:"object",children:"对象"}),e.jsx(Z,{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:()=>u(l.id),title:"添加子项",children:e.jsx(et,{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(l.id),title:"删除",children:e.jsx(ns,{className:"h-4 w-4"})})]})]}),h&&l.expanded&&l.children&&l.children.length>0&&e.jsx("div",{className:"space-y-1",children:l.children.map(p=>e.jsx(Cv,{node:p,level:n+1,onUpdate:i,onRemove:c,onAddChild:u,onToggleExpand:x},p.id))})]})}function oS({value:l,onChange:n,placeholder:i="添加参数..."}){const[c,u]=d.useState(()=>Im(l||{})),x=d.useCallback(v=>{u(v),n(Pm(v))},[n]),h=d.useCallback(()=>{const v={id:Zi(),key:"",value:"",type:"string",expanded:!1};x([...c,v])},[c,x]),f=d.useCallback((v,b,w)=>{const y=R=>R.map(A=>{if(A.id===v)if(b==="type"){const S=w;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 B=Cg(String(A.value),S);return{...A,type:S,value:B,children:void 0}}}else if(b==="value"){const S=Cg(String(w),A.type);return{...A,value:S}}else return{...A,[b]:String(w)};return A.children?{...A,children:y(A.children)}:A});x(y(c))},[c,x]),p=d.useCallback(v=>{const b=w=>w.filter(y=>y.id!==v).map(y=>y.children?{...y,children:b(y.children)}:y);x(b(c))},[c,x]),g=d.useCallback(v=>{const b=w=>w.map(y=>{if(y.id===v){const R={id:Zi(),key:y.type==="array"?String(y.children?.length||0):"",value:"",type:"string",expanded:!0};return{...y,children:[...y.children||[],R]}}return y.children?{...y,children:b(y.children)}:y});x(b(c))},[c,x]),N=d.useCallback(v=>{const b=w=>w.map(y=>y.id===v?{...y,expanded:!y.expanded}:y.children?{...y,children:b(y.children)}:y);u(b(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(et,{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:i}):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(v=>e.jsx(Cv,{node:v,level:0,onUpdate:f,onRemove:p,onAddChild:g,onToggleExpand:N},v.id))]})})]})}function Tg(l){if(!l.trim())return{valid:!0,parsed:{}};try{const n=JSON.parse(l);return typeof n!="object"||n===null||Array.isArray(n)?{valid:!1,error:"必须是一个 JSON 对象 {}"}:{valid:!0,parsed:n}}catch{return{valid:!1,error:"JSON 格式错误"}}}function dS({value:l,onChange:n,className:i,placeholder:c="添加额外参数..."}){const[u,x]=d.useState("list"),h=d.useMemo(()=>Object.keys(l||{}).length>0?JSON.stringify(l,null,2):"",[l]),[f,p]=d.useState(h),[g,N]=d.useState(null);d.useEffect(()=>{p(h)},[h]);const v=d.useMemo(()=>{const y=Tg(f);return y.valid&&y.parsed?{success:!0,data:y.parsed}:{success:!1,data:{}}},[f]),b=d.useCallback(y=>{const R=y;R==="json"&&u==="list"&&(p(Object.keys(l).length>0?JSON.stringify(l,null,2):""),N(null)),x(R)},[u,l]),w=d.useCallback(y=>{p(y);const R=Tg(y);R.valid&&R.parsed?(N(null),n(R.parsed)):N(R.error||"JSON 格式错误")},[n]);return e.jsx("div",{className:P("h-full flex flex-col",i),children:e.jsxs(ta,{value:u,onValueChange:b,className:"w-full flex-1 flex flex-col",children:[e.jsxs(Xt,{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(ys,{value:"list",className:"mt-2 flex-1 flex flex-col overflow-hidden data-[state=inactive]:hidden data-[state=inactive]:h-0",children:e.jsx(oS,{value:l,onChange:n,placeholder:c})}),e.jsx(ys,{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(_t,{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(Ct,{className:"h-3 w-3"}),e.jsx("span",{children:"有效"})]})]}),e.jsx(ot,{value:f,onChange:y=>w(y.target.value),placeholder:`{ + "key": "value" +}`,className:P("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:v.success&&Object.keys(v.data).length>0?e.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-words",children:JSON.stringify(v.data,null,2)}):v.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 uS({open:l,onOpenChange:n,value:i,onChange:c}){const[u,x]=d.useState(i),h=g=>{g&&x(i),n(g)},f=()=>{c(u),n(!1)},p=()=>{x(i),n(!1)};return e.jsx(Is,{open:l,onOpenChange:h,children:e.jsxs(Ds,{className:"max-w-3xl h-[70vh] flex flex-col",children:[e.jsxs(Os,{children:[e.jsx(Rs,{children:"编辑额外参数"}),e.jsx(Ks,{children:"配置模型调用时的额外参数,支持嵌套对象和数组"})]}),e.jsx("div",{className:"flex-1 overflow-hidden min-h-0",children:e.jsx(dS,{value:u,onChange:x,placeholder:"添加额外参数(如 thinking、top_p 等)..."})}),e.jsxs(st,{children:[e.jsx(_,{variant:"outline",onClick:p,children:"取消"}),e.jsx(_,{onClick:f,children:"保存"})]})]})})}const Yr="https://maibot-plugin-stats.maibot-webui.workers.dev";async function mS(l){const n=new URLSearchParams;l?.status&&n.set("status",l.status),l?.page&&n.set("page",l.page.toString()),l?.page_size&&n.set("page_size",l.page_size.toString()),l?.search&&n.set("search",l.search),l?.sort_by&&n.set("sort_by",l.sort_by),l?.sort_order&&n.set("sort_order",l.sort_order);const i=await fetch(`${Yr}/pack?${n.toString()}`);if(!i.ok)throw new Error(`获取 Pack 列表失败: ${i.status}`);return i.json()}async function xS(l){const n=await fetch(`${Yr}/pack/${l}`);if(!n.ok)throw new Error(`获取 Pack 失败: ${n.status}`);const i=await n.json();if(!i.success)throw new Error(i.error||"获取 Pack 失败");return i.pack}async function hS(l){const i=await(await fetch(`${Yr}/pack`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)})).json();if(!i.success)throw new Error(i.error||"创建 Pack 失败");return i}async function fS(l,n){await fetch(`${Yr}/pack/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pack_id:l,user_id:n})})}async function Tv(l,n){const c=await(await fetch(`${Yr}/pack/like`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pack_id:l,user_id:n})})).json();if(!c.success)throw new Error(c.error||"点赞失败");return{likes:c.likes,liked:c.liked}}async function Ev(l,n){return(await(await fetch(`${Yr}/pack/like/check?pack_id=${l}&user_id=${n}`)).json()).liked||!1}async function pS(l){const n=await _e("/api/webui/config/model");if(!n.ok)throw new Error("获取当前模型配置失败");const i=await n.json(),c=i.config||i;console.log("=== Pack Conflict Detection ==="),console.log("Pack providers:",l.providers),console.log("Local providers:",c.api_providers);const u={existing_providers:[],new_providers:[],conflicting_models:[]},x=c.api_providers||[];for(const f of l.providers){console.log(` +Checking pack provider: ${f.name}`),console.log(` Pack URL: ${f.base_url}`),console.log(` Normalized: ${Em(f.base_url)}`);const p=x.filter(g=>{const N=Em(g.base_url),v=Em(f.base_url);return console.log(` Comparing with local "${g.name}": ${g.base_url}`),console.log(` Local normalized: ${N}`),console.log(` Match: ${N===v}`),N===v});p.length>0?(console.log(` ✓ Matched with ${p.length} local provider(s):`,p.map(g=>g.name).join(", ")),u.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"),u.new_providers.push(f))}const h=c.models||[];console.log(` +=== Model Conflict Detection ===`);for(const f of l.models){const p=h.find(g=>g.name===f.name);p&&(console.log(`Model conflict: ${f.name}`),u.conflicting_models.push({pack_model:f.name,local_model:p.name}))}return console.log(` +=== Detection Summary ===`),console.log(`Existing providers: ${u.existing_providers.length}`),console.log(`New providers: ${u.new_providers.length}`),console.log(`Conflicting models: ${u.conflicting_models.length}`),console.log(`=========================== +`),u}async function gS(l,n,i,c){const u=await _e("/api/webui/config/model");if(!u.ok)throw new Error("获取当前模型配置失败");const x=await u.json(),h=x.config||x;if(n.apply_providers){const p=n.selected_providers?l.providers.filter(g=>n.selected_providers.includes(g.name)):l.providers;for(const g of p){if(i[g.name])continue;const N=c[g.name];if(!N)throw new Error(`提供商 "${g.name}" 缺少 API Key`);const v={...g,api_key:N},b=h.api_providers.findIndex(w=>w.name===g.name);b>=0?h.api_providers[b]=v:h.api_providers.push(v)}}if(n.apply_models){const p=n.selected_models?l.models.filter(g=>n.selected_models.includes(g.name)):l.models;for(const g of p){const N=i[g.api_provider]||g.api_provider,v={...g,api_provider:N},b=h.models.findIndex(w=>w.name===g.name);b>=0?h.models[b]=v:h.models.push(v)}}if(n.apply_task_config){const p=n.selected_tasks||Object.keys(l.task_config);for(const g of p){const N=l.task_config[g];if(!N)continue;const v=new Set(n.selected_models||l.models.map(y=>y.name)),b=N.model_list.filter(y=>v.has(y));if(b.length===0)continue;const w={...N,model_list:b};if(n.task_mode==="replace")h.model_task_config[g]=w;else{const y=h.model_task_config[g];if(y){const R=[...new Set([...y.model_list,...b])];h.model_task_config[g]={...y,model_list:R}}else h.model_task_config[g]=w}}}if(!(await _e("/api/webui/config/model",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(h)})).ok)throw new Error("保存配置失败")}async function jS(l){const n=await _e("/api/webui/config/model");if(!n.ok)throw new Error("获取当前模型配置失败");const i=await n.json();if(!i.success||!i.config)throw new Error("获取配置失败");const c=i.config;let u=(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}));l.selectedProviders&&(u=u.filter(g=>l.selectedProviders.includes(g.name)));let x=c.models||[];l.selectedModels&&(x=x.filter(g=>l.selectedModels.includes(g.name)));const h={},f=c.model_task_config||{},p=l.selectedTasks||Object.keys(f);for(const g of p)f[g]&&(h[g]=f[g]);return{providers:u,models:x,task_config:h}}function Em(l){try{const n=new URL(l);return`${n.protocol}//${n.host}${n.pathname}`.replace(/\/$/,"").toLowerCase()}catch{return l.toLowerCase().replace(/\/$/,"")}}function Mv(){const l="maibot_pack_user_id";let n=localStorage.getItem(l);return n||(n="pack_user_"+Math.random().toString(36).substring(2,15),localStorage.setItem(l,n)),n}const vS={utils:"通用工具",utils_small:"轻量工具",tool_use:"工具调用",replyer:"回复生成",planner:"规划推理",vlm:"视觉模型",voice:"语音处理",embedding:"向量嵌入",lpmm_entity_extract:"实体提取",lpmm_rdf_build:"RDF构建",lpmm_qa:"问答模型"},NS=["官方推荐","性价比","高性能","免费模型","国内可用","海外模型","OpenAI","Claude","Gemini","国产模型","多模态","轻量级"];function bS({trigger:l}){const[n,i]=d.useState(!1),[c,u]=d.useState(1),[x,h]=d.useState(!1),[f,p]=d.useState(!1),[g,N]=d.useState([]),[v,b]=d.useState([]),[w,y]=d.useState({}),[R,A]=d.useState(new Set),[S,B]=d.useState(new Set),[M,C]=d.useState(new Set),[D,H]=d.useState(""),[L,J]=d.useState(""),[U,oe]=d.useState(""),[Ne,je]=d.useState([]);d.useEffect(()=>{n&&c===1&&re()},[n,c]);const re=async()=>{h(!0);try{const z=await jS({name:"",description:"",author:""});N(z.providers),b(z.models),y(z.task_config),A(new Set(z.providers.map(O=>O.name))),B(new Set(z.models.map(O=>O.name))),C(new Set(Object.keys(z.task_config)))}catch(z){console.error("加载配置失败:",z),Qt({title:"加载当前配置失败",variant:"destructive"})}finally{h(!1)}},fe=z=>{const O=new Set(R),V=new Set(S),de=new Set(M);O.has(z)?(O.delete(z),v.filter(W=>W.api_provider===z).forEach(W=>V.delete(W.name)),Object.entries(w).forEach(([W,Y])=>{Y.model_list&&(Y.model_list.some(F=>V.has(F))||de.delete(W))})):(O.add(z),v.filter(W=>W.api_provider===z).forEach(W=>V.add(W.name)),Object.entries(w).forEach(([W,Y])=>{Y.model_list&&Y.model_list.some(F=>{const ee=v.find(Ue=>Ue.name===F);return ee&&ee.api_provider===z})&&de.add(W)})),A(O),B(V),C(de)},ge=z=>{const O=new Set(S),V=new Set(M);O.has(z)?(O.delete(z),Object.entries(w).forEach(([de,De])=>{De.model_list&&(De.model_list.some(Y=>O.has(Y))||V.delete(de))})):(O.add(z),Object.entries(w).forEach(([de,De])=>{De.model_list&&De.model_list.includes(z)&&V.add(de)})),B(O),C(V)},E=z=>{const O=new Set(M);O.has(z)?O.delete(z):O.add(z),C(O)},K=z=>{Ne.includes(z)?je(Ne.filter(O=>O!==z)):Ne.length<5?je([...Ne,z]):Qt({title:"最多选择 5 个标签",variant:"destructive"})},I=()=>{R.size===g.length?A(new Set):A(new Set(g.map(z=>z.name)))},ue=()=>{S.size===v.length?B(new Set):B(new Set(v.map(z=>z.name)))},Q=()=>{const z=Object.keys(w);M.size===z.length?C(new Set):C(new Set(z))},Se=async()=>{if(!D.trim()){Qt({title:"请输入模板名称",variant:"destructive"});return}if(!L.trim()){Qt({title:"请输入模板描述",variant:"destructive"});return}if(!U.trim()){Qt({title:"请输入作者名称",variant:"destructive"});return}if(R.size===0&&S.size===0&&M.size===0){Qt({title:"请至少选择一项配置",variant:"destructive"});return}p(!0);try{const z=g.filter(de=>R.has(de.name)),O=v.filter(de=>S.has(de.name)),V={};for(const[de,De]of Object.entries(w))M.has(de)&&(V[de]=De);await hS({name:D.trim(),description:L.trim(),author:U.trim(),tags:Ne,providers:z,models:O,task_config:V}),Qt({title:"模板已提交审核,审核通过后将显示在市场中"}),i(!1),pe()}catch(z){console.error("提交失败:",z),Qt({title:z instanceof Error?z.message:"提交失败",variant:"destructive"})}finally{p(!1)}},pe=()=>{u(1),H(""),J(""),oe(""),je([]),A(new Set),B(new Set),C(new Set)},Ce=2;return e.jsxs(Is,{open:n,onOpenChange:i,children:[e.jsx(ed,{asChild:!0,children:l||e.jsxs(_,{variant:"outline",children:[e.jsx(Ij,{className:"w-4 h-4 mr-2"}),"分享配置"]})}),e.jsxs(Ds,{className:"max-w-2xl max-h-[85vh] flex flex-col",children:[e.jsxs(Os,{children:[e.jsxs(Rs,{className:"flex items-center gap-2",children:[e.jsx(ra,{className:"w-5 h-5"}),"分享配置模板"]}),e.jsxs(Ks,{children:["步骤 ",c," / ",Ce,":",c===1&&"选择要分享的配置",c===2&&"填写模板信息"]})]}),e.jsx(Je,{className:"h-[calc(85vh-220px)] pr-4",children:x?e.jsxs("div",{className:"py-8 text-center",children:[e.jsx(Bs,{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(at,{children:[e.jsx(Ht,{className:"h-4 w-4"}),e.jsx(Hn,{children:"安全提示"}),e.jsxs(lt,{children:["分享的配置将",e.jsx("strong",{children:"不包含"})," API Key,其他用户需要自行配置。"]})]}),e.jsxs(ta,{defaultValue:"providers",className:"w-full",children:[e.jsxs(Xt,{className:"grid w-full grid-cols-3",children:[e.jsxs(Xe,{value:"providers",children:[e.jsx(Ol,{className:"w-4 h-4 mr-2"}),"API 提供商",e.jsxs(ke,{variant:"secondary",className:"ml-2",children:[R.size,"/",g.length]})]}),e.jsxs(Xe,{value:"models",children:[e.jsx(Vn,{className:"w-4 h-4 mr-2"}),"模型配置",e.jsxs(ke,{variant:"secondary",className:"ml-2",children:[S.size,"/",v.length]})]}),e.jsxs(Xe,{value:"tasks",children:[e.jsx(qn,{className:"w-4 h-4 mr-2"}),"任务配置",e.jsxs(ke,{variant:"secondary",className:"ml-2",children:[M.size,"/",Object.keys(w).length]})]})]}),e.jsx(ys,{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:I,children:R.size===g.length?"取消全选":"全选"})}),g.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-2",children:"暂无提供商配置"}):g.map(z=>e.jsxs("div",{className:"flex items-center space-x-2 p-2 rounded hover:bg-muted",children:[e.jsx(qs,{id:`provider-${z.name}`,checked:R.has(z.name),onCheckedChange:()=>fe(z.name)}),e.jsxs(T,{htmlFor:`provider-${z.name}`,className:"flex-1 cursor-pointer",children:[e.jsx("span",{className:"font-medium",children:z.name}),e.jsx("span",{className:"text-xs text-muted-foreground ml-2",children:z.base_url})]}),e.jsx(ke,{variant:"outline",className:"text-xs",children:z.client_type})]},z.name))]})}),e.jsx(ys,{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===v.length?"取消全选":"全选"})}),v.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-2",children:"暂无模型配置"}):v.map(z=>e.jsxs("div",{className:"flex items-center space-x-2 p-2 rounded hover:bg-muted",children:[e.jsx(qs,{id:`model-${z.name}`,checked:S.has(z.name),onCheckedChange:()=>ge(z.name)}),e.jsxs(T,{htmlFor:`model-${z.name}`,className:"flex-1 cursor-pointer",children:[e.jsx("span",{className:"font-medium",children:z.name}),e.jsx("span",{className:"text-xs text-muted-foreground ml-2",children:z.model_identifier})]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:z.api_provider})]},z.name))]})}),e.jsx(ys,{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:M.size===Object.keys(w).length?"取消全选":"全选"})}),Object.keys(w).length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-2",children:"暂无任务配置"}):Object.entries(w).map(([z,O])=>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(qs,{id:`task-${z}`,checked:M.has(z),onCheckedChange:()=>E(z)}),e.jsx(T,{htmlFor:`task-${z}`,className:"flex-1 cursor-pointer",children:e.jsx("span",{className:"font-medium",children:vS[z]||z})}),e.jsxs(ke,{variant:"outline",className:"text-xs",children:[O.model_list.length," 个模型"]})]}),O.model_list&&O.model_list.length>0&&e.jsx("div",{className:"ml-6 flex flex-wrap gap-1",children:O.model_list.map(V=>{const de=v.find(W=>W.name===V),De=S.has(V);return e.jsxs(ke,{variant:De?"default":"outline",className:"text-xs cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>ge(V),children:[V,de&&e.jsxs("span",{className:"ml-1 opacity-70",children:["(",de.api_provider,")"]})]},V)})})]},z))]})})]})]}),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(Ol,{className:"w-4 h-4"}),R.size," 个提供商"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Vn,{className:"w-4 h-4"}),S.size," 个模型"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(qn,{className:"w-4 h-4"}),M.size," 个任务"]})]}),e.jsx(Yt,{}),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(le,{id:"pack-name",placeholder:"例如:高性价比国产模型配置",value:D,onChange:z=>H(z.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(ot,{id:"pack-description",placeholder:"详细描述这个配置模板的特点、适用场景等...",value:L,onChange:z=>J(z.target.value),rows:4,maxLength:500}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[L.length,"/500"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"pack-author",children:"作者名称 *"}),e.jsx(le,{id:"pack-author",placeholder:"你的昵称或 ID",value:U,onChange:z=>oe(z.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:NS.map(z=>e.jsxs(ke,{variant:Ne.includes(z)?"default":"outline",className:"cursor-pointer transition-colors",onClick:()=>K(z),children:[Ne.includes(z)&&e.jsx(Ct,{className:"w-3 h-3 mr-1"}),e.jsx(Zo,{className:"w-3 h-3 mr-1"}),z]},z))})]})]}),e.jsxs(at,{children:[e.jsx(Ht,{className:"h-4 w-4"}),e.jsx(Hn,{children:"审核说明"}),e.jsx(lt,{children:"提交后需要经过审核才能在市场中展示。审核通常在 1-3 个工作日内完成。"})]})]})]})}),e.jsxs(st,{className:"flex justify-between pt-4 border-t",children:[e.jsx("div",{children:c>1&&e.jsx(_,{variant:"outline",onClick:()=>u(c-1),disabled:f,children:"上一步"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(_,{variant:"outline",onClick:()=>{i(!1),pe()},disabled:f,children:"取消"}),cu(c+1),disabled:x||R.size===0&&S.size===0&&M.size===0,children:"下一步"}):e.jsxs(_,{onClick:Se,disabled:f,children:[f&&e.jsx(Bs,{className:"w-4 h-4 mr-2 animate-spin"}),"提交审核"]})]})]})]})]})}function yS({value:l,label:n,onRemove:i}){const{attributes:c,listeners:u,setNodeRef:x,transform:h,transition:f,isDragging:p}=sv({id:l}),g={transform:tv.Transform.toString(h),transition:f,opacity:p?.5:1},N=b=>{b.preventDefault(),b.stopPropagation(),i(l)},v=b=>{b.stopPropagation()};return e.jsx("div",{ref:x,style:g,className:P("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,...u,className:"cursor-grab active:cursor-grabbing flex items-center",children:e.jsx(Uj,{className:"h-3 w-3 text-muted-foreground"})}),e.jsx("span",{children:n}),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:v,onMouseDown:b=>b.stopPropagation(),onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),N(b))},children:e.jsx(Ea,{className:"h-3 w-3 hover:text-destructive",strokeWidth:2,fill:"none"})})]})})}function wS({options:l,selected:n,onChange:i,placeholder:c="选择选项...",emptyText:u="未找到选项",className:x}){const[h,f]=d.useState(!1),p=Kj(Io(Jj,{activationConstraint:{distance:8}}),Io(Yj,{coordinateGetter:Qj})),g=b=>{n.includes(b)?i(n.filter(w=>w!==b)):i([...n,b])},N=b=>{i(n.filter(w=>w!==b))},v=b=>{const{active:w,over:y}=b;if(y&&w.id!==y.id){const R=n.indexOf(w.id),A=n.indexOf(y.id);i(Xj(n,R,A))}};return e.jsxs(ol,{open:h,onOpenChange:f,children:[e.jsx(dl,{asChild:!0,children:e.jsxs(_,{variant:"outline",role:"combobox","aria-expanded":h,className:P("w-full justify-between min-h-10 h-auto",x),children:[e.jsx(Zj,{sensors:p,collisionDetection:Wj,onDragEnd:v,children:e.jsx(ev,{items:n,strategy:R1,children:e.jsx("div",{className:"flex gap-1 flex-wrap flex-1",children:n.length===0?e.jsx("span",{className:"text-muted-foreground",children:c}):n.map(b=>{const w=l.find(y=>y.value===b);return e.jsx(yS,{value:b,label:w?.label||b,onRemove:N},b)})})})}),e.jsx(Ym,{className:"ml-2 h-4 w-4 shrink-0 opacity-50",strokeWidth:2,fill:"none"})]})}),e.jsx(Wa,{className:"w-full p-0",align:"start",children:e.jsxs(td,{children:[e.jsx(ad,{placeholder:"搜索...",className:"h-9"}),e.jsxs(ld,{children:[e.jsx(nd,{children:u}),e.jsx(lc,{children:l.map(b=>{const w=n.includes(b.value);return e.jsxs(nc,{value:b.value,onSelect:()=>g(b.value),children:[e.jsx("div",{className:P("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",w?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(Ct,{className:"h-3 w-3",strokeWidth:2,fill:"none"})}),e.jsx("span",{children:b.label})]},b.value)})})]})]})})]})}const Ml=As.memo(function({title:n,description:i,taskConfig:c,modelNames:u,onChange:x,hideTemperature:h=!1,hideMaxTokens:f=!1,dataTour:p}){const g=N=>{x("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:n}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:i})]}),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(wS,{options:u.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(le,{type:"number",step:"0.1",min:"0",max:"1",value:c.temperature??.3,onChange:N=>{const v=parseFloat(N.target.value);!isNaN(v)&&v>=0&&v<=1&&x("temperature",v)},className:"w-20 h-8 text-sm"})]}),e.jsx(qa,{value:[c.temperature??.3],onValueChange:N=>x("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(le,{type:"number",step:"1",min:"1",value:c.max_tokens??1024,onChange:N=>x("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(le,{type:"number",step:"1",min:"1",value:c.slow_threshold??15,onChange:N=>{const v=parseInt(N.target.value);!isNaN(v)&&v>=1&&x("slow_threshold",v)},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(Ie,{value:c.selection_strategy??"balance",onValueChange:N=>x("selection_strategy",N),children:[e.jsx($e,{children:e.jsx(Pe,{placeholder:"选择模型选择策略"})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"balance",children:"负载均衡(balance)"}),e.jsx(Z,{value:"random",children:"随机选择(random)"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"负载均衡:优先选择使用次数少的模型。随机选择:完全随机从模型列表中选择"})]})]})]})}),_S=As.memo(function({paginatedModels:n,allModels:i,onEdit:c,onDelete:u,isModelUsed:x,searchQuery:h}){return n.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:n.map((f,p)=>{const g=i.findIndex(v=>v===f),N=x(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(Gn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(_,{size:"sm",onClick:()=>u(g),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(ns,{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)})})}),SS=As.memo(function({paginatedModels:n,allModels:i,filteredModels:c,selectedModels:u,onEdit:x,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(Rl,{children:[e.jsx(Ll,{children:e.jsxs(ut,{children:[e.jsx(We,{className:"w-12",children:e.jsx(qs,{checked:u.size===c.length&&c.length>0,onCheckedChange:p})}),e.jsx(We,{className:"w-24",children:"使用状态"}),e.jsx(We,{children:"模型名称"}),e.jsx(We,{children:"模型标识符"}),e.jsx(We,{children:"提供商"}),e.jsx(We,{className:"text-center",children:"温度"}),e.jsx(We,{className:"text-right",children:"输入价格"}),e.jsx(We,{className:"text-right",children:"输出价格"}),e.jsx(We,{className:"text-right",children:"操作"})]})}),e.jsx(Ul,{children:n.length===0?e.jsx(ut,{children:e.jsx(Ke,{colSpan:9,className:"text-center text-muted-foreground py-8",children:N?"未找到匹配的模型":"暂无模型配置"})}):n.map((v,b)=>{const w=i.findIndex(R=>R===v),y=g(v.name);return e.jsxs(ut,{children:[e.jsx(Ke,{children:e.jsx(qs,{checked:u.has(w),onCheckedChange:()=>f(w)})}),e.jsx(Ke,{children:e.jsx(ke,{variant:y?"default":"secondary",className:y?"bg-green-600 hover:bg-green-700":"",children:y?"已使用":"未使用"})}),e.jsx(Ke,{className:"font-medium",children:v.name}),e.jsx(Ke,{className:"max-w-xs truncate",title:v.model_identifier,children:v.model_identifier}),e.jsx(Ke,{children:v.api_provider}),e.jsx(Ke,{className:"text-center",children:v.temperature!=null?v.temperature:e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsxs(Ke,{className:"text-right",children:["¥",v.price_in,"/M"]}),e.jsxs(Ke,{className:"text-right",children:["¥",v.price_out,"/M"]}),e.jsx(Ke,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>x(v,w),children:[e.jsx(Gn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(_,{size:"sm",onClick:()=>h(w),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(ns,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},b)})})]})})})}),kS=300*1e3,Eg=new Map,CS=[10,20,50,100],TS=As.memo(function({page:n,pageSize:i,totalItems:c,jumpToPage:u,onPageChange:x,onPageSizeChange:h,onJumpToPageChange:f,onJumpToPage:p,onSelectionClear:g}){const N=Math.ceil(c/i),v=w=>{h(parseInt(w)),x(1),g?.()},b=w=>{w.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(Ie,{value:i.toString(),onValueChange:v,children:[e.jsx($e,{id:"page-size-model",className:"w-20",children:e.jsx(Pe,{})}),e.jsx(Be,{children:CS.map(w=>e.jsx(Z,{value:w.toString(),children:w},w))})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(n-1)*i+1," 到"," ",Math.min(n*i,c)," 条,共 ",c," 条"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>x(1),disabled:n===1,className:"hidden sm:flex",children:e.jsx(gn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>x(Math.max(1,n-1)),disabled:n===1,children:[e.jsx(Aa,{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(le,{type:"number",value:u,onChange:w=>f(w.target.value),onKeyDown:b,placeholder:n.toString(),className:"w-16 h-8 text-center",min:1,max:N}),e.jsx(_,{variant:"outline",size:"sm",onClick:p,disabled:!u,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>x(n+1),disabled:n>=N,children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Zt,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>x(N),disabled:n>=N,className:"hidden sm:flex",children:e.jsx(jn,{className:"h-4 w-4"})})]})]})});function ES(l){const{models:n,taskConfig:i,debounceMs:c=2e3,onSavingChange:u,onUnsavedChange:x}=l,h=d.useRef(null),f=d.useRef(null),p=d.useRef(!0),g=d.useCallback(()=>{h.current&&(clearTimeout(h.current),h.current=null),f.current&&(clearTimeout(f.current),f.current=null)},[]),N=d.useCallback(w=>{const y={model_identifier:w.model_identifier,name:w.name,api_provider:w.api_provider,price_in:w.price_in??0,price_out:w.price_out??0,force_stream_mode:w.force_stream_mode??!1,extra_params:w.extra_params??{}};return w.temperature!=null&&(y.temperature=w.temperature),w.max_tokens!=null&&(y.max_tokens=w.max_tokens),y},[]),v=d.useCallback(async w=>{try{u?.(!0);const y=w.map(N);await Bm("models",y),x?.(!1)}catch(y){console.error("自动保存模型列表失败:",y),x?.(!0)}finally{u?.(!1)}},[u,x,N]),b=d.useCallback(async w=>{try{u?.(!0),await Bm("model_task_config",w),x?.(!1)}catch(y){console.error("自动保存任务配置失败:",y),x?.(!0)}finally{u?.(!1)}},[u,x]);return d.useEffect(()=>{if(!p.current)return x?.(!0),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{v(n)},c),()=>{h.current&&clearTimeout(h.current)}},[n,v,c,x]),d.useEffect(()=>{if(!(p.current||!i))return x?.(!0),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{b(i)},c),()=>{f.current&&clearTimeout(f.current)}},[i,b,c,x]),d.useEffect(()=>()=>{g()},[g]),{clearTimers:g,initialLoadRef:p}}function MS(l={}){const{onCloseEditDialog:n}=l,i=ca(),{registerTour:c,startTour:u,state:x,goToStep:h}=nx(),f=d.useRef(x.stepIndex);return d.useEffect(()=>{c(il,Sv)},[c]),d.useEffect(()=>{if(x.activeTourId===il&&x.isRunning){const g=kv[x.stepIndex];g&&!window.location.pathname.endsWith(g.replace("/config/",""))&&i({to:g})}},[x.stepIndex,x.activeTourId,x.isRunning,i]),d.useEffect(()=>{if(x.activeTourId===il&&x.isRunning){const g=f.current,N=x.stepIndex;g>=12&&g<=17&&N<12&&n?.(),f.current=N}},[x.stepIndex,x.activeTourId,x.isRunning,n]),d.useEffect(()=>{if(x.activeTourId!==il||!x.isRunning)return;const g=N=>{const v=N.target,b=x.stepIndex;b===2&&v.closest('[data-tour="add-provider-button"]')?setTimeout(()=>h(3),300):b===9&&v.closest('[data-tour="provider-cancel-button"]')?setTimeout(()=>h(10),300):b===11&&v.closest('[data-tour="add-model-button"]')?setTimeout(()=>h(12),300):b===17&&v.closest('[data-tour="model-cancel-button"]')?setTimeout(()=>h(18),300):b===18&&v.closest('[data-tour="tasks-tab-trigger"]')&&setTimeout(()=>h(19),300)};return document.addEventListener("click",g,!0),()=>document.removeEventListener("click",g,!0)},[x,h]),{startTour:d.useCallback(()=>{u(il)},[u]),isRunning:x.isRunning&&x.activeTourId===il,stepIndex:x.stepIndex}}function zS(l){const{getProviderConfig:n}=l,[i,c]=d.useState([]),[u,x]=d.useState(!1),[h,f]=d.useState(null),[p,g]=d.useState(null),N=d.useCallback(()=>{c([]),f(null),g(null)},[]),v=d.useCallback(async(b,w=!1)=>{const y=n(b);if(!y?.base_url){c([]),g(null),f('提供商配置不完整,请先在"模型提供商配置"中配置');return}if(!y.api_key){c([]),g(null),f('该提供商未配置 API Key,请先在"模型提供商配置"中填写');return}const R=nS(y.base_url);if(g(R),!R?.modelFetcher){c([]),f(null);return}const A=`${b}:${y.base_url}`,S=Eg.get(A);if(!w&&S&&Date.now()-S.timestampM(!1)}),{clearTimers:Ft,initialLoadRef:mt}=ES({models:l,taskConfig:p,onSavingChange:R,onUnsavedChange:S}),q=d.useCallback((ne,he)=>{if(!ne)return;const ts=new Set(he.map(ja=>ja.name)),gs=[],is=[],jt=[{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:ja,label:Bl}of jt){const Wn=ne[ja];if(!Wn)continue;if(!Wn.model_list||Wn.model_list.length===0){is.push(Bl);continue}const Xr=Wn.model_list.filter(bn=>!ts.has(bn));Xr.length>0&&gs.push({taskName:Bl,invalidModels:Xr})}ee(gs),ie(is)},[]),qe=d.useCallback(async()=>{try{v(!0);const ne=await un(),he=ne.models||[];n(he),f(he.map(jt=>jt.name));const ts=ne.api_providers||[];c(ts.map(jt=>jt.name)),x(ts);const gs=ne.model_task_config||null;g(gs),q(gs,he);const is=gs?.embedding?.model_list||[];Y.current=[...is],S(!1),mt.current=!1}catch(ne){console.error("加载配置失败:",ne)}finally{v(!1)}},[mt,q]);d.useEffect(()=>{qe()},[qe]);const Qe=d.useCallback(ne=>u.find(he=>he.name===ne),[u]),{availableModels:es,fetchingModels:Ls,modelFetchError:as,matchedTemplate:Cs,fetchModelsForProvider:ze,clearModels:Ns}=zS({getProviderConfig:Qe});d.useEffect(()=>{B&&C?.api_provider&&ze(C.api_provider)},[B,C?.api_provider,ze]);const ls=async()=>{await rs()},ss=d.useCallback(()=>{if(!p)return;const ne=new Set(l.map(gs=>gs.name)),he={...p},ts=Object.keys(he);for(const gs of ts){const is=he[gs];is&&is.model_list&&(is.model_list=is.model_list.filter(jt=>ne.has(jt)))}g(he),ee([]),Me({title:"清理完成",description:"已删除所有无效的模型引用"})},[p,l,Me]),bs=ne=>{const he={model_identifier:ne.model_identifier,name:ne.name,api_provider:ne.api_provider,price_in:ne.price_in??0,price_out:ne.price_out??0,force_stream_mode:ne.force_stream_mode??!1,extra_params:ne.extra_params??{}};return ne.temperature!=null&&(he.temperature=ne.temperature),ne.max_tokens!=null&&(he.max_tokens=ne.max_tokens),he},gt=async()=>{try{w(!0),Ft();const ne=await un();ne.models=l.map(bs),ne.model_task_config=p,await Xi(ne),S(!1),Me({title:"保存成功",description:"正在重启麦麦..."}),await ls()}catch(ne){console.error("保存配置失败:",ne),Me({title:"保存失败",description:ne.message,variant:"destructive"}),w(!1)}},$t=async()=>{try{w(!0),Ft();const ne=await un();ne.models=l.map(bs),ne.model_task_config=p,await Xi(ne),S(!1),Me({title:"保存成功",description:"模型配置已保存"}),await qe()}catch(ne){console.error("保存配置失败:",ne),Me({title:"保存失败",description:ne.message,variant:"destructive"})}finally{w(!1)}},tt=(ne,he)=>{me({}),D(ne||{model_identifier:"",name:"",api_provider:i[0]||"",price_in:0,price_out:0,temperature:null,max_tokens:null,force_stream_mode:!1,extra_params:{}}),L(he),M(!0)},Ms=()=>{if(!C)return;const ne={};if(C.name?.trim()?l.some((jt,ja)=>H!==null&&ja===H?!1:jt.name.trim().toLowerCase()===C.name.trim().toLowerCase())&&(ne.name="模型名称已存在,请使用其他名称"):ne.name="请输入模型名称",C.api_provider?.trim()||(ne.api_provider="请选择 API 提供商"),C.model_identifier?.trim()||(ne.model_identifier="请输入模型标识符"),Object.keys(ne).length>0){me(ne);return}me({});const he={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&&(he.temperature=C.temperature),C.max_tokens!=null&&(he.max_tokens=C.max_tokens);let ts,gs=null;if(H!==null?(gs=l[H].name,ts=[...l],ts[H]=he):ts=[...l,he],n(ts),f(ts.map(is=>is.name)),gs&&gs!==he.name&&p){const is=jt=>jt.map(ja=>ja===gs?he.name:ja);g({...p,utils:{...p.utils,model_list:is(p.utils?.model_list||[])},tool_use:{...p.tool_use,model_list:is(p.tool_use?.model_list||[])},replyer:{...p.replyer,model_list:is(p.replyer?.model_list||[])},planner:{...p.planner,model_list:is(p.planner?.model_list||[])},vlm:{...p.vlm,model_list:is(p.vlm?.model_list||[])},voice:{...p.voice,model_list:is(p.voice?.model_list||[])},embedding:{...p.embedding,model_list:is(p.embedding?.model_list||[])},lpmm_entity_extract:{...p.lpmm_entity_extract,model_list:is(p.lpmm_entity_extract?.model_list||[])},lpmm_rdf_build:{...p.lpmm_rdf_build,model_list:is(p.lpmm_rdf_build?.model_list||[])}})}M(!1),D(null),L(null),Me({title:H!==null?"模型已更新":"模型已添加",description:'配置将在 2 秒后自动保存,或点击右上角"保存配置"按钮立即保存'})},Et=ne=>{if(!ne&&C){const he={...C,price_in:C.price_in??0,price_out:C.price_out??0};D(he)}M(ne)},Bt=ne=>{re(ne),Ne(!0)},Da=()=>{if(je!==null){const ne=l.filter((he,ts)=>ts!==je);n(ne),f(ne.map(he=>he.name)),q(p,ne),Me({title:"删除成功",description:'配置将在 2 秒后自动保存,或点击右上角"保存配置"按钮立即保存'})}Ne(!1),re(null)},tl=ne=>{const he=new Set(E);he.has(ne)?he.delete(ne):he.add(ne),K(he)},ul=()=>{if(E.size===Ot.length)K(new Set);else{const ne=Ot.map((he,ts)=>l.findIndex(gs=>gs===Ot[ts]));K(new Set(ne))}},Zn=()=>{if(E.size===0){Me({title:"提示",description:"请先选择要删除的模型",variant:"default"});return}ue(!0)},se=()=>{const ne=E.size,he=l.filter((ts,gs)=>!E.has(gs));n(he),f(he.map(ts=>ts.name)),q(p,he),K(new Set),ue(!1),Me({title:"批量删除成功",description:`已删除 ${ne} 个模型,配置将在 2 秒后自动保存`})},we=(ne,he,ts)=>{if(!p)return;if(ne==="embedding"&&he==="model_list"&&Array.isArray(ts)){const is=Y.current,jt=ts;if((is.length!==jt.length||is.some(Bl=>!jt.includes(Bl))||jt.some(Bl=>!is.includes(Bl)))&&is.length>0){He.current={field:he,value:ts},W(!0);return}}const gs={...p,[ne]:{...p[ne],[he]:ts}};g(gs),q(gs,l),ne==="embedding"&&he==="model_list"&&Array.isArray(ts)&&(Y.current=[...ts])},Re=()=>{if(!p||!He.current)return;const{field:ne,value:he}=He.current,ts={...p,embedding:{...p.embedding,[ne]:he}};g(ts),q(ts,l),ne==="model_list"&&Array.isArray(he)&&(Y.current=[...he]),He.current=null,W(!1),Me({title:"嵌入模型已更新",description:"建议重新生成知识库向量以确保最佳匹配精度"})},Hs=()=>{He.current=null,W(!1)},Ot=l.filter(ne=>{if(!fe)return!0;const he=fe.toLowerCase();return ne.name.toLowerCase().includes(he)||ne.model_identifier.toLowerCase().includes(he)||ne.api_provider.toLowerCase().includes(he)}),Wt=Math.ceil(Ot.length/pe),rt=Ot.slice((Q-1)*pe,Q*pe),ea=()=>{const ne=parseInt(z);ne>=1&&ne<=Wt&&(Se(ne),O(""))},xt=ne=>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(ts=>ts.includes(ne)):!1;return N?e.jsx(Je,{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(Je,{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(bS,{trigger:e.jsxs(_,{variant:"outline",size:"sm",className:"flex-1 sm:flex-none",children:[e.jsx(Ij,{className:"mr-2 h-4 w-4"}),"分享配置"]})}),e.jsxs(_,{onClick:$t,disabled:b||y||!A||Ut,size:"sm",variant:"outline",className:"flex-1 sm:flex-none sm:min-w-[120px]",children:[e.jsx(dc,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),b?"保存中...":y?"自动保存中...":A?"保存配置":"已保存"]}),e.jsxs(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{disabled:b||y||Ut,size:"sm",className:"flex-1 sm:flex-none sm:min-w-[120px]",children:[e.jsx(oc,{className:"mr-2 h-4 w-4"}),Ut?"重启中...":A?"保存并重启":"重启麦麦"]})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认重启麦麦?"}),e.jsx(hs,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:A?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})})})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:A?gt:ls,children:A?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsxs(at,{children:[e.jsx(Ht,{className:"h-4 w-4"}),e.jsxs(lt,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),F.length>0&&e.jsxs(at,{variant:"destructive",children:[e.jsx(Jt,{className:"h-4 w-4"}),e.jsxs(lt,{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:F.map(({taskName:ne,invalidModels:he})=>e.jsxs("div",{className:"text-sm",children:[e.jsx("strong",{children:ne})," 引用了不存在的模型: ",he.join(", ")]},ne))})]}),e.jsx(_,{variant:"outline",size:"sm",className:"shrink-0 bg-background hover:bg-accent",onClick:ss,children:"一键清理"})]})]}),Ue.length>0&&e.jsxs(at,{variant:"default",className:"border-yellow-500/50 bg-yellow-500/10",children:[e.jsx(Jt,{className:"h-4 w-4 text-yellow-600"}),e.jsxs(lt,{children:[e.jsx("strong",{className:"text-yellow-600",children:"以下任务未配置模型"}),e.jsxs("div",{className:"mt-2 text-sm",children:[Ue.join("、")," 还未分配模型,这些功能将无法正常工作。"]})]})]}),e.jsxs(at,{className:"hidden lg:flex border-primary/30 bg-primary/5 cursor-pointer hover:bg-primary/10 transition-colors",onClick:aa,children:[e.jsx(s1,{className:"h-4 w-4 text-primary"}),e.jsxs(lt,{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(ta,{defaultValue:"models",className:"w-full",children:[e.jsxs(Xt,{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(ys,{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:[E.size>0&&e.jsxs(_,{onClick:Zn,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(ns,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",E.size,")"]}),e.jsxs(_,{onClick:()=>tt(null,null),size:"sm",variant:"outline",className:"w-full sm:w-auto","data-tour":"add-model-button",children:[e.jsx(et,{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(Tt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(le,{placeholder:"搜索模型名称、标识符或提供商...",value:fe,onChange:ne=>ge(ne.target.value),className:"pl-9"})]}),fe&&e.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",Ot.length," 个结果"]})]}),e.jsx(_S,{paginatedModels:rt,allModels:l,onEdit:tt,onDelete:Bt,isModelUsed:xt,searchQuery:fe}),e.jsx(SS,{paginatedModels:rt,allModels:l,filteredModels:Ot,selectedModels:E,onEdit:tt,onDelete:Bt,onToggleSelection:tl,onToggleSelectAll:ul,isModelUsed:xt,searchQuery:fe}),e.jsx(TS,{page:Q,pageSize:pe,totalItems:Ot.length,jumpToPage:z,onPageChange:Se,onPageSizeChange:Ce,onJumpToPageChange:O,onJumpToPage:ea,onSelectionClear:()=>K(new Set)})]}),e.jsxs(ys,{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(Ml,{title:"组件模型 (utils)",description:"用于表情包、取名、关系、情绪变化等组件",taskConfig:p.utils,modelNames:h,onChange:(ne,he)=>we("utils",ne,he),dataTour:"task-model-select"}),e.jsx(Ml,{title:"工具调用模型 (tool_use)",description:"需要使用支持工具调用的模型",taskConfig:p.tool_use,modelNames:h,onChange:(ne,he)=>we("tool_use",ne,he)}),e.jsx(Ml,{title:"首要回复模型 (replyer)",description:"用于表达器和表达方式学习",taskConfig:p.replyer,modelNames:h,onChange:(ne,he)=>we("replyer",ne,he)}),e.jsx(Ml,{title:"决策模型 (planner)",description:"负责决定麦麦该什么时候回复",taskConfig:p.planner,modelNames:h,onChange:(ne,he)=>we("planner",ne,he)}),e.jsx(Ml,{title:"图像识别模型 (vlm)",description:"视觉语言模型",taskConfig:p.vlm,modelNames:h,onChange:(ne,he)=>we("vlm",ne,he),hideTemperature:!0}),e.jsx(Ml,{title:"语音识别模型 (voice)",description:"语音转文字",taskConfig:p.voice,modelNames:h,onChange:(ne,he)=>we("voice",ne,he),hideTemperature:!0,hideMaxTokens:!0}),e.jsx(Ml,{title:"嵌入模型 (embedding)",description:"用于向量化",taskConfig:p.embedding,modelNames:h,onChange:(ne,he)=>we("embedding",ne,he),hideTemperature:!0,hideMaxTokens:!0}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库模型"}),e.jsx(Ml,{title:"实体提取模型 (lpmm_entity_extract)",description:"从文本中提取实体",taskConfig:p.lpmm_entity_extract,modelNames:h,onChange:(ne,he)=>we("lpmm_entity_extract",ne,he)}),e.jsx(Ml,{title:"RDF 构建模型 (lpmm_rdf_build)",description:"构建知识图谱",taskConfig:p.lpmm_rdf_build,modelNames:h,onChange:(ne,he)=>we("lpmm_rdf_build",ne,he)})]})]})]})]}),e.jsx(Is,{open:B,onOpenChange:Et,children:e.jsxs(Ds,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto","data-tour":"model-dialog",preventOutsideClose:Qa,children:[e.jsxs(Os,{children:[e.jsx(Rs,{children:H!==null?"编辑模型":"添加模型"}),e.jsx(Ks,{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(le,{id:"model_name",value:C?.name||"",onChange:ne=>{D(he=>he?{...he,name:ne.target.value}:null),Ee.name&&me(he=>({...he,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(Ie,{value:C?.api_provider||"",onValueChange:ne=>{D(he=>he?{...he,api_provider:ne}:null),Ns(),Ee.api_provider&&me(he=>({...he,api_provider:void 0}))},children:[e.jsx($e,{id:"api_provider",className:Ee.api_provider?"border-destructive focus-visible:ring-destructive":"",children:e.jsx(Pe,{placeholder:"选择提供商"})}),e.jsx(Be,{children:i.map(ne=>e.jsx(Z,{value:ne,children:ne},ne))})]}),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:"模型标识符 *"}),Cs?.modelFetcher&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ke,{variant:"secondary",className:"text-xs",children:Cs.display_name}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-6 px-2",onClick:()=>C?.api_provider&&ze(C.api_provider,!0),disabled:Ls,children:Ls?e.jsx(Bs,{className:"h-3 w-3 animate-spin"}):e.jsx(dt,{className:"h-3 w-3"})})]})]}),Cs?.modelFetcher?e.jsxs(ol,{open:V,onOpenChange:de,children:[e.jsx(dl,{asChild:!0,children:e.jsxs(_,{variant:"outline",role:"combobox","aria-expanded":V,className:"w-full justify-between font-normal",disabled:Ls||!!as,children:[Ls?e.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(Bs,{className:"h-4 w-4 animate-spin"}),"正在获取模型列表..."]}):as?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(Ym,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(Wa,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:e.jsxs(td,{children:[e.jsx(ad,{placeholder:"搜索模型..."}),e.jsx(Je,{className:"h-[300px]",children:e.jsxs(ld,{className:"max-h-none overflow-visible",children:[e.jsx(nd,{children:as?e.jsxs("div",{className:"py-4 px-2 text-center space-y-2",children:[e.jsx("p",{className:"text-sm text-destructive",children:as}),!as.includes("API Key")&&e.jsx(_,{variant:"link",size:"sm",onClick:()=>C?.api_provider&&ze(C.api_provider,!0),children:"重试"})]}):"未找到匹配的模型"}),e.jsx(lc,{heading:"可用模型",children:es.map(ne=>e.jsxs(nc,{value:ne.id,onSelect:()=>{D(he=>he?{...he,model_identifier:ne.id}:null),de(!1)},children:[e.jsx(Ct,{className:`mr-2 h-4 w-4 ${C?.model_identifier===ne.id?"opacity-100":"opacity-0"}`}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{children:ne.id}),ne.name!==ne.id&&e.jsx("span",{className:"text-xs text-muted-foreground",children:ne.name})]})]},ne.id))}),e.jsx(lc,{heading:"手动输入",children:e.jsxs(nc,{value:"__manual_input__",onSelect:()=>{de(!1)},children:[e.jsx(Gn,{className:"mr-2 h-4 w-4"}),"手动输入模型标识符..."]})})]})})]})})]}):e.jsx(le,{id:"model_identifier",value:C?.model_identifier||"",onChange:ne=>{D(he=>he?{...he,model_identifier:ne.target.value}:null),Ee.model_identifier&&me(he=>({...he,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}),as&&Cs?.modelFetcher&&!Ee.model_identifier&&e.jsxs(at,{variant:"destructive",className:"mt-2 py-2",children:[e.jsx(Ht,{className:"h-4 w-4"}),e.jsx(lt,{className:"text-xs",children:as})]}),Cs?.modelFetcher&&e.jsx(le,{value:C?.model_identifier||"",onChange:ne=>{D(he=>he?{...he,model_identifier:ne.target.value}:null),Ee.model_identifier&&me(he=>({...he,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:as?'请手动输入模型标识符,或前往"模型提供商配置"检查 API Key':Cs?.modelFetcher?`已识别为 ${Cs.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(le,{id:"price_in",type:"number",step:"0.1",min:"0",value:C?.price_in??"",onChange:ne=>{const he=ne.target.value===""?null:parseFloat(ne.target.value);D(ts=>ts?{...ts,price_in:he}:null)},placeholder:"默认: 0"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"price_out",children:"输出价格 (¥/M token)"}),e.jsx(le,{id:"price_out",type:"number",step:"0.1",min:"0",value:C?.price_out??"",onChange:ne=>{const he=ne.target.value===""?null:parseFloat(ne.target.value);D(ts=>ts?{...ts,price_out:he}: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:ne=>{D(ne?he=>he?{...he,temperature:.5}:null:he=>he?{...he,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:ne=>D(he=>he?{...he,temperature:ne[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:ne=>{D(ne?he=>he?{...he,max_tokens:2048}:null:he=>he?{...he,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(le,{type:"number",min:"1",max:"128000",value:C.max_tokens,onChange:ne=>{const he=parseInt(ne.target.value);!isNaN(he)&&he>=1&&D(ts=>ts?{...ts,max_tokens:he}: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:ne=>D(he=>he?{...he,force_stream_mode:ne}: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:()=>U(!0),children:[e.jsx(pn,{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(ne=>e.jsx("span",{className:"inline-block mr-2",children:e.jsx("code",{className:"px-1.5 py-0.5 bg-muted rounded",children:ne})},ne)),Object.keys(C?.extra_params||{}).length>3&&e.jsx("span",{children:"..."})]})]})]}),e.jsxs(st,{children:[e.jsx(_,{variant:"outline",onClick:()=>M(!1),"data-tour":"model-cancel-button",children:"取消"}),e.jsx(_,{onClick:Ms,"data-tour":"model-save-button",children:"保存"})]})]})}),e.jsx(vs,{open:oe,onOpenChange:Ne,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:['确定要删除模型 "',je!==null?l[je]?.name:"",'" 吗? 此操作无法撤销。']})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:Da,children:"删除"})]})]})}),e.jsx(vs,{open:I,onOpenChange:ue,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认批量删除"}),e.jsxs(hs,{children:["确定要删除选中的 ",E.size," 个模型吗? 此操作无法撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:se,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),e.jsx(vs,{open:De,onOpenChange:W,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsxs(xs,{className:"flex items-center gap-2",children:[e.jsx(Jt,{className:"h-5 w-5 text-amber-500"}),"更换嵌入模型警告"]}),e.jsx(hs,{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(ms,{children:[e.jsx(ps,{onClick:Hs,children:"取消"}),e.jsx(fs,{onClick:Re,className:"bg-amber-600 hover:bg-amber-700",children:"确认更换"})]})]})}),e.jsx(uS,{open:J,onOpenChange:U,value:C?.extra_params||{},onChange:ne=>D(he=>he?{...he,extra_params:ne}:null)}),e.jsx(Xn,{})]})})}const rc=lj,ic=Y0,cc=J0,rd="/api/webui/config";async function OS(){const n=await(await _e(`${rd}/adapter-config/path`)).json();return!n.success||!n.path?null:{path:n.path,lastModified:n.lastModified}}async function Mg(l){const i=await(await _e(`${rd}/adapter-config/path`,{method:"POST",headers:Fs(),body:JSON.stringify({path:l})})).json();if(!i.success)throw new Error(i.message||"保存路径失败")}async function zg(l){const i=await(await _e(`${rd}/adapter-config?path=${encodeURIComponent(l)}`)).json();if(!i.success)throw new Error("读取配置文件失败");return i.content}async function Ag(l,n){const c=await(await _e(`${rd}/adapter-config`,{method:"POST",headers:Fs(),body:JSON.stringify({path:l,content:n})})).json();if(!c.success)throw new Error(c.message||"保存配置失败")}const bt={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"}},Mm={oneclick:{name:"一键包",description:"使用一键包部署的适配器配置",path:"../MaiBot-Napcat-Adapter/config.toml",icon:ra},docker:{name:"Docker",description:"Docker Compose 部署的适配器配置",path:"/MaiMBot/adapters-config/config.toml",icon:t1}};function RS(l,n){let i=l.slice(0,n).split(/\r\n|\n|\r/g);return[i.length,i.pop().length+1]}function LS(l,n,i){let c=l.split(/\r\n|\n|\r/g),u="",x=(Math.log10(n+1)|0)+1;for(let h=n-1;h<=n+1;h++){let f=c[h-1];f&&(u+=h.toString().padEnd(x," "),u+=": ",u+=f,u+=` +`,h===n&&(u+=" ".repeat(x+i+2),u+=`^ +`))}return u}class ks extends Error{line;column;codeblock;constructor(n,i){const[c,u]=RS(i.toml,i.ptr),x=LS(i.toml,c,u);super(`Invalid TOML document: ${n} + +${x}`,i),this.line=c,this.column=u,this.codeblock=x}}function US(l,n){let i=0;for(;l[n-++i]==="\\";);return--i&&i%2}function Fo(l,n=0,i=l.length){let c=l.indexOf(` +`,n);return l[c-1]==="\r"&&c--,c<=i?c:-1}function rx(l,n){for(let i=n;i-1&&i!=="'"&&US(l,n));return n>-1&&(n+=c.length,c.length>1&&(l[n]===i&&n++,l[n]===i&&n++)),n}let $S=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}:\d{2}(?:\.\d+)?)?(Z|[-+]\d{2}:\d{2})?$/i;class Hr extends Date{#s=!1;#t=!1;#e=null;constructor(n){let i=!0,c=!0,u="Z";if(typeof n=="string"){let x=n.match($S);x?(x[1]||(i=!1,n=`0000-01-01T${n}`),c=!!x[2],c&&n[10]===" "&&(n=n.replace(" ","T")),x[2]&&+x[2]>23?n="":(u=x[3]||null,n=n.toUpperCase(),!u&&c&&(n+="Z"))):n=""}super(n),isNaN(this.getTime())||(this.#s=i,this.#t=c,this.#e=u)}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 n=super.toISOString();if(this.isDate())return n.slice(0,10);if(this.isTime())return n.slice(11,23);if(this.#e===null)return n.slice(0,-1);if(this.#e==="Z")return n;let i=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return i=this.#e[0]==="-"?i:-i,new Date(this.getTime()-i*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(n,i="Z"){let c=new Hr(n);return c.#e=i,c}static wrapAsLocalDateTime(n){let i=new Hr(n);return i.#e=null,i}static wrapAsLocalDate(n){let i=new Hr(n);return i.#t=!1,i.#e=null,i}static wrapAsLocalTime(n){let i=new Hr(n);return i.#s=!1,i.#e=null,i}}let BS=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,IS=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,PS=/^[+-]?0[0-9_]/,HS=/^[0-9a-f]{4,8}$/i,Og={b:"\b",t:" ",n:` +`,f:"\f",r:"\r",'"':'"',"\\":"\\"};function Av(l,n=0,i=l.length){let c=l[n]==="'",u=l[n++]===l[n]&&l[n]===l[n+1];u&&(i-=2,l[n+=2]==="\r"&&n++,l[n]===` +`&&n++);let x=0,h,f="",p=n;for(;n-1&&(rx(l,x),u=u.slice(0,x));let h=u.trimEnd();if(!c){let f=u.indexOf(` +`,h.length);if(f>-1)throw new ks("newlines are not allowed in inline tables",{toml:l,ptr:n+f})}return[h,x]}function ix(l,n,i,c,u){if(c===0)throw new ks("document contains excessively nested structures. aborting.",{toml:l,ptr:n});let x=l[n];if(x==="["||x==="{"){let[p,g]=x==="["?KS(l,n,c,u):qS(l,n,c,u),N=i?Dg(l,g,",",i):g;if(g-N&&i==="}"){let v=Fo(l,g,N);if(v>-1)throw new ks("newlines are not allowed in inline tables",{toml:l,ptr:v})}return[p,N]}let h;if(x==='"'||x==="'"){h=zv(l,n);let p=Av(l,n,h);if(i){if(h=Dl(l,h,i!=="]"),l[h]&&l[h]!==","&&l[h]!==i&&l[h]!==` +`&&l[h]!=="\r")throw new ks("unexpected character encountered",{toml:l,ptr:h});h+=+(l[h]===",")}return[p,h]}h=Dg(l,n,",",i);let f=GS(l,n,h-+(l[h-1]===","),i==="]");if(!f[0])throw new ks("incomplete key-value declaration: no value specified",{toml:l,ptr:n});return i&&f[1]>-1&&(h=Dl(l,n+f[1]),h+=+(l[h]===",")),[FS(f[0],l,n,u),h]}let VS=/^[a-zA-Z0-9-_]+[ \t]*$/;function Hm(l,n,i="="){let c=n-1,u=[],x=l.indexOf(i,n);if(x<0)throw new ks("incomplete key-value: cannot find end of key",{toml:l,ptr:n});do{let h=l[n=++c];if(h!==" "&&h!==" ")if(h==='"'||h==="'"){if(h===l[n+1]&&h===l[n+2])throw new ks("multiline strings are not allowed in keys",{toml:l,ptr:n});let f=zv(l,n);if(f<0)throw new ks("unfinished string encountered",{toml:l,ptr:n});c=l.indexOf(".",f);let p=l.slice(f,c<0||c>x?x:c),g=Fo(p);if(g>-1)throw new ks("newlines are not allowed in keys",{toml:l,ptr:n+c+g});if(p.trimStart())throw new ks("found extra tokens after the string part",{toml:l,ptr:f});if(xx?x:c);if(!VS.test(f))throw new ks("only letter, numbers, dashes and underscores are allowed in keys",{toml:l,ptr:n});u.push(f.trimEnd())}}while(c+1&&cu===""||u===null||u===void 0?x:u,i={inner:{version:n(l.inner.version,bt.inner.version)},nickname:{nickname:n(l.nickname.nickname,bt.nickname.nickname)},napcat_server:{host:n(l.napcat_server.host,bt.napcat_server.host),port:n(l.napcat_server.port||0,bt.napcat_server.port),token:n(l.napcat_server.token,bt.napcat_server.token),heartbeat_interval:n(l.napcat_server.heartbeat_interval||0,bt.napcat_server.heartbeat_interval)},maibot_server:{host:n(l.maibot_server.host,bt.maibot_server.host),port:n(l.maibot_server.port||0,bt.maibot_server.port)},chat:{group_list_type:n(l.chat.group_list_type,bt.chat.group_list_type),group_list:l.chat.group_list||[],private_list_type:n(l.chat.private_list_type,bt.chat.private_list_type),private_list:l.chat.private_list||[],ban_user_id:l.chat.ban_user_id||[],ban_qq_bot:l.chat.ban_qq_bot??bt.chat.ban_qq_bot,enable_poke:l.chat.enable_poke??bt.chat.enable_poke},voice:{use_tts:l.voice.use_tts??bt.voice.use_tts},debug:{level:n(l.debug.level,bt.debug.level)}};let c=ZS(i);return c=WS(c),c}catch(n){throw console.error("TOML 生成失败:",n),new Error(`无法生成 TOML 文件: ${n instanceof Error?n.message:"未知错误"}`)}}function WS(l){const n=l.split(` +`),i=[];for(let c=0;c"|?*\x00-\x1F]/.test(l)?{valid:!1,error:"路径包含非法字符"}:{valid:!0,error:""}}function e4(){const[l,n]=d.useState("upload"),[i,c]=d.useState(null),[u,x]=d.useState(""),[h,f]=d.useState(""),[p,g]=d.useState("oneclick"),[N,v]=d.useState(""),[b,w]=d.useState(!1),[y,R]=d.useState(!1),[A,S]=d.useState(!1),[B,M]=d.useState(!1),[C,D]=d.useState(null),[H,L]=d.useState(!1),J=d.useRef(null),{toast:U}=Zs(),oe=d.useRef(null),Ne=V=>{if(f(V),V.trim()){const de=Dm(V);v(de.error)}else v("")},je=d.useCallback(async V=>{const de=Mm[V];R(!0);try{const De=await zg(de.path),W=zm(De);c(W),g(V),f(de.path),await Mg(de.path),U({title:"加载成功",description:`已从${de.name}预设加载配置`})}catch(De){console.error("加载预设配置失败:",De),U({title:"加载失败",description:De instanceof Error?De.message:"无法读取预设配置文件",variant:"destructive"})}finally{R(!1)}},[U]),re=d.useCallback(async V=>{const de=Dm(V);if(!de.valid){v(de.error),U({title:"路径无效",description:de.error,variant:"destructive"});return}v(""),R(!0);try{const De=await zg(V),W=zm(De);c(W),f(V),await Mg(V),U({title:"加载成功",description:"已从配置文件加载"})}catch(De){console.error("加载配置失败:",De),U({title:"加载失败",description:De instanceof Error?De.message:"无法读取配置文件",variant:"destructive"})}finally{R(!1)}},[U]);d.useEffect(()=>{(async()=>{try{const de=await OS();if(de&&de.path){f(de.path);const De=Object.entries(Mm).find(([,W])=>W.path===de.path);De?(n("preset"),g(De[0]),await je(De[0])):(n("path"),await re(de.path))}}catch(de){console.error("加载保存的路径失败:",de)}})()},[re,je]);const fe=d.useCallback(V=>{l!=="path"&&l!=="preset"||!h||(oe.current&&clearTimeout(oe.current),oe.current=setTimeout(async()=>{w(!0);try{const de=Am(V);await Ag(h,de),U({title:"自动保存成功",description:"配置已保存到文件"})}catch(de){console.error("自动保存失败:",de),U({title:"自动保存失败",description:de instanceof Error?de.message:"保存配置失败",variant:"destructive"})}finally{w(!1)}},1e3))},[l,h,U]),ge=async()=>{if(!i||!h)return;const V=Dm(h);if(!V.valid){U({title:"保存失败",description:V.error,variant:"destructive"});return}w(!0);try{const de=Am(i);await Ag(h,de),U({title:"保存成功",description:"配置已保存到文件"})}catch(de){console.error("保存失败:",de),U({title:"保存失败",description:de instanceof Error?de.message:"保存配置失败",variant:"destructive"})}finally{w(!1)}},E=async()=>{h&&await re(h)},K=V=>{if(V!==l){if(i){D(V),S(!0);return}I(V)}},I=V=>{c(null),x(""),v(""),n(V),V==="preset"&&je("oneclick"),U({title:"已切换模式",description:{upload:"现在可以上传配置文件",path:"现在可以指定配置文件路径",preset:"现在可以使用预设配置"}[V]})},ue=()=>{C&&(I(C),D(null)),S(!1)},Q=()=>{if(i){M(!0);return}Se()},Se=()=>{f(""),c(null),v(""),U({title:"已清空",description:"路径和配置已清空"})},pe=()=>{Se(),M(!1)},Ce=V=>{const de=V.target.files?.[0];if(!de)return;const De=new FileReader;De.onload=W=>{try{const Y=W.target?.result,He=zm(Y);c(He),x(de.name),U({title:"上传成功",description:`已加载配置文件:${de.name}`})}catch(Y){console.error("解析配置文件失败:",Y),U({title:"解析失败",description:"配置文件格式错误,请检查文件内容",variant:"destructive"})}},De.readAsText(de)},z=()=>{if(!i)return;const V=Am(i),de=new Blob([V],{type:"text/plain;charset=utf-8"}),De=URL.createObjectURL(de),W=document.createElement("a");W.href=De,W.download=u||"config.toml",document.body.appendChild(W),W.click(),document.body.removeChild(W),URL.revokeObjectURL(De),U({title:"下载成功",description:"配置文件已下载,请手动覆盖并重启适配器"})},O=()=>{c(JSON.parse(JSON.stringify(bt))),x("config.toml"),U({title:"已加载默认配置",description:"可以开始编辑配置"})};return e.jsx(Je,{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(_t,{className:"h-4 w-4 mt-0.5 flex-shrink-0"}),e.jsx("p",{className:"text-sm",children:"适配器配置保存之后使用 WebUI 的重启功能适配器并不会重启,需要手动重启适配器。"})]}),e.jsx(rc,{open:H,onOpenChange:L,children:e.jsxs(Te,{children:[e.jsx(Oe,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Le,{children:"工作模式"}),e.jsx(ws,{children:"选择配置文件的管理方式"})]}),e.jsx(ic,{asChild:!0,children:e.jsxs(_,{variant:"ghost",size:"sm",className:"w-9 p-0",children:[e.jsx(Ma,{className:`h-4 w-4 transition-transform duration-200 ${H?"transform rotate-180":""}`}),e.jsx("span",{className:"sr-only",children:"切换"})]})})]})}),e.jsx(cc,{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 ${l==="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(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 ${l==="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(sc,{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 ${l==="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(a1,{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:"指定配置文件路径,自动加载和保存"})]})]})})]}),l==="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(Mm).map(([V,de])=>{const De=de.icon,W=p===V;return e.jsx("div",{className:`border-2 rounded-lg p-3 cursor-pointer transition-all ${W?"border-primary bg-primary/5":"border-muted hover:border-primary/50"}`,onClick:()=>{g(V),je(V)},children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(De,{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:de.name}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:de.description}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 font-mono break-all",children:de.path})]})]})},V)})})]}),l==="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(le,{id:"config-path",value:h,onChange:V=>Ne(V.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:()=>re(h),disabled:y||!h||!!N,className:"w-full sm:w-auto",children:y?e.jsxs(e.Fragment,{children:[e.jsx(dt,{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(at,{children:[e.jsx(Ht,{className:"h-4 w-4"}),e.jsx(lt,{children:l==="preset"?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"预设模式:"}),"选择预设的部署方式,配置会自动加载,修改后 1 秒自动保存",b&&" (正在保存...)"]}):l==="upload"?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"上传文件模式:"}),"上传配置文件 → 在线编辑 → 下载文件 → 手动覆盖并重启适配器"]}):e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"指定路径模式:"}),"指定配置文件路径后,配置会自动加载,修改后 1 秒自动保存",b&&" (正在保存...)"]})})]}),l==="upload"&&!i&&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:Ce}),e.jsxs(_,{onClick:()=>J.current?.click(),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(sc,{className:"mr-2 h-4 w-4"}),"上传配置"]}),e.jsxs(_,{onClick:O,size:"sm",className:"w-full sm:w-auto",children:[e.jsx(Ca,{className:"mr-2 h-4 w-4"}),"使用默认配置"]})]}),l==="upload"&&i&&e.jsx("div",{className:"flex gap-2",children:e.jsxs(_,{onClick:z,size:"sm",className:"w-full sm:w-auto",children:[e.jsx(sa,{className:"mr-2 h-4 w-4"}),"下载配置"]})}),(l==="preset"||l==="path")&&i&&e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs(_,{onClick:ge,size:"sm",disabled:b||!!N,className:"w-full sm:w-auto",children:[e.jsx(dc,{className:"mr-2 h-4 w-4"}),b?"保存中...":"立即保存"]}),e.jsxs(_,{onClick:E,size:"sm",variant:"outline",disabled:y,className:"w-full sm:w-auto",children:[e.jsx(dt,{className:`mr-2 h-4 w-4 ${y?"animate-spin":""}`}),"刷新"]}),l==="path"&&e.jsxs(_,{onClick:Q,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(ns,{className:"mr-2 h-4 w-4"}),"清空路径"]})]}),i?e.jsxs(ta,{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(Xt,{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(ys,{value:"napcat",className:"space-y-4",children:e.jsx(s4,{config:i,onChange:V=>{c(V),fe(V)}})}),e.jsx(ys,{value:"maibot",className:"space-y-4",children:e.jsx(t4,{config:i,onChange:V=>{c(V),fe(V)}})}),e.jsx(ys,{value:"chat",className:"space-y-4",children:e.jsx(a4,{config:i,onChange:V=>{c(V),fe(V)}})}),e.jsx(ys,{value:"voice",className:"space-y-4",children:e.jsx(l4,{config:i,onChange:V=>{c(V),fe(V)}})}),e.jsx(ys,{value:"debug",className:"space-y-4",children:e.jsx(n4,{config:i,onChange:V=>{c(V),fe(V)}})})]}):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(Ca,{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:l==="preset"?"请选择预设的部署方式":l==="upload"?"请上传现有配置文件,或使用默认配置开始编辑":"请指定配置文件路径并点击加载按钮"})]})]})}),e.jsx(vs,{open:A,onOpenChange:S,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认切换模式"}),e.jsxs(hs,{children:["切换模式将清空当前配置,确定要继续吗?",e.jsx("br",{}),e.jsx("span",{className:"text-destructive font-medium",children:"请确保已保存重要配置"})]})]}),e.jsxs(ms,{children:[e.jsx(ps,{onClick:()=>{S(!1),D(null)},children:"取消"}),e.jsx(fs,{onClick:ue,children:"确认切换"})]})]})}),e.jsx(vs,{open:B,onOpenChange:M,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认清空路径"}),e.jsxs(hs,{children:["清空路径将清除当前配置,确定要继续吗?",e.jsx("br",{}),e.jsx("span",{className:"text-muted-foreground text-sm",children:"此操作不会删除配置文件,只是清除界面中的配置"})]})]}),e.jsxs(ms,{children:[e.jsx(ps,{onClick:()=>M(!1),children:"取消"}),e.jsx(fs,{onClick:pe,className:"bg-destructive hover:bg-destructive/90",children:"确认清空"})]})]})})]})})}function s4({config:l,onChange:n}){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(le,{id:"napcat-host",value:l.napcat_server.host,onChange:i=>n({...l,napcat_server:{...l.napcat_server,host:i.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(le,{id:"napcat-port",type:"number",value:l.napcat_server.port||"",onChange:i=>n({...l,napcat_server:{...l.napcat_server,port:i.target.value?parseInt(i.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(le,{id:"napcat-token",type:"password",value:l.napcat_server.token,onChange:i=>n({...l,napcat_server:{...l.napcat_server,token:i.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(le,{id:"napcat-heartbeat",type:"number",value:l.napcat_server.heartbeat_interval||"",onChange:i=>n({...l,napcat_server:{...l.napcat_server,heartbeat_interval:i.target.value?parseInt(i.target.value):0}}),placeholder:"30",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"与 Napcat 设置的心跳间隔保持一致(留空使用默认值 30)"})]})]})]})})}function t4({config:l,onChange:n}){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(le,{id:"maibot-host",value:l.maibot_server.host,onChange:i=>n({...l,maibot_server:{...l.maibot_server,host:i.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(le,{id:"maibot-port",type:"number",value:l.maibot_server.port||"",onChange:i=>n({...l,maibot_server:{...l.maibot_server,port:i.target.value?parseInt(i.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 a4({config:l,onChange:n}){const i=x=>{const h={...l};x==="group"?h.chat.group_list=[...h.chat.group_list,0]:x==="private"?h.chat.private_list=[...h.chat.private_list,0]:h.chat.ban_user_id=[...h.chat.ban_user_id,0],n(h)},c=(x,h)=>{const f={...l};x==="group"?f.chat.group_list=f.chat.group_list.filter((p,g)=>g!==h):x==="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),n(f)},u=(x,h,f)=>{const p={...l};x==="group"?p.chat.group_list[h]=f:x==="private"?p.chat.private_list[h]=f:p.chat.ban_user_id[h]=f,n(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(Ie,{value:l.chat.group_list_type,onValueChange:x=>n({...l,chat:{...l.chat,group_list_type:x}}),children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),e.jsx(Z,{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:()=>i("group"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(Ca,{className:"mr-1 h-4 w-4"}),"添加群号"]})]}),l.chat.group_list.map((x,h)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(le,{type:"number",value:x,onChange:f=>u("group",h,parseInt(f.target.value)||0),placeholder:"输入群号",className:"text-sm md:text-base"}),e.jsxs(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(ns,{className:"h-4 w-4"})})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:["确定要删除群号 ",x," 吗?此操作无法撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>c("group",h),children:"删除"})]})]})]})]},h)),l.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(Ie,{value:l.chat.private_list_type,onValueChange:x=>n({...l,chat:{...l.chat,private_list_type:x}}),children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),e.jsx(Z,{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:()=>i("private"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(Ca,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),l.chat.private_list.map((x,h)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(le,{type:"number",value:x,onChange:f=>u("private",h,parseInt(f.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),e.jsxs(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(ns,{className:"h-4 w-4"})})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:["确定要删除用户 ",x," 吗?此操作无法撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>c("private",h),children:"删除"})]})]})]})]},h)),l.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:()=>i("ban"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(Ca,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),l.chat.ban_user_id.map((x,h)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(le,{type:"number",value:x,onChange:f=>u("ban",h,parseInt(f.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),e.jsxs(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(ns,{className:"h-4 w-4"})})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:["确定要从全局禁止名单中删除用户 ",x," 吗?此操作无法撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>c("ban",h),children:"删除"})]})]})]})]},h)),l.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:l.chat.ban_qq_bot,onCheckedChange:x=>n({...l,chat:{...l.chat,ban_qq_bot:x}})})]}),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:l.chat.enable_poke,onCheckedChange:x=>n({...l,chat:{...l.chat,enable_poke:x}})})]})]})]})})}function l4({config:l,onChange:n}){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:l.voice.use_tts,onCheckedChange:i=>n({...l,voice:{use_tts:i}})})]})]})})}function n4({config:l,onChange:n}){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(Ie,{value:l.debug.level,onValueChange:i=>n({...l,debug:{level:i}}),children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"DEBUG",children:"DEBUG(调试)"}),e.jsx(Z,{value:"INFO",children:"INFO(信息)"}),e.jsx(Z,{value:"WARNING",children:"WARNING(警告)"}),e.jsx(Z,{value:"ERROR",children:"ERROR(错误)"}),e.jsx(Z,{value:"CRITICAL",children:"CRITICAL(严重)"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"设置适配器的日志输出等级"})]})})]})})}const r4=["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"],i4=/^(aria-|data-)/,Rv=l=>Object.fromEntries(Object.entries(l).filter(([n])=>i4.test(n)||r4.includes(n)));function c4(l,n){const i=Rv(l);return Object.keys(l).some(c=>!Object.hasOwn(i,c)&&l[c]!==n[c])}class o4 extends d.Component{container;plugin;componentDidMount(){this.installPlugin()}componentDidUpdate(n){if(n.uppy!==this.props.uppy)this.uninstallPlugin(n),this.installPlugin();else if(c4(this.props,n)){const{uppy:i,...c}={...this.props,target:this.container};this.plugin.setOptions(c)}}componentWillUnmount(){this.uninstallPlugin()}installPlugin(){const{uppy:n,...i}={id:"Dashboard",...this.props,inline:!0,target:this.container};n.use($1,i),this.plugin=n.getPlugin(i.id)}uninstallPlugin(n=this.props){const{uppy:i}=n;i.removePlugin(this.plugin)}render(){return d.createElement("div",{className:"uppy-Container",ref:n=>{this.container=n},...Rv(this.props)})}}function d4({src:l,alt:n="表情包",className:i,maxRetries:c=5,retryInterval:u=1500}){const[x,h]=d.useState("loading"),[f,p]=d.useState(0),[g,N]=d.useState(null),[v,b]=d.useState(l);l!==v&&(h("loading"),p(0),N(null),b(l));const w=d.useCallback(async()=>{try{const y=await fetch(l,{credentials:"include"});if(y.status===202){h("generating"),f{p(S=>S+1)},u):h("error");return}if(!y.ok){h("error");return}const R=await y.blob(),A=URL.createObjectURL(R);N(A),h("loaded")}catch(y){console.error("加载缩略图失败:",y),h("error")}},[l,f,c,u]);return d.useEffect(()=>{w()},[w]),d.useEffect(()=>()=>{g&&URL.revokeObjectURL(g)},[g]),x==="loading"||x==="generating"?e.jsx(js,{className:P("w-full h-full",i)}):x==="error"||!g?e.jsx("div",{className:P("w-full h-full flex items-center justify-center bg-muted",i),children:e.jsx(Jm,{className:"h-8 w-8 text-muted-foreground"})}):e.jsx("img",{src:g,alt:n,className:P("w-full h-full object-contain",i)})}function u4({children:l,className:n}){return e.jsx(lx,{content:l,className:n})}const Ka="/api/webui/emoji";async function m4(l){const n=new URLSearchParams;l.page&&n.append("page",l.page.toString()),l.page_size&&n.append("page_size",l.page_size.toString()),l.search&&n.append("search",l.search),l.is_registered!==void 0&&n.append("is_registered",l.is_registered.toString()),l.is_banned!==void 0&&n.append("is_banned",l.is_banned.toString()),l.format&&n.append("format",l.format),l.sort_by&&n.append("sort_by",l.sort_by),l.sort_order&&n.append("sort_order",l.sort_order);const i=await _e(`${Ka}/list?${n}`,{});if(!i.ok)throw new Error(`获取表情包列表失败: ${i.statusText}`);return i.json()}async function x4(l){const n=await _e(`${Ka}/${l}`,{});if(!n.ok)throw new Error(`获取表情包详情失败: ${n.statusText}`);return n.json()}async function h4(l,n){const i=await _e(`${Ka}/${l}`,{method:"PATCH",body:JSON.stringify(n)});if(!i.ok)throw new Error(`更新表情包失败: ${i.statusText}`);return i.json()}async function f4(l){const n=await _e(`${Ka}/${l}`,{method:"DELETE"});if(!n.ok)throw new Error(`删除表情包失败: ${n.statusText}`);return n.json()}async function p4(){const l=await _e(`${Ka}/stats/summary`,{});if(!l.ok)throw new Error(`获取统计数据失败: ${l.statusText}`);return l.json()}async function g4(l){const n=await _e(`${Ka}/${l}/register`,{method:"POST"});if(!n.ok)throw new Error(`注册表情包失败: ${n.statusText}`);return n.json()}async function j4(l){const n=await _e(`${Ka}/${l}/ban`,{method:"POST"});if(!n.ok)throw new Error(`封禁表情包失败: ${n.statusText}`);return n.json()}function v4(l,n=!1){return n?`${Ka}/${l}/thumbnail?original=true`:`${Ka}/${l}/thumbnail`}function N4(l){return`${Ka}/${l}/thumbnail?original=true`}async function b4(l){const n=await _e(`${Ka}/batch/delete`,{method:"POST",body:JSON.stringify({emoji_ids:l})});if(!n.ok){const i=await n.json();throw new Error(i.detail||"批量删除失败")}return n.json()}function y4(){return`${Ka}/upload`}function w4(){const[l,n]=d.useState([]),[i,c]=d.useState(null),[u,x]=d.useState(!1),[h,f]=d.useState(1),[p,g]=d.useState(0),[N,v]=d.useState(20),[b,w]=d.useState("all"),[y,R]=d.useState("all"),[A,S]=d.useState("all"),[B,M]=d.useState("usage_count"),[C,D]=d.useState("desc"),[H,L]=d.useState(null),[J,U]=d.useState(!1),[oe,Ne]=d.useState(!1),[je,re]=d.useState(!1),[fe,ge]=d.useState(new Set),[E,K]=d.useState(!1),[I,ue]=d.useState(""),[Q,Se]=d.useState("medium"),[pe,Ce]=d.useState(!1),{toast:z}=Zs(),O=d.useCallback(async()=>{try{x(!0);const me=await m4({page:h,page_size:N,is_registered:b==="all"?void 0:b==="registered",is_banned:y==="all"?void 0:y==="banned",format:A==="all"?void 0:A,sort_by:B,sort_order:C});n(me.data),g(me.total)}catch(me){const Me=me instanceof Error?me.message:"加载表情包列表失败";z({title:"错误",description:Me,variant:"destructive"})}finally{x(!1)}},[h,N,b,y,A,B,C,z]),V=async()=>{try{const me=await p4();c(me.data)}catch(me){console.error("加载统计数据失败:",me)}};d.useEffect(()=>{O()},[O]),d.useEffect(()=>{V()},[]);const de=async me=>{try{const Me=await x4(me.id);L(Me.data),U(!0)}catch(Me){const rs=Me instanceof Error?Me.message:"加载详情失败";z({title:"错误",description:rs,variant:"destructive"})}},De=me=>{L(me),Ne(!0)},W=me=>{L(me),re(!0)},Y=async()=>{if(H)try{await f4(H.id),z({title:"成功",description:"表情包已删除"}),re(!1),L(null),O(),V()}catch(me){const Me=me instanceof Error?me.message:"删除失败";z({title:"错误",description:Me,variant:"destructive"})}},He=async me=>{try{await g4(me.id),z({title:"成功",description:"表情包已注册"}),O(),V()}catch(Me){const rs=Me instanceof Error?Me.message:"注册失败";z({title:"错误",description:rs,variant:"destructive"})}},F=async me=>{try{await j4(me.id),z({title:"成功",description:"表情包已封禁"}),O(),V()}catch(Me){const rs=Me instanceof Error?Me.message:"封禁失败";z({title:"错误",description:rs,variant:"destructive"})}},ee=me=>{const Me=new Set(fe);Me.has(me)?Me.delete(me):Me.add(me),ge(Me)},Ue=async()=>{try{const me=await b4(Array.from(fe));z({title:"批量删除完成",description:me.message}),ge(new Set),K(!1),O(),V()}catch(me){z({title:"批量删除失败",description:me instanceof Error?me.message:"批量删除失败",variant:"destructive"})}},ie=()=>{const me=parseInt(I),Me=Math.ceil(p/N);me>=1&&me<=Me?(f(me),ue("")):z({title:"无效的页码",description:`请输入1-${Me}之间的页码`,variant:"destructive"})},Ee=i?.formats?Object.keys(i.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:()=>Ce(!0),className:"gap-2",children:[e.jsx(sc,{className:"h-4 w-4"}),"上传表情包"]})]}),e.jsx(Je,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[i&&e.jsxs("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[e.jsx(Te,{children:e.jsxs(Oe,{className:"pb-2",children:[e.jsx(ws,{children:"总数"}),e.jsx(Le,{className:"text-2xl",children:i.total})]})}),e.jsx(Te,{children:e.jsxs(Oe,{className:"pb-2",children:[e.jsx(ws,{children:"已注册"}),e.jsx(Le,{className:"text-2xl text-green-600",children:i.registered})]})}),e.jsx(Te,{children:e.jsxs(Oe,{className:"pb-2",children:[e.jsx(ws,{children:"已封禁"}),e.jsx(Le,{className:"text-2xl text-red-600",children:i.banned})]})}),e.jsx(Te,{children:e.jsxs(Oe,{className:"pb-2",children:[e.jsx(ws,{children:"未注册"}),e.jsx(Le,{className:"text-2xl text-gray-600",children:i.unregistered})]})})]}),e.jsxs(Te,{children:[e.jsx(Oe,{children:e.jsxs(Le,{className:"flex items-center gap-2",children:[e.jsx(Do,{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(Ie,{value:`${B}-${C}`,onValueChange:me=>{const[Me,rs]=me.split("-");M(Me),D(rs),f(1)},children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"usage_count-desc",children:"使用次数 (多→少)"}),e.jsx(Z,{value:"usage_count-asc",children:"使用次数 (少→多)"}),e.jsx(Z,{value:"register_time-desc",children:"注册时间 (新→旧)"}),e.jsx(Z,{value:"register_time-asc",children:"注册时间 (旧→新)"}),e.jsx(Z,{value:"record_time-desc",children:"记录时间 (新→旧)"}),e.jsx(Z,{value:"record_time-asc",children:"记录时间 (旧→新)"}),e.jsx(Z,{value:"last_used_time-desc",children:"最后使用 (新→旧)"}),e.jsx(Z,{value:"last_used_time-asc",children:"最后使用 (旧→新)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"注册状态"}),e.jsxs(Ie,{value:b,onValueChange:me=>{w(me),f(1)},children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"all",children:"全部"}),e.jsx(Z,{value:"registered",children:"已注册"}),e.jsx(Z,{value:"unregistered",children:"未注册"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"封禁状态"}),e.jsxs(Ie,{value:y,onValueChange:me=>{R(me),f(1)},children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"all",children:"全部"}),e.jsx(Z,{value:"banned",children:"已封禁"}),e.jsx(Z,{value:"unbanned",children:"未封禁"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"格式"}),e.jsxs(Ie,{value:A,onValueChange:me=>{S(me),f(1)},children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"all",children:"全部"}),Ee.map(me=>e.jsxs(Z,{value:me,children:[me.toUpperCase()," (",i?.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:[fe.size>0&&e.jsxs("span",{className:"text-sm text-muted-foreground",children:["已选择 ",fe.size," 个表情包"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{className:"text-sm whitespace-nowrap",children:"卡片大小"}),e.jsxs(Ie,{value:Q,onValueChange:me=>Se(me),children:[e.jsx($e,{className:"w-24",children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"small",children:"小"}),e.jsx(Z,{value:"medium",children:"中"}),e.jsx(Z,{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(Ie,{value:N.toString(),onValueChange:me=>{v(parseInt(me)),f(1),ge(new Set)},children:[e.jsx($e,{id:"emoji-page-size",className:"w-20",children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"20",children:"20"}),e.jsx(Z,{value:"40",children:"40"}),e.jsx(Z,{value:"60",children:"60"}),e.jsx(Z,{value:"100",children:"100"})]})]}),fe.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:()=>K(!0),children:[e.jsx(ns,{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:O,disabled:u,children:[e.jsx(dt,{className:`h-4 w-4 mr-2 ${u?"animate-spin":""}`}),"刷新"]})})]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Le,{children:"表情包列表"}),e.jsxs(ws,{children:["共 ",p," 个表情包,当前第 ",h," 页"]})]}),e.jsxs(Ae,{children:[l.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:l.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 ${fe.has(me.id)?"ring-2 ring-primary bg-primary/5":""}`,onClick:()=>ee(me.id),children:[e.jsx("div",{className:`absolute top-1 left-1 z-10 transition-opacity ${fe.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 ${fe.has(me.id)?"bg-primary border-primary text-primary-foreground":"bg-background/80 border-muted-foreground/50"}`,children:fe.has(me.id)&&e.jsx(pt,{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(ke,{variant:"default",className:"bg-green-600 text-[10px] px-1 py-0",children:"已注册"}),me.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(d4,{src:v4(me.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: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 ${Q==="small"?"flex-wrap":""}`,children:[e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Me=>{Me.stopPropagation(),De(me)},title:"编辑",children:e.jsx(Kn,{className:"h-3 w-3"})}),e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Me=>{Me.stopPropagation(),de(me)},title:"详情",children:e.jsx(Ht,{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:Me=>{Me.stopPropagation(),He(me)},title:"注册",children:e.jsx(pt,{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:Me=>{Me.stopPropagation(),F(me)},title:"封禁",children:e.jsx(l1,{className:"h-3 w-3"})}),e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6 text-red-600 hover:text-red-700",onClick:Me=>{Me.stopPropagation(),W(me)},title:"删除",children:e.jsx(ns,{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)*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(gn,{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(Aa,{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(le,{type:"number",value:I,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/N)}),e.jsx(_,{variant:"outline",size:"sm",onClick:ie,disabled:!I,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(me=>me+1),disabled:h>=Math.ceil(p/N),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Zt,{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(jn,{className:"h-4 w-4"})})]})]})]})]}),e.jsx(_4,{emoji:H,open:J,onOpenChange:U}),e.jsx(S4,{emoji:H,open:oe,onOpenChange:Ne,onSuccess:()=>{O(),V()}}),e.jsx(k4,{open:pe,onOpenChange:Ce,onSuccess:()=>{O(),V()}})]})}),e.jsx(vs,{open:E,onOpenChange:K,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认批量删除"}),e.jsxs(hs,{children:["你确定要删除选中的 ",fe.size," 个表情包吗?此操作不可撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:Ue,children:"确认删除"})]})]})}),e.jsx(Is,{open:je,onOpenChange:re,children:e.jsxs(Ds,{children:[e.jsxs(Os,{children:[e.jsx(Rs,{children:"确认删除"}),e.jsx(Ks,{children:"确定要删除这个表情包吗?此操作无法撤销。"})]}),e.jsxs(st,{children:[e.jsx(_,{variant:"outline",onClick:()=>re(!1),children:"取消"}),e.jsx(_,{variant:"destructive",onClick:Y,children:"删除"})]})]})})]})}function _4({emoji:l,open:n,onOpenChange:i}){if(!l)return null;const c=u=>u?new Date(u*1e3).toLocaleString("zh-CN"):"-";return e.jsx(Is,{open:n,onOpenChange:i,children:e.jsxs(Ds,{className:"max-w-2xl max-h-[90vh]",children:[e.jsx(Os,{children:e.jsx(Rs,{children:"表情包详情"})}),e.jsx(Je,{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:N4(l.id),alt:l.description||"表情包",className:"w-full h-full object-cover",onError:u=>{const x=u.target;x.style.display="none";const h=x.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:l.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:l.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:l.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:l.emoji_hash})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"描述"}),l.description?e.jsx("div",{className:"mt-1 rounded-lg border bg-muted/50 p-3",children:e.jsx(u4,{className:"prose-sm",children:l.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:l.emotion?e.jsx("span",{className:"text-sm",children:l.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:[l.is_registered&&e.jsx(ke,{variant:"default",className:"bg-green-600",children:"已注册"}),l.is_banned&&e.jsx(ke,{variant:"destructive",children:"已封禁"}),!l.is_registered&&!l.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:l.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(l.record_time)})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"注册时间"}),e.jsx("div",{className:"mt-1 text-sm",children:c(l.register_time)})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"最后使用"}),e.jsx("div",{className:"mt-1 text-sm",children:c(l.last_used_time)})]})]})})]})})}function S4({emoji:l,open:n,onOpenChange:i,onSuccess:c}){const[u,x]=d.useState(""),[h,f]=d.useState(!1),[p,g]=d.useState(!1),[N,v]=d.useState(!1),{toast:b}=Zs();d.useEffect(()=>{l&&(x(l.emotion||""),f(l.is_registered),g(l.is_banned))},[l]);const w=async()=>{if(l)try{v(!0);const y=u.split(/[,,]/).map(R=>R.trim()).filter(Boolean).join(",");await h4(l.id,{emotion:y||void 0,is_registered:h,is_banned:p}),b({title:"成功",description:"表情包信息已更新"}),i(!1),c()}catch(y){const R=y instanceof Error?y.message:"保存失败";b({title:"错误",description:R,variant:"destructive"})}finally{v(!1)}};return l?e.jsx(Is,{open:n,onOpenChange:i,children:e.jsxs(Ds,{className:"max-w-2xl",children:[e.jsxs(Os,{children:[e.jsx(Rs,{children:"编辑表情包"}),e.jsx(Ks,{children:"修改表情包的情绪和状态信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(T,{children:"情绪"}),e.jsx(ot,{value:u,onChange:y=>x(y.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(qs,{id:"is_registered",checked:h,onCheckedChange:y=>{y===!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(qs,{id:"is_banned",checked:p,onCheckedChange:y=>{y===!0?(g(!0),f(!1)):g(!1)}}),e.jsx(T,{htmlFor:"is_banned",className:"cursor-pointer",children:"已封禁"})]})]})]}),e.jsxs(st,{children:[e.jsx(_,{variant:"outline",onClick:()=>i(!1),children:"取消"}),e.jsx(_,{onClick:w,disabled:N,children:N?"保存中...":"保存"})]})]})}):null}function k4({open:l,onOpenChange:n,onSuccess:i}){const[c,u]=d.useState("select"),[x,h]=d.useState([]),[f,p]=d.useState(null),[g,N]=d.useState(!1),{toast:v}=Zs(),b=d.useMemo(()=>new B1({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}"}}}),[]);d.useEffect(()=>{const H=()=>{const L=b.getFiles();if(L.length===0)return;const J=L.map(U=>({id:U.id,name:U.name,previewUrl:U.preview||URL.createObjectURL(U.data),emotion:"",description:"",isRegistered:!0,file:U.data}));h(J),L.length===1?(p(J[0].id),u("edit-single")):u("edit-multiple")};return b.on("upload",H),()=>{b.off("upload",H)}},[b]),d.useEffect(()=>{l||(b.cancelAll(),u("select"),h([]),p(null),N(!1))},[l,b]);const w=d.useCallback((H,L)=>{h(J=>J.map(U=>U.id===H?{...U,...L}:U))},[]),y=d.useCallback(H=>H.emotion.trim().length>0,[]),R=d.useMemo(()=>x.length>0&&x.every(y),[x,y]),A=d.useMemo(()=>x.find(H=>H.id===f)||null,[x,f]),S=d.useCallback(()=>{(c==="edit-single"||c==="edit-multiple")&&(u("select"),h([]),p(null))},[c]),B=d.useCallback(async()=>{if(!R){v({title:"请填写必填项",description:"每个表情包的情感标签都是必填的",variant:"destructive"});return}N(!0);let H=0,L=0;try{for(const J of x){const U=new FormData;U.append("file",J.file),U.append("emotion",J.emotion),U.append("description",J.description),U.append("is_registered",J.isRegistered.toString());try{(await _e(y4(),{method:"POST",body:U})).ok?H++:L++}catch{L++}}L===0?(v({title:"上传成功",description:`成功上传 ${H} 个表情包`}),n(!1),i()):(v({title:"部分上传失败",description:`成功 ${H} 个,失败 ${L} 个`,variant:"destructive"}),i())}finally{N(!1)}},[R,x,v,n,i]),M=()=>e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"border rounded-lg overflow-hidden w-full",children:e.jsx(o4,{uppy:b,proudlyDisplayPoweredByUppy:!1,hideProgressDetails:!0,height:350,width:"100%",theme:"auto",note:"支持 JPG、PNG、GIF、WebP 格式,最多 20 个文件"})})}),C=()=>{const H=x[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(Ta,{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(le,{id:"single-emotion",value:H.emotion,onChange:L=>w(H.id,{emotion:L.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(le,{id:"single-description",value:H.description,onChange:L=>w(H.id,{description:L.target.value}),placeholder:"输入表情包描述..."})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qs,{id:"single-is-registered",checked:H.isRegistered,onCheckedChange:L=>w(H.id,{isRegistered:L===!0})}),e.jsx(T,{htmlFor:"single-is-registered",className:"cursor-pointer",children:"上传后立即注册(可被麦麦使用)"})]})]})]}),e.jsx(st,{children:e.jsx(_,{onClick:B,disabled:!R||g,children:g?"上传中...":"上传"})})]}):null},D=()=>{const H=x.filter(y).length,L=x.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(Ta,{className:"h-4 w-4 mr-1"}),"返回"]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["编辑表情包信息(",H,"/",L," 已完成)"]})]}),e.jsx(ke,{variant:R?"default":"secondary",children:R?e.jsxs(e.Fragment,{children:[e.jsx(Ct,{className:"h-3 w-3 mr-1"}),"全部完成"]}):e.jsxs(e.Fragment,{children:[e.jsx(Ea,{className:"h-3 w-3 mr-1"}),"未完成"]})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Je,{className:"h-[350px] pr-2",children:e.jsx("div",{className:"space-y-2",children:x.map(J=>{const U=y(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":""} + ${U?"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||"未填写情感标签"})]}),U?e.jsx(pt,{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}),y(A)&&e.jsxs(ke,{variant:"outline",className:"text-green-600 border-green-600",children:[e.jsx(Ct,{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(le,{id:"multi-emotion",value:A.emotion,onChange:J=>w(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(le,{id:"multi-description",value:A.description,onChange:J=>w(A.id,{description:J.target.value}),placeholder:"输入表情包描述..."})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qs,{id:"multi-is-registered",checked:A.isRegistered,onCheckedChange:J=>w(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(Jm,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"点击左侧卡片编辑"})]})})})]}),e.jsx(st,{children:e.jsx(_,{onClick:B,disabled:!R||g,children:g?"上传中...":`上传全部 (${L})`})})]})};return e.jsx(Is,{open:l,onOpenChange:n,children:e.jsxs(Ds,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[e.jsxs(Os,{children:[e.jsxs(Rs,{className:"flex items-center gap-2",children:[e.jsx(sc,{className:"h-5 w-5"}),c==="select"&&"上传表情包 - 选择文件",c==="edit-single"&&"上传表情包 - 填写信息",c==="edit-multiple"&&"上传表情包 - 批量编辑"]}),e.jsxs(Ks,{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"&&M(),c==="edit-single"&&C(),c==="edit-multiple"&&D()]})]})})}function C4(){const[l,n]=d.useState([]),[i,c]=d.useState(!0),[u,x]=d.useState(0),[h,f]=d.useState(1),[p,g]=d.useState(20),[N,v]=d.useState(""),[b,w]=d.useState(null),[y,R]=d.useState(!1),[A,S]=d.useState(!1),[B,M]=d.useState(!1),[C,D]=d.useState(null),[H,L]=d.useState(new Set),[J,U]=d.useState(!1),[oe,Ne]=d.useState(""),[je,re]=d.useState({total:0,recent_7days:0,chat_count:0,top_chats:{}}),[fe,ge]=d.useState([]),[E,K]=d.useState(new Map),[I,ue]=d.useState(!1),[Q,Se]=d.useState(0),{toast:pe}=Zs(),Ce=async()=>{try{c(!0);const ie=await y_({page:h,page_size:p,search:N||void 0});n(ie.data),x(ie.total)}catch(ie){pe({title:"加载失败",description:ie instanceof Error?ie.message:"无法加载表达方式",variant:"destructive"})}finally{c(!1)}},z=async()=>{try{const ie=await T_();ie?.data&&re(ie.data)}catch(ie){console.error("加载统计数据失败:",ie)}},O=async()=>{try{const ie=await sx();Se(ie.unchecked)}catch(ie){console.error("加载审核统计失败:",ie)}},V=async()=>{try{const ie=await ex();if(ie?.data){ge(ie.data);const Ee=new Map;ie.data.forEach(me=>{Ee.set(me.chat_id,me.chat_name)}),K(Ee)}}catch(ie){console.error("加载聊天列表失败:",ie)}},de=ie=>E.get(ie)||ie;d.useEffect(()=>{Ce(),O(),z(),V()},[h,p,N]);const De=async ie=>{try{const Ee=await w_(ie.id);w(Ee.data),R(!0)}catch(Ee){pe({title:"加载详情失败",description:Ee instanceof Error?Ee.message:"无法加载表达方式详情",variant:"destructive"})}},W=ie=>{w(ie),S(!0)},Y=async ie=>{try{await k_(ie.id),pe({title:"删除成功",description:`已删除表达方式: ${ie.situation}`}),D(null),Ce(),z()}catch(Ee){pe({title:"删除失败",description:Ee instanceof Error?Ee.message:"无法删除表达方式",variant:"destructive"})}},He=ie=>{const Ee=new Set(H);Ee.has(ie)?Ee.delete(ie):Ee.add(ie),L(Ee)},F=()=>{H.size===l.length&&l.length>0?L(new Set):L(new Set(l.map(ie=>ie.id)))},ee=async()=>{try{await C_(Array.from(H)),pe({title:"批量删除成功",description:`已删除 ${H.size} 个表达方式`}),L(new Set),U(!1),Ce(),z()}catch(ie){pe({title:"批量删除失败",description:ie instanceof Error?ie.message:"无法批量删除表达方式",variant:"destructive"})}},Ue=()=>{const ie=parseInt(oe),Ee=Math.ceil(u/p);ie>=1&&ie<=Ee?(f(ie),Ne("")):pe({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(za,{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(Oj,{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:()=>M(!0),className:"gap-2",children:[e.jsx(et,{className:"h-4 w-4"}),"新增表达方式"]})]})]})}),e.jsx(Je,{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(Tt,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(le,{id:"search",placeholder:"搜索情境、风格或上下文...",value:N,onChange:ie=>v(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: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(Ie,{value:p.toString(),onValueChange:ie=>{g(parseInt(ie)),f(1),L(new Set)},children:[e.jsx($e,{id:"page-size",className:"w-20",children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"10",children:"10"}),e.jsx(Z,{value:"20",children:"20"}),e.jsx(Z,{value:"50",children:"50"}),e.jsx(Z,{value:"100",children:"100"})]})]}),H.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>L(new Set),children:"取消选择"}),e.jsxs(_,{variant:"destructive",size:"sm",onClick:()=>U(!0),children:[e.jsx(ns,{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(Rl,{children:[e.jsx(Ll,{children:e.jsxs(ut,{children:[e.jsx(We,{className:"w-12",children:e.jsx(qs,{checked:H.size===l.length&&l.length>0,onCheckedChange:F})}),e.jsx(We,{children:"情境"}),e.jsx(We,{children:"风格"}),e.jsx(We,{children:"聊天"}),e.jsx(We,{className:"text-right",children:"操作"})]})}),e.jsx(Ul,{children:i?e.jsx(ut,{children:e.jsx(Ke,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):l.length===0?e.jsx(ut,{children:e.jsx(Ke,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):l.map(ie=>e.jsxs(ut,{children:[e.jsx(Ke,{children:e.jsx(qs,{checked:H.has(ie.id),onCheckedChange:()=>He(ie.id)})}),e.jsx(Ke,{className:"font-medium max-w-xs truncate",children:ie.situation}),e.jsx(Ke,{className:"max-w-xs truncate",children:ie.style}),e.jsx(Ke,{className:"max-w-[200px] truncate",title:de(ie.chat_id),style:{wordBreak:"keep-all"},children:e.jsx("span",{className:"whitespace-nowrap overflow-hidden text-ellipsis block",children:de(ie.chat_id)})}),e.jsx(Ke,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>W(ie),children:[e.jsx(Kn,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(_,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>De(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(ns,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},ie.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3 p-4",children:i?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):l.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):l.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(qs,{checked:H.has(ie.id),onCheckedChange:()=>He(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:de(ie.chat_id),style:{wordBreak:"keep-all"},children:de(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:()=>W(ie),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(Kn,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>De(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(ns,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},ie.id))}),u>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:["共 ",u," 条记录,第 ",h," / ",Math.ceil(u/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(gn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h-1),disabled:h===1,children:[e.jsx(Aa,{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(le,{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(u/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(u/p),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Zt,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(u/p)),disabled:h>=Math.ceil(u/p),className:"hidden sm:flex",children:e.jsx(jn,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(T4,{expression:b,open:y,onOpenChange:R,chatNameMap:E}),e.jsx(E4,{open:B,onOpenChange:M,chatList:fe,onSuccess:()=>{Ce(),z(),M(!1)}}),e.jsx(M4,{expression:b,open:A,onOpenChange:S,chatList:fe,onSuccess:()=>{Ce(),z(),S(!1)}}),e.jsx(vs,{open:!!C,onOpenChange:()=>D(null),children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:['确定要删除表达方式 "',C?.situation,'" 吗? 此操作不可撤销。']})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>C&&Y(C),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(z4,{open:J,onOpenChange:U,onConfirm:ee,count:H.size}),e.jsx(fv,{open:I,onOpenChange:ie=>{ue(ie),ie||(Ce(),z(),O())}})]})}function T4({expression:l,open:n,onOpenChange:i,chatNameMap:c}){if(!l)return null;const u=h=>h?new Date(h*1e3).toLocaleString("zh-CN"):"-",x=h=>c.get(h)||h;return e.jsx(Is,{open:n,onOpenChange:i,children:e.jsxs(Ds,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Os,{children:[e.jsx(Rs,{children:"表达方式详情"}),e.jsx(Ks,{children:"查看表达方式的完整信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Hi,{label:"情境",value:l.situation}),e.jsx(Hi,{label:"风格",value:l.style}),e.jsx(Hi,{label:"聊天",value:x(l.chat_id)}),e.jsx(Hi,{icon:Vr,label:"记录ID",value:l.id.toString(),mono:!0})]}),e.jsx("div",{className:"grid grid-cols-2 gap-4",children:e.jsx(Hi,{icon:na,label:"创建时间",value:u(l.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:P("flex h-8 w-8 items-center justify-center rounded-full",l.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:l.checked?e.jsx(pt,{className:"h-5 w-5"}):e.jsx(Uo,{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:l.checked?"已通过审核":"未审核"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:P("flex h-8 w-8 items-center justify-center rounded-full",l.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:l.rejected?e.jsx(Va,{className:"h-5 w-5"}):e.jsx(Uo,{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:l.rejected?"不会被使用":"正常"})]})]})]})]})]}),e.jsx(st,{children:e.jsx(_,{onClick:()=>i(!1),children:"关闭"})})]})})}function Hi({icon:l,label:n,value:i,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:[l&&e.jsx(l,{className:"h-3 w-3"}),n]}),e.jsx("div",{className:P("text-sm",c&&"font-mono",!i&&"text-muted-foreground"),children:i||"-"})]})}function E4({open:l,onOpenChange:n,chatList:i,onSuccess:c}){const[u,x]=d.useState({situation:"",style:"",chat_id:""}),[h,f]=d.useState(!1),{toast:p}=Zs(),g=async()=>{if(!u.situation||!u.style||!u.chat_id){p({title:"验证失败",description:"请填写必填字段:情境、风格和聊天",variant:"destructive"});return}try{f(!0),await __(u),p({title:"创建成功",description:"表达方式已创建"}),x({situation:"",style:"",chat_id:""}),c()}catch(N){p({title:"创建失败",description:N instanceof Error?N.message:"无法创建表达方式",variant:"destructive"})}finally{f(!1)}};return e.jsx(Is,{open:l,onOpenChange:n,children:e.jsxs(Ds,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Os,{children:[e.jsx(Rs,{children:"新增表达方式"}),e.jsx(Ks,{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(le,{id:"situation",value:u.situation,onChange:N=>x({...u,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(le,{id:"style",value:u.style,onChange:N=>x({...u,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(Ie,{value:u.chat_id,onValueChange:N=>x({...u,chat_id:N}),children:[e.jsx($e,{children:e.jsx(Pe,{placeholder:"选择关联的聊天"})}),e.jsx(Be,{children:i.map(N=>e.jsx(Z,{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(st,{children:[e.jsx(_,{variant:"outline",onClick:()=>n(!1),children:"取消"}),e.jsx(_,{onClick:g,disabled:h,children:h?"创建中...":"创建"})]})]})})}function M4({expression:l,open:n,onOpenChange:i,chatList:c,onSuccess:u}){const[x,h]=d.useState({}),[f,p]=d.useState(!1),{toast:g}=Zs();d.useEffect(()=>{l&&h({situation:l.situation,style:l.style,chat_id:l.chat_id,checked:l.checked,rejected:l.rejected})},[l]);const N=async()=>{if(l)try{p(!0),await S_(l.id,x),g({title:"保存成功",description:"表达方式已更新"}),u()}catch(v){g({title:"保存失败",description:v instanceof Error?v.message:"无法更新表达方式",variant:"destructive"})}finally{p(!1)}};return l?e.jsx(Is,{open:n,onOpenChange:i,children:e.jsxs(Ds,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Os,{children:[e.jsx(Rs,{children:"编辑表达方式"}),e.jsx(Ks,{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(le,{id:"edit_situation",value:x.situation||"",onChange:v=>h({...x,situation:v.target.value}),placeholder:"描述使用场景"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_style",children:"风格"}),e.jsx(le,{id:"edit_style",value:x.style||"",onChange:v=>h({...x,style:v.target.value}),placeholder:"描述表达风格"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_chat_id",children:"聊天"}),e.jsxs(Ie,{value:x.chat_id||"",onValueChange:v=>h({...x,chat_id:v}),children:[e.jsx($e,{children:e.jsx(Pe,{placeholder:"选择关联的聊天"})}),e.jsx(Be,{children:c.map(v=>e.jsx(Z,{value:v.chat_id,children:e.jsxs("span",{className:"truncate",style:{wordBreak:"keep-all"},children:[v.chat_name,v.is_group&&e.jsx("span",{className:"text-muted-foreground ml-1",children:"(群聊)"})]})},v.chat_id))})]})]}),e.jsxs(at,{children:[e.jsx(Ht,{className:"h-4 w-4"}),e.jsx(lt,{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:x.checked??!1,onCheckedChange:v=>h({...x,checked:v})})]}),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:x.rejected??!1,onCheckedChange:v=>h({...x,rejected:v})})]})]})]}),e.jsxs(st,{children:[e.jsx(_,{variant:"outline",onClick:()=>i(!1),children:"取消"}),e.jsx(_,{onClick:N,disabled:f,children:f?"保存中...":"保存"})]})]})}):null}function z4({open:l,onOpenChange:n,onConfirm:i,count:c}){return e.jsx(vs,{open:l,onOpenChange:n,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认批量删除"}),e.jsxs(hs,{children:["您即将删除 ",c," 个表达方式,此操作无法撤销。确定要继续吗?"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:i,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})}const $l="/api/webui/jargon";async function A4(){const l=await _e(`${$l}/chats`,{});if(!l.ok){const n=await l.json();throw new Error(n.detail||"获取聊天列表失败")}return l.json()}async function D4(l){const n=new URLSearchParams;l.page&&n.append("page",l.page.toString()),l.page_size&&n.append("page_size",l.page_size.toString()),l.search&&n.append("search",l.search),l.chat_id&&n.append("chat_id",l.chat_id),l.is_jargon!==void 0&&l.is_jargon!==null&&n.append("is_jargon",l.is_jargon.toString()),l.is_global!==void 0&&n.append("is_global",l.is_global.toString());const i=await _e(`${$l}/list?${n}`,{});if(!i.ok){const c=await i.json();throw new Error(c.detail||"获取黑话列表失败")}return i.json()}async function O4(l){const n=await _e(`${$l}/${l}`,{});if(!n.ok){const i=await n.json();throw new Error(i.detail||"获取黑话详情失败")}return n.json()}async function R4(l){const n=await _e(`${$l}/`,{method:"POST",body:JSON.stringify(l)});if(!n.ok){const i=await n.json();throw new Error(i.detail||"创建黑话失败")}return n.json()}async function L4(l,n){const i=await _e(`${$l}/${l}`,{method:"PATCH",body:JSON.stringify(n)});if(!i.ok){const c=await i.json();throw new Error(c.detail||"更新黑话失败")}return i.json()}async function U4(l){const n=await _e(`${$l}/${l}`,{method:"DELETE"});if(!n.ok){const i=await n.json();throw new Error(i.detail||"删除黑话失败")}return n.json()}async function $4(l){const n=await _e(`${$l}/batch/delete`,{method:"POST",body:JSON.stringify({ids:l})});if(!n.ok){const i=await n.json();throw new Error(i.detail||"批量删除黑话失败")}return n.json()}async function B4(){const l=await _e(`${$l}/stats/summary`,{});if(!l.ok){const n=await l.json();throw new Error(n.detail||"获取黑话统计失败")}return l.json()}async function I4(l,n){const i=new URLSearchParams;l.forEach(u=>i.append("ids",u.toString())),i.append("is_jargon",n.toString());const c=await _e(`${$l}/batch/set-jargon?${i}`,{method:"POST"});if(!c.ok){const u=await c.json();throw new Error(u.detail||"批量设置黑话状态失败")}return c.json()}function P4(){const[l,n]=d.useState([]),[i,c]=d.useState(!0),[u,x]=d.useState(0),[h,f]=d.useState(1),[p,g]=d.useState(20),[N,v]=d.useState(""),[b,w]=d.useState("all"),[y,R]=d.useState("all"),[A,S]=d.useState(null),[B,M]=d.useState(!1),[C,D]=d.useState(!1),[H,L]=d.useState(!1),[J,U]=d.useState(null),[oe,Ne]=d.useState(new Set),[je,re]=d.useState(!1),[fe,ge]=d.useState(""),[E,K]=d.useState({total:0,confirmed_jargon:0,confirmed_not_jargon:0,pending:0,global_count:0,complete_count:0,chat_count:0,top_chats:{}}),[I,ue]=d.useState([]),{toast:Q}=Zs(),Se=async()=>{try{c(!0);const ee=await D4({page:h,page_size:p,search:N||void 0,chat_id:b==="all"?void 0:b,is_jargon:y==="all"?void 0:y==="true"?!0:y==="false"?!1:void 0});n(ee.data),x(ee.total)}catch(ee){Q({title:"加载失败",description:ee instanceof Error?ee.message:"无法加载黑话列表",variant:"destructive"})}finally{c(!1)}},pe=async()=>{try{const ee=await B4();ee?.data&&K(ee.data)}catch(ee){console.error("加载统计数据失败:",ee)}},Ce=async()=>{try{const ee=await A4();ee?.data&&ue(ee.data)}catch(ee){console.error("加载聊天列表失败:",ee)}};d.useEffect(()=>{Se(),pe(),Ce()},[h,p,N,b,y]);const z=async ee=>{try{const Ue=await O4(ee.id);S(Ue.data),M(!0)}catch(Ue){Q({title:"加载详情失败",description:Ue instanceof Error?Ue.message:"无法加载黑话详情",variant:"destructive"})}},O=ee=>{S(ee),D(!0)},V=async ee=>{try{await U4(ee.id),Q({title:"删除成功",description:`已删除黑话: ${ee.content}`}),U(null),Se(),pe()}catch(Ue){Q({title:"删除失败",description:Ue instanceof Error?Ue.message:"无法删除黑话",variant:"destructive"})}},de=ee=>{const Ue=new Set(oe);Ue.has(ee)?Ue.delete(ee):Ue.add(ee),Ne(Ue)},De=()=>{oe.size===l.length&&l.length>0?Ne(new Set):Ne(new Set(l.map(ee=>ee.id)))},W=async()=>{try{await $4(Array.from(oe)),Q({title:"批量删除成功",description:`已删除 ${oe.size} 个黑话`}),Ne(new Set),re(!1),Se(),pe()}catch(ee){Q({title:"批量删除失败",description:ee instanceof Error?ee.message:"无法批量删除黑话",variant:"destructive"})}},Y=async ee=>{try{await I4(Array.from(oe),ee),Q({title:"操作成功",description:`已将 ${oe.size} 个词条设为${ee?"黑话":"非黑话"}`}),Ne(new Set),Se(),pe()}catch(Ue){Q({title:"操作失败",description:Ue instanceof Error?Ue.message:"批量设置失败",variant:"destructive"})}},He=()=>{const ee=parseInt(fe),Ue=Math.ceil(u/p);ee>=1&&ee<=Ue?(f(ee),ge("")):Q({title:"无效的页码",description:`请输入1-${Ue}之间的页码`,variant:"destructive"})},F=ee=>ee===!0?e.jsxs(ke,{variant:"default",className:"bg-green-600 hover:bg-green-700",children:[e.jsx(Ct,{className:"h-3 w-3 mr-1"}),"是黑话"]}):ee===!1?e.jsxs(ke,{variant:"secondary",children:[e.jsx(Ea,{className:"h-3 w-3 mr-1"}),"非黑话"]}):e.jsxs(ke,{variant:"outline",children:[e.jsx(Lj,{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(n1,{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:()=>L(!0),className:"gap-2",children:[e.jsx(et,{className:"h-4 w-4"}),"新增黑话"]})]})}),e.jsx(Je,{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:E.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:E.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:E.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:E.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:E.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:E.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:E.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(Tt,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(le,{id:"search",placeholder:"搜索内容、含义...",value:N,onChange:ee=>v(ee.target.value),className:"pl-9"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(T,{children:"聊天筛选"}),e.jsxs(Ie,{value:b,onValueChange:w,children:[e.jsx($e,{children:e.jsx(Pe,{placeholder:"全部聊天"})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"all",children:"全部聊天"}),I.map(ee=>e.jsx(Z,{value:ee.chat_id,children:ee.chat_name},ee.chat_id))]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(T,{children:"状态筛选"}),e.jsxs(Ie,{value:y,onValueChange:R,children:[e.jsx($e,{children:e.jsx(Pe,{placeholder:"全部状态"})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"all",children:"全部状态"}),e.jsx(Z,{value:"true",children:"是黑话"}),e.jsx(Z,{value:"false",children:"非黑话"})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(T,{htmlFor:"page-size",children:"每页显示"}),e.jsxs(Ie,{value:p.toString(),onValueChange:ee=>{g(parseInt(ee)),f(1),Ne(new Set)},children:[e.jsx($e,{id:"page-size",children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"10",children:"10"}),e.jsx(Z,{value:"20",children:"20"}),e.jsx(Z,{value:"50",children:"50"}),e.jsx(Z,{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(Ct,{className:"h-4 w-4 mr-1"}),"标记为黑话"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>Y(!1),children:[e.jsx(Ea,{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:()=>re(!0),children:[e.jsx(ns,{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(Rl,{children:[e.jsx(Ll,{children:e.jsxs(ut,{children:[e.jsx(We,{className:"w-12",children:e.jsx(qs,{checked:oe.size===l.length&&l.length>0,onCheckedChange:De})}),e.jsx(We,{children:"内容"}),e.jsx(We,{children:"含义"}),e.jsx(We,{children:"聊天"}),e.jsx(We,{children:"状态"}),e.jsx(We,{className:"text-center",children:"次数"}),e.jsx(We,{className:"text-right",children:"操作"})]})}),e.jsx(Ul,{children:i?e.jsx(ut,{children:e.jsx(Ke,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):l.length===0?e.jsx(ut,{children:e.jsx(Ke,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):l.map(ee=>e.jsxs(ut,{children:[e.jsx(Ke,{children:e.jsx(qs,{checked:oe.has(ee.id),onCheckedChange:()=>de(ee.id)})}),e.jsx(Ke,{className:"font-medium max-w-[200px]",children:e.jsxs("div",{className:"flex items-center gap-2",children:[ee.is_global&&e.jsx("span",{title:"全局黑话",children:e.jsx($o,{className:"h-4 w-4 text-blue-500 flex-shrink-0"})}),e.jsx("span",{className:"truncate",title:ee.content,children:ee.content})]})}),e.jsx(Ke,{className:"max-w-[200px] truncate",title:ee.meaning||"",children:ee.meaning||e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx(Ke,{className:"max-w-[150px] truncate",title:ee.chat_name||ee.chat_id,children:ee.chat_name||ee.chat_id}),e.jsx(Ke,{children:F(ee.is_jargon)}),e.jsx(Ke,{className:"text-center",children:ee.count}),e.jsx(Ke,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>O(ee),children:[e.jsx(Kn,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(_,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>z(ee),title:"查看详情",children:e.jsx(ia,{className:"h-4 w-4"})}),e.jsxs(_,{size:"sm",onClick:()=>U(ee),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(ns,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},ee.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3 p-4",children:i?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):l.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):l.map(ee=>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(qs,{checked:oe.has(ee.id),onCheckedChange:()=>de(ee.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:[ee.is_global&&e.jsx($o,{className:"h-4 w-4 text-blue-500 flex-shrink-0"}),e.jsx("h3",{className:"font-semibold text-sm break-all",children:ee.content})]}),ee.meaning&&e.jsx("p",{className:"text-sm text-muted-foreground break-all",children:ee.meaning}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[F(ee.is_jargon),e.jsxs("span",{className:"text-muted-foreground",children:["次数: ",ee.count]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground truncate",children:["聊天: ",ee.chat_name||ee.chat_id]})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>O(ee),className:"text-xs px-2 py-1 h-auto",children:[e.jsx(Kn,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>z(ee),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:()=>U(ee),className:"text-xs px-2 py-1 h-auto text-destructive hover:text-destructive",children:[e.jsx(ns,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},ee.id))}),u>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:["共 ",u," 条记录,第 ",h," / ",Math.ceil(u/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(gn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h-1),disabled:h===1,children:[e.jsx(Aa,{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(le,{type:"number",value:fe,onChange:ee=>ge(ee.target.value),onKeyDown:ee=>ee.key==="Enter"&&He(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(u/p)}),e.jsx(_,{variant:"outline",size:"sm",onClick:He,disabled:!fe,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h+1),disabled:h>=Math.ceil(u/p),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Zt,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(u/p)),disabled:h>=Math.ceil(u/p),className:"hidden sm:flex",children:e.jsx(jn,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(H4,{jargon:A,open:B,onOpenChange:M}),e.jsx(F4,{open:H,onOpenChange:L,chatList:I,onSuccess:()=>{Se(),pe(),L(!1)}}),e.jsx(G4,{jargon:A,open:C,onOpenChange:D,chatList:I,onSuccess:()=>{Se(),pe(),D(!1)}}),e.jsx(vs,{open:!!J,onOpenChange:()=>U(null),children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:['确定要删除黑话 "',J?.content,'" 吗?此操作不可撤销。']})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>J&&V(J),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(vs,{open:je,onOpenChange:re,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认批量删除"}),e.jsxs(hs,{children:["您即将删除 ",oe.size," 个黑话,此操作无法撤销。确定要继续吗?"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:W,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})]})}function H4({jargon:l,open:n,onOpenChange:i}){return l?e.jsx(Is,{open:n,onOpenChange:i,children:e.jsxs(Ds,{className:"max-w-2xl max-h-[80vh] grid grid-rows-[auto_1fr_auto] overflow-hidden",children:[e.jsxs(Os,{children:[e.jsx(Rs,{children:"黑话详情"}),e.jsx(Ks,{children:"查看黑话的完整信息"})]}),e.jsx(Je,{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(Om,{icon:Vr,label:"记录ID",value:l.id.toString(),mono:!0}),e.jsx(Om,{label:"使用次数",value:l.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:l.content})]}),l.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(l.raw_content);return Array.isArray(c)?c.map((u,x)=>e.jsxs("div",{children:[x>0&&e.jsx("hr",{className:"my-3 border-border"}),e.jsx("div",{className:"whitespace-pre-wrap",children:u})]},x)):e.jsx("div",{className:"whitespace-pre-wrap",children:l.raw_content})}catch{return e.jsx("div",{className:"whitespace-pre-wrap",children:l.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:l.meaning?e.jsx(lx,{content:l.meaning}):"-"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Om,{label:"聊天",value:l.chat_name||l.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:[l.is_jargon===!0&&e.jsx(ke,{variant:"default",className:"bg-green-600",children:"是黑话"}),l.is_jargon===!1&&e.jsx(ke,{variant:"secondary",children:"非黑话"}),l.is_jargon===null&&e.jsx(ke,{variant:"outline",children:"未判定"}),l.is_global&&e.jsx(ke,{variant:"outline",className:"border-blue-500 text-blue-500",children:"全局"}),l.is_complete&&e.jsx(ke,{variant:"outline",className:"border-purple-500 text-purple-500",children:"推断完成"})]})]})]}),l.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:l.inference_with_context})]}),l.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:l.inference_content_only})]})]})}),e.jsx(st,{className:"flex-shrink-0",children:e.jsx(_,{onClick:()=>i(!1),children:"关闭"})})]})}):null}function Om({icon:l,label:n,value:i,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:[l&&e.jsx(l,{className:"h-3 w-3"}),n]}),e.jsx("div",{className:P("text-sm",c&&"font-mono",!i&&"text-muted-foreground"),children:i||"-"})]})}function F4({open:l,onOpenChange:n,chatList:i,onSuccess:c}){const[u,x]=d.useState({content:"",meaning:"",chat_id:"",is_global:!1}),[h,f]=d.useState(!1),{toast:p}=Zs(),g=async()=>{if(!u.content||!u.chat_id){p({title:"验证失败",description:"请填写必填字段:内容和聊天",variant:"destructive"});return}try{f(!0),await R4(u),p({title:"创建成功",description:"黑话已创建"}),x({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(Is,{open:l,onOpenChange:n,children:e.jsxs(Ds,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Os,{children:[e.jsx(Rs,{children:"新增黑话"}),e.jsx(Ks,{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(le,{id:"content",value:u.content,onChange:N=>x({...u,content:N.target.value}),placeholder:"输入黑话内容"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"meaning",children:"含义"}),e.jsx(ot,{id:"meaning",value:u.meaning||"",onChange:N=>x({...u,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(Ie,{value:u.chat_id,onValueChange:N=>x({...u,chat_id:N}),children:[e.jsx($e,{children:e.jsx(Pe,{placeholder:"选择关联的聊天"})}),e.jsx(Be,{children:i.map(N=>e.jsx(Z,{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:u.is_global,onCheckedChange:N=>x({...u,is_global:N})}),e.jsx(T,{htmlFor:"is_global",children:"设为全局黑话"})]})]}),e.jsxs(st,{children:[e.jsx(_,{variant:"outline",onClick:()=>n(!1),children:"取消"}),e.jsx(_,{onClick:g,disabled:h,children:h?"创建中...":"创建"})]})]})})}function G4({jargon:l,open:n,onOpenChange:i,chatList:c,onSuccess:u}){const[x,h]=d.useState({}),[f,p]=d.useState(!1),{toast:g}=Zs();d.useEffect(()=>{l&&h({content:l.content,meaning:l.meaning||"",chat_id:l.stream_id||l.chat_id,is_global:l.is_global,is_jargon:l.is_jargon})},[l]);const N=async()=>{if(l)try{p(!0),await L4(l.id,x),g({title:"保存成功",description:"黑话已更新"}),u()}catch(v){g({title:"保存失败",description:v instanceof Error?v.message:"无法更新黑话",variant:"destructive"})}finally{p(!1)}};return l?e.jsx(Is,{open:n,onOpenChange:i,children:e.jsxs(Ds,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Os,{children:[e.jsx(Rs,{children:"编辑黑话"}),e.jsx(Ks,{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(le,{id:"edit_content",value:x.content||"",onChange:v=>h({...x,content:v.target.value}),placeholder:"输入黑话内容"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_meaning",children:"含义"}),e.jsx(ot,{id:"edit_meaning",value:x.meaning||"",onChange:v=>h({...x,meaning:v.target.value}),placeholder:"输入黑话含义",rows:3})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_chat_id",children:"聊天"}),e.jsxs(Ie,{value:x.chat_id||"",onValueChange:v=>h({...x,chat_id:v}),children:[e.jsx($e,{children:e.jsx(Pe,{placeholder:"选择关联的聊天"})}),e.jsx(Be,{children:c.map(v=>e.jsx(Z,{value:v.chat_id,children:v.chat_name},v.chat_id))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"黑话状态"}),e.jsxs(Ie,{value:x.is_jargon===null?"null":x.is_jargon?.toString()||"null",onValueChange:v=>h({...x,is_jargon:v==="null"?null:v==="true"}),children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"null",children:"未判定"}),e.jsx(Z,{value:"true",children:"是黑话"}),e.jsx(Z,{value:"false",children:"非黑话"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"edit_is_global",checked:x.is_global,onCheckedChange:v=>h({...x,is_global:v})}),e.jsx(T,{htmlFor:"edit_is_global",children:"全局黑话"})]})]}),e.jsxs(st,{children:[e.jsx(_,{variant:"outline",onClick:()=>i(!1),children:"取消"}),e.jsx(_,{onClick:N,disabled:f,children:f?"保存中...":"保存"})]})]})}):null}const Jr="/api/webui/person";async function V4(l){const n=new URLSearchParams;l.page&&n.append("page",l.page.toString()),l.page_size&&n.append("page_size",l.page_size.toString()),l.search&&n.append("search",l.search),l.is_known!==void 0&&n.append("is_known",l.is_known.toString()),l.platform&&n.append("platform",l.platform);const i=await _e(`${Jr}/list?${n}`,{headers:Fs()});if(!i.ok){const c=await i.json();throw new Error(c.detail||"获取人物列表失败")}return i.json()}async function q4(l){const n=await _e(`${Jr}/${l}`,{headers:Fs()});if(!n.ok){const i=await n.json();throw new Error(i.detail||"获取人物详情失败")}return n.json()}async function K4(l,n){const i=await _e(`${Jr}/${l}`,{method:"PATCH",headers:Fs(),body:JSON.stringify(n)});if(!i.ok){const c=await i.json();throw new Error(c.detail||"更新人物信息失败")}return i.json()}async function Q4(l){const n=await _e(`${Jr}/${l}`,{method:"DELETE",headers:Fs()});if(!n.ok){const i=await n.json();throw new Error(i.detail||"删除人物信息失败")}return n.json()}async function Y4(){const l=await _e(`${Jr}/stats/summary`,{headers:Fs()});if(!l.ok){const n=await l.json();throw new Error(n.detail||"获取统计数据失败")}return l.json()}async function J4(l){const n=await _e(`${Jr}/batch/delete`,{method:"POST",headers:Fs(),body:JSON.stringify({person_ids:l})});if(!n.ok){const i=await n.json();throw new Error(i.detail||"批量删除失败")}return n.json()}function X4(){const[l,n]=d.useState([]),[i,c]=d.useState(!0),[u,x]=d.useState(0),[h,f]=d.useState(1),[p,g]=d.useState(20),[N,v]=d.useState(""),[b,w]=d.useState(void 0),[y,R]=d.useState(void 0),[A,S]=d.useState(null),[B,M]=d.useState(!1),[C,D]=d.useState(!1),[H,L]=d.useState(null),[J,U]=d.useState({total:0,known:0,unknown:0,platforms:{}}),[oe,Ne]=d.useState(new Set),[je,re]=d.useState(!1),[fe,ge]=d.useState(""),{toast:E}=Zs(),K=async()=>{try{c(!0);const W=await V4({page:h,page_size:p,search:N||void 0,is_known:b,platform:y});n(W.data),x(W.total)}catch(W){E({title:"加载失败",description:W instanceof Error?W.message:"无法加载人物信息",variant:"destructive"})}finally{c(!1)}},I=async()=>{try{const W=await Y4();W?.data&&U(W.data)}catch(W){console.error("加载统计数据失败:",W)}};d.useEffect(()=>{K(),I()},[h,p,N,b,y]);const ue=async W=>{try{const Y=await q4(W.person_id);S(Y.data),M(!0)}catch(Y){E({title:"加载详情失败",description:Y instanceof Error?Y.message:"无法加载人物详情",variant:"destructive"})}},Q=W=>{S(W),D(!0)},Se=async W=>{try{await Q4(W.person_id),E({title:"删除成功",description:`已删除人物信息: ${W.person_name||W.nickname||W.user_id}`}),L(null),K(),I()}catch(Y){E({title:"删除失败",description:Y instanceof Error?Y.message:"无法删除人物信息",variant:"destructive"})}},pe=d.useMemo(()=>Object.keys(J.platforms),[J.platforms]),Ce=W=>{const Y=new Set(oe);Y.has(W)?Y.delete(W):Y.add(W),Ne(Y)},z=()=>{oe.size===l.length&&l.length>0?Ne(new Set):Ne(new Set(l.map(W=>W.person_id)))},O=()=>{if(oe.size===0){E({title:"未选择任何人物",description:"请先选择要删除的人物",variant:"destructive"});return}re(!0)},V=async()=>{try{const W=await J4(Array.from(oe));E({title:"批量删除完成",description:W.message}),Ne(new Set),re(!1),K(),I()}catch(W){E({title:"批量删除失败",description:W instanceof Error?W.message:"批量删除失败",variant:"destructive"})}},de=()=>{const W=parseInt(fe),Y=Math.ceil(u/p);W>=1&&W<=Y?(f(W),ge("")):E({title:"无效的页码",description:`请输入1-${Y}之间的页码`,variant:"destructive"})},De=W=>W?new Date(W*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(tc,{className:"h-8 w-8",strokeWidth:2}),"人物信息管理"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦认识的所有人物信息"})]})})}),e.jsx(Je,{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(Tt,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(le,{id:"search",placeholder:"搜索名称、昵称或用户ID...",value:N,onChange:W=>v(W.target.value),className:"pl-9"})]})]}),e.jsxs("div",{children:[e.jsx(T,{htmlFor:"filter-known",children:"认识状态"}),e.jsxs(Ie,{value:b===void 0?"all":b.toString(),onValueChange:W=>{w(W==="all"?void 0:W==="true"),f(1)},children:[e.jsx($e,{id:"filter-known",className:"mt-1.5",children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"all",children:"全部"}),e.jsx(Z,{value:"true",children:"已认识"}),e.jsx(Z,{value:"false",children:"未认识"})]})]})]}),e.jsxs("div",{children:[e.jsx(T,{htmlFor:"filter-platform",children:"平台"}),e.jsxs(Ie,{value:y||"all",onValueChange:W=>{R(W==="all"?void 0:W),f(1)},children:[e.jsx($e,{id:"filter-platform",className:"mt-1.5",children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"all",children:"全部平台"}),pe.map(W=>e.jsxs(Z,{value:W,children:[W," (",J.platforms[W],")"]},W))]})]})]})]}),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(Ie,{value:p.toString(),onValueChange:W=>{g(parseInt(W)),f(1),Ne(new Set)},children:[e.jsx($e,{id:"page-size",className:"w-20",children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"10",children:"10"}),e.jsx(Z,{value:"20",children:"20"}),e.jsx(Z,{value:"50",children:"50"}),e.jsx(Z,{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:O,children:[e.jsx(ns,{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(Rl,{children:[e.jsx(Ll,{children:e.jsxs(ut,{children:[e.jsx(We,{className:"w-12",children:e.jsx(qs,{checked:l.length>0&&oe.size===l.length,onCheckedChange:z,"aria-label":"全选"})}),e.jsx(We,{children:"状态"}),e.jsx(We,{children:"名称"}),e.jsx(We,{children:"昵称"}),e.jsx(We,{children:"平台"}),e.jsx(We,{children:"用户ID"}),e.jsx(We,{children:"最后更新"}),e.jsx(We,{className:"text-right",children:"操作"})]})}),e.jsx(Ul,{children:i?e.jsx(ut,{children:e.jsx(Ke,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):l.length===0?e.jsx(ut,{children:e.jsx(Ke,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):l.map(W=>e.jsxs(ut,{children:[e.jsx(Ke,{children:e.jsx(qs,{checked:oe.has(W.person_id),onCheckedChange:()=>Ce(W.person_id),"aria-label":`选择 ${W.person_name||W.nickname||W.user_id}`})}),e.jsx(Ke,{children:e.jsx("div",{className:P("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",W.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:W.is_known?"已认识":"未认识"})}),e.jsx(Ke,{className:"font-medium",children:W.person_name||e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx(Ke,{children:W.nickname||"-"}),e.jsx(Ke,{children:W.platform}),e.jsx(Ke,{className:"font-mono text-sm",children:W.user_id}),e.jsx(Ke,{className:"text-sm text-muted-foreground",children:De(W.last_know)}),e.jsx(Ke,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>ue(W),children:[e.jsx(ia,{className:"h-4 w-4 mr-1"}),"详情"]}),e.jsxs(_,{variant:"default",size:"sm",onClick:()=>Q(W),children:[e.jsx(Kn,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsxs(_,{size:"sm",onClick:()=>L(W),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(ns,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},W.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3 p-4",children:i?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):l.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):l.map(W=>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(qs,{checked:oe.has(W.person_id),onCheckedChange:()=>Ce(W.person_id),className:"mt-1"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:P("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium mb-2",W.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:W.is_known?"已认识":"未认识"}),e.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",children:W.person_name||e.jsx("span",{className:"text-muted-foreground",children:"未命名"})}),W.nickname&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-1 w-full break-all",children:["昵称: ",W.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:W.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:W.user_id,children:W.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:De(W.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(W),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:()=>Q(W),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(Kn,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>L(W),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[e.jsx(ns,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},W.id))}),u>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:["共 ",u," 条记录,第 ",h," / ",Math.ceil(u/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(gn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h-1),disabled:h===1,children:[e.jsx(Aa,{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(le,{type:"number",value:fe,onChange:W=>ge(W.target.value),onKeyDown:W=>W.key==="Enter"&&de(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(u/p)}),e.jsx(_,{variant:"outline",size:"sm",onClick:de,disabled:!fe,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h+1),disabled:h>=Math.ceil(u/p),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Zt,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(u/p)),disabled:h>=Math.ceil(u/p),className:"hidden sm:flex",children:e.jsx(jn,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(Z4,{person:A,open:B,onOpenChange:M}),e.jsx(W4,{person:A,open:C,onOpenChange:D,onSuccess:()=>{K(),I(),D(!1)}}),e.jsx(vs,{open:!!H,onOpenChange:()=>L(null),children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:['确定要删除人物信息 "',H?.person_name||H?.nickname||H?.user_id,'" 吗? 此操作不可撤销。']})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>H&&Se(H),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(vs,{open:je,onOpenChange:re,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认批量删除"}),e.jsxs(hs,{children:["确定要删除选中的 ",oe.size," 个人物信息吗? 此操作不可撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:V,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})})]})}function Z4({person:l,open:n,onOpenChange:i}){if(!l)return null;const c=u=>u?new Date(u*1e3).toLocaleString("zh-CN"):"-";return e.jsx(Is,{open:n,onOpenChange:i,children:e.jsxs(Ds,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Os,{children:[e.jsx(Rs,{children:"人物详情"}),e.jsxs(Ks,{children:["查看 ",l.person_name||l.nickname||l.user_id," 的完整信息"]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(zl,{icon:fn,label:"人物名称",value:l.person_name}),e.jsx(zl,{icon:za,label:"昵称",value:l.nickname}),e.jsx(zl,{icon:Vr,label:"用户ID",value:l.user_id,mono:!0}),e.jsx(zl,{icon:Vr,label:"人物ID",value:l.person_id,mono:!0}),e.jsx(zl,{label:"平台",value:l.platform}),e.jsx(zl,{label:"状态",value:l.is_known?"已认识":"未认识"})]}),l.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:l.name_reason})]}),l.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:l.memory_points})]}),l.group_nick_name&&l.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:l.group_nick_name.map((u,x)=>e.jsxs("div",{className:"text-sm flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:u.group_id}),e.jsx("span",{children:"→"}),e.jsx("span",{children:u.group_nick_name})]},x))})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx(zl,{icon:na,label:"认识时间",value:c(l.know_times)}),e.jsx(zl,{icon:na,label:"首次记录",value:c(l.know_since)}),e.jsx(zl,{icon:na,label:"最后更新",value:c(l.last_know)})]})]}),e.jsx(st,{children:e.jsx(_,{onClick:()=>i(!1),children:"关闭"})})]})})}function zl({icon:l,label:n,value:i,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:[l&&e.jsx(l,{className:"h-3 w-3"}),n]}),e.jsx("div",{className:P("text-sm",c&&"font-mono",!i&&"text-muted-foreground"),children:i||"-"})]})}function W4({person:l,open:n,onOpenChange:i,onSuccess:c}){const[u,x]=d.useState({}),[h,f]=d.useState(!1),{toast:p}=Zs();d.useEffect(()=>{l&&x({person_name:l.person_name||"",name_reason:l.name_reason||"",nickname:l.nickname||"",is_known:l.is_known})},[l]);const g=async()=>{if(l)try{f(!0),await K4(l.person_id,u),p({title:"保存成功",description:"人物信息已更新"}),c()}catch(N){p({title:"保存失败",description:N instanceof Error?N.message:"无法更新人物信息",variant:"destructive"})}finally{f(!1)}};return l?e.jsx(Is,{open:n,onOpenChange:i,children:e.jsxs(Ds,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Os,{children:[e.jsx(Rs,{children:"编辑人物信息"}),e.jsxs(Ks,{children:["修改 ",l.person_name||l.nickname||l.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(le,{id:"person_name",value:u.person_name||"",onChange:N=>x({...u,person_name:N.target.value}),placeholder:"为这个人设置一个名称"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"nickname",children:"昵称"}),e.jsx(le,{id:"nickname",value:u.nickname||"",onChange:N=>x({...u,nickname:N.target.value}),placeholder:"昵称"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"name_reason",children:"名称设定原因"}),e.jsx(ot,{id:"name_reason",value:u.name_reason||"",onChange:N=>x({...u,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:u.is_known,onCheckedChange:N=>x({...u,is_known:N})})]})]}),e.jsxs(st,{children:[e.jsx(_,{variant:"outline",onClick:()=>i(!1),children:"取消"}),e.jsx(_,{onClick:g,disabled:h,children:h?"保存中...":"保存"})]})]})}):null}var ek=G1();const Lg=M0(ek),ux="/api/webui";async function sk(l=100,n="all"){const i=`${ux}/knowledge/graph?limit=${l}&node_type=${n}`,c=await fetch(i);if(!c.ok)throw new Error(`获取知识图谱失败: ${c.status}`);return c.json()}async function tk(){const l=await fetch(`${ux}/knowledge/stats`);if(!l.ok)throw new Error("获取知识图谱统计信息失败");return l.json()}async function ak(l){const n=await fetch(`${ux}/knowledge/search?query=${encodeURIComponent(l)}`);if(!n.ok)throw new Error("搜索知识节点失败");return n.json()}const Lv=d.memo(({data:l})=>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(Po,{type:"target",position:Ho.Top}),e.jsx("div",{className:"font-semibold text-white text-sm truncate max-w-[200px]",title:l.content,children:l.label}),e.jsx(Po,{type:"source",position:Ho.Bottom})]}));Lv.displayName="EntityNode";const Uv=d.memo(({data:l})=>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(Po,{type:"target",position:Ho.Top}),e.jsx("div",{className:"font-medium text-white text-xs truncate max-w-[150px]",title:l.content,children:l.label}),e.jsx(Po,{type:"source",position:Ho.Bottom})]}));Uv.displayName="ParagraphNode";const lk={entity:Lv,paragraph:Uv};function nk(l,n){const i=new Lg.graphlib.Graph;i.setDefaultEdgeLabel(()=>({})),i.setGraph({rankdir:"TB",ranksep:100,nodesep:80});const c=[],u=[];return l.forEach(x=>{i.setNode(x.id,{width:150,height:50})}),n.forEach(x=>{i.setEdge(x.source,x.target)}),Lg.layout(i),l.forEach(x=>{const h=i.node(x.id);c.push({id:x.id,type:x.type,position:{x:h.x-75,y:h.y-25},data:{label:x.content.slice(0,20)+(x.content.length>20?"...":""),content:x.content}})}),n.forEach((x,h)=>{const f={id:`edge-${h}`,source:x.source,target:x.target,animated:l.length<=200&&x.weight>5,style:{strokeWidth:Math.min(x.weight/2,5),opacity:.6}};x.weight>10&&l.length<100&&(f.label=`${x.weight.toFixed(0)}`),u.push(f)}),{nodes:c,edges:u}}function rk(){const l=ca(),[n,i]=d.useState(!1),[c,u]=d.useState(null),[x,h]=d.useState(""),[f,p]=d.useState("all"),[g,N]=d.useState(50),[v,b]=d.useState("50"),[w,y]=d.useState(!1),[R,A]=d.useState(!0),[S,B]=d.useState(!1),[M,C]=d.useState(!1),[D,H,L]=V1([]),[J,U,oe]=q1([]),[Ne,je]=d.useState(0),[re,fe]=d.useState(null),[ge,E]=d.useState(null),{toast:K}=Zs(),I=d.useCallback(V=>V.type==="entity"?"#6366f1":V.type==="paragraph"?"#10b981":"#6b7280",[]),ue=d.useCallback(async(V=!1)=>{try{if(!V&&g>200){C(!0);return}i(!0);const[de,De]=await Promise.all([sk(g,f),tk()]);if(u(De),de.nodes.length===0){K({title:"提示",description:"知识库为空,请先导入知识数据"}),H([]),U([]);return}const{nodes:W,edges:Y}=nk(de.nodes,de.edges);H(W),U(Y),je(W.length),De&&De.total_nodes>g&&K({title:"提示",description:`知识图谱包含 ${De.total_nodes} 个节点,当前显示 ${W.length} 个`}),K({title:"加载成功",description:`已加载 ${W.length} 个节点,${Y.length} 条边`})}catch(de){console.error("加载知识图谱失败:",de),K({title:"加载失败",description:de instanceof Error?de.message:"未知错误",variant:"destructive"})}finally{i(!1)}},[g,f,K]),Q=d.useCallback(async()=>{if(!x.trim()){K({title:"提示",description:"请输入搜索关键词"});return}try{const V=await ak(x);if(V.length===0){K({title:"未找到",description:"没有找到匹配的节点"});return}const de=new Set(V.map(De=>De.id));H(De=>De.map(W=>({...W,style:{...W.style,opacity:de.has(W.id)?1:.3,filter:de.has(W.id)?"brightness(1.2)":"brightness(0.8)"}}))),K({title:"搜索完成",description:`找到 ${V.length} 个匹配节点`})}catch(V){console.error("搜索失败:",V),K({title:"搜索失败",description:V instanceof Error?V.message:"未知错误",variant:"destructive"})}},[x,K]),Se=d.useCallback(()=>{H(V=>V.map(de=>({...de,style:{...de.style,opacity:1,filter:"brightness(1)"}})))},[]),pe=d.useCallback(()=>{A(!1),B(!0),ue()},[ue]),Ce=d.useCallback(()=>{C(!1),setTimeout(()=>{ue(!0)},0)},[ue]),z=d.useCallback((V,de)=>{D.find(W=>W.id===de.id)&&fe({id:de.id,type:de.type,content:de.data.content})},[D]);d.useEffect(()=>{R||S&&ue()},[g,f,R,S]);const O=d.useCallback((V,de)=>{const De=D.find(He=>He.id===de.source),W=D.find(He=>He.id===de.target),Y=J.find(He=>He.id===de.id);De&&W&&Y&&E({source:{id:De.id,type:De.type,content:De.data.content},target:{id:W.id,type:W.type,content:W.data.content},edge:{source:de.source,target:de.target,weight:parseFloat(de.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(ke,{variant:"outline",className:"gap-1",children:[e.jsx(Gr,{className:"h-3 w-3"}),"节点: ",c.total_nodes]}),e.jsxs(ke,{variant:"outline",className:"gap-1",children:[e.jsx(Pj,{className:"h-3 w-3"}),"边: ",c.total_edges]}),e.jsxs(ke,{variant:"outline",className:"gap-1",children:[e.jsx(Ht,{className:"h-3 w-3"}),"实体: ",c.entity_nodes]}),e.jsxs(ke,{variant:"outline",className:"gap-1",children:[e.jsx(Ca,{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(le,{placeholder:"搜索节点内容...",value:x,onChange:V=>h(V.target.value),onKeyDown:V=>V.key==="Enter"&&Q(),className:"flex-1"}),e.jsx(_,{onClick:Q,size:"sm",children:e.jsx(Tt,{className:"h-4 w-4"})}),e.jsx(_,{onClick:Se,variant:"outline",size:"sm",children:"重置"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(Ie,{value:f,onValueChange:V=>p(V),children:[e.jsx($e,{className:"w-[120px]",children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"all",children:"全部节点"}),e.jsx(Z,{value:"entity",children:"仅实体"}),e.jsx(Z,{value:"paragraph",children:"仅段落"})]})]}),e.jsxs(Ie,{value:g===1e4?"all":w?"custom":g.toString(),onValueChange:V=>{V==="custom"?(y(!0),b(g.toString())):V==="all"?(y(!1),N(1e4)):(y(!1),N(Number(V)))},children:[e.jsx($e,{className:"w-[120px]",children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"50",children:"50 节点"}),e.jsx(Z,{value:"100",children:"100 节点"}),e.jsx(Z,{value:"200",children:"200 节点"}),e.jsx(Z,{value:"500",children:"500 节点"}),e.jsx(Z,{value:"1000",children:"1000 节点"}),e.jsx(Z,{value:"all",children:"全部 (最多10000)"}),e.jsx(Z,{value:"custom",children:"自定义..."})]})]}),w&&e.jsx(le,{type:"number",min:"50",value:v,onChange:V=>b(V.target.value),onBlur:()=>{const V=parseInt(v);!isNaN(V)&&V>=50?N(V):(b("50"),N(50))},onKeyDown:V=>{if(V.key==="Enter"){const de=parseInt(v);!isNaN(de)&&de>=50?N(de):(b("50"),N(50))}},placeholder:"最少50个",className:"w-[120px]"}),e.jsx(_,{onClick:()=>ue(),variant:"outline",size:"sm",disabled:n,children:e.jsx(dt,{className:P("h-4 w-4",n&&"animate-spin")})})]})]})]}),e.jsx("div",{className:"flex-1 relative",children:n?e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(dt,{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(Gr,{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(K1,{nodes:D,edges:J,onNodesChange:L,onEdgesChange:oe,onNodeClick:z,onEdgeClick:O,nodeTypes:lk,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(Q1,{variant:Y1.Dots,gap:12,size:1}),e.jsx(J1,{}),Ne<=500&&e.jsx(X1,{nodeColor:I,nodeBorderRadius:8,pannable:!0,zoomable:!0}),e.jsxs(Z1,{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(Is,{open:!!re,onOpenChange:V=>!V&&fe(null),children:e.jsxs(Ds,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsx(Os,{children:e.jsx(Rs,{children:"节点详情"})}),re&&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:re.type==="entity"?"default":"secondary",children:re.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:re.id})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"内容"}),e.jsx(Je,{className:"mt-1 h-40 p-3 bg-muted rounded",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:re.content})})]})]})]})}),e.jsx(Is,{open:!!ge,onOpenChange:V=>!V&&E(null),children:e.jsxs(Ds,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[e.jsx(Os,{children:e.jsx(Rs,{children:"边详情"})}),ge&&e.jsx(Je,{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(ke,{variant:"outline",className:"text-base font-mono",children:ge.edge.weight.toFixed(4)})})]})]})})]})}),e.jsx(vs,{open:R,onOpenChange:A,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"加载知识图谱"}),e.jsxs(hs,{children:["知识图谱的动态展示会消耗较多系统资源。",e.jsx("br",{}),"确定要加载知识图谱吗?"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{onClick:()=>l({to:"/"}),children:"取消 (返回首页)"}),e.jsx(fs,{onClick:pe,children:"确认加载"})]})]})}),e.jsx(vs,{open:M,onOpenChange:C,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"⚠️ 节点数量较多"}),e.jsx(hs,{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(ms,{children:[e.jsx(ps,{onClick:()=>{C(!1),g>200&&(N(50),y(!1))},children:"取消"}),e.jsx(fs,{onClick:Ce,className:"bg-orange-600 hover:bg-orange-700",children:"我了解风险,继续加载"})]})]})})]})}function ik(){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(Te,{children:[e.jsxs(Oe,{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(Gr,{className:"h-10 w-10 text-primary"})}),e.jsx(Le,{className:"text-2xl",children:"麦麦知识库管理"}),e.jsx(ws,{className:"text-base",children:"功能开发中,敬请期待"})]}),e.jsx(Ae,{className:"text-center text-sm text-muted-foreground",children:e.jsx("p",{children:"此功能将提供知识库的创建、编辑、导入和管理能力"})})]})})})]})}function Ug({className:l,classNames:n,showOutsideDays:i=!0,captionLayout:c="label",buttonVariant:u="ghost",formatters:x,components:h,...f}){const p=av();return e.jsx(U1,{showOutsideDays:i,className:P("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`,l),captionLayout:c,formatters:{formatMonthDropdown:g=>g.toLocaleString("default",{month:"short"}),...x},classNames:{root:P("w-fit",p.root),months:P("relative flex flex-col gap-4 md:flex-row",p.months),month:P("flex w-full flex-col gap-4",p.month),nav:P("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",p.nav),button_previous:P(Kr({variant:u}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",p.button_previous),button_next:P(Kr({variant:u}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",p.button_next),month_caption:P("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",p.month_caption),dropdowns:P("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",p.dropdowns),dropdown_root:P("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:P("bg-popover absolute inset-0 opacity-0",p.dropdown),caption_label:P("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:P("flex",p.weekdays),weekday:P("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",p.weekday),week:P("mt-2 flex w-full",p.week),week_number_header:P("w-[--cell-size] select-none",p.week_number_header),week_number:P("text-muted-foreground select-none text-[0.8rem]",p.week_number),day:P("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:P("bg-accent rounded-l-md",p.range_start),range_middle:P("rounded-none",p.range_middle),range_end:P("bg-accent rounded-r-md",p.range_end),today:P("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",p.today),outside:P("text-muted-foreground aria-selected:text-muted-foreground",p.outside),disabled:P("text-muted-foreground opacity-50",p.disabled),hidden:P("invisible",p.hidden),...n},components:{Root:({className:g,rootRef:N,...v})=>e.jsx("div",{"data-slot":"calendar",ref:N,className:P(g),...v}),Chevron:({className:g,orientation:N,...v})=>N==="left"?e.jsx(Aa,{className:P("size-4",g),...v}):N==="right"?e.jsx(Zt,{className:P("size-4",g),...v}):e.jsx(Ma,{className:P("size-4",g),...v}),DayButton:ck,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 ck({className:l,day:n,modifiers:i,...c}){const u=av(),x=d.useRef(null);return d.useEffect(()=>{i.focused&&x.current?.focus()},[i.focused]),e.jsx(_,{ref:x,variant:"ghost",size:"icon","data-day":n.date.toLocaleDateString(),"data-selected-single":i.selected&&!i.range_start&&!i.range_end&&!i.range_middle,"data-range-start":i.range_start,"data-range-end":i.range_end,"data-range-middle":i.range_middle,className:P("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",u.day,l),...c})}const Mo={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 ok(){const[l,n]=d.useState([]),[i,c]=d.useState(""),[u,x]=d.useState("all"),[h,f]=d.useState("all"),[p,g]=d.useState(void 0),[N,v]=d.useState(void 0),[b,w]=d.useState(!0),[y,R]=d.useState(!1),[A,S]=d.useState("xs"),[B,M]=d.useState(4),[C,D]=d.useState(!1),H=d.useRef(null);d.useEffect(()=>{const Q=In.getAllLogs();n(Q);const Se=In.onLog(()=>{n(In.getAllLogs())}),pe=In.onConnectionChange(Ce=>{R(Ce)});return()=>{Se(),pe()}},[]);const L=d.useMemo(()=>{const Q=new Set(l.map(Se=>Se.module).filter(Se=>Se&&Se.trim()!==""));return Array.from(Q).sort()},[l]),J=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"}},U=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"}},oe=()=>{window.location.reload()},Ne=()=>{In.clearLogs(),n([])},je=()=>{const Q=ge.map(z=>`${z.timestamp} [${z.level.padEnd(8)}] [${z.module}] ${z.message}`).join(` +`),Se=new Blob([Q],{type:"text/plain;charset=utf-8"}),pe=URL.createObjectURL(Se),Ce=document.createElement("a");Ce.href=pe,Ce.download=`logs-${vm(new Date,"yyyy-MM-dd-HHmmss")}.txt`,Ce.click(),URL.revokeObjectURL(pe)},re=()=>{w(!b)},fe=()=>{g(void 0),v(void 0)},ge=d.useMemo(()=>l.filter(Q=>{const Se=i===""||Q.message.toLowerCase().includes(i.toLowerCase())||Q.module.toLowerCase().includes(i.toLowerCase()),pe=u==="all"||Q.level===u,Ce=h==="all"||Q.module===h;let z=!0;if(p||N){const O=new Date(Q.timestamp);if(p){const V=new Date(p);V.setHours(0,0,0,0),z=z&&O>=V}if(N){const V=new Date(N);V.setHours(23,59,59,999),z=z&&O<=V}}return Se&&pe&&Ce&&z}),[l,i,u,h,p,N]),E=Mo[A].rowHeight+B,K=b0({count:ge.length,getScrollElement:()=>H.current,estimateSize:()=>E,overscan:50}),I=d.useRef(!1),ue=d.useRef(ge.length);return d.useEffect(()=>{const Q=H.current;if(!Q)return;const Se=()=>{if(I.current)return;const{scrollTop:pe,scrollHeight:Ce,clientHeight:z}=Q,O=Ce-pe-z;O>100&&b?w(!1):O<50&&!b&&w(!0)};return Q.addEventListener("scroll",Se,{passive:!0}),()=>Q.removeEventListener("scroll",Se)},[b]),d.useEffect(()=>{const Q=ge.length>ue.current;ue.current=ge.length,b&&ge.length>0&&Q&&(I.current=!0,K.scrollToIndex(ge.length-1,{align:"end",behavior:"auto"}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{I.current=!1})}))},[ge.length,b,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:P("h-2 w-2 sm:h-2.5 sm:w-2.5 rounded-full",y?"bg-green-500 animate-pulse":"bg-red-500")}),e.jsx("span",{className:"text-xs text-muted-foreground",children:y?"已连接":"未连接"})]})]}),e.jsx(Te,{className:"p-2 sm:p-3",children:e.jsx(rc,{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(Tt,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),e.jsx(le,{placeholder:"搜索日志...",value:i,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:b?"default":"outline",size:"sm",onClick:re,className:"h-8 px-2",title:b?"自动滚动":"已暂停",children:[b?e.jsx(r1,{className:"h-3.5 w-3.5"}):e.jsx(i1,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"ml-1 text-xs hidden sm:inline",children:b?"滚动":"暂停"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:Ne,className:"h-8 px-2",title:"清空日志",children:[e.jsx(ns,{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(sa,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"ml-1 text-xs hidden lg:inline",children:"导出"})]}),e.jsx(ic,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:"h-8 px-2",title:C?"收起筛选":"展开筛选",children:[e.jsx(Do,{className:"h-3.5 w-3.5"}),C?e.jsx(Fr,{className:"h-3.5 w-3.5 ml-1"}):e.jsx(Ma,{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," / ",l.length]}),e.jsx("span",{className:"ml-1",children:"条日志"})]}),e.jsxs(cc,{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-2",children:[e.jsxs(Ie,{value:u,onValueChange:x,children:[e.jsxs($e,{className:"w-full sm:flex-1 h-8 text-xs",children:[e.jsx(Do,{className:"h-3.5 w-3.5 mr-1.5"}),e.jsx(Pe,{placeholder:"级别"})]}),e.jsxs(Be,{children:[e.jsx(Z,{value:"all",children:"全部级别"}),e.jsx(Z,{value:"DEBUG",children:"DEBUG"}),e.jsx(Z,{value:"INFO",children:"INFO"}),e.jsx(Z,{value:"WARNING",children:"WARNING"}),e.jsx(Z,{value:"ERROR",children:"ERROR"}),e.jsx(Z,{value:"CRITICAL",children:"CRITICAL"})]})]}),e.jsxs(Ie,{value:h,onValueChange:f,children:[e.jsxs($e,{className:"w-full sm:flex-1 h-8 text-xs",children:[e.jsx(Do,{className:"h-3.5 w-3.5 mr-1.5"}),e.jsx(Pe,{placeholder:"模块"})]}),e.jsxs(Be,{children:[e.jsx(Z,{value:"all",children:"全部模块"}),L.map(Q=>e.jsx(Z,{value:Q,children:Q},Q))]})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-2",children:[e.jsxs(ol,{children:[e.jsx(dl,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:P("w-full sm:flex-1 justify-start text-left font-normal h-8",!p&&"text-muted-foreground"),children:[e.jsx(Bo,{className:"mr-1.5 h-3.5 w-3.5"}),e.jsx("span",{className:"text-xs",children:p?vm(p,"PP",{locale:To}):"开始日期"})]})}),e.jsx(Wa,{className:"w-auto p-0",align:"start",children:e.jsx(Ug,{mode:"single",selected:p,onSelect:g,initialFocus:!0,locale:To})})]}),e.jsxs(ol,{children:[e.jsx(dl,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:P("w-full sm:flex-1 justify-start text-left font-normal h-8",!N&&"text-muted-foreground"),children:[e.jsx(Bo,{className:"mr-1.5 h-3.5 w-3.5"}),e.jsx("span",{className:"text-xs",children:N?vm(N,"PP",{locale:To}):"结束日期"})]})}),e.jsx(Wa,{className:"w-auto p-0",align:"start",children:e.jsx(Ug,{mode:"single",selected:N,onSelect:v,initialFocus:!0,locale:To})})]}),(p||N)&&e.jsxs(_,{variant:"outline",size:"sm",onClick:fe,className:"w-full sm:w-auto h-8",children:[e.jsx(Ea,{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(c1,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"字号"})]}),e.jsx("div",{className:"flex gap-1",children:Object.keys(Mo).map(Q=>e.jsx(_,{variant:A===Q?"default":"outline",size:"sm",onClick:()=>S(Q),className:"h-6 px-2 text-xs",children:Mo[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(qa,{value:[B],onValueChange:([Q])=>M(Q),min:0,max:12,step:2,className:"flex-1"}),e.jsxs("span",{className:"text-xs text-muted-foreground w-7",children:[B,"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(dt,{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(sa,{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(Te,{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:P("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:P("p-2 sm:p-3 font-mono relative",Mo[A].class),style:{height:`${K.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:"暂无日志数据"}):K.getVirtualItems().map(Q=>{const Se=ge[Q.index];return e.jsxs("div",{"data-index":Q.index,ref:K.measureElement,className:P("absolute top-0 left-0 w-full px-2 sm:px-3 rounded hover:bg-white/5 transition-colors",U(Se.level)),style:{transform:`translateY(${Q.start}px)`,paddingTop:`${B/2}px`,paddingBottom:`${B/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:P("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:P("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})]})]},Q.key)})})})})})]})}async function dk(){return(await _e("/api/planner/overview")).json()}async function uk(l,n=1,i=20,c){const u=new URLSearchParams({page:n.toString(),page_size:i.toString()});return c&&u.append("search",c),(await _e(`/api/planner/chat/${l}/logs?${u}`)).json()}async function mk(l,n){return(await _e(`/api/planner/log/${l}/${n}`)).json()}async function xk(){return(await _e("/api/replier/overview")).json()}async function hk(l,n=1,i=20,c){const u=new URLSearchParams({page:n.toString(),page_size:i.toString()});return c&&u.append("search",c),(await _e(`/api/replier/chat/${l}/logs?${u}`)).json()}async function fk(l,n){return(await _e(`/api/replier/log/${l}/${n}`)).json()}function $v(){const[l,n]=d.useState(new Map),[i,c]=d.useState(!0),u=d.useCallback(async()=>{try{c(!0);const h=await ex();if(h?.data){const f=new Map;h.data.forEach(p=>{f.set(p.chat_id,p.chat_name)}),n(f)}}catch(h){console.error("加载聊天列表失败:",h)}finally{c(!1)}},[]);d.useEffect(()=>{u()},[u]);const x=d.useCallback(h=>l.get(h)||h,[l]);return{chatNameMap:l,getChatName:x,loading:i,reload:u}}function Go(l){return new Date(l*1e3).toLocaleString("zh-CN")}function Bv(l){const i=Date.now()/1e3-l;return i<60?"刚刚":i<3600?`${Math.floor(i/60)} 分钟前`:i<86400?`${Math.floor(i/3600)} 小时前`:`${Math.floor(i/86400)} 天前`}function Iv(l,n,i=1e4){d.useEffect(()=>{if(!l)return;const c=setInterval(n,i);return()=>clearInterval(c)},[l,n,i])}function pk({autoRefresh:l,refreshKey:n}){const[i,c]=d.useState("overview"),[u,x]=d.useState(null),{getChatName:h}=$v(),[f,p]=d.useState(null),[g,N]=d.useState(!0),[v,b]=d.useState(null),[w,y]=d.useState(!1),[R,A]=d.useState(1),[S,B]=d.useState(20),[M,C]=d.useState(""),[D,H]=d.useState(""),[L,J]=d.useState(""),[U,oe]=d.useState(null),[Ne,je]=d.useState(!1),[re,fe]=d.useState(!1),ge=d.useCallback(async()=>{try{N(!0);const O=await dk();p(O)}catch(O){console.error("加载规划器总览失败:",O)}finally{N(!1)}},[]),E=d.useCallback(async()=>{if(u)try{y(!0);const O=await uk(u.chat_id,R,S,D||void 0);b(O)}catch(O){console.error("加载聊天日志失败:",O)}finally{y(!1)}},[u,R,S,D]);d.useEffect(()=>{ge()},[ge]),d.useEffect(()=>{n>0&&(i==="overview"?ge():E())},[n,i,ge,E]),d.useEffect(()=>{i==="chat-logs"&&u&&E()},[i,u,E]),Iv(l,d.useCallback(()=>{i==="overview"?ge():E()},[i,ge,E]));const K=O=>{x(O),A(1),H(""),J(""),c("chat-logs")},I=()=>{c("overview"),x(null),b(null),H(""),J("")},ue=()=>{H(L),A(1)},Q=()=>{J(""),H(""),A(1)},Se=async(O,V)=>{try{fe(!0),je(!0);const de=await mk(O,V);oe(de)}catch(de){console.error("加载计划详情失败:",de)}finally{fe(!1)}},pe=O=>{B(Number(O)),A(1)},Ce=()=>{const O=parseInt(M),V=v?Math.ceil(v.total/v.page_size):0;!isNaN(O)&&O>=1&&O<=V&&(A(O),C(""))},z=v?Math.ceil(v.total/v.page_size):0;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-4",children:i==="overview"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Le,{className:"text-sm font-medium",children:"聊天数量"}),e.jsx(za,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(Ae,{children:g?e.jsx(js,{className:"h-8 w-16"}):e.jsx("div",{className:"text-2xl font-bold",children:f?.total_chats||0})})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Le,{className:"text-sm font-medium",children:"计划总数"}),e.jsx(Vm,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(Ae,{children:g?e.jsx(js,{className:"h-8 w-16"}):e.jsx("div",{className:"text-2xl font-bold",children:f?.total_plans||0})})]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Le,{children:"聊天列表"}),e.jsx(ws,{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((O,V)=>e.jsx(js,{className:"h-24 w-full"},V))}):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(O=>e.jsxs("div",{className:"border rounded-lg p-4 hover:bg-accent/50 transition-colors cursor-pointer",onClick:()=>K(O),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(za,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm truncate max-w-[180px]",title:h(O.chat_id),children:h(O.chat_id)})]}),e.jsx(ke,{variant:"secondary",children:O.plan_count})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["最后活动: ",Bv(O.latest_timestamp)]})]},O.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:I,children:[e.jsx(Ta,{className:"h-4 w-4 mr-2"}),"返回聊天列表"]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:["当前聊天: ",e.jsx("span",{className:"font-medium",children:u?h(u.chat_id):""}),e.jsx("span",{className:"mx-2",children:"•"}),"共 ",v?.total||0," 条计划记录"]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{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(Le,{children:"计划执行记录"}),e.jsx(ws,{children:u?h(u.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(le,{placeholder:"搜索提示词内容...",value:L,onChange:O=>J(O.target.value),onKeyDown:O=>O.key==="Enter"&&ue(),className:"w-full sm:w-48"}),e.jsx(_,{variant:"outline",size:"icon",onClick:ue,children:e.jsx(Tt,{className:"h-4 w-4"})}),D&&e.jsx(_,{variant:"ghost",size:"sm",onClick:Q,children:"清除"})]}),e.jsxs(Ie,{value:S.toString(),onValueChange:pe,children:[e.jsx($e,{className:"w-full sm:w-32",children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"10",children:"10条/页"}),e.jsx(Z,{value:"20",children:"20条/页"}),e.jsx(Z,{value:"50",children:"50条/页"}),e.jsx(Z,{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(Ae,{children:w?e.jsx("div",{className:"space-y-2",children:[...Array(5)].map((O,V)=>e.jsx(js,{className:"h-20 w-full"},V))}):v?.data&&v.data.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-2",children:v.data.map(O=>e.jsxs("div",{className:"border rounded-lg p-3 hover:bg-accent/50 transition-colors cursor-pointer",onClick:()=>Se(O.chat_id,O.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:Go(O.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:[O.action_count," 个动作"]}),e.jsxs(ke,{variant:"outline",className:"text-xs",children:[O.total_plan_ms.toFixed(0),"ms"]})]})]}),O.action_types&&O.action_types.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:O.action_types.map((V,de)=>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:V},de))}),e.jsx("p",{className:"text-sm line-clamp-2",children:O.reasoning_preview||"无推理内容"})]},O.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:["共 ",v.total," 条记录,第 ",R," / ",z," 页"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>A(1),disabled:R===1,className:"hidden sm:flex",children:e.jsx(gn,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>A(O=>Math.max(1,O-1)),disabled:R===1,children:e.jsx(Aa,{className:"h-4 w-4"})}),e.jsxs("div",{className:"hidden sm:flex items-center gap-2",children:[e.jsx(le,{type:"number",min:1,max:z,value:M,onChange:O=>C(O.target.value),onKeyDown:O=>O.key==="Enter"&&Ce(),placeholder:"跳转",className:"w-20 h-8"}),e.jsx(_,{size:"sm",variant:"outline",onClick:Ce,children:"跳转"})]}),e.jsxs("span",{className:"sm:hidden text-sm text-muted-foreground",children:[R,"/",z]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>A(O=>Math.min(z,O+1)),disabled:R===z,children:e.jsx(Zt,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>A(z),disabled:R===z,className:"hidden sm:flex",children:e.jsx(jn,{className:"h-4 w-4"})})]})]})]}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无计划记录"})})]})]})}),e.jsx(Is,{open:Ne,onOpenChange:je,children:e.jsxs(Ds,{className:"max-w-4xl max-h-[80vh] grid grid-rows-[auto_1fr_auto] overflow-hidden",children:[e.jsxs(Os,{children:[e.jsxs(Rs,{className:"flex items-center gap-2",children:[e.jsx(Ca,{className:"h-5 w-5"}),"计划执行详情"]}),e.jsx(Ks,{children:"查看麦麦的详细计划推理过程和执行动作"})]}),e.jsx(Je,{className:"h-full pr-4",children:e.jsx("div",{className:"space-y-6 pb-4",children:re?e.jsx("div",{className:"space-y-4",children:[...Array(5)].map((O,V)=>e.jsx(js,{className:"h-24 w-full"},V))}):U?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:U.chat_id,children:h(U.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:Go(U.timestamp)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"类型"}),e.jsx(ke,{variant:"outline",children:U.type})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"动作数量"}),e.jsxs(ke,{children:[U.actions.length," 个动作"]})]})]})]}),e.jsx(Yt,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(Za,{className:"h-4 w-4"}),"性能统计"]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs(Te,{children:[e.jsx(Oe,{className:"p-4 pb-2",children:e.jsx(Le,{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:[U.timing.prompt_build_ms?.toFixed(2)||0,"ms"]})})]}),e.jsxs(Te,{children:[e.jsx(Oe,{className:"p-4 pb-2",children:e.jsx(Le,{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:[U.timing.llm_duration_ms?.toFixed(2)||0,"ms"]})})]}),e.jsxs(Te,{children:[e.jsx(Oe,{className:"p-4 pb-2",children:e.jsx(Le,{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:[U.timing.total_plan_ms?.toFixed(2)||0,"ms"]})})]})]})]}),e.jsx(Yt,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(Xm,{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:U.reasoning||"无推理内容"})})]}),e.jsx(Yt,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(o1,{className:"h-4 w-4"}),"执行动作 (",U.actions.length,")"]}),e.jsx("div",{className:"space-y-3",children:U.actions.map((O,V)=>e.jsxs(Te,{children:[e.jsx(Oe,{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:["动作 ",V+1]}),e.jsx(ke,{variant:"outline",children:O.action_type})]})})}),e.jsxs(Ae,{className:"p-4 pt-0 space-y-3",children:[O.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 O.reasoning=="string"?O.reasoning:JSON.stringify(O.reasoning)})]}),O.action_message&&e.jsxs("div",{className:"overflow-hidden",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:"动作消息"}),typeof O.action_message=="string"?e.jsx("p",{className:"text-sm bg-muted/30 p-2 rounded break-all whitespace-pre-wrap",children:O.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(O.action_message,null,2)})]}),O.action_data&&Object.keys(O.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(O.action_data,null,2)})]}),O.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 O.action_reasoning=="string"?O.action_reasoning:JSON.stringify(O.action_reasoning)})]})]})]},V))})]}),e.jsx(Yt,{}),U.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:U.raw_output})})]})]}),U.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:U.prompt})})]})]})]}):e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("p",{className:"text-muted-foreground",children:"无数据"})})})}),e.jsx(st,{className:"flex-shrink-0",children:e.jsx(_,{onClick:()=>je(!1),children:"关闭"})})]})})]})}function gk({autoRefresh:l,refreshKey:n}){const[i,c]=d.useState("overview"),[u,x]=d.useState(null),{getChatName:h}=$v(),[f,p]=d.useState(null),[g,N]=d.useState(!0),[v,b]=d.useState(null),[w,y]=d.useState(!1),[R,A]=d.useState(1),[S,B]=d.useState(20),[M,C]=d.useState(""),[D,H]=d.useState(""),[L,J]=d.useState(""),[U,oe]=d.useState(null),[Ne,je]=d.useState(!1),[re,fe]=d.useState(!1),ge=d.useCallback(async()=>{try{N(!0);const O=await xk();p(O)}catch(O){console.error("加载回复器总览失败:",O)}finally{N(!1)}},[]),E=d.useCallback(async()=>{if(u)try{y(!0);const O=await hk(u.chat_id,R,S,D||void 0);b(O)}catch(O){console.error("加载聊天日志失败:",O)}finally{y(!1)}},[u,R,S,D]);d.useEffect(()=>{ge()},[ge]),d.useEffect(()=>{n>0&&(i==="overview"?ge():E())},[n,i,ge,E]),d.useEffect(()=>{i==="chat-logs"&&u&&E()},[i,u,E]),Iv(l,d.useCallback(()=>{i==="overview"?ge():E()},[i,ge,E]));const K=O=>{x(O),A(1),H(""),J(""),c("chat-logs")},I=()=>{c("overview"),x(null),b(null),H(""),J("")},ue=()=>{H(L),A(1)},Q=()=>{J(""),H(""),A(1)},Se=async(O,V)=>{try{fe(!0),je(!0);const de=await fk(O,V);oe(de)}catch(de){console.error("加载回复详情失败:",de)}finally{fe(!1)}},pe=O=>{B(Number(O)),A(1)},Ce=()=>{const O=parseInt(M),V=v?Math.ceil(v.total/v.page_size):0;!isNaN(O)&&O>=1&&O<=V&&(A(O),C(""))},z=v?Math.ceil(v.total/v.page_size):0;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-4",children:i==="overview"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Le,{className:"text-sm font-medium",children:"聊天数量"}),e.jsx(za,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(Ae,{children:g?e.jsx(js,{className:"h-8 w-16"}):e.jsx("div",{className:"text-2xl font-bold",children:f?.total_chats||0})})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Le,{className:"text-sm font-medium",children:"回复总数"}),e.jsx(Vm,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(Ae,{children:g?e.jsx(js,{className:"h-8 w-16"}):e.jsx("div",{className:"text-2xl font-bold",children:f?.total_replies||0})})]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Le,{children:"聊天列表"}),e.jsx(ws,{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((O,V)=>e.jsx(js,{className:"h-24 w-full"},V))}):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(O=>e.jsxs("div",{className:"border rounded-lg p-4 hover:bg-accent/50 transition-colors cursor-pointer",onClick:()=>K(O),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(za,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm truncate max-w-[180px]",title:h(O.chat_id),children:h(O.chat_id)})]}),e.jsx(ke,{variant:"secondary",children:O.reply_count})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["最后活动: ",Bv(O.latest_timestamp)]})]},O.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:I,children:[e.jsx(Ta,{className:"h-4 w-4 mr-2"}),"返回聊天列表"]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:["当前聊天: ",e.jsx("span",{className:"font-medium",children:u?h(u.chat_id):""}),e.jsx("span",{className:"mx-2",children:"•"}),"共 ",v?.total||0," 条回复记录"]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{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(Le,{children:"回复生成记录"}),e.jsx(ws,{children:u?h(u.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(le,{placeholder:"搜索提示词内容...",value:L,onChange:O=>J(O.target.value),onKeyDown:O=>O.key==="Enter"&&ue(),className:"w-full sm:w-48"}),e.jsx(_,{variant:"outline",size:"icon",onClick:ue,children:e.jsx(Tt,{className:"h-4 w-4"})}),D&&e.jsx(_,{variant:"ghost",size:"sm",onClick:Q,children:"清除"})]}),e.jsxs(Ie,{value:S.toString(),onValueChange:pe,children:[e.jsx($e,{className:"w-full sm:w-32",children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"10",children:"10条/页"}),e.jsx(Z,{value:"20",children:"20条/页"}),e.jsx(Z,{value:"50",children:"50条/页"}),e.jsx(Z,{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(Ae,{children:w?e.jsx("div",{className:"space-y-2",children:[...Array(5)].map((O,V)=>e.jsx(js,{className:"h-20 w-full"},V))}):v?.data&&v.data.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-2",children:v.data.map(O=>e.jsxs("div",{className:"border rounded-lg p-3 hover:bg-accent/50 transition-colors cursor-pointer",onClick:()=>Se(O.chat_id,O.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:Go(O.timestamp)}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[O.success?e.jsxs(ke,{variant:"default",className:"text-xs bg-green-600",children:[e.jsx(og,{className:"h-3 w-3 mr-1"}),"成功"]}):e.jsxs(ke,{variant:"destructive",className:"text-xs",children:[e.jsx(Va,{className:"h-3 w-3 mr-1"}),"失败"]}),e.jsx(ke,{variant:"outline",className:"text-xs",children:O.model}),e.jsxs(ke,{variant:"secondary",className:"text-xs",children:[O.overall_ms.toFixed(0),"ms"]})]})]}),e.jsx("p",{className:"text-sm line-clamp-2",children:O.output_preview||"无输出内容"})]},O.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:["共 ",v.total," 条记录,第 ",R," / ",z," 页"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>A(1),disabled:R===1,className:"hidden sm:flex",children:e.jsx(gn,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>A(O=>Math.max(1,O-1)),disabled:R===1,children:e.jsx(Aa,{className:"h-4 w-4"})}),e.jsxs("div",{className:"hidden sm:flex items-center gap-2",children:[e.jsx(le,{type:"number",min:1,max:z,value:M,onChange:O=>C(O.target.value),onKeyDown:O=>O.key==="Enter"&&Ce(),placeholder:"跳转",className:"w-20 h-8"}),e.jsx(_,{size:"sm",variant:"outline",onClick:Ce,children:"跳转"})]}),e.jsxs("span",{className:"sm:hidden text-sm text-muted-foreground",children:[R,"/",z]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>A(O=>Math.min(z,O+1)),disabled:R===z,children:e.jsx(Zt,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>A(z),disabled:R===z,className:"hidden sm:flex",children:e.jsx(jn,{className:"h-4 w-4"})})]})]})]}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无回复记录"})})]})]})}),e.jsx(Is,{open:Ne,onOpenChange:je,children:e.jsxs(Ds,{className:"max-w-4xl max-h-[80vh] grid grid-rows-[auto_1fr_auto] overflow-hidden",children:[e.jsxs(Os,{children:[e.jsxs(Rs,{className:"flex items-center gap-2",children:[e.jsx(Ca,{className:"h-5 w-5"}),"回复生成详情"]}),e.jsx(Ks,{children:"查看麦麦的详细回复生成过程"})]}),e.jsx(Je,{className:"h-full pr-4",children:e.jsx("div",{className:"space-y-6 pb-4",children:re?e.jsx("div",{className:"space-y-4",children:[...Array(5)].map((O,V)=>e.jsx(js,{className:"h-24 w-full"},V))}):U?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:U.chat_id,children:h(U.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:Go(U.timestamp)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"状态"}),U.success?e.jsxs(ke,{variant:"default",className:"bg-green-600",children:[e.jsx(og,{className:"h-3 w-3 mr-1"}),"成功"]}):e.jsxs(ke,{variant:"destructive",children:[e.jsx(Va,{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 ",U.think_level]})]})]})]}),e.jsx(Yt,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(d1,{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:U.model})})]}),e.jsx(Yt,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(Za,{className:"h-4 w-4"}),"性能统计"]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs(Te,{children:[e.jsx(Oe,{className:"p-4 pb-2",children:e.jsx(Le,{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:[U.timing.prompt_ms?.toFixed(2)||0,"ms"]})})]}),e.jsxs(Te,{children:[e.jsx(Oe,{className:"p-4 pb-2",children:e.jsx(Le,{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:[U.timing.llm_ms?.toFixed(2)||0,"ms"]})})]}),e.jsxs(Te,{children:[e.jsx(Oe,{className:"p-4 pb-2",children:e.jsx(Le,{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:[U.timing.overall_ms?.toFixed(2)||0,"ms"]})})]})]}),U.timing.timing_logs&&U.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:U.timing.timing_logs.map((O,V)=>e.jsx("div",{className:"text-xs text-muted-foreground",children:O},V))})]}),U.timing.almost_zero&&e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:[e.jsx("span",{className:"font-medium",children:"近乎零耗时: "}),U.timing.almost_zero]})]}),e.jsx(Yt,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(Xm,{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:U.output||"无输出内容"})})]}),U.processed_output&&U.processed_output.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(Yt,{}),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:U.processed_output.map((O,V)=>e.jsx("div",{className:"p-3 bg-muted/30 rounded-lg",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:O})},V))})]})]}),U.reasoning&&e.jsxs(e.Fragment,{children:[e.jsx(Yt,{}),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:U.reasoning})})]})]}),U.error&&e.jsxs(e.Fragment,{children:[e.jsx(Yt,{}),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:U.error})})]})]}),U.prompt&&e.jsxs(e.Fragment,{children:[e.jsx(Yt,{}),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:U.prompt})})]})]})]})]}):e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("p",{className:"text-muted-foreground",children:"无数据"})})})}),e.jsx(st,{className:"flex-shrink-0",children:e.jsx(_,{onClick:()=>je(!1),children:"关闭"})})]})})]})}function jk(){const[l,n]=d.useState("planner"),[i,c]=d.useState(!1),[u,x]=d.useState(0),h=d.useCallback(()=>{x(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:i?"default":"outline",size:"sm",onClick:()=>c(!i),children:[e.jsx(dt,{className:`h-4 w-4 mr-2 ${i?"animate-spin":""}`}),i?"自动刷新中":"自动刷新"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:h,children:e.jsx(dt,{className:"h-4 w-4"})})]})]}),e.jsxs(ta,{value:l,onValueChange:f=>n(f),className:"w-full",children:[e.jsxs(Xt,{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(Gm,{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(u1,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"回复器监控"})]})]}),e.jsxs(Je,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[e.jsx(ys,{value:"planner",className:"mt-0",children:e.jsx(pk,{autoRefresh:i,refreshKey:u})}),e.jsx(ys,{value:"replier",className:"mt-0",children:e.jsx(gk,{autoRefresh:i,refreshKey:u})})]})]})]})}const vk="Mai-with-u",Nk="plugin-repo",bk="main",yk="plugin_details.json";async function wk(){try{const l=await _e("/api/webui/plugins/fetch-raw",{method:"POST",body:JSON.stringify({owner:vk,repo:Nk,branch:bk,file_path:yk})});if(!l.ok)throw new Error(`HTTP error! status: ${l.status}`);const n=await l.json();if(!n.success||!n.data)throw new Error(n.error||"获取插件列表失败");return JSON.parse(n.data).filter(u=>!u?.id||!u?.manifest?(console.warn("跳过无效插件数据:",u),!1):!u.manifest.name||!u.manifest.version?(console.warn("跳过缺少必需字段的插件:",u.id),!1):!0).map(u=>({id:u.id,manifest:{manifest_version:u.manifest.manifest_version||1,name:u.manifest.name,version:u.manifest.version,description:u.manifest.description||"",author:u.manifest.author||{name:"Unknown"},license:u.manifest.license||"Unknown",host_application:u.manifest.host_application||{min_version:"0.0.0"},homepage_url:u.manifest.homepage_url,repository_url:u.manifest.repository_url,keywords:u.manifest.keywords||[],categories:u.manifest.categories||[],default_locale:u.manifest.default_locale||"zh-CN",locales_path:u.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!1,published_at:new Date().toISOString(),updated_at:new Date().toISOString()}))}catch(l){throw console.error("Failed to fetch plugin list:",l),l}}async function Pv(){try{const l=await _e("/api/webui/plugins/git-status");if(!l.ok)throw new Error(`HTTP error! status: ${l.status}`);return await l.json()}catch(l){return console.error("Failed to check Git status:",l),{installed:!1,error:"无法检测 Git 安装状态"}}}async function Hv(){try{const l=await _e("/api/webui/plugins/version");if(!l.ok)throw new Error(`HTTP error! status: ${l.status}`);return await l.json()}catch(l){return console.error("Failed to get Maimai version:",l),{version:"0.0.0",version_major:0,version_minor:0,version_patch:0}}}function Fv(l,n,i){const c=l.split(".").map(f=>parseInt(f)||0),u=c[0]||0,x=c[1]||0,h=c[2]||0;if(i.version_majorparseInt(v)||0),p=f[0]||0,g=f[1]||0,N=f[2]||0;if(i.version_major>p||i.version_major===p&&i.version_minor>g||i.version_major===p&&i.version_minor===g&&i.version_patch>N)return!1}return!0}async function _k(){try{const l=await _e("/api/webui/ws-token");if(!l.ok)return console.error("获取 WebSocket token 失败:",l.status),null;const n=await l.json();return n.success&&n.token?n.token:null}catch(l){return console.error("获取 WebSocket token 失败:",l),null}}async function Sk(l,n){const i=await _k();if(!i)return console.warn("无法获取 WebSocket token,可能未登录"),null;const c=window.location.protocol==="https:"?"wss:":"ws:",u=window.location.host,x=`${c}//${u}/api/webui/ws/plugin-progress?token=${encodeURIComponent(i)}`;try{const h=new WebSocket(x);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);l(p)}catch(p){console.error("Failed to parse progress data:",p)}},h.onerror=f=>{console.error("Plugin progress WebSocket error:",f),n?.(f)},h.onclose=()=>{console.log("Plugin progress WebSocket disconnected")},h}catch(h){return console.error("创建 WebSocket 连接失败:",h),null}}async function Al(){try{const l=await _e("/api/webui/plugins/installed",{headers:Fs()});if(!l.ok)throw new Error(`HTTP error! status: ${l.status}`);const n=await l.json();if(!n.success)throw new Error(n.message||"获取已安装插件列表失败");return n.plugins||[]}catch(l){return console.error("Failed to get installed plugins:",l),[]}}function mn(l,n){return n.some(i=>i.id===l)}function xn(l,n){const i=n.find(c=>c.id===l);if(i)return i.manifest?.version||i.version}async function Gv(l,n,i="main"){const c=await _e("/api/webui/plugins/install",{method:"POST",body:JSON.stringify({plugin_id:l,repository_url:n,branch:i})});if(!c.ok){const u=await c.json();throw new Error(u.detail||"安装失败")}return await c.json()}async function Vv(l){const n=await _e("/api/webui/plugins/uninstall",{method:"POST",body:JSON.stringify({plugin_id:l})});if(!n.ok){const i=await n.json();throw new Error(i.detail||"卸载失败")}return await n.json()}async function qv(l,n,i="main"){const c=await _e("/api/webui/plugins/update",{method:"POST",body:JSON.stringify({plugin_id:l,repository_url:n,branch:i})});if(!c.ok){const u=await c.json();throw new Error(u.detail||"更新失败")}return await c.json()}async function kk(l){const n=await _e(`/api/webui/plugins/config/${l}/schema`,{headers:Fs()});if(!n.ok){const c=await n.text();try{const u=JSON.parse(c);throw new Error(u.detail||"获取配置 Schema 失败")}catch{throw new Error(`获取配置 Schema 失败 (${n.status})`)}}const i=await n.json();if(!i.success)throw new Error(i.message||"获取配置 Schema 失败");return i.schema}async function Ck(l){const n=await _e(`/api/webui/plugins/config/${l}`,{headers:Fs()});if(!n.ok){const c=await n.text();try{const u=JSON.parse(c);throw new Error(u.detail||"获取配置失败")}catch{throw new Error(`获取配置失败 (${n.status})`)}}const i=await n.json();if(!i.success)throw new Error(i.message||"获取配置失败");return i.config}async function Tk(l){const n=await _e(`/api/webui/plugins/config/${l}/raw`,{headers:Fs()});if(!n.ok){const c=await n.text();try{const u=JSON.parse(c);throw new Error(u.detail||"获取配置失败")}catch{throw new Error(`获取配置失败 (${n.status})`)}}const i=await n.json();if(!i.success)throw new Error(i.message||"获取配置失败");return i.config}async function Ek(l,n){const i=await _e(`/api/webui/plugins/config/${l}`,{method:"PUT",headers:Fs(),body:JSON.stringify({config:n})});if(!i.ok){const c=await i.json();throw new Error(c.detail||"保存配置失败")}return await i.json()}async function Mk(l,n){const i=await _e(`/api/webui/plugins/config/${l}/raw`,{method:"PUT",headers:Fs(),body:JSON.stringify({config:n})});if(!i.ok){const c=await i.json();throw new Error(c.detail||"保存配置失败")}return await i.json()}async function zk(l){const n=await _e(`/api/webui/plugins/config/${l}/reset`,{method:"POST",headers:Fs()});if(!n.ok){const i=await n.json();throw new Error(i.detail||"重置配置失败")}return await n.json()}async function Ak(l){const n=await _e(`/api/webui/plugins/config/${l}/toggle`,{method:"POST",headers:Fs()});if(!n.ok){const i=await n.json();throw new Error(i.detail||"切换状态失败")}return await n.json()}const xc="https://maibot-plugin-stats.maibot-webui.workers.dev";async function Kv(l){try{const n=await fetch(`${xc}/stats/${l}`);return n.ok?await n.json():(console.error("Failed to fetch plugin stats:",n.statusText),null)}catch(n){return console.error("Error fetching plugin stats:",n),null}}async function Dk(l,n){try{const i=n||mx(),c=await fetch(`${xc}/stats/like`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:l,user_id:i})}),u=await c.json();return c.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:c.ok?{success:!0,...u}:{success:!1,error:u.error||"点赞失败"}}catch(i){return console.error("Error liking plugin:",i),{success:!1,error:"网络错误"}}}async function Ok(l,n){try{const i=n||mx(),c=await fetch(`${xc}/stats/dislike`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:l,user_id:i})}),u=await c.json();return c.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:c.ok?{success:!0,...u}:{success:!1,error:u.error||"点踩失败"}}catch(i){return console.error("Error disliking plugin:",i),{success:!1,error:"网络错误"}}}async function Rk(l,n,i,c){if(n<1||n>5)return{success:!1,error:"评分必须在 1-5 之间"};try{const u=c||mx(),x=await fetch(`${xc}/stats/rate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:l,rating:n,comment:i,user_id:u})}),h=await x.json();return x.status===429?{success:!1,error:"每天最多评分 3 次"}:x.ok?{success:!0,...h}:{success:!1,error:h.error||"评分失败"}}catch(u){return console.error("Error rating plugin:",u),{success:!1,error:"网络错误"}}}async function Qv(l){try{const n=await fetch(`${xc}/stats/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:l})}),i=await n.json();return n.status===429?(console.warn("Download recording rate limited"),{success:!0}):n.ok?{success:!0,...i}:(console.error("Failed to record download:",i.error),{success:!1,error:i.error})}catch(n){return console.error("Error recording download:",n),{success:!1,error:"网络错误"}}}function Lk(){const l=navigator,n=[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,l.deviceMemory||0].join("|");let i=0;for(let c=0;c{const ee=F.map(async Ee=>{try{const me=await Kv(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(ee),ie={};Ue.forEach(({id:Ee,stats:me})=>{me&&(ie[Ee]=me)}),U(ie)};d.useEffect(()=>{let F=null,ee=!1;return(async()=>{if(F=await Sk(ie=>{ee||(C(ie),ie.stage==="success"?setTimeout(()=>{ee||C(null)},2e3):ie.stage==="error"&&(y(!1),A(ie.error||"加载失败")))},ie=>{console.error("WebSocket error:",ie),ee||pe({title:"WebSocket 连接失败",description:"无法实时显示加载进度",variant:"destructive"})}),await new Promise(ie=>{if(!F){ie();return}const Ee=()=>{F&&F.readyState===WebSocket.OPEN?(console.log("WebSocket connected, starting to load plugins"),ie()):F&&F.readyState===WebSocket.CLOSED?(console.warn("WebSocket closed before loading plugins"),ie()):setTimeout(Ee,100)};Ee()}),!ee){const ie=await Pv();B(ie),ie.installed||pe({title:"Git 未安装",description:ie.error||"请先安装 Git 才能使用插件安装功能",variant:"destructive"})}if(!ee){const ie=await Hv();H(ie)}if(!ee)try{y(!0),A(null);const ie=await wk();if(!ee){const Ee=await Al();L(Ee);const me=ie.map(Me=>{const rs=mn(Me.id,Ee),Ut=xn(Me.id,Ee);return{...Me,installed:rs,installed_version:Ut}});for(const Me of Ee)!me.some(Ut=>Ut.id===Me.id)&&Me.manifest&&me.push({id:Me.id,manifest:{manifest_version:Me.manifest.manifest_version||1,name:Me.manifest.name,version:Me.manifest.version,description:Me.manifest.description||"",author:Me.manifest.author,license:Me.manifest.license||"Unknown",host_application:Me.manifest.host_application,homepage_url:Me.manifest.homepage_url,repository_url:Me.manifest.repository_url,keywords:Me.manifest.keywords||[],categories:Me.manifest.categories||[],default_locale:Me.manifest.default_locale||"zh-CN",locales_path:Me.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!0,installed_version:Me.manifest.version,published_at:new Date().toISOString(),updated_at:new Date().toISOString()});b(me),Ce(me)}}catch(ie){if(!ee){const Ee=ie instanceof Error?ie.message:"加载插件列表失败";A(Ee),pe({title:"加载失败",description:Ee,variant:"destructive"})}}finally{ee||y(!1)}})(),()=>{ee=!0,F&&F.close()}},[pe]);const z=F=>{if(!F.installed&&D&&!O(F))return e.jsxs(ke,{variant:"destructive",className:"gap-1",children:[e.jsx(_t,{className:"h-3 w-3"}),"不兼容"]});if(F.installed){const ee=F.installed_version?.trim(),Ue=F.manifest.version?.trim();if(ee!==Ue){const ie=ee?.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(ke,{variant:"outline",className:"gap-1 text-orange-600 border-orange-600",children:[e.jsx(_t,{className:"h-3 w-3"}),"可更新"]});if((Ee[me]||0)<(ie[me]||0))break}}return e.jsxs(ke,{variant:"default",className:"gap-1",children:[e.jsx(pt,{className:"h-3 w-3"}),"已安装"]})}return null},O=F=>!D||!F.manifest?.host_application?!0:Fv(F.manifest.host_application.min_version,F.manifest.host_application.max_version,D),V=F=>{if(!F.installed||!F.installed_version||!F.manifest?.version)return!1;const ee=F.installed_version.trim(),Ue=F.manifest.version.trim();if(ee===Ue)return!1;const ie=ee.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},de=v.filter(F=>{if(!F.manifest)return console.warn("[过滤] 跳过无 manifest 的插件:",F.id),!1;const ee=c===""||F.manifest.name?.toLowerCase().includes(c.toLowerCase())||F.manifest.description?.toLowerCase().includes(c.toLowerCase())||F.manifest.keywords&&F.manifest.keywords.some(me=>me.toLowerCase().includes(c.toLowerCase())),Ue=x==="all"||F.manifest.categories&&F.manifest.categories.includes(x);let ie=!0;f==="installed"?ie=F.installed===!0:f==="updates"&&(ie=F.installed===!0&&V(F));const Ee=!g||!D||O(F);return ee&&Ue&&ie&&Ee}),De=F=>{if(!S?.installed){pe({title:"无法安装",description:"Git 未安装",variant:"destructive"});return}if(D&&!O(F)){pe({title:"无法安装",description:"插件与当前麦麦版本不兼容",variant:"destructive"});return}re(F),ge("main"),K(""),ue("preset"),Se(!1),Ne(!0)},W=async()=>{if(!je)return;const F=I==="custom"?E:fe;if(!F||F.trim()===""){pe({title:"分支名称不能为空",variant:"destructive"});return}try{Ne(!1),await Gv(je.id,je.manifest.repository_url||"",F),Qv(je.id).catch(Ue=>{console.warn("Failed to record download:",Ue)}),pe({title:"安装成功",description:`${je.manifest.name} 已成功安装`});const ee=await Al();L(ee),b(Ue=>Ue.map(ie=>{if(ie.id===je.id){const Ee=mn(ie.id,ee),me=xn(ie.id,ee);return{...ie,installed:Ee,installed_version:me}}return ie}))}catch(ee){pe({title:"安装失败",description:ee instanceof Error?ee.message:"未知错误",variant:"destructive"})}finally{re(null)}},Y=async F=>{try{await Vv(F.id),pe({title:"卸载成功",description:`${F.manifest.name} 已成功卸载`});const ee=await Al();L(ee),b(Ue=>Ue.map(ie=>{if(ie.id===F.id){const Ee=mn(ie.id,ee),me=xn(ie.id,ee);return{...ie,installed:Ee,installed_version:me}}return ie}))}catch(ee){pe({title:"卸载失败",description:ee instanceof Error?ee.message:"未知错误",variant:"destructive"})}},He=async F=>{if(!S?.installed){pe({title:"无法更新",description:"Git 未安装",variant:"destructive"});return}try{const ee=await qv(F.id,F.manifest.repository_url||"","main");pe({title:"更新成功",description:`${F.manifest.name} 已从 ${ee.old_version} 更新到 ${ee.new_version}`});const Ue=await Al();L(Ue),b(ie=>ie.map(Ee=>{if(Ee.id===F.id){const me=mn(Ee.id,Ue),Me=xn(Ee.id,Ue);return{...Ee,installed:me,installed_version:Me}}return Ee}))}catch(ee){pe({title:"更新失败",description:ee instanceof Error?ee.message:"未知错误",variant:"destructive"})}};return e.jsx(Je,{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:()=>n(),disabled:i,children:[e.jsx(Hj,{className:`h-4 w-4 mr-2 ${i?"animate-spin":""}`}),"重启麦麦"]}),e.jsxs(_,{onClick:()=>l({to:"/plugin-mirrors"}),children:[e.jsx(m1,{className:"h-4 w-4 mr-2"}),"配置镜像源"]})]})]}),e.jsx(Te,{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(Ht,{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(Te,{className:"border-orange-600 bg-orange-50 dark:bg-orange-950/20",children:[e.jsx(Oe,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Jt,{className:"h-5 w-5 text-orange-600"}),e.jsxs("div",{children:[e.jsx(Le,{className:"text-lg text-orange-900 dark:text-orange-100",children:"Git 未安装"}),e.jsx(ws,{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(Te,{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(Tt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(le,{placeholder:"搜索插件...",value:c,onChange:F=>u(F.target.value),className:"pl-9"})]}),e.jsxs(Ie,{value:x,onValueChange:h,children:[e.jsx($e,{className:"w-full sm:w-[200px]",children:e.jsx(Pe,{placeholder:"选择分类"})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"all",children:"全部分类"}),e.jsx(Z,{value:"Group Management",children:"群组管理"}),e.jsx(Z,{value:"Entertainment & Interaction",children:"娱乐互动"}),e.jsx(Z,{value:"Utility Tools",children:"实用工具"}),e.jsx(Z,{value:"Content Generation",children:"内容生成"}),e.jsx(Z,{value:"Multimedia",children:"多媒体"}),e.jsx(Z,{value:"External Integration",children:"外部集成"}),e.jsx(Z,{value:"Data Analysis & Insights",children:"数据分析与洞察"}),e.jsx(Z,{value:"Other",children:"其他"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qs,{id:"compatible-only",checked:g,onCheckedChange:F=>N(F===!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(ta,{value:f,onValueChange:p,className:"w-full",children:e.jsxs(Xt,{className:"grid w-full grid-cols-3",children:[e.jsxs(Xe,{value:"all",children:["全部插件 (",v.filter(F=>{if(!F.manifest)return!1;const ee=c===""||F.manifest.name?.toLowerCase().includes(c.toLowerCase())||F.manifest.description?.toLowerCase().includes(c.toLowerCase())||F.manifest.keywords&&F.manifest.keywords.some(Ee=>Ee.toLowerCase().includes(c.toLowerCase())),Ue=x==="all"||F.manifest.categories&&F.manifest.categories.includes(x),ie=!g||!D||O(F);return ee&&Ue&&ie}).length,")"]}),e.jsxs(Xe,{value:"installed",children:["已安装 (",v.filter(F=>{if(!F.manifest)return!1;const ee=c===""||F.manifest.name?.toLowerCase().includes(c.toLowerCase())||F.manifest.description?.toLowerCase().includes(c.toLowerCase())||F.manifest.keywords&&F.manifest.keywords.some(Ee=>Ee.toLowerCase().includes(c.toLowerCase())),Ue=x==="all"||F.manifest.categories&&F.manifest.categories.includes(x),ie=!g||!D||O(F);return F.installed&&ee&&Ue&&ie}).length,")"]}),e.jsxs(Xe,{value:"updates",children:["可更新 (",v.filter(F=>{if(!F.manifest)return!1;const ee=c===""||F.manifest.name?.toLowerCase().includes(c.toLowerCase())||F.manifest.description?.toLowerCase().includes(c.toLowerCase())||F.manifest.keywords&&F.manifest.keywords.some(Ee=>Ee.toLowerCase().includes(c.toLowerCase())),Ue=x==="all"||F.manifest.categories&&F.manifest.categories.includes(x),ie=!g||!D||O(F);return F.installed&&V(F)&&ee&&Ue&&ie}).length,")"]})]})}),M&&M.stage==="loading"&&M.operation==="fetch"&&e.jsx(Te,{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(Bs,{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:[M.progress,"%"]})]}),e.jsx(Qn,{value:M.progress,className:"h-2"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:M.message}),M.total_plugins>0&&e.jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["已加载 ",M.loaded_plugins," / ",M.total_plugins," 个插件"]})]})}),M&&M.stage==="error"&&M.error&&e.jsx(Te,{className:"border-destructive bg-destructive/10",children:e.jsx(Oe,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Jt,{className:"h-5 w-5 text-destructive"}),e.jsxs("div",{children:[e.jsx(Le,{className:"text-lg text-destructive",children:"加载失败"}),e.jsx(ws,{className:"text-destructive/80",children:M.error})]})]})})}),w?e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(Bs,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件列表中..."})]}):R?e.jsx(Te,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Jt,{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:R}),e.jsx(_,{onClick:()=>window.location.reload(),children:"重新加载"})]})}):de.length===0?e.jsx(Te,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Tt,{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||x!=="all"?"尝试调整搜索条件或筛选器":"暂无可用插件"})]})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:de.map(F=>e.jsxs(Te,{className:"flex flex-col hover:shadow-lg transition-shadow h-full",children:[e.jsxs(Oe,{children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx(Le,{className:"text-xl",children:F.manifest?.name||F.id}),e.jsxs("div",{className:"flex flex-col gap-1",children:[F.manifest?.categories&&F.manifest.categories[0]&&e.jsx(ke,{variant:"secondary",className:"text-xs whitespace-nowrap",children:Uk[F.manifest.categories[0]]||F.manifest.categories[0]}),z(F)]})]}),e.jsx(ws,{className:"line-clamp-2",children:F.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(sa,{className:"h-4 w-4"}),e.jsx("span",{children:(J[F.id]?.downloads??F.downloads??0).toLocaleString()})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(dn,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),e.jsx("span",{children:(J[F.id]?.rating??F.rating??0).toFixed(1)})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[F.manifest?.keywords&&F.manifest.keywords.slice(0,3).map(ee=>e.jsx(ke,{variant:"outline",className:"text-xs",children:ee},ee)),F.manifest?.keywords&&F.manifest.keywords.length>3&&e.jsxs(ke,{variant:"outline",className:"text-xs",children:["+",F.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",F.manifest?.version||"unknown"," · ",F.manifest?.author?.name||"Unknown"]}),F.manifest?.host_application&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{children:"支持:"}),e.jsxs("span",{className:"font-medium",children:[F.manifest.host_application.min_version,F.manifest.host_application.max_version?` - ${F.manifest.host_application.max_version}`:" - 最新版本"]})]})]})]})}),e.jsx(Wo,{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:()=>l({to:"/plugin-detail",search:{pluginId:F.id}}),children:"查看详情"}),F.installed?V(F)?e.jsxs(_,{size:"sm",disabled:!S?.installed,title:S?.installed?void 0:"Git 未安装",onClick:()=>He(F),children:[e.jsx(dt,{className:"h-4 w-4 mr-1"}),"更新"]}):e.jsxs(_,{variant:"destructive",size:"sm",disabled:!S?.installed,title:S?.installed?void 0:"Git 未安装",onClick:()=>Y(F),children:[e.jsx(ns,{className:"h-4 w-4 mr-1"}),"卸载"]}):e.jsxs(_,{size:"sm",disabled:!S?.installed||M?.operation==="install"||D!==null&&!O(F),title:S?.installed?D!==null&&!O(F)?`不兼容当前版本 (需要 ${F.manifest?.host_application?.min_version||"未知"}${F.manifest?.host_application?.max_version?` - ${F.manifest.host_application.max_version}`:"+"},当前 ${D?.version})`:void 0:"Git 未安装",onClick:()=>De(F),children:[e.jsx(sa,{className:"h-4 w-4 mr-1"}),M?.operation==="install"&&M?.plugin_id===F.id?"安装中...":"安装"]})]})}),M&&(M.stage==="loading"||M.stage==="success"||M.stage==="error")&&M.operation!=="fetch"&&M.plugin_id===F.id&&e.jsx("div",{className:"px-6 pb-4 -mt-2",children:e.jsxs("div",{className:`space-y-2 p-3 rounded-lg border ${M.stage==="success"?"bg-green-50 dark:bg-green-950/20 border-green-200 dark:border-green-900":M.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:[M.stage==="loading"?e.jsx(Bs,{className:"h-3 w-3 animate-spin"}):M.stage==="success"?e.jsx(pt,{className:"h-3 w-3 text-green-600"}):e.jsx(_t,{className:"h-3 w-3 text-red-600"}),e.jsx("span",{className:`text-xs font-medium ${M.stage==="success"?"text-green-700 dark:text-green-300":M.stage==="error"?"text-red-700 dark:text-red-300":""}`,children:M.stage==="loading"?e.jsxs(e.Fragment,{children:[M.operation==="install"&&"正在安装",M.operation==="uninstall"&&"正在卸载",M.operation==="update"&&"正在更新"]}):M.stage==="success"?e.jsxs(e.Fragment,{children:[M.operation==="install"&&"安装完成",M.operation==="uninstall"&&"卸载完成",M.operation==="update"&&"更新完成"]}):e.jsxs(e.Fragment,{children:[M.operation==="install"&&"安装失败",M.operation==="uninstall"&&"卸载失败",M.operation==="update"&&"更新失败"]})})]}),M.stage!=="error"&&e.jsxs("span",{className:`text-xs font-medium ${M.stage==="success"?"text-green-700 dark:text-green-300":""}`,children:[M.progress,"%"]})]}),M.stage!=="error"&&e.jsx(Qn,{value:M.progress,className:`h-1.5 ${M.stage==="success"?"[&>div]:bg-green-500":""}`}),e.jsx("div",{className:`text-xs ${M.stage==="success"?"text-green-600 dark:text-green-400 truncate":M.stage==="error"?"text-red-600 dark:text-red-400":"text-muted-foreground truncate"}`,children:M.stage==="error"?M.error||M.message||"操作失败":M.message})]})})]},F.id))}),e.jsx(Is,{open:oe,onOpenChange:Ne,children:e.jsxs(Ds,{children:[e.jsxs(Os,{children:[e.jsx(Rs,{children:"安装插件"}),e.jsxs(Ks,{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(qs,{id:"advanced-options",checked:Q,onCheckedChange:F=>Se(F)}),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(ta,{value:I,onValueChange:F=>ue(F),children:[e.jsxs(Xt,{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:"自定义分支"})]}),I==="preset"&&e.jsx("div",{className:"mt-3",children:e.jsxs(Ie,{value:fe,onValueChange:ge,children:[e.jsx($e,{children:e.jsx(Pe,{placeholder:"选择分支"})}),e.jsxs(Be,{children:[e.jsx(Z,{value:"main",children:"main (默认)"}),e.jsx(Z,{value:"master",children:"master"}),e.jsx(Z,{value:"dev",children:"dev (开发版)"}),e.jsx(Z,{value:"develop",children:"develop"}),e.jsx(Z,{value:"beta",children:"beta (测试版)"}),e.jsx(Z,{value:"stable",children:"stable (稳定版)"})]})]})}),I==="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:E,onChange:F=>K(F.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(st,{children:[e.jsx(_,{variant:"outline",onClick:()=>Ne(!1),children:"取消"}),e.jsxs(_,{onClick:W,children:[e.jsx(sa,{className:"h-4 w-4 mr-2"}),"安装"]})]})]})}),e.jsx(Xn,{})]})})}function Ik(){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(Fj,{className:"h-8 w-8",strokeWidth:2}),"模型分配预设市场"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"浏览和下载社区共享的模型分配预设配置"})]})})}),e.jsx(Je,{className:"flex-1",children:e.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-12rem)]",children:e.jsxs(Te,{className:"max-w-2xl w-full border-dashed",children:[e.jsxs(Oe,{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(Le,{className:"text-2xl",children:"功能开发中"}),e.jsx(ws,{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 Pk({field:l,value:n,onChange:i}){const[c,u]=d.useState(!1);switch(l.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:l.label}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]}),e.jsx(Ge,{checked:!!n,onCheckedChange:i,disabled:l.disabled})]});case"number":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:l.label}),e.jsx(le,{type:"number",value:n??l.default,onChange:x=>i(parseFloat(x.target.value)||0),min:l.min,max:l.max,step:l.step??1,placeholder:l.placeholder,disabled:l.disabled}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.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:l.label}),e.jsx("span",{className:"text-sm text-muted-foreground",children:n??l.default})]}),e.jsx(qa,{value:[n??l.default],onValueChange:x=>i(x[0]),min:l.min??0,max:l.max??100,step:l.step??1,disabled:l.disabled}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]});case"select":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:l.label}),e.jsxs(Ie,{value:String(n??l.default),onValueChange:i,disabled:l.disabled,children:[e.jsx($e,{children:e.jsx(Pe,{placeholder:l.placeholder??"请选择"})}),e.jsx(Be,{children:l.choices?.map(x=>e.jsx(Z,{value:String(x),children:String(x)},String(x)))})]}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]});case"textarea":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:l.label}),e.jsx(ot,{value:n??l.default,onChange:x=>i(x.target.value),placeholder:l.placeholder,rows:l.rows??3,disabled:l.disabled}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]});case"password":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:l.label}),e.jsxs("div",{className:"relative",children:[e.jsx(le,{type:c?"text":"password",value:n??"",onChange:x=>i(x.target.value),placeholder:l.placeholder,disabled:l.disabled,className:"pr-10"}),e.jsx(_,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3",onClick:()=>u(!c),children:c?e.jsx(ec,{className:"h-4 w-4"}):e.jsx(ia,{className:"h-4 w-4"})})]}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]});case"list":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:l.label}),e.jsx(q2,{value:Array.isArray(n)?n:[],onChange:x=>i(x),itemType:l.item_type??"string",itemFields:l.item_fields,minItems:l.min_items,maxItems:l.max_items,disabled:l.disabled,placeholder:l.placeholder}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]});case"text":default:return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:l.label}),e.jsx(le,{type:"text",value:n??l.default??"",onChange:x=>i(x.target.value),placeholder:l.placeholder,maxLength:l.max_length,disabled:l.disabled}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]})}}function $g({section:l,config:n,onChange:i}){const[c,u]=d.useState(!l.collapsed),x=Object.entries(l.fields).filter(([,h])=>!h.hidden).sort(([,h],[,f])=>h.order-f.order);return e.jsx(rc,{open:c,onOpenChange:u,children:e.jsxs(Te,{children:[e.jsx(ic,{asChild:!0,children:e.jsxs(Oe,{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(Ma,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(Zt,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(Le,{className:"text-lg",children:l.title})]}),e.jsxs(ke,{variant:"secondary",className:"text-xs",children:[x.length," 项"]})]}),l.description&&e.jsx(ws,{className:"ml-6",children:l.description})]})}),e.jsx(cc,{children:e.jsx(Ae,{className:"space-y-4 pt-0",children:x.map(([h,f])=>e.jsx(Pk,{field:f,value:n[l.name]?.[h],onChange:p=>i(l.name,h,p),sectionName:l.name},h))})})]})})}function Hk({plugin:l,onBack:n}){const{toast:i}=Zs(),{triggerRestart:c,isRestarting:u}=vn(),[x,h]=d.useState("visual"),[f,p]=d.useState(null),[g,N]=d.useState({}),[v,b]=d.useState({}),[w,y]=d.useState(""),[R,A]=d.useState(""),[S,B]=d.useState(!0),[M,C]=d.useState(!1),[D,H]=d.useState(!1),[L,J]=d.useState(!1),[U,oe]=d.useState(!1),Ne=d.useCallback(async()=>{B(!0);try{const[I,ue,Q]=await Promise.all([kk(l.id),Ck(l.id),Tk(l.id)]);p(I),N(ue),b(JSON.parse(JSON.stringify(ue))),y(Q),A(Q)}catch(I){i({title:"加载配置失败",description:I instanceof Error?I.message:"未知错误",variant:"destructive"})}finally{B(!1)}},[l.id,i]);d.useEffect(()=>{Ne()},[Ne]),d.useEffect(()=>{H(x==="visual"?JSON.stringify(g)!==JSON.stringify(v):w!==R)},[g,v,w,R,x]);const je=(I,ue,Q)=>{N(Se=>({...Se,[I]:{...Se[I]||{},[ue]:Q}}))},re=async()=>{C(!0);try{if(x==="source"){try{Dv(w)}catch(I){J(!0),i({title:"TOML 格式错误",description:I instanceof Error?I.message:"无法解析 TOML 配置,请检查语法",variant:"destructive"}),C(!1);return}await Mk(l.id,w),A(w),J(!1)}else await Ek(l.id,g),b(JSON.parse(JSON.stringify(g)));i({title:"配置已保存",description:"更改将在插件重新加载后生效"})}catch(I){i({title:"保存失败",description:I instanceof Error?I.message:"未知错误",variant:"destructive"})}finally{C(!1)}},fe=async()=>{try{await zk(l.id),i({title:"配置已重置",description:"下次加载插件时将使用默认配置"}),oe(!1),Ne()}catch(I){i({title:"重置失败",description:I instanceof Error?I.message:"未知错误",variant:"destructive"})}},ge=async()=>{try{const I=await Ak(l.id);i({title:I.message,description:I.note}),Ne()}catch(I){i({title:"切换状态失败",description:I instanceof Error?I.message:"未知错误",variant:"destructive"})}};if(S)return e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx(Bs,{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(_t,{className:"h-12 w-12 text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground",children:"无法加载配置"}),e.jsxs(_,{onClick:n,variant:"outline",children:[e.jsx(Ta,{className:"h-4 w-4 mr-2"}),"返回"]})]});const E=Object.values(f.sections).sort((I,ue)=>I.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:n,children:e.jsx(Ta,{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||l.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||l.manifest.version]})]})]})]}),e.jsxs("div",{className:"flex gap-2 ml-10 sm:ml-0",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>h(x==="visual"?"source":"visual"),children:x==="visual"?e.jsxs(e.Fragment,{children:[e.jsx(Bj,{className:"h-4 w-4 mr-2"}),"源代码"]}):e.jsxs(e.Fragment,{children:[e.jsx($j,{className:"h-4 w-4 mr-2"}),"可视化"]})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>c(),disabled:u,children:[e.jsx(Hj,{className:`h-4 w-4 mr-2 ${u?"animate-spin":""}`}),"重启麦麦"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:ge,children:[e.jsx(oc,{className:"h-4 w-4 mr-2"}),K?"禁用":"启用"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>oe(!0),children:[e.jsx(Wi,{className:"h-4 w-4 mr-2"}),"重置"]}),e.jsxs(_,{size:"sm",onClick:re,disabled:!D||M,children:[M?e.jsx(Bs,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(dc,{className:"h-4 w-4 mr-2"}),"保存"]})]})]}),D&&e.jsx(Te,{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(Ht,{className:"h-4 w-4 text-orange-600"}),e.jsx("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:"有未保存的更改"})]})})}),x==="source"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(at,{children:[e.jsx(_t,{className:"h-4 w-4"}),e.jsxs(lt,{children:[e.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。保存时会验证格式,只有格式正确才能保存。",L&&e.jsx("span",{className:"text-destructive font-semibold ml-2",children:"⚠️ 上次保存失败,请检查 TOML 格式"})]})]}),e.jsx(yv,{value:w,onChange:I=>{y(I),L&&J(!1)},language:"toml",theme:"dark",height:"calc(100vh - 350px)",minHeight:"500px",placeholder:"TOML 配置内容"})]}),x==="visual"&&e.jsxs(e.Fragment,{children:[e.jsxs(at,{children:[e.jsx(Ht,{className:"h-4 w-4"}),e.jsxs(lt,{children:[e.jsx("strong",{children:"提示:"}),"如果插件当前未加载或未启用,WebUI 适配器的高级插件可视化编辑功能可能会不可用。 请确保插件已启用并成功加载后,再进行配置编辑。"]})]}),f.layout.type==="tabs"&&f.layout.tabs.length>0?e.jsxs(ta,{defaultValue:f.layout.tabs[0]?.id,children:[e.jsx(Xt,{children:f.layout.tabs.map(I=>e.jsxs(Xe,{value:I.id,children:[I.title,I.badge&&e.jsx(ke,{variant:"secondary",className:"ml-2 text-xs",children:I.badge})]},I.id))}),f.layout.tabs.map(I=>e.jsx(ys,{value:I.id,className:"space-y-4 mt-4",children:I.sections.map(ue=>{const Q=f.sections[ue];return Q?e.jsx($g,{section:Q,config:g,onChange:je},ue):null})},I.id))]}):e.jsx("div",{className:"space-y-4",children:E.map(I=>e.jsx($g,{section:I,config:g,onChange:je},I.name))})]}),e.jsx(Is,{open:U,onOpenChange:oe,children:e.jsxs(Ds,{children:[e.jsxs(Os,{children:[e.jsx(Rs,{children:"确认重置配置"}),e.jsx(Ks,{children:"这将删除当前配置文件,下次加载插件时将使用默认配置。此操作不可撤销。"})]}),e.jsxs(st,{children:[e.jsx(_,{variant:"outline",onClick:()=>oe(!1),children:"取消"}),e.jsx(_,{variant:"destructive",onClick:fe,children:"确认重置"})]})]})})]})}function Fk(){return e.jsx(Jn,{children:e.jsx(Gk,{})})}function Gk(){const{toast:l}=Zs(),[n,i]=d.useState([]),[c,u]=d.useState(!0),[x,h]=d.useState(""),[f,p]=d.useState(null),g=async()=>{u(!0);try{const y=await Al();i(y)}catch(y){l({title:"加载插件列表失败",description:y instanceof Error?y.message:"未知错误",variant:"destructive"})}finally{u(!1)}};d.useEffect(()=>{g()},[]);const v=n.filter(y=>{const R=x.toLowerCase();return y.id.toLowerCase().includes(R)||y.manifest.name.toLowerCase().includes(R)||y.manifest.description?.toLowerCase().includes(R)}).filter((y,R,A)=>R===A.findIndex(S=>S.id===y.id)),b=n.length,w=0;return f?e.jsxs(e.Fragment,{children:[e.jsx(Je,{className:"h-full",children:e.jsx("div",{className:"p-4 sm:p-6",children:e.jsx(Hk,{plugin:f,onBack:()=>p(null)})})}),e.jsx(Xn,{})]}):e.jsx(Je,{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(dt,{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(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Le,{className:"text-sm font-medium",children:"已安装插件"}),e.jsx(ra,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ae,{children:[e.jsx("div",{className:"text-2xl font-bold",children:n.length}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:c?"正在加载...":"个插件"})]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Le,{className:"text-sm font-medium",children:"已启用"}),e.jsx(pt,{className:"h-4 w-4 text-green-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(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Le,{className:"text-sm font-medium",children:"已禁用"}),e.jsx(_t,{className:"h-4 w-4 text-orange-600"})]}),e.jsxs(Ae,{children:[e.jsx("div",{className:"text-2xl font-bold",children:w}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"未激活的插件"})]})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(Tt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(le,{placeholder:"搜索插件...",value:x,onChange:y=>h(y.target.value),className:"pl-9"})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Le,{children:"已安装的插件"}),e.jsx(ws,{children:"点击插件查看和编辑配置"})]}),e.jsx(Ae,{children:c?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(Bs,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):v.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:x?"没有找到匹配的插件":"暂无已安装的插件"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:x?"尝试其他搜索关键词":"前往插件市场安装插件"})]})]}):e.jsx("div",{className:"space-y-2",children:v.map(y=>e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg border hover:bg-muted/50 cursor-pointer transition-colors",onClick:()=>p(y),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:y.manifest.name}),e.jsxs(ke,{variant:"secondary",className:"text-xs flex-shrink-0",children:["v",y.manifest.version]})]}),e.jsx("p",{className:"text-sm text-muted-foreground truncate",children:y.manifest.description||"暂无描述"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(_,{variant:"ghost",size:"sm",children:e.jsx(pn,{className:"h-4 w-4"})}),e.jsx(Zt,{className:"h-4 w-4 text-muted-foreground"})]})]},y.id))})})]})]})})}function Vk(){const l=ca(),{toast:n}=Zs(),[i,c]=d.useState([]),[u,x]=d.useState(!0),[h,f]=d.useState(null),[p,g]=d.useState(null),[N,v]=d.useState(!1),[b,w]=d.useState(!1),[y,R]=d.useState({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),A=d.useCallback(async()=>{try{x(!0),f(null);const L=await _e("/api/webui/plugins/mirrors");if(!L.ok)throw new Error("获取镜像源列表失败");const J=await L.json();c(J.mirrors||[])}catch(L){const J=L instanceof Error?L.message:"加载镜像源失败";f(J),n({title:"加载失败",description:J,variant:"destructive"})}finally{x(!1)}},[n]);d.useEffect(()=>{A()},[A]);const S=async()=>{try{const L=await _e("/api/webui/plugins/mirrors",{method:"POST",body:JSON.stringify(y)});if(!L.ok){const J=await L.json();throw new Error(J.detail||"添加镜像源失败")}n({title:"添加成功",description:"镜像源已添加"}),v(!1),R({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),A()}catch(L){n({title:"添加失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"})}},B=async()=>{if(p)try{if(!(await _e(`/api/webui/plugins/mirrors/${p.id}`,{method:"PUT",body:JSON.stringify({name:y.name,raw_prefix:y.raw_prefix,clone_prefix:y.clone_prefix,enabled:y.enabled,priority:y.priority})})).ok)throw new Error("更新镜像源失败");n({title:"更新成功",description:"镜像源已更新"}),w(!1),g(null),A()}catch(L){n({title:"更新失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"})}},M=async L=>{if(confirm("确定要删除这个镜像源吗?"))try{if(!(await _e(`/api/webui/plugins/mirrors/${L}`,{method:"DELETE"})).ok)throw new Error("删除镜像源失败");n({title:"删除成功",description:"镜像源已删除"}),A()}catch(J){n({title:"删除失败",description:J instanceof Error?J.message:"未知错误",variant:"destructive"})}},C=async L=>{try{if(!(await _e(`/api/webui/plugins/mirrors/${L.id}`,{method:"PUT",body:JSON.stringify({enabled:!L.enabled})})).ok)throw new Error("更新状态失败");A()}catch(J){n({title:"更新失败",description:J instanceof Error?J.message:"未知错误",variant:"destructive"})}},D=L=>{g(L),R({id:L.id,name:L.name,raw_prefix:L.raw_prefix,clone_prefix:L.clone_prefix,enabled:L.enabled,priority:L.priority}),w(!0)},H=async(L,J)=>{const U=J==="up"?L.priority-1:L.priority+1;if(!(U<1))try{if(!(await _e(`/api/webui/plugins/mirrors/${L.id}`,{method:"PUT",body:JSON.stringify({priority:U})})).ok)throw new Error("更新优先级失败");A()}catch(oe){n({title:"更新失败",description:oe instanceof Error?oe.message:"未知错误",variant:"destructive"})}};return e.jsx(Je,{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:()=>l({to:"/plugins"}),children:e.jsx(Ta,{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:()=>v(!0),children:[e.jsx(et,{className:"h-4 w-4 mr-2"}),"添加镜像源"]})]}),u?e.jsx(Te,{className:"p-6",children:e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Bs,{className:"h-8 w-8 animate-spin text-primary"})})}):h?e.jsx(Te,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Jt,{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(Te,{children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs(Rl,{children:[e.jsx(Ll,{children:e.jsxs(ut,{children:[e.jsx(We,{children:"状态"}),e.jsx(We,{children:"名称"}),e.jsx(We,{children:"ID"}),e.jsx(We,{children:"优先级"}),e.jsx(We,{className:"text-right",children:"操作"})]})}),e.jsx(Ul,{children:i.map(L=>e.jsxs(ut,{children:[e.jsx(Ke,{children:e.jsx(Ge,{checked:L.enabled,onCheckedChange:()=>C(L)})}),e.jsx(Ke,{children:e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:L.name}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Raw: ",L.raw_prefix]})]})}),e.jsx(Ke,{children:e.jsx(ke,{variant:"outline",children:L.id})}),e.jsx(Ke,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-mono",children:L.priority}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(_,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>H(L,"up"),disabled:L.priority===1,children:e.jsx(Fr,{className:"h-3 w-3"})}),e.jsx(_,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>H(L,"down"),children:e.jsx(Ma,{className:"h-3 w-3"})})]})]})}),e.jsx(Ke,{className:"text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>D(L),children:e.jsx(Gn,{className:"h-4 w-4"})}),e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>M(L.id),children:e.jsx(ns,{className:"h-4 w-4 text-destructive"})})]})})]},L.id))})]})}),e.jsx("div",{className:"md:hidden p-4 space-y-4",children:i.map(L=>e.jsx(Te,{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:L.name}),L.enabled&&e.jsx(ke,{variant:"default",className:"text-xs",children:"启用"})]}),e.jsx(ke,{variant:"outline",className:"mt-1 text-xs",children:L.id})]}),e.jsx(Ge,{checked:L.enabled,onCheckedChange:()=>C(L)})]}),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:L.raw_prefix})]}),e.jsxs("div",{className:"text-muted-foreground",children:[e.jsx("span",{className:"font-medium",children:"优先级: "}),e.jsx("span",{className:"font-mono",children:L.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(L),children:[e.jsx(Gn,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>H(L,"up"),disabled:L.priority===1,children:e.jsx(Fr,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>H(L,"down"),children:e.jsx(Ma,{className:"h-4 w-4"})}),e.jsx(_,{variant:"destructive",size:"sm",onClick:()=>M(L.id),children:e.jsx(ns,{className:"h-4 w-4"})})]})]})},L.id))})]}),e.jsx(Is,{open:N,onOpenChange:v,children:e.jsxs(Ds,{className:"max-w-lg",children:[e.jsxs(Os,{children:[e.jsx(Rs,{children:"添加镜像源"}),e.jsx(Ks,{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(le,{id:"add-id",placeholder:"例如: my-mirror",value:y.id,onChange:L=>R({...y,id:L.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"add-name",children:"名称 *"}),e.jsx(le,{id:"add-name",placeholder:"例如: 我的镜像源",value:y.name,onChange:L=>R({...y,name:L.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"add-raw",children:"Raw 文件前缀 *"}),e.jsx(le,{id:"add-raw",placeholder:"https://example.com/raw",value:y.raw_prefix,onChange:L=>R({...y,raw_prefix:L.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"add-clone",children:"克隆前缀 *"}),e.jsx(le,{id:"add-clone",placeholder:"https://example.com/clone",value:y.clone_prefix,onChange:L=>R({...y,clone_prefix:L.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"add-priority",children:"优先级"}),e.jsx(le,{id:"add-priority",type:"number",min:"1",value:y.priority,onChange:L=>R({...y,priority:parseInt(L.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:y.enabled,onCheckedChange:L=>R({...y,enabled:L})}),e.jsx(T,{htmlFor:"add-enabled",children:"启用此镜像源"})]})]}),e.jsxs(st,{children:[e.jsx(_,{variant:"outline",onClick:()=>v(!1),children:"取消"}),e.jsx(_,{onClick:S,children:"添加"})]})]})}),e.jsx(Is,{open:b,onOpenChange:w,children:e.jsxs(Ds,{className:"max-w-lg",children:[e.jsxs(Os,{children:[e.jsx(Rs,{children:"编辑镜像源"}),e.jsx(Ks,{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(le,{value:y.id,disabled:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit-name",children:"名称 *"}),e.jsx(le,{id:"edit-name",value:y.name,onChange:L=>R({...y,name:L.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit-raw",children:"Raw 文件前缀 *"}),e.jsx(le,{id:"edit-raw",value:y.raw_prefix,onChange:L=>R({...y,raw_prefix:L.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit-clone",children:"克隆前缀 *"}),e.jsx(le,{id:"edit-clone",value:y.clone_prefix,onChange:L=>R({...y,clone_prefix:L.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit-priority",children:"优先级"}),e.jsx(le,{id:"edit-priority",type:"number",min:"1",value:y.priority,onChange:L=>R({...y,priority:parseInt(L.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:y.enabled,onCheckedChange:L=>R({...y,enabled:L})}),e.jsx(T,{htmlFor:"edit-enabled",children:"启用此镜像源"})]})]}),e.jsxs(st,{children:[e.jsx(_,{variant:"outline",onClick:()=>w(!1),children:"取消"}),e.jsx(_,{onClick:B,children:"保存"})]})]})})]})})}function qk({pluginId:l,compact:n=!1}){const[i,c]=d.useState(null),[u,x]=d.useState(!0),[h,f]=d.useState(0),[p,g]=d.useState(""),[N,v]=d.useState(!1),{toast:b}=Zs(),w=async()=>{x(!0);const S=await Kv(l);S&&c(S),x(!1)};d.useEffect(()=>{w()},[l]);const y=async()=>{const S=await Dk(l);S.success?(b({title:"已点赞",description:"感谢你的支持!"}),w()):b({title:"点赞失败",description:S.error||"未知错误",variant:"destructive"})},R=async()=>{const S=await Ok(l);S.success?(b({title:"已反馈",description:"感谢你的反馈!"}),w()):b({title:"操作失败",description:S.error||"未知错误",variant:"destructive"})},A=async()=>{if(h===0){b({title:"请选择评分",description:"至少选择 1 颗星",variant:"destructive"});return}const S=await Rk(l,h,p||void 0);S.success?(b({title:"评分成功",description:"感谢你的评价!"}),v(!1),f(0),g(""),w()):b({title:"评分失败",description:S.error||"未知错误",variant:"destructive"})};return u?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(sa,{className:"h-4 w-4"}),e.jsx("span",{children:"-"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(dn,{className:"h-4 w-4"}),e.jsx("span",{children:"-"})]})]}):i?n?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:`下载量: ${i.downloads.toLocaleString()}`,children:[e.jsx(sa,{className:"h-4 w-4"}),e.jsx("span",{children:i.downloads.toLocaleString()})]}),e.jsxs("div",{className:"flex items-center gap-1",title:`评分: ${i.rating.toFixed(1)} (${i.rating_count} 条评价)`,children:[e.jsx(dn,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),e.jsx("span",{children:i.rating.toFixed(1)})]}),e.jsxs("div",{className:"flex items-center gap-1",title:`点赞数: ${i.likes}`,children:[e.jsx(Nm,{className:"h-4 w-4"}),e.jsx("span",{children:i.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(sa,{className:"h-5 w-5 text-muted-foreground mb-1"}),e.jsx("span",{className:"text-2xl font-bold",children:i.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(dn,{className:"h-5 w-5 text-yellow-400 mb-1 fill-yellow-400"}),e.jsx("span",{className:"text-2xl font-bold",children:i.rating.toFixed(1)}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[i.rating_count," 条评价"]})]}),e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(Nm,{className:"h-5 w-5 text-green-500 mb-1"}),e.jsx("span",{className:"text-2xl font-bold",children:i.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(dg,{className:"h-5 w-5 text-red-500 mb-1"}),e.jsx("span",{className:"text-2xl font-bold",children:i.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:y,children:[e.jsx(Nm,{className:"h-4 w-4 mr-1"}),"点赞"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:R,children:[e.jsx(dg,{className:"h-4 w-4 mr-1"}),"点踩"]}),e.jsxs(Is,{open:N,onOpenChange:v,children:[e.jsx(ed,{asChild:!0,children:e.jsxs(_,{variant:"default",size:"sm",children:[e.jsx(dn,{className:"h-4 w-4 mr-1"}),"评分"]})}),e.jsxs(Ds,{children:[e.jsxs(Os,{children:[e.jsx(Rs,{children:"为插件评分"}),e.jsx(Ks,{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(dn,{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(ot,{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(st,{children:[e.jsx(_,{variant:"outline",onClick:()=>v(!1),children:"取消"}),e.jsx(_,{onClick:A,disabled:h===0,children:"提交评分"})]})]})]})]}),i.recent_ratings&&i.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:i.recent_ratings.map((S,B)=>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(M=>e.jsx(dn,{className:`h-3 w-3 ${M<=S.rating?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},M))}),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})]},B))})]})]}):null}const Kk={"Group Management":"群组管理","Entertainment & Interaction":"娱乐互动","Utility Tools":"实用工具","Content Generation":"内容生成",Multimedia:"多媒体","External Integration":"外部集成","Data Analysis & Insights":"数据分析与洞察",Other:"其他"};function Qk(){const l=ca(),n=y0({strict:!1}),{toast:i}=Zs(),[c,u]=d.useState(null),[x,h]=d.useState(""),[f,p]=d.useState(!0),[g,N]=d.useState(!0),[v,b]=d.useState(null),[w,y]=d.useState(null),[R,A]=d.useState(null),[S,B]=d.useState(!1),[M,C]=d.useState(),[D,H]=d.useState(!1);d.useEffect(()=>{(async()=>{if(!n.pluginId){b("缺少插件 ID"),p(!1);return}try{p(!0),b(null);const fe=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(!fe.ok)throw new Error("获取插件列表失败");const ge=await fe.json();if(!ge.success||!ge.data)throw new Error(ge.error||"获取插件列表失败");const K=JSON.parse(ge.data).find(pe=>pe.id===n.pluginId);if(!K)throw new Error("未找到该插件");const I={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()};u(I);const[ue,Q,Se]=await Promise.all([Pv(),Hv(),Al()]);y(ue),A(Q),B(mn(n.pluginId,Se)),C(xn(n.pluginId,Se))}catch(fe){b(fe instanceof Error?fe.message:"加载失败")}finally{p(!1)}})()},[n.pluginId]),d.useEffect(()=>{(async()=>{if(!c?.manifest?.repository_url){N(!1);return}try{if(N(!0),S&&n.pluginId)try{const Q=await _e(`/api/webui/plugins/local-readme/${n.pluginId}`);if(Q.ok){const Se=await Q.json();if(Se.success&&Se.data){h(Se.data),N(!1);return}}}catch(Q){console.log("本地 README 获取失败,尝试远程获取:",Q)}const fe=c.manifest.repository_url.match(/github\.com\/([^/]+)\/([^/\s]+)/);if(!fe){h("无法解析仓库地址");return}const[,ge,E]=fe,K=E.replace(/\.git$/,""),I=await _e("/api/webui/plugins/fetch-raw",{method:"POST",body:JSON.stringify({owner:ge,repo:K,branch:"main",file_path:"README.md"})});if(!I.ok)throw new Error("获取 README 失败");const ue=await I.json();ue.success&&ue.data?h(ue.data):h("该插件暂无 README 文档")}catch(fe){console.error("加载 README 失败:",fe),h("加载 README 失败")}finally{N(!1)}})()},[c,S,n.pluginId]);const L=()=>!c||!S||!M?!1:M!==c.manifest.version,J=()=>!c||!R?!0:Fv(c.manifest.host_application.min_version,c.manifest.host_application.max_version,R),U=async()=>{if(!(!c||!w?.installed))try{H(!0),await Gv(c.id,c.manifest.repository_url||"","main"),Qv(c.id).catch(fe=>{console.warn("Failed to record download:",fe)}),i({title:"安装成功",description:`${c.manifest.name} 已成功安装`});const re=await Al();B(mn(c.id,re)),C(xn(c.id,re))}catch(re){i({title:"安装失败",description:re instanceof Error?re.message:"未知错误",variant:"destructive"})}finally{H(!1)}},oe=async()=>{if(c)try{H(!0),await Vv(c.id),i({title:"卸载成功",description:`${c.manifest.name} 已成功卸载`});const re=await Al();B(mn(c.id,re)),C(xn(c.id,re))}catch(re){i({title:"卸载失败",description:re instanceof Error?re.message:"未知错误",variant:"destructive"})}finally{H(!1)}},Ne=async()=>{if(!(!c||!w?.installed))try{H(!0);const re=await qv(c.id,c.manifest.repository_url||"","main");i({title:"更新成功",description:`${c.manifest.name} 已从 ${re.old_version} 更新到 ${re.new_version}`});const fe=await Al();B(mn(c.id,fe)),C(xn(c.id,fe))}catch(re){i({title:"更新失败",description:re instanceof Error?re.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:()=>l({to:"/plugins"}),children:e.jsx(Ta,{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(Bs,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件信息中..."})]})]});if(v||!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:()=>l({to:"/plugins"}),children:e.jsx(Ta,{className:"h-5 w-5"})}),e.jsx("div",{children:e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件详情"})})]}),e.jsx(Te,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(_t,{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:v}),e.jsx(_,{onClick:()=>l({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:()=>l({to:"/plugins"}),className:"shrink-0",children:e.jsx(Ta,{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:[L()?e.jsx(_,{disabled:!w?.installed||D,onClick:Ne,title:w?.installed?void 0:"Git 未安装",children:D?e.jsxs(e.Fragment,{children:[e.jsx(Bs,{className:"h-4 w-4 mr-2 animate-spin"}),"更新中..."]}):e.jsxs(e.Fragment,{children:[e.jsx(dt,{className:"h-4 w-4 mr-2"}),"更新"]})}):null,e.jsx(_,{variant:"destructive",disabled:!w?.installed||D,onClick:oe,title:w?.installed?void 0:"Git 未安装",children:D?e.jsxs(e.Fragment,{children:[e.jsx(Bs,{className:"h-4 w-4 mr-2 animate-spin"}),"卸载中..."]}):e.jsxs(e.Fragment,{children:[e.jsx(ns,{className:"h-4 w-4 mr-2"}),"卸载"]})})]}):e.jsx(_,{disabled:!w?.installed||!je||D,onClick:U,title:w?.installed?je?void 0:`不兼容当前版本 (需要 ${c.manifest.host_application.min_version}${c.manifest.host_application.max_version?` - ${c.manifest.host_application.max_version}`:"+"},当前 ${R?.version})`:"Git 未安装",children:D?e.jsxs(e.Fragment,{children:[e.jsx(Bs,{className:"h-4 w-4 mr-2 animate-spin"}),"安装中..."]}):e.jsxs(e.Fragment,{children:[e.jsx(sa,{className:"h-4 w-4 mr-2"}),"安装"]})})})]}),e.jsx(Je,{className:"h-[calc(100vh-200px)] sm:h-[calc(100vh-220px)]",children:e.jsxs("div",{className:"space-y-6 pr-4",children:[e.jsx(Te,{children:e.jsx(Oe,{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(Le,{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(pt,{className:"h-3 w-3 mr-1"}),"已安装 ",M&&`(v${M})`]}),L()&&e.jsxs(ke,{variant:"outline",className:"text-sm border-orange-500 text-orange-500",children:[e.jsx(dt,{className:"h-3 w-3 mr-1"}),"可更新"]}),!je&&e.jsxs(ke,{variant:"destructive",className:"text-sm",children:[e.jsx(_t,{className:"h-3 w-3 mr-1"}),"不兼容"]})]}),e.jsx(ws,{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(Te,{children:[e.jsx(Oe,{children:e.jsx(Le,{className:"text-lg",children:"统计信息"})}),e.jsx(Ae,{children:e.jsx(qk,{pluginId:c.id})})]}),e.jsxs(Te,{children:[e.jsx(Oe,{children:e.jsx(Le,{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(fn,{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(Ao,{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(Rj,{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($o,{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(Ao,{className:"h-3 w-3"})]})]}),c.manifest.repository_url&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(x1,{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(Ao,{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(Ht,{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(Te,{children:[e.jsx(Oe,{children:e.jsx(Le,{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(re=>e.jsx(ke,{variant:"secondary",children:Kk[re]||re},re))})]}),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(re=>e.jsxs(ke,{variant:"outline",className:"text-xs",children:[e.jsx(Zo,{className:"h-3 w-3 mr-1"}),re]},re))})]})]})]})]}),e.jsxs(Te,{className:"lg:col-span-2",children:[e.jsx(Oe,{children:e.jsx(Le,{className:"text-lg",children:"插件说明"})}),e.jsx(Ae,{children:e.jsx(Je,{className:"h-[600px] pr-4",children:g?e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(Bs,{className:"h-6 w-6 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-sm text-muted-foreground",children:"加载说明文档中..."})]}):x?e.jsx(lx,{content:x}):e.jsx("div",{className:"text-center text-muted-foreground py-12",children:"暂无说明文档"})})})]})]})]})})]})}const Ki=d.forwardRef(({className:l,...n},i)=>e.jsx(nj,{ref:i,className:P("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",l),...n}));Ki.displayName=nj.displayName;const Yk=d.forwardRef(({className:l,...n},i)=>e.jsx(rj,{ref:i,className:P("aspect-square h-full w-full",l),...n}));Yk.displayName=rj.displayName;const Qi=d.forwardRef(({className:l,...n},i)=>e.jsx(ij,{ref:i,className:P("flex h-full w-full items-center justify-center rounded-full bg-muted",l),...n}));Qi.displayName=ij.displayName;function Jk(){return"webui_"+Math.random().toString(36).substr(2,9)+"_"+Date.now().toString(36)}function Xk(){const l="maibot_webui_user_id";let n=localStorage.getItem(l);return n||(n=Jk(),localStorage.setItem(l,n)),n}function Zk(){return localStorage.getItem("maibot_webui_user_name")||"WebUI用户"}function Wk(l){localStorage.setItem("maibot_webui_user_name",l)}const Yv="maibot_webui_virtual_tabs";function eC(){try{const l=localStorage.getItem(Yv);if(l)return JSON.parse(l)}catch(l){console.error("[Chat] 加载虚拟标签页失败:",l)}return[]}function Bg(l){try{localStorage.setItem(Yv,JSON.stringify(l))}catch(n){console.error("[Chat] 保存虚拟标签页失败:",n)}}function sC({segment:l}){switch(l.type){case"text":return e.jsx("span",{className:"whitespace-pre-wrap",children:String(l.data)});case"image":case"emoji":return e.jsx("img",{src:String(l.data),alt:l.type==="emoji"?"表情包":"图片",className:P("rounded-lg max-w-full",l.type==="emoji"?"max-h-32":"max-h-64"),loading:"lazy",onError:n=>{const i=n.target;i.style.display="none",i.parentElement?.insertAdjacentHTML("beforeend",`[${l.type==="emoji"?"表情包":"图片"}加载失败]`)}});case"voice":return e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("audio",{controls:!0,src:String(l.data),className:"max-w-[200px] h-8",children:"您的浏览器不支持音频播放"})});case"video":return e.jsx("video",{controls:!0,src:String(l.data),className:"rounded-lg max-w-full max-h-64",children:"您的浏览器不支持视频播放"});case"face":return e.jsxs("span",{className:"text-muted-foreground",children:["[表情:",String(l.data),"]"]});case"music":return e.jsx("span",{className:"text-muted-foreground",children:"[音乐分享]"});case"file":return e.jsxs("span",{className:"text-muted-foreground",children:["[文件: ",String(l.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:["[",l.original_type||"未知消息","]"]})}}function tC({message:l,isBot:n}){return l.message_type==="rich"&&l.segments&&l.segments.length>0?e.jsx("div",{className:"flex flex-col gap-2",children:l.segments.map((i,c)=>e.jsx(sC,{segment:i},c))}):e.jsx("span",{className:"whitespace-pre-wrap",children:l.content})}function aC(){const l={id:"webui-default",type:"webui",label:"WebUI",messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}},n=()=>{const qe=eC().map(Qe=>{const es=Qe.virtualConfig;return!es.groupId&&es.platform&&es.userId&&(es.groupId=`webui_virtual_group_${es.platform}_${es.userId}`),{id:Qe.id,type:"virtual",label:Qe.label,virtualConfig:es,messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}}});return[l,...qe]},[i,c]=d.useState(n),[u,x]=d.useState("webui-default"),h=i.find(q=>q.id===u)||i[0],[f,p]=d.useState(""),[g,N]=d.useState(!1),[v,b]=d.useState(!0),[w,y]=d.useState(Zk()),[R,A]=d.useState(!1),[S,B]=d.useState(""),[M,C]=d.useState(!1),[D,H]=d.useState([]),[L,J]=d.useState([]),[U,oe]=d.useState(!1),[Ne,je]=d.useState(!1),[re,fe]=d.useState(""),[ge,E]=d.useState({platform:"",personId:"",userId:"",userName:"",groupName:"",groupId:""}),K=d.useRef(Xk()),I=d.useRef(new Map),ue=d.useRef(null),Q=d.useRef(new Map),Se=d.useRef(0),pe=d.useRef(new Map),{toast:Ce}=Zs(),z=q=>(Se.current+=1,`${q}-${Date.now()}-${Se.current}-${Math.random().toString(36).substr(2,9)}`),O=d.useCallback((q,qe)=>{c(Qe=>Qe.map(es=>es.id===q?{...es,...qe}:es))},[]),V=d.useCallback((q,qe)=>{c(Qe=>Qe.map(es=>es.id===q?{...es,messages:[...es.messages,qe]}:es))},[]),de=d.useCallback(()=>{ue.current?.scrollIntoView({behavior:"smooth"})},[]);d.useEffect(()=>{de()},[h?.messages,de]);const De=d.useCallback(async()=>{oe(!0);try{const q=await _e("/api/chat/platforms");if(console.log("[Chat] 平台列表响应:",q.status,q.headers.get("content-type")),q.ok){const qe=q.headers.get("content-type");if(qe&&qe.includes("application/json")){const Qe=await q.json();console.log("[Chat] 平台列表数据:",Qe),H(Qe.platforms||[])}else{const Qe=await q.text();console.error("[Chat] 获取平台列表失败: 非 JSON 响应:",Qe.substring(0,200)),Ce({title:"连接失败",description:"无法连接到后端服务,请确保 MaiBot 已启动",variant:"destructive"})}}else console.error("[Chat] 获取平台列表失败: HTTP",q.status),Ce({title:"获取平台失败",description:`服务器返回错误: ${q.status}`,variant:"destructive"})}catch(q){console.error("[Chat] 获取平台列表失败:",q),Ce({title:"网络错误",description:"无法连接到后端服务",variant:"destructive"})}finally{oe(!1)}},[Ce]),W=d.useCallback(async(q,qe)=>{je(!0);try{const Qe=new URLSearchParams;q&&Qe.append("platform",q),qe&&Qe.append("search",qe),Qe.append("limit","50");const es=await _e(`/api/chat/persons?${Qe.toString()}`);if(es.ok){const Ls=es.headers.get("content-type");if(Ls&&Ls.includes("application/json")){const as=await es.json();J(as.persons||[])}else console.error("[Chat] 获取用户列表失败: 后端返回非 JSON 响应")}}catch(Qe){console.error("[Chat] 获取用户列表失败:",Qe)}finally{je(!1)}},[]);d.useEffect(()=>{ge.platform&&W(ge.platform,re)},[ge.platform,re,W]);const Y=d.useCallback(async(q,qe)=>{b(!0);try{const Qe=new URLSearchParams;Qe.append("user_id",K.current),Qe.append("limit","50"),qe&&Qe.append("group_id",qe);const es=`/api/chat/history?${Qe.toString()}`;console.log("[Chat] 正在加载历史消息:",es);const Ls=await _e(es);if(Ls.ok){const as=await Ls.text();try{const Cs=JSON.parse(as);if(Cs.messages&&Cs.messages.length>0){const ze=Cs.messages.map(ls=>({id:ls.id,type:ls.type,content:ls.content,timestamp:ls.timestamp,sender:{name:ls.sender_name||(ls.is_bot?"麦麦":"WebUI用户"),user_id:ls.user_id,is_bot:ls.is_bot}}));O(q,{messages:ze});const Ns=pe.current.get(q)||new Set;ze.forEach(ls=>{if(ls.type==="bot"){const ss=`bot-${ls.content}-${Math.floor(ls.timestamp*1e3)}`;Ns.add(ss)}}),pe.current.set(q,Ns)}}catch(Cs){console.error("[Chat] JSON 解析失败:",Cs)}}}catch(Qe){console.error("[Chat] 加载历史消息失败:",Qe)}finally{b(!1)}},[O]),He=d.useCallback(async(q,qe,Qe)=>{const es=I.current.get(q);if(es?.readyState===WebSocket.OPEN||es?.readyState===WebSocket.CONNECTING){console.log(`[Tab ${q}] WebSocket 已存在,跳过连接`);return}N(!0);let Ls=null;try{const Ns=await _e("/api/webui/ws-token");if(Ns.ok){const ls=await Ns.json();if(ls.success&&ls.token)Ls=ls.token;else{console.warn(`[Tab ${q}] 获取 WebSocket token 失败: ${ls.message||"未登录"}`),N(!1);return}}}catch(Ns){console.error(`[Tab ${q}] 获取 WebSocket token 失败:`,Ns),N(!1);return}if(!Ls){N(!1);return}const as=window.location.protocol==="https:"?"wss:":"ws:",Cs=new URLSearchParams;Cs.append("token",Ls),qe==="virtual"&&Qe?(Cs.append("user_id",Qe.userId),Cs.append("user_name",Qe.userName),Cs.append("platform",Qe.platform),Cs.append("person_id",Qe.personId),Cs.append("group_name",Qe.groupName||"WebUI虚拟群聊"),Qe.groupId&&Cs.append("group_id",Qe.groupId)):(Cs.append("user_id",K.current),Cs.append("user_name",w));const ze=`${as}//${window.location.host}/api/chat/ws?${Cs.toString()}`;console.log(`[Tab ${q}] 正在连接 WebSocket:`,ze);try{const Ns=new WebSocket(ze);I.current.set(q,Ns),Ns.onopen=()=>{O(q,{isConnected:!0}),N(!1),console.log(`[Tab ${q}] WebSocket 已连接`)},Ns.onmessage=ls=>{try{const ss=JSON.parse(ls.data);switch(ss.type){case"session_info":O(q,{sessionInfo:{session_id:ss.session_id,user_id:ss.user_id,user_name:ss.user_name,bot_name:ss.bot_name}});break;case"system":V(q,{id:z("sys"),type:"system",content:ss.content||"",timestamp:ss.timestamp||Date.now()/1e3});break;case"user_message":{const bs=ss.sender?.user_id,gt=qe==="virtual"&&Qe?Qe.userId:K.current;console.log(`[Tab ${q}] 收到 user_message, sender: ${bs}, current: ${gt}`);const $t=bs?bs.replace(/^webui_user_/,""):"",tt=gt?gt.replace(/^webui_user_/,""):"";if($t&&tt&&$t===tt){console.log(`[Tab ${q}] 跳过自己的消息(user_id 匹配)`);break}const Ms=pe.current.get(q)||new Set,Et=`user-${ss.content}-${Math.floor((ss.timestamp||0)*1e3)}`;if(Ms.has(Et)){console.log(`[Tab ${q}] 跳过自己的消息(内容去重)`);break}if(Ms.add(Et),pe.current.set(q,Ms),Ms.size>100){const Bt=Ms.values().next().value;Bt&&Ms.delete(Bt)}V(q,{id:ss.message_id||z("user"),type:"user",content:ss.content||"",timestamp:ss.timestamp||Date.now()/1e3,sender:ss.sender});break}case"bot_message":{O(q,{isTyping:!1});const bs=pe.current.get(q)||new Set,gt=`bot-${ss.content}-${Math.floor((ss.timestamp||0)*1e3)}`;if(bs.has(gt))break;if(bs.add(gt),pe.current.set(q,bs),bs.size>100){const $t=bs.values().next().value;$t&&bs.delete($t)}c($t=>$t.map(tt=>{if(tt.id!==q)return tt;const Ms=tt.messages.filter(Bt=>Bt.type!=="thinking"),Et={id:z("bot"),type:"bot",content:ss.content||"",message_type:ss.message_type==="rich"?"rich":"text",segments:ss.segments,timestamp:ss.timestamp||Date.now()/1e3,sender:ss.sender};return{...tt,messages:[...Ms,Et]}}));break}case"typing":O(q,{isTyping:ss.is_typing||!1});break;case"error":c(bs=>bs.map(gt=>{if(gt.id!==q)return gt;const $t=gt.messages.filter(tt=>tt.type!=="thinking");return{...gt,messages:[...$t,{id:z("error"),type:"error",content:ss.content||"发生错误",timestamp:ss.timestamp||Date.now()/1e3}]}})),Ce({title:"错误",description:ss.content,variant:"destructive"});break;case"pong":break;case"history":{const bs=ss.messages||[];if(bs.length>0){const gt=pe.current.get(q)||new Set,$t=bs.map(tt=>{const Ms=tt.is_bot||!1,Et=tt.id||z(Ms?"bot":"user"),Bt=`${Ms?"bot":"user"}-${tt.content}-${Math.floor(tt.timestamp*1e3)}`;return gt.add(Bt),{id:Et,type:Ms?"bot":"user",content:tt.content,timestamp:tt.timestamp,sender:{name:tt.sender_name||(Ms?"麦麦":"用户"),user_id:tt.sender_id,is_bot:Ms}}});pe.current.set(q,gt),O(q,{messages:$t}),console.log(`[Tab ${q}] 已加载 ${$t.length} 条历史消息`)}break}default:console.log("未知消息类型:",ss.type)}}catch(ss){console.error("解析消息失败:",ss)}},Ns.onclose=()=>{O(q,{isConnected:!1}),N(!1),I.current.delete(q),console.log(`[Tab ${q}] WebSocket 已断开`);const ls=Q.current.get(q);ls&&clearTimeout(ls);const ss=window.setTimeout(()=>{if(!F.current){const bs=i.find(gt=>gt.id===q);bs&&He(q,bs.type,bs.virtualConfig)}},5e3);Q.current.set(q,ss)},Ns.onerror=ls=>{console.error(`[Tab ${q}] WebSocket 错误:`,ls),N(!1)}}catch(Ns){console.error(`[Tab ${q}] 创建 WebSocket 失败:`,Ns),N(!1)}},[w,O,V,Ce,i]),F=d.useRef(!1);d.useEffect(()=>{F.current=!1;const q=I.current,qe=Q.current,Qe=pe.current;Y("webui-default");const es=setTimeout(()=>{F.current||(He("webui-default","webui"),i.forEach(as=>{as.type==="virtual"&&as.virtualConfig&&(Qe.set(as.id,new Set),setTimeout(()=>{F.current||He(as.id,"virtual",as.virtualConfig)},200))}))},100),Ls=setInterval(()=>{q.forEach(as=>{as.readyState===WebSocket.OPEN&&as.send(JSON.stringify({type:"ping"}))})},3e4);return()=>{F.current=!0,clearTimeout(es),clearInterval(Ls),qe.forEach(as=>{clearTimeout(as)}),qe.clear(),q.forEach(as=>{as.close()}),q.clear()}},[]);const ee=d.useCallback(()=>{const q=I.current.get(u);if(!f.trim()||!q||q.readyState!==WebSocket.OPEN)return;const qe=h?.type==="virtual"&&h.virtualConfig?.userName||w,Qe=f.trim(),es=Date.now()/1e3;q.send(JSON.stringify({type:"message",content:Qe,user_name:qe}));const Ls=pe.current.get(u)||new Set,as=`user-${Qe}-${Math.floor(es*1e3)}`;if(Ls.add(as),pe.current.set(u,Ls),Ls.size>100){const Ns=Ls.values().next().value;Ns&&Ls.delete(Ns)}const Cs={id:z("user"),type:"user",content:Qe,timestamp:es,sender:{name:qe,is_bot:!1}};V(u,Cs);const ze={id:z("thinking"),type:"thinking",content:"",timestamp:es+.001,sender:{name:h?.sessionInfo.bot_name||"麦麦",is_bot:!0}};V(u,ze),p("")},[f,w,u,h,V]),Ue=q=>{q.key==="Enter"&&!q.shiftKey&&(q.preventDefault(),ee())},ie=()=>{B(w),A(!0)},Ee=()=>{const q=S.trim()||"WebUI用户";y(q),Wk(q),A(!1);const qe=I.current.get(u);qe?.readyState===WebSocket.OPEN&&qe.send(JSON.stringify({type:"update_nickname",user_name:q}))},me=()=>{B(""),A(!1)},Me=q=>new Date(q*1e3).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}),rs=()=>{const q=I.current.get(u);q&&(q.close(),I.current.delete(u)),He(u,h?.type||"webui",h?.virtualConfig)},Ut=()=>{E({platform:"",personId:"",userId:"",userName:"",groupName:"",groupId:""}),fe(""),De(),C(!0)},aa=()=>{if(!ge.platform||!ge.personId){Ce({title:"配置不完整",description:"请选择平台和用户",variant:"destructive"});return}const q=`webui_virtual_group_${ge.platform}_${ge.userId}`,qe=`virtual-${ge.platform}-${ge.userId}-${Date.now()}`,Qe=ge.userName||ge.userId,es={id:qe,type:"virtual",label:Qe,virtualConfig:{...ge,groupId:q},messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}};c(Ls=>{const as=[...Ls,es],Cs=as.filter(ze=>ze.type==="virtual"&&ze.virtualConfig).map(ze=>({id:ze.id,label:ze.label,virtualConfig:ze.virtualConfig,createdAt:Date.now()}));return Bg(Cs),as}),x(qe),C(!1),pe.current.set(qe,new Set),setTimeout(()=>{He(qe,"virtual",ge)},100),Ce({title:"虚拟身份标签页",description:`已创建 ${Qe} 的对话`})},Qa=(q,qe)=>{if(qe?.stopPropagation(),q==="webui-default")return;const Qe=I.current.get(q);Qe&&(Qe.close(),I.current.delete(q));const es=Q.current.get(q);es&&(clearTimeout(es),Q.current.delete(q)),pe.current.delete(q),c(Ls=>{const as=Ls.filter(ze=>ze.id!==q),Cs=as.filter(ze=>ze.type==="virtual"&&ze.virtualConfig).map(ze=>({id:ze.id,label:ze.label,virtualConfig:ze.virtualConfig,createdAt:Date.now()}));return Bg(Cs),as}),u===q&&x("webui-default")},Ft=q=>{x(q)},mt=q=>{E(qe=>({...qe,personId:q.person_id,userId:q.user_id,userName:q.nickname||q.person_name}))};return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(Is,{open:M,onOpenChange:C,children:e.jsxs(Ds,{className:"sm:max-w-[500px] max-h-[85vh] overflow-hidden flex flex-col",children:[e.jsxs(Os,{children:[e.jsxs(Rs,{className:"flex items-center gap-2",children:[e.jsx(bm,{className:"h-5 w-5"}),"新建虚拟身份对话"]}),e.jsx(Ks,{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($o,{className:"h-4 w-4"}),"选择平台"]}),e.jsxs(Ie,{value:ge.platform,onValueChange:q=>{E(qe=>({...qe,platform:q,personId:"",userId:"",userName:""})),J([])},children:[e.jsx($e,{disabled:U,children:e.jsx(Pe,{placeholder:U?"加载中...":"选择平台"})}),e.jsx(Be,{children:D.map(q=>e.jsxs(Z,{value:q.platform,children:[q.platform," (",q.count," 人)"]},q.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(tc,{className:"h-4 w-4"}),"选择用户"]}),e.jsxs("div",{className:"relative",children:[e.jsx(Tt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(le,{placeholder:"搜索用户名...",value:re,onChange:q=>fe(q.target.value),className:"pl-9"})]}),e.jsx(Je,{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(Bs,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):L.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground",children:[e.jsx(tc,{className:"h-8 w-8 mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"没有找到用户"})]}):e.jsx("div",{className:"space-y-1",children:L.map(q=>e.jsxs("button",{onClick:()=>mt(q),className:P("w-full flex items-center gap-3 p-2 rounded-md text-left transition-colors",ge.personId===q.person_id?"bg-primary text-primary-foreground":"hover:bg-muted"),children:[e.jsx(Ki,{className:"h-8 w-8 shrink-0",children:e.jsx(Qi,{className:P("text-xs",ge.personId===q.person_id?"bg-primary-foreground/20":"bg-muted"),children:(q.nickname||q.person_name||"?").charAt(0)})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-medium truncate",children:q.nickname||q.person_name}),e.jsxs("div",{className:P("text-xs truncate",ge.personId===q.person_id?"text-primary-foreground/70":"text-muted-foreground"),children:["ID: ",q.user_id,q.is_known&&" · 已认识"]})]})]},q.person_id))})})})]}),ge.personId&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"虚拟群名(可选)"}),e.jsx(le,{placeholder:"WebUI虚拟群聊",value:ge.groupName,onChange:q=>E(qe=>({...qe,groupName:q.target.value}))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦会认为这是一个名为此名称的群聊"})]})]}),e.jsxs(st,{className:"gap-2 sm:gap-0",children:[e.jsx(_,{variant:"outline",onClick:()=>C(!1),children:"取消"}),e.jsx(_,{onClick:aa,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:[i.map(q=>e.jsxs("div",{className:P("flex items-center gap-1.5 px-3 py-1.5 rounded-md text-sm whitespace-nowrap transition-colors cursor-pointer","hover:bg-muted",u===q.id?"bg-background shadow-sm border":"text-muted-foreground"),onClick:()=>Ft(q.id),children:[q.type==="webui"?e.jsx(za,{className:"h-3.5 w-3.5"}):e.jsx(bm,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"max-w-[100px] truncate",children:q.label}),e.jsx("span",{className:P("w-1.5 h-1.5 rounded-full",q.isConnected?"bg-green-500":"bg-muted-foreground/50")}),q.id!=="webui-default"&&e.jsx("span",{onClick:qe=>Qa(q.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(),Qa(q.id,qe))},children:e.jsx(Ea,{className:"h-3 w-3"})})]},q.id)),e.jsx("button",{onClick:Ut,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(et,{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(Ki,{className:"h-8 w-8 sm:h-10 sm:w-10 shrink-0",children:e.jsx(Qi,{className:"bg-primary/10 text-primary",children:e.jsx(Pn,{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(Bs,{className:"h-3 w-3 animate-spin"}),e.jsx("span",{children:"连接中..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(f1,{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:[v&&e.jsx(Bs,{className:"h-4 w-4 animate-spin text-muted-foreground"}),e.jsx(_,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:rs,disabled:g,title:"重新连接",children:e.jsx(dt,{className:P("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(bm,{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(fn,{className:"h-3 w-3"}),e.jsx("span",{children:"当前身份:"}),R?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(le,{value:S,onChange:q=>B(q.target.value),onKeyDown:q=>{q.key==="Enter"&&Ee(),q.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:w}),e.jsx(_,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:ie,title:"修改昵称",children:e.jsx(p1,{className:"h-3 w-3"})})]})]})})]})}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(Je,{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&&!v&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[e.jsx(Pn,{className:"h-12 w-12 mb-4 opacity-50"}),e.jsxs("p",{className:"text-sm",children:["开始与 ",h?.sessionInfo.bot_name||"麦麦"," 对话吧!"]})]}),h?.messages.map(q=>e.jsxs("div",{className:P("flex gap-2 sm:gap-3",q.type==="user"&&"flex-row-reverse",q.type==="system"&&"justify-center",q.type==="error"&&"justify-center"),children:[q.type==="system"&&e.jsx("div",{className:"text-xs text-muted-foreground bg-muted/50 px-3 py-1 rounded-full max-w-[90%]",children:q.content}),q.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:q.content}),q.type==="thinking"&&e.jsxs(e.Fragment,{children:[e.jsx(Ki,{className:"h-7 w-7 sm:h-8 sm:w-8 shrink-0",children:e.jsx(Qi,{className:"bg-primary/10 text-primary",children:e.jsx(Pn,{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:q.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:"思考中..."})]})})]})]}),(q.type==="user"||q.type==="bot")&&e.jsxs(e.Fragment,{children:[e.jsx(Ki,{className:"h-7 w-7 sm:h-8 sm:w-8 shrink-0",children:e.jsx(Qi,{className:P("text-xs",q.type==="bot"?"bg-primary/10 text-primary":"bg-secondary text-secondary-foreground"),children:q.type==="bot"?e.jsx(Pn,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"}):e.jsx(fn,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"})})}),e.jsxs("div",{className:P("flex flex-col gap-1 max-w-[75%] sm:max-w-[70%]",q.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:q.sender?.name||(q.type==="bot"?h?.sessionInfo.bot_name:w)}),e.jsx("span",{children:Me(q.timestamp)})]}),e.jsx("div",{className:P("rounded-2xl px-3 py-2 text-sm break-words",q.type==="bot"?"bg-muted rounded-tl-sm":"bg-primary text-primary-foreground rounded-tr-sm"),children:e.jsx(tC,{message:q,isBot:q.type==="bot"})})]})]})]},q.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(le,{value:f,onChange:q=>p(q.target.value),onKeyDown:Ue,placeholder:h?.isConnected?"输入消息...":"等待连接...",disabled:!h?.isConnected,className:"flex-1 h-10 sm:h-10"}),e.jsx(_,{onClick:ee,disabled:!h?.isConnected||!f.trim(),size:"icon",className:"h-10 w-10 shrink-0",children:e.jsx(g1,{className:"h-4 w-4"})})]})})})]})}var xx="Radio",[lC,Jv]=Qo(xx),[nC,rC]=lC(xx),Xv=d.forwardRef((l,n)=>{const{__scopeRadio:i,name:c,checked:u=!1,required:x,disabled:h,value:f="on",onCheck:p,form:g,...N}=l,[v,b]=d.useState(null),w=Yo(n,A=>b(A)),y=d.useRef(!1),R=v?g||!!v.closest("form"):!0;return e.jsxs(nC,{scope:i,checked:u,disabled:h,children:[e.jsx(Yn.button,{type:"button",role:"radio","aria-checked":u,"data-state":sN(u),"data-disabled":h?"":void 0,disabled:h,value:f,...N,ref:w,onClick:hn(l.onClick,A=>{u||p?.(),R&&(y.current=A.isPropagationStopped(),y.current||A.stopPropagation())})}),R&&e.jsx(eN,{control:v,bubbles:!y.current,name:c,value:f,checked:u,required:x,disabled:h,form:g,style:{transform:"translateX(-100%)"}})]})});Xv.displayName=xx;var Zv="RadioIndicator",Wv=d.forwardRef((l,n)=>{const{__scopeRadio:i,forceMount:c,...u}=l,x=rC(Zv,i);return e.jsx(Rw,{present:c||x.checked,children:e.jsx(Yn.span,{"data-state":sN(x.checked),"data-disabled":x.disabled?"":void 0,...u,ref:n})})});Wv.displayName=Zv;var iC="RadioBubbleInput",eN=d.forwardRef(({__scopeRadio:l,control:n,checked:i,bubbles:c=!0,...u},x)=>{const h=d.useRef(null),f=Yo(h,x),p=Lw(i),g=Uw(n);return d.useEffect(()=>{const N=h.current;if(!N)return;const v=window.HTMLInputElement.prototype,w=Object.getOwnPropertyDescriptor(v,"checked").set;if(p!==i&&w){const y=new Event("click",{bubbles:c});w.call(N,i),N.dispatchEvent(y)}},[p,i,c]),e.jsx(Yn.input,{type:"radio","aria-hidden":!0,defaultChecked:i,...u,tabIndex:-1,ref:f,style:{...u.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});eN.displayName=iC;function sN(l){return l?"checked":"unchecked"}var cC=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],id="RadioGroup",[oC]=Qo(id,[cj,Jv]),tN=cj(),aN=Jv(),[dC,uC]=oC(id),lN=d.forwardRef((l,n)=>{const{__scopeRadioGroup:i,name:c,defaultValue:u,value:x,required:h=!1,disabled:f=!1,orientation:p,dir:g,loop:N=!0,onValueChange:v,...b}=l,w=tN(i),y=kj(g),[R,A]=Ko({prop:x,defaultProp:u??null,onChange:v,caller:id});return e.jsx(dC,{scope:i,name:c,required:h,disabled:f,value:R,onValueChange:A,children:e.jsx(X0,{asChild:!0,...w,orientation:p,dir:y,loop:N,children:e.jsx(Yn.div,{role:"radiogroup","aria-required":h,"aria-orientation":p,"data-disabled":f?"":void 0,dir:y,...b,ref:n})})})});lN.displayName=id;var nN="RadioGroupItem",rN=d.forwardRef((l,n)=>{const{__scopeRadioGroup:i,disabled:c,...u}=l,x=uC(nN,i),h=x.disabled||c,f=tN(i),p=aN(i),g=d.useRef(null),N=Yo(n,g),v=x.value===u.value,b=d.useRef(!1);return d.useEffect(()=>{const w=R=>{cC.includes(R.key)&&(b.current=!0)},y=()=>b.current=!1;return document.addEventListener("keydown",w),document.addEventListener("keyup",y),()=>{document.removeEventListener("keydown",w),document.removeEventListener("keyup",y)}},[]),e.jsx(Z0,{asChild:!0,...f,focusable:!h,active:v,children:e.jsx(Xv,{disabled:h,required:x.required,checked:v,...p,...u,name:x.name,ref:N,onCheck:()=>x.onValueChange(u.value),onKeyDown:hn(w=>{w.key==="Enter"&&w.preventDefault()}),onFocus:hn(u.onFocus,()=>{b.current&&g.current?.click()})})})});rN.displayName=nN;var mC="RadioGroupIndicator",iN=d.forwardRef((l,n)=>{const{__scopeRadioGroup:i,...c}=l,u=aN(i);return e.jsx(Wv,{...u,...c,ref:n})});iN.displayName=mC;var cN=lN,oN=rN,xC=iN;const hx=d.forwardRef(({className:l,...n},i)=>e.jsx(cN,{className:P("grid gap-2",l),...n,ref:i}));hx.displayName=cN.displayName;const Vo=d.forwardRef(({className:l,...n},i)=>e.jsx(oN,{ref:i,className:P("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",l),...n,children:e.jsx(xC,{className:"flex items-center justify-center",children:e.jsx(Uo,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Vo.displayName=oN.displayName;function hC({question:l,value:n,onChange:i,error:c,disabled:u=!1}){const[x,h]=d.useState(null),f=u||l.readOnly,p=()=>{switch(l.type){case"single":return e.jsx(hx,{value:n||"",onValueChange:i,disabled:f,className:"space-y-2",children:l.options?.map(g=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Vo,{value:g.value,id:`${l.id}-${g.id}`}),e.jsx(T,{htmlFor:`${l.id}-${g.id}`,className:"cursor-pointer font-normal",children:g.label})]},g.id))});case"multiple":{const g=n||[];return e.jsxs("div",{className:"space-y-2",children:[l.options?.map(N=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qs,{id:`${l.id}-${N.id}`,checked:g.includes(N.value),disabled:f||l.maxSelections!==void 0&&g.length>=l.maxSelections&&!g.includes(N.value),onCheckedChange:v=>{i(v?[...g,N.value]:g.filter(b=>b!==N.value))}}),e.jsx(T,{htmlFor:`${l.id}-${N.id}`,className:"cursor-pointer font-normal",children:N.label})]},N.id)),l.maxSelections&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["最多选择 ",l.maxSelections," 项"]})]})}case"text":return e.jsx(le,{value:n||"",onChange:g=>i(g.target.value),placeholder:l.placeholder||"请输入...",disabled:f,readOnly:l.readOnly,maxLength:l.maxLength,className:P(l.readOnly&&"bg-muted cursor-not-allowed")});case"textarea":return e.jsxs("div",{className:"space-y-1",children:[e.jsx(ot,{value:n||"",onChange:g=>i(g.target.value),placeholder:l.placeholder||"请输入...",disabled:f,readOnly:l.readOnly,maxLength:l.maxLength,rows:4,className:P(l.readOnly&&"bg-muted cursor-not-allowed")}),l.maxLength&&e.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[(n||"").length," / ",l.maxLength]})]});case"rating":{const g=n||0,N=x!==null?x:g;return e.jsxs("div",{className:"flex items-center gap-1",children:[[1,2,3,4,5].map(v=>e.jsx("button",{type:"button",disabled:f,className:P("p-1 transition-colors focus:outline-none focus:ring-2 focus:ring-ring rounded",f&&"cursor-not-allowed opacity-50"),onMouseEnter:()=>!f&&h(v),onMouseLeave:()=>h(null),onClick:()=>!f&&i(v),children:e.jsx(dn,{className:P("h-6 w-6 transition-colors",v<=N?"fill-yellow-400 text-yellow-400":"text-muted-foreground")})},v)),g>0&&e.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:[g," / 5"]})]})}case"scale":{const g=l.min??1,N=l.max??10,v=l.step??1,b=n??g;return e.jsxs("div",{className:"space-y-4",children:[e.jsx(qa,{value:[b],onValueChange:([w])=>i(w),min:g,max:N,step:v,disabled:f}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:l.minLabel||g}),e.jsx("span",{className:"font-medium text-foreground",children:b}),e.jsx("span",{children:l.maxLabel||N})]})]})}case"dropdown":return e.jsxs(Ie,{value:n||"",onValueChange:i,disabled:f,children:[e.jsx($e,{children:e.jsx(Pe,{placeholder:l.placeholder||"请选择..."})}),e.jsx(Be,{children:l.options?.map(g=>e.jsx(Z,{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:[l.title,l.required&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),l.description&&e.jsx("p",{className:"text-sm text-muted-foreground",children:l.description})]}),p(),c&&e.jsx("p",{className:"text-sm text-destructive",children:c})]})}const dN="https://maibot-plugin-stats.maibot-webui.workers.dev";function uN(){const l="maibot_user_id";let n=localStorage.getItem(l);if(!n){const i=Math.random().toString(36).substring(2,10),c=Date.now().toString(36),u=Math.random().toString(36).substring(2,10);n=`fp_${i}_${c}_${u}`,localStorage.setItem(l,n)}return n}async function fC(l,n,i,c){try{const u=c?.userId||uN(),x={surveyId:l,surveyVersion:n,userId:u,answers:i,submittedAt:new Date().toISOString(),allowMultiple:c?.allowMultiple,metadata:{userAgent:navigator.userAgent,language:navigator.language}},h=await fetch(`${dN}/survey/submit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(x)}),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(u){return console.error("Error submitting survey:",u),{success:!1,error:"网络错误"}}}async function pC(l,n){try{const i=n||uN(),c=new URLSearchParams({user_id:i,survey_id:l}),u=await fetch(`${dN}/survey/check?${c}`);return u.ok?{success:!0,hasSubmitted:(await u.json()).hasSubmitted}:{success:!1,error:(await u.json()).error||"检查失败"}}catch(i){return console.error("Error checking submission:",i),{success:!1,error:"网络错误"}}}function mN({config:l,initialAnswers:n,onSubmitSuccess:i,onSubmitError:c,showProgress:u=!0,paginateQuestions:x=!1,className:h}){const f=d.useCallback(()=>!n||n.length===0?{}:n.reduce((I,ue)=>(I[ue.questionId]=ue.value,I),{}),[n]),[p,g]=d.useState(()=>f()),[N,v]=d.useState({}),[b,w]=d.useState(0),[y,R]=d.useState(!1),[A,S]=d.useState(!1),[B,M]=d.useState(null),[C,D]=d.useState(null),[H,L]=d.useState(!1),[J,U]=d.useState(!0);d.useEffect(()=>{n&&n.length>0&&g(I=>({...I,...f()}))},[n,f]),d.useEffect(()=>{(async()=>{if(!l.settings?.allowMultiple){const ue=await pC(l.id);ue.success&&ue.hasSubmitted&&L(!0)}U(!1)})()},[l.id,l.settings?.allowMultiple]);const oe=d.useCallback(()=>{const I=new Date;return!(l.settings?.startTime&&new Date(l.settings.startTime)>I||l.settings?.endTime&&new Date(l.settings.endTime){const ue=p[I.id];return ue==null?!1:Array.isArray(ue)?ue.length>0:typeof ue=="string"?ue.trim()!=="":!0}).length,je=Ne/l.questions.length*100,re=d.useCallback((I,ue)=>{g(Q=>({...Q,[I]:ue})),v(Q=>{const Se={...Q};return delete Se[I],Se})},[]),fe=d.useCallback(()=>{const I={};for(const ue of l.questions){if(ue.required){const Q=p[ue.id];if(Q==null){I[ue.id]="此题为必填项";continue}if(Array.isArray(Q)&&Q.length===0){I[ue.id]="请至少选择一项";continue}if(typeof Q=="string"&&Q.trim()===""){I[ue.id]="此题为必填项";continue}}ue.minLength&&typeof p[ue.id]=="string"&&p[ue.id].length{if(!fe()){if(x){const I=l.questions.findIndex(ue=>N[ue.id]);I>=0&&w(I)}return}R(!0),M(null);try{const I=l.questions.filter(Q=>p[Q.id]!==void 0).map(Q=>({questionId:Q.id,value:p[Q.id]})),ue=await fC(l.id,l.version,I,{allowMultiple:l.settings?.allowMultiple});if(ue.success&&ue.submissionId)S(!0),D(ue.submissionId),i?.(ue.submissionId);else{const Q=ue.error||"提交失败";M(Q),c?.(Q)}}catch(I){const ue=I instanceof Error?I.message:"提交失败";M(ue),c?.(ue)}finally{R(!1)}},[fe,x,l,p,N,i,c]),E=d.useCallback(I=>{I>=0&&Ie.jsxs("div",{className:P("p-4 rounded-lg border bg-card",N[I.id]?"border-destructive bg-destructive/5":"border-border"),children:[x&&e.jsxs("div",{className:"text-xs text-muted-foreground mb-2",children:["问题 ",b+1," / ",l.questions.length]}),!x&&e.jsxs("div",{className:"text-xs text-muted-foreground mb-2",children:[ue+1,"."]}),e.jsx(hC,{question:I,value:p[I.id],onChange:Q=>re(I.id,Q),error:N[I.id],disabled:y})]},I.id)),B&&e.jsxs(at,{variant:"destructive",children:[e.jsx(_t,{className:"h-4 w-4"}),e.jsx(lt,{children:B})]}),e.jsx("div",{className:"flex justify-between items-center py-4",children:x?e.jsxs(e.Fragment,{children:[e.jsxs(_,{variant:"outline",onClick:()=>E(b-1),disabled:b===0||y,children:[e.jsx(Aa,{className:"h-4 w-4 mr-1"}),"上一题"]}),b===l.questions.length-1?e.jsxs(_,{onClick:ge,disabled:y,children:[y&&e.jsx(Bs,{className:"h-4 w-4 mr-2 animate-spin"}),"提交问卷"]}):e.jsxs(_,{onClick:()=>E(b+1),disabled:y,children:["下一题",e.jsx(Zt,{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:ge,disabled:y,size:"lg",children:[y&&e.jsx(Bs,{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:"感谢你的反馈!你的意见对我们非常重要,我们会认真考虑每一条建议。"}},jC={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 vC(){const[l,n]=d.useState(!0),i=d.useMemo(()=>JSON.parse(JSON.stringify(gC)),[]);d.useEffect(()=>{n(!1)},[]);const c=d.useMemo(()=>[{questionId:"webui_version",value:`v${sd}`}],[]),u=d.useCallback(h=>{console.log("WebUI Survey submitted:",h)},[]),x=d.useCallback(h=>{console.error("WebUI Survey submission error:",h)},[]);return l?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx(Bs,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):i?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(Gj,{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(mN,{config:i,initialAnswers:c,showProgress:!0,paginateQuestions:!1,onSubmitSuccess:u,onSubmitError:x})})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-4",children:[e.jsxs(at,{variant:"destructive",className:"max-w-md",children:[e.jsx(_t,{className:"h-4 w-4"}),e.jsx(lt,{children:"无法加载问卷配置"})]}),e.jsx(_,{variant:"outline",onClick:()=>window.location.reload(),children:"重试"})]})}function NC(){const[l,n]=d.useState(null),[i,c]=d.useState(!0),[u,x]=d.useState("未知版本");d.useEffect(()=>{(async()=>{try{const v=await d_();x(v.version||"未知版本")}catch(v){console.error("Failed to get MaiBot version:",v),x("获取失败")}const N=JSON.parse(JSON.stringify(jC));n(N),c(!1)})()},[]);const h=d.useMemo(()=>[{questionId:"maibot_version",value:u}],[u]),f=d.useCallback(g=>{console.log("MaiBot Survey submitted:",g)},[]),p=d.useCallback(g=>{console.error("MaiBot Survey submission error:",g)},[]);return i?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx(Bs,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):l?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(Gj,{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(mN,{config:l,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(at,{variant:"destructive",className:"max-w-md",children:[e.jsx(_t,{className:"h-4 w-4"}),e.jsx(lt,{children:"无法加载问卷配置"})]}),e.jsx(_,{variant:"outline",onClick:()=>window.location.reload(),children:"重试"})]})}async function bC(l=2025){const n=await _e(`/api/webui/annual-report/full?year=${l}`);if(!n.ok){const i=await n.json();throw new Error(i.detail||"获取年度报告失败")}return n.json()}const Ig=["#0088FE","#00C49F","#FFBB28","#FF8042","#8884d8","#82ca9d"];function yC(){const[l]=d.useState(2025),[n,i]=d.useState(null),[c,u]=d.useState(!0),[x,h]=d.useState(null),f=d.useRef(null),p=d.useCallback(async()=>{try{u(!0),h(null);const g=await bC(l);i(g)}catch(g){h(g instanceof Error?g:new Error("获取年度报告失败"))}finally{u(!1)}},[l]);return d.useEffect(()=>{p()},[p]),c?e.jsx(wC,{}):x?e.jsxs("div",{className:"flex h-screen items-center justify-center text-red-500",children:["获取年度报告失败: ",x.message]}):n?e.jsx(Je,{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",children:e.jsxs("div",{className:"mx-auto max-w-5xl space-y-8 print:space-y-4",ref:f,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.jsxs("div",{className:"relative z-10 flex flex-col items-center text-center",children:[e.jsx(Pn,{className:"mb-4 h-16 w-16 animate-bounce"}),e.jsxs("h1",{className:"text-4xl font-bold tracking-tighter sm:text-6xl",children:["麦麦 ",n.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(Bo,{className:"h-4 w-4"}),e.jsxs("span",{children:["生成时间: ",n.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(ka,{title:"年度在线时长",value:`${n.time_footprint.total_online_hours} 小时`,description:"相当于陪伴大家绕了太阳一圈",icon:e.jsx(na,{className:"h-4 w-4"})}),e.jsx(ka,{title:"最忙碌的一天",value:n.time_footprint.busiest_day||"N/A",description:`处理了 ${n.time_footprint.busiest_day_count} 条消息`,icon:e.jsx(Bo,{className:"h-4 w-4"})}),e.jsx(ka,{title:"深夜互动 (0-4点)",value:`${n.time_footprint.midnight_chat_count} 次`,description:"在万籁俱寂时交换秘密",icon:e.jsx(Yi,{className:"h-4 w-4"})}),e.jsx(ka,{title:"作息属性",value:n.time_footprint.is_night_owl?"夜猫子":"早起鸟",description:n.time_footprint.is_night_owl?"越夜越精神":"早睡早起身体好",icon:n.time_footprint.is_night_owl?e.jsx(Yi,{className:"h-4 w-4"}):e.jsx(qm,{className:"h-4 w-4"})})]}),e.jsxs(Te,{className:"overflow-hidden",children:[e.jsxs(Oe,{children:[e.jsx(Le,{children:"24小时活跃时钟"}),e.jsx(ws,{children:"麦麦在一天中各个时段的活跃程度"})]}),e.jsx(Ae,{className:"h-[300px]",children:e.jsx(uj,{width:"100%",height:"100%",children:e.jsxs(zo,{data:n.time_footprint.hourly_distribution.map((g,N)=>({hour:`${N}点`,count:g})),children:[e.jsx(Fi,{strokeDasharray:"3 3",vertical:!1}),e.jsx(Gi,{dataKey:"hour"}),e.jsx($r,{}),e.jsx(mj,{contentStyle:{borderRadius:"8px",border:"none",boxShadow:"0 4px 12px rgba(0,0,0,0.1)"},cursor:{fill:"transparent"}}),e.jsx(Vi,{dataKey:"count",fill:"hsl(var(--primary))",radius:[4,4,0,0]})]})})})]}),n.time_footprint.first_message_time&&e.jsx(Te,{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:n.time_footprint.first_message_time}),e.jsxs("p",{className:"text-lg",children:[e.jsx("span",{className:"font-semibold text-foreground",children:n.time_footprint.first_message_user})," 说:",e.jsxs("span",{className:"italic text-muted-foreground",children:['"',n.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(tc,{className:"h-8 w-8"}),e.jsx("h2",{children:"社交网络"})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsx(ka,{title:"社交圈子",value:`${n.social_network.total_groups} 个群组`,description:`今年新认识了 ${n.social_network.new_friends_count} 位朋友`,icon:e.jsx(tc,{className:"h-4 w-4"})}),e.jsx(ka,{title:"被呼叫次数",value:`${n.social_network.at_count+n.social_network.mentioned_count} 次`,description:"我的名字被大家频繁提起",icon:e.jsx(j1,{className:"h-4 w-4"})}),e.jsx(ka,{title:"最长情陪伴",value:n.social_network.longest_companion_user||"N/A",description:`始终都在,已陪伴 ${n.social_network.longest_companion_days} 天`,icon:e.jsx(qr,{className:"h-4 w-4 text-red-500"})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(Te,{children:[e.jsx(Oe,{children:e.jsx(Le,{children:"话痨群组 TOP3"})}),e.jsx(Ae,{children:e.jsx("div",{className:"space-y-4",children:n.social_network.top_groups.map((g,N)=>e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ke,{variant:N===0?"default":"secondary",className:"h-6 w-6 rounded-full p-0 flex items-center justify-center",children:N+1}),e.jsx("span",{className:"font-medium truncate max-w-[150px]",children:g.group_name})]}),e.jsxs("span",{className:"text-muted-foreground text-sm",children:[g.message_count," 条消息"]})]},g.group_id))})})]}),e.jsxs(Te,{children:[e.jsx(Oe,{children:e.jsx(Le,{children:"年度最佳损友 TOP3"})}),e.jsx(Ae,{children:e.jsx("div",{className:"space-y-4",children:n.social_network.top_users.map((g,N)=>e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ke,{variant:N===0?"default":"secondary",className:"h-6 w-6 rounded-full p-0 flex items-center justify-center",children:N+1}),e.jsx("span",{className:"font-medium truncate max-w-[150px]",children:g.user_nickname})]}),e.jsxs("span",{className:"text-muted-foreground text-sm",children:[g.message_count," 次互动"]})]},g.user_id))})})]})]})]}),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(Xm,{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(ka,{title:"年度 Token 消耗",value:(n.brain_power.total_tokens/1e6).toFixed(2)+" M",description:"连起来可以绕地球 0.5 圈",icon:e.jsx(Za,{className:"h-4 w-4"})}),e.jsx(ka,{title:"年度总花费",value:`$${n.brain_power.total_cost.toFixed(2)}`,description:"为了陪大家聊天也是拼了",icon:e.jsx("span",{className:"font-bold",children:"$"})}),e.jsx(ka,{title:"高冷指数",value:`${n.brain_power.silence_rate}%`,description:`有 ${n.brain_power.no_reply_count} 次选择了沉默`,icon:e.jsx(Yi,{className:"h-4 w-4"})}),e.jsx(ka,{title:"最高兴趣值",value:n.brain_power.max_interest_value??"N/A",description:n.brain_power.max_interest_time?`出现在 ${n.brain_power.max_interest_time}`:"暂无数据",icon:e.jsx(qr,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(Te,{children:[e.jsx(Oe,{children:e.jsx(Le,{children:"模型偏好分布"})}),e.jsx(Ae,{children:e.jsx("div",{className:"space-y-3",children:n.brain_power.model_distribution.slice(0,5).map((g,N)=>{const v=n.brain_power.model_distribution[0]?.count||1,b=Math.round(g.count/v*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:g.model}),e.jsxs("span",{className:"text-muted-foreground",children:[g.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:`${b}%`,backgroundColor:Ig[N%Ig.length]}})})]},g.model)})})})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Le,{children:"烧钱大户 TOP3"}),e.jsx(ws,{children:"谁消耗了最多的 API 额度"})]}),e.jsx(Ae,{children:e.jsx("div",{className:"space-y-6",children:n.brain_power.top_token_consumers.map(g=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between text-sm font-medium",children:[e.jsxs("span",{children:["用户 ",g.user_id]}),e.jsxs("span",{children:["$",g.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:`${g.cost/(n.brain_power.top_token_consumers[0]?.cost||1)*100}%`}})})]},g.user_id))})})]})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(Te,{className:"bg-gradient-to-br from-amber-50 to-orange-50 dark:from-amber-950/20 dark:to-orange-950/20",children:[e.jsx(Oe,{children:e.jsxs(Le,{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:["$",n.brain_power.most_expensive_cost.toFixed(4)]}),n.brain_power.most_expensive_time&&e.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:["发生在 ",n.brain_power.most_expensive_time]}),e.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"为了让你满意,这次我可是下了血本!"})]})]}),e.jsxs(Te,{className:"bg-gradient-to-br from-indigo-50 to-blue-50 dark:from-indigo-950/20 dark:to-blue-950/20",children:[e.jsx(Oe,{children:e.jsxs(Le,{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:n.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:n.brain_power.max_reasoning_length?.toLocaleString()||0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"最长思考字数"})]})]}),n.brain_power.max_reasoning_time&&e.jsxs("p",{className:"mt-4 text-center text-xs text-muted-foreground",children:["最深沉的思考发生在 ",n.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(Jo,{className:"h-8 w-8"}),e.jsx("h2",{children:"个性与表达"})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(Te,{className:"bg-gradient-to-br from-pink-50 to-purple-50 dark:from-pink-950/20 dark:to-purple-950/20",children:[e.jsxs(Oe,{children:[e.jsx(Le,{children:"表情包之王"}),e.jsx(ws,{children:"年度使用次数最多的表情包"})]}),e.jsx(Ae,{className:"flex flex-col items-center justify-center",children:n.expression_vibe.top_emoji?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative mb-4 h-48 w-48 overflow-hidden rounded-lg shadow-lg transition-transform hover:scale-105",children:[e.jsx("img",{src:`/api/webui/emoji/${n.expression_vibe.top_emoji.id}/thumbnail?original=true`,alt:"Top Emoji",className:"h-full w-full object-cover"}),e.jsx(ke,{className:"absolute right-2 top-2 bg-yellow-500",children:"NO.1"})]}),e.jsxs("p",{className:"text-center font-medium text-lg",children:['"',n.expression_vibe.top_emoji.description,'"']}),e.jsxs("p",{className:"text-muted-foreground",children:["使用了 ",n.expression_vibe.top_emoji.usage_count," 次"]})]}):e.jsx("div",{className:"flex h-48 items-center justify-center text-muted-foreground",children:"暂无数据"})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Le,{children:"百变麦麦"}),e.jsx(ws,{children:"最常使用的表达风格"})]}),e.jsx(Ae,{children:e.jsx("div",{className:"flex flex-wrap gap-2",children:n.expression_vibe.top_expressions.map((g,N)=>e.jsxs(ke,{variant:"outline",className:P("px-3 py-1 text-sm",N===0&&"border-primary bg-primary/10 text-primary text-base px-4 py-2"),children:[g.style," (",g.count,")"]},g.style))})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(ka,{title:"图片鉴赏",value:`${n.expression_vibe.image_processed_count} 张`,description:"我看过的图比你吃过的盐还多",icon:e.jsx(Jm,{className:"h-4 w-4"})}),e.jsx(ka,{title:"成长的足迹",value:`${n.expression_vibe.rejected_expression_count} 次`,description:"被大家纠正表达的次数",icon:e.jsx(Za,{className:"h-4 w-4"})})]})]})]}),n.expression_vibe.action_types.length>0&&e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsxs(Le,{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-2xl",children:"⚡"}),"行动派"]}),e.jsx(ws,{children:"除了聊天,我还帮大家做了这些事"})]}),e.jsx(Ae,{children:e.jsx("div",{className:"flex flex-wrap gap-3",children:n.expression_vibe.action_types.map(g=>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:g.action}),e.jsxs(ke,{variant:"secondary",children:[g.count," 次"]})]},g.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(v1,{className:"h-8 w-8"}),e.jsx("h2",{children:"趣味成就"})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsxs(Te,{className:"col-span-1 md:col-span-2",children:[e.jsxs(Oe,{children:[e.jsx(Le,{children:'新学到的"黑话"'}),e.jsxs(ws,{children:["今年我学会了 ",n.achievements.new_jargon_count," 个新词"]})]}),e.jsx(Ae,{children:e.jsx("div",{className:"flex flex-wrap gap-3",children:n.achievements.sample_jargons.map(g=>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:g.content}),e.jsx("div",{className:"text-xs text-muted-foreground mt-1 line-clamp-2 max-w-[200px]",children:g.meaning||"暂无解释"})]},g.content))})})]}),e.jsx(Te,{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(za,{className:"h-12 w-12 mb-4 opacity-80"}),e.jsx("div",{className:"text-4xl font-bold mb-2",children:n.achievements.total_messages.toLocaleString()}),e.jsx("div",{className:"text-sm opacity-80",children:"年度总消息数"}),e.jsxs("div",{className:"mt-4 text-xs opacity-60",children:["其中回复了 ",n.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 ka({title:l,value:n,description:i,icon:c}){return e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Le,{className:"text-sm font-medium",children:l}),e.jsx("div",{className:"text-muted-foreground",children:c})]}),e.jsxs(Ae,{children:[e.jsx("div",{className:"text-2xl font-bold",children:n}),e.jsx("p",{className:"text-xs text-muted-foreground",children:i})]})]})}function wC(){return e.jsxs("div",{className:"container mx-auto space-y-8 p-8",children:[e.jsx(js,{className:"h-64 w-full rounded-3xl"}),e.jsx("div",{className:"grid gap-4 md:grid-cols-4",children:[...Array(4)].map((l,n)=>e.jsx(js,{className:"h-32 w-full"},n))}),e.jsx(js,{className:"h-96 w-full"})]})}var cd="DropdownMenu",[_C]=Qo(cd,[oj]),oa=oj(),[SC,xN]=_C(cd),hN=l=>{const{__scopeDropdownMenu:n,children:i,dir:c,open:u,defaultOpen:x,onOpenChange:h,modal:f=!0}=l,p=oa(n),g=d.useRef(null),[N,v]=Ko({prop:u,defaultProp:x??!1,onChange:h,caller:cd});return e.jsx(SC,{scope:n,triggerId:Lm(),triggerRef:g,contentId:Lm(),open:N,onOpenChange:v,onOpenToggle:d.useCallback(()=>v(b=>!b),[v]),modal:f,children:e.jsx(ow,{...p,open:N,onOpenChange:v,dir:c,modal:f,children:i})})};hN.displayName=cd;var fN="DropdownMenuTrigger",pN=d.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,disabled:c=!1,...u}=l,x=xN(fN,i),h=oa(i);return e.jsx(dw,{asChild:!0,...h,children:e.jsx(Yn.button,{type:"button",id:x.triggerId,"aria-haspopup":"menu","aria-expanded":x.open,"aria-controls":x.open?x.contentId:void 0,"data-state":x.open?"open":"closed","data-disabled":c?"":void 0,disabled:c,...u,ref:$w(n,x.triggerRef),onPointerDown:hn(l.onPointerDown,f=>{!c&&f.button===0&&f.ctrlKey===!1&&(x.onOpenToggle(),x.open||f.preventDefault())}),onKeyDown:hn(l.onKeyDown,f=>{c||(["Enter"," "].includes(f.key)&&x.onOpenToggle(),f.key==="ArrowDown"&&x.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(f.key)&&f.preventDefault())})})})});pN.displayName=fN;var kC="DropdownMenuPortal",gN=l=>{const{__scopeDropdownMenu:n,...i}=l,c=oa(n);return e.jsx(sw,{...c,...i})};gN.displayName=kC;var jN="DropdownMenuContent",vN=d.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=xN(jN,i),x=oa(i),h=d.useRef(!1);return e.jsx(tw,{id:u.contentId,"aria-labelledby":u.triggerId,...x,...c,ref:n,onCloseAutoFocus:hn(l.onCloseAutoFocus,f=>{h.current||u.triggerRef.current?.focus(),h.current=!1,f.preventDefault()}),onInteractOutside:hn(l.onInteractOutside,f=>{const p=f.detail.originalEvent,g=p.button===0&&p.ctrlKey===!0,N=p.button===2||g;(!u.modal||N)&&(h.current=!0)}),style:{...l.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)"}})});vN.displayName=jN;var CC="DropdownMenuGroup",TC=d.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=oa(i);return e.jsx(uw,{...u,...c,ref:n})});TC.displayName=CC;var EC="DropdownMenuLabel",NN=d.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=oa(i);return e.jsx(iw,{...u,...c,ref:n})});NN.displayName=EC;var MC="DropdownMenuItem",bN=d.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=oa(i);return e.jsx(aw,{...u,...c,ref:n})});bN.displayName=MC;var zC="DropdownMenuCheckboxItem",yN=d.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=oa(i);return e.jsx(lw,{...u,...c,ref:n})});yN.displayName=zC;var AC="DropdownMenuRadioGroup",DC=d.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=oa(i);return e.jsx(mw,{...u,...c,ref:n})});DC.displayName=AC;var OC="DropdownMenuRadioItem",wN=d.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=oa(i);return e.jsx(rw,{...u,...c,ref:n})});wN.displayName=OC;var RC="DropdownMenuItemIndicator",_N=d.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=oa(i);return e.jsx(nw,{...u,...c,ref:n})});_N.displayName=RC;var LC="DropdownMenuSeparator",SN=d.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=oa(i);return e.jsx(cw,{...u,...c,ref:n})});SN.displayName=LC;var UC="DropdownMenuArrow",$C=d.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=oa(i);return e.jsx(xw,{...u,...c,ref:n})});$C.displayName=UC;var BC="DropdownMenuSubTrigger",kN=d.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=oa(i);return e.jsx(W0,{...u,...c,ref:n})});kN.displayName=BC;var IC="DropdownMenuSubContent",CN=d.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=oa(i);return e.jsx(ew,{...u,...c,ref:n,style:{...l.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)"}})});CN.displayName=IC;var PC=hN,HC=pN,FC=gN,TN=vN,EN=NN,MN=bN,zN=yN,AN=wN,DN=_N,ON=SN,RN=kN,LN=CN;const GC=PC,VC=HC,qC=d.forwardRef(({className:l,inset:n,children:i,...c},u)=>e.jsxs(RN,{ref:u,className:P("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",n&&"pl-8",l),...c,children:[i,e.jsx(Zt,{className:"ml-auto h-4 w-4"})]}));qC.displayName=RN.displayName;const KC=d.forwardRef(({className:l,...n},i)=>e.jsx(LN,{ref:i,className:P("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",l),...n}));KC.displayName=LN.displayName;const UN=d.forwardRef(({className:l,sideOffset:n=4,...i},c)=>e.jsx(FC,{children:e.jsx(TN,{ref:c,sideOffset:n,className:P("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",l),...i})}));UN.displayName=TN.displayName;const $N=d.forwardRef(({className:l,inset:n,...i},c)=>e.jsx(MN,{ref:c,className:P("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",n&&"pl-8",l),...i}));$N.displayName=MN.displayName;const QC=d.forwardRef(({className:l,children:n,checked:i,...c},u)=>e.jsxs(zN,{ref:u,className:P("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",l),checked:i,...c,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(DN,{children:e.jsx(Ct,{className:"h-4 w-4"})})}),n]}));QC.displayName=zN.displayName;const YC=d.forwardRef(({className:l,children:n,...i},c)=>e.jsxs(AN,{ref:c,className:P("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",l),...i,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(DN,{children:e.jsx(Uo,{className:"h-2 w-2 fill-current"})})}),n]}));YC.displayName=AN.displayName;const JC=d.forwardRef(({className:l,inset:n,...i},c)=>e.jsx(EN,{ref:c,className:P("px-2 py-1.5 text-sm font-semibold",n&&"pl-8",l),...i}));JC.displayName=EN.displayName;const XC=d.forwardRef(({className:l,...n},i)=>e.jsx(ON,{ref:i,className:P("-mx-1 my-1 h-px bg-muted",l),...n}));XC.displayName=ON.displayName;const Rm=[{value:"created_at",label:"最新发布",icon:na},{value:"downloads",label:"下载最多",icon:sa},{value:"likes",label:"最受欢迎",icon:qr}];function ZC(){const l=ca(),[n,i]=d.useState([]),[c,u]=d.useState(!0),[x,h]=d.useState(""),[f,p]=d.useState("downloads"),[g,N]=d.useState(1),[v,b]=d.useState(1),[w,y]=d.useState(0),[R,A]=d.useState(new Set),[S,B]=d.useState(new Set),M=Mv(),C=d.useCallback(async()=>{u(!0);try{const U=await mS({status:"approved",page:g,page_size:12,search:x||void 0,sort_by:f,sort_order:"desc"});i(U.packs),b(U.total_pages),y(U.total);const oe=new Set;for(const Ne of U.packs)await Ev(Ne.id,M)&&oe.add(Ne.id);A(oe)}catch(U){console.error("加载 Pack 列表失败:",U),Qt({title:"加载 Pack 列表失败",variant:"destructive"})}finally{u(!1)}},[g,x,f,M]);d.useEffect(()=>{C()},[C]);const D=U=>{U.preventDefault(),N(1),C()},H=async U=>{if(!S.has(U)){B(oe=>new Set(oe).add(U));try{const oe=await Tv(U,M);A(Ne=>{const je=new Set(Ne);return oe.liked?je.add(U):je.delete(U),je}),i(Ne=>Ne.map(je=>je.id===U?{...je,likes:oe.likes}:je))}catch(oe){console.error("点赞失败:",oe),Qt({title:"点赞失败",variant:"destructive"})}finally{B(oe=>{const Ne=new Set(oe);return Ne.delete(U),Ne})}}},L=U=>{l({to:"/config/pack-market/$packId",params:{packId:U}})},J=Rm.find(U=>U.value===f)||Rm[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(dt,{className:`h-4 w-4 ${c?"animate-spin":""}`}),"刷新"]})]})}),e.jsx(Je,{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(Tt,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(le,{placeholder:"搜索模板名称、描述...",value:x,onChange:U=>h(U.target.value),className:"pl-10"})]})}),e.jsxs(GC,{children:[e.jsx(VC,{asChild:!0,children:e.jsxs(_,{variant:"outline",className:"min-w-[140px] gap-2",children:[e.jsx(N1,{className:"w-4 h-4"}),J.label,e.jsx(Ma,{className:"w-4 h-4 ml-auto"})]})}),e.jsx(UN,{align:"end",children:Rm.map(U=>e.jsxs($N,{onClick:()=>{p(U.value),N(1)},children:[e.jsx(U.icon,{className:"w-4 h-4 mr-2"}),U.label]},U.value))})]})]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共找到 ",e.jsx("span",{className:"font-medium text-foreground",children:w})," 个模板"]}),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((U,oe)=>e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(js,{className:"h-6 w-3/4"}),e.jsx(js,{className:"h-4 w-full mt-2"})]}),e.jsx(Ae,{children:e.jsx(js,{className:"h-20 w-full"})}),e.jsx(Wo,{children:e.jsx(js,{className:"h-9 w-full"})})]},oe))}):n.length===0?e.jsx(Te,{className:"py-12",children:e.jsxs(Ae,{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:n.map(U=>e.jsx(WC,{pack:U,liked:R.has(U.id),liking:S.has(U.id),onLike:()=>H(U.id),onView:()=>L(U.id)},U.id))}),v>1&&e.jsx(Zm,{children:e.jsxs(Wm,{children:[e.jsx(Fn,{children:e.jsx(mv,{onClick:()=>N(U=>Math.max(1,U-1)),className:g===1?"pointer-events-none opacity-50":"cursor-pointer"})}),Array.from({length:v},(U,oe)=>oe+1).filter(U=>U===1||U===v||Math.abs(U-g)<=1).map((U,oe,Ne)=>{const je=oe>0&&U-Ne[oe-1]>1;return e.jsxs(Fn,{children:[je&&e.jsx("span",{className:"px-2",children:"..."}),e.jsx(uc,{onClick:()=>N(U),isActive:U===g,className:"cursor-pointer",children:U})]},U)}),e.jsx(Fn,{children:e.jsx(xv,{onClick:()=>N(U=>Math.min(v,U+1)),className:g===v?"pointer-events-none opacity-50":"cursor-pointer"})})]})})]})})]})}function WC({pack:l,liked:n,liking:i,onLike:c,onView:u}){const x=h=>new Date(h).toLocaleDateString("zh-CN",{year:"numeric",month:"short",day:"numeric"});return e.jsxs(Te,{className:"flex flex-col hover:shadow-md transition-shadow",children:[e.jsxs(Oe,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx(Le,{className:"text-lg line-clamp-1",children:l.name}),e.jsxs(ke,{variant:"secondary",className:"text-xs",children:["v",l.version]})]}),e.jsx(ws,{className:"line-clamp-2 min-h-[40px]",children:l.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(fn,{className:"w-3.5 h-3.5"}),l.author]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(na,{className:"w-3.5 h-3.5"}),x(l.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(Ol,{className:"w-3.5 h-3.5"}),l.provider_count]}),e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",title:"模型数量",children:[e.jsx(Vn,{className:"w-3.5 h-3.5"}),l.model_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"}),l.task_count]})]}),l.tags&&l.tags.length>0&&e.jsxs("div",{className:"flex flex-wrap gap-1",children:[l.tags.slice(0,3).map(h=>e.jsxs(ke,{variant:"outline",className:"text-xs",children:[e.jsx(Zo,{className:"w-2.5 h-2.5 mr-1"}),h]},h)),l.tags.length>3&&e.jsxs(ke,{variant:"outline",className:"text-xs",children:["+",l.tags.length-3]})]})]}),e.jsx(Wo,{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(sa,{className:"w-4 h-4"}),l.downloads]}),e.jsxs("button",{onClick:h=>{h.stopPropagation(),c()},disabled:i,className:`flex items-center gap-1 transition-colors ${n?"text-red-500":"hover:text-red-500"} ${i?"opacity-50":""}`,children:[e.jsx(qr,{className:`w-4 h-4 ${n?"fill-current":""}`}),l.likes]})]}),e.jsx(_,{size:"sm",onClick:u,children:"查看详情"})]})})]})}var sl="Accordion",e3=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[fx,s3,t3]=Bw(sl),[od]=Qo(sl,[t3,dj]),px=dj(),BN=As.forwardRef((l,n)=>{const{type:i,...c}=l,u=c,x=c;return e.jsx(fx.Provider,{scope:l.__scopeAccordion,children:i==="multiple"?e.jsx(r3,{...x,ref:n}):e.jsx(n3,{...u,ref:n})})});BN.displayName=sl;var[IN,a3]=od(sl),[PN,l3]=od(sl,{collapsible:!1}),n3=As.forwardRef((l,n)=>{const{value:i,defaultValue:c,onValueChange:u=()=>{},collapsible:x=!1,...h}=l,[f,p]=Ko({prop:i,defaultProp:c??"",onChange:u,caller:sl});return e.jsx(IN,{scope:l.__scopeAccordion,value:As.useMemo(()=>f?[f]:[],[f]),onItemOpen:p,onItemClose:As.useCallback(()=>x&&p(""),[x,p]),children:e.jsx(PN,{scope:l.__scopeAccordion,collapsible:x,children:e.jsx(HN,{...h,ref:n})})})}),r3=As.forwardRef((l,n)=>{const{value:i,defaultValue:c,onValueChange:u=()=>{},...x}=l,[h,f]=Ko({prop:i,defaultProp:c??[],onChange:u,caller:sl}),p=As.useCallback(N=>f((v=[])=>[...v,N]),[f]),g=As.useCallback(N=>f((v=[])=>v.filter(b=>b!==N)),[f]);return e.jsx(IN,{scope:l.__scopeAccordion,value:h,onItemOpen:p,onItemClose:g,children:e.jsx(PN,{scope:l.__scopeAccordion,collapsible:!0,children:e.jsx(HN,{...x,ref:n})})})}),[i3,dd]=od(sl),HN=As.forwardRef((l,n)=>{const{__scopeAccordion:i,disabled:c,dir:u,orientation:x="vertical",...h}=l,f=As.useRef(null),p=Yo(f,n),g=s3(i),v=kj(u)==="ltr",b=hn(l.onKeyDown,w=>{if(!e3.includes(w.key))return;const y=w.target,R=g().filter(J=>!J.ref.current?.disabled),A=R.findIndex(J=>J.ref.current===y),S=R.length;if(A===-1)return;w.preventDefault();let B=A;const M=0,C=S-1,D=()=>{B=A+1,B>C&&(B=M)},H=()=>{B=A-1,B{const{__scopeAccordion:i,value:c,...u}=l,x=dd(qo,i),h=a3(qo,i),f=px(i),p=Lm(),g=c&&h.value.includes(c)||!1,N=x.disabled||l.disabled;return e.jsx(c3,{scope:i,open:g,disabled:N,triggerId:p,children:e.jsx(lj,{"data-orientation":x.orientation,"data-state":YN(g),...f,...u,ref:n,disabled:N,open:g,onOpenChange:v=>{v?h.onItemOpen(c):h.onItemClose(c)}})})});FN.displayName=qo;var GN="AccordionHeader",VN=As.forwardRef((l,n)=>{const{__scopeAccordion:i,...c}=l,u=dd(sl,i),x=gx(GN,i);return e.jsx(Yn.h3,{"data-orientation":u.orientation,"data-state":YN(x.open),"data-disabled":x.disabled?"":void 0,...c,ref:n})});VN.displayName=GN;var Fm="AccordionTrigger",qN=As.forwardRef((l,n)=>{const{__scopeAccordion:i,...c}=l,u=dd(sl,i),x=gx(Fm,i),h=l3(Fm,i),f=px(i);return e.jsx(fx.ItemSlot,{scope:i,children:e.jsx(hw,{"aria-disabled":x.open&&!h.collapsible||void 0,"data-orientation":u.orientation,id:x.triggerId,...f,...c,ref:n})})});qN.displayName=Fm;var KN="AccordionContent",QN=As.forwardRef((l,n)=>{const{__scopeAccordion:i,...c}=l,u=dd(sl,i),x=gx(KN,i),h=px(i);return e.jsx(fw,{role:"region","aria-labelledby":x.triggerId,"data-orientation":u.orientation,...h,...c,ref:n,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...l.style}})});QN.displayName=KN;function YN(l){return l?"open":"closed"}var o3=BN,d3=FN,u3=VN,JN=qN,XN=QN;const m3=o3,ZN=d.forwardRef(({className:l,...n},i)=>e.jsx(d3,{ref:i,className:P("border-b",l),...n}));ZN.displayName="AccordionItem";const WN=d.forwardRef(({className:l,children:n,...i},c)=>e.jsx(u3,{className:"flex",children:e.jsxs(JN,{ref:c,className:P("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",l),...i,children:[n,e.jsx(Ma,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));WN.displayName=JN.displayName;const eb=d.forwardRef(({className:l,children:n,...i},c)=>e.jsx(XN,{ref:c,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...i,children:e.jsx("div",{className:P("pb-4 pt-0",l),children:n})}));eb.displayName=XN.displayName;const x3={utils:"通用工具",utils_small:"轻量工具",tool_use:"工具调用",replyer:"回复生成",planner:"规划推理",vlm:"视觉模型",voice:"语音处理",embedding:"向量嵌入",lpmm_entity_extract:"实体提取",lpmm_rdf_build:"RDF构建",lpmm_qa:"问答模型"};function h3(){const{packId:l}=nb.useParams(),n=ca(),[i,c]=d.useState(null),[u,x]=d.useState(!0),[h,f]=d.useState(!1),[p,g]=d.useState(!1),[N,v]=d.useState(!1),[b,w]=d.useState(1),[y,R]=d.useState(null),[A,S]=d.useState(!1),[B,M]=d.useState(!1),[C,D]=d.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,L]=d.useState({}),[J,U]=d.useState({}),oe=Mv(),Ne=d.useCallback(async()=>{if(l){x(!0);try{const E=await xS(l);c(E);const K=await Ev(l,oe);f(K)}catch(E){console.error("加载 Pack 失败:",E),Qt({title:"加载模板失败",variant:"destructive"})}finally{x(!1)}}},[l,oe]);d.useEffect(()=>{Ne()},[Ne]);const je=async()=>{if(!(!l||p)){g(!0);try{const E=await Tv(l,oe);f(E.liked),i&&c({...i,likes:E.likes})}catch(E){console.error("点赞失败:",E),Qt({title:"点赞失败",variant:"destructive"})}finally{g(!1)}}},re=async()=>{if(i){v(!0),w(1),S(!0);try{const E=await pS(i);R(E);const K={};for(const ue of E.existing_providers)K[ue.pack_provider.name]=ue.local_providers[0].name;L(K);const I={};for(const ue of E.new_providers)I[ue.name]="";U(I)}catch(E){console.error("检测冲突失败:",E),Qt({title:"检测配置冲突失败",variant:"destructive"}),v(!1)}finally{S(!1)}}},fe=async()=>{if(i){if(C.apply_providers&&y){for(const E of y.new_providers)if(!J[E.name]){Qt({title:`请填写提供商 "${E.name}" 的 API Key`,variant:"destructive"});return}}M(!0);try{await gS(i,C,H,J),await fS(i.id,oe),c({...i,downloads:i.downloads+1}),Qt({title:"配置模板应用成功!"}),v(!1)}catch(E){console.error("应用 Pack 失败:",E),Qt({title:E instanceof Error?E.message:"应用配置失败",variant:"destructive"})}finally{M(!1)}}},ge=E=>new Date(E).toLocaleDateString("zh-CN",{year:"numeric",month:"long",day:"numeric"});return u?e.jsx(p3,{}):i?e.jsx("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:e.jsx(Je,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsxs(_,{variant:"ghost",size:"sm",onClick:()=>n({to:"/config/pack-market"}),className:"gap-2",children:[e.jsx(Ta,{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:[i.name,e.jsxs(ke,{variant:"secondary",children:["v",i.version]})]}),e.jsx("p",{className:"text-muted-foreground mt-1",children:i.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(fn,{className:"w-4 h-4"}),i.author]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(na,{className:"w-4 h-4"}),ge(i.created_at)]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(sa,{className:"w-4 h-4"}),i.downloads," 次下载"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(qr,{className:`w-4 h-4 ${h?"fill-red-500 text-red-500":""}`}),i.likes," 赞"]})]}),i.tags&&i.tags.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:i.tags.map(E=>e.jsxs(ke,{variant:"outline",children:[e.jsx(Zo,{className:"w-3 h-3 mr-1"}),E]},E))})]}),e.jsxs("div",{className:"flex flex-col gap-2 min-w-[160px]",children:[e.jsxs(_,{size:"lg",onClick:re,children:[e.jsx(sa,{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(qr,{className:`w-4 h-4 mr-2 ${h?"fill-current":""}`}),h?"已点赞":"点赞"]})]})]}),e.jsx(Yt,{}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsx(Te,{children:e.jsxs(Ae,{className:"flex items-center gap-3 py-4",children:[e.jsx(Ol,{className:"w-8 h-8 text-blue-500 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:i.providers.length}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"API 提供商"})]})]})}),e.jsx(Te,{children:e.jsxs(Ae,{className:"flex items-center gap-3 py-4",children:[e.jsx(Vn,{className:"w-8 h-8 text-green-500 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:i.models.length}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"模型配置"})]})]})}),e.jsx(Te,{children:e.jsxs(Ae,{className:"flex items-center gap-3 py-4",children:[e.jsx(qn,{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(i.task_config).length}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"任务配置"})]})]})})]}),e.jsxs(ta,{defaultValue:"providers",className:"space-y-4",children:[e.jsxs(Xt,{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(Ol,{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:["(",i.providers.length,")"]})]}),e.jsxs(Xe,{value:"models",className:"gap-1 sm:gap-2",children:[e.jsx(Vn,{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:["(",i.models.length,")"]})]}),e.jsxs(Xe,{value:"tasks",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:["(",Object.keys(i.task_config).length,")"]})]})]}),e.jsx(ys,{value:"providers",children:e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Le,{children:"API 提供商"}),e.jsx(ws,{children:"模板中包含的 API 提供商配置(不含 API Key)"})]}),e.jsx(Ae,{children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(Rl,{children:[e.jsx(Ll,{children:e.jsxs(ut,{children:[e.jsx(We,{children:"名称"}),e.jsx(We,{children:"Base URL"}),e.jsx(We,{children:"类型"})]})}),e.jsx(Ul,{children:i.providers.map(E=>e.jsxs(ut,{children:[e.jsx(Ke,{className:"font-medium whitespace-nowrap",children:E.name}),e.jsx(Ke,{className:"text-muted-foreground font-mono text-sm max-w-[200px] truncate",children:E.base_url}),e.jsx(Ke,{children:e.jsx(ke,{variant:"outline",children:E.client_type})})]},E.name))})]})})})]})}),e.jsx(ys,{value:"models",children:e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Le,{children:"模型配置"}),e.jsx(ws,{children:"模板中包含的模型配置"})]}),e.jsx(Ae,{children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(Rl,{children:[e.jsx(Ll,{children:e.jsxs(ut,{children:[e.jsx(We,{children:"模型名称"}),e.jsx(We,{children:"标识符"}),e.jsx(We,{children:"提供商"}),e.jsx(We,{className:"text-right",children:"价格 (入/出)"})]})}),e.jsx(Ul,{children:i.models.map(E=>e.jsxs(ut,{children:[e.jsx(Ke,{className:"font-medium whitespace-nowrap",children:E.name}),e.jsx(Ke,{className:"text-muted-foreground font-mono text-sm max-w-[150px] truncate",children:E.model_identifier}),e.jsx(Ke,{className:"whitespace-nowrap",children:E.api_provider}),e.jsxs(Ke,{className:"text-right text-muted-foreground whitespace-nowrap",children:["¥",E.price_in," / ¥",E.price_out]})]},E.name))})]})})})]})}),e.jsx(ys,{value:"tasks",children:e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Le,{children:"任务配置"}),e.jsx(ws,{children:"模板中各任务类型的模型分配"})]}),e.jsx(Ae,{children:e.jsx(m3,{type:"multiple",className:"w-full",children:Object.entries(i.task_config).map(([E,K])=>e.jsxs(ZN,{value:E,children:[e.jsx(WN,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(pn,{className:"w-4 h-4"}),x3[E]||E,e.jsxs(ke,{variant:"secondary",className:"ml-2",children:[K.model_list.length," 个模型"]})]})}),e.jsx(eb,{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(I=>e.jsx(ke,{variant:"outline",children:I},I))}),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})]})]})})]},E))})})]})})]}),e.jsx(f3,{open:N,onOpenChange:v,pack:i,step:b,setStep:w,conflicts:y,detectingConflicts:A,applying:B,options:C,setOptions:D,_providerMapping:H,_setProviderMapping:L,newProviderApiKeys:J,setNewProviderApiKeys:U,onApply:fe})]})})}):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:()=>n({to:"/config/pack-market"}),children:[e.jsx(Ta,{className:"w-4 h-4 mr-2"}),"返回市场"]})]})}function f3({open:l,onOpenChange:n,pack:i,step:c,setStep:u,conflicts:x,detectingConflicts:h,applying:f,options:p,setOptions:g,_providerMapping:N,_setProviderMapping:v,newProviderApiKeys:b,setNewProviderApiKeys:w,onApply:y}){return e.jsx(Is,{open:l,onOpenChange:n,children:e.jsxs(Ds,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Os,{children:[e.jsxs(Rs,{className:"flex items-center gap-2",children:[e.jsx(ra,{className:"w-5 h-5"}),"应用配置模板"]}),e.jsxs(Ks,{children:["步骤 ",c," / ",3,":",c===1&&"选择要应用的内容",c===2&&"配置提供商映射",c===3&&"确认并应用"]})]}),h?e.jsxs("div",{className:"py-8 text-center",children:[e.jsx(Bs,{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(qs,{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(Ol,{className:"w-4 h-4"}),"应用提供商配置 (",i.providers.length," 个)"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qs,{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(Vn,{className:"w-4 h-4"}),"应用模型配置 (",i.models.length," 个)"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qs,{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(qn,{className:"w-4 h-4"}),"应用任务配置 (",Object.keys(i.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(hx,{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(Vo,{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(Vo,{value:"replace",id:"mode_replace"}),e.jsx(T,{htmlFor:"mode_replace",className:"font-normal",children:"替换模式 - 用模板配置完全替换现有配置"})]})]})]})]}),c===2&&x&&e.jsxs("div",{className:"space-y-4",children:[p.apply_providers&&x.existing_providers.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs(at,{children:[e.jsx(Ht,{className:"h-4 w-4"}),e.jsx(Hn,{children:"发现已有的提供商"}),e.jsx(lt,{children:"以下提供商的 URL 与您本地配置中的提供商匹配,将自动使用本地提供商:"})]}),e.jsx("div",{className:"space-y-2",children:x.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(Ct,{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(Zt,{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(Ie,{value:N[A.name]||S[0].name,onValueChange:B=>v({...N,[A.name]:B}),children:[e.jsx($e,{className:"w-[200px]",children:e.jsx(Pe,{})}),e.jsx(Be,{children:S.map(B=>e.jsx(Z,{value:B.name,children:B.name},B.name))})]}),e.jsxs(ke,{variant:"outline",className:"ml-auto",children:[S.length," 个匹配"]})]})]},A.name))})]}),p.apply_providers&&x.new_providers.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs(at,{variant:"destructive",children:[e.jsx(Jt,{className:"h-4 w-4"}),e.jsx(Hn,{children:"需要配置 API Key"}),e.jsx(lt,{children:"以下提供商在您的本地配置中不存在,需要填写 API Key:"})]}),e.jsx("div",{className:"space-y-4",children:x.new_providers.map(A=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Km,{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(le,{type:"password",placeholder:`输入 ${A.name} 的 API Key`,value:b[A.name]||"",onChange:S=>w({...b,[A.name]:S.target.value})})]},A.name))})]}),(!p.apply_providers||x.existing_providers.length===0&&x.new_providers.length===0)&&e.jsxs(at,{children:[e.jsx(Ct,{className:"h-4 w-4"}),e.jsx(Hn,{children:"无需配置"}),e.jsx(lt,{children:"模板中没有提供商配置,或您选择不应用提供商。"})]})]}),c===3&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(at,{children:[e.jsx(Ht,{className:"h-4 w-4"}),e.jsx(Hn,{children:"确认应用"}),e.jsx(lt,{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(Ct,{className:"w-4 h-4 text-green-500"}),e.jsx(Ol,{className:"w-4 h-4"}),e.jsxs("span",{children:["应用 ",i.providers.length," 个提供商配置"]})]}),p.apply_models&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Ct,{className:"w-4 h-4 text-green-500"}),e.jsx(Vn,{className:"w-4 h-4"}),e.jsxs("span",{children:["应用 ",i.models.length," 个模型配置"]})]}),p.apply_task_config&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Ct,{className:"w-4 h-4 text-green-500"}),e.jsx(qn,{className:"w-4 h-4"}),e.jsxs("span",{children:[p.task_mode==="append"?"追加":"替换"," ",Object.keys(i.task_config).length," 个任务配置"]})]})]}),x&&x.new_providers.length>0&&e.jsxs(at,{variant:"destructive",children:[e.jsx(Jt,{className:"h-4 w-4"}),e.jsxs(lt,{children:["将添加 ",x.new_providers.length," 个新提供商,请确保已填写正确的 API Key。"]})]})]})]}),e.jsxs(st,{className:"flex justify-between",children:[e.jsx("div",{children:c>1&&!h&&e.jsx(_,{variant:"outline",onClick:()=>u(c-1),disabled:f,children:"上一步"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(_,{variant:"outline",onClick:()=>n(!1),disabled:f,children:"取消"}),c<3?e.jsx(_,{onClick:()=>u(c+1),disabled:h,children:"下一步"}):e.jsxs(_,{onClick:y,disabled:f,children:[f&&e.jsx(Bs,{className:"w-4 h-4 mr-2 animate-spin"}),"应用模板"]})]})]})]})})}function p3(){return e.jsx("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:e.jsx(Je,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsx(js,{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(js,{className:"w-10 h-10"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(js,{className:"h-8 w-2/3"}),e.jsx(js,{className:"h-4 w-full"})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-4",children:[e.jsx(js,{className:"h-4 w-24"}),e.jsx(js,{className:"h-4 w-32"}),e.jsx(js,{className:"h-4 w-28"}),e.jsx(js,{className:"h-4 w-20"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(js,{className:"h-6 w-20"}),e.jsx(js,{className:"h-6 w-24"}),e.jsx(js,{className:"h-6 w-16"})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 min-w-[160px]",children:[e.jsx(js,{className:"h-10 w-full"}),e.jsx(js,{className:"h-10 w-full"})]})]}),e.jsx(js,{className:"h-px w-full"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsx(js,{className:"h-24"}),e.jsx(js,{className:"h-24"}),e.jsx(js,{className:"h-24"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(js,{className:"h-10 w-32"}),e.jsx(js,{className:"h-10 w-32"}),e.jsx(js,{className:"h-10 w-32"})]}),e.jsx(js,{className:"h-96 w-full"})]})]})})})}function g3(){const l=ca(),[n,i]=d.useState(!0);return d.useEffect(()=>{let c=!1;return(async()=>{try{const x=await ac();!c&&!x&&l({to:"/auth"})}catch{c||l({to:"/auth"})}finally{c||i(!1)}})(),()=>{c=!0}},[l]),{checking:n}}async function j3(){return await ac()}const v3=Qr("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"}}),sb=d.forwardRef(({className:l,size:n,abbrTitle:i,children:c,...u},x)=>e.jsx("kbd",{className:P(v3({size:n,className:l})),ref:x,...u,children:i?e.jsx("abbr",{title:i,children:c}):c}));sb.displayName="Kbd";const N3=[{icon:Xo,title:"首页",description:"查看仪表板概览",path:"/",category:"概览"},{icon:Ca,title:"麦麦主程序配置",description:"配置麦麦的核心设置",path:"/config/bot",category:"配置"},{icon:Ol,title:"麦麦模型提供商配置",description:"配置模型提供商",path:"/config/modelProvider",category:"配置"},{icon:Vj,title:"麦麦模型配置",description:"配置模型参数",path:"/config/model",category:"配置"},{icon:Jo,title:"表情包管理",description:"管理麦麦的表情包",path:"/resource/emoji",category:"资源"},{icon:za,title:"表达方式管理",description:"管理麦麦的表达方式",path:"/resource/expression",category:"资源"},{icon:qj,title:"人物信息管理",description:"管理人物信息",path:"/resource/person",category:"资源"},{icon:Vr,title:"黑话管理",description:"管理麦麦学习到的黑话和俚语",path:"/resource/jargon",category:"资源"},{icon:b1,title:"统计信息",description:"查看使用统计",path:"/statistics",category:"监控"},{icon:ra,title:"插件市场",description:"浏览和安装插件",path:"/plugins",category:"扩展"},{icon:Qm,title:"日志查看器",description:"查看系统日志",path:"/logs",category:"监控"},{icon:pn,title:"系统设置",description:"配置系统参数",path:"/settings",category:"系统"}];function b3({open:l,onOpenChange:n}){const[i,c]=d.useState(""),[u,x]=d.useState(0),h=ca(),f=N3.filter(N=>N.title.toLowerCase().includes(i.toLowerCase())||N.description.toLowerCase().includes(i.toLowerCase())||N.category.toLowerCase().includes(i.toLowerCase())),p=d.useCallback(N=>{h({to:N}),n(!1),c(""),x(0)},[h,n]),g=d.useCallback(N=>{N.key==="ArrowDown"?(N.preventDefault(),x(v=>(v+1)%f.length)):N.key==="ArrowUp"?(N.preventDefault(),x(v=>(v-1+f.length)%f.length)):N.key==="Enter"&&f[u]&&(N.preventDefault(),p(f[u].path))},[f,u,p]);return e.jsx(Is,{open:l,onOpenChange:n,children:e.jsxs(Ds,{className:"max-w-2xl p-0 gap-0",children:[e.jsxs(Os,{className:"px-4 pt-4 pb-0",children:[e.jsx(Rs,{className:"sr-only",children:"搜索"}),e.jsxs("div",{className:"relative",children:[e.jsx(Tt,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground"}),e.jsx(le,{value:i,onChange:N=>{c(N.target.value),x(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(Je,{className:"h-[400px]",children:f.length>0?e.jsx("div",{className:"p-2",children:f.map((N,v)=>{const b=N.icon;return e.jsxs("button",{onClick:()=>p(N.path),onMouseEnter:()=>x(v),className:P("w-full flex items-center gap-3 px-3 py-2.5 rounded-md text-left transition-colors",v===u?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:[e.jsx(b,{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(Tt,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:i?"未找到匹配的页面":"输入关键词开始搜索"})]})})}),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 y3(){const l=window.location.protocol==="http:",n=window.location.hostname.toLowerCase(),i=n==="localhost"||n==="127.0.0.1"||n==="::1",c=sessionStorage.getItem("http-warning-dismissed")==="true",[u,x]=d.useState(l&&!i&&!c),[h,f]=d.useState(!1),p=()=>{f(!0),x(!1),sessionStorage.setItem("http-warning-dismissed","true")};return!u||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(Jt,{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(Ea,{className:"h-4 w-4"})})]})})})}function w3(){const[l,n]=d.useState(0),[i,c]=d.useState(!1),u=d.useRef(null);d.useEffect(()=>{const g=N=>{const v=N.target;if(v.scrollHeight>v.clientHeight+100){u.current=v;const b=v.scrollTop,w=v.scrollHeight-v.clientHeight,y=w>0?b/w*100:0;n(y),c(b>300)}};return window.addEventListener("scroll",g,{capture:!0,passive:!0}),()=>window.removeEventListener("scroll",g,{capture:!0})},[]);const x=()=>{u.current?.scrollTo({top:0,behavior:"smooth"})},h=18,f=2*Math.PI*h,p=f-l/100*f;return e.jsx("div",{className:P("fixed bottom-24 right-8 z-50 transition-all duration-500 ease-in-out transform",i?"translate-x-0 opacity-100":"translate-x-32 opacity-0 pointer-events-none"),children:e.jsxs(_,{variant:"outline",size:"icon",className:P("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:x,"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(y1,{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 _3=Pw,S3=Hw,k3=Fw,tb=d.forwardRef(({className:l,sideOffset:n=4,...i},c)=>e.jsx(Iw,{children:e.jsx(Cj,{ref:c,sideOffset:n,className:P("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]",l),...i})}));tb.displayName=Cj.displayName;function C3({children:l}){const{checking:n}=g3(),[i,c]=d.useState(!0),[u,x]=d.useState(!1),[h,f]=d.useState(!1),{theme:p,setTheme:g}=tx(),N=w0();if(d.useEffect(()=>{const R=A=>{(A.metaKey||A.ctrlKey)&&A.key==="k"&&(A.preventDefault(),f(!0))};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[]),n)return e.jsx("div",{className:"flex h-screen items-center justify-center bg-background",children:e.jsx("div",{className:"text-muted-foreground",children:"正在验证登录状态..."})});const v=[{title:"概览",items:[{icon:Xo,label:"首页",path:"/"}]},{title:"麦麦配置编辑",items:[{icon:Ca,label:"麦麦主程序配置",path:"/config/bot"},{icon:Ol,label:"AI模型厂商配置",path:"/config/modelProvider",tourId:"sidebar-model-provider"},{icon:Vj,label:"模型管理与分配",path:"/config/model",tourId:"sidebar-model-management"},{icon:ug,label:"麦麦适配器配置",path:"/config/adapter"}]},{title:"麦麦资源管理",items:[{icon:Jo,label:"表情包管理",path:"/resource/emoji"},{icon:za,label:"表达方式管理",path:"/resource/expression"},{icon:Vr,label:"黑话管理",path:"/resource/jargon"},{icon:qj,label:"人物信息管理",path:"/resource/person"},{icon:Pj,label:"知识库图谱可视化",path:"/resource/knowledge-graph"},{icon:Gr,label:"麦麦知识库管理",path:"/resource/knowledge-base"}]},{title:"扩展与监控",items:[{icon:ra,label:"插件市场",path:"/plugins"},{icon:Fj,label:"配置模板市场",path:"/config/pack-market"},{icon:ug,label:"插件配置",path:"/plugin-config"},{icon:Qm,label:"日志查看器",path:"/logs"},{icon:Gm,label:"计划器&回复器监控",path:"/planner-monitor"},{icon:za,label:"本地聊天室",path:"/chat"}]},{title:"系统",items:[{icon:pn,label:"系统设置",path:"/settings"}]}],w=p==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":p,y=async()=>{await l_()};return e.jsx(_3,{delayDuration:300,children:e.jsxs("div",{className:"flex h-screen overflow-hidden",children:[e.jsxs("aside",{className:P("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",i?"lg:w-64":"lg:w-16",u?"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:P("relative flex items-center justify-center flex-1 transition-all overflow-hidden","lg:flex-1",!i&&"lg:flex-none lg:w-8"),children:[e.jsxs("div",{className:P("flex items-baseline gap-2",!i&&"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:B_()})]}),!i&&e.jsx("span",{className:"hidden lg:block font-bold text-primary-gradient text-2xl",children:"M"})]})}),e.jsx(Je,{className:P("flex-1 overflow-x-hidden",!i&&"lg:w-16"),children:e.jsx("nav",{className:P("p-4",!i&&"lg:p-2 lg:w-16"),children:e.jsx("ul",{className:P("space-y-6",!i&&"lg:space-y-3 lg:w-full"),children:v.map((R,A)=>e.jsxs("li",{children:[e.jsx("div",{className:P("px-3 h-[1.25rem]","mb-2",!i&&"lg:mb-1 lg:invisible"),children:e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground/60 whitespace-nowrap",children:R.title})}),!i&&A>0&&e.jsx("div",{className:"hidden lg:block mb-2 border-t border-border"}),e.jsx("ul",{className:"space-y-1",children:R.items.map(S=>{const B=N({to:S.path}),M=S.icon,C=e.jsxs(e.Fragment,{children:[B&&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:P("flex items-center transition-all duration-300",i?"gap-3":"gap-3 lg:gap-0"),children:[e.jsx(M,{className:P("h-5 w-5 flex-shrink-0",B&&"text-primary"),strokeWidth:2,fill:"none"}),e.jsx("span",{className:P("text-sm font-medium whitespace-nowrap transition-all duration-300",B&&"font-semibold",i?"opacity-100 max-w-[200px]":"opacity-100 max-w-[200px] lg:opacity-0 lg:max-w-0 lg:overflow-hidden"),children:S.label})]})]});return e.jsx("li",{className:"relative",children:e.jsxs(S3,{children:[e.jsx(k3,{asChild:!0,children:e.jsx(Bn,{to:S.path,"data-tour":S.tourId,className:P("relative flex items-center rounded-lg py-2 transition-all duration-300","hover:bg-accent hover:text-accent-foreground",B?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground",i?"px-3":"px-3 lg:px-0 lg:justify-center lg:w-12 lg:mx-auto"),onClick:()=>x(!1),children:C})}),!i&&e.jsx(tb,{side:"right",className:"hidden lg:block",children:e.jsx("p",{children:S.label})})]})},S.path)})})]},R.title))})})})]}),u&&e.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 lg:hidden",onClick:()=>x(!1)}),e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[e.jsx(y3,{}),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:()=>x(!u),className:"rounded-lg p-2 hover:bg-accent lg:hidden",children:e.jsx(w1,{className:"h-5 w-5"})}),e.jsx("button",{onClick:()=>c(!i),className:"hidden rounded-lg p-2 hover:bg-accent lg:block",title:i?"收起侧边栏":"展开侧边栏",children:e.jsx(Aa,{className:P("h-5 w-5 transition-transform",!i&&"rotate-180")})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Bn,{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(_1,{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(Tt,{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(sb,{size:"sm",className:"absolute right-2 top-1/2 -translate-y-1/2",children:[e.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),e.jsx(b3,{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(S1,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"麦麦文档"})]}),e.jsx("button",{onClick:R=>{O_(w==="dark"?"light":"dark",g,R)},className:"rounded-lg p-2 hover:bg-accent",title:w==="dark"?"切换到浅色模式":"切换到深色模式",children:w==="dark"?e.jsx(qm,{className:"h-5 w-5"}):e.jsx(Yi,{className:"h-5 w-5"})}),e.jsx("div",{className:"h-6 w-px bg-border"}),e.jsxs(_,{variant:"ghost",size:"sm",onClick:y,className:"gap-2",title:"登出系统",children:[e.jsx(k1,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"登出"})]})]})]}),e.jsx("main",{className:"flex-1 overflow-hidden bg-background",children:l}),e.jsx(w3,{})]})]})})}function T3(l){const n=l.split(` +`).slice(1),i=[];for(const c of n){const u=c.trim();if(!u.startsWith("at "))continue;const x=u.match(/at\s+(?:(.+?)\s+\()?(.+?):(\d+):(\d+)\)?$/);x?i.push({functionName:x[1]||"",fileName:x[2],lineNumber:x[3],columnNumber:x[4],raw:u}):i.push({functionName:"",fileName:"",lineNumber:"",columnNumber:"",raw:u})}return i}function E3({error:l,errorInfo:n}){const[i,c]=d.useState(!0),[u,x]=d.useState(!1),[h,f]=d.useState(!1),p=l.stack?T3(l.stack):[],g=async()=>{const N=` +Error: ${l.name} +Message: ${l.message} + +Stack Trace: +${l.stack||"No stack trace available"} + +Component Stack: +${n?.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(v){console.error("Failed to copy:",v)}};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs(at,{variant:"destructive",className:"border-red-500/50 bg-red-500/10",children:[e.jsx(Jt,{className:"h-4 w-4"}),e.jsxs(lt,{className:"font-mono text-sm",children:[e.jsxs("span",{className:"font-semibold",children:[l.name,":"]})," ",l.message]})]}),p.length>0&&e.jsxs(rc,{open:i,onOpenChange:c,children:[e.jsx(ic,{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(C1,{className:"h-4 w-4"}),"Stack Trace (",p.length," frames)"]}),i?e.jsx(Fr,{className:"h-4 w-4"}):e.jsx(Ma,{className:"h-4 w-4"})]})}),e.jsx(cc,{children:e.jsx(Je,{className:"h-[280px] rounded-md border bg-muted/30",children:e.jsx("div",{className:"p-3 space-y-1",children:p.map((N,v)=>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:[v+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]})]})]})]})},v))})})})]}),n?.componentStack&&e.jsxs(rc,{open:u,onOpenChange:x,children:[e.jsx(ic,{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(Jt,{className:"h-4 w-4"}),"Component Stack"]}),u?e.jsx(Fr,{className:"h-4 w-4"}):e.jsx(Ma,{className:"h-4 w-4"})]})}),e.jsx(cc,{children:e.jsx(Je,{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:n.componentStack})})})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:g,className:"w-full",children:h?e.jsxs(e.Fragment,{children:[e.jsx(Ct,{className:"mr-2 h-4 w-4 text-green-500"}),"已复制到剪贴板"]}):e.jsxs(e.Fragment,{children:[e.jsx(Lo,{className:"mr-2 h-4 w-4"}),"复制错误信息"]})})]})}function ab({error:l,errorInfo:n}){const i=()=>{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(Te,{className:"w-full max-w-2xl shadow-lg",children:[e.jsxs(Oe,{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(Jt,{className:"h-8 w-8 text-red-600 dark:text-red-400"})}),e.jsx(Le,{className:"text-2xl font-bold",children:"页面出现了问题"}),e.jsx(ws,{className:"text-base mt-2",children:"应用程序遇到了意外错误。您可以尝试刷新页面或返回首页。"})]}),e.jsxs(Ae,{className:"space-y-4",children:[e.jsx(E3,{error:l,errorInfo:n}),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(dt,{className:"mr-2 h-4 w-4"}),"刷新页面"]}),e.jsxs(_,{onClick:i,variant:"outline",className:"flex-1",children:[e.jsx(Xo,{className:"mr-2 h-4 w-4"}),"返回首页"]})]}),e.jsx("p",{className:"text-xs text-center text-muted-foreground pt-2",children:"如果问题持续存在,请将错误信息复制并反馈给开发者"})]})]})})}class M3 extends d.Component{constructor(n){super(n),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(n){return{hasError:!0,error:n}}componentDidCatch(n,i){console.error("ErrorBoundary caught an error:",n,i),this.setState({errorInfo:i})}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 lb({error:l}){return e.jsx(ab,{error:l,errorInfo:null})}const hc=_0({component:()=>e.jsxs(e.Fragment,{children:[e.jsx(Pg,{}),!1]}),beforeLoad:()=>{if(window.location.pathname==="/"&&!j3())throw k0({to:"/auth"})}}),z3=Qs({getParentRoute:()=>hc,path:"/auth",component:s2}),A3=Qs({getParentRoute:()=>hc,path:"/setup",component:g2}),nt=Qs({getParentRoute:()=>hc,id:"protected",component:()=>e.jsx(C3,{children:e.jsx(Pg,{})}),errorComponent:({error:l})=>e.jsx(lb,{error:l})}),D3=Qs({getParentRoute:()=>nt,path:"/",component:M_}),O3=Qs({getParentRoute:()=>nt,path:"/config/bot",component:Y2}),R3=Qs({getParentRoute:()=>nt,path:"/config/modelProvider",component:iS}),L3=Qs({getParentRoute:()=>nt,path:"/config/model",component:AS}),U3=Qs({getParentRoute:()=>nt,path:"/config/adapter",component:e4}),$3=Qs({getParentRoute:()=>nt,path:"/resource/emoji",component:w4}),B3=Qs({getParentRoute:()=>nt,path:"/resource/expression",component:C4}),I3=Qs({getParentRoute:()=>nt,path:"/resource/person",component:X4}),P3=Qs({getParentRoute:()=>nt,path:"/resource/jargon",component:P4}),H3=Qs({getParentRoute:()=>nt,path:"/resource/knowledge-graph",component:rk}),F3=Qs({getParentRoute:()=>nt,path:"/resource/knowledge-base",component:ik}),G3=Qs({getParentRoute:()=>nt,path:"/logs",component:ok}),V3=Qs({getParentRoute:()=>nt,path:"/planner-monitor",component:jk}),q3=Qs({getParentRoute:()=>nt,path:"/chat",component:aC}),K3=Qs({getParentRoute:()=>nt,path:"/plugins",component:$k}),Q3=Qs({getParentRoute:()=>nt,path:"/plugin-detail",component:Qk}),Y3=Qs({getParentRoute:()=>nt,path:"/model-presets",component:Ik}),J3=Qs({getParentRoute:()=>nt,path:"/plugin-config",component:Fk}),X3=Qs({getParentRoute:()=>nt,path:"/plugin-mirrors",component:Vk}),Z3=Qs({getParentRoute:()=>nt,path:"/settings",component:Q_}),W3=Qs({getParentRoute:()=>nt,path:"/config/pack-market",component:ZC}),nb=Qs({getParentRoute:()=>nt,path:"/config/pack-market/$packId",component:h3}),e5=Qs({getParentRoute:()=>nt,path:"/survey/webui-feedback",component:vC}),s5=Qs({getParentRoute:()=>nt,path:"/survey/maibot-feedback",component:NC}),t5=Qs({getParentRoute:()=>nt,path:"/annual-report",component:yC}),a5=Qs({getParentRoute:()=>hc,path:"*",component:bv}),l5=hc.addChildren([z3,A3,nt.addChildren([D3,O3,R3,L3,U3,$3,B3,P3,I3,H3,F3,K3,Q3,Y3,J3,X3,G3,V3,q3,Z3,W3,nb,e5,s5,t5]),a5]),n5=S0({routeTree:l5,defaultNotFoundComponent:bv,defaultErrorComponent:({error:l})=>e.jsx(lb,{error:l})});function r5({children:l,defaultTheme:n="system",storageKey:i="ui-theme",...c}){const[u,x]=d.useState(()=>localStorage.getItem(i)||n);d.useEffect(()=>{const f=window.document.documentElement;if(f.classList.remove("light","dark"),u==="system"){const p=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";f.classList.add(p);return}f.classList.add(u)},[u]),d.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:u,setTheme:f=>{localStorage.setItem(i,f),x(f)}};return e.jsx(pv.Provider,{...c,value:h,children:l})}function i5({children:l,defaultEnabled:n=!0,defaultWavesEnabled:i=!0,storageKey:c="enable-animations",wavesStorageKey:u="enable-waves-background"}){const[x,h]=d.useState(()=>{const N=localStorage.getItem(c);return N!==null?N==="true":n}),[f,p]=d.useState(()=>{const N=localStorage.getItem(u);return N!==null?N==="true":i});d.useEffect(()=>{const N=document.documentElement;x?N.classList.remove("no-animations"):N.classList.add("no-animations"),localStorage.setItem(c,String(x))},[x,c]),d.useEffect(()=>{localStorage.setItem(u,String(f))},[f,u]);const g={enableAnimations:x,setEnableAnimations:h,enableWavesBackground:f,setEnableWavesBackground:p};return e.jsx(gv.Provider,{value:g,children:l})}const c5=Gw,rb=d.forwardRef(({className:l,...n},i)=>e.jsx(Tj,{ref:i,className:P("fixed bottom-0 right-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:max-w-[420px] gap-2",l),...n}));rb.displayName=Tj.displayName;const o5=Qr("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"}}),ib=d.forwardRef(({className:l,variant:n,...i},c)=>e.jsx(Ej,{ref:c,className:P(o5({variant:n}),l),...i}));ib.displayName=Ej.displayName;const d5=d.forwardRef(({className:l,...n},i)=>e.jsx(Mj,{ref:i,className:P("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",l),...n}));d5.displayName=Mj.displayName;const cb=d.forwardRef(({className:l,...n},i)=>e.jsx(zj,{ref:i,className:P("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",l),"toast-close":"",...n,children:e.jsx(Ea,{className:"h-4 w-4"})}));cb.displayName=zj.displayName;const ob=d.forwardRef(({className:l,...n},i)=>e.jsx(Aj,{ref:i,className:P("text-sm font-semibold [&+div]:text-xs",l),...n}));ob.displayName=Aj.displayName;const db=d.forwardRef(({className:l,...n},i)=>e.jsx(Dj,{ref:i,className:P("text-sm opacity-90",l),...n}));db.displayName=Dj.displayName;function u5(){const{toasts:l}=Zs();return e.jsxs(c5,{children:[l.map(function({id:n,title:i,description:c,action:u,...x}){return e.jsxs(ib,{...x,children:[e.jsxs("div",{className:"grid gap-1",children:[i&&e.jsx(ob,{children:i}),c&&e.jsx(db,{children:c})]}),u,e.jsx(cb,{})]},n)}),e.jsx(rb,{})]})}a_.createRoot(document.getElementById("root")).render(e.jsx(d.StrictMode,{children:e.jsx(M3,{children:e.jsx(r5,{defaultTheme:"system",children:e.jsx(i5,{children:e.jsxs(sS,{children:[e.jsx(C0,{router:n5}),e.jsx(lS,{}),e.jsx(u5,{})]})})})})})); diff --git a/webui/dist/assets/index-C6yBaKb0.css b/webui/dist/assets/index-C6yBaKb0.css new file mode 100644 index 00000000..24e95a2c --- /dev/null +++ b/webui/dist/assets/index-C6yBaKb0.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-y-0{top:0;bottom:0}.-bottom-20{bottom:-5rem}.-left-20{left:-5rem}.-right-20{right:-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-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-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-48{width:12rem}.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-\[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-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-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-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-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-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)}.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}.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\/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\: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-purple-950\/20:is(.dark *){--tw-gradient-to: rgb(59 7 100 / .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\: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-Cg1tZrb2.js b/webui/dist/assets/index-Cg1tZrb2.js deleted file mode 100644 index e9d0bdd0..00000000 --- a/webui/dist/assets/index-Cg1tZrb2.js +++ /dev/null @@ -1,90 +0,0 @@ -import{r as d,j as e,L as Bn,e as ca,R as As,b as v0,f as N0,g as b0,h as y0,k as w0,l as Qs,m as _0,n as S0,O as Bg,o as k0}from"./router-9vIXuQkh.js";import{a as C0,b as T0,g as E0}from"./react-vendor-BmxF9s7Q.js";import{N as M0,c as z0,O as Kr,P as A0,g as vm}from"./utils-BqoaXoQ1.js";import{L as Ig,T as Pg,C as Hg,R as O0,a as Fg,V as D0,b as R0,S as Gg,c as L0,d as Vg,I as U0,e as qg,f as $0,g as Kg,h as B0,i as I0,j as P0,O as Qg,P as H0,k as Yg,l as Jg,D as Xg,A as Zg,m as Wg,n as F0,o as G0,p as ej,q as V0,r as sj,s as q0,t as K0,u as tj,v as Q0,w as Y0,x as aj,y as lj,F as nj,z as rj,B as J0,E as X0,G as ij,H as Z0,J as W0,K as ew,M as sw,N as tw,Q as aw,U as lw,W as nw,X as rw,Y as iw,Z as cw,_ as ow,$ as dw,a0 as uw,a1 as mw,a2 as cj,a3 as xw,a4 as hw}from"./radix-extra-tU0cN6gS.js";import{R as oj,T as dj,L as fw,g as pw,C as Hi,X as Fi,Y as Ur,h as gw,B as Eo,j as Gi,P as jw,k as vw,l as Nw}from"./charts-simvewUa.js";import{S as bw,O as uj,o as yw,C as mj,p as ww,T as xj,D as hj,R as _w,q as Sw,H as fj,I as kw,J as pj,K as gj,L as Cw,M as jj,N as vj,Q as Tw,U as Nj,V as Ew,X as bj,Y as yj,Z as Mw,_ as zw,$ as wj,a0 as Aw,a1 as Ow,e as _j,f as qo,c as Ko,P as Qn,d as Qo,b as hn,h as Dw,l as Rw,m as Lw,u as Lm,r as Uw,a as $w,a2 as Bw,a3 as Sj,a4 as Iw,a5 as Pw,a6 as Hw,a7 as kj,a8 as Cj,a9 as Tj,aa as Ej,ab as Mj,ac as zj,ad as Fw}from"./radix-core-CEUnGg09.js";import{R as dt,a as Zi,C as _t,b as pt,L as Bs,X as Ea,c as Ct,d as na,e as Va,S as Tt,f as Aa,g as Zt,B as Pn,U as fn,P as cc,Z as Za,h as Aj,F as Ca,i as Gw,j as pn,k as Vw,M as Ma,A as Gm,D as qw,l as Hr,T as Vm,m as Kw,n as Oj,I as Ht,o as Jt,p as Ro,E as Wi,q as ia,H as Qw,r as ls,s as sa,t as ec,u as qm,v as Qi,w as rg,K as Km,x as Dj,y as Yw,z as Mo,G as Jw,J as Yo,N as Xw,O as Zw,Q as Jo,V as Ta,W as et,Y as za,_ as Fr,$ as Qm,a0 as Rj,a1 as oc,a2 as Lj,a3 as Uj,a4 as Fn,a5 as gn,a6 as jn,a7 as Ym,a8 as $j,a9 as ra,aa as Dl,ab as Gn,ac as Vn,ad as Xo,ae as Ww,af as e_,ag as s_,ah as Jm,ai as zo,aj as qn,ak as t_,al as Gr,am as Lo,an as a_,ao as Uo,ap as sc,aq as Bj,ar as l_,as as n_,at as $o,au as r_,av as Xm,aw as i_,ax as ig,ay as c_,az as o_,aA as Ij,aB as d_,aC as dn,aD as Pj,aE as Nm,aF as cg,aG as u_,aH as bm,aI as m_,aJ as x_,aK as h_,aL as f_,aM as Hj,aN as p_,aO as Vr,aP as g_,aQ as j_,aR as Fj,aS as Gj,aT as v_,aU as N_,aV as og,aW as b_,aX as y_,aY as w_,aZ as __,a_ as S_}from"./icons-Dluc6IJB.js";import{S as k_,p as C_,j as T_,a as E_,E as dg,R as M_,o as z_}from"./codemirror-TZqPU532.js";import{u as Vj,a as Bo,s as qj,K as Kj,P as Qj,b as Yj,D as Jj,c as Xj,S as Zj,v as A_,d as Wj,C as ev,h as O_}from"./dnd-BiPfFtVp.js";import{_ as ga,c as D_,g as sv,D as R_,z as ko}from"./misc-Dw5FBFSX.js";import{D as L_,U as U_}from"./uppy-wQRVMWCa.js";import{M as $_,r as B_,a as I_,b as P_}from"./markdown-CKA5gBQ9.js";import{c as H_,H as Io,P as Po,u as F_,d as G_,R as V_,B as q_,e as K_,C as Q_,M as Y_,f as J_}from"./reactflow-DtsZHOR4.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))c(u);new MutationObserver(u=>{for(const x of u)if(x.type==="childList")for(const h of x.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&c(h)}).observe(document,{childList:!0,subtree:!0});function i(u){const x={};return u.integrity&&(x.integrity=u.integrity),u.referrerPolicy&&(x.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?x.credentials="include":u.crossOrigin==="anonymous"?x.credentials="omit":x.credentials="same-origin",x}function c(u){if(u.ep)return;u.ep=!0;const x=i(u);fetch(u.href,x)}})();var ym={exports:{}},Bi={},wm={exports:{}},_m={};var ug;function X_(){return ug||(ug=1,(function(l){function n(z,V){var B=z.length;z.push(V);e:for(;0>>1,K=z[oe];if(0>>1;oe<_e;){var pe=2*(oe+1)-1,ke=z[pe],O=pe+1,k=z[O];if(0>u(ke,B))Ou(k,ke)?(z[oe]=k,z[O]=B,oe=O):(z[oe]=ke,z[pe]=B,oe=pe);else if(Ou(k,B))z[oe]=k,z[O]=B,oe=O;else break e}}return V}function u(z,V){var B=z.sortIndex-V.sortIndex;return B!==0?B:z.id-V.id}if(l.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var x=performance;l.unstable_now=function(){return x.now()}}else{var h=Date,f=h.now();l.unstable_now=function(){return h.now()-f}}var p=[],g=[],N=1,v=null,y=3,w=!1,b=!1,R=!1,D=!1,S=typeof setTimeout=="function"?setTimeout:null,P=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;function T(z){for(var V=i(g);V!==null;){if(V.callback===null)c(g);else if(V.startTime<=z)c(g),V.sortIndex=V.expirationTime,n(p,V);else break;V=i(g)}}function A(z){if(R=!1,T(z),!b)if(i(p)!==null)b=!0,F||(F=!0,he());else{var V=i(g);V!==null&&je(A,V.startTime-z)}}var F=!1,L=-1,J=5,U=-1;function ue(){return D?!0:!(l.unstable_now()-Uz&&ue());){var oe=v.callback;if(typeof oe=="function"){v.callback=null,y=v.priorityLevel;var K=oe(v.expirationTime<=z);if(z=l.unstable_now(),typeof K=="function"){v.callback=K,T(z),V=!0;break s}v===i(p)&&c(p),T(z)}else c(p);v=i(p)}if(v!==null)V=!0;else{var _e=i(g);_e!==null&&je(A,_e.startTime-z),V=!1}}break e}finally{v=null,y=B,w=!1}V=void 0}}finally{V?he():F=!1}}}var he;if(typeof M=="function")he=function(){M(xe)};else if(typeof MessageChannel<"u"){var ne=new MessageChannel,ve=ne.port2;ne.port1.onmessage=xe,he=function(){ve.postMessage(null)}}else he=function(){S(xe,0)};function je(z,V){L=S(function(){z(l.unstable_now())},V)}l.unstable_IdlePriority=5,l.unstable_ImmediatePriority=1,l.unstable_LowPriority=4,l.unstable_NormalPriority=3,l.unstable_Profiling=null,l.unstable_UserBlockingPriority=2,l.unstable_cancelCallback=function(z){z.callback=null},l.unstable_forceFrameRate=function(z){0>z||125oe?(z.sortIndex=B,n(g,z),i(p)===null&&z===i(g)&&(R?(P(L),L=-1):R=!0,je(A,B-oe))):(z.sortIndex=K,n(p,z),b||w||(b=!0,F||(F=!0,he()))),z},l.unstable_shouldYield=ue,l.unstable_wrapCallback=function(z){var V=y;return function(){var B=y;y=V;try{return z.apply(this,arguments)}finally{y=B}}}})(_m)),_m}var mg;function Z_(){return mg||(mg=1,wm.exports=X_()),wm.exports}var xg;function W_(){if(xg)return Bi;xg=1;var l=Z_(),n=C0(),i=T0();function c(s){var t="https://react.dev/errors/"+s;if(1K||(s.current=oe[K],oe[K]=null,K--)}function ke(s,t){K++,oe[K]=s.current,s.current=t}var O=_e(null),k=_e(null),H=_e(null),se=_e(null);function Ee(s,t){switch(ke(H,t),ke(k,s),ke(O,null),t.nodeType){case 9:case 11:s=(s=t.documentElement)&&(s=s.namespaceURI)?Ep(s):0;break;default:if(s=t.tagName,t=t.namespaceURI)t=Ep(t),s=Mp(t,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}pe(O),ke(O,s)}function Z(){pe(O),pe(k),pe(H)}function Oe(s){s.memoizedState!==null&&ke(se,s);var t=O.current,a=Mp(t,s.type);t!==a&&(ke(k,s),ke(O,a))}function ns(s){k.current===s&&(pe(O),pe(k)),se.current===s&&(pe(se),Ri._currentValue=B)}var Q,ee;function Ue(s){if(Q===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);Q=t&&t[1]||"",ee=-1)":-1o||$[r]!==ae[o]){var ge=` -`+$[r].replace(" at new "," at ");return s.displayName&&ge.includes("")&&(ge=ge.replace("",s.displayName)),ge}while(1<=r&&0<=o);break}}}finally{ie=!1,Error.prepareStackTrace=a}return(a=s?s.displayName||s.name:"")?Ue(a):""}function de(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 Te(s.type,!1);case 11:return Te(s.type.render,!1);case 1:return Te(s.type,!0);case 31:return Ue("Activity");default:return""}}function Me(s){try{var t="",a=null;do t+=de(s,a),a=s,s=s.return;while(s);return t}catch(r){return` -Error generating stack: `+r.message+` -`+r.stack}}var rs=Object.prototype.hasOwnProperty,Ut=l.unstable_scheduleCallback,aa=l.unstable_cancelCallback,Qa=l.unstable_shouldYield,Ft=l.unstable_requestPaint,mt=l.unstable_now,q=l.unstable_getCurrentPriorityLevel,Ve=l.unstable_ImmediatePriority,Ke=l.unstable_UserBlockingPriority,We=l.unstable_NormalPriority,Ls=l.unstable_LowPriority,ts=l.unstable_IdlePriority,Cs=l.log,ze=l.unstable_setDisableYieldValue,Ns=null,as=null;function es(s){if(typeof Cs=="function"&&ze(s),as&&typeof as.setStrictMode=="function")try{as.setStrictMode(Ns,s)}catch{}}var bs=Math.clz32?Math.clz32:tt,gt=Math.log,$t=Math.LN2;function tt(s){return s>>>=0,s===0?32:31-(gt(s)/$t|0)|0}var Ms=256,Et=262144,Bt=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 tl(s,t,a){var r=s.pendingLanes;if(r===0)return 0;var o=0,m=s.suspendedLanes,j=s.pingedLanes;s=s.warmLanes;var C=r&134217727;return C!==0?(r=C&~m,r!==0?o=Oa(r):(j&=C,j!==0?o=Oa(j):a||(a=C&~s,a!==0&&(o=Oa(a))))):(C=r&~m,C!==0?o=Oa(C):j!==0?o=Oa(j):a||(a=r&~s,a!==0&&(o=Oa(a)))),o===0?0:t!==0&&t!==o&&(t&m)===0&&(m=o&-o,a=t&-t,m>=a||m===32&&(a&4194048)!==0)?t:o}function ul(s,t){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&t)===0}function Xn(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 W(){var s=Bt;return Bt<<=1,(Bt&62914560)===0&&(Bt=4194304),s}function ye(s){for(var t=[],a=0;31>a;a++)t.push(s);return t}function Re(s,t){s.pendingLanes|=t,t!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function Hs(s,t,a,r,o,m){var j=s.pendingLanes;s.pendingLanes=a,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=a,s.entangledLanes&=a,s.errorRecoveryDisabledLanes&=a,s.shellSuspendCounter=0;var C=s.entanglements,$=s.expirationTimes,ae=s.hiddenUpdates;for(a=j&~a;0"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var xb=/[\n"\\]/g;function Ra(s){return s.replace(xb,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function xd(s,t,a,r,o,m,j,C){s.name="",j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?s.type=j:s.removeAttribute("type"),t!=null?j==="number"?(t===0&&s.value===""||s.value!=t)&&(s.value=""+Da(t)):s.value!==""+Da(t)&&(s.value=""+Da(t)):j!=="submit"&&j!=="reset"||s.removeAttribute("value"),t!=null?hd(s,j,Da(t)):a!=null?hd(s,j,Da(a)):r!=null&&s.removeAttribute("value"),o==null&&m!=null&&(s.defaultChecked=!!m),o!=null&&(s.checked=o&&typeof o!="function"&&typeof o!="symbol"),C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?s.name=""+Da(C):s.removeAttribute("name")}function yx(s,t,a,r,o,m,j,C){if(m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(s.type=m),t!=null||a!=null){if(!(m!=="submit"&&m!=="reset"||t!=null)){md(s);return}a=a!=null?""+Da(a):"",t=t!=null?""+Da(t):a,C||t===s.value||(s.value=t),s.defaultValue=t}r=r??o,r=typeof r!="function"&&typeof r!="symbol"&&!!r,s.checked=C?s.checked:!!r,s.defaultChecked=!!r,j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(s.name=j),md(s)}function hd(s,t,a){t==="number"&&fc(s.ownerDocument)===s||s.defaultValue===""+a||(s.defaultValue=""+a)}function ar(s,t,a,r){if(s=s.options,t){t={};for(var o=0;o"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),vd=!1;if(hl)try{var Wr={};Object.defineProperty(Wr,"passive",{get:function(){vd=!0}}),window.addEventListener("test",Wr,Wr),window.removeEventListener("test",Wr,Wr)}catch{vd=!1}var Il=null,Nd=null,gc=null;function Ex(){if(gc)return gc;var s,t=Nd,a=t.length,r,o="value"in Il?Il.value:Il.textContent,m=o.length;for(s=0;s=ti),Rx=" ",Lx=!1;function Ux(s,t){switch(s){case"keyup":return Pb.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function $x(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var ir=!1;function Fb(s,t){switch(s){case"compositionend":return $x(t);case"keypress":return t.which!==32?null:(Lx=!0,Rx);case"textInput":return s=t.data,s===Rx&&Lx?null:s;default:return null}}function Gb(s,t){if(ir)return s==="compositionend"||!Sd&&Ux(s,t)?(s=Ex(),gc=Nd=Il=null,ir=!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:a,offset:t-s};s=r}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=qx(a)}}function Qx(s,t){return s&&t?s===t?!0:s&&s.nodeType===3?!1:t&&t.nodeType===3?Qx(s,t.parentNode):"contains"in s?s.contains(t):s.compareDocumentPosition?!!(s.compareDocumentPosition(t)&16):!1:!1}function Yx(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var t=fc(s.document);t instanceof s.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)s=t.contentWindow;else break;t=fc(s.document)}return t}function Td(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 Zb=hl&&"documentMode"in document&&11>=document.documentMode,cr=null,Ed=null,ri=null,Md=!1;function Jx(s,t,a){var r=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Md||cr==null||cr!==fc(r)||(r=cr,"selectionStart"in r&&Td(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ri&&ni(ri,r)||(ri=r,r=uo(Ed,"onSelect"),0>=j,o-=j,al=1<<32-bs(t)+o|a<os?(Es=Ge,Ge=null):Es=Ge.sibling;var $s=ce(Y,Ge,te[os],Ne);if($s===null){Ge===null&&(Ge=Es);break}s&&Ge&&$s.alternate===null&&t(Y,Ge),G=m($s,G,os),Us===null?Qe=$s:Us.sibling=$s,Us=$s,Ge=Es}if(os===te.length)return a(Y,Ge),zs&&pl(Y,os),Qe;if(Ge===null){for(;osos?(Es=Ge,Ge=null):Es=Ge.sibling;var on=ce(Y,Ge,$s.value,Ne);if(on===null){Ge===null&&(Ge=Es);break}s&&Ge&&on.alternate===null&&t(Y,Ge),G=m(on,G,os),Us===null?Qe=on:Us.sibling=on,Us=on,Ge=Es}if($s.done)return a(Y,Ge),zs&&pl(Y,os),Qe;if(Ge===null){for(;!$s.done;os++,$s=te.next())$s=be(Y,$s.value,Ne),$s!==null&&(G=m($s,G,os),Us===null?Qe=$s:Us.sibling=$s,Us=$s);return zs&&pl(Y,os),Qe}for(Ge=r(Ge);!$s.done;os++,$s=te.next())$s=me(Ge,Y,os,$s.value,Ne),$s!==null&&(s&&$s.alternate!==null&&Ge.delete($s.key===null?os:$s.key),G=m($s,G,os),Us===null?Qe=$s:Us.sibling=$s,Us=$s);return s&&Ge.forEach(function(j0){return t(Y,j0)}),zs&&pl(Y,os),Qe}function Xs(Y,G,te,Ne){if(typeof te=="object"&&te!==null&&te.type===R&&te.key===null&&(te=te.props.children),typeof te=="object"&&te!==null){switch(te.$$typeof){case w:e:{for(var Qe=te.key;G!==null;){if(G.key===Qe){if(Qe=te.type,Qe===R){if(G.tag===7){a(Y,G.sibling),Ne=o(G,te.props.children),Ne.return=Y,Y=Ne;break e}}else if(G.elementType===Qe||typeof Qe=="object"&&Qe!==null&&Qe.$$typeof===J&&An(Qe)===G.type){a(Y,G.sibling),Ne=o(G,te.props),mi(Ne,te),Ne.return=Y,Y=Ne;break e}a(Y,G);break}else t(Y,G);G=G.sibling}te.type===R?(Ne=Cn(te.props.children,Y.mode,Ne,te.key),Ne.return=Y,Y=Ne):(Ne=Cc(te.type,te.key,te.props,null,Y.mode,Ne),mi(Ne,te),Ne.return=Y,Y=Ne)}return j(Y);case b:e:{for(Qe=te.key;G!==null;){if(G.key===Qe)if(G.tag===4&&G.stateNode.containerInfo===te.containerInfo&&G.stateNode.implementation===te.implementation){a(Y,G.sibling),Ne=o(G,te.children||[]),Ne.return=Y,Y=Ne;break e}else{a(Y,G);break}else t(Y,G);G=G.sibling}Ne=Ud(te,Y.mode,Ne),Ne.return=Y,Y=Ne}return j(Y);case J:return te=An(te),Xs(Y,G,te,Ne)}if(je(te))return He(Y,G,te,Ne);if(he(te)){if(Qe=he(te),typeof Qe!="function")throw Error(c(150));return te=Qe.call(te),Xe(Y,G,te,Ne)}if(typeof te.then=="function")return Xs(Y,G,Dc(te),Ne);if(te.$$typeof===M)return Xs(Y,G,Mc(Y,te),Ne);Rc(Y,te)}return typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint"?(te=""+te,G!==null&&G.tag===6?(a(Y,G.sibling),Ne=o(G,te),Ne.return=Y,Y=Ne):(a(Y,G),Ne=Ld(te,Y.mode,Ne),Ne.return=Y,Y=Ne),j(Y)):a(Y,G)}return function(Y,G,te,Ne){try{ui=0;var Qe=Xs(Y,G,te,Ne);return vr=null,Qe}catch(Ge){if(Ge===jr||Ge===Ac)throw Ge;var Us=Na(29,Ge,null,Y.mode);return Us.lanes=Ne,Us.return=Y,Us}finally{}}}var Dn=vh(!0),Nh=vh(!1),Vl=!1;function Yd(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Jd(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 Kl(s,t,a){var r=s.updateQueue;if(r===null)return null;if(r=r.shared,(Ps&2)!==0){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,t=kc(s),ah(s,null,a),t}return Sc(s,r,t,a),kc(s)}function xi(s,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var r=t.lanes;r&=s.pendingLanes,a|=r,t.lanes=a,Wt(s,a)}}function Xd(s,t){var a=s.updateQueue,r=s.alternate;if(r!==null&&(r=r.updateQueue,a===r)){var o=null,m=null;if(a=a.firstBaseUpdate,a!==null){do{var j={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};m===null?o=m=j:m=m.next=j,a=a.next}while(a!==null);m===null?o=m=t:m=m.next=t}else o=m=t;a={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:m,shared:r.shared,callbacks:r.callbacks},s.updateQueue=a;return}s=a.lastBaseUpdate,s===null?a.firstBaseUpdate=t:s.next=t,a.lastBaseUpdate=t}var Zd=!1;function hi(){if(Zd){var s=gr;if(s!==null)throw s}}function fi(s,t,a,r){Zd=!1;var o=s.updateQueue;Vl=!1;var m=o.firstBaseUpdate,j=o.lastBaseUpdate,C=o.shared.pending;if(C!==null){o.shared.pending=null;var $=C,ae=$.next;$.next=null,j===null?m=ae:j.next=ae,j=$;var ge=s.alternate;ge!==null&&(ge=ge.updateQueue,C=ge.lastBaseUpdate,C!==j&&(C===null?ge.firstBaseUpdate=ae:C.next=ae,ge.lastBaseUpdate=$))}if(m!==null){var be=o.baseState;j=0,ge=ae=$=null,C=m;do{var ce=C.lane&-536870913,me=ce!==C.lane;if(me?(Ts&ce)===ce:(r&ce)===ce){ce!==0&&ce===pr&&(Zd=!0),ge!==null&&(ge=ge.next={lane:0,tag:C.tag,payload:C.payload,callback:null,next:null});e:{var He=s,Xe=C;ce=t;var Xs=a;switch(Xe.tag){case 1:if(He=Xe.payload,typeof He=="function"){be=He.call(Xs,be,ce);break e}be=He;break e;case 3:He.flags=He.flags&-65537|128;case 0:if(He=Xe.payload,ce=typeof He=="function"?He.call(Xs,be,ce):He,ce==null)break e;be=v({},be,ce);break e;case 2:Vl=!0}}ce=C.callback,ce!==null&&(s.flags|=64,me&&(s.flags|=8192),me=o.callbacks,me===null?o.callbacks=[ce]:me.push(ce))}else me={lane:ce,tag:C.tag,payload:C.payload,callback:C.callback,next:null},ge===null?(ae=ge=me,$=be):ge=ge.next=me,j|=ce;if(C=C.next,C===null){if(C=o.shared.pending,C===null)break;me=C,C=me.next,me.next=null,o.lastBaseUpdate=me,o.shared.pending=null}}while(!0);ge===null&&($=be),o.baseState=$,o.firstBaseUpdate=ae,o.lastBaseUpdate=ge,m===null&&(o.shared.lanes=0),Zl|=j,s.lanes=j,s.memoizedState=be}}function bh(s,t){if(typeof s!="function")throw Error(c(191,s));s.call(t)}function yh(s,t){var a=s.callbacks;if(a!==null)for(s.callbacks=null,s=0;sm?m:8;var j=z.T,C={};z.T=C,gu(s,!1,t,a);try{var $=o(),ae=z.S;if(ae!==null&&ae(C,$),$!==null&&typeof $=="object"&&typeof $.then=="function"){var ge=iy($,r);ji(s,t,ge,Sa(s))}else ji(s,t,r,Sa(s))}catch(be){ji(s,t,{then:function(){},status:"rejected",reason:be},Sa())}finally{V.p=m,j!==null&&C.types!==null&&(j.types=C.types),z.T=j}}function xy(){}function fu(s,t,a,r){if(s.tag!==5)throw Error(c(476));var o=ef(s).queue;Wh(s,o,t,B,a===null?xy:function(){return sf(s),a(r)})}function ef(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:Nl,lastRenderedState:B},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Nl,lastRenderedState:a},next:null},s.memoizedState=t,s=s.alternate,s!==null&&(s.memoizedState=t),t}function sf(s){var t=ef(s);t.next===null&&(t=s.alternate.memoizedState),ji(s,t.next.queue,{},Sa())}function pu(){return Vt(Ri)}function tf(){return kt().memoizedState}function af(){return kt().memoizedState}function hy(s){for(var t=s.return;t!==null;){switch(t.tag){case 24:case 3:var a=Sa();s=ql(a);var r=Kl(t,s,a);r!==null&&(fa(r,t,a),xi(r,t,a)),t={cache:Vd()},s.payload=t;return}t=t.return}}function fy(s,t,a){var r=Sa();a={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Vc(s)?nf(t,a):(a=Dd(s,t,a,r),a!==null&&(fa(a,s,r),rf(a,t,r)))}function lf(s,t,a){var r=Sa();ji(s,t,a,r)}function ji(s,t,a,r){var o={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Vc(s))nf(t,o);else{var m=s.alternate;if(s.lanes===0&&(m===null||m.lanes===0)&&(m=t.lastRenderedReducer,m!==null))try{var j=t.lastRenderedState,C=m(j,a);if(o.hasEagerState=!0,o.eagerState=C,va(C,j))return Sc(s,t,o,0),Ws===null&&_c(),!1}catch{}finally{}if(a=Dd(s,t,o,r),a!==null)return fa(a,s,r),rf(a,t,r),!0}return!1}function gu(s,t,a,r){if(r={lane:2,revertLane:Yu(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Vc(s)){if(t)throw Error(c(479))}else t=Dd(s,a,r,2),t!==null&&fa(t,s,2)}function Vc(s){var t=s.alternate;return s===cs||t!==null&&t===cs}function nf(s,t){br=$c=!0;var a=s.pending;a===null?t.next=t:(t.next=a.next,a.next=t),s.pending=t}function rf(s,t,a){if((a&4194048)!==0){var r=t.lanes;r&=s.pendingLanes,a|=r,t.lanes=a,Wt(s,a)}}var vi={readContext:Vt,use:Pc,useCallback:vt,useContext:vt,useEffect:vt,useImperativeHandle:vt,useLayoutEffect:vt,useInsertionEffect:vt,useMemo:vt,useReducer:vt,useRef:vt,useState:vt,useDebugValue:vt,useDeferredValue:vt,useTransition:vt,useSyncExternalStore:vt,useId:vt,useHostTransitionStatus:vt,useFormState:vt,useActionState:vt,useOptimistic:vt,useMemoCache:vt,useCacheRefresh:vt};vi.useEffectEvent=vt;var cf={readContext:Vt,use:Pc,useCallback:function(s,t){return la().memoizedState=[s,t===void 0?null:t],s},useContext:Vt,useEffect:Gh,useImperativeHandle:function(s,t,a){a=a!=null?a.concat([s]):null,Fc(4194308,4,Qh.bind(null,t,s),a)},useLayoutEffect:function(s,t){return Fc(4194308,4,s,t)},useInsertionEffect:function(s,t){Fc(4,2,s,t)},useMemo:function(s,t){var a=la();t=t===void 0?null:t;var r=s();if(Rn){es(!0);try{s()}finally{es(!1)}}return a.memoizedState=[r,t],r},useReducer:function(s,t,a){var r=la();if(a!==void 0){var o=a(t);if(Rn){es(!0);try{a(t)}finally{es(!1)}}}else o=t;return r.memoizedState=r.baseState=o,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:o},r.queue=s,s=s.dispatch=fy.bind(null,cs,s),[r.memoizedState,s]},useRef:function(s){var t=la();return s={current:s},t.memoizedState=s},useState:function(s){s=du(s);var t=s.queue,a=lf.bind(null,cs,t);return t.dispatch=a,[s.memoizedState,a]},useDebugValue:xu,useDeferredValue:function(s,t){var a=la();return hu(a,s,t)},useTransition:function(){var s=du(!1);return s=Wh.bind(null,cs,s.queue,!0,!1),la().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,t,a){var r=cs,o=la();if(zs){if(a===void 0)throw Error(c(407));a=a()}else{if(a=t(),Ws===null)throw Error(c(349));(Ts&127)!==0||Th(r,t,a)}o.memoizedState=a;var m={value:a,getSnapshot:t};return o.queue=m,Gh(Mh.bind(null,r,m,s),[s]),r.flags|=2048,wr(9,{destroy:void 0},Eh.bind(null,r,m,a,t),null),a},useId:function(){var s=la(),t=Ws.identifierPrefix;if(zs){var a=ll,r=al;a=(r&~(1<<32-bs(r)-1)).toString(32)+a,t="_"+t+"R_"+a,a=Bc++,0<\/script>",m=m.removeChild(m.firstChild);break;case"select":m=typeof r.is=="string"?j.createElement("select",{is:r.is}):j.createElement("select"),r.multiple?m.multiple=!0:r.size&&(m.size=r.size);break;default:m=typeof r.is=="string"?j.createElement(o,{is:r.is}):j.createElement(o)}}m[gs]=t,m[is]=r;e:for(j=t.child;j!==null;){if(j.tag===5||j.tag===6)m.appendChild(j.stateNode);else if(j.tag!==4&&j.tag!==27&&j.child!==null){j.child.return=j,j=j.child;continue}if(j===t)break e;for(;j.sibling===null;){if(j.return===null||j.return===t)break e;j=j.return}j.sibling.return=j.return,j=j.sibling}t.stateNode=m;e:switch(Kt(m,o,r),o){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&yl(t)}}return ct(t),zu(t,t.type,s===null?null:s.memoizedProps,t.pendingProps,a),null;case 6:if(s&&t.stateNode!=null)s.memoizedProps!==r&&yl(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(c(166));if(s=H.current,hr(t)){if(s=t.stateNode,a=t.memoizedProps,r=null,o=Gt,o!==null)switch(o.tag){case 27:case 5:r=o.memoizedProps}s[gs]=t,s=!!(s.nodeValue===a||r!==null&&r.suppressHydrationWarning===!0||Cp(s.nodeValue,a)),s||Fl(t,!0)}else s=mo(s).createTextNode(r),s[gs]=t,t.stateNode=s}return ct(t),null;case 31:if(a=t.memoizedState,s===null||s.memoizedState!==null){if(r=hr(t),a!==null){if(s===null){if(!r)throw Error(c(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(c(557));s[gs]=t}else Tn(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;ct(t),s=!1}else a=Pd(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=a),s=!0;if(!s)return t.flags&256?(ya(t),t):(ya(t),null);if((t.flags&128)!==0)throw Error(c(558))}return ct(t),null;case 13:if(r=t.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(o=hr(t),r!==null&&r.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[gs]=t}else Tn(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;ct(t),o=!1}else o=Pd(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?(ya(t),t):(ya(t),null)}return ya(t),(t.flags&128)!==0?(t.lanes=a,t):(a=r!==null,s=s!==null&&s.memoizedState!==null,a&&(r=t.child,o=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(o=r.alternate.memoizedState.cachePool.pool),m=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(m=r.memoizedState.cachePool.pool),m!==o&&(r.flags|=2048)),a!==s&&a&&(t.child.flags|=8192),Jc(t,t.updateQueue),ct(t),null);case 4:return Z(),s===null&&Wu(t.stateNode.containerInfo),ct(t),null;case 10:return jl(t.type),ct(t),null;case 19:if(pe(St),r=t.memoizedState,r===null)return ct(t),null;if(o=(t.flags&128)!==0,m=r.rendering,m===null)if(o)bi(r,!1);else{if(Nt!==0||s!==null&&(s.flags&128)!==0)for(s=t.child;s!==null;){if(m=Uc(s),m!==null){for(t.flags|=128,bi(r,!1),s=m.updateQueue,t.updateQueue=s,Jc(t,s),t.subtreeFlags=0,s=a,a=t.child;a!==null;)lh(a,s),a=a.sibling;return ke(St,St.current&1|2),zs&&pl(t,r.treeForkCount),t.child}s=s.sibling}r.tail!==null&&mt()>so&&(t.flags|=128,o=!0,bi(r,!1),t.lanes=4194304)}else{if(!o)if(s=Uc(m),s!==null){if(t.flags|=128,o=!0,s=s.updateQueue,t.updateQueue=s,Jc(t,s),bi(r,!0),r.tail===null&&r.tailMode==="hidden"&&!m.alternate&&!zs)return ct(t),null}else 2*mt()-r.renderingStartTime>so&&a!==536870912&&(t.flags|=128,o=!0,bi(r,!1),t.lanes=4194304);r.isBackwards?(m.sibling=t.child,t.child=m):(s=r.last,s!==null?s.sibling=m:t.child=m,r.last=m)}return r.tail!==null?(s=r.tail,r.rendering=s,r.tail=s.sibling,r.renderingStartTime=mt(),s.sibling=null,a=St.current,ke(St,o?a&1|2:a&1),zs&&pl(t,r.treeForkCount),s):(ct(t),null);case 22:case 23:return ya(t),eu(),r=t.memoizedState!==null,s!==null?s.memoizedState!==null!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?(a&536870912)!==0&&(t.flags&128)===0&&(ct(t),t.subtreeFlags&6&&(t.flags|=8192)):ct(t),a=t.updateQueue,a!==null&&Jc(t,a.retryQueue),a=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(a=s.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==a&&(t.flags|=2048),s!==null&&pe(zn),null;case 24:return a=null,s!==null&&(a=s.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),jl(Mt),ct(t),null;case 25:return null;case 30:return null}throw Error(c(156,t.tag))}function Ny(s,t){switch(Bd(t),t.tag){case 1:return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 3:return jl(Mt),Z(),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(ya(t),t.alternate===null)throw Error(c(340));Tn()}return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 13:if(ya(t),s=t.memoizedState,s!==null&&s.dehydrated!==null){if(t.alternate===null)throw Error(c(340));Tn()}return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 19:return pe(St),null;case 4:return Z(),null;case 10:return jl(t.type),null;case 22:case 23:return ya(t),eu(),s!==null&&pe(zn),s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 24:return jl(Mt),null;case 25:return null;default:return null}}function Af(s,t){switch(Bd(t),t.tag){case 3:jl(Mt),Z();break;case 26:case 27:case 5:ns(t);break;case 4:Z();break;case 31:t.memoizedState!==null&&ya(t);break;case 13:ya(t);break;case 19:pe(St);break;case 10:jl(t.type);break;case 22:case 23:ya(t),eu(),s!==null&&pe(zn);break;case 24:jl(Mt)}}function yi(s,t){try{var a=t.updateQueue,r=a!==null?a.lastEffect:null;if(r!==null){var o=r.next;a=o;do{if((a.tag&s)===s){r=void 0;var m=a.create,j=a.inst;r=m(),j.destroy=r}a=a.next}while(a!==o)}}catch(C){Vs(t,t.return,C)}}function Jl(s,t,a){try{var r=t.updateQueue,o=r!==null?r.lastEffect:null;if(o!==null){var m=o.next;r=m;do{if((r.tag&s)===s){var j=r.inst,C=j.destroy;if(C!==void 0){j.destroy=void 0,o=t;var $=a,ae=C;try{ae()}catch(ge){Vs(o,$,ge)}}}r=r.next}while(r!==m)}}catch(ge){Vs(t,t.return,ge)}}function Of(s){var t=s.updateQueue;if(t!==null){var a=s.stateNode;try{yh(t,a)}catch(r){Vs(s,s.return,r)}}}function Df(s,t,a){a.props=Ln(s.type,s.memoizedProps),a.state=s.memoizedState;try{a.componentWillUnmount()}catch(r){Vs(s,t,r)}}function wi(s,t){try{var a=s.ref;if(a!==null){switch(s.tag){case 26:case 27:case 5:var r=s.stateNode;break;case 30:r=s.stateNode;break;default:r=s.stateNode}typeof a=="function"?s.refCleanup=a(r):a.current=r}}catch(o){Vs(s,t,o)}}function nl(s,t){var a=s.ref,r=s.refCleanup;if(a!==null)if(typeof r=="function")try{r()}catch(o){Vs(s,t,o)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(o){Vs(s,t,o)}else a.current=null}function Rf(s){var t=s.type,a=s.memoizedProps,r=s.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&r.focus();break e;case"img":a.src?r.src=a.src:a.srcSet&&(r.srcset=a.srcSet)}}catch(o){Vs(s,s.return,o)}}function Au(s,t,a){try{var r=s.stateNode;Hy(r,s.type,a,t),r[is]=t}catch(o){Vs(s,s.return,o)}}function Lf(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&an(s.type)||s.tag===4}function Ou(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||Lf(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&&an(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 Du(s,t,a){var r=s.tag;if(r===5||r===6)s=s.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(s,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(s),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=xl));else if(r!==4&&(r===27&&an(s.type)&&(a=s.stateNode,t=null),s=s.child,s!==null))for(Du(s,t,a),s=s.sibling;s!==null;)Du(s,t,a),s=s.sibling}function Xc(s,t,a){var r=s.tag;if(r===5||r===6)s=s.stateNode,t?a.insertBefore(s,t):a.appendChild(s);else if(r!==4&&(r===27&&an(s.type)&&(a=s.stateNode),s=s.child,s!==null))for(Xc(s,t,a),s=s.sibling;s!==null;)Xc(s,t,a),s=s.sibling}function Uf(s){var t=s.stateNode,a=s.memoizedProps;try{for(var r=s.type,o=t.attributes;o.length;)t.removeAttributeNode(o[0]);Kt(t,r,a),t[gs]=s,t[is]=a}catch(m){Vs(s,s.return,m)}}var wl=!1,Ot=!1,Ru=!1,$f=typeof WeakSet=="function"?WeakSet:Set,Pt=null;function by(s,t){if(s=s.containerInfo,tm=vo,s=Yx(s),Td(s)){if("selectionStart"in s)var a={start:s.selectionStart,end:s.selectionEnd};else e:{a=(a=s.ownerDocument)&&a.defaultView||window;var r=a.getSelection&&a.getSelection();if(r&&r.rangeCount!==0){a=r.anchorNode;var o=r.anchorOffset,m=r.focusNode;r=r.focusOffset;try{a.nodeType,m.nodeType}catch{a=null;break e}var j=0,C=-1,$=-1,ae=0,ge=0,be=s,ce=null;s:for(;;){for(var me;be!==a||o!==0&&be.nodeType!==3||(C=j+o),be!==m||r!==0&&be.nodeType!==3||($=j+r),be.nodeType===3&&(j+=be.nodeValue.length),(me=be.firstChild)!==null;)ce=be,be=me;for(;;){if(be===s)break s;if(ce===a&&++ae===o&&(C=j),ce===m&&++ge===r&&($=j),(me=be.nextSibling)!==null)break;be=ce,ce=be.parentNode}be=me}a=C===-1||$===-1?null:{start:C,end:$}}else a=null}a=a||{start:0,end:0}}else a=null;for(am={focusedElem:s,selectionRange:a},vo=!1,Pt=t;Pt!==null;)if(t=Pt,s=t.child,(t.subtreeFlags&1028)!==0&&s!==null)s.return=t,Pt=s;else for(;Pt!==null;){switch(t=Pt,m=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(a=0;a title"))),Kt(m,r,a),m[gs]=s,It(m),r=m;break e;case"link":var j=Gp("link","href",o).get(r+(a.href||""));if(j){for(var C=0;CXs&&(j=Xs,Xs=Xe,Xe=j);var Y=Kx(C,Xe),G=Kx(C,Xs);if(Y&&G&&(me.rangeCount!==1||me.anchorNode!==Y.node||me.anchorOffset!==Y.offset||me.focusNode!==G.node||me.focusOffset!==G.offset)){var te=be.createRange();te.setStart(Y.node,Y.offset),me.removeAllRanges(),Xe>Xs?(me.addRange(te),me.extend(G.node,G.offset)):(te.setEnd(G.node,G.offset),me.addRange(te))}}}}for(be=[],me=C;me=me.parentNode;)me.nodeType===1&&be.push({element:me,left:me.scrollLeft,top:me.scrollTop});for(typeof C.focus=="function"&&C.focus(),C=0;Ca?32:a,z.T=null,a=Hu,Hu=null;var m=en,j=Tl;if(Rt=0,Tr=en=null,Tl=0,(Ps&6)!==0)throw Error(c(331));var C=Ps;if(Ps|=4,Yf(m.current),qf(m,m.current,j,a),Ps=C,Ei(0,!1),as&&typeof as.onPostCommitFiberRoot=="function")try{as.onPostCommitFiberRoot(Ns,m)}catch{}return!0}finally{V.p=o,z.T=r,xp(s,t)}}function fp(s,t,a){t=Ua(a,t),t=bu(s.stateNode,t,2),s=Kl(s,t,2),s!==null&&(Re(s,2),rl(s))}function Vs(s,t,a){if(s.tag===3)fp(s,s,a);else for(;t!==null;){if(t.tag===3){fp(t,s,a);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Wl===null||!Wl.has(r))){s=Ua(a,s),a=pf(2),r=Kl(t,a,2),r!==null&&(gf(a,r,t,s),Re(r,2),rl(r));break}}t=t.return}}function qu(s,t,a){var r=s.pingCache;if(r===null){r=s.pingCache=new _y;var o=new Set;r.set(t,o)}else o=r.get(t),o===void 0&&(o=new Set,r.set(t,o));o.has(a)||($u=!0,o.add(a),s=Ey.bind(null,s,t,a),t.then(s,s))}function Ey(s,t,a){var r=s.pingCache;r!==null&&r.delete(t),s.pingedLanes|=s.suspendedLanes&a,s.warmLanes&=~a,Ws===s&&(Ts&a)===a&&(Nt===4||Nt===3&&(Ts&62914560)===Ts&&300>mt()-eo?(Ps&2)===0&&Er(s,0):Bu|=a,Cr===Ts&&(Cr=0)),rl(s)}function pp(s,t){t===0&&(t=W()),s=kn(s,t),s!==null&&(Re(s,t),rl(s))}function My(s){var t=s.memoizedState,a=0;t!==null&&(a=t.retryLane),pp(s,a)}function zy(s,t){var a=0;switch(s.tag){case 31:case 13:var r=s.stateNode,o=s.memoizedState;o!==null&&(a=o.retryLane);break;case 19:r=s.stateNode;break;case 22:r=s.stateNode._retryCache;break;default:throw Error(c(314))}r!==null&&r.delete(t),pp(s,a)}function Ay(s,t){return Ut(s,t)}var io=null,zr=null,Ku=!1,co=!1,Qu=!1,tn=0;function rl(s){s!==zr&&s.next===null&&(zr===null?io=zr=s:zr=zr.next=s),co=!0,Ku||(Ku=!0,Dy())}function Ei(s,t){if(!Qu&&co){Qu=!0;do for(var a=!1,r=io;r!==null;){if(s!==0){var o=r.pendingLanes;if(o===0)var m=0;else{var j=r.suspendedLanes,C=r.pingedLanes;m=(1<<31-bs(42|s)+1)-1,m&=o&~(j&~C),m=m&201326741?m&201326741|1:m?m|2:0}m!==0&&(a=!0,Np(r,m))}else m=Ts,m=tl(r,r===Ws?m:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),(m&3)===0||ul(r,m)||(a=!0,Np(r,m));r=r.next}while(a);Qu=!1}}function Oy(){gp()}function gp(){co=Ku=!1;var s=0;tn!==0&&Gy()&&(s=tn);for(var t=mt(),a=null,r=io;r!==null;){var o=r.next,m=jp(r,t);m===0?(r.next=null,a===null?io=o:a.next=o,o===null&&(zr=a)):(a=r,(s!==0||(m&3)!==0)&&(co=!0)),r=o}Rt!==0&&Rt!==5||Ei(s),tn!==0&&(tn=0)}function jp(s,t){for(var a=s.suspendedLanes,r=s.pingedLanes,o=s.expirationTimes,m=s.pendingLanes&-62914561;0C)break;var ge=$.transferSize,be=$.initiatorType;ge&&Tp(be)&&($=$.responseEnd,j+=ge*($"u"?null:document;function Ip(s,t,a){var r=Ar;if(r&&typeof t=="string"&&t){var o=Ra(t);o='link[rel="'+s+'"][href="'+o+'"]',typeof a=="string"&&(o+='[crossorigin="'+a+'"]'),Bp.has(o)||(Bp.add(o),s={rel:s,crossOrigin:a,href:t},r.querySelector(o)===null&&(t=r.createElement("link"),Kt(t,"link",s),It(t),r.head.appendChild(t)))}}function Wy(s){El.D(s),Ip("dns-prefetch",s,null)}function e0(s,t){El.C(s,t),Ip("preconnect",s,t)}function s0(s,t,a){El.L(s,t,a);var r=Ar;if(r&&s&&t){var o='link[rel="preload"][as="'+Ra(t)+'"]';t==="image"&&a&&a.imageSrcSet?(o+='[imagesrcset="'+Ra(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(o+='[imagesizes="'+Ra(a.imageSizes)+'"]')):o+='[href="'+Ra(s)+'"]';var m=o;switch(t){case"style":m=Or(s);break;case"script":m=Dr(s)}Fa.has(m)||(s=v({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:s,as:t},a),Fa.set(m,s),r.querySelector(o)!==null||t==="style"&&r.querySelector(Oi(m))||t==="script"&&r.querySelector(Di(m))||(t=r.createElement("link"),Kt(t,"link",s),It(t),r.head.appendChild(t)))}}function t0(s,t){El.m(s,t);var a=Ar;if(a&&s){var r=t&&typeof t.as=="string"?t.as:"script",o='link[rel="modulepreload"][as="'+Ra(r)+'"][href="'+Ra(s)+'"]',m=o;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":m=Dr(s)}if(!Fa.has(m)&&(s=v({rel:"modulepreload",href:s},t),Fa.set(m,s),a.querySelector(o)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Di(m)))return}r=a.createElement("link"),Kt(r,"link",s),It(r),a.head.appendChild(r)}}}function a0(s,t,a){El.S(s,t,a);var r=Ar;if(r&&s){var o=sr(r).hoistableStyles,m=Or(s);t=t||"default";var j=o.get(m);if(!j){var C={loading:0,preload:null};if(j=r.querySelector(Oi(m)))C.loading=5;else{s=v({rel:"stylesheet",href:s,"data-precedence":t},a),(a=Fa.get(m))&&dm(s,a);var $=j=r.createElement("link");It($),Kt($,"link",s),$._p=new Promise(function(ae,ge){$.onload=ae,$.onerror=ge}),$.addEventListener("load",function(){C.loading|=1}),$.addEventListener("error",function(){C.loading|=2}),C.loading|=4,ho(j,t,r)}j={type:"stylesheet",instance:j,count:1,state:C},o.set(m,j)}}}function l0(s,t){El.X(s,t);var a=Ar;if(a&&s){var r=sr(a).hoistableScripts,o=Dr(s),m=r.get(o);m||(m=a.querySelector(Di(o)),m||(s=v({src:s,async:!0},t),(t=Fa.get(o))&&um(s,t),m=a.createElement("script"),It(m),Kt(m,"link",s),a.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},r.set(o,m))}}function n0(s,t){El.M(s,t);var a=Ar;if(a&&s){var r=sr(a).hoistableScripts,o=Dr(s),m=r.get(o);m||(m=a.querySelector(Di(o)),m||(s=v({src:s,async:!0,type:"module"},t),(t=Fa.get(o))&&um(s,t),m=a.createElement("script"),It(m),Kt(m,"link",s),a.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},r.set(o,m))}}function Pp(s,t,a,r){var o=(o=H.current)?xo(o):null;if(!o)throw Error(c(446));switch(s){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=Or(a.href),a=sr(o).hoistableStyles,r=a.get(t),r||(r={type:"style",instance:null,count:0,state:null},a.set(t,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){s=Or(a.href);var m=sr(o).hoistableStyles,j=m.get(s);if(j||(o=o.ownerDocument||o,j={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},m.set(s,j),(m=o.querySelector(Oi(s)))&&!m._p&&(j.instance=m,j.state.loading=5),Fa.has(s)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Fa.set(s,a),m||r0(o,s,a,j.state))),t&&r===null)throw Error(c(528,""));return j}if(t&&r!==null)throw Error(c(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Dr(a),a=sr(o).hoistableScripts,r=a.get(t),r||(r={type:"script",instance:null,count:0,state:null},a.set(t,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(c(444,s))}}function Or(s){return'href="'+Ra(s)+'"'}function Oi(s){return'link[rel="stylesheet"]['+s+"]"}function Hp(s){return v({},s,{"data-precedence":s.precedence,precedence:null})}function r0(s,t,a,r){s.querySelector('link[rel="preload"][as="style"]['+t+"]")?r.loading=1:(t=s.createElement("link"),r.preload=t,t.addEventListener("load",function(){return r.loading|=1}),t.addEventListener("error",function(){return r.loading|=2}),Kt(t,"link",a),It(t),s.head.appendChild(t))}function Dr(s){return'[src="'+Ra(s)+'"]'}function Di(s){return"script[async]"+s}function Fp(s,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var r=s.querySelector('style[data-href~="'+Ra(a.href)+'"]');if(r)return t.instance=r,It(r),r;var o=v({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return r=(s.ownerDocument||s).createElement("style"),It(r),Kt(r,"style",o),ho(r,a.precedence,s),t.instance=r;case"stylesheet":o=Or(a.href);var m=s.querySelector(Oi(o));if(m)return t.state.loading|=4,t.instance=m,It(m),m;r=Hp(a),(o=Fa.get(o))&&dm(r,o),m=(s.ownerDocument||s).createElement("link"),It(m);var j=m;return j._p=new Promise(function(C,$){j.onload=C,j.onerror=$}),Kt(m,"link",r),t.state.loading|=4,ho(m,a.precedence,s),t.instance=m;case"script":return m=Dr(a.src),(o=s.querySelector(Di(m)))?(t.instance=o,It(o),o):(r=a,(o=Fa.get(m))&&(r=v({},a),um(r,o)),s=s.ownerDocument||s,o=s.createElement("script"),It(o),Kt(o,"link",r),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&&(r=t.instance,t.state.loading|=4,ho(r,a.precedence,s));return t.instance}function ho(s,t,a){for(var r=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),o=r.length?r[r.length-1]:null,m=o,j=0;j title"):null)}function i0(s,t,a){if(a===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 qp(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function c0(s,t,a,r){if(a.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var o=Or(r.href),m=t.querySelector(Oi(o));if(m){t=m._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(s.count++,s=po.bind(s),t.then(s,s)),a.state.loading|=4,a.instance=m,It(m);return}m=t.ownerDocument||t,r=Hp(r),(o=Fa.get(o))&&dm(r,o),m=m.createElement("link"),It(m);var j=m;j._p=new Promise(function(C,$){j.onload=C,j.onerror=$}),Kt(m,"link",r),a.instance=m}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(s.count++,a=po.bind(s),t.addEventListener("load",a),t.addEventListener("error",a))}}var mm=0;function o0(s,t){return s.stylesheets&&s.count===0&&jo(s,s.stylesheets),0mm?50:800)+t);return s.unsuspend=a,function(){s.unsuspend=null,clearTimeout(r),clearTimeout(o)}}:null}function po(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)jo(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var go=null;function jo(s,t){s.stylesheets=null,s.unsuspend!==null&&(s.count++,go=new Map,t.forEach(d0,s),go=null,po.call(s))}function d0(s,t){if(!(t.state.loading&4)){var a=go.get(s);if(a)var r=a.get(null);else{a=new Map,go.set(s,a);for(var o=s.querySelectorAll("link[data-precedence],style[data-precedence]"),m=0;m"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l)}catch(n){console.error(n)}}return l(),ym.exports=W_(),ym.exports}var s1=e1();function I(...l){return M0(z0(l))}const Ce=d.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:I("rounded-xl border bg-card text-card-foreground shadow",l),...n}));Ce.displayName="Card";const De=d.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:I("flex flex-col space-y-1.5 p-6",l),...n}));De.displayName="CardHeader";const Le=d.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:I("font-semibold leading-none tracking-tight",l),...n}));Le.displayName="CardTitle";const ws=d.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:I("text-sm text-muted-foreground",l),...n}));ws.displayName="CardDescription";const Ae=d.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:I("p-6 pt-0",l),...n}));Ae.displayName="CardContent";const Zo=d.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:I("flex items-center p-6 pt-0",l),...n}));Zo.displayName="CardFooter";const ta=O0,Xt=d.forwardRef(({className:l,...n},i)=>e.jsx(Ig,{ref:i,className:I("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",l),...n}));Xt.displayName=Ig.displayName;const Je=d.forwardRef(({className:l,...n},i)=>e.jsx(Pg,{ref:i,className:I("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",l),...n}));Je.displayName=Pg.displayName;const ys=d.forwardRef(({className:l,...n},i)=>e.jsx(Hg,{ref:i,className:I("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",l),...n}));ys.displayName=Hg.displayName;const Ye=d.forwardRef(({className:l,children:n,viewportRef:i,...c},u)=>e.jsxs(Fg,{ref:u,className:I("relative overflow-hidden",l),...c,children:[e.jsx(D0,{ref:i,className:"h-full w-full rounded-[inherit]",children:n}),e.jsx(Um,{}),e.jsx(Um,{orientation:"horizontal"}),e.jsx(R0,{})]}));Ye.displayName=Fg.displayName;const Um=d.forwardRef(({className:l,orientation:n="vertical",...i},c)=>e.jsx(Gg,{ref:c,orientation:n,className:I("flex touch-none select-none transition-colors",n==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",n==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",l),...i,children:e.jsx(L0,{className:"relative flex-1 rounded-full bg-border"})}));Um.displayName=Gg.displayName;function js({className:l,...n}){return e.jsx("div",{className:I("animate-pulse rounded-md bg-primary/10",l),...n})}const Kn=d.forwardRef(({className:l,value:n,...i},c)=>e.jsx(Vg,{ref:c,className:I("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",l),...i,children:e.jsx(U0,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(n||0)}%)`}})}));Kn.displayName=Vg.displayName;async function we(l,n){const c=n?.body instanceof FormData?{...n?.headers}:{"Content-Type":"application/json",...n?.headers},u={...n,credentials:"include",headers:c},x=await fetch(l,u);if(x.status===401)throw window.location.href="/auth",new Error("认证失败,请重新登录");return x}function Fs(){return{"Content-Type":"application/json"}}async function t1(){try{await fetch("/api/webui/auth/logout",{method:"POST",credentials:"include"})}catch(l){console.error("登出请求失败:",l)}window.location.href="/auth"}async function tc(){try{return(await(await fetch("/api/webui/auth/check",{method:"GET",credentials:"include"})).json()).authenticated===!0}catch{return!1}}const a1={light:"",dark:".dark"},tv=d.createContext(null);function av(){const l=d.useContext(tv);if(!l)throw new Error("useChart must be used within a ");return l}const $r=d.forwardRef(({id:l,className:n,children:i,config:c,...u},x)=>{const h=d.useId(),f=`chart-${l||h.replace(/:/g,"")}`;return e.jsx(tv.Provider,{value:{config:c},children:e.jsxs("div",{"data-chart":f,ref:x,className:I("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",n),...u,children:[e.jsx(l1,{id:f,config:c}),e.jsx(oj,{children:i})]})})});$r.displayName="Chart";const l1=({id:l,config:n})=>{const i=Object.entries(n).filter(([,c])=>c.theme||c.color);return i.length?e.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(a1).map(([c,u])=>` -${u} [data-chart=${l}] { -${i.map(([x,h])=>{const f=h.theme?.[c]||h.color;return f?` --color-${x}: ${f};`:null}).join(` -`)} -} -`).join(` -`)}}):null},Ii=dj,Br=d.forwardRef(({active:l,payload:n,className:i,indicator:c="dot",hideLabel:u=!1,hideIndicator:x=!1,label:h,labelFormatter:f,labelClassName:p,formatter:g,color:N,nameKey:v,labelKey:y},w)=>{const{config:b}=av(),R=d.useMemo(()=>{if(u||!n?.length)return null;const[S]=n,P=`${y||S?.dataKey||S?.name||"value"}`,M=$m(b,S,P),T=!y&&typeof h=="string"?b[h]?.label||h:M?.label;return f?e.jsx("div",{className:I("font-medium",p),children:f(T,n)}):T?e.jsx("div",{className:I("font-medium",p),children:T}):null},[h,f,n,u,p,b,y]);if(!l||!n?.length)return null;const D=n.length===1&&c!=="dot";return e.jsxs("div",{ref:w,className:I("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",i),children:[D?null:R,e.jsx("div",{className:"grid gap-1.5",children:n.filter(S=>S.type!=="none").map((S,P)=>{const M=`${v||S.name||S.dataKey||"value"}`,T=$m(b,S,M),A=N||S.payload.fill||S.color;return e.jsx("div",{className:I("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:[T?.icon?e.jsx(T.icon,{}):!x&&e.jsx("div",{className:I("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":D&&c==="dashed"}),style:{"--color-bg":A,"--color-border":A}}),e.jsxs("div",{className:I("flex flex-1 justify-between leading-none",D?"items-end":"items-center"),children:[e.jsxs("div",{className:"grid gap-1.5",children:[D?R:null,e.jsx("span",{className:"text-muted-foreground",children:T?.label||S.name})]}),S.value&&e.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:S.value.toLocaleString()})]})]})},S.dataKey)})})]})});Br.displayName="ChartTooltip";const n1=fw,lv=d.forwardRef(({className:l,hideIcon:n=!1,payload:i,verticalAlign:c="bottom",nameKey:u},x)=>{const{config:h}=av();return i?.length?e.jsx("div",{ref:x,className:I("flex items-center justify-center gap-4",c==="top"?"pb-3":"pt-3",l),children:i.filter(f=>f.type!=="none").map(f=>{const p=`${u||f.dataKey||"value"}`,g=$m(h,f,p);return e.jsxs("div",{className:I("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[g?.icon&&!n?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});lv.displayName="ChartLegend";function $m(l,n,i){if(typeof n!="object"||n===null)return;const c="payload"in n&&typeof n.payload=="object"&&n.payload!==null?n.payload:void 0;let u=i;return i in n&&typeof n[i]=="string"?u=n[i]:c&&i in c&&typeof c[i]=="string"&&(u=c[i]),u in l?l[u]:l[i]}const qr=Kr("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"}}),_=d.forwardRef(({className:l,variant:n,size:i,asChild:c=!1,...u},x)=>{const h=c?bw:"button";return e.jsx(h,{className:I(qr({variant:n,size:i,className:l})),ref:x,...u})});_.displayName="Button";const r1=Kr("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 Se({className:l,variant:n,...i}){return e.jsx("div",{className:I(r1({variant:n}),l),...i})}async function i1(){const l=await we("/api/webui/system/restart",{method:"POST",headers:Fs()});if(!l.ok){const n=await l.json();throw new Error(n.detail||"重启失败")}return await l.json()}async function c1(){const l=await we("/api/webui/system/status",{method:"GET",headers:Fs()});if(!l.ok){const n=await l.json();throw new Error(n.detail||"获取状态失败")}return await l.json()}const Lr={INITIAL_DELAY:3e3,CHECK_INTERVAL:2e3,CHECK_TIMEOUT:3e3,MAX_ATTEMPTS:60,PROGRESS_INTERVAL:200,SUCCESS_REDIRECT_DELAY:1500},nv=d.createContext(null);function Yn({children:l,onRestartComplete:n,onRestartFailed:i,healthCheckUrl:c="/api/webui/system/status",maxAttempts:u=Lr.MAX_ATTEMPTS}){const[x,h]=d.useState({status:"idle",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:u}),[f,p]=d.useState({}),g=d.useCallback(()=>{f.progress&&clearInterval(f.progress),f.elapsed&&clearInterval(f.elapsed),f.check&&clearTimeout(f.check),p({})},[f]),N=d.useCallback(()=>{g(),h({status:"idle",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:u})},[g,u]),v=d.useCallback(async()=>{try{const D=new AbortController,S=setTimeout(()=>D.abort(),Lr.CHECK_TIMEOUT),P=await fetch(c,{method:"GET",headers:{"Content-Type":"application/json"},credentials:"include",signal:D.signal});return clearTimeout(S),P.ok}catch{return!1}},[c]),y=d.useCallback(()=>{let D=0;const S=async()=>{if(D++,h(M=>({...M,status:"checking",checkAttempts:D})),await v())g(),h(M=>({...M,status:"success",progress:100})),setTimeout(()=>{n?.(),window.location.href="/auth"},Lr.SUCCESS_REDIRECT_DELAY);else if(D>=u){g();const M=`健康检查超时 (${D}/${u})`;h(T=>({...T,status:"failed",error:M})),i?.(M)}else{const M=setTimeout(S,Lr.CHECK_INTERVAL);p(T=>({...T,check:M}))}};S()},[v,g,u,n,i]),w=d.useCallback(()=>{h(D=>({...D,status:"checking",checkAttempts:0,error:void 0})),y()},[y]),b=d.useCallback(async D=>{const{delay:S=0,skipApiCall:P=!1}=D??{};if(x.status!=="idle"&&x.status!=="failed")return;if(g(),h({status:"requesting",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:u}),S>0&&await new Promise(A=>setTimeout(A,S)),P)h(A=>({...A,status:"restarting"}));else try{h(A=>({...A,status:"restarting"})),await Promise.race([i1(),new Promise(A=>setTimeout(A,5e3))])}catch{}const M=setInterval(()=>{h(A=>({...A,progress:A.progress>=90?A.progress:A.progress+1}))},Lr.PROGRESS_INTERVAL),T=setInterval(()=>{h(A=>({...A,elapsedTime:A.elapsedTime+1}))},1e3);p({progress:M,elapsed:T}),setTimeout(()=>{y()},Lr.INITIAL_DELAY)},[x.status,g,u,y]),R={state:x,isRestarting:x.status!=="idle",triggerRestart:b,resetState:N,retryHealthCheck:w};return e.jsx(nv.Provider,{value:R,children:l})}function vn(){const l=d.useContext(nv);if(!l)throw new Error("useRestart must be used within a RestartProvider");return l}function o1(){try{return vn()}catch{return null}}const d1=(l,n,i,c,u)=>({idle:{icon:null,title:"",description:"",tip:""},requesting:{icon:e.jsx(Bs,{className:"h-16 w-16 text-primary animate-spin"}),title:c??"准备重启",description:u??"正在发送重启请求...",tip:"🔄 正在准备重启麦麦..."},restarting:{icon:e.jsx(Bs,{className:"h-16 w-16 text-primary animate-spin"}),title:c??"正在重启麦麦",description:u??"请稍候,麦麦正在重启中...",tip:"🔄 配置已保存,正在重启主程序..."},checking:{icon:e.jsx(Bs,{className:"h-16 w-16 text-primary animate-spin"}),title:"检查服务状态",description:`等待服务恢复... (${n}/${i})`,tip:"⏳ 正在等待服务恢复,请勿关闭页面..."},success:{icon:e.jsx(pt,{className:"h-16 w-16 text-green-500"}),title:"重启成功",description:"正在跳转到登录页面...",tip:"✅ 配置已生效,服务运行正常"},failed:{icon:e.jsx(_t,{className:"h-16 w-16 text-destructive"}),title:"重启超时",description:"服务未能在预期时间内恢复",tip:"⚠️ 如果长时间无响应,请尝试手动重启"}})[l];function Jn({visible:l,onComplete:n,onFailed:i,title:c,description:u,showAnimation:x=!0,className:h}){const f=o1();return(f?f.isRestarting:l)?f?e.jsx(rv,{state:f.state,onRetry:f.retryHealthCheck,onComplete:n,onFailed:i,title:c,description:u,showAnimation:x,className:h}):e.jsx(u1,{onComplete:n,onFailed:i,title:c,description:u,showAnimation:x,className:h}):null}function rv({state:l,onRetry:n,onComplete:i,onFailed:c,title:u,description:x,showAnimation:h,className:f}){const{status:p,progress:g,elapsedTime:N,checkAttempts:v,maxAttempts:y}=l;d.useEffect(()=>{p==="success"&&i?i():p==="failed"&&c&&c()},[p,i,c]);const w=d1(p,v,y,u,x),b=R=>{const D=Math.floor(R/60),S=R%60;return`${D}:${S.toString().padStart(2,"0")}`};return e.jsxs("div",{className:I("fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center",f),children:[h&&e.jsx(m1,{}),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:[w.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:w.title}),e.jsx("p",{className:"text-muted-foreground text-center",children:w.description})]}),p!=="failed"&&p!=="idle"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(Kn,{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:["已用时: ",b(N)]})]})]}),e.jsx("div",{className:"bg-muted/50 rounded-lg p-4",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:w.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(dt,{className:"mr-2 h-4 w-4"}),"刷新页面"]}),e.jsxs(_,{onClick:n,variant:"secondary",className:"flex-1",children:[e.jsx(Zi,{className:"mr-2 h-4 w-4"}),"重试检测"]})]})]})]})}function u1({onComplete:l,onFailed:n,title:i,description:c,showAnimation:u,className:x}){const[h,f]=d.useState({status:"restarting",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:60}),p=d.useCallback(()=>{let g=0;const N=60,v=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(w=>({...w,status:"success",progress:100})),setTimeout(()=>{l?.(),window.location.href="/auth"},1500);return}}catch{}g>=N?(f(y=>({...y,status:"failed"})),n?.()):setTimeout(v,2e3)};v()},[l,n]);return d.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),v=setTimeout(()=>{p()},3e3);return()=>{clearInterval(g),clearInterval(N),clearTimeout(v)}},[p]),e.jsx(rv,{state:h,onRetry:p,onComplete:l,onFailed:n,title:i,description:c,showAnimation:u,className:x})}function m1(){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 Is=_w,Wo=Sw,x1=yw,iv=d.forwardRef(({className:l,...n},i)=>e.jsx(uj,{ref:i,className:I("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",l),...n}));iv.displayName=uj.displayName;const Os=d.forwardRef(({className:l,children:n,preventOutsideClose:i=!1,...c},u)=>e.jsxs(x1,{children:[e.jsx(iv,{}),e.jsxs(mj,{ref:u,className:I("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",l),onPointerDownOutside:i?x=>x.preventDefault():void 0,onInteractOutside:i?x=>x.preventDefault():void 0,...c,children:[n,e.jsxs(ww,{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(Ea,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Os.displayName=mj.displayName;const Ds=({className:l,...n})=>e.jsx("div",{className:I("flex flex-col space-y-1.5 text-center sm:text-left",l),...n});Ds.displayName="DialogHeader";const st=({className:l,...n})=>e.jsx("div",{className:I("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",l),...n});st.displayName="DialogFooter";const Rs=d.forwardRef(({className:l,...n},i)=>e.jsx(xj,{ref:i,className:I("text-lg font-semibold leading-none tracking-tight",l),...n}));Rs.displayName=xj.displayName;const Ks=d.forwardRef(({className:l,...n},i)=>e.jsx(hj,{ref:i,className:I("text-sm text-muted-foreground",l),...n}));Ks.displayName=hj.displayName;const le=d.forwardRef(({className:l,type:n,...i},c)=>e.jsx("input",{type:n,className:I("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",l),ref:c,...i}));le.displayName="Input";const qs=d.forwardRef(({className:l,...n},i)=>e.jsx(fj,{ref:i,className:I("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",l),...n,children:e.jsx(kw,{className:I("grid place-content-center text-current"),children:e.jsx(Ct,{className:"h-4 w-4"})})}));qs.displayName=fj.displayName;const h1=5,f1=5e3;let Sm=0;function p1(){return Sm=(Sm+1)%Number.MAX_SAFE_INTEGER,Sm.toString()}const km=new Map,fg=l=>{if(km.has(l))return;const n=setTimeout(()=>{km.delete(l),Yi({type:"REMOVE_TOAST",toastId:l})},f1);km.set(l,n)},g1=(l,n)=>{switch(n.type){case"ADD_TOAST":return{...l,toasts:[n.toast,...l.toasts].slice(0,h1)};case"UPDATE_TOAST":return{...l,toasts:l.toasts.map(i=>i.id===n.toast.id?{...i,...n.toast}:i)};case"DISMISS_TOAST":{const{toastId:i}=n;return i?fg(i):l.toasts.forEach(c=>{fg(c.id)}),{...l,toasts:l.toasts.map(c=>c.id===i||i===void 0?{...c,open:!1}:c)}}case"REMOVE_TOAST":return n.toastId===void 0?{...l,toasts:[]}:{...l,toasts:l.toasts.filter(i=>i.id!==n.toastId)}}},Ao=[];let Oo={toasts:[]};function Yi(l){Oo=g1(Oo,l),Ao.forEach(n=>{n(Oo)})}function Qt({...l}){const n=p1(),i=u=>Yi({type:"UPDATE_TOAST",toast:{...u,id:n}}),c=()=>Yi({type:"DISMISS_TOAST",toastId:n});return Yi({type:"ADD_TOAST",toast:{...l,id:n,open:!0,onOpenChange:u=>{u||c()}}}),{id:n,dismiss:c,update:i}}function Zs(){const[l,n]=d.useState(Oo);return d.useEffect(()=>(Ao.push(n),()=>{const i=Ao.indexOf(n);i>-1&&Ao.splice(i,1)}),[l]),{...l,toast:Qt,dismiss:i=>Yi({type:"DISMISS_TOAST",toastId:i})}}const el="/api/webui/expression";async function Zm(){const l=await we(`${el}/chats`,{});if(!l.ok){const n=await l.json();throw new Error(n.detail||"获取聊天列表失败")}return l.json()}async function j1(l){const n=new URLSearchParams;l.page&&n.append("page",l.page.toString()),l.page_size&&n.append("page_size",l.page_size.toString()),l.search&&n.append("search",l.search),l.chat_id&&n.append("chat_id",l.chat_id);const i=await we(`${el}/list?${n}`,{});if(!i.ok){const c=await i.json();throw new Error(c.detail||"获取表达方式列表失败")}return i.json()}async function v1(l){const n=await we(`${el}/${l}`,{});if(!n.ok){const i=await n.json();throw new Error(i.detail||"获取表达方式详情失败")}return n.json()}async function N1(l){const n=await we(`${el}/`,{method:"POST",body:JSON.stringify(l)});if(!n.ok){const i=await n.json();throw new Error(i.detail||"创建表达方式失败")}return n.json()}async function b1(l,n){const i=await we(`${el}/${l}`,{method:"PATCH",body:JSON.stringify(n)});if(!i.ok){const c=await i.json();throw new Error(c.detail||"更新表达方式失败")}return i.json()}async function y1(l){const n=await we(`${el}/${l}`,{method:"DELETE"});if(!n.ok){const i=await n.json();throw new Error(i.detail||"删除表达方式失败")}return n.json()}async function w1(l){const n=await we(`${el}/batch/delete`,{method:"POST",body:JSON.stringify({ids:l})});if(!n.ok){const i=await n.json();throw new Error(i.detail||"批量删除表达方式失败")}return n.json()}async function _1(){const l=await we(`${el}/stats/summary`,{});if(!l.ok){const n=await l.json();throw new Error(n.detail||"获取统计数据失败")}return l.json()}async function Wm(){const l=await we(`${el}/review/stats`);if(!l.ok){const n=await l.json();throw new Error(n.detail||"获取审核统计失败")}return l.json()}async function S1(l){const n=new URLSearchParams;l.page&&n.append("page",l.page.toString()),l.page_size&&n.append("page_size",l.page_size.toString()),l.filter_type&&n.append("filter_type",l.filter_type),l.search&&n.append("search",l.search),l.chat_id&&n.append("chat_id",l.chat_id);const i=await we(`${el}/review/list?${n}`);if(!i.ok){const c=await i.json();throw new Error(c.detail||"获取审核列表失败")}return i.json()}async function pg(l){const n=await we(`${el}/review/batch`,{method:"POST",body:JSON.stringify({items:l})});if(!n.ok){const i=await n.json();throw new Error(i.detail||"批量审核失败")}return n.json()}function cv({open:l,onOpenChange:n}){const[i,c]=d.useState(null),[u,x]=d.useState([]),[h,f]=d.useState(!1),[p,g]=d.useState(!1),[N,v]=d.useState(0),[y,w]=d.useState(1),[b]=d.useState(20),[R,D]=d.useState("unchecked"),[S,P]=d.useState(""),[M,T]=d.useState(""),[A,F]=d.useState(new Set),[L,J]=d.useState(new Set),[U,ue]=d.useState(new Map),{toast:xe}=Zs(),he=d.useCallback(async()=>{try{g(!0);const k=await Wm();c(k)}catch(k){console.error("加载统计失败:",k)}finally{g(!1)}},[]),ne=d.useCallback(async()=>{try{f(!0);const k=await S1({page:y,page_size:b,filter_type:R,search:S||void 0});x(k.data),v(k.total)}catch(k){xe({title:"加载失败",description:k instanceof Error?k.message:"无法加载列表",variant:"destructive"})}finally{f(!1)}},[y,b,R,S,xe]),ve=d.useCallback(async()=>{try{const k=await Zm();if(k?.data){const H=new Map;k.data.forEach(se=>{H.set(se.chat_id,se.chat_name)}),ue(H)}}catch(k){console.error("加载聊天名称失败:",k)}},[]);d.useEffect(()=>{l&&(he(),ne(),ve())},[l,he,ne,ve]),d.useEffect(()=>{w(1),F(new Set)},[R,S]);const je=()=>{P(M),w(1)},z=k=>U.get(k)||k,V=async(k,H)=>{try{J(Ee=>new Set(Ee).add(k));const se=await pg([{id:k,rejected:H,require_unchecked:R==="unchecked"}]);se.results[0]?.success?(xe({title:H?"已拒绝":"已通过",description:`表达方式 #${k} ${H?"已拒绝":"已通过"}`}),ne(),he()):xe({title:"操作失败",description:se.results[0]?.message||"未知错误",variant:"destructive"})}catch(se){xe({title:"操作失败",description:se instanceof Error?se.message:"未知错误",variant:"destructive"})}finally{J(se=>{const Ee=new Set(se);return Ee.delete(k),Ee})}},B=async k=>{if(A.size===0){xe({title:"请选择",description:"请先选择要审核的表达方式",variant:"destructive"});return}try{f(!0);const H=Array.from(A).map(Ee=>({id:Ee,rejected:k,require_unchecked:R==="unchecked"})),se=await pg(H);xe({title:"批量审核完成",description:`成功 ${se.succeeded} 条,失败 ${se.failed} 条`,variant:se.failed>0?"destructive":"default"}),F(new Set),ne(),he()}catch(H){xe({title:"批量审核失败",description:H instanceof Error?H.message:"未知错误",variant:"destructive"})}finally{f(!1)}},oe=()=>{A.size===u.length?F(new Set):F(new Set(u.map(k=>k.id)))},K=k=>{F(H=>{const se=new Set(H);return se.has(k)?se.delete(k):se.add(k),se})},_e=k=>k?new Date(k*1e3).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"-",pe=k=>k.checked?k.rejected?e.jsxs(Se,{variant:"destructive",className:"gap-1",children:[e.jsx(Va,{className:"h-3 w-3"}),"已拒绝"]}):e.jsxs(Se,{variant:"default",className:"gap-1 bg-green-600",children:[e.jsx(pt,{className:"h-3 w-3"}),"已通过"]}):e.jsxs(Se,{variant:"outline",className:"gap-1",children:[e.jsx(na,{className:"h-3 w-3"}),"待审核"]}),ke=k=>k?k==="ai"?e.jsxs(Se,{variant:"secondary",className:"gap-1 text-xs",children:[e.jsx(Pn,{className:"h-3 w-3"}),"AI"]}):e.jsxs(Se,{variant:"secondary",className:"gap-1 text-xs",children:[e.jsx(fn,{className:"h-3 w-3"}),"人工"]}):null,O=Math.ceil(N/b);return e.jsx(Is,{open:l,onOpenChange:n,children:e.jsxs(Os,{className:"max-w-5xl h-[85vh] flex flex-col p-0",children:[e.jsxs(Ds,{className:"px-6 pt-6 pb-4 border-b shrink-0",children:[e.jsx(Rs,{className:"text-xl",children:"表达方式审核"}),e.jsx(Ks,{children:"审核麦麦学习到的表达方式。通过审核的项目才会被使用(可在配置中调整),被拒绝的项目永远不会被使用。"}),e.jsxs("div",{className:"grid grid-cols-4 gap-3 mt-4",children:[e.jsxs("div",{className:"rounded-lg border p-3 text-center",children:[e.jsx("div",{className:"text-2xl font-bold text-orange-500",children:p?"-":i?.unchecked??0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"待审核"})]}),e.jsxs("div",{className:"rounded-lg border p-3 text-center",children:[e.jsx("div",{className:"text-2xl font-bold text-green-500",children:p?"-":i?.passed??0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"已通过"})]}),e.jsxs("div",{className:"rounded-lg border p-3 text-center",children:[e.jsx("div",{className:"text-2xl font-bold text-red-500",children:p?"-":i?.rejected??0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"已拒绝"})]}),e.jsxs("div",{className:"rounded-lg border p-3 text-center",children:[e.jsx("div",{className:"text-2xl font-bold text-blue-500",children:p?"-":i?.total??0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"总计"})]})]})]}),e.jsxs("div",{className:"px-6 py-3 border-b shrink-0 space-y-3",children:[e.jsx(ta,{value:R,onValueChange:k=>D(k),className:"w-full",children:e.jsxs(Xt,{className:"grid w-full grid-cols-4",children:[e.jsxs(Je,{value:"unchecked",className:"gap-1",children:[e.jsx(na,{className:"h-4 w-4"}),"待审核 (",i?.unchecked??0,")"]}),e.jsxs(Je,{value:"passed",className:"gap-1",children:[e.jsx(pt,{className:"h-4 w-4"}),"已通过 (",i?.passed??0,")"]}),e.jsxs(Je,{value:"rejected",className:"gap-1",children:[e.jsx(Va,{className:"h-4 w-4"}),"已拒绝 (",i?.rejected??0,")"]}),e.jsxs(Je,{value:"all",className:"gap-1",children:["全部 (",i?.total??0,")"]})]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(Tt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(le,{placeholder:"搜索情景或风格...",value:M,onChange:k=>T(k.target.value),onKeyDown:k=>k.key==="Enter"&&je(),className:"pl-9"})]}),e.jsx(_,{variant:"outline",size:"icon",onClick:je,children:e.jsx(Tt,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"icon",onClick:()=>{ne(),he()},disabled:h,children:e.jsx(dt,{className:I("h-4 w-4",h&&"animate-spin")})}),R==="unchecked"&&A.size>0&&e.jsxs(e.Fragment,{children:[e.jsxs(_,{variant:"default",size:"sm",className:"bg-green-600 hover:bg-green-700",onClick:()=>B(!1),disabled:h,children:[e.jsx(pt,{className:"h-4 w-4 mr-1"}),"批量通过 (",A.size,")"]}),e.jsxs(_,{variant:"destructive",size:"sm",onClick:()=>B(!0),disabled:h,children:[e.jsx(Va,{className:"h-4 w-4 mr-1"}),"批量拒绝 (",A.size,")"]})]})]})]}),e.jsx(Ye,{className:"flex-1 px-6",children:h&&u.length===0?e.jsx("div",{className:"flex items-center justify-center h-40",children:e.jsx(dt,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):u.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-40 text-muted-foreground",children:[e.jsx(_t,{className:"h-8 w-8 mb-2"}),e.jsx("p",{children:"没有找到表达方式"})]}):e.jsxs("div",{className:"space-y-2 py-2",children:[R==="unchecked"&&u.length>0&&e.jsxs("div",{className:"flex items-center gap-2 py-2 px-3 rounded-lg bg-muted/50",children:[e.jsx(qs,{checked:A.size===u.length&&u.length>0,onCheckedChange:oe}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["全选当前页 (",u.length," 条)"]})]}),u.map(k=>e.jsx("div",{className:I("rounded-lg border p-4 space-y-3 transition-colors",A.has(k.id)&&"bg-accent border-primary",L.has(k.id)&&"opacity-50"),children:e.jsxs("div",{className:"flex items-start gap-3",children:[R==="unchecked"&&e.jsx(qs,{checked:A.has(k.id),onCheckedChange:()=>K(k.id),disabled:L.has(k.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:k.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:k.style})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[e.jsxs("span",{children:["#",k.id]}),e.jsx("span",{children:"·"}),e.jsx("span",{title:z(k.chat_id),className:"truncate max-w-32",children:z(k.chat_id)}),e.jsx("span",{children:"·"}),e.jsx("span",{children:_e(k.create_date)}),pe(k),ke(k.modified_by)]})]}),e.jsx("div",{className:"flex flex-col gap-2 shrink-0",children:R==="unchecked"?e.jsxs(e.Fragment,{children:[e.jsxs(_,{size:"sm",variant:"outline",className:"text-green-600 hover:text-green-700 hover:bg-green-50",onClick:()=>V(k.id,!1),disabled:L.has(k.id),children:[e.jsx(pt,{className:"h-4 w-4 mr-1"}),"通过"]}),e.jsxs(_,{size:"sm",variant:"outline",className:"text-red-600 hover:text-red-700 hover:bg-red-50",onClick:()=>V(k.id,!0),disabled:L.has(k.id),children:[e.jsx(Va,{className:"h-4 w-4 mr-1"}),"拒绝"]})]}):R==="passed"?e.jsxs(_,{size:"sm",variant:"outline",className:"text-red-600 hover:text-red-700 hover:bg-red-50",onClick:()=>V(k.id,!0),disabled:L.has(k.id),children:[e.jsx(Va,{className:"h-4 w-4 mr-1"}),"改为拒绝"]}):R==="rejected"?e.jsxs(_,{size:"sm",variant:"outline",className:"text-green-600 hover:text-green-700 hover:bg-green-50",onClick:()=>V(k.id,!1),disabled:L.has(k.id),children:[e.jsx(pt,{className:"h-4 w-4 mr-1"}),"改为通过"]}):e.jsx(e.Fragment,{children:k.rejected?e.jsxs(_,{size:"sm",variant:"outline",className:"text-green-600 hover:text-green-700 hover:bg-green-50",onClick:()=>V(k.id,!1),disabled:L.has(k.id),children:[e.jsx(pt,{className:"h-4 w-4 mr-1"}),"改为通过"]}):k.checked?e.jsxs(_,{size:"sm",variant:"outline",className:"text-red-600 hover:text-red-700 hover:bg-red-50",onClick:()=>V(k.id,!0),disabled:L.has(k.id),children:[e.jsx(Va,{className:"h-4 w-4 mr-1"}),"改为拒绝"]}):e.jsxs(e.Fragment,{children:[e.jsxs(_,{size:"sm",variant:"outline",className:"text-green-600 hover:text-green-700 hover:bg-green-50",onClick:()=>V(k.id,!1),disabled:L.has(k.id),children:[e.jsx(pt,{className:"h-4 w-4 mr-1"}),"通过"]}),e.jsxs(_,{size:"sm",variant:"outline",className:"text-red-600 hover:text-red-700 hover:bg-red-50",onClick:()=>V(k.id,!0),disabled:L.has(k.id),children:[e.jsx(Va,{className:"h-4 w-4 mr-1"}),"拒绝"]})]})})})]})},k.id))]})}),e.jsxs("div",{className:"px-6 py-3 border-t shrink-0 flex items-center justify-between",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",N," 条,第 ",y,"/",O||1," 页"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>w(k=>Math.max(1,k-1)),disabled:y<=1||h,children:[e.jsx(Aa,{className:"h-4 w-4"}),"上一页"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>w(k=>Math.min(O,k+1)),disabled:y>=O||h,children:["下一页",e.jsx(Zt,{className:"h-4 w-4"})]})]})]})]})})}function k1(){return e.jsx(Yn,{children:e.jsx(T1,{})})}const C1=l=>{const n=[];for(let i=0;i{try{const O=await Wm();M(O.unchecked)}catch(O){console.error("获取审核统计失败:",O)}},[]),L=d.useCallback(async()=>{try{w(!0);const O=await A0.get("https://v1.hitokoto.cn/?c=a&c=b&c=c&c=d&c=h&c=i&c=k");v({hitokoto:O.data.hitokoto,from:O.data.from||O.data.from_who||"未知"})}catch(O){console.error("获取一言失败:",O),v({hitokoto:"人生就像一盒巧克力,你永远不知道下一颗是什么味道。",from:"阿甘正传"})}finally{w(!1)}},[]),J=d.useCallback(async()=>{try{const O=await we("/api/webui/system/status");if(O.ok){const k=await O.json();R(k)}else R(null)}catch(O){console.error("获取机器人状态失败:",O),R(null)}},[]),U=async()=>{await T()},ue=d.useCallback(async()=>{try{const O=await we(`/api/webui/statistics/dashboard?hours=${h}`);if(O.ok){const k=await O.json();n(k)}c(!1),x(100)}catch(O){console.error("Failed to fetch dashboard data:",O),c(!1),x(100)}},[h]);if(d.useEffect(()=>{if(!i)return;x(0);const O=setTimeout(()=>x(15),200),k=setTimeout(()=>x(30),800),H=setTimeout(()=>x(45),2e3),se=setTimeout(()=>x(60),4e3),Ee=setTimeout(()=>x(75),6500),Z=setTimeout(()=>x(85),9e3),Oe=setTimeout(()=>x(92),11e3);return()=>{clearTimeout(O),clearTimeout(k),clearTimeout(H),clearTimeout(se),clearTimeout(Ee),clearTimeout(Z),clearTimeout(Oe)}},[i]),d.useEffect(()=>{ue(),L(),J(),F()},[ue,L,J,F]),d.useEffect(()=>{if(!p)return;const O=setInterval(()=>{ue(),J()},3e4);return()=>clearInterval(O)},[p,ue,J]),i||!l)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(dt,{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(Kn,{value:u,className:"h-2"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[u,"%"]})]})]})});const{summary:xe,model_stats:he=[],hourly_data:ne=[],daily_data:ve=[],recent_activity:je=[]}=l,z=xe??{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},V=O=>{const k=Math.floor(O/3600),H=Math.floor(O%3600/60);return`${k}小时${H}分钟`},B=O=>{const k=O.toLocaleString("zh-CN");return O>=1e9?{display:`${(O/1e9).toFixed(2)}B`,exact:k,needsExact:!0}:O>=1e6?{display:`${(O/1e6).toFixed(2)}M`,exact:k,needsExact:!0}:O>=1e4?{display:`${(O/1e3).toFixed(1)}K`,exact:k,needsExact:!0}:O>=1e3?{display:`${(O/1e3).toFixed(2)}K`,exact:k,needsExact:!0}:{display:k,exact:k,needsExact:!1}},oe=O=>{const k=`¥${O.toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2})}`;return O>=1e6?{display:`¥${(O/1e6).toFixed(2)}M`,exact:k,needsExact:!0}:O>=1e4?{display:`¥${(O/1e3).toFixed(1)}K`,exact:k,needsExact:!0}:O>=1e3?{display:`¥${(O/1e3).toFixed(2)}K`,exact:k,needsExact:!0}:{display:k,exact:k,needsExact:!1}},K=O=>new Date(O).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),_e=C1(he.length),pe=he.map((O,k)=>({name:O.model_name,value:O.request_count,fill:_e[k]})),ke={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(Ye,{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(ta,{value:h.toString(),onValueChange:O=>f(Number(O)),children:e.jsxs(Xt,{className:"grid grid-cols-3 w-full sm:w-auto",children:[e.jsx(Je,{value:"24",children:"24小时"}),e.jsx(Je,{value:"168",children:"7天"}),e.jsx(Je,{value:"720",children:"30天"})]})}),e.jsxs(_,{variant:p?"default":"outline",size:"sm",onClick:()=>g(!p),className:"gap-2",children:[e.jsx(dt,{className:`h-4 w-4 ${p?"animate-spin":""}`}),e.jsx("span",{className:"hidden sm:inline",children:"自动刷新"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:ue,children:e.jsx(dt,{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(js,{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(dt,{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(Le,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(cc,{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:b?.running?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-3 w-3 rounded-full bg-green-500 animate-pulse"}),e.jsxs(Se,{variant:"outline",className:"text-green-600 border-green-300 bg-green-50",children:[e.jsx(pt,{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(Se,{variant:"outline",className:"text-red-600 border-red-300 bg-red-50",children:[e.jsx(_t,{className:"h-3 w-3 mr-1"}),"已停止"]})]})}),b&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:[e.jsxs("span",{children:["v",b.version]}),e.jsx("span",{className:"mx-2",children:"|"}),e.jsxs("span",{children:["运行 ",V(b.uptime)]})]})]})})]}),e.jsxs(Ce,{children:[e.jsx(De,{className:"pb-3",children:e.jsxs(Le,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Za,{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:U,disabled:A,className:"gap-2",children:[e.jsx(Zi,{className:`h-4 w-4 ${A?"animate-spin":""}`}),A?"重启中...":"重启麦麦"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>S(!0),className:"gap-2",children:[e.jsx(Aj,{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(Bn,{to:"/logs",children:[e.jsx(Ca,{className:"h-4 w-4"}),"查看日志"]})}),e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Bn,{to:"/plugins",children:[e.jsx(Gw,{className:"h-4 w-4"}),"插件管理"]})}),e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Bn,{to:"/settings",children:[e.jsx(pn,{className:"h-4 w-4"}),"系统设置"]})})]})})]}),e.jsxs(Ce,{children:[e.jsxs(De,{className:"pb-3",children:[e.jsxs(Le,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Vw,{className:"h-4 w-4"}),"反馈问卷"]}),e.jsx(ws,{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(Bn,{to:"/survey/webui-feedback",children:[e.jsx(Ca,{className:"h-4 w-4"}),"WebUI 反馈"]})}),e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Bn,{to:"/survey/maibot-feedback",children:[e.jsx(Ma,{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(Le,{className:"text-sm font-medium",children:"总请求数"}),e.jsx(Gm,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ae,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[B(z.total_requests).display,B(z.total_requests).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",B(z.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(Le,{className:"text-sm font-medium",children:"总花费"}),e.jsx(qw,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ae,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[oe(z.total_cost).display,oe(z.total_cost).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",oe(z.total_cost).exact,")"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:z.cost_per_hour>0?`¥${z.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(Le,{className:"text-sm font-medium",children:"Token消耗"}),e.jsx(Hr,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ae,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[B(z.total_tokens).display,B(z.total_tokens).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",B(z.total_tokens).exact,")"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:z.tokens_per_hour>0?`${B(z.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(Le,{className:"text-sm font-medium",children:"平均响应"}),e.jsx(Za,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ae,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[z.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(Le,{className:"text-sm font-medium",children:"在线时长"}),e.jsx(na,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(Ae,{children:e.jsxs("div",{className:"text-xl font-bold",children:[V(z.online_time),e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",z.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(Le,{className:"text-sm font-medium",children:"消息处理"}),e.jsx(Ma,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ae,{children:[e.jsxs("div",{className:"text-xl font-bold",children:[B(z.total_messages).display,B(z.total_messages).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",B(z.total_messages).exact,")"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["回复 ",B(z.total_replies).display,B(z.total_replies).needsExact&&e.jsxs("span",{children:["(",B(z.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(Le,{className:"text-sm font-medium",children:"成本效率"}),e.jsx(Vm,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ae,{children:[e.jsx("div",{className:"text-xl font-bold",children:z.total_messages>0?`¥${(z.total_cost/z.total_messages*100).toFixed(2)}`:"¥0.00"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"每100条消息"})]})]})]}),e.jsxs(ta,{defaultValue:"trends",className:"space-y-4",children:[e.jsxs(Xt,{className:"grid w-full grid-cols-2 sm:grid-cols-4",children:[e.jsx(Je,{value:"trends",children:"趋势"}),e.jsx(Je,{value:"models",children:"模型"}),e.jsx(Je,{value:"activity",children:"活动"}),e.jsx(Je,{value:"daily",children:"日统计"})]}),e.jsxs(ys,{value:"trends",className:"space-y-4",children:[e.jsxs(Ce,{children:[e.jsxs(De,{children:[e.jsx(Le,{children:"请求趋势"}),e.jsxs(ws,{children:["最近",h,"小时的请求量变化"]})]}),e.jsx(Ae,{children:e.jsx($r,{config:ke,className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:e.jsxs(pw,{data:ne,children:[e.jsx(Hi,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Fi,{dataKey:"timestamp",tickFormatter:O=>K(O),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Ur,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Ii,{content:e.jsx(Br,{labelFormatter:O=>K(O)})}),e.jsx(gw,{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(Le,{children:"花费趋势"}),e.jsx(ws,{children:"API调用成本变化"})]}),e.jsx(Ae,{children:e.jsx($r,{config:ke,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:e.jsxs(Eo,{data:ne,children:[e.jsx(Hi,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Fi,{dataKey:"timestamp",tickFormatter:O=>K(O),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Ur,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Ii,{content:e.jsx(Br,{labelFormatter:O=>K(O)})}),e.jsx(Gi,{dataKey:"cost",fill:"var(--color-cost)"})]})})})]}),e.jsxs(Ce,{children:[e.jsxs(De,{children:[e.jsx(Le,{children:"Token消耗"}),e.jsx(ws,{children:"Token使用量变化"})]}),e.jsx(Ae,{children:e.jsx($r,{config:ke,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:e.jsxs(Eo,{data:ne,children:[e.jsx(Hi,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Fi,{dataKey:"timestamp",tickFormatter:O=>K(O),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Ur,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Ii,{content:e.jsx(Br,{labelFormatter:O=>K(O)})}),e.jsx(Gi,{dataKey:"tokens",fill:"var(--color-tokens)"})]})})})]})]})]}),e.jsx(ys,{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(Le,{children:"模型请求分布"}),e.jsxs(ws,{children:["各模型使用占比 (共 ",he.length," 个模型)"]})]}),e.jsx(Ae,{children:e.jsx($r,{config:Object.fromEntries(he.map((O,k)=>[O.model_name,{label:O.model_name,color:_e[k]}])),className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:e.jsxs(jw,{children:[e.jsx(Ii,{content:e.jsx(Br,{})}),e.jsx(vw,{data:pe,cx:"50%",cy:"50%",labelLine:!1,label:({name:O,percent:k})=>k&&k<.05?"":`${O} ${k?(k*100).toFixed(0):0}%`,outerRadius:100,dataKey:"value",children:pe.map((O,k)=>e.jsx(Nw,{fill:O.fill},`cell-${k}`))})]})})})]}),e.jsxs(Ce,{children:[e.jsxs(De,{children:[e.jsx(Le,{children:"模型详细统计"}),e.jsx(ws,{children:"请求数、花费和性能"})]}),e.jsx(Ae,{children:e.jsx(Ye,{className:"h-[300px] sm:h-[400px]",children:e.jsx("div",{className:"space-y-3",children:he.map((O,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:O.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:O.request_count.toLocaleString()})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"花费:"}),e.jsxs("span",{className:"ml-1 font-medium",children:["¥",O.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:[(O.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:[O.avg_response_time.toFixed(2),"s"]})]})]})]},k))})})})]})]})}),e.jsx(ys,{value:"activity",children:e.jsxs(Ce,{children:[e.jsxs(De,{children:[e.jsx(Le,{children:"最近活动"}),e.jsx(ws,{children:"最新的API调用记录"})]}),e.jsx(Ae,{children:e.jsx(Ye,{className:"h-[400px] sm:h-[500px]",children:e.jsx("div",{className:"space-y-2",children:je.map((O,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:O.model}),e.jsx("div",{className:"text-xs text-muted-foreground",children:O.request_type})]}),e.jsx("div",{className:"text-xs text-muted-foreground flex-shrink-0",children:K(O.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:O.tokens})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"花费:"}),e.jsxs("span",{className:"ml-1",children:["¥",O.cost.toFixed(4)]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"耗时:"}),e.jsxs("span",{className:"ml-1",children:[O.time_cost.toFixed(2),"s"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"状态:"}),e.jsx("span",{className:`ml-1 ${O.status==="success"?"text-green-600":"text-red-600"}`,children:O.status})]})]})]},k))})})})]})}),e.jsx(ys,{value:"daily",children:e.jsxs(Ce,{children:[e.jsxs(De,{children:[e.jsx(Le,{children:"每日统计"}),e.jsx(ws,{children:"最近7天的数据汇总"})]}),e.jsx(Ae,{children:e.jsx($r,{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(Eo,{data:ve,children:[e.jsx(Hi,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Fi,{dataKey:"timestamp",tickFormatter:O=>{const k=new Date(O);return`${k.getMonth()+1}/${k.getDate()}`},stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Ur,{yAxisId:"left",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Ur,{yAxisId:"right",orientation:"right",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Ii,{content:e.jsx(Br,{labelFormatter:O=>new Date(O).toLocaleDateString("zh-CN")})}),e.jsx(n1,{content:e.jsx(lv,{})}),e.jsx(Gi,{yAxisId:"left",dataKey:"requests",fill:"var(--color-requests)"}),e.jsx(Gi,{yAxisId:"right",dataKey:"cost",fill:"var(--color-cost)"})]})})})]})})]}),e.jsx(Jn,{}),e.jsx(cv,{open:D,onOpenChange:O=>{S(O),O||F()}})]})})}const E1={theme:"system",setTheme:()=>null},ov=d.createContext(E1),ex=()=>{const l=d.useContext(ov);if(l===void 0)throw new Error("useTheme must be used within a ThemeProvider");return l},M1=(l,n,i)=>{const c=document.documentElement.classList.contains("no-animations");if(!document.startViewTransition||c){n(l);return}const u=i.clientX,x=i.clientY,h=Math.hypot(Math.max(u,innerWidth-u),Math.max(x,innerHeight-x));document.startViewTransition(()=>{n(l)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${u}px ${x}px)`,`circle(${h}px at ${u}px ${x}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},dv=d.createContext(void 0),uv=()=>{const l=d.useContext(dv);if(l===void 0)throw new Error("useAnimation must be used within an AnimationProvider");return l},Fe=d.forwardRef(({className:l,...n},i)=>e.jsx(qg,{className:I("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",l),...n,ref:i,children:e.jsx($0,{className:I("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")})}));Fe.displayName=qg.displayName;const z1=Kr("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),E=d.forwardRef(({className:l,...n},i)=>e.jsx(pj,{ref:i,className:I(z1(),l),...n}));E.displayName=pj.displayName;const A1=[{id:"minLength",label:"长度至少 10 位",description:"Token 长度必须大于等于 10 个字符",validate:l=>l.length>=10},{id:"hasUppercase",label:"包含大写字母",description:"至少包含一个大写字母 (A-Z)",validate:l=>/[A-Z]/.test(l)},{id:"hasLowercase",label:"包含小写字母",description:"至少包含一个小写字母 (a-z)",validate:l=>/[a-z]/.test(l)},{id:"hasSpecialChar",label:"包含特殊符号",description:"至少包含一个特殊符号 (!@#$%^&*()_+-=[]{}|;:,.<>?/)",validate:l=>/[!@#$%^&*()_+\-=[\]{}|;:,.<>?/]/.test(l)}];function O1(l){const n=A1.map(c=>({id:c.id,label:c.label,description:c.description,passed:c.validate(l)}));return{isValid:n.every(c=>c.passed),rules:n}}const ed="0.12.1",sx="MaiBot Dashboard",D1=`${sx} v${ed}`,R1=(l="v")=>`${l}${ed}`,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"},cl={theme:"system",accentColor:"blue",enableAnimations:!0,enableWavesBackground:!0,logCacheSize:1e3,logAutoScroll:!0,logFontSize:"xs",logLineSpacing:4,dataSyncInterval:30,wsReconnectInterval:3e3,wsMaxReconnectAttempts:10};function yt(l){const n=mv(l),i=localStorage.getItem(n);if(i===null)return cl[l];const c=cl[l];if(typeof c=="boolean")return i==="true";if(typeof c=="number"){const u=parseFloat(i);return isNaN(u)?c:u}return i}function Ir(l,n){const i=mv(l);localStorage.setItem(i,String(n)),window.dispatchEvent(new CustomEvent("maibot-settings-change",{detail:{key:l,value:n}}))}function L1(){return{theme:yt("theme"),accentColor:yt("accentColor"),enableAnimations:yt("enableAnimations"),enableWavesBackground:yt("enableWavesBackground"),logCacheSize:yt("logCacheSize"),logAutoScroll:yt("logAutoScroll"),logFontSize:yt("logFontSize"),logLineSpacing:yt("logLineSpacing"),dataSyncInterval:yt("dataSyncInterval"),wsReconnectInterval:yt("wsReconnectInterval"),wsMaxReconnectAttempts:yt("wsMaxReconnectAttempts")}}function U1(){const l=L1(),n=localStorage.getItem(pa.COMPLETED_TOURS),i=n?JSON.parse(n):[];return{...l,completedTours:i}}function $1(l){const n=[],i=[];for(const[c,u]of Object.entries(l)){if(c==="completedTours"){Array.isArray(u)?(localStorage.setItem(pa.COMPLETED_TOURS,JSON.stringify(u)),n.push("completedTours")):i.push("completedTours");continue}if(c in cl){const x=c,h=cl[x];if(typeof u==typeof h){if(x==="theme"&&!["light","dark","system"].includes(u)){i.push(c);continue}if(x==="logFontSize"&&!["xs","sm","base"].includes(u)){i.push(c);continue}Ir(x,u),n.push(c)}else i.push(c)}else i.push(c)}return{success:n.length>0,imported:n,skipped:i}}function B1(){for(const l of Object.keys(cl))Ir(l,cl[l]);localStorage.removeItem(pa.COMPLETED_TOURS),window.dispatchEvent(new CustomEvent("maibot-settings-reset"))}function I1(){const l=[],n=[],i=[];for(let c=0;cc.size-i.size),{used:l,items:localStorage.length,details:n}}function P1(l){if(l===0)return"0 B";const n=1024,i=["B","KB","MB"],c=Math.floor(Math.log(l)/Math.log(n));return parseFloat((l/Math.pow(n,c)).toFixed(2))+" "+i[c]}function mv(l){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}[l]}const qa=d.forwardRef(({className:l,...n},i)=>e.jsxs(Kg,{ref:i,className:I("relative flex w-full touch-none select-none items-center",l),...n,children:[e.jsx(B0,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:e.jsx(I0,{className:"absolute h-full bg-primary"})}),e.jsx(P0,{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=Kg.displayName;class H1{ws=null;reconnectTimeout=null;reconnectAttempts=0;heartbeatInterval=null;logCallbacks=new Set;connectionCallbacks=new Set;isConnected=!1;logCache=[];getMaxCacheSize(){return yt("logCacheSize")}getMaxReconnectAttempts(){return yt("wsMaxReconnectAttempts")}getReconnectInterval(){return yt("wsReconnectInterval")}getWebSocketUrl(n){let i;{const c=window.location.protocol==="https:"?"wss:":"ws:",u=window.location.host;i=`${c}//${u}/ws/logs`}return n?`${i}?token=${encodeURIComponent(n)}`:i}async getWsToken(){try{const n=await we("/api/webui/ws-token",{method:"GET",credentials:"include"});if(!n.ok)return console.error("获取 WebSocket token 失败:",n.status),null;const i=await n.json();return i.success&&i.token?i.token:null}catch(n){return console.error("获取 WebSocket token 失败:",n),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 tc()){console.log("📡 未登录,跳过 WebSocket 连接");return}const i=await this.getWsToken();if(!i){console.log("📡 无法获取 WebSocket token,跳过连接");return}const c=this.getWebSocketUrl(i);try{this.ws=new WebSocket(c),this.ws.onopen=()=>{this.isConnected=!0,this.reconnectAttempts=0,this.notifyConnection(!0),this.startHeartbeat()},this.ws.onmessage=u=>{try{if(u.data==="pong")return;const x=JSON.parse(u.data);this.notifyLog(x)}catch(x){console.error("解析日志消息失败:",x)}},this.ws.onerror=u=>{console.error("❌ WebSocket 错误:",u),this.isConnected=!1,this.notifyConnection(!1)},this.ws.onclose=()=>{this.isConnected=!1,this.notifyConnection(!1),this.stopHeartbeat(),this.attemptReconnect()}}catch(u){console.error("创建 WebSocket 连接失败:",u),this.attemptReconnect()}}attemptReconnect(){const n=this.getMaxReconnectAttempts();if(this.reconnectAttempts>=n)return;this.reconnectAttempts+=1;const i=this.getReconnectInterval(),c=Math.min(i*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(n){return this.logCallbacks.add(n),()=>this.logCallbacks.delete(n)}onConnectionChange(n){return this.connectionCallbacks.add(n),n(this.isConnected),()=>this.connectionCallbacks.delete(n)}notifyLog(n){if(!this.logCache.some(c=>c.id===n.id)){this.logCache.push(n);const c=this.getMaxCacheSize();this.logCache.length>c&&(this.logCache=this.logCache.slice(-c)),this.logCallbacks.forEach(u=>{try{u(n)}catch(x){console.error("日志回调执行失败:",x)}})}}notifyConnection(n){this.connectionCallbacks.forEach(i=>{try{i(n)}catch(c){console.error("连接状态回调执行失败:",c)}})}getAllLogs(){return[...this.logCache]}clearLogs(){this.logCache=[]}getConnectionStatus(){return this.isConnected}}const In=new H1;typeof window<"u"&&setTimeout(()=>{In.connect()},100);const vs=F0,wt=G0,F1=H0,xv=d.forwardRef(({className:l,...n},i)=>e.jsx(Qg,{className:I("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",l),...n,ref:i}));xv.displayName=Qg.displayName;const ds=d.forwardRef(({className:l,...n},i)=>e.jsxs(F1,{children:[e.jsx(xv,{}),e.jsx(Yg,{ref:i,className:I("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",l),...n})]}));ds.displayName=Yg.displayName;const us=({className:l,...n})=>e.jsx("div",{className:I("flex flex-col space-y-2 text-center sm:text-left",l),...n});us.displayName="AlertDialogHeader";const ms=({className:l,...n})=>e.jsx("div",{className:I("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",l),...n});ms.displayName="AlertDialogFooter";const xs=d.forwardRef(({className:l,...n},i)=>e.jsx(Jg,{ref:i,className:I("text-lg font-semibold",l),...n}));xs.displayName=Jg.displayName;const hs=d.forwardRef(({className:l,...n},i)=>e.jsx(Xg,{ref:i,className:I("text-sm text-muted-foreground",l),...n}));hs.displayName=Xg.displayName;const fs=d.forwardRef(({className:l,variant:n,...i},c)=>e.jsx(Zg,{ref:c,className:I(qr({variant:n}),l),...i}));fs.displayName=Zg.displayName;const ps=d.forwardRef(({className:l,...n},i)=>e.jsx(Wg,{ref:i,className:I(qr({variant:"outline"}),"mt-2 sm:mt-0",l),...n}));ps.displayName=Wg.displayName;function G1(){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(ta,{defaultValue:"appearance",className:"w-full",children:[e.jsxs(Xt,{className:"grid w-full grid-cols-2 sm:grid-cols-4 gap-0.5 sm:gap-1 h-auto p-1",children:[e.jsxs(Je,{value:"appearance",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(Kw,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"外观"})]}),e.jsxs(Je,{value:"security",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(Oj,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"安全"})]}),e.jsxs(Je,{value:"other",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(pn,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"其他"})]}),e.jsxs(Je,{value:"about",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(Ht,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"关于"})]})]}),e.jsxs(Ye,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[e.jsx(ys,{value:"appearance",className:"mt-0",children:e.jsx(V1,{})}),e.jsx(ys,{value:"security",className:"mt-0",children:e.jsx(q1,{})}),e.jsx(ys,{value:"other",className:"mt-0",children:e.jsx(K1,{})}),e.jsx(ys,{value:"about",className:"mt-0",children:e.jsx(Q1,{})})]})]})]})}function jg(l){const n=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%)"}}[l];if(c)n.style.setProperty("--primary",c.hsl),c.gradient?(n.style.setProperty("--primary-gradient",c.gradient),n.classList.add("has-gradient")):(n.style.removeProperty("--primary-gradient"),n.classList.remove("has-gradient"));else if(l.startsWith("#")){const u=x=>{x=x.replace("#","");const h=parseInt(x.substring(0,2),16)/255,f=parseInt(x.substring(2,4),16)/255,p=parseInt(x.substring(4,6),16)/255,g=Math.max(h,f,p),N=Math.min(h,f,p);let v=0,y=0;const w=(g+N)/2;if(g!==N){const b=g-N;switch(y=w>.5?b/(2-g-N):b/(g+N),g){case h:v=((f-p)/b+(flocalStorage.getItem("accent-color")||"blue");d.useEffect(()=>{const g=localStorage.getItem("accent-color")||"blue";jg(g)},[]);const p=g=>{f(g),localStorage.setItem("accent-color",g),jg(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(Cm,{value:"light",current:l,onChange:n,label:"浅色",description:"始终使用浅色主题"}),e.jsx(Cm,{value:"dark",current:l,onChange:n,label:"深色",description:"始终使用深色主题"}),e.jsx(Cm,{value:"system",current:l,onChange:n,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(Ga,{value:"blue",current:h,onChange:p,label:"蓝色",colorClass:"bg-blue-500"}),e.jsx(Ga,{value:"purple",current:h,onChange:p,label:"紫色",colorClass:"bg-purple-500"}),e.jsx(Ga,{value:"green",current:h,onChange:p,label:"绿色",colorClass:"bg-green-500"}),e.jsx(Ga,{value:"orange",current:h,onChange:p,label:"橙色",colorClass:"bg-orange-500"}),e.jsx(Ga,{value:"pink",current:h,onChange:p,label:"粉色",colorClass:"bg-pink-500"}),e.jsx(Ga,{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(Ga,{value:"gradient-sunset",current:h,onChange:p,label:"日落",colorClass:"bg-gradient-to-r from-orange-500 to-pink-500"}),e.jsx(Ga,{value:"gradient-ocean",current:h,onChange:p,label:"海洋",colorClass:"bg-gradient-to-r from-blue-500 to-cyan-500"}),e.jsx(Ga,{value:"gradient-forest",current:h,onChange:p,label:"森林",colorClass:"bg-gradient-to-r from-green-500 to-emerald-500"}),e.jsx(Ga,{value:"gradient-aurora",current:h,onChange:p,label:"极光",colorClass:"bg-gradient-to-r from-purple-500 to-pink-500"}),e.jsx(Ga,{value:"gradient-fire",current:h,onChange:p,label:"烈焰",colorClass:"bg-gradient-to-r from-red-500 to-orange-500"}),e.jsx(Ga,{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(le,{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(E,{htmlFor:"animations",className:"text-base font-medium cursor-pointer",children:"启用动画效果"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后将禁用所有过渡动画和特效,提升性能"})]}),e.jsx(Fe,{id:"animations",checked:i,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(E,{htmlFor:"waves-background",className:"text-base font-medium cursor-pointer",children:"登录页波浪背景"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后登录页将使用纯色背景,适合低性能设备"})]}),e.jsx(Fe,{id:"waves-background",checked:u,onCheckedChange:x})]})})]})]})]})}function q1(){const l=ca(),[n,i]=d.useState(""),[c,u]=d.useState(""),[x,h]=d.useState(!1),[f,p]=d.useState(!1),[g,N]=d.useState(!1),[v,y]=d.useState(!1),[w,b]=d.useState(!1),[R,D]=d.useState(!1),[S,P]=d.useState(""),[M,T]=d.useState(!1),{toast:A}=Zs(),F=d.useMemo(()=>O1(c),[c]),L=async ne=>{if(!n){A({title:"无法复制",description:"Token 存储在安全 Cookie 中,请重新生成以获取新 Token",variant:"destructive"});return}try{await navigator.clipboard.writeText(ne),b(!0),A({title:"复制成功",description:"Token 已复制到剪贴板"}),setTimeout(()=>b(!1),2e3)}catch{A({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},J=async()=>{if(!c.trim()){A({title:"输入错误",description:"请输入新的 Token",variant:"destructive"});return}if(!F.isValid){const ne=F.rules.filter(ve=>!ve.passed).map(ve=>ve.label).join(", ");A({title:"格式错误",description:`Token 不符合要求: ${ne}`,variant:"destructive"});return}N(!0);try{const ne=await fetch("/api/webui/auth/update",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({new_token:c.trim()})}),ve=await ne.json();ne.ok&&ve.success?(u(""),i(c.trim()),A({title:"更新成功",description:"Access Token 已更新,即将跳转到登录页"}),setTimeout(()=>{l({to:"/auth"})},1500)):A({title:"更新失败",description:ve.message||"无法更新 Token",variant:"destructive"})}catch(ne){console.error("更新 Token 错误:",ne),A({title:"更新失败",description:"连接服务器失败",variant:"destructive"})}finally{N(!1)}},U=async()=>{y(!0);try{const ne=await fetch("/api/webui/auth/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"}),ve=await ne.json();ne.ok&&ve.success?(i(ve.token),P(ve.token),D(!0),T(!1),A({title:"生成成功",description:"新的 Access Token 已生成,请及时保存"})):A({title:"生成失败",description:ve.message||"无法生成新 Token",variant:"destructive"})}catch(ne){console.error("生成 Token 错误:",ne),A({title:"生成失败",description:"连接服务器失败",variant:"destructive"})}finally{y(!1)}},ue=async()=>{try{await navigator.clipboard.writeText(S),T(!0),A({title:"复制成功",description:"Token 已复制到剪贴板"})}catch{A({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},xe=()=>{D(!1),setTimeout(()=>{P(""),T(!1)},300),setTimeout(()=>{l({to:"/auth"})},500)},he=ne=>{ne||xe()};return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsx(Is,{open:R,onOpenChange:he,children:e.jsxs(Os,{className:"sm:max-w-md",children:[e.jsxs(Ds,{children:[e.jsxs(Rs,{className:"flex items-center gap-2",children:[e.jsx(Jt,{className:"h-5 w-5 text-yellow-500"}),"新的 Access Token"]}),e.jsx(Ks,{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(E,{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(Jt,{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(st,{className:"gap-2 sm:gap-0",children:[e.jsx(_,{variant:"outline",onClick:ue,className:"gap-2",children:M?e.jsxs(e.Fragment,{children:[e.jsx(Ct,{className:"h-4 w-4 text-green-500"}),"已复制"]}):e.jsxs(e.Fragment,{children:[e.jsx(Ro,{className:"h-4 w-4"}),"复制 Token"]})}),e.jsx(_,{onClick:xe,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(E,{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(le,{id:"current-token",type:x?"text":"password",value:n||"••••••••••••••••••••••••••••••••",readOnly:!0,className:"pr-10 font-mono text-sm",placeholder:"Token 存储在安全 Cookie 中"}),e.jsx("button",{onClick:()=>{n?h(!x):A({title:"无法查看",description:'Token 存储在安全 Cookie 中,如需新 Token 请点击"重新生成"'})},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:x?"隐藏":"显示",children:x?e.jsx(Wi,{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:()=>L(n),title:"复制到剪贴板",className:"flex-shrink-0",disabled:!n,children:w?e.jsx(Ct,{className:"h-4 w-4 text-green-500"}):e.jsx(Ro,{className:"h-4 w-4"})}),e.jsxs(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{variant:"outline",disabled:v,className:"gap-2 flex-1 sm:flex-none",children:[e.jsx(dt,{className:I("h-4 w-4",v&&"animate-spin")}),e.jsx("span",{className:"hidden sm:inline",children:"重新生成"}),e.jsx("span",{className:"sm:hidden",children:"生成"})]})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认重新生成 Token"}),e.jsx(hs,{children:"这将生成一个新的 64 位安全令牌,并使当前 Token 立即失效。 您需要使用新 Token 重新登录系统。此操作不可撤销,确定要继续吗?"})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:U,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(E,{htmlFor:"new-token",className:"text-sm",children:"新的访问令牌"}),e.jsxs("div",{className:"relative",children:[e.jsx(le,{id:"new-token",type:f?"text":"password",value:c,onChange:ne=>u(ne.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(Wi,{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:F.rules.map(ne=>e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[ne.passed?e.jsx(pt,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):e.jsx(Va,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:I(ne.passed?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:ne.label})]},ne.id))}),F.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(Ct,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:"Token 格式正确,可以使用"})]})})]})]}),e.jsx(_,{onClick:J,disabled:g||!F.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 K1(){const l=ca(),{toast:n}=Zs(),[i,c]=d.useState(!1),[u,x]=d.useState(!1),[h,f]=d.useState(()=>yt("logCacheSize")),[p,g]=d.useState(()=>yt("wsReconnectInterval")),[N,v]=d.useState(()=>yt("wsMaxReconnectAttempts")),[y,w]=d.useState(()=>yt("dataSyncInterval")),[b,R]=d.useState(()=>gg()),[D,S]=d.useState(!1),[P,M]=d.useState(!1),T=d.useRef(null);if(u)throw new Error("这是一个手动触发的测试错误,用于验证错误边界组件是否正常工作。");const A=()=>{R(gg())},F=z=>{const V=z[0];f(V),Ir("logCacheSize",V)},L=z=>{const V=z[0];g(V),Ir("wsReconnectInterval",V)},J=z=>{const V=z[0];v(V),Ir("wsMaxReconnectAttempts",V)},U=z=>{const V=z[0];w(V),Ir("dataSyncInterval",V)},ue=()=>{In.clearLogs(),n({title:"日志已清除",description:"日志缓存已清空"})},xe=()=>{const z=I1();A(),n({title:"缓存已清除",description:`已清除 ${z.clearedKeys.length} 项缓存数据`})},he=()=>{S(!0);try{const z=U1(),V=JSON.stringify(z,null,2),B=new Blob([V],{type:"application/json"}),oe=URL.createObjectURL(B),K=document.createElement("a");K.href=oe,K.download=`maibot-webui-settings-${new Date().toISOString().slice(0,10)}.json`,document.body.appendChild(K),K.click(),document.body.removeChild(K),URL.revokeObjectURL(oe),n({title:"导出成功",description:"设置已导出为 JSON 文件"})}catch(z){console.error("导出设置失败:",z),n({title:"导出失败",description:"无法导出设置",variant:"destructive"})}finally{S(!1)}},ne=z=>{const V=z.target.files?.[0];if(!V)return;M(!0);const B=new FileReader;B.onload=oe=>{try{const K=oe.target?.result,_e=JSON.parse(K),pe=$1(_e);pe.success?(f(yt("logCacheSize")),g(yt("wsReconnectInterval")),v(yt("wsMaxReconnectAttempts")),w(yt("dataSyncInterval")),A(),n({title:"导入成功",description:`成功导入 ${pe.imported.length} 项设置${pe.skipped.length>0?`,跳过 ${pe.skipped.length} 项`:""}`}),(pe.imported.includes("theme")||pe.imported.includes("accentColor"))&&n({title:"提示",description:"部分设置需要刷新页面才能完全生效"})):n({title:"导入失败",description:"没有有效的设置项可导入",variant:"destructive"})}catch(K){console.error("导入设置失败:",K),n({title:"导入失败",description:"文件格式无效",variant:"destructive"})}finally{M(!1),T.current&&(T.current.value="")}},B.readAsText(V)},ve=()=>{B1(),f(cl.logCacheSize),g(cl.wsReconnectInterval),v(cl.wsMaxReconnectAttempts),w(cl.dataSyncInterval),A(),n({title:"已重置",description:"所有设置已恢复为默认值,刷新页面以应用更改"})},je=async()=>{c(!0);try{const z=await we("/api/webui/setup/reset",{method:"POST"}),V=await z.json();z.ok&&V.success?(n({title:"重置成功",description:"即将进入初次配置向导"}),setTimeout(()=>{l({to:"/setup"})},1e3)):n({title:"重置失败",description:V.message||"无法重置配置状态",variant:"destructive"})}catch(z){console.error("重置配置状态错误:",z),n({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(Hr,{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(Qw,{className:"h-4 w-4"}),"本地存储使用"]}),e.jsx(_,{variant:"ghost",size:"sm",onClick:A,className:"h-7 px-2",children:e.jsx(dt,{className:"h-3 w-3"})})]}),e.jsx("div",{className:"text-2xl font-bold text-primary",children:P1(b.used)}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[b.items," 个存储项"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(E,{className:"text-sm font-medium",children:"日志缓存大小"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[h," 条"]})]}),e.jsx(qa,{value:[h],onValueChange:F,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(E,{className:"text-sm font-medium",children:"首页数据刷新间隔"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[y," 秒"]})]}),e.jsx(qa,{value:[y],onValueChange:U,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(E,{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:L,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(E,{className:"text-sm font-medium",children:"WebSocket 最大重连次数"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[N," 次"]})]}),e.jsx(qa,{value:[N],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:ue,className:"gap-2",children:[e.jsx(ls,{className:"h-4 w-4"}),"清除日志缓存"]}),e.jsxs(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:"gap-2",children:[e.jsx(ls,{className:"h-4 w-4"}),"清除本地缓存"]})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认清除本地缓存"}),e.jsx(hs,{children:"这将清除所有本地缓存的设置和数据(不包括登录凭证)。 您可能需要重新配置部分偏好设置。确定要继续吗?"})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:xe,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(sa,{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:he,disabled:D,className:"gap-2",children:[e.jsx(sa,{className:"h-4 w-4"}),D?"导出中...":"导出设置"]}),e.jsx("input",{ref:T,type:"file",accept:".json",onChange:ne,className:"hidden"}),e.jsxs(_,{variant:"outline",onClick:()=>T.current?.click(),disabled:P,className:"gap-2",children:[e.jsx(ec,{className:"h-4 w-4"}),P?"导入中...":"导入设置"]})]}),e.jsx("div",{className:"pt-2 border-t",children:e.jsxs(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:"gap-2 text-destructive hover:text-destructive",children:[e.jsx(Zi,{className:"h-4 w-4"}),"重置所有设置为默认值"]})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认重置所有设置"}),e.jsx(hs,{children:"这将把所有界面设置恢复为默认值,包括主题、颜色、动画等偏好设置。 此操作不会影响您的登录状态。确定要继续吗?"})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:ve,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(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{variant:"outline",disabled:i,className:"gap-2",children:[e.jsx(Zi,{className:I("h-4 w-4",i&&"animate-spin")}),"重新进行初次配置"]})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认重新配置"}),e.jsx(hs,{children:"这将带您重新进入初次配置向导。您可以重新设置系统的基础配置项。确定要继续吗?"})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:je,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(Jt,{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(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{variant:"destructive",className:"gap-2",children:[e.jsx(Jt,{className:"h-4 w-4"}),"触发测试错误"]})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认触发错误"}),e.jsx(hs,{children:"这将手动触发一个 React 错误,用于测试错误边界组件的显示效果。 页面将显示错误界面,您可以通过刷新页面或点击返回首页来恢复。"})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>x(!0),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认触发"})]})]})]})]})]})]})}function Q1(){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:I("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:["关于 ",sx]}),e.jsxs("div",{className:"space-y-2 text-xs sm:text-sm text-muted-foreground",children:[e.jsxs("p",{children:["版本: ",ed]}),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(Ye,{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(ft,{name:"React",description:"用户界面构建库",license:"MIT"}),e.jsx(ft,{name:"shadcn/ui",description:"优雅的 React 组件库",license:"MIT"}),e.jsx(ft,{name:"Radix UI",description:"无样式的可访问组件库",license:"MIT"}),e.jsx(ft,{name:"Tailwind CSS",description:"实用优先的 CSS 框架",license:"MIT"}),e.jsx(ft,{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(ft,{name:"TanStack Router",description:"类型安全的路由库",license:"MIT"}),e.jsx(ft,{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(ft,{name:"React Hook Form",description:"高性能表单库",license:"MIT"}),e.jsx(ft,{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(ft,{name:"clsx",description:"条件 className 构建工具",license:"MIT"}),e.jsx(ft,{name:"tailwind-merge",description:"Tailwind 类名合并工具",license:"MIT"}),e.jsx(ft,{name:"class-variance-authority",description:"组件变体管理",license:"Apache-2.0"}),e.jsx(ft,{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(ft,{name:"Framer Motion",description:"React 动画库",license:"MIT"}),e.jsx(ft,{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(ft,{name:"FastAPI",description:"现代化 Python Web 框架",license:"MIT"}),e.jsx(ft,{name:"Uvicorn",description:"ASGI 服务器",license:"BSD-3-Clause"}),e.jsx(ft,{name:"Pydantic",description:"数据验证库",license:"MIT"}),e.jsx(ft,{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(ft,{name:"TypeScript",description:"JavaScript 的超集",license:"Apache-2.0"}),e.jsx(ft,{name:"Vite",description:"下一代前端构建工具",license:"MIT"}),e.jsx(ft,{name:"ESLint",description:"JavaScript 代码检查工具",license:"MIT"}),e.jsx(ft,{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 ft({name:l,description:n,license:i}){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:l}),e.jsx("p",{className:"text-muted-foreground text-xs mt-0.5",children:n})]}),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:i})]})}function Cm({value:l,current:n,onChange:i,label:c,description:u}){const x=n===l;return e.jsxs("button",{onClick:()=>i(l),className:I("relative rounded-lg border-2 p-3 sm:p-4 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",x?"border-primary bg-accent":"border-border"),children:[x&&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:u})]}),e.jsxs("div",{className:"mt-2 sm:mt-3 flex gap-1",children:[l==="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"})]}),l==="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"})]}),l==="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 Ga({value:l,current:n,onChange:i,label:c,colorClass:u}){const x=n===l;return e.jsxs("button",{onClick:()=>i(l),className:I("relative rounded-lg border-2 p-2 sm:p-3 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",x?"border-primary bg-accent":"border-border"),children:[x&&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:I("h-8 w-8 sm:h-10 sm:w-10 rounded-full",u)}),e.jsx("div",{className:"text-[10px] sm:text-xs font-medium text-center",children:c})]})]})}const Y1=Date.now()%1e6;class J1{grad3;p;perm;constructor(n=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 i=0;i<256;i++)this.p[i]=Math.floor(Math.random()*256);this.perm=[];for(let i=0;i<512;i++)this.perm[i]=this.p[i&255]}dot(n,i,c){return n[0]*i+n[1]*c}mix(n,i,c){return(1-c)*n+c*i}fade(n){return n*n*n*(n*(n*6-15)+10)}perlin2(n,i){const c=Math.floor(n)&255,u=Math.floor(i)&255;n-=Math.floor(n),i-=Math.floor(i);const x=this.fade(n),h=this.fade(i),f=this.perm[c]+u,p=this.perm[f],g=this.perm[f+1],N=this.perm[c+1]+u,v=this.perm[N],y=this.perm[N+1];return this.mix(this.mix(this.dot(this.grad3[p%12],n,i),this.dot(this.grad3[v%12],n-1,i),x),this.mix(this.dot(this.grad3[g%12],n,i-1),this.dot(this.grad3[y%12],n-1,i-1),x),h)}}function vg(){const l=d.useRef(null),n=d.useRef(null),i=d.useRef(void 0),[c]=d.useState(()=>new J1(Y1)),u=d.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 d.useEffect(()=>{const x=n.current,h=l.current;if(!x||!h)return;const f=u.current;f.noise=c;const p=()=>{const D=x.getBoundingClientRect();f.bounding=D,h.style.width=`${D.width}px`,h.style.height=`${D.height}px`},g=()=>{if(!f.bounding)return;const{width:D,height:S}=f.bounding;f.lines=[],f.paths.forEach(ue=>ue.remove()),f.paths=[];const P=10,M=32,T=D+200,A=S+30,F=Math.ceil(T/P),L=Math.ceil(A/M),J=(D-P*F)/2,U=(S-M*L)/2;for(let ue=0;ue<=F;ue++){const xe=[];for(let ne=0;ne<=L;ne++){const ve={x:J+P*ue,y:U+M*ne,wave:{x:0,y:0},cursor:{x:0,y:0,vx:0,vy:0}};xe.push(ve)}const he=document.createElementNS("http://www.w3.org/2000/svg","path");h.appendChild(he),f.paths.push(he),f.lines.push(xe)}},N=D=>{const{lines:S,mouse:P,noise:M}=f;S.forEach(T=>{T.forEach(A=>{const F=M.perlin2((A.x+D*.0125)*.002,(A.y+D*.005)*.0015)*12;A.wave.x=Math.cos(F)*32,A.wave.y=Math.sin(F)*16;const L=A.x-P.sx,J=A.y-P.sy,U=Math.hypot(L,J),ue=Math.max(175,P.vs);if(U{const P={x:D.x+D.wave.x+(S?D.cursor.x:0),y:D.y+D.wave.y+(S?D.cursor.y:0)};return P.x=Math.round(P.x*10)/10,P.y=Math.round(P.y*10)/10,P},y=()=>{const{lines:D,paths:S}=f;D.forEach((P,M)=>{let T=v(P[0],!1),A=`M ${T.x} ${T.y}`;P.forEach((F,L)=>{const J=L===P.length-1;T=v(F,!J),A+=`L ${T.x} ${T.y}`}),S[M].setAttribute("d",A)})},w=D=>{const{mouse:S}=f;S.sx+=(S.x-S.sx)*.1,S.sy+=(S.y-S.sy)*.1;const P=S.x-S.lx,M=S.y-S.ly,T=Math.hypot(P,M);S.v=T,S.vs+=(T-S.vs)*.1,S.vs=Math.min(100,S.vs),S.lx=S.x,S.ly=S.y,S.a=Math.atan2(M,P),x&&(x.style.setProperty("--x",`${S.sx}px`),x.style.setProperty("--y",`${S.sy}px`)),N(D),y(),i.current=requestAnimationFrame(w)},b=D=>{if(!f.bounding)return;const{mouse:S}=f;S.x=D.pageX-f.bounding.left,S.y=D.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)},R=()=>{p(),g()};return p(),g(),window.addEventListener("resize",R),window.addEventListener("mousemove",b),i.current=requestAnimationFrame(w),()=>{window.removeEventListener("resize",R),window.removeEventListener("mousemove",b),i.current&&cancelAnimationFrame(i.current)}},[c]),e.jsxs("div",{ref:n,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:l,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 X1(){const[l,n]=d.useState(""),[i,c]=d.useState(!1),[u,x]=d.useState(""),[h,f]=d.useState(!0),p=ca(),{enableWavesBackground:g,setEnableWavesBackground:N}=uv(),{theme:v,setTheme:y}=ex();d.useEffect(()=>{(async()=>{try{await tc()&&p({to:"/"})}catch{}finally{f(!1)}})()},[p]);const b=v==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":v,R=()=>{y(b==="dark"?"light":"dark")},D=async S=>{if(S.preventDefault(),x(""),!l.trim()){x("请输入 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:l.trim()})});console.log("Token 验证响应状态:",P.status);const M=await P.json();if(console.log("Token 验证响应数据:",M),P.ok&&M.valid){console.log("Token 验证成功,准备跳转..."),console.log("is_first_setup:",M.is_first_setup),await new Promise(A=>setTimeout(A,100));const T=await tc();console.log("跳转前认证状态检查:",T),M.is_first_setup?(console.log("跳转到首次配置页面"),p({to:"/setup"})):(console.log("跳转到首页"),p({to:"/"}))}else console.error("Token 验证失败:",M.message),x(M.message||"Token 验证失败,请检查后重试")}catch(P){console.error("Token 验证错误:",P),x("连接服务器失败,请检查网络连接")}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(vg,{}),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(vg,{}),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:R,className:"absolute right-4 top-4 rounded-lg p-2 hover:bg-accent transition-colors z-10 text-foreground",title:b==="dark"?"切换到浅色模式":"切换到深色模式",children:b==="dark"?e.jsx(qm,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"}):e.jsx(Qi,{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(rg,{className:"h-8 w-8 text-primary",strokeWidth:2,fill:"none"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Le,{className:"text-2xl font-bold",children:"欢迎使用 MaiBot"}),e.jsx(ws,{className:"text-base",children:"请输入您的 Access Token 以继续访问系统"})]})]}),e.jsx(Ae,{children:e.jsxs("form",{onSubmit:D,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"token",className:"text-sm font-medium",children:"Access Token"}),e.jsxs("div",{className:"relative",children:[e.jsx(Km,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground",strokeWidth:2,fill:"none"}),e.jsx(le,{id:"token",type:"password",placeholder:"请输入您的 Access Token",value:l,onChange:S=>n(S.target.value),className:I("pl-10",u&&"border-red-500 focus-visible:ring-red-500"),disabled:i,autoFocus:!0,autoComplete:"off"})]})]}),u&&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(_t,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),e.jsx("span",{children:u})]}),e.jsx(_,{type:"submit",className:"w-full",disabled:i,children:i?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(Is,{children:[e.jsx(Wo,{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(Dj,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我没有 Token,我该去哪里获得 Token?"]})}),e.jsxs(Os,{className:"sm:max-w-md",children:[e.jsxs(Ds,{children:[e.jsxs(Rs,{className:"flex items-center gap-2",children:[e.jsx(rg,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"如何获取 Access Token"]}),e.jsx(Ks,{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(Yw,{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(Ca,{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(_t,{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(vs,{children:[e.jsx(wt,{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(Za,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我觉得这个界面很卡怎么办?"]})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsxs(xs,{className:"flex items-center gap-2",children:[e.jsx(Za,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"关闭背景动画"]}),e.jsx(hs,{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(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{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:D1})})]})}const ot=d.forwardRef(({className:l,...n},i)=>e.jsx("textarea",{className:I("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",l),ref:i,...n}));ot.displayName="Textarea";const Yt=d.forwardRef(({className:l,orientation:n="horizontal",decorative:i=!0,...c},u)=>e.jsx(ej,{ref:u,decorative:i,orientation:n,className:I("shrink-0 bg-border",n==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",l),...c}));Yt.displayName=ej.displayName;function Z1({config:l,onChange:n}){const i=u=>{u.trim()&&!l.alias_names.includes(u.trim())&&n({...l,alias_names:[...l.alias_names,u.trim()]})},c=u=>{n({...l,alias_names:l.alias_names.filter((x,h)=>h!==u)})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(E,{htmlFor:"qq_account",children:"QQ账号 *"}),e.jsx(le,{id:"qq_account",type:"number",placeholder:"请输入机器人的QQ账号",value:l.qq_account||"",onChange:u=>n({...l,qq_account:Number(u.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人登录使用的QQ账号"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(E,{htmlFor:"nickname",children:"昵称 *"}),e.jsx(le,{id:"nickname",placeholder:"请输入机器人的昵称",value:l.nickname,onChange:u=>n({...l,nickname:u.target.value})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的主要称呼名称"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(E,{children:"别名"}),e.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:l.alias_names.map((u,x)=>e.jsxs(Se,{variant:"secondary",className:"gap-1",children:[u,e.jsx("button",{type:"button",onClick:()=>c(x),className:"ml-1 hover:text-destructive",children:e.jsx(Ea,{className:"h-3 w-3"})})]},x))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(le,{id:"alias_input",placeholder:"输入别名后按回车添加",onKeyPress:u=>{u.key==="Enter"&&(i(u.target.value),u.target.value="")}}),e.jsx(_,{type:"button",variant:"outline",onClick:()=>{const u=document.getElementById("alias_input");u&&(i(u.value),u.value="")},children:"添加"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的其他称呼,可以添加多个"})]})]})}function W1({config:l,onChange:n}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(E,{htmlFor:"personality",children:"人格特征 *"}),e.jsx(ot,{id:"personality",placeholder:"描述机器人的人格特质和身份特征(建议120字以内)",value:l.personality,onChange:i=>n({...l,personality:i.target.value}),rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:是一个女大学生,现在在读大二,会刷贴吧"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(E,{htmlFor:"reply_style",children:"表达风格 *"}),e.jsx(ot,{id:"reply_style",placeholder:"描述机器人说话的表达风格、表达习惯",value:l.reply_style,onChange:i=>n({...l,reply_style:i.target.value}),rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:回复平淡一些,简短一些,说中文,参考贴吧、知乎和微博的回复风格"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(E,{htmlFor:"interest",children:"兴趣 *"}),e.jsx(ot,{id:"interest",placeholder:"描述机器人感兴趣的话题",value:l.interest,onChange:i=>n({...l,interest:i.target.value}),rows:2}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"会影响机器人对什么话题进行回复"})]}),e.jsx(Yt,{}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(E,{htmlFor:"plan_style",children:"群聊说话规则 *"}),e.jsx(ot,{id:"plan_style",placeholder:"机器人在群聊中的行为风格和规则",value:l.plan_style,onChange:i=>n({...l,plan_style:i.target.value}),rows:4}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在群聊中如何行动,例如回复频率、条件等"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(E,{htmlFor:"private_plan_style",children:"私聊说话规则 *"}),e.jsx(ot,{id:"private_plan_style",placeholder:"机器人在私聊中的行为风格和规则",value:l.private_plan_style,onChange:i=>n({...l,private_plan_style:i.target.value}),rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在私聊中的行为方式"})]})]})}function e2({config:l,onChange:n}){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(E,{htmlFor:"emoji_chance",children:"表情包激活概率"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[(l.emoji_chance*100).toFixed(0),"%"]})]}),e.jsx(le,{id:"emoji_chance",type:"range",min:"0",max:"1",step:"0.1",value:l.emoji_chance,onChange:i=>n({...l,emoji_chance:Number(i.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人发送表情包的概率"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(E,{htmlFor:"max_reg_num",children:"最大表情包数量"}),e.jsx(le,{id:"max_reg_num",type:"number",min:"1",max:"200",value:l.max_reg_num,onChange:i=>n({...l,max_reg_num:Number(i.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(E,{htmlFor:"do_replace",children:"达到最大数量时替换"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"开启后会删除旧表情包,关闭则不再收集新表情包"})]}),e.jsx(Fe,{id:"do_replace",checked:l.do_replace,onCheckedChange:i=>n({...l,do_replace:i})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(E,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),e.jsx(le,{id:"check_interval",type:"number",min:"1",max:"120",value:l.check_interval,onChange:i=>n({...l,check_interval:Number(i.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包注册、破损、删除的时间间隔"})]}),e.jsx(Yt,{}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(E,{htmlFor:"steal_emoji",children:"偷取表情包"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人将一些表情包据为己有"})]}),e.jsx(Fe,{id:"steal_emoji",checked:l.steal_emoji,onCheckedChange:i=>n({...l,steal_emoji:i})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(E,{htmlFor:"content_filtration",children:"启用表情包过滤"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"只保存符合要求的表情包"})]}),e.jsx(Fe,{id:"content_filtration",checked:l.content_filtration,onCheckedChange:i=>n({...l,content_filtration:i})})]}),l.content_filtration&&e.jsxs("div",{className:"space-y-3",children:[e.jsx(E,{htmlFor:"filtration_prompt",children:"过滤要求"}),e.jsx(le,{id:"filtration_prompt",placeholder:"例如:符合公序良俗",value:l.filtration_prompt,onChange:i=>n({...l,filtration_prompt:i.target.value})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"描述表情包应该符合的要求"})]})]})}function s2({config:l,onChange:n}){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(E,{htmlFor:"enable_tool",children:"启用工具系统"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人使用各种工具增强功能"})]}),e.jsx(Fe,{id:"enable_tool",checked:l.enable_tool,onCheckedChange:i=>n({...l,enable_tool:i})})]}),e.jsx(Yt,{}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(E,{htmlFor:"all_global",children:"启用全局黑话模式"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人学习和使用群组黑话"})]}),e.jsx(Fe,{id:"all_global",checked:l.all_global,onCheckedChange:i=>n({...l,all_global:i})})]})]})}function t2({config:l,onChange:n}){const[i,c]=d.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(Mo,{className:"h-3 w-3"})]})]})]})}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(E,{htmlFor:"siliconflow_api_key",children:"SiliconFlow API Key *"}),e.jsxs("div",{className:"relative",children:[e.jsx(le,{id:"siliconflow_api_key",type:i?"text":"password",placeholder:"sk-...",value:l.api_key,onChange:u=>n({api_key:u.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(!i),children:i?e.jsx(Wi,{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 a2(){const l=await we("/api/webui/config/bot",{method:"GET",headers:Fs()});if(!l.ok)throw new Error("读取Bot配置失败");const i=(await l.json()).config.bot||{};return{qq_account:i.qq_account||0,nickname:i.nickname||"",alias_names:i.alias_names||[]}}async function l2(){const l=await we("/api/webui/config/bot",{method:"GET",headers:Fs()});if(!l.ok)throw new Error("读取人格配置失败");const i=(await l.json()).config.personality||{};return{personality:i.personality||"",reply_style:i.reply_style||"",interest:i.interest||"",plan_style:i.plan_style||"",private_plan_style:i.private_plan_style||""}}async function n2(){const l=await we("/api/webui/config/bot",{method:"GET",headers:Fs()});if(!l.ok)throw new Error("读取表情包配置失败");const i=(await l.json()).config.emoji||{};return{emoji_chance:i.emoji_chance??.4,max_reg_num:i.max_reg_num??40,do_replace:i.do_replace??!0,check_interval:i.check_interval??10,steal_emoji:i.steal_emoji??!0,content_filtration:i.content_filtration??!1,filtration_prompt:i.filtration_prompt||""}}async function r2(){const l=await we("/api/webui/config/bot",{method:"GET",headers:Fs()});if(!l.ok)throw new Error("读取其他配置失败");const i=(await l.json()).config,c=i.tool||{},u=i.expression||{};return{enable_tool:c.enable_tool??!0,all_global:u.all_global_jargon??!0}}async function i2(){const l=await we("/api/webui/config/model",{method:"GET",headers:Fs()});if(!l.ok)throw new Error("读取模型配置失败");return{api_key:((await l.json()).config.api_providers||[]).find(x=>x.name==="SiliconFlow")?.api_key||""}}async function c2(l){const n=await we("/api/webui/config/bot/section/bot",{method:"POST",headers:Fs(),body:JSON.stringify(l)});if(!n.ok){const i=await n.json();throw new Error(i.detail||"保存Bot基础配置失败")}return await n.json()}async function o2(l){const n=await we("/api/webui/config/bot/section/personality",{method:"POST",headers:Fs(),body:JSON.stringify(l)});if(!n.ok){const i=await n.json();throw new Error(i.detail||"保存人格配置失败")}return await n.json()}async function d2(l){const n=await we("/api/webui/config/bot/section/emoji",{method:"POST",headers:Fs(),body:JSON.stringify(l)});if(!n.ok){const i=await n.json();throw new Error(i.detail||"保存表情包配置失败")}return await n.json()}async function u2(l){const n=[];n.push(we("/api/webui/config/bot/section/tool",{method:"POST",headers:Fs(),body:JSON.stringify({enable_tool:l.enable_tool})})),n.push(we("/api/webui/config/bot/section/expression",{method:"POST",headers:Fs(),body:JSON.stringify({all_global_jargon:l.all_global})}));const i=await Promise.all(n);for(const c of i)if(!c.ok){const u=await c.json();throw new Error(u.detail||"保存其他配置失败")}return{success:!0}}async function m2(l){const n=await we("/api/webui/config/model",{method:"GET",headers:Fs()});if(!n.ok)throw new Error("读取模型配置失败");const c=(await n.json()).config,u=c.api_providers||[],x=u.findIndex(p=>p.name==="SiliconFlow");x>=0?u[x]={...u[x],api_key:l.api_key}:u.push({name:"SiliconFlow",base_url:"https://api.siliconflow.cn/v1",api_key:l.api_key,client_type:"openai",max_retry:3,timeout:120,retry_interval:5});const h={...c,api_providers:u},f=await we("/api/webui/config/model",{method:"POST",headers:Fs(),body:JSON.stringify(h)});if(!f.ok){const p=await f.json();throw new Error(p.detail||"保存模型配置失败")}return await f.json()}async function Ng(){const l=await we("/api/webui/setup/complete",{method:"POST"});if(!l.ok){const n=await l.json();throw new Error(n.message||"标记配置完成失败")}return await l.json()}function x2(){return e.jsx(Yn,{children:e.jsx(h2,{})})}function h2(){const l=ca(),{toast:n}=Zs(),{triggerRestart:i}=vn(),[c,u]=d.useState(0),[x,h]=d.useState(!1),[f,p]=d.useState(!1),[g,N]=d.useState(!0),[v,y]=d.useState({qq_account:0,nickname:"",alias_names:[]}),[w,b]=d.useState({personality:"是一个女大学生,现在在读大二,会刷贴吧。",reply_style:"请回复的平淡一些,简短一些,说中文,不要刻意突出自身学科背景。可以参考贴吧,知乎和微博的回复风格。",interest:"对技术相关话题,游戏和动漫相关话题感兴趣,也对日常话题感兴趣,不喜欢太过沉重严肃的话题",plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 -2.如果相同的内容已经被执行,请不要重复执行 -3.请控制你的发言频率,不要太过频繁的发言 -4.如果有人对你感到厌烦,请减少回复 -5.如果有人对你进行攻击,或者情绪激动,请你以合适的方法应对`,private_plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 -2.如果相同的内容已经被执行,请不要重复执行 -3.某句话如果已经被回复过,不要重复回复`}),[R,D]=d.useState({emoji_chance:.4,max_reg_num:40,do_replace:!0,check_interval:10,steal_emoji:!0,content_filtration:!1,filtration_prompt:"符合公序良俗"}),[S,P]=d.useState({enable_tool:!0,all_global:!0}),[M,T]=d.useState({api_key:""}),A=[{id:"bot-basic",title:"Bot基础",description:"配置机器人的基本信息",icon:Pn},{id:"personality",title:"人格配置",description:"定义机器人的性格和说话风格",icon:fn},{id:"emoji",title:"表情包",description:"配置表情包相关设置",icon:Yo},{id:"other",title:"其他设置",description:"工具、情绪系统等配置",icon:pn},{id:"siliconflow",title:"API配置",description:"配置硅基流动API密钥",icon:Km}],F=(c+1)/A.length*100;d.useEffect(()=>{(async()=>{try{N(!0);const[ve,je,z,V,B]=await Promise.all([a2(),l2(),n2(),r2(),i2()]);y(ve),b(je),D(z),P(V),T(B)}catch(ve){n({title:"加载配置失败",description:ve instanceof Error?ve.message:"无法加载现有配置,将使用默认值",variant:"destructive"})}finally{N(!1)}})()},[n]);const L=async()=>{p(!0);try{switch(c){case 0:await c2(v);break;case 1:await o2(w);break;case 2:await d2(R);break;case 3:await u2(S);break;case 4:await m2(M);break}return n({title:"保存成功",description:`${A[c].title}配置已保存`}),!0}catch(ne){return n({title:"保存失败",description:ne instanceof Error?ne.message:"未知错误",variant:"destructive"}),!1}finally{p(!1)}},J=async()=>{await L()&&c{c>0&&u(c-1)},ue=async()=>{h(!0);try{if(!await L()){h(!1);return}await Ng(),n({title:"配置完成",description:"麦麦正在重启以应用新配置..."}),await i()}catch(ne){n({title:"配置失败",description:ne instanceof Error?ne.message:"未知错误",variant:"destructive"})}finally{h(!1)}},xe=async()=>{try{await Ng(),l({to:"/"})}catch(ne){n({title:"跳过失败",description:ne instanceof Error?ne.message:"未知错误",variant:"destructive"})}},he=()=>{switch(c){case 0:return e.jsx(Z1,{config:v,onChange:y});case 1:return e.jsx(W1,{config:w,onChange:b});case 2:return e.jsx(e2,{config:R,onChange:D});case 3:return e.jsx(s2,{config:S,onChange:P});case 4:return e.jsx(t2,{config:M,onChange:T});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(Jn,{}),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(Jw,{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:["让我们一起完成 ",sx," 的初始配置"]})]}),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," / ",A.length]}),e.jsxs("span",{className:"font-medium text-primary",children:[Math.round(F),"%"]})]}),e.jsx(Kn,{value:F,className:"h-2"})]}),e.jsx("div",{className:"mb-6 md:mb-8 flex justify-between",children:A.map((ne,ve)=>{const je=ne.icon;return e.jsxs("div",{className:I("flex flex-1 flex-col items-center gap-1 md:gap-2",vel({to:"/"}),className:"gap-2 w-full sm:w-auto",children:[e.jsx(Jo,{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(Ta,{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 f2=As.memo(function({config:n,onChange:i}){const c=n.platforms||[],u=n.alias_names||[],x=()=>{i({...n,platforms:[...c,""]})},h=v=>{i({...n,platforms:c.filter((y,w)=>w!==v)})},f=(v,y)=>{const w=[...c];w[v]=y,i({...n,platforms:w})},p=()=>{i({...n,alias_names:[...u,""]})},g=v=>{i({...n,alias_names:u.filter((y,w)=>w!==v)})},N=(v,y)=>{const w=[...u];w[v]=y,i({...n,alias_names:w})};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(E,{htmlFor:"platform",children:"平台"}),e.jsx(le,{id:"platform",value:n.platform,onChange:v=>i({...n,platform:v.target.value}),placeholder:"qq"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"qq_account",children:"QQ账号"}),e.jsx(le,{id:"qq_account",value:n.qq_account,onChange:v=>i({...n,qq_account:v.target.value}),placeholder:"123456789"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"nickname",children:"昵称"}),e.jsx(le,{id:"nickname",value:n.nickname,onChange:v=>i({...n,nickname:v.target.value}),placeholder:"麦麦"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(E,{children:"别名"}),e.jsxs(_,{onClick:p,size:"sm",variant:"outline",children:[e.jsx(et,{className:"h-4 w-4 mr-1"}),"添加"]})]}),e.jsxs("div",{className:"space-y-2",children:[u.map((v,y)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(le,{value:v,onChange:w=>N(y,w.target.value),placeholder:"小麦"}),e.jsxs(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(ls,{className:"h-4 w-4"})})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:['确定要删除别名 "',v||"(空)",'" 吗?此操作无法撤销。']})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>g(y),children:"删除"})]})]})]})]},y)),u.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(E,{children:"其他平台账号"}),e.jsxs(_,{onClick:x,size:"sm",variant:"outline",children:[e.jsx(et,{className:"h-4 w-4 mr-1"}),"添加"]})]}),e.jsxs("div",{className:"space-y-2",children:[c.map((v,y)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(le,{value:v,onChange:w=>f(y,w.target.value),placeholder:"wx:114514"}),e.jsxs(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(ls,{className:"h-4 w-4"})})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:['确定要删除平台账号 "',v||"(空)",'" 吗?此操作无法撤销。']})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>h(y),children:"删除"})]})]})]})]},y)),c.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无其他平台账号"})]})]})]})]})})}),p2=As.memo(function({config:n,onChange:i}){const c=()=>{i({...n,states:[...n.states,""]})},u=h=>{i({...n,states:n.states.filter((f,p)=>p!==h)})},x=(h,f)=>{const p=[...n.states];p[h]=f,i({...n,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(E,{htmlFor:"personality",children:"人格特质"}),e.jsx(ot,{id:"personality",value:n.personality,onChange:h=>i({...n,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(E,{children:"多重人格"}),e.jsxs(_,{onClick:c,size:"sm",variant:"outline",children:[e.jsx(et,{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:n.states.map((h,f)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ot,{value:h,onChange:p=>x(f,p.target.value),placeholder:"描述一个人格状态",rows:2}),e.jsxs(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(ls,{className:"h-4 w-4"})})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsx(hs,{children:"确定要删除这个人格状态吗?此操作无法撤销。"})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>u(f),children:"删除"})]})]})]})]},f))})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"state_probability",children:"替换为多重人格概率"}),e.jsx(le,{id:"state_probability",type:"number",step:"0.1",min:"0",max:"1",value:n.state_probability,onChange:h=>i({...n,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(E,{htmlFor:"reply_style",children:"表达风格"}),e.jsx(ot,{id:"reply_style",value:n.reply_style,onChange:h=>i({...n,reply_style:h.target.value}),placeholder:"描述说话的表达风格和习惯",rows:3})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"plan_style",children:"说话规则与行为风格"}),e.jsx(ot,{id:"plan_style",value:n.plan_style,onChange:h=>i({...n,plan_style:h.target.value}),placeholder:"麦麦的说话规则和行为风格",rows:5})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"visual_style",children:"识图规则"}),e.jsx(ot,{id:"visual_style",value:n.visual_style,onChange:h=>i({...n,visual_style:h.target.value}),placeholder:"识图时的处理规则",rows:3})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"private_plan_style",children:"私聊规则"}),e.jsx(ot,{id:"private_plan_style",value:n.private_plan_style,onChange:h=>i({...n,private_plan_style:h.target.value}),placeholder:"私聊的说话规则和行为风格",rows:4})]})]})]})})}),Ie=Aw,Pe=Ow,$e=d.forwardRef(({className:l,children:n,...i},c)=>e.jsxs(gj,{ref:c,className:I("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",l),...i,children:[n,e.jsx(Cw,{asChild:!0,children:e.jsx(za,{className:"h-4 w-4 opacity-50"})})]}));$e.displayName=gj.displayName;const fv=d.forwardRef(({className:l,...n},i)=>e.jsx(jj,{ref:i,className:I("flex cursor-default items-center justify-center py-1",l),...n,children:e.jsx(Fr,{className:"h-4 w-4"})}));fv.displayName=jj.displayName;const pv=d.forwardRef(({className:l,...n},i)=>e.jsx(vj,{ref:i,className:I("flex cursor-default items-center justify-center py-1",l),...n,children:e.jsx(za,{className:"h-4 w-4"})}));pv.displayName=vj.displayName;const Be=d.forwardRef(({className:l,children:n,position:i="popper",...c},u)=>e.jsx(Tw,{children:e.jsxs(Nj,{ref:u,className:I("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]",i==="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",l),position:i,...c,children:[e.jsx(fv,{}),e.jsx(Ew,{className:I("p-1",i==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:n}),e.jsx(pv,{})]})}));Be.displayName=Nj.displayName;const g2=d.forwardRef(({className:l,...n},i)=>e.jsx(bj,{ref:i,className:I("px-2 py-1.5 text-sm font-semibold",l),...n}));g2.displayName=bj.displayName;const X=d.forwardRef(({className:l,children:n,...i},c)=>e.jsxs(yj,{ref:c,className:I("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",l),...i,children:[e.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Mw,{children:e.jsx(Ct,{className:"h-4 w-4"})})}),e.jsx(zw,{children:n})]}));X.displayName=yj.displayName;const j2=d.forwardRef(({className:l,...n},i)=>e.jsx(wj,{ref:i,className:I("-mx-1 my-1 h-px bg-muted",l),...n}));j2.displayName=wj.displayName;const ol=q0,dl=K0,Wa=d.forwardRef(({className:l,align:n="center",sideOffset:i=4,...c},u)=>e.jsx(V0,{children:e.jsx(sj,{ref:u,align:n,sideOffset:i,className:I("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]",l),...c})}));Wa.displayName=sj.displayName;const v2=As.memo(function({value:n,onChange:i}){const c=d.useMemo(()=>{const w=n.split("-");if(w.length===2){const[b,R]=w,[D,S]=b.split(":"),[P,M]=R.split(":");return{startHour:D?D.padStart(2,"0"):"00",startMinute:S?S.padStart(2,"0"):"00",endHour:P?P.padStart(2,"0"):"23",endMinute:M?M.padStart(2,"0"):"59"}}return{startHour:"00",startMinute:"00",endHour:"23",endMinute:"59"}},[n]),[u,x]=d.useState(c.startHour),[h,f]=d.useState(c.startMinute),[p,g]=d.useState(c.endHour),[N,v]=d.useState(c.endMinute);d.useEffect(()=>{x(c.startHour),f(c.startMinute),g(c.endHour),v(c.endMinute)},[c]);const y=(w,b,R,D)=>{const S=`${w}:${b}-${R}:${D}`;i(S)};return e.jsxs(ol,{children:[e.jsx(dl,{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"}),n||"选择时间段"]})}),e.jsx(Wa,{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(E,{className:"text-xs",children:"小时"}),e.jsxs(Ie,{value:u,onValueChange:w=>{x(w),y(w,h,p,N)},children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsx(Be,{children:Array.from({length:24},(w,b)=>b).map(w=>e.jsx(X,{value:w.toString().padStart(2,"0"),children:w.toString().padStart(2,"0")},w))})]})]}),e.jsxs("div",{children:[e.jsx(E,{className:"text-xs",children:"分钟"}),e.jsxs(Ie,{value:h,onValueChange:w=>{f(w),y(u,w,p,N)},children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsx(Be,{children:Array.from({length:60},(w,b)=>b).map(w=>e.jsx(X,{value:w.toString().padStart(2,"0"),children:w.toString().padStart(2,"0")},w))})]})]})]})]}),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(E,{className:"text-xs",children:"小时"}),e.jsxs(Ie,{value:p,onValueChange:w=>{g(w),y(u,h,w,N)},children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsx(Be,{children:Array.from({length:24},(w,b)=>b).map(w=>e.jsx(X,{value:w.toString().padStart(2,"0"),children:w.toString().padStart(2,"0")},w))})]})]}),e.jsxs("div",{children:[e.jsx(E,{className:"text-xs",children:"分钟"}),e.jsxs(Ie,{value:N,onValueChange:w=>{v(w),y(u,h,p,w)},children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsx(Be,{children:Array.from({length:60},(w,b)=>b).map(w=>e.jsx(X,{value:w.toString().padStart(2,"0"),children:w.toString().padStart(2,"0")},w))})]})]})]})]})]})})]})}),N2=As.memo(function({rule:n}){const i=`{ target = "${n.target}", time = "${n.time}", value = ${n.value.toFixed(1)} }`;return e.jsxs(ol,{children:[e.jsx(dl,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(ia,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Wa,{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:i}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})}),b2=As.memo(function({config:n,onChange:i}){const c=()=>{i({...n,talk_value_rules:[...n.talk_value_rules,{target:"",time:"00:00-23:59",value:1}]})},u=h=>{i({...n,talk_value_rules:n.talk_value_rules.filter((f,p)=>p!==h)})},x=(h,f,p)=>{const g=[...n.talk_value_rules];g[h]={...g[h],[f]:p},i({...n,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(E,{htmlFor:"talk_value",children:"聊天频率(基础值)"}),e.jsx(le,{id:"talk_value",type:"number",step:"0.1",min:"0",max:"1",value:n.talk_value,onChange:h=>i({...n,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(E,{htmlFor:"think_mode",children:"思考模式"}),e.jsxs(Ie,{value:n.think_mode||"classic",onValueChange:h=>i({...n,think_mode:h}),children:[e.jsx($e,{id:"think_mode",children:e.jsx(Pe,{placeholder:"选择思考模式"})}),e.jsxs(Be,{children:[e.jsx(X,{value:"classic",children:"经典模式 - 浅度思考和回复"}),e.jsx(X,{value:"deep",children:"深度模式 - 进行深度思考和回复"}),e.jsx(X,{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(Fe,{id:"mentioned_bot_reply",checked:n.mentioned_bot_reply,onCheckedChange:h=>i({...n,mentioned_bot_reply:h})}),e.jsx(E,{htmlFor:"mentioned_bot_reply",className:"cursor-pointer",children:"启用提及必回复"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"max_context_size",children:"上下文长度"}),e.jsx(le,{id:"max_context_size",type:"number",min:"1",value:n.max_context_size,onChange:h=>i({...n,max_context_size:parseInt(h.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"planner_smooth",children:"规划器平滑"}),e.jsx(le,{id:"planner_smooth",type:"number",step:"1",min:"0",value:n.planner_smooth,onChange:h=>i({...n,planner_smooth:parseFloat(h.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"增大数值会减小 planner 负荷,推荐 1-5,0 为关闭"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Fe,{id:"enable_talk_value_rules",checked:n.enable_talk_value_rules,onCheckedChange:h=>i({...n,enable_talk_value_rules:h})}),e.jsx(E,{htmlFor:"enable_talk_value_rules",className:"cursor-pointer",children:"启用动态发言频率规则"})]})]})]}),n.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(et,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),n.talk_value_rules&&n.talk_value_rules.length>0?e.jsx("div",{className:"space-y-4",children:n.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(N2,{rule:h}),e.jsxs(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{variant:"ghost",size:"sm",children:e.jsx(ls,{className:"h-4 w-4 text-destructive"})})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:["确定要删除规则 #",f+1," 吗?此操作无法撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>u(f),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{className:"text-xs font-medium",children:"配置类型"}),e.jsxs(Ie,{value:h.target===""?"global":"specific",onValueChange:p=>{p==="global"?x(f,"target",""):x(f,"target","qq::group")},children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(X,{value:"global",children:"全局配置"}),e.jsx(X,{value:"specific",children:"详细配置"})]})]})]}),h.target!==""&&(()=>{const p=h.target.split(":"),g=p[0]||"qq",N=p[1]||"",v=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(E,{className:"text-xs font-medium",children:"平台"}),e.jsxs(Ie,{value:g,onValueChange:y=>{x(f,"target",`${y}:${N}:${v}`)},children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(X,{value:"qq",children:"QQ"}),e.jsx(X,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{className:"text-xs font-medium",children:"群 ID"}),e.jsx(le,{value:N,onChange:y=>{x(f,"target",`${g}:${y.target.value}:${v}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{className:"text-xs font-medium",children:"类型"}),e.jsxs(Ie,{value:v,onValueChange:y=>{x(f,"target",`${g}:${N}:${y}`)},children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(X,{value:"group",children:"群组(group)"}),e.jsx(X,{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(E,{className:"text-xs font-medium",children:"时间段 (Time)"}),e.jsx(v2,{value:h.time,onChange:p=>x(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(E,{htmlFor:`rule-value-${f}`,className:"text-xs font-medium",children:"发言频率值 (Value)"}),e.jsx(le,{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)||x(f,"value",Math.max(.01,Math.min(1,g)))},className:"w-20 h-8 text-xs"})]}),e.jsx(qa,{value:[h.value],onValueChange:p=>x(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 表示正常发言"]})]})]})]})]})}),y2=As.memo(function({config:n,onChange:i}){const c=S=>{if(!S||!S.includes(":"))return{platform:"qq",userId:""};const[P,M]=S.split(":");return{platform:P,userId:M}},{platform:u,userId:x}=c(n.dream_send),[h,f]=d.useState(u),[p,g]=d.useState(x),N=S=>{const[P,M]=S.split("-");return{startTime:P||"09:00",endTime:M||"22:00"}},v=(S,P)=>{const M=P?`${S}:${P}`:"";i({...n,dream_send:M})},y=S=>{f(S),v(S,p)},w=S=>{g(S),v(h,S)},b=()=>{i({...n,dream_time_ranges:[...n.dream_time_ranges,"09:00-22:00"]})},R=S=>{i({...n,dream_time_ranges:n.dream_time_ranges.filter((P,M)=>M!==S)})},D=(S,P,M)=>{const T=[...n.dream_time_ranges],A=N(T[S]);P==="startTime"?A.startTime=M:A.endTime=M,T[S]=`${A.startTime}-${A.endTime}`,i({...n,dream_time_ranges:T})};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(E,{htmlFor:"interval_minutes",children:"做梦时间间隔(分钟)"}),e.jsx(le,{id:"interval_minutes",type:"number",min:"1",value:n.interval_minutes,onChange:S=>i({...n,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(E,{htmlFor:"max_iterations",children:"做梦最大轮次"}),e.jsx(le,{id:"max_iterations",type:"number",min:"1",value:n.max_iterations,onChange:S=>i({...n,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(E,{htmlFor:"first_delay_seconds",children:"首次做梦延迟(秒)"}),e.jsx(le,{id:"first_delay_seconds",type:"number",min:"0",value:n.first_delay_seconds,onChange:S=>i({...n,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(E,{children:"做梦结果推送目标"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(Ie,{value:h,onValueChange:y,children:[e.jsx($e,{className:"w-[120px]",children:e.jsx(Pe,{placeholder:"选择平台"})}),e.jsxs(Be,{children:[e.jsx(X,{value:"qq",children:"QQ"}),e.jsx(X,{value:"wx",children:"微信"}),e.jsx(X,{value:"webui",children:"WebUI"})]})]}),e.jsx(le,{type:"text",placeholder:"输入用户ID (例如: 123456)",value:p,onChange:S=>w(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(E,{children:"做梦时间段配置"}),e.jsx(_,{type:"button",size:"sm",onClick:b,children:"添加时间段"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"设置允许做梦的时间段,支持跨夜区间(如 23:00 到次日 02:00)。列表为空则全天允许做梦"}),e.jsxs("div",{className:"space-y-2",children:[n.dream_time_ranges.map((S,P)=>{const{startTime:M,endTime:T}=N(S);return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(le,{type:"time",value:M,onChange:A=>D(P,"startTime",A.target.value),className:"w-[140px]"}),e.jsx("span",{className:"text-muted-foreground",children:"至"}),e.jsx(le,{type:"time",value:T,onChange:A=>D(P,"endTime",A.target.value),className:"w-[140px]"}),e.jsx(_,{type:"button",variant:"ghost",size:"icon",onClick:()=>R(P),children:e.jsx(Ea,{className:"h-4 w-4"})})]},P)}),n.dream_time_ranges.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"当前配置为全天允许做梦"})]})]})]})}),w2=As.memo(function({config:n,onChange:i}){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(Fe,{checked:n.enable,onCheckedChange:c=>i({...n,enable:c})}),e.jsx(E,{className:"cursor-pointer",children:"启用 LPMM 知识库"})]}),n.enable&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"LPMM 模式"}),e.jsxs(Ie,{value:n.lpmm_mode,onValueChange:c=>i({...n,lpmm_mode:c}),children:[e.jsx($e,{children:e.jsx(Pe,{placeholder:"选择 LPMM 模式"})}),e.jsxs(Be,{children:[e.jsx(X,{value:"classic",children:"经典模式"}),e.jsx(X,{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(E,{children:"同义词搜索 TopK"}),e.jsx(le,{type:"number",min:"1",value:n.rag_synonym_search_top_k,onChange:c=>i({...n,rag_synonym_search_top_k:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"同义词阈值"}),e.jsx(le,{type:"number",step:"0.1",min:"0",max:"1",value:n.rag_synonym_threshold,onChange:c=>i({...n,rag_synonym_threshold:parseFloat(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"实体提取线程数"}),e.jsx(le,{type:"number",min:"1",value:n.info_extraction_workers,onChange:c=>i({...n,info_extraction_workers:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"嵌入向量维度"}),e.jsx(le,{type:"number",min:"1",value:n.embedding_dimension,onChange:c=>i({...n,embedding_dimension:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"嵌入并发线程数"}),e.jsx(le,{type:"number",min:"1",value:n.max_embedding_workers,onChange:c=>i({...n,max_embedding_workers:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"每批嵌入条数"}),e.jsx(le,{type:"number",min:"1",value:n.embedding_chunk_size,onChange:c=>i({...n,embedding_chunk_size:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"同义实体数上限"}),e.jsx(le,{type:"number",min:"1",value:n.max_synonym_entities,onChange:c=>i({...n,max_synonym_entities:parseInt(c.target.value)})})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Fe,{checked:n.enable_ppr,onCheckedChange:c=>i({...n,enable_ppr:c})}),e.jsx(E,{className:"cursor-pointer",children:"启用 PPR (低配机器可关闭)"})]})]})]})]})}),_2=As.memo(function({config:n,onChange:i}){const[c,u]=d.useState(""),[x,h]=d.useState("WARNING"),f=()=>{c&&!n.suppress_libraries.includes(c)&&(i({...n,suppress_libraries:[...n.suppress_libraries,c]}),u(""))},p=b=>{i({...n,suppress_libraries:n.suppress_libraries.filter(R=>R!==b)})},g=()=>{c&&!n.library_log_levels[c]&&(i({...n,library_log_levels:{...n.library_log_levels,[c]:x}}),u(""),h("WARNING"))},N=b=>{const R={...n.library_log_levels};delete R[b],i({...n,library_log_levels:R})},v=["DEBUG","INFO","WARNING","ERROR","CRITICAL"],y=["FULL","compact","lite"],w=["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(E,{children:"日期格式"}),e.jsx(le,{value:n.date_style,onChange:b=>i({...n,date_style:b.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(E,{children:"日志级别样式"}),e.jsxs(Ie,{value:n.log_level_style,onValueChange:b=>i({...n,log_level_style:b}),children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsx(Be,{children:y.map(b=>e.jsx(X,{value:b,children:b},b))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"日志文本颜色"}),e.jsxs(Ie,{value:n.color_text,onValueChange:b=>i({...n,color_text:b}),children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsx(Be,{children:w.map(b=>e.jsx(X,{value:b,children:b},b))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"全局日志级别"}),e.jsxs(Ie,{value:n.log_level,onValueChange:b=>i({...n,log_level:b}),children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsx(Be,{children:v.map(b=>e.jsx(X,{value:b,children:b},b))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"控制台日志级别"}),e.jsxs(Ie,{value:n.console_log_level,onValueChange:b=>i({...n,console_log_level:b}),children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsx(Be,{children:v.map(b=>e.jsx(X,{value:b,children:b},b))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"文件日志级别"}),e.jsxs(Ie,{value:n.file_log_level,onValueChange:b=>i({...n,file_log_level:b}),children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsx(Be,{children:v.map(b=>e.jsx(X,{value:b,children:b},b))})]})]})]})]}),e.jsxs("div",{children:[e.jsx(E,{className:"mb-2 block",children:"完全屏蔽的库"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(le,{value:c,onChange:b=>u(b.target.value),placeholder:"输入库名",className:"flex-1",onKeyDown:b=>{b.key==="Enter"&&(b.preventDefault(),f())}}),e.jsx(_,{onClick:f,size:"sm",className:"flex-shrink-0",children:e.jsx(et,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:n.suppress_libraries.map(b=>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:b}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onClick:()=>p(b),children:e.jsx(ls,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},b))})]}),e.jsxs("div",{children:[e.jsx(E,{className:"mb-2 block",children:"特定库的日志级别"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(le,{value:c,onChange:b=>u(b.target.value),placeholder:"输入库名",className:"flex-1"}),e.jsxs(Ie,{value:x,onValueChange:h,children:[e.jsx($e,{className:"w-32",children:e.jsx(Pe,{})}),e.jsx(Be,{children:v.map(b=>e.jsx(X,{value:b,children:b},b))})]}),e.jsx(_,{onClick:g,size:"sm",children:e.jsx(et,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"space-y-2",children:Object.entries(n.library_log_levels).map(([b,R])=>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:b}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:R}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>N(b),children:e.jsx(ls,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]})]},b))})]})]})}),S2=As.memo(function({config:n,onChange:i}){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(E,{children:"显示 Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否在日志中显示提示词"})]}),e.jsx(Fe,{checked:n.show_prompt,onCheckedChange:c=>i({...n,show_prompt:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(E,{children:"显示回复器 Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的提示词"})]}),e.jsx(Fe,{checked:n.show_replyer_prompt,onCheckedChange:c=>i({...n,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(E,{children:"显示回复器推理"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的推理过程"})]}),e.jsx(Fe,{checked:n.show_replyer_reasoning,onCheckedChange:c=>i({...n,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(E,{children:"显示 Jargon Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示术语相关的提示词"})]}),e.jsx(Fe,{checked:n.show_jargon_prompt,onCheckedChange:c=>i({...n,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(E,{children:"显示记忆检索 Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示记忆检索相关的提示词"})]}),e.jsx(Fe,{checked:n.show_memory_prompt,onCheckedChange:c=>i({...n,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(E,{children:"显示 Planner Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示 Planner 的提示词和原始返回结果"})]}),e.jsx(Fe,{checked:n.show_planner_prompt,onCheckedChange:c=>i({...n,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(E,{children:"显示 LPMM 相关文段"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示 LPMM 知识库找到的相关文段日志"})]}),e.jsx(Fe,{checked:n.show_lpmm_paragraph,onCheckedChange:c=>i({...n,show_lpmm_paragraph:c})})]})]})]})}),k2=As.memo(function({config:n,onChange:i}){const[c,u]=d.useState(""),[x,h]=d.useState(""),f=()=>{c&&!n.auth_token.includes(c)&&(i({...n,auth_token:[...n.auth_token,c]}),u(""))},p=v=>{i({...n,auth_token:n.auth_token.filter((y,w)=>w!==v)})},g=()=>{x&&!n.api_server_allowed_api_keys.includes(x)&&(i({...n,api_server_allowed_api_keys:[...n.api_server_allowed_api_keys,x]}),h(""))},N=v=>{i({...n,api_server_allowed_api_keys:n.api_server_allowed_api_keys.filter((y,w)=>w!==v)})};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(le,{value:c,onChange:v=>u(v.target.value),placeholder:"输入认证令牌",onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),f())}}),e.jsx(_,{onClick:f,size:"sm",children:e.jsx(et,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"space-y-2",children:n.auth_token.map((v,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:v}),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(E,{children:"启用新版 API Server"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否启用额外的新版 API Server(额外监听端口)"})]}),e.jsx(Fe,{checked:n.enable_api_server,onCheckedChange:v=>i({...n,enable_api_server:v})})]}),n.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(E,{children:"主机地址"}),e.jsx(le,{value:n.api_server_host,onChange:v=>i({...n,api_server_host:v.target.value}),placeholder:"0.0.0.0"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"端口号"}),e.jsx(le,{type:"number",value:n.api_server_port,onChange:v=>i({...n,api_server_port:parseInt(v.target.value)}),placeholder:"8090"})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Fe,{checked:n.api_server_use_wss,onCheckedChange:v=>i({...n,api_server_use_wss:v})}),e.jsx(E,{children:"启用 WSS 安全连接"})]}),n.api_server_use_wss&&e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"SSL 证书文件路径"}),e.jsx(le,{value:n.api_server_cert_file,onChange:v=>i({...n,api_server_cert_file:v.target.value}),placeholder:"cert.pem"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"SSL 密钥文件路径"}),e.jsx(le,{value:n.api_server_key_file,onChange:v=>i({...n,api_server_key_file:v.target.value}),placeholder:"key.pem"})]})]}),e.jsxs("div",{children:[e.jsx(E,{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(le,{value:x,onChange:v=>h(v.target.value),placeholder:"输入 API Key",onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),g())}}),e.jsx(_,{onClick:g,size:"sm",children:e.jsx(et,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"space-y-2",children:n.api_server_allowed_api_keys.map((v,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:v}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>N(y),children:e.jsx(ls,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},y))})]})]})]})]})]})}),C2=As.memo(function({config:n,onChange:i}){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(E,{children:"启用统计信息发送"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"发送匿名统计信息,帮助我们了解全球有多少只麦麦在运行"})]}),e.jsx(Fe,{checked:n.enable,onCheckedChange:c=>i({...n,enable:c})})]})]})}),T2=As.memo(function({emojiConfig:n,memoryConfig:i,toolConfig:c,voiceConfig:u,onEmojiChange:x,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(Fe,{id:"enable_tool",checked:c.enable_tool,onCheckedChange:g=>f({...c,enable_tool:g})}),e.jsx(E,{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(Fe,{id:"enable_asr",checked:u.enable_asr,onCheckedChange:g=>p({...u,enable_asr:g})}),e.jsx(E,{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(E,{htmlFor:"max_agent_iterations",children:"记忆思考深度"}),e.jsx(le,{id:"max_agent_iterations",type:"number",min:"1",value:i.max_agent_iterations,onChange:g=>h({...i,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(E,{htmlFor:"agent_timeout_seconds",children:"最长回忆时间(秒)"}),e.jsx(le,{id:"agent_timeout_seconds",type:"number",min:"1",step:"0.1",value:i.agent_timeout_seconds??120,onChange:g=>h({...i,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(Fe,{id:"enable_jargon_detection",checked:i.enable_jargon_detection??!0,onCheckedChange:g=>h({...i,enable_jargon_detection:g})}),e.jsx(E,{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(Fe,{id:"global_memory",checked:i.global_memory??!1,onCheckedChange:g=>h({...i,global_memory:g})}),e.jsx(E,{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(E,{htmlFor:"emoji_chance",children:"表情包激活概率"}),e.jsx(le,{id:"emoji_chance",type:"number",step:"0.1",min:"0",max:"1",value:n.emoji_chance,onChange:g=>x({...n,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(E,{htmlFor:"max_reg_num",children:"最大注册数量"}),e.jsx(le,{id:"max_reg_num",type:"number",min:"1",value:n.max_reg_num,onChange:g=>x({...n,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(E,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),e.jsx(le,{id:"check_interval",type:"number",min:"1",value:n.check_interval,onChange:g=>x({...n,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(Fe,{id:"do_replace",checked:n.do_replace,onCheckedChange:g=>x({...n,do_replace:g})}),e.jsx(E,{htmlFor:"do_replace",className:"cursor-pointer",children:"达到最大数量时替换表情包"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Fe,{id:"steal_emoji",checked:n.steal_emoji,onCheckedChange:g=>x({...n,steal_emoji:g})}),e.jsx(E,{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(Fe,{id:"content_filtration",checked:n.content_filtration,onCheckedChange:g=>x({...n,content_filtration:g})}),e.jsx(E,{htmlFor:"content_filtration",className:"cursor-pointer",children:"启用表情包过滤"})]}),n.content_filtration&&e.jsxs("div",{className:"grid gap-2 pl-6 border-l-2 border-primary/20",children:[e.jsx(E,{htmlFor:"filtration_prompt",children:"过滤要求"}),e.jsx(le,{id:"filtration_prompt",value:n.filtration_prompt,onChange:g=>x({...n,filtration_prompt:g.target.value}),placeholder:"符合公序良俗"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"只有符合此要求的表情包才会被保存"})]})]})]})})]})}),E2=As.memo(function({member:n,groupIndex:i,memberIndex:c,availableChatIds:u,onUpdate:x,onRemove:h}){const f=u.includes(n)||n==="*",[p,g]=d.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(le,{value:n,onChange:N=>x(i,c,N.target.value),placeholder:'输入 "*" 或 "qq:123456:group"',className:"flex-1"}),u.length>0&&e.jsx(_,{size:"sm",variant:"outline",onClick:()=>g(!1),title:"切换到下拉选择",children:"下拉"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(Ie,{value:n,onValueChange:N=>x(i,c,N),children:[e.jsx($e,{className:"flex-1",children:e.jsx(Pe,{placeholder:"选择聊天流"})}),e.jsxs(Be,{children:[e.jsx(X,{value:"*",children:"* (全局共享)"}),u.map((N,v)=>e.jsx(X,{value:N,children:N},v))]})]}),e.jsx(_,{size:"sm",variant:"outline",onClick:()=>g(!0),title:"切换到手动输入",children:"输入"})]})}),e.jsxs(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(ls,{className:"h-4 w-4"})})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:['确定要删除组成员 "',n||"(空)",'" 吗?此操作无法撤销。']})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>h(i,c),children:"删除"})]})]})]})]})}),M2=As.memo(function({config:n,onChange:i}){const c=()=>{i({...n,learning_list:[...n.learning_list,["","enable","enable","1.0"]]})},u=y=>{i({...n,learning_list:n.learning_list.filter((w,b)=>b!==y)})},x=(y,w,b)=>{const R=[...n.learning_list];R[y][w]=b,i({...n,learning_list:R})},h=({rule:y})=>{const w=`["${y[0]}", "${y[1]}", "${y[2]}", "${y[3]}"]`;return e.jsxs(ol,{children:[e.jsx(dl,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(ia,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Wa,{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:w}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},f=()=>{i({...n,expression_groups:[...n.expression_groups,[]]})},p=y=>{i({...n,expression_groups:n.expression_groups.filter((w,b)=>b!==y)})},g=y=>{const w=[...n.expression_groups];w[y]=[...w[y],""],i({...n,expression_groups:w})},N=(y,w)=>{const b=[...n.expression_groups];b[y]=b[y].filter((R,D)=>D!==w),i({...n,expression_groups:b})},v=(y,w,b)=>{const R=[...n.expression_groups];R[y][w]=b,i({...n,expression_groups:R})};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(Fe,{id:"all_global_jargon",checked:n.all_global_jargon??!1,onCheckedChange:y=>i({...n,all_global_jargon:y})}),e.jsx(E,{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(Fe,{id:"enable_jargon_explanation",checked:n.enable_jargon_explanation??!0,onCheckedChange:y=>i({...n,enable_jargon_explanation:y})}),e.jsx(E,{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(E,{htmlFor:"jargon_mode",children:"黑话解释来源模式"}),e.jsxs(Ie,{value:n.jargon_mode??"context",onValueChange:y=>i({...n,jargon_mode:y}),children:[e.jsx($e,{id:"jargon_mode",className:"mt-2",children:e.jsx(Pe,{placeholder:"选择黑话解释来源"})}),e.jsxs(Be,{children:[e.jsx(X,{value:"context",children:"上下文模式(自动匹配黑话)"}),e.jsx(X,{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(et,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),e.jsxs("div",{className:"space-y-4",children:[n.learning_list.map((y,w)=>{const b=n.learning_list.some((T,A)=>A!==w&&T[0]===""),R=y[0]==="",D=y[0].split(":"),S=D[0]||"qq",P=D[1]||"",M=D[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:["规则 ",w+1," ",R&&"(全局配置)"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{rule:y}),e.jsxs(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"sm",variant:"ghost",children:e.jsx(ls,{className:"h-4 w-4"})})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:["确定要删除学习规则 ",w+1," 吗?此操作无法撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>u(w),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{className:"text-xs font-medium",children:"配置类型"}),e.jsxs(Ie,{value:R?"global":"specific",onValueChange:T=>{T==="global"?x(w,0,""):x(w,0,"qq::group")},disabled:b&&!R,children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(X,{value:"global",children:"全局配置"}),e.jsx(X,{value:"specific",disabled:b&&!R,children:"详细配置"})]})]}),b&&!R&&e.jsx("p",{className:"text-xs text-amber-600",children:"已存在全局配置,无法创建新的全局配置"})]}),!R&&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(E,{className:"text-xs font-medium",children:"平台"}),e.jsxs(Ie,{value:S,onValueChange:T=>{x(w,0,`${T}:${P}:${M}`)},children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(X,{value:"qq",children:"QQ"}),e.jsx(X,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{className:"text-xs font-medium",children:"群 ID"}),e.jsx(le,{value:P,onChange:T=>{x(w,0,`${S}:${T.target.value}:${M}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{className:"text-xs font-medium",children:"类型"}),e.jsxs(Ie,{value:M,onValueChange:T=>{x(w,0,`${S}:${P}:${T}`)},children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(X,{value:"group",children:"群组(group)"}),e.jsx(X,{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(E,{className:"text-xs font-medium",children:"使用学到的表达"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦使用从聊天中学到的表达方式"})]}),e.jsx(Fe,{checked:y[1]==="enable",onCheckedChange:T=>x(w,1,T?"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(E,{className:"text-xs font-medium",children:"学习表达"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦从聊天中学习新的表达方式"})]}),e.jsx(Fe,{checked:y[2]==="enable",onCheckedChange:T=>x(w,2,T?"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(E,{className:"text-xs font-medium",children:"启用黑话学习"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦在此聊天流中学习和记录黑话"})]}),e.jsx(Fe,{checked:y[3]==="true"||y[3]==="enable",onCheckedChange:T=>x(w,3,T?"true":"false")})]})})]})]},w)}),n.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(E,{htmlFor:"expression_self_reflect",className:"cursor-pointer font-medium",children:"自动表达优化"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后,麦麦会自动检查并优化表达方式,无需管理员手动干预"})]}),e.jsx(Fe,{id:"expression_self_reflect",checked:n.expression_self_reflect??!1,onCheckedChange:y=>i({...n,expression_self_reflect:y})})]}),n.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(E,{htmlFor:"expression_auto_check_interval",children:"自动检查间隔(秒)"}),e.jsx(le,{id:"expression_auto_check_interval",type:"number",min:"60",value:n.expression_auto_check_interval??3600,onChange:y=>i({...n,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(E,{htmlFor:"expression_auto_check_count",children:"每次检查数量"}),e.jsx(le,{id:"expression_auto_check_count",type:"number",min:"1",max:"100",value:n.expression_auto_check_count??10,onChange:y=>i({...n,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(E,{children:"自定义评估标准"}),e.jsxs(_,{onClick:()=>{i({...n,expression_auto_check_custom_criteria:[...n.expression_auto_check_custom_criteria||[],""]})},size:"sm",variant:"outline",children:[e.jsx(et,{className:"h-4 w-4 mr-1"}),"添加标准"]})]}),e.jsxs("div",{className:"space-y-2",children:[(n.expression_auto_check_custom_criteria||[]).map((y,w)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(le,{value:y,onChange:b=>{const R=[...n.expression_auto_check_custom_criteria||[]];R[w]=b.target.value,i({...n,expression_auto_check_custom_criteria:R})},placeholder:"输入评估标准,例如:是否符合角色人设",className:"flex-1"}),e.jsx(_,{onClick:()=>{i({...n,expression_auto_check_custom_criteria:(n.expression_auto_check_custom_criteria||[]).filter((b,R)=>R!==w)})},size:"icon",variant:"ghost",children:e.jsx(ls,{className:"h-4 w-4"})})]},w)),(!n.expression_auto_check_custom_criteria||n.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(E,{htmlFor:"expression_checked_only",className:"cursor-pointer font-medium",children:"仅使用已审核通过的表达方式"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"开启后,只有通过审核(已检查)的项目会被使用;关闭时,未审核的项目也会被使用。无论开关状态,被拒绝的项目永远不会被使用。"})]}),e.jsx(Fe,{id:"expression_checked_only",checked:n.expression_checked_only??!1,onCheckedChange:y=>i({...n,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(E,{htmlFor:"expression_manual_reflect",className:"cursor-pointer font-medium",children:"手动表达优化"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后,麦麦会主动向管理员询问表达方式是否合适"})]}),e.jsx(Fe,{id:"expression_manual_reflect",checked:n.expression_manual_reflect??!1,onCheckedChange:y=>i({...n,expression_manual_reflect:y})})]}),n.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 w=(n.manual_reflect_operator_id||"").split(":"),b=w[0]||"qq",R=w[1]||"",D=w[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(E,{className:"text-xs font-medium",children:"平台"}),e.jsxs(Ie,{value:b,onValueChange:S=>{i({...n,manual_reflect_operator_id:`${S}:${R}:${D}`})},children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(X,{value:"qq",children:"QQ"}),e.jsx(X,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{className:"text-xs font-medium",children:"用户/群 ID"}),e.jsx(le,{value:R,onChange:S=>{i({...n,manual_reflect_operator_id:`${b}:${S.target.value}:${D}`})},placeholder:"输入 ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{className:"text-xs font-medium",children:"类型"}),e.jsxs(Ie,{value:D,onValueChange:S=>{i({...n,manual_reflect_operator_id:`${b}:${R}:${S}`})},children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(X,{value:"private",children:"私聊(private)"}),e.jsx(X,{value:"group",children:"群组(group)"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前操作员 ID:",n.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:()=>{i({...n,allow_reflect:[...n.allow_reflect||[],"qq::group"]})},size:"sm",variant:"outline",children:[e.jsx(et,{className:"h-4 w-4 mr-1"}),"添加聊天流"]})]}),e.jsxs("div",{className:"space-y-2",children:[(n.allow_reflect||[]).map((y,w)=>{const b=y.split(":"),R=b[0]||"qq",D=b[1]||"",S=b[2]||"group";return e.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg bg-muted/50",children:[e.jsxs(Ie,{value:R,onValueChange:P=>{const M=[...n.allow_reflect];M[w]=`${P}:${D}:${S}`,i({...n,allow_reflect:M})},children:[e.jsx($e,{className:"w-24",children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(X,{value:"qq",children:"QQ"}),e.jsx(X,{value:"wx",children:"微信"})]})]}),e.jsx(le,{value:D,onChange:P=>{const M=[...n.allow_reflect];M[w]=`${R}:${P.target.value}:${S}`,i({...n,allow_reflect:M})},placeholder:"ID",className:"flex-1 font-mono text-sm"}),e.jsxs(Ie,{value:S,onValueChange:P=>{const M=[...n.allow_reflect];M[w]=`${R}:${D}:${P}`,i({...n,allow_reflect:M})},children:[e.jsx($e,{className:"w-32",children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(X,{value:"group",children:"群组"}),e.jsx(X,{value:"private",children:"私聊"})]})]}),e.jsx(_,{onClick:()=>{i({...n,allow_reflect:n.allow_reflect.filter((P,M)=>M!==w)})},size:"sm",variant:"ghost",children:e.jsx(ls,{className:"h-4 w-4"})})]},w)}),(!n.allow_reflect||n.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(et,{className:"h-4 w-4 mr-1"}),"添加共享组"]})]}),e.jsxs("div",{className:"space-y-4",children:[n.expression_groups.map((y,w)=>{const b=n.learning_list.map(R=>R[0]).filter(R=>R!=="");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:["共享组 ",w+1,y.length===1&&y[0]==="*"&&"(全局共享)"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(_,{onClick:()=>g(w),size:"sm",variant:"outline",children:e.jsx(et,{className:"h-4 w-4"})}),e.jsxs(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"sm",variant:"ghost",children:e.jsx(ls,{className:"h-4 w-4"})})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:["确定要删除共享组 ",w+1," 吗?此操作无法撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>p(w),children:"删除"})]})]})]})]})]}),e.jsx("div",{className:"space-y-2",children:y.map((R,D)=>e.jsx(E2,{member:R,groupIndex:w,memberIndex:D,availableChatIds:b,onUpdate:v,onRemove:N},`${w}-${D}`))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:'提示:可以从下拉框选择已配置的聊天流,或手动输入。输入 "*" 启用全局共享'})]},w)}),n.expression_groups.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无共享组,点击"添加共享组"开始配置'})]})]})})]})});function z2({regex:l,reaction:n,onRegexChange:i,onReactionChange:c}){const[u,x]=d.useState(!1),[h,f]=d.useState(""),[p,g]=d.useState(null),[N,v]=d.useState(""),[y,w]=d.useState({}),[b,R]=d.useState(""),D=d.useRef(null),[S,P]=d.useState("build"),M=L=>L.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),T=(L,J=0)=>{const U=D.current;if(!U)return;const ue=U.selectionStart||0,xe=U.selectionEnd||0,he=l.substring(0,ue)+L+l.substring(xe);i(he),setTimeout(()=>{const ne=ue+L.length+J;U.setSelectionRange(ne,ne),U.focus()},0)};d.useEffect(()=>{if(!l||!h){p!==null&&g(null),Object.keys(y).length>0&&w({}),b!==n&&R(n),N!==""&&v("");return}try{const L=M(l),J=new RegExp(L,"g"),U=h.match(J);g(U),v("");const xe=new RegExp(L).exec(h);if(xe&&xe.groups){w(xe.groups);let he=n;Object.entries(xe.groups).forEach(([ne,ve])=>{he=he.replace(new RegExp(`\\[${ne}\\]`,"g"),ve||"")}),R(he)}else w({}),R(n)}catch(L){v(L.message),g(null),w({}),R(n)}},[l,h,n,p,y,b,N]);const A=()=>{if(!h||!p||p.length===0)return e.jsx("span",{className:"text-muted-foreground",children:h||"请输入测试文本"});try{const L=M(l),J=new RegExp(L,"g");let U=0;const ue=[];let xe;for(;(xe=J.exec(h))!==null;)xe.index>U&&ue.push(e.jsx("span",{children:h.substring(U,xe.index)},`text-${U}`)),ue.push(e.jsx("span",{className:"bg-yellow-200 dark:bg-yellow-900 font-semibold",children:xe[0]},`match-${xe.index}`)),U=xe.index+xe[0].length;return U)",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(Is,{open:u,onOpenChange:x,children:[e.jsx(Wo,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(Qm,{className:"h-4 w-4 mr-1"}),"正则编辑器"]})}),e.jsxs(Os,{className:"max-w-[95vw] sm:max-w-[900px] max-h-[90vh]",children:[e.jsxs(Ds,{children:[e.jsx(Rs,{children:"正则表达式编辑器"}),e.jsx(Ks,{className:"text-sm",children:"使用可视化工具构建正则表达式,并实时测试效果"})]}),e.jsx(Ye,{className:"max-h-[calc(90vh-120px)]",children:e.jsxs(ta,{value:S,onValueChange:L=>P(L),className:"w-full",children:[e.jsxs(Xt,{className:"grid w-full grid-cols-2",children:[e.jsx(Je,{value:"build",children:"🔧 构建器"}),e.jsx(Je,{value:"test",children:"🧪 测试器"})]}),e.jsxs(ys,{value:"build",className:"space-y-4 mt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{className:"text-sm font-medium",children:"正则表达式"}),e.jsx(le,{ref:D,value:l,onChange:L=>i(L.target.value),className:"font-mono text-sm",placeholder:"点击下方按钮构建正则表达式..."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{className:"text-sm font-medium",children:"Reaction 内容"}),e.jsx(ot,{value:n,onChange:L=>c(L.target.value),placeholder:"使用 [捕获组名] 引用捕获的内容...",rows:3,className:"text-sm"})]}),e.jsxs("div",{className:"space-y-4 border-t pt-4",children:[F.map(L=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("h5",{className:"text-xs font-semibold text-primary",children:L.category}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:L.items.map(J=>e.jsx(_,{variant:"outline",size:"sm",className:"justify-start h-auto py-2 px-3",onClick:()=>T(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))})]},L.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:()=>i("^(?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:()=>i("(?:[^,。.\\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:()=>i("(?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(ys,{value:"test",className:"space-y-4 mt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{className:"text-sm font-medium",children:"当前正则表达式"}),e.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:l||"(未设置)"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"test-text",className:"text-sm font-medium",children:"测试文本"}),e.jsx(ot,{id:"test-text",value:h,onChange:L=>f(L.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(E,{className:"text-sm font-medium",children:"匹配高亮"}),e.jsx(Ye,{className:"h-40 rounded-md bg-muted p-3",children:e.jsx("div",{className:"text-sm break-words",children:A()})})]}),Object.keys(y).length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{className:"text-sm font-medium",children:"命名捕获组"}),e.jsx(Ye,{className:"h-32 rounded-md border p-3",children:e.jsx("div",{className:"space-y-2",children:Object.entries(y).map(([L,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:["[",L,"]"]}),e.jsx("span",{className:"text-muted-foreground",children:"="}),e.jsx("span",{className:"font-mono bg-muted px-2 py-0.5 rounded",children:J})]},L))})})]}),Object.keys(y).length>0&&n&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{className:"text-sm font-medium",children:"Reaction 替换预览"}),e.jsx(Ye,{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:b})}),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 A2=As.memo(function({keywordReactionConfig:n,responsePostProcessConfig:i,chineseTypoConfig:c,responseSplitterConfig:u,onKeywordReactionChange:x,onResponsePostProcessChange:h,onChineseTypoChange:f,onResponseSplitterChange:p}){const g=()=>{x({...n,regex_rules:[...n.regex_rules,{regex:[""],reaction:""}]})},N=T=>{x({...n,regex_rules:n.regex_rules.filter((A,F)=>F!==T)})},v=(T,A,F)=>{const L=[...n.regex_rules];A==="regex"&&typeof F=="string"?L[T]={...L[T],regex:[F]}:A==="reaction"&&typeof F=="string"&&(L[T]={...L[T],reaction:F}),x({...n,regex_rules:L})},y=()=>{x({...n,keyword_rules:[...n.keyword_rules,{keywords:[],reaction:""}]})},w=T=>{x({...n,keyword_rules:n.keyword_rules.filter((A,F)=>F!==T)})},b=(T,A,F)=>{const L=[...n.keyword_rules];typeof F=="string"&&(L[T]={...L[T],reaction:F}),x({...n,keyword_rules:L})},R=T=>{const A=[...n.keyword_rules];A[T]={...A[T],keywords:[...A[T].keywords||[],""]},x({...n,keyword_rules:A})},D=(T,A)=>{const F=[...n.keyword_rules];F[T]={...F[T],keywords:(F[T].keywords||[]).filter((L,J)=>J!==A)},x({...n,keyword_rules:F})},S=(T,A,F)=>{const L=[...n.keyword_rules],J=[...L[T].keywords||[]];J[A]=F,L[T]={...L[T],keywords:J},x({...n,keyword_rules:L})},P=({rule:T})=>{const A=`{ regex = [${(T.regex||[]).map(F=>`"${F}"`).join(", ")}], reaction = "${T.reaction}" }`;return e.jsxs(ol,{children:[e.jsx(dl,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(ia,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Wa,{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(Ye,{className:"h-60 rounded-md bg-muted p-3",children:e.jsx("pre",{className:"font-mono text-xs break-all",children:A})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},M=({rule:T})=>{const A=`[[keyword_reaction.keyword_rules]] -keywords = [${(T.keywords||[]).map(F=>`"${F}"`).join(", ")}] -reaction = "${T.reaction}"`;return e.jsxs(ol,{children:[e.jsx(dl,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(ia,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Wa,{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(Ye,{className:"h-60 rounded-md bg-muted p-3",children:e.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-all",children:A})}),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(et,{className:"h-4 w-4 mr-1"}),"添加正则规则"]})]}),e.jsxs("div",{className:"space-y-3",children:[n.regex_rules.map((T,A)=>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:["正则规则 ",A+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(z2,{regex:T.regex&&T.regex[0]||"",reaction:T.reaction,onRegexChange:F=>v(A,"regex",F),onReactionChange:F=>v(A,"reaction",F)}),e.jsx(P,{rule:T}),e.jsxs(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"sm",variant:"ghost",children:e.jsx(ls,{className:"h-4 w-4"})})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:["确定要删除正则规则 ",A+1," 吗?此操作无法撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>N(A),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{className:"text-xs font-medium",children:"正则表达式(Python 语法)"}),e.jsx(le,{value:T.regex&&T.regex[0]||"",onChange:F=>v(A,"regex",F.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(E,{className:"text-xs font-medium",children:"反应内容"}),e.jsx(ot,{value:T.reaction,onChange:F=>v(A,"reaction",F.target.value),placeholder:`触发后麦麦的反应... -可以使用 [捕获组名] 来引用正则表达式中的内容`,rows:3,className:"text-sm"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"使用 [捕获组名] 引用正则表达式中的命名捕获组,例如 [n] 会被替换为捕获的内容"})]})]})]},A)),n.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(et,{className:"h-4 w-4 mr-1"}),"添加关键词规则"]})]}),e.jsxs("div",{className:"space-y-3",children:[n.keyword_rules.map((T,A)=>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:["关键词规则 ",A+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(M,{rule:T}),e.jsxs(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"sm",variant:"ghost",children:e.jsx(ls,{className:"h-4 w-4"})})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:["确定要删除关键词规则 ",A+1," 吗?此操作无法撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>w(A),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(E,{className:"text-xs font-medium",children:"关键词列表"}),e.jsxs(_,{onClick:()=>R(A),size:"sm",variant:"ghost",children:[e.jsx(et,{className:"h-3 w-3 mr-1"}),"添加关键词"]})]}),e.jsxs("div",{className:"space-y-2",children:[(T.keywords||[]).map((F,L)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(le,{value:F,onChange:J=>S(A,L,J.target.value),placeholder:"关键词",className:"flex-1"}),e.jsx(_,{onClick:()=>D(A,L),size:"sm",variant:"ghost",children:e.jsx(ls,{className:"h-4 w-4"})})]},L)),(!T.keywords||T.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(E,{className:"text-xs font-medium",children:"反应内容"}),e.jsx(ot,{value:T.reaction,onChange:F=>b(A,"reaction",F.target.value),placeholder:"触发后麦麦的反应...",rows:3,className:"text-sm"})]})]})]},A)),n.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(Fe,{id:"enable_response_post_process",checked:i.enable_response_post_process,onCheckedChange:T=>h({...i,enable_response_post_process:T})}),e.jsx(E,{htmlFor:"enable_response_post_process",className:"cursor-pointer",children:"启用回复后处理"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"包括错别字生成器和回复分割器"})]}),i.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(Fe,{id:"enable_chinese_typo",checked:c.enable,onCheckedChange:T=>f({...c,enable:T})}),e.jsx(E,{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(E,{htmlFor:"error_rate",className:"text-xs font-medium",children:"单字替换概率"}),e.jsx(le,{id:"error_rate",type:"number",step:"0.001",min:"0",max:"1",value:c.error_rate,onChange:T=>f({...c,error_rate:parseFloat(T.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"min_freq",className:"text-xs font-medium",children:"最小字频阈值"}),e.jsx(le,{id:"min_freq",type:"number",min:"0",value:c.min_freq,onChange:T=>f({...c,min_freq:parseInt(T.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"tone_error_rate",className:"text-xs font-medium",children:"声调错误概率"}),e.jsx(le,{id:"tone_error_rate",type:"number",step:"0.01",min:"0",max:"1",value:c.tone_error_rate,onChange:T=>f({...c,tone_error_rate:parseFloat(T.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"word_replace_rate",className:"text-xs font-medium",children:"整词替换概率"}),e.jsx(le,{id:"word_replace_rate",type:"number",step:"0.001",min:"0",max:"1",value:c.word_replace_rate,onChange:T=>f({...c,word_replace_rate:parseFloat(T.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(Fe,{id:"enable_response_splitter",checked:u.enable,onCheckedChange:T=>p({...u,enable:T})}),e.jsx(E,{htmlFor:"enable_response_splitter",className:"cursor-pointer font-semibold",children:"回复分割器"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"控制回复的长度和句子数量"}),u.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(E,{htmlFor:"max_length",className:"text-xs font-medium",children:"最大长度"}),e.jsx(le,{id:"max_length",type:"number",min:"1",value:u.max_length,onChange:T=>p({...u,max_length:parseInt(T.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大字符数"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"max_sentence_num",className:"text-xs font-medium",children:"最大句子数"}),e.jsx(le,{id:"max_sentence_num",type:"number",min:"1",value:u.max_sentence_num,onChange:T=>p({...u,max_sentence_num:parseInt(T.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(Fe,{id:"enable_kaomoji_protection",checked:u.enable_kaomoji_protection,onCheckedChange:T=>p({...u,enable_kaomoji_protection:T})}),e.jsx(E,{htmlFor:"enable_kaomoji_protection",className:"cursor-pointer",children:"启用颜文字保护"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Fe,{id:"enable_overflow_return_all",checked:u.enable_overflow_return_all,onCheckedChange:T=>p({...u,enable_overflow_return_all:T})}),e.jsx(E,{htmlFor:"enable_overflow_return_all",className:"cursor-pointer",children:"超出时一次性返回全部"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"当句子数量超出限制时,合并后一次性返回所有内容"})]})]})})]})]})]})}),O2=As.memo(function({config:n,onChange:i}){const[c,u]=d.useState(""),[x,h]=d.useState(""),[f,p]=d.useState(!1),g=n.allowed_ips?n.allowed_ips.split(",").map(S=>S.trim()).filter(S=>S):[],N=n.trusted_proxies?n.trusted_proxies.split(",").map(S=>S.trim()).filter(S=>S):[],v=()=>{if(!c.trim())return;const S=[...g,c.trim()];i({...n,allowed_ips:S.join(",")}),u("")},y=S=>{const P=g.filter((M,T)=>T!==S);i({...n,allowed_ips:P.join(",")})},w=()=>{if(!x.trim())return;const S=[...N,x.trim()];i({...n,trusted_proxies:S.join(",")}),h("")},b=S=>{const P=N.filter((M,T)=>T!==S);i({...n,trusted_proxies:P.join(",")})},R=S=>{!S&&n.enabled?p(!0):i({...n,enabled:S})},D=()=>{i({...n,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(Fe,{checked:n.enabled,onCheckedChange:R}),e.jsx(E,{className:"cursor-pointer",children:"启用 WebUI"})]}),n.enabled&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"运行模式"}),e.jsxs(Ie,{value:n.mode,onValueChange:S=>i({...n,mode:S}),children:[e.jsx($e,{children:e.jsx(Pe,{placeholder:"选择运行模式"})}),e.jsxs(Be,{children:[e.jsx(X,{value:"development",children:"开发模式"}),e.jsx(X,{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(E,{children:"防爬虫模式"}),e.jsxs(Ie,{value:n.anti_crawler_mode,onValueChange:S=>i({...n,anti_crawler_mode:S}),children:[e.jsx($e,{children:e.jsx(Pe,{placeholder:"选择防爬虫模式"})}),e.jsxs(Be,{children:[e.jsx(X,{value:"false",children:"禁用"}),e.jsx(X,{value:"basic",children:"基础(只记录不阻止)"}),e.jsx(X,{value:"loose",children:"宽松"}),e.jsx(X,{value:"strict",children:"严格"})]})]})]}),e.jsxs("div",{className:"grid gap-2 sm:col-span-2",children:[e.jsx(E,{children:"IP 白名单"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(le,{value:c,onChange:S=>u(S.target.value),onKeyDown:S=>{S.key==="Enter"&&(S.preventDefault(),v())},placeholder:"输入IP地址后按回车或点击添加"}),e.jsx(_,{type:"button",size:"sm",onClick:v,disabled:!c.trim(),children:e.jsx(et,{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(Se,{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(Ea,{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(E,{children:"信任的代理 IP"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(le,{value:x,onChange:S=>h(S.target.value),onKeyDown:S=>{S.key==="Enter"&&(S.preventDefault(),w())},placeholder:"输入代理IP后按回车或点击添加"}),e.jsx(_,{type:"button",size:"sm",onClick:w,disabled:!x.trim(),children:e.jsx(et,{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(Se,{variant:"secondary",className:"flex items-center gap-1",children:[S,e.jsx("button",{type:"button",onClick:()=>b(P),className:"ml-1 hover:bg-destructive/20 rounded-full p-0.5",children:e.jsx(Ea,{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(Fe,{checked:n.trust_xff,onCheckedChange:S=>i({...n,trust_xff:S})}),e.jsx(E,{className:"cursor-pointer",children:"启用 X-Forwarded-For 代理解析"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Fe,{checked:n.secure_cookie,onCheckedChange:S=>i({...n,secure_cookie:S})}),e.jsx(E,{className:"cursor-pointer",children:"启用安全 Cookie(仅 HTTPS)"})]})]})]}),e.jsx(vs,{open:f,onOpenChange:p,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"警告:即将关闭 WebUI"}),e.jsxs(hs,{children:["关闭 WebUI 后,在您下次重启麦麦之前,WebUI 界面将无法访问。",e.jsx("br",{}),e.jsx("br",{}),"您需要通过修改配置文件或命令行重新启用 WebUI 才能再次访问此界面。",e.jsx("br",{}),e.jsx("br",{}),"确定要关闭 WebUI 吗?"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{variant:"destructive",onClick:D,children:"确认关闭"})]})]})})]})}),Nn="/api/webui/config";async function bg(){const n=await(await we(`${Nn}/bot`)).json();if(!n.success)throw new Error("获取配置数据失败");return n.config}async function un(){const n=await(await we(`${Nn}/model`)).json();if(!n.success)throw new Error("获取模型配置数据失败");return n.config}async function yg(l){const i=await(await we(`${Nn}/bot`,{method:"POST",body:JSON.stringify(l)})).json();if(!i.success)throw new Error(i.message||"保存配置失败")}async function D2(){const n=await(await we(`${Nn}/bot/raw`)).json();if(!n.success)throw new Error("获取配置源代码失败");return n.content}async function R2(l){const i=await(await we(`${Nn}/bot/raw`,{method:"POST",body:JSON.stringify({raw_content:l})})).json();if(!i.success)throw new Error(i.message||"保存配置失败")}async function Ji(l){const i=await(await we(`${Nn}/model`,{method:"POST",body:JSON.stringify(l)})).json();if(!i.success)throw new Error(i.message||"保存配置失败")}async function L2(l,n){const c=await(await we(`${Nn}/bot/section/${l}`,{method:"POST",body:JSON.stringify(n)})).json();if(!c.success)throw new Error(c.message||`保存配置节 ${l} 失败`)}async function Bm(l,n){const c=await(await we(`${Nn}/model/section/${l}`,{method:"POST",body:JSON.stringify(n)})).json();if(!c.success)throw new Error(c.message||`保存配置节 ${l} 失败`)}async function U2(l,n="openai",i="/models"){const c=new URLSearchParams({provider_name:l,parser:n,endpoint:i}),u=await we(`/api/webui/models/list?${c}`);if(!u.ok){const h=await u.json().catch(()=>({}));throw new Error(h.detail||`获取模型列表失败 (${u.status})`)}const x=await u.json();if(!x.success)throw new Error("获取模型列表失败");return x.models}async function $2(l){const n=new URLSearchParams({provider_name:l}),i=await we(`/api/webui/models/test-connection-by-name?${n}`,{method:"POST"});if(!i.ok){const c=await i.json().catch(()=>({}));throw new Error(c.detail||`测试连接失败 (${i.status})`)}return await i.json()}const B2=Kr("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"}}),at=d.forwardRef(({className:l,variant:n,...i},c)=>e.jsx("div",{ref:c,role:"alert",className:I(B2({variant:n}),l),...i}));at.displayName="Alert";const Hn=d.forwardRef(({className:l,...n},i)=>e.jsx("h5",{ref:i,className:I("mb-1 font-medium leading-none tracking-tight",l),...n}));Hn.displayName="AlertTitle";const lt=d.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:I("text-sm [&_p]:leading-relaxed",l),...n}));lt.displayName="AlertDescription";const I2={name:"toml",startState:function(){return{inString:!1,stringType:"",lhs:!0,inArray:0}},token:function(l,n){let i;if(!n.inString&&(i=l.match(/^('''|"""|'|")/))&&(n.stringType=i[0],n.inString=!0),l.sol()&&!n.inString&&n.inArray===0&&(n.lhs=!0),n.inString){for(;n.inString;)if(l.match(n.stringType))n.inString=!1;else if(l.peek()==="\\")l.next(),l.next();else{if(l.eol())break;l.match(/^.[^\\\"\']*/)}return n.lhs?"property":"string"}else{if(n.inArray&&l.peek()==="]")return l.next(),n.inArray--,"bracket";if(n.lhs&&l.peek()==="["&&l.skipTo("]"))return l.next(),l.peek()==="]"&&l.next(),"atom";if(l.peek()==="#")return l.skipToEnd(),"comment";if(l.eatSpace())return null;if(n.lhs&&l.eatWhile(function(c){return c!="="&&c!=" "}))return"property";if(n.lhs&&l.peek()==="=")return l.next(),n.lhs=!1,null;if(!n.lhs&&l.match(/^\d\d\d\d[\d\-\:\.T]*Z/))return"atom";if(!n.lhs&&(l.match("true")||l.match("false")))return"atom";if(!n.lhs&&l.peek()==="[")return n.inArray++,l.next(),"bracket";if(!n.lhs&&l.match(/^\-?\d+(?:\.\d+)?/))return"number";l.eatSpace()||l.next()}return null},languageData:{commentTokens:{line:"#"}}},P2={python:[C_()],json:[T_(),E_()],toml:[k_.define(I2)],text:[]};function gv({value:l,onChange:n,language:i="text",readOnly:c=!1,height:u="400px",minHeight:x,maxHeight:h,placeholder:f,theme:p="dark",className:g=""}){const[N,v]=d.useState(!1);if(d.useEffect(()=>{v(!0)},[]),!N)return e.jsx("div",{className:`rounded-md border bg-muted animate-pulse ${g}`,style:{height:u,minHeight:x,maxHeight:h}});const y=[...P2[i]||[],dg.lineWrapping];return c&&y.push(dg.editable.of(!1)),e.jsx("div",{className:`rounded-md overflow-hidden border ${g}`,children:e.jsx(M_,{value:l,height:u,minHeight:x,maxHeight:h,theme:p==="dark"?z_:void 0,extensions:y,onChange:n,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 H2({id:l,index:n,itemType:i,itemFields:c,value:u,onChange:x,onRemove:h,disabled:f,canRemove:p,placeholder:g}){const{attributes:N,listeners:v,setNodeRef:y,transform:w,transition:b,isDragging:R}=Wj({id:l,disabled:f}),D={transform:ev.Transform.toString(w),transition:b};return e.jsxs("div",{ref:y,style:D,className:I("flex items-start gap-2 group",R&&"opacity-50 z-50"),children:[e.jsx("button",{type:"button",className:I("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,...v,children:e.jsx(Rj,{className:"h-4 w-4"})}),e.jsx("div",{className:"flex-1 min-w-0",children:i==="object"&&c?e.jsx(F2,{value:u,onChange:x,fields:c,disabled:f}):i==="number"?e.jsx(le,{type:"number",value:u??"",onChange:S=>x(parseFloat(S.target.value)||0),placeholder:g??`第 ${n+1} 项`,disabled:f,className:"font-mono"}):e.jsx(le,{type:"text",value:u??"",onChange:S=>x(S.target.value),placeholder:g??`第 ${n+1} 项`,disabled:f})}),e.jsx(_,{type:"button",variant:"ghost",size:"icon",onClick:h,disabled:f||!p,className:I("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 F2({value:l,onChange:n,fields:i,disabled:c}){const u=d.useCallback((h,f)=>{n({...l,[h]:f})},[l,n]),x=(h,f)=>{const p=l?.[h];if(f.type==="boolean"||f.type==="switch")return e.jsxs("div",{className:"flex items-center justify-between py-1",children:[e.jsx(E,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsx(Fe,{checked:!!(p??f.default),onCheckedChange:g=>u(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(E,{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:N=>u(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(E,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsxs(Ie,{value:String(p??f.default??""),onValueChange:g=>u(h,g),disabled:c,children:[e.jsx($e,{className:"h-8 text-sm",children:e.jsx(Pe,{placeholder:f.placeholder??"请选择"})}),e.jsx(Be,{children:f.choices.map(g=>e.jsx(X,{value:String(g),children:String(g)},String(g)))})]})]}):f.type==="number"?e.jsxs("div",{className:"space-y-1",children:[e.jsx(E,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsx(le,{type:"number",value:p??f.default??"",onChange:g=>u(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(E,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsx(le,{type:"text",value:p??f.default??"",onChange:g=>u(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(i).map(([h,f])=>e.jsx("div",{children:x(h,f)},h))})}function G2({value:l,onChange:n,itemType:i="string",itemFields:c,minItems:u,maxItems:x,disabled:h,placeholder:f}){const p=d.useMemo(()=>Array.isArray(l)?l:typeof l=="string"&&l.trim()?l.split(",").map(M=>M.trim()):[],[l]),[g]=d.useState(()=>new Map),N=d.useCallback(M=>(g.has(M)||g.set(M,`item-${Date.now()}-${M}-${Math.random().toString(36).slice(2)}`),g.get(M)),[g]),v=d.useMemo(()=>{const M=[];for(let T=0;T{const{active:T,over:A}=M;if(A&&T.id!==A.id){const F=v.indexOf(T.id),L=v.indexOf(A.id),J=Yj(p,F,L);n(J)}},[p,v,n]),b=d.useCallback(()=>{if(x!=null&&p.length>=x)return;let M;i==="object"&&c?M=Object.fromEntries(Object.entries(c).map(([T,A])=>[T,A.default??""])):i==="number"?M=0:M="",n([...p,M])},[p,x,i,c,n]),R=d.useCallback((M,T)=>{const A=[...p];A[M]=T,n(A)},[p,n]),D=d.useCallback(M=>{if(u!=null&&p.length<=u)return;const T=p.filter((A,F)=>F!==M);g.delete(M),n(T)},[p,u,g,n]),S=x==null||p.lengthu;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(_t,{className:"h-4 w-4"}),e.jsx("span",{children:"暂无数据,点击下方按钮添加"})]}):e.jsx(Jj,{sensors:y,collisionDetection:Xj,onDragEnd:w,children:e.jsx(Zj,{items:v,strategy:A_,children:e.jsx("div",{className:"space-y-2",children:p.map((M,T)=>e.jsx(H2,{id:v[T],index:T,itemType:i,itemFields:c,value:M,onChange:A=>R(T,A),onRemove:()=>D(T),disabled:h,canRemove:P,placeholder:f},v[T]))})})}),e.jsxs(_,{type:"button",variant:"outline",size:"sm",onClick:b,disabled:h||!S,className:"w-full",children:[e.jsx(et,{className:"h-4 w-4 mr-1"}),"添加项目",x!==void 0&&e.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(",p.length,"/",x,")"]})]}),(u!=null||x!=null)&&(u!==null||x!==null)&&e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:u!=null&&x!=null?`允许 ${u} - ${x} 项`:u!=null?`至少 ${u} 项`:`最多 ${x} 项`})]})}function tx({content:l,className:n=""}){return e.jsx("div",{className:`prose prose-sm dark:prose-invert max-w-none ${n}`,children:e.jsx($_,{remarkPlugins:[I_,P_],rehypePlugins:[B_],components:{code({inline:i,className:c,children:u,...x}){return i?e.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-sm font-mono",...x,children:u}):e.jsx("code",{className:`${c} block bg-muted p-4 rounded-lg overflow-x-auto`,...x,children:u})},table({children:i,...c}){return e.jsx("div",{className:"overflow-x-auto",children:e.jsx("table",{className:"border-collapse border border-border",...c,children:i})})},th({children:i,...c}){return e.jsx("th",{className:"border border-border bg-muted px-4 py-2 text-left font-semibold",...c,children:i})},td({children:i,...c}){return e.jsx("td",{className:"border border-border px-4 py-2",...c,children:i})},a({children:i,...c}){return e.jsx("a",{className:"text-primary hover:underline",target:"_blank",rel:"noopener noreferrer",...c,children:i})},blockquote({children:i,...c}){return e.jsx("blockquote",{className:"border-l-4 border-primary pl-4 italic text-muted-foreground",...c,children:i})},h1({children:i,...c}){return e.jsx("h1",{className:"text-3xl font-bold mt-6 mb-4",...c,children:i})},h2({children:i,...c}){return e.jsx("h2",{className:"text-2xl font-bold mt-5 mb-3",...c,children:i})},h3({children:i,...c}){return e.jsx("h3",{className:"text-xl font-bold mt-4 mb-2",...c,children:i})},h4({children:i,...c}){return e.jsx("h4",{className:"text-lg font-semibold mt-3 mb-2",...c,children:i})},ul({children:i,...c}){return e.jsx("ul",{className:"list-disc list-inside space-y-1 my-2",...c,children:i})},ol({children:i,...c}){return e.jsx("ol",{className:"list-decimal list-inside space-y-1 my-2",...c,children:i})},p({children:i,...c}){return e.jsx("p",{className:"my-2 leading-relaxed",...c,children:i})},hr({...i}){return e.jsx("hr",{className:"my-4 border-border",...i})}},children:l})})}function V2(l,n,i,c={}){const{debounceMs:u=2e3,onSaveSuccess:x,onSaveError:h}=c,f=d.useRef(null),p=d.useCallback(async(y,w)=>{try{n(!0),await L2(y,w),i(!1),x?.()}catch(b){console.error(`自动保存 ${y} 失败:`,b),i(!0),h?.(b instanceof Error?b:new Error(String(b)))}finally{n(!1)}},[n,i,x,h]),g=d.useCallback((y,w)=>{l||(i(!0),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{p(y,w)},u))},[l,i,p,u]),N=d.useCallback(async(y,w)=>{f.current&&(clearTimeout(f.current),f.current=null),await p(y,w)},[p]),v=d.useCallback(()=>{f.current&&(clearTimeout(f.current),f.current=null)},[]);return d.useEffect(()=>()=>{f.current&&clearTimeout(f.current)},[]),{triggerAutoSave:g,saveNow:N,cancelPendingAutoSave:v}}function Lt(l,n,i,c){d.useEffect(()=>{l&&!i&&c(n,l)},[l])}const q2=500;function K2(){return e.jsx(Yn,{children:e.jsx(Q2,{})})}function Q2(){const[l,n]=d.useState(!0),[i,c]=d.useState(!1),[u,x]=d.useState(!1),[h,f]=d.useState(!1),[p,g]=d.useState("visual"),[N,v]=d.useState(""),[y,w]=d.useState(!1),{toast:b}=Zs(),{triggerRestart:R,isRestarting:D}=vn(),[S,P]=d.useState(null),[M,T]=d.useState(null),[A,F]=d.useState(null),[L,J]=d.useState(null),[U,ue]=d.useState(null),[xe,he]=d.useState(null),[ne,ve]=d.useState(null),[je,z]=d.useState(null),[V,B]=d.useState(null),[oe,K]=d.useState(null),[_e,pe]=d.useState(null),[ke,O]=d.useState(null),[k,H]=d.useState(null),[se,Ee]=d.useState(null),[Z,Oe]=d.useState(null),[ns,Q]=d.useState(null),[ee,Ue]=d.useState(null),[ie,Te]=d.useState(null),[de,Me]=d.useState(null),rs=d.useRef(!0),Ut=d.useRef({}),aa=d.useCallback(ze=>{Ut.current=ze,P(ze.bot),T(ze.personality);const Ns=ze.chat;Ns.talk_value_rules||(Ns.talk_value_rules=[]),F(Ns),J(ze.expression),ue(ze.emoji),he(ze.memory),ve(ze.tool),z(ze.voice),B(ze.dream),K(ze.lpmm_knowledge),pe(ze.keyword_reaction),O(ze.response_post_process),H(ze.chinese_typo),Ee(ze.response_splitter),Oe(ze.log),Q(ze.debug),Ue(ze.maim_message),Te(ze.telemetry),Me(ze.webui)},[]),Qa=d.useCallback(()=>({...Ut.current,bot:S,personality:M,chat:A,expression:L,emoji:U,memory:xe,tool:ne,voice:je,dream:V,lpmm_knowledge:oe,keyword_reaction:_e,response_post_process:ke,chinese_typo:k,response_splitter:se,log:Z,debug:ns,maim_message:ee,telemetry:ie,webui:de}),[S,M,A,L,U,xe,ne,je,V,oe,_e,ke,k,se,Z,ns,ee,ie,de]),Ft=d.useCallback(async()=>{try{const Ns=(await D2()).replace(/"([^"]*)"/g,(as,es)=>`"${es.replace(/\\n/g,` -`).replace(/\\t/g," ").replace(/\\r/g,"\r").replace(/\\"/g,'"').replace(/\\\\/g,"\\")}"`);v(Ns),w(!1)}catch(ze){b({variant:"destructive",title:"加载失败",description:ze instanceof Error?ze.message:"加载源代码失败"})}},[b]),mt=d.useCallback(async()=>{try{n(!0);const ze=await bg();aa(ze),f(!1),rs.current=!1,await Ft()}catch(ze){console.error("加载配置失败:",ze),b({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}finally{n(!1)}},[b,Ft,aa]);d.useEffect(()=>{mt()},[mt]);const{triggerAutoSave:q,cancelPendingAutoSave:Ve}=V2(rs.current,x,f);Lt(S,"bot",rs.current,q),Lt(M,"personality",rs.current,q),Lt(A,"chat",rs.current,q),Lt(L,"expression",rs.current,q),Lt(U,"emoji",rs.current,q),Lt(xe,"memory",rs.current,q),Lt(ne,"tool",rs.current,q),Lt(je,"voice",rs.current,q),Lt(V,"dream",rs.current,q),Lt(oe,"lpmm_knowledge",rs.current,q),Lt(_e,"keyword_reaction",rs.current,q),Lt(ke,"response_post_process",rs.current,q),Lt(k,"chinese_typo",rs.current,q),Lt(se,"response_splitter",rs.current,q),Lt(Z,"log",rs.current,q),Lt(ns,"debug",rs.current,q),Lt(ee,"maim_message",rs.current,q),Lt(ie,"telemetry",rs.current,q),Lt(de,"webui",rs.current,q);const Ke=async()=>{try{c(!0);const ze=N.replace(/"([^"]*)"/g,(Ns,as)=>`"${as.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r")}"`);await R2(ze),f(!1),w(!1),b({title:"保存成功",description:"配置已保存"}),await mt()}catch(ze){w(!0),b({variant:"destructive",title:"保存失败",description:ze instanceof Error?ze.message:"保存配置失败"})}finally{c(!1)}},We=async ze=>{if(h){b({variant:"destructive",title:"切换失败",description:"请先保存当前更改"});return}if(g(ze),ze==="source")await Ft();else try{const Ns=await bg();aa(Ns),f(!1)}catch(Ns){console.error("加载配置失败:",Ns),b({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}},Ls=async()=>{try{c(!0),Ve(),await yg(Qa()),f(!1),b({title:"保存成功",description:"麦麦主程序配置已保存"})}catch(ze){console.error("保存配置失败:",ze),b({title:"保存失败",description:ze.message,variant:"destructive"})}finally{c(!1)}},ts=async()=>{await R()},Cs=async()=>{try{c(!0),Ve(),await yg(Qa()),f(!1),b({title:"保存成功",description:"配置已保存,即将重启麦麦..."}),await new Promise(ze=>setTimeout(ze,q2)),await ts()}catch(ze){console.error("保存失败:",ze),b({title:"保存失败",description:ze.message,variant:"destructive"})}finally{c(!1)}};return l?e.jsx(Ye,{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(Ye,{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"?Ls:Ke,disabled:i||u||!h||D,size:"sm",variant:"outline",className:"w-20 sm:w-24",children:[e.jsx(oc,{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:i?"保存中":u?"自动":h?"保存":"已保存"})]}),e.jsxs(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{disabled:i||u||D,size:"sm",className:"w-20 sm:w-28",children:[e.jsx(cc,{className:"h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"ml-1 truncate text-xs sm:text-sm",children:D?"重启中":h?"保存重启":"重启"})]})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认重启麦麦?"}),e.jsx(hs,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:h?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})})})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:h?Cs:ts,children:h?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsx("div",{className:"flex",children:e.jsx(ta,{value:p,onValueChange:ze=>We(ze),className:"w-full",children:e.jsxs(Xt,{className:"h-8 sm:h-9 w-full grid grid-cols-2",children:[e.jsxs(Je,{value:"visual",className:"text-xs sm:text-sm",children:[e.jsx(Lj,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"可视化编辑"]}),e.jsxs(Je,{value:"source",className:"text-xs sm:text-sm",children:[e.jsx(Uj,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"源代码编辑"]})]})})})]}),e.jsxs(at,{children:[e.jsx(Ht,{className:"h-4 w-4"}),e.jsxs(lt,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),p==="source"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(at,{children:[e.jsx(Ht,{className:"h-4 w-4"}),e.jsxs(lt,{children:[e.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。此功能仅适用于熟悉 TOML 语法的高级用户。保存时会在后端验证格式,只有格式完全正确才能保存。",y&&e.jsx("span",{className:"text-destructive font-semibold ml-2",children:"⚠️ 上次保存失败,请检查 TOML 格式"})]})]}),e.jsx(gv,{value:N,onChange:ze=>{v(ze),f(!0),y&&w(!1)},language:"toml",theme:"dark",height:"calc(100vh - 280px)",minHeight:"500px",placeholder:"TOML 配置内容"})]}),p==="visual"&&e.jsx(e.Fragment,{children:e.jsxs(ta,{defaultValue:"bot",className:"w-full",children:[e.jsxs(Xt,{className:"flex flex-wrap h-auto gap-1 p-1 sm:grid sm:grid-cols-5 lg:grid-cols-10",children:[e.jsx(Je,{value:"bot",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"基本信息"}),e.jsx(Je,{value:"personality",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"人格"}),e.jsx(Je,{value:"chat",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"聊天"}),e.jsx(Je,{value:"expression",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"表达"}),e.jsx(Je,{value:"features",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"功能"}),e.jsx(Je,{value:"processing",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"处理"}),e.jsx(Je,{value:"dream",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"做梦"}),e.jsx(Je,{value:"lpmm",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"知识库"}),e.jsx(Je,{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(Je,{value:"other",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"其他"})]}),e.jsx(ys,{value:"bot",className:"space-y-4",children:S&&e.jsx(f2,{config:S,onChange:P})}),e.jsx(ys,{value:"personality",className:"space-y-4",children:M&&e.jsx(p2,{config:M,onChange:T})}),e.jsx(ys,{value:"chat",className:"space-y-4",children:A&&e.jsx(b2,{config:A,onChange:F})}),e.jsx(ys,{value:"expression",className:"space-y-4",children:L&&e.jsx(M2,{config:L,onChange:J})}),e.jsx(ys,{value:"features",className:"space-y-4",children:U&&xe&&ne&&je&&e.jsx(T2,{emojiConfig:U,memoryConfig:xe,toolConfig:ne,voiceConfig:je,onEmojiChange:ue,onMemoryChange:he,onToolChange:ve,onVoiceChange:z})}),e.jsx(ys,{value:"processing",className:"space-y-4",children:_e&&ke&&k&&se&&e.jsx(A2,{keywordReactionConfig:_e,responsePostProcessConfig:ke,chineseTypoConfig:k,responseSplitterConfig:se,onKeywordReactionChange:pe,onResponsePostProcessChange:O,onChineseTypoChange:H,onResponseSplitterChange:Ee})}),e.jsx(ys,{value:"dream",className:"space-y-4",children:V&&e.jsx(y2,{config:V,onChange:B})}),e.jsx(ys,{value:"lpmm",className:"space-y-4",children:oe&&e.jsx(w2,{config:oe,onChange:K})}),e.jsx(ys,{value:"webui",className:"space-y-4",children:de&&e.jsx(O2,{config:de,onChange:Me})}),e.jsxs(ys,{value:"other",className:"space-y-4",children:[Z&&e.jsx(_2,{config:Z,onChange:Oe}),ns&&e.jsx(S2,{config:ns,onChange:Q}),ee&&e.jsx(k2,{config:ee,onChange:Ue}),ie&&e.jsx(C2,{config:ie,onChange:Te})]})]})}),e.jsx(Jn,{})]})})}const Rl=d.forwardRef(({className:l,...n},i)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:i,className:I("w-full caption-bottom text-sm",l),...n})}));Rl.displayName="Table";const Ll=d.forwardRef(({className:l,...n},i)=>e.jsx("thead",{ref:i,className:I("[&_tr]:border-b",l),...n}));Ll.displayName="TableHeader";const Ul=d.forwardRef(({className:l,...n},i)=>e.jsx("tbody",{ref:i,className:I("[&_tr:last-child]:border-0",l),...n}));Ul.displayName="TableBody";const Y2=d.forwardRef(({className:l,...n},i)=>e.jsx("tfoot",{ref:i,className:I("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",l),...n}));Y2.displayName="TableFooter";const ut=d.forwardRef(({className:l,...n},i)=>e.jsx("tr",{ref:i,className:I("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",l),...n}));ut.displayName="TableRow";const Ze=d.forwardRef(({className:l,...n},i)=>e.jsx("th",{ref:i,className:I("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",l),...n}));Ze.displayName="TableHead";const qe=d.forwardRef(({className:l,...n},i)=>e.jsx("td",{ref:i,className:I("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",l),...n}));qe.displayName="TableCell";const J2=d.forwardRef(({className:l,...n},i)=>e.jsx("caption",{ref:i,className:I("mt-4 text-sm text-muted-foreground",l),...n}));J2.displayName="TableCaption";const sd=d.forwardRef(({className:l,...n},i)=>e.jsx(ga,{ref:i,className:I("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",l),...n}));sd.displayName=ga.displayName;const td=d.forwardRef(({className:l,...n},i)=>e.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[e.jsx(Tt,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(ga.Input,{ref:i,className:I("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",l),...n})]}));td.displayName=ga.Input.displayName;const ad=d.forwardRef(({className:l,...n},i)=>e.jsx(ga.List,{ref:i,className:I("max-h-[300px] overflow-y-auto overflow-x-hidden",l),...n}));ad.displayName=ga.List.displayName;const ld=d.forwardRef((l,n)=>e.jsx(ga.Empty,{ref:n,className:"py-6 text-center text-sm",...l}));ld.displayName=ga.Empty.displayName;const ac=d.forwardRef(({className:l,...n},i)=>e.jsx(ga.Group,{ref:i,className:I("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",l),...n}));ac.displayName=ga.Group.displayName;const X2=d.forwardRef(({className:l,...n},i)=>e.jsx(ga.Separator,{ref:i,className:I("-mx-1 h-px bg-border",l),...n}));X2.displayName=ga.Separator.displayName;const lc=d.forwardRef(({className:l,...n},i)=>e.jsx(ga.Item,{ref:i,className:I("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",l),...n}));lc.displayName=ga.Item.displayName;const jv=d.createContext(null),vv="maibot-completed-tours";function Z2(){try{const l=localStorage.getItem(vv);return l?new Set(JSON.parse(l)):new Set}catch{return new Set}}function wg(l){localStorage.setItem(vv,JSON.stringify([...l]))}function W2({children:l}){const[n,i]=d.useState({activeTourId:null,stepIndex:0,isRunning:!1}),[c]=d.useState(()=>new Map),[u,x]=d.useState(Z2),[,h]=d.useState(0),f=d.useCallback((M,T)=>{c.set(M,T),h(A=>A+1)},[c]),p=d.useCallback(M=>{c.delete(M),i(T=>T.activeTourId===M?{...T,activeTourId:null,isRunning:!1,stepIndex:0}:T)},[c]),g=d.useCallback((M,T=0)=>{c.has(M)&&i({activeTourId:M,stepIndex:T,isRunning:!0})},[c]),N=d.useCallback(()=>{i(M=>({...M,isRunning:!1}))},[]),v=d.useCallback(M=>{i(T=>({...T,stepIndex:M}))},[]),y=d.useCallback(()=>{i(M=>({...M,stepIndex:M.stepIndex+1}))},[]),w=d.useCallback(()=>{i(M=>({...M,stepIndex:Math.max(0,M.stepIndex-1)}))},[]),b=d.useCallback(()=>n.activeTourId?c.get(n.activeTourId)||[]:[],[n.activeTourId,c]),R=d.useCallback(M=>{x(T=>{const A=new Set(T);return A.add(M),wg(A),A})},[]),D=d.useCallback(M=>{const{action:T,index:A,status:F,type:L}=M,J=["finished","skipped"];if(T==="close"){i(U=>({...U,isRunning:!1,stepIndex:0}));return}J.includes(F)?i(U=>(F==="finished"&&U.activeTourId&&setTimeout(()=>R(U.activeTourId),0),{...U,isRunning:!1,stepIndex:0})):L==="step:after"&&(T==="next"?i(U=>({...U,stepIndex:A+1})):T==="prev"&&i(U=>({...U,stepIndex:A-1})))},[R]),S=d.useCallback(M=>u.has(M),[u]),P=d.useCallback(M=>{x(T=>{const A=new Set(T);return A.delete(M),wg(A),A})},[]);return e.jsx(jv.Provider,{value:{state:n,tours:c,registerTour:f,unregisterTour:p,startTour:g,stopTour:N,goToStep:v,nextStep:y,prevStep:w,getCurrentSteps:b,handleJoyrideCallback:D,isTourCompleted:S,markTourCompleted:R,resetTourCompleted:P},children:l})}function ax(){const l=d.useContext(jv);if(!l)throw new Error("useTour must be used within a TourProvider");return l}const eS={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)"}},sS={back:"上一步",close:"关闭",last:"完成",next:"下一步",nextLabelWithProgress:"下一步 ({step}/{steps})",open:"打开对话框",skip:"跳过"};function tS(){const{state:l,getCurrentSteps:n,handleJoyrideCallback:i}=ax(),c=n(),[u,x]=d.useState(!1),h=d.useRef(l.stepIndex),f=d.useRef(null);d.useEffect(()=>{h.current!==l.stepIndex&&(x(!1),h.current=l.stepIndex)},[l.stepIndex]),d.useEffect(()=>{if(!l.isRunning||c.length===0){x(!1);return}const v=c[l.stepIndex];if(!v){x(!1);return}const y=v.target;if(y==="body"){x(!0);return}x(!1);const w=setTimeout(()=>{const b=()=>{const P=document.querySelector(y);if(P){const M=P.getBoundingClientRect();if(M.width>0&&M.height>0)return!0}return!1};if(b()){setTimeout(()=>x(!0),100);return}const R=setInterval(()=>{b()&&(clearInterval(R),setTimeout(()=>x(!0),100))},100),D=setTimeout(()=>{clearInterval(R),x(!0)},5e3),S=()=>{clearInterval(R),clearTimeout(D)};f.current=S},150);return()=>{clearTimeout(w),f.current&&(f.current(),f.current=null)}},[l.isRunning,l.stepIndex,c]);const[p,g]=d.useState(null);if(d.useEffect(()=>{let v=document.getElementById("tour-portal-container");return v||(v=document.createElement("div"),v.id="tour-portal-container",v.style.cssText="position: fixed; top: 0; left: 0; z-index: 99999; pointer-events: none;",document.body.appendChild(v)),g(v),()=>{}},[]),!l.isRunning||c.length===0||!u)return null;const N=e.jsx(D_,{steps:c,stepIndex:l.stepIndex,run:l.isRunning,continuous:!0,showSkipButton:!0,showProgress:!0,disableOverlayClose:!0,disableScrolling:!1,disableScrollParentFix:!1,callback:i,styles:eS,locale:sS,scrollOffset:80,scrollToFirstStep:!0,floaterProps:{styles:{floater:{zIndex:99999}},disableAnimation:!0}},`tour-step-${l.stepIndex}`);return p?v0.createPortal(N,p):N}const il="model-assignment-tour",Nv=[{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}],bv={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"},Vi=[{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 _g(l){return l?l.replace(/\/+$/,"").toLowerCase():""}function aS(l){if(!l)return null;const n=_g(l);return Vi.find(i=>i.id!=="custom"&&_g(i.base_url)===n)||null}const Co=l=>({...l,max_retry:l.max_retry??2,timeout:l.timeout??30,retry_interval:l.retry_interval??10}),lS=(l,n=[],i=null)=>{const c={};return l?(l.name?.trim()?n.some((x,h)=>i!==null&&h===i?!1:x.name.trim().toLowerCase()===l.name.trim().toLowerCase())&&(c.name="提供商名称已存在,请使用其他名称"):c.name="请输入提供商名称",l.base_url?.trim()||(c.base_url="请输入基础 URL"),l.api_key?.trim()||(c.api_key="请输入 API Key"),{isValid:Object.keys(c).length===0,errors:c}):{isValid:!1,errors:{name:"提供商数据为空"}}};function nS(){return e.jsx(Yn,{children:e.jsx(rS,{})})}function rS(){const[l,n]=d.useState([]),[i,c]=d.useState(!0),[u,x]=d.useState(!1),[h,f]=d.useState(!1),[p,g]=d.useState(!1),[N,v]=d.useState(!1),[y,w]=d.useState(null),[b,R]=d.useState(null),[D,S]=d.useState("custom"),[P,M]=d.useState(!1),[T,A]=d.useState(!1),[F,L]=d.useState(null),[J,U]=d.useState(!1),[ue,xe]=d.useState(""),[he,ne]=d.useState(new Set),[ve,je]=d.useState(!1),[z,V]=d.useState(1),[B,oe]=d.useState(20),[K,_e]=d.useState(""),[pe,ke]=d.useState({isOpen:!1,providersToDelete:[],affectedModels:[],pendingProviders:[],context:"auto",oldProviders:[]}),[O,k]=d.useState({}),[H,se]=d.useState(new Set),[Ee,Z]=d.useState(new Map),{toast:Oe}=Zs(),ns=ca(),{state:Q,goToStep:ee,registerTour:Ue}=ax(),{triggerRestart:ie,isRestarting:Te}=vn(),de=d.useRef(null),Me=d.useRef(!0);d.useEffect(()=>{Ue(il,Nv)},[Ue]),d.useEffect(()=>{if(Q.activeTourId===il&&Q.isRunning){const W=bv[Q.stepIndex];W&&!window.location.pathname.endsWith(W.replace("/config/",""))&&ns({to:W})}},[Q.stepIndex,Q.activeTourId,Q.isRunning,ns]);const rs=d.useRef(Q.stepIndex);d.useEffect(()=>{if(Q.activeTourId===il&&Q.isRunning){const W=rs.current,ye=Q.stepIndex;W>=3&&W<=9&&ye<3&&v(!1),W>=10&&ye>=3&&ye<=9&&(k({}),S("custom"),w({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10}),R(null),U(!1),v(!0)),rs.current=ye}},[Q.stepIndex,Q.activeTourId,Q.isRunning]),d.useEffect(()=>{if(Q.activeTourId!==il||!Q.isRunning)return;const W=ye=>{const Re=ye.target,Hs=Q.stepIndex;Hs===2&&Re.closest('[data-tour="add-provider-button"]')?setTimeout(()=>ee(3),300):Hs===9&&Re.closest('[data-tour="provider-cancel-button"]')&&setTimeout(()=>ee(10),300)};return document.addEventListener("click",W,!0),()=>document.removeEventListener("click",W,!0)},[Q,ee]),d.useEffect(()=>{Ut()},[]);const Ut=async()=>{try{c(!0);const W=await un();n(W.api_providers||[]),g(!1),Me.current=!1}catch(W){console.error("加载配置失败:",W)}finally{c(!1)}},aa=async()=>{await ie()},Qa=async()=>{try{x(!0),de.current&&clearTimeout(de.current);const W=l.map(rt=>({...rt,max_retry:rt.max_retry??2,timeout:rt.timeout??30,retry_interval:rt.retry_interval??10})),{shouldProceed:ye}=await Ft(W,"restart");if(!ye){x(!1);return}const Re=await un(),Hs=new Set(W.map(rt=>rt.name)),Wt=(Re.models||[]).filter(rt=>Hs.has(rt.api_provider));Re.api_providers=W,Re.models=Wt,await Ji(Re),g(!1),Oe({title:"保存成功",description:"正在重启麦麦..."}),await aa()}catch(W){console.error("保存配置失败:",W),Oe({title:"保存失败",description:W.message,variant:"destructive"}),x(!1)}},Ft=d.useCallback(async(W,ye="auto")=>{try{const Re=await un(),Hs=new Set(l.map(xt=>xt.name)),Dt=new Set(W.map(xt=>xt.name)),Wt=Array.from(Hs).filter(xt=>!Dt.has(xt));if(Wt.length===0)return{shouldProceed:!0,providers:W};const ea=(Re.models||[]).filter(xt=>Wt.includes(xt.api_provider));return ea.length===0?{shouldProceed:!0,providers:W}:(ke({isOpen:!0,providersToDelete:Wt,affectedModels:ea,pendingProviders:W,context:ye,oldProviders:[...l]}),{shouldProceed:!1,providers:W})}catch(Re){return console.error("检查删除影响失败:",Re),{shouldProceed:!0,providers:W}}},[l]),mt=async()=>{try{(pe.context==="auto"?f:x)(!0),ke(xt=>({...xt,isOpen:!1}));const ye=await un(),Re=pe.pendingProviders.map(Co),Hs=new Set(Re.map(xt=>xt.name)),Wt=(ye.models||[]).filter(xt=>Hs.has(xt.api_provider)),rt=new Set(pe.affectedModels.map(xt=>xt.name)),ea=ye.model_task_config;ea&&Object.keys(ea).forEach(xt=>{const re=ea[xt];re&&Array.isArray(re.model_list)&&(re.model_list=re.model_list.filter(fe=>!rt.has(fe)))}),ye.api_providers=Re,ye.models=Wt,ye.model_task_config=ea,await Ji(ye),n(pe.pendingProviders),g(!1),Oe({title:"删除成功",description:`已删除 ${pe.providersToDelete.length} 个提供商和 ${pe.affectedModels.length} 个关联模型`}),ke({isOpen:!1,providersToDelete:[],affectedModels:[],pendingProviders:[],context:"auto",oldProviders:[]}),ne(new Set),pe.context==="restart"&&await aa()}catch(W){console.error("删除失败:",W),Oe({title:"删除失败",description:W.message,variant:"destructive"})}finally{pe.context==="auto"?f(!1):x(!1)}},q=()=>{pe.oldProviders.length>0&&n(pe.oldProviders),ke({isOpen:!1,providersToDelete:[],affectedModels:[],pendingProviders:[],context:"auto",oldProviders:[]}),g(!1)},Ve=d.useCallback(async W=>{if(Me.current)return;const{shouldProceed:ye}=await Ft(W,"auto");if(!ye){g(!0);return}try{f(!0);const Re=W.map(Co);await Bm("api_providers",Re),g(!1)}catch(Re){console.error("自动保存失败:",Re),Oe({title:"自动保存失败",description:Re.message,variant:"destructive"}),g(!0)}finally{f(!1)}},[l,Ft]);d.useEffect(()=>{if(!Me.current)return g(!0),de.current&&clearTimeout(de.current),de.current=setTimeout(()=>{Ve(l)},2e3),()=>{de.current&&clearTimeout(de.current)}},[l,Ve]);const Ke=async()=>{try{x(!0),de.current&&clearTimeout(de.current);const W=l.map(Co),{shouldProceed:ye}=await Ft(W,"manual");if(!ye){x(!1);return}const Re=await un(),Hs=new Set(W.map(rt=>rt.name)),Dt=Re.models||[],Wt=Dt.filter(rt=>{const ea=Hs.has(rt.api_provider);return ea||console.warn(`模型 "${rt.name}" 引用了已删除的提供商 "${rt.api_provider}",将被移除`),ea});if(Dt.length!==Wt.length){const rt=Dt.length-Wt.length;Oe({title:"注意",description:`已自动移除 ${rt} 个引用已删除提供商的模型`,variant:"default"})}console.log("发送的 providers 数据:",W),Re.api_providers=W,Re.models=Wt,console.log("完整配置数据:",Re),await Ji(Re),g(!1),Oe({title:"保存成功",description:"模型提供商配置已保存"})}catch(W){console.error("保存配置失败:",W),Oe({title:"保存失败",description:W.message,variant:"destructive"})}finally{x(!1)}},We=(W,ye)=>{if(k({}),W){const Re=Vi.find(Hs=>Hs.base_url===W.base_url&&Hs.client_type===W.client_type);S(Re?.id||"custom"),w(W)}else S("custom"),w({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10});R(ye),U(!1),v(!0)},Ls=d.useCallback(W=>{S(W),M(!1);const ye=Vi.find(Re=>Re.id===W);ye&&ye.id!=="custom"?w(Re=>({...Re,name:ye.name,base_url:ye.base_url,client_type:ye.client_type})):ye?.id==="custom"&&w(Re=>({...Re,name:"",base_url:"",client_type:"openai"}))},[]),ts=d.useMemo(()=>D!=="custom",[D]),Cs=d.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]),ze=()=>{if(!y)return;const{isValid:W,errors:ye}=lS(y,l,b);if(!W){k(ye);return}k({});const Re=Co(y);if(b!==null){const Hs=[...l];Hs[b]=Re,n(Hs)}else n([...l,Re]);v(!1),w(null),R(null)},Ns=W=>{if(!W&&y){const ye={...y,max_retry:y.max_retry??2,timeout:y.timeout??30,retry_interval:y.retry_interval??10};w(ye)}v(W)},as=W=>{L(W),A(!0)},es=async()=>{if(F!==null){const W=l.filter((Re,Hs)=>Hs!==F),{shouldProceed:ye}=await Ft(W,"manual");ye&&(n(W),Oe({title:"删除成功",description:"提供商已从列表中移除"}))}A(!1),L(null)},bs=W=>{const ye=new Set(he);ye.has(W)?ye.delete(W):ye.add(W),ne(ye)},gt=()=>{if(he.size===Ms.length)ne(new Set);else{const W=Ms.map((ye,Re)=>l.findIndex(Hs=>Hs===Ms[Re]));ne(new Set(W))}},$t=()=>{if(he.size===0){Oe({title:"提示",description:"请先选择要删除的提供商",variant:"default"});return}je(!0)},tt=async()=>{const W=l.filter((Re,Hs)=>!he.has(Hs)),{shouldProceed:ye}=await Ft(W,"manual");ye&&(n(W),ne(new Set),Oe({title:"批量删除成功",description:`已删除 ${he.size} 个提供商`})),je(!1)},Ms=d.useMemo(()=>{if(!ue)return l;const W=ue.toLowerCase();return l.filter(ye=>ye.name.toLowerCase().includes(W)||ye.base_url.toLowerCase().includes(W)||ye.client_type.toLowerCase().includes(W))},[l,ue]),{totalPages:Et,paginatedProviders:Bt}=d.useMemo(()=>{const W=Math.ceil(Ms.length/B),ye=Ms.slice((z-1)*B,z*B);return{totalPages:W,paginatedProviders:ye}},[Ms,z,B]),Oa=d.useCallback(()=>{const W=parseInt(K);W>=1&&W<=Et&&(V(W),_e(""))},[K,Et]),tl=async W=>{se(ye=>new Set(ye).add(W));try{const ye=await $2(W);Z(Re=>new Map(Re).set(W,ye)),ye.network_ok?ye.api_key_valid===!0?Oe({title:"连接正常",description:`${W} 网络连接正常,API Key 有效 (${ye.latency_ms}ms)`}):ye.api_key_valid===!1?Oe({title:"连接正常但 Key 无效",description:`${W} 网络连接正常,但 API Key 无效或已过期`,variant:"destructive"}):Oe({title:"网络连接正常",description:`${W} 可以访问 (${ye.latency_ms}ms)`}):Oe({title:"连接失败",description:ye.error||"无法连接到提供商",variant:"destructive"})}catch(ye){Oe({title:"测试失败",description:ye.message,variant:"destructive"})}finally{se(ye=>{const Re=new Set(ye);return Re.delete(W),Re})}},ul=async()=>{for(const W of l)await tl(W.name)},Xn=W=>{const ye=H.has(W),Re=Ee.get(W);return ye?e.jsxs(Se,{variant:"secondary",className:"gap-1",children:[e.jsx(Bs,{className:"h-3 w-3 animate-spin"}),"测试中"]}):Re?Re.network_ok?Re.api_key_valid===!0?e.jsxs(Se,{className:"gap-1 bg-green-600 hover:bg-green-700",children:[e.jsx(pt,{className:"h-3 w-3"}),"正常"]}):Re.api_key_valid===!1?e.jsxs(Se,{variant:"destructive",className:"gap-1",children:[e.jsx(_t,{className:"h-3 w-3"}),"Key无效"]}):e.jsxs(Se,{className:"gap-1 bg-blue-600 hover:bg-blue-700",children:[e.jsx(pt,{className:"h-3 w-3"}),"可访问"]}):e.jsxs(Se,{variant:"destructive",className:"gap-1",children:[e.jsx(Va,{className:"h-3 w-3"}),"离线"]}):null};return i?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:[he.size>0&&e.jsxs(_,{onClick:$t,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"}),"批量删除 (",he.size,")"]}),e.jsxs(_,{onClick:ul,size:"sm",variant:"outline",className:"w-full sm:w-auto",disabled:l.length===0||H.size>0,children:[e.jsx(Za,{className:"mr-2 h-4 w-4"}),H.size>0?`测试中 (${H.size})`:"测试全部"]}),e.jsxs(_,{onClick:()=>We(null,null),size:"sm",className:"w-full sm:w-auto","data-tour":"add-provider-button",children:[e.jsx(et,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加提供商"]}),e.jsxs(_,{onClick:Ke,disabled:u||h||!p||Te,size:"sm",variant:"outline",className:"w-full sm:w-auto sm:min-w-[120px]",children:[e.jsx(oc,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),u?"保存中...":h?"自动保存中...":p?"保存配置":"已保存"]}),e.jsxs(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{disabled:u||h||Te,size:"sm",className:"w-full sm:w-auto sm:min-w-[120px]",children:[e.jsx(cc,{className:"mr-2 h-4 w-4"}),Te?"重启中...":p?"保存并重启":"重启麦麦"]})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认重启麦麦?"}),e.jsx(hs,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:p?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})})})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:p?Qa:aa,children:p?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsxs(at,{children:[e.jsx(Ht,{className:"h-4 w-4"}),e.jsxs(lt,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),e.jsxs(Ye,{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(Tt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(le,{placeholder:"搜索提供商名称、URL 或类型...",value:ue,onChange:W=>xe(W.target.value),className:"pl-9"})]}),ue&&e.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",Ms.length," 个结果"]})]}),e.jsx("div",{className:"md:hidden space-y-3",children:Ms.length===0?e.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:ue?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'}):Bt.map((W,ye)=>{const Re=l.findIndex(Hs=>Hs===W);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:W.name}),Xn(W.name)]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:W.base_url})]}),e.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>tl(W.name),disabled:H.has(W.name),title:"测试连接",children:H.has(W.name)?e.jsx(Bs,{className:"h-4 w-4 animate-spin"}):e.jsx(Za,{className:"h-4 w-4"})}),e.jsx(_,{variant:"default",size:"sm",onClick:()=>We(W,Re),children:e.jsx(Fn,{className:"h-4 w-4",strokeWidth:2,fill:"none"})}),e.jsx(_,{size:"sm",onClick:()=>as(Re),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:W.client_type})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"最大重试"}),e.jsx("p",{className:"font-medium",children:W.max_retry})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"超时(秒)"}),e.jsx("p",{className:"font-medium",children:W.timeout})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"重试间隔(秒)"}),e.jsx("p",{className:"font-medium",children:W.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(Rl,{children:[e.jsx(Ll,{children:e.jsxs(ut,{children:[e.jsx(Ze,{className:"w-12",children:e.jsx(qs,{checked:he.size===Ms.length&&Ms.length>0,onCheckedChange:gt})}),e.jsx(Ze,{children:"状态"}),e.jsx(Ze,{children:"名称"}),e.jsx(Ze,{children:"基础URL"}),e.jsx(Ze,{children:"客户端类型"}),e.jsx(Ze,{className:"text-right",children:"最大重试"}),e.jsx(Ze,{className:"text-right",children:"超时(秒)"}),e.jsx(Ze,{className:"text-right",children:"重试间隔(秒)"}),e.jsx(Ze,{className:"text-right",children:"操作"})]})}),e.jsx(Ul,{children:Bt.length===0?e.jsx(ut,{children:e.jsx(qe,{colSpan:9,className:"text-center text-muted-foreground py-8",children:ue?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'})}):Bt.map((W,ye)=>{const Re=l.findIndex(Hs=>Hs===W);return e.jsxs(ut,{children:[e.jsx(qe,{children:e.jsx(qs,{checked:he.has(Re),onCheckedChange:()=>bs(Re)})}),e.jsx(qe,{children:Xn(W.name)||e.jsx(Se,{variant:"outline",className:"text-muted-foreground",children:"未测试"})}),e.jsx(qe,{className:"font-medium",children:W.name}),e.jsx(qe,{className:"max-w-xs truncate",title:W.base_url,children:W.base_url}),e.jsx(qe,{children:W.client_type}),e.jsx(qe,{className:"text-right",children:W.max_retry}),e.jsx(qe,{className:"text-right",children:W.timeout}),e.jsx(qe,{className:"text-right",children:W.retry_interval}),e.jsx(qe,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>tl(W.name),disabled:H.has(W.name),title:"测试连接",children:H.has(W.name)?e.jsx(Bs,{className:"h-4 w-4 animate-spin"}):e.jsx(Za,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"default",size:"sm",onClick:()=>We(W,Re),children:[e.jsx(Fn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(_,{size:"sm",onClick:()=>as(Re),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"}),"删除"]})]})})]},ye)})})]})})}),Ms.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(E,{htmlFor:"page-size-provider",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Ie,{value:B.toString(),onValueChange:W=>{oe(parseInt(W)),V(1),ne(new Set)},children:[e.jsx($e,{id:"page-size-provider",className:"w-20",children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(X,{value:"10",children:"10"}),e.jsx(X,{value:"20",children:"20"}),e.jsx(X,{value:"50",children:"50"}),e.jsx(X,{value:"100",children:"100"})]})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(z-1)*B+1," 到"," ",Math.min(z*B,Ms.length)," 条,共 ",Ms.length," 条"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>V(1),disabled:z===1,className:"hidden sm:flex",children:e.jsx(gn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>V(W=>Math.max(1,W-1)),disabled:z===1,children:[e.jsx(Aa,{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(le,{type:"number",value:K,onChange:W=>_e(W.target.value),onKeyDown:W=>W.key==="Enter"&&Oa(),placeholder:z.toString(),className:"w-16 h-8 text-center",min:1,max:Et}),e.jsx(_,{variant:"outline",size:"sm",onClick:Oa,disabled:!K,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>V(W=>W+1),disabled:z>=Et,children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Zt,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>V(Et),disabled:z>=Et,className:"hidden sm:flex",children:e.jsx(jn,{className:"h-4 w-4"})})]})]})]}),e.jsx(Is,{open:N,onOpenChange:Ns,children:e.jsxs(Os,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto","data-tour":"provider-dialog",preventOutsideClose:Q.isRunning,children:[e.jsxs(Ds,{children:[e.jsx(Rs,{children:b!==null?"编辑提供商":"添加提供商"}),e.jsx(Ks,{children:"配置 API 提供商的连接信息和参数"})]}),e.jsxs("form",{onSubmit:W=>{W.preventDefault(),ze()},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(E,{htmlFor:"template",children:"提供商模板"}),e.jsxs(ol,{open:P,onOpenChange:M,children:[e.jsx(dl,{asChild:!0,children:e.jsxs(_,{variant:"outline",role:"combobox","aria-expanded":P,className:"w-full justify-between",children:[D?Vi.find(W=>W.id===D)?.display_name:"选择提供商模板...",e.jsx(Ym,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(Wa,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:e.jsxs(sd,{children:[e.jsx(td,{placeholder:"搜索提供商模板..."}),e.jsx(Ye,{className:"h-[300px]",children:e.jsxs(ad,{className:"max-h-none overflow-visible",children:[e.jsx(ld,{children:"未找到匹配的模板"}),e.jsx(ac,{children:Vi.map(W=>e.jsxs(lc,{value:W.display_name,onSelect:()=>Ls(W.id),children:[e.jsx(Ct,{className:`mr-2 h-4 w-4 ${D===W.id?"opacity-100":"opacity-0"}`}),W.display_name]},W.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(E,{htmlFor:"name",className:O.name?"text-destructive":"",children:"名称 *"}),e.jsx(le,{id:"name",value:y?.name||"",onChange:W=>{w(ye=>ye?{...ye,name:W.target.value}:null),O.name&&k(ye=>({...ye,name:void 0}))},placeholder:"例如: DeepSeek, SiliconFlow",className:O.name?"border-destructive focus-visible:ring-destructive":""}),O.name&&e.jsx("p",{className:"text-xs text-destructive",children:O.name})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-url-input",children:[e.jsx(E,{htmlFor:"base_url",className:O.base_url?"text-destructive":"",children:"基础 URL *"}),e.jsx(le,{id:"base_url",value:y?.base_url||"",onChange:W=>{w(ye=>ye?{...ye,base_url:W.target.value}:null),O.base_url&&k(ye=>({...ye,base_url:void 0}))},placeholder:"https://api.example.com/v1",disabled:ts,className:`${ts?"bg-muted cursor-not-allowed":""} ${O.base_url?"border-destructive focus-visible:ring-destructive":""}`}),O.base_url&&e.jsx("p",{className:"text-xs text-destructive",children:O.base_url}),ts&&!O.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(E,{htmlFor:"api_key",className:O.api_key?"text-destructive":"",children:"API Key *"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(le,{id:"api_key",type:J?"text":"password",value:y?.api_key||"",onChange:W=>{w(ye=>ye?{...ye,api_key:W.target.value}:null),O.api_key&&k(ye=>({...ye,api_key:void 0}))},placeholder:"sk-...",className:`flex-1 ${O.api_key?"border-destructive focus-visible:ring-destructive":""}`}),e.jsx(_,{type:"button",variant:"outline",size:"icon",onClick:()=>U(!J),title:J?"隐藏密钥":"显示密钥",children:J?e.jsx(Wi,{className:"h-4 w-4"}):e.jsx(ia,{className:"h-4 w-4"})}),e.jsx(_,{type:"button",variant:"outline",size:"icon",onClick:Cs,title:"复制密钥",children:e.jsx(Ro,{className:"h-4 w-4"})})]}),O.api_key&&e.jsx("p",{className:"text-xs text-destructive",children:O.api_key})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"client_type",children:"客户端类型"}),e.jsxs(Ie,{value:y?.client_type||"openai",onValueChange:W=>w(ye=>ye?{...ye,client_type:W}:null),disabled:ts,children:[e.jsx($e,{id:"client_type",className:ts?"bg-muted cursor-not-allowed":"",children:e.jsx(Pe,{placeholder:"选择客户端类型"})}),e.jsxs(Be,{children:[e.jsx(X,{value:"openai",children:"OpenAI"}),e.jsx(X,{value:"gemini",children:"Gemini"})]})]}),ts&&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(E,{htmlFor:"max_retry",children:"最大重试"}),e.jsx(le,{id:"max_retry",type:"number",min:"0",value:y?.max_retry??"",onChange:W=>{const ye=W.target.value===""?null:parseInt(W.target.value);w(Re=>Re?{...Re,max_retry:ye}:null)},placeholder:"默认: 2"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"timeout",children:"超时(秒)"}),e.jsx(le,{id:"timeout",type:"number",min:"1",value:y?.timeout??"",onChange:W=>{const ye=W.target.value===""?null:parseInt(W.target.value);w(Re=>Re?{...Re,timeout:ye}:null)},placeholder:"默认: 30"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"retry_interval",children:"重试间隔(秒)"}),e.jsx(le,{id:"retry_interval",type:"number",min:"1",value:y?.retry_interval??"",onChange:W=>{const ye=W.target.value===""?null:parseInt(W.target.value);w(Re=>Re?{...Re,retry_interval:ye}:null)},placeholder:"默认: 10"})]})]})]}),e.jsxs(st,{children:[e.jsx(_,{type:"button",variant:"outline",onClick:()=>v(!1),"data-tour":"provider-cancel-button",children:"取消"}),e.jsx(_,{type:"submit","data-tour":"provider-save-button",children:"保存"})]})]})]})}),e.jsx(vs,{open:T,onOpenChange:A,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:['确定要删除提供商 "',F!==null?l[F]?.name:"",'" 吗? 此操作无法撤销。']})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:es,children:"删除"})]})]})}),e.jsx(vs,{open:ve,onOpenChange:je,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认批量删除"}),e.jsxs(hs,{children:["确定要删除选中的 ",he.size," 个提供商吗? 此操作无法撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:tt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),e.jsx(vs,{open:pe.isOpen,onOpenChange:W=>ke(ye=>({...ye,isOpen:W})),children:e.jsxs(ds,{className:"max-w-2xl",children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除提供商"}),e.jsx(hs,{asChild:!0,children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:["您即将删除以下提供商:",e.jsx("strong",{className:"text-foreground ml-1",children:pe.providersToDelete.join(", ")})]}),e.jsxs("p",{className:"text-yellow-600 dark:text-yellow-500 font-medium",children:["⚠️ 此操作将同时删除 ",pe.affectedModels.length," 个关联的模型:"]}),e.jsx(Ye,{className:"h-32 w-full rounded border p-3",children:e.jsx("div",{className:"space-y-1",children:pe.affectedModels.map((W,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:W.name}),e.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(",W.model_identifier,")"]})]},ye))})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"这些模型将从模型列表和所有任务分配中移除。此操作无法撤销。"})]})})]}),e.jsxs(ms,{children:[e.jsx(ps,{onClick:q,children:"取消"}),e.jsx(fs,{onClick:mt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})}),e.jsx(Jn,{})]})}function Xi(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).substring(2,11)}`}function Tm(l){return l===null?"null":Array.isArray(l)?"array":typeof l=="object"?"object":typeof l=="boolean"?"boolean":typeof l=="number"?"number":"string"}function Im(l){return Object.entries(l).map(([n,i])=>{const c=Tm(i),u={id:Xi(),key:n,value:i,type:c,expanded:!0};return c==="object"&&i&&typeof i=="object"?u.children=Im(i):c==="array"&&Array.isArray(i)&&(u.children=i.map((x,h)=>{const f=Tm(x),p={id:Xi(),key:String(h),value:x,type:f,expanded:!0};return f==="object"&&x&&typeof x=="object"?p.children=Im(x):f==="array"&&Array.isArray(x)&&(p.children=x.map((g,N)=>({id:Xi(),key:String(N),value:g,type:Tm(g),expanded:!0}))),p})),u})}function Pm(l){const n={};for(const i of l)i.key.trim()&&(i.type==="object"&&i.children?n[i.key]=Pm(i.children):i.type==="array"&&i.children?n[i.key]=i.children.map(c=>c.type==="object"&&c.children?Pm(c.children):c.type==="array"&&c.children?c.children.map(u=>u.value):c.value):i.type==="null"?n[i.key]=null:n[i.key]=i.value);return n}function Sg(l,n){switch(n){case"boolean":return l==="true";case"number":{const i=parseFloat(l);return isNaN(i)?0:i}case"null":return null;default:return l}}function yv({node:l,level:n,onUpdate:i,onRemove:c,onAddChild:u,onToggleExpand:x}){const h=l.type==="object"||l.type==="array",f=l.children&&l.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:`${n*20}px`},children:[e.jsx(_,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>x(l.id),disabled:!h||!f,children:h&&f?l.expanded?e.jsx(za,{className:"h-4 w-4"}):e.jsx(Zt,{className:"h-4 w-4"}):e.jsx("span",{className:"w-4"})}),e.jsx(le,{value:l.key,onChange:p=>i(l.id,"key",p.target.value),placeholder:"key",className:"h-8 text-sm"}),!h&&e.jsx(e.Fragment,{children:l.type==="boolean"?e.jsxs("div",{className:"flex items-center h-8 px-3 border rounded-md bg-background",children:[e.jsx(Fe,{checked:l.value===!0,onCheckedChange:p=>i(l.id,"value",p)}),e.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:l.value?"true":"false"})]}):l.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(le,{type:l.type==="number"?"number":"text",value:l.value,onChange:p=>i(l.id,"value",p.target.value),placeholder:"value",className:"h-8 text-sm",step:l.type==="number"?"any":void 0})}),e.jsxs(Ie,{value:l.type,onValueChange:p=>i(l.id,"type",p),children:[e.jsx($e,{className:"h-8 text-xs",children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(X,{value:"string",children:"字符串"}),e.jsx(X,{value:"number",children:"数字"}),e.jsx(X,{value:"boolean",children:"布尔"}),e.jsx(X,{value:"null",children:"Null"}),e.jsx(X,{value:"object",children:"对象"}),e.jsx(X,{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:()=>u(l.id),title:"添加子项",children:e.jsx(et,{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(l.id),title:"删除",children:e.jsx(ls,{className:"h-4 w-4"})})]})]}),h&&l.expanded&&l.children&&l.children.length>0&&e.jsx("div",{className:"space-y-1",children:l.children.map(p=>e.jsx(yv,{node:p,level:n+1,onUpdate:i,onRemove:c,onAddChild:u,onToggleExpand:x},p.id))})]})}function iS({value:l,onChange:n,placeholder:i="添加参数..."}){const[c,u]=d.useState(()=>Im(l||{})),x=d.useCallback(v=>{u(v),n(Pm(v))},[n]),h=d.useCallback(()=>{const v={id:Xi(),key:"",value:"",type:"string",expanded:!1};x([...c,v])},[c,x]),f=d.useCallback((v,y,w)=>{const b=R=>R.map(D=>{if(D.id===v)if(y==="type"){const S=w;if(S==="object")return{...D,type:S,value:{},children:[]};if(S==="array")return{...D,type:S,value:[],children:[]};if(S==="null")return{...D,type:S,value:null};{const P=Sg(String(D.value),S);return{...D,type:S,value:P,children:void 0}}}else if(y==="value"){const S=Sg(String(w),D.type);return{...D,value:S}}else return{...D,[y]:String(w)};return D.children?{...D,children:b(D.children)}:D});x(b(c))},[c,x]),p=d.useCallback(v=>{const y=w=>w.filter(b=>b.id!==v).map(b=>b.children?{...b,children:y(b.children)}:b);x(y(c))},[c,x]),g=d.useCallback(v=>{const y=w=>w.map(b=>{if(b.id===v){const R={id:Xi(),key:b.type==="array"?String(b.children?.length||0):"",value:"",type:"string",expanded:!0};return{...b,children:[...b.children||[],R]}}return b.children?{...b,children:y(b.children)}:b});x(y(c))},[c,x]),N=d.useCallback(v=>{const y=w=>w.map(b=>b.id===v?{...b,expanded:!b.expanded}:b.children?{...b,children:y(b.children)}:b);u(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(et,{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:i}):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(v=>e.jsx(yv,{node:v,level:0,onUpdate:f,onRemove:p,onAddChild:g,onToggleExpand:N},v.id))]})})]})}function kg(l){if(!l.trim())return{valid:!0,parsed:{}};try{const n=JSON.parse(l);return typeof n!="object"||n===null||Array.isArray(n)?{valid:!1,error:"必须是一个 JSON 对象 {}"}:{valid:!0,parsed:n}}catch{return{valid:!1,error:"JSON 格式错误"}}}function cS({value:l,onChange:n,className:i,placeholder:c="添加额外参数..."}){const[u,x]=d.useState("list"),h=d.useMemo(()=>Object.keys(l||{}).length>0?JSON.stringify(l,null,2):"",[l]),[f,p]=d.useState(h),[g,N]=d.useState(null);d.useEffect(()=>{p(h)},[h]);const v=d.useMemo(()=>{const b=kg(f);return b.valid&&b.parsed?{success:!0,data:b.parsed}:{success:!1,data:{}}},[f]),y=d.useCallback(b=>{const R=b;R==="json"&&u==="list"&&(p(Object.keys(l).length>0?JSON.stringify(l,null,2):""),N(null)),x(R)},[u,l]),w=d.useCallback(b=>{p(b);const R=kg(b);R.valid&&R.parsed?(N(null),n(R.parsed)):N(R.error||"JSON 格式错误")},[n]);return e.jsx("div",{className:I("h-full flex flex-col",i),children:e.jsxs(ta,{value:u,onValueChange:y,className:"w-full flex-1 flex flex-col",children:[e.jsxs(Xt,{className:"h-8 p-0.5 bg-muted/60 w-fit",children:[e.jsx(Je,{value:"list",className:"h-7 px-3 text-xs data-[state=active]:bg-background data-[state=active]:shadow-sm",children:"可视化编辑"}),e.jsx(Je,{value:"json",className:"h-7 px-3 text-xs data-[state=active]:bg-background data-[state=active]:shadow-sm",children:"JSON 编辑"})]}),e.jsx(ys,{value:"list",className:"mt-2 flex-1 flex flex-col overflow-hidden data-[state=inactive]:hidden data-[state=inactive]:h-0",children:e.jsx(iS,{value:l,onChange:n,placeholder:c})}),e.jsx(ys,{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(_t,{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(Ct,{className:"h-3 w-3"}),e.jsx("span",{children:"有效"})]})]}),e.jsx(ot,{value:f,onChange:b=>w(b.target.value),placeholder:`{ - "key": "value" -}`,className:I("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:v.success&&Object.keys(v.data).length>0?e.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-words",children:JSON.stringify(v.data,null,2)}):v.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 oS({open:l,onOpenChange:n,value:i,onChange:c}){const[u,x]=d.useState(i),h=g=>{g&&x(i),n(g)},f=()=>{c(u),n(!1)},p=()=>{x(i),n(!1)};return e.jsx(Is,{open:l,onOpenChange:h,children:e.jsxs(Os,{className:"max-w-3xl h-[70vh] flex flex-col",children:[e.jsxs(Ds,{children:[e.jsx(Rs,{children:"编辑额外参数"}),e.jsx(Ks,{children:"配置模型调用时的额外参数,支持嵌套对象和数组"})]}),e.jsx("div",{className:"flex-1 overflow-hidden min-h-0",children:e.jsx(cS,{value:u,onChange:x,placeholder:"添加额外参数(如 thinking、top_p 等)..."})}),e.jsxs(st,{children:[e.jsx(_,{variant:"outline",onClick:p,children:"取消"}),e.jsx(_,{onClick:f,children:"保存"})]})]})})}const Qr="https://maibot-plugin-stats.maibot-webui.workers.dev";async function dS(l){const n=new URLSearchParams;l?.status&&n.set("status",l.status),l?.page&&n.set("page",l.page.toString()),l?.page_size&&n.set("page_size",l.page_size.toString()),l?.search&&n.set("search",l.search),l?.sort_by&&n.set("sort_by",l.sort_by),l?.sort_order&&n.set("sort_order",l.sort_order);const i=await fetch(`${Qr}/pack?${n.toString()}`);if(!i.ok)throw new Error(`获取 Pack 列表失败: ${i.status}`);return i.json()}async function uS(l){const n=await fetch(`${Qr}/pack/${l}`);if(!n.ok)throw new Error(`获取 Pack 失败: ${n.status}`);const i=await n.json();if(!i.success)throw new Error(i.error||"获取 Pack 失败");return i.pack}async function mS(l){const i=await(await fetch(`${Qr}/pack`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)})).json();if(!i.success)throw new Error(i.error||"创建 Pack 失败");return i}async function xS(l,n){await fetch(`${Qr}/pack/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pack_id:l,user_id:n})})}async function wv(l,n){const c=await(await fetch(`${Qr}/pack/like`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pack_id:l,user_id:n})})).json();if(!c.success)throw new Error(c.error||"点赞失败");return{likes:c.likes,liked:c.liked}}async function _v(l,n){return(await(await fetch(`${Qr}/pack/like/check?pack_id=${l}&user_id=${n}`)).json()).liked||!1}async function hS(l){const n=await we("/api/webui/config/model");if(!n.ok)throw new Error("获取当前模型配置失败");const i=await n.json(),c=i.config||i;console.log("=== Pack Conflict Detection ==="),console.log("Pack providers:",l.providers),console.log("Local providers:",c.api_providers);const u={existing_providers:[],new_providers:[],conflicting_models:[]},x=c.api_providers||[];for(const f of l.providers){console.log(` -Checking pack provider: ${f.name}`),console.log(` Pack URL: ${f.base_url}`),console.log(` Normalized: ${Em(f.base_url)}`);const p=x.filter(g=>{const N=Em(g.base_url),v=Em(f.base_url);return console.log(` Comparing with local "${g.name}": ${g.base_url}`),console.log(` Local normalized: ${N}`),console.log(` Match: ${N===v}`),N===v});p.length>0?(console.log(` ✓ Matched with ${p.length} local provider(s):`,p.map(g=>g.name).join(", ")),u.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"),u.new_providers.push(f))}const h=c.models||[];console.log(` -=== Model Conflict Detection ===`);for(const f of l.models){const p=h.find(g=>g.name===f.name);p&&(console.log(`Model conflict: ${f.name}`),u.conflicting_models.push({pack_model:f.name,local_model:p.name}))}return console.log(` -=== Detection Summary ===`),console.log(`Existing providers: ${u.existing_providers.length}`),console.log(`New providers: ${u.new_providers.length}`),console.log(`Conflicting models: ${u.conflicting_models.length}`),console.log(`=========================== -`),u}async function fS(l,n,i,c){const u=await we("/api/webui/config/model");if(!u.ok)throw new Error("获取当前模型配置失败");const x=await u.json(),h=x.config||x;if(n.apply_providers){const p=n.selected_providers?l.providers.filter(g=>n.selected_providers.includes(g.name)):l.providers;for(const g of p){if(i[g.name])continue;const N=c[g.name];if(!N)throw new Error(`提供商 "${g.name}" 缺少 API Key`);const v={...g,api_key:N},y=h.api_providers.findIndex(w=>w.name===g.name);y>=0?h.api_providers[y]=v:h.api_providers.push(v)}}if(n.apply_models){const p=n.selected_models?l.models.filter(g=>n.selected_models.includes(g.name)):l.models;for(const g of p){const N=i[g.api_provider]||g.api_provider,v={...g,api_provider:N},y=h.models.findIndex(w=>w.name===g.name);y>=0?h.models[y]=v:h.models.push(v)}}if(n.apply_task_config){const p=n.selected_tasks||Object.keys(l.task_config);for(const g of p){const N=l.task_config[g];if(!N)continue;const v=new Set(n.selected_models||l.models.map(b=>b.name)),y=N.model_list.filter(b=>v.has(b));if(y.length===0)continue;const w={...N,model_list:y};if(n.task_mode==="replace")h.model_task_config[g]=w;else{const b=h.model_task_config[g];if(b){const R=[...new Set([...b.model_list,...y])];h.model_task_config[g]={...b,model_list:R}}else h.model_task_config[g]=w}}}if(!(await we("/api/webui/config/model",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(h)})).ok)throw new Error("保存配置失败")}async function pS(l){const n=await we("/api/webui/config/model");if(!n.ok)throw new Error("获取当前模型配置失败");const i=await n.json();if(!i.success||!i.config)throw new Error("获取配置失败");const c=i.config;let u=(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}));l.selectedProviders&&(u=u.filter(g=>l.selectedProviders.includes(g.name)));let x=c.models||[];l.selectedModels&&(x=x.filter(g=>l.selectedModels.includes(g.name)));const h={},f=c.model_task_config||{},p=l.selectedTasks||Object.keys(f);for(const g of p)f[g]&&(h[g]=f[g]);return{providers:u,models:x,task_config:h}}function Em(l){try{const n=new URL(l);return`${n.protocol}//${n.host}${n.pathname}`.replace(/\/$/,"").toLowerCase()}catch{return l.toLowerCase().replace(/\/$/,"")}}function Sv(){const l="maibot_pack_user_id";let n=localStorage.getItem(l);return n||(n="pack_user_"+Math.random().toString(36).substring(2,15),localStorage.setItem(l,n)),n}const gS={utils:"通用工具",utils_small:"轻量工具",tool_use:"工具调用",replyer:"回复生成",planner:"规划推理",vlm:"视觉模型",voice:"语音处理",embedding:"向量嵌入",lpmm_entity_extract:"实体提取",lpmm_rdf_build:"RDF构建",lpmm_qa:"问答模型"},jS=["官方推荐","性价比","高性能","免费模型","国内可用","海外模型","OpenAI","Claude","Gemini","国产模型","多模态","轻量级"];function vS({trigger:l}){const[n,i]=d.useState(!1),[c,u]=d.useState(1),[x,h]=d.useState(!1),[f,p]=d.useState(!1),[g,N]=d.useState([]),[v,y]=d.useState([]),[w,b]=d.useState({}),[R,D]=d.useState(new Set),[S,P]=d.useState(new Set),[M,T]=d.useState(new Set),[A,F]=d.useState(""),[L,J]=d.useState(""),[U,ue]=d.useState(""),[xe,he]=d.useState([]);d.useEffect(()=>{n&&c===1&&ne()},[n,c]);const ne=async()=>{h(!0);try{const O=await pS({name:"",description:"",author:""});N(O.providers),y(O.models),b(O.task_config),D(new Set(O.providers.map(k=>k.name))),P(new Set(O.models.map(k=>k.name))),T(new Set(Object.keys(O.task_config)))}catch(O){console.error("加载配置失败:",O),Qt({title:"加载当前配置失败",variant:"destructive"})}finally{h(!1)}},ve=O=>{const k=new Set(R),H=new Set(S),se=new Set(M);k.has(O)?(k.delete(O),v.filter(Z=>Z.api_provider===O).forEach(Z=>H.delete(Z.name)),Object.entries(w).forEach(([Z,Oe])=>{Oe.model_list&&(Oe.model_list.some(Q=>H.has(Q))||se.delete(Z))})):(k.add(O),v.filter(Z=>Z.api_provider===O).forEach(Z=>H.add(Z.name)),Object.entries(w).forEach(([Z,Oe])=>{Oe.model_list&&Oe.model_list.some(Q=>{const ee=v.find(Ue=>Ue.name===Q);return ee&&ee.api_provider===O})&&se.add(Z)})),D(k),P(H),T(se)},je=O=>{const k=new Set(S),H=new Set(M);k.has(O)?(k.delete(O),Object.entries(w).forEach(([se,Ee])=>{Ee.model_list&&(Ee.model_list.some(Oe=>k.has(Oe))||H.delete(se))})):(k.add(O),Object.entries(w).forEach(([se,Ee])=>{Ee.model_list&&Ee.model_list.includes(O)&&H.add(se)})),P(k),T(H)},z=O=>{const k=new Set(M);k.has(O)?k.delete(O):k.add(O),T(k)},V=O=>{xe.includes(O)?he(xe.filter(k=>k!==O)):xe.length<5?he([...xe,O]):Qt({title:"最多选择 5 个标签",variant:"destructive"})},B=()=>{R.size===g.length?D(new Set):D(new Set(g.map(O=>O.name)))},oe=()=>{S.size===v.length?P(new Set):P(new Set(v.map(O=>O.name)))},K=()=>{const O=Object.keys(w);M.size===O.length?T(new Set):T(new Set(O))},_e=async()=>{if(!A.trim()){Qt({title:"请输入模板名称",variant:"destructive"});return}if(!L.trim()){Qt({title:"请输入模板描述",variant:"destructive"});return}if(!U.trim()){Qt({title:"请输入作者名称",variant:"destructive"});return}if(R.size===0&&S.size===0&&M.size===0){Qt({title:"请至少选择一项配置",variant:"destructive"});return}p(!0);try{const O=g.filter(se=>R.has(se.name)),k=v.filter(se=>S.has(se.name)),H={};for(const[se,Ee]of Object.entries(w))M.has(se)&&(H[se]=Ee);await mS({name:A.trim(),description:L.trim(),author:U.trim(),tags:xe,providers:O,models:k,task_config:H}),Qt({title:"模板已提交审核,审核通过后将显示在市场中"}),i(!1),pe()}catch(O){console.error("提交失败:",O),Qt({title:O instanceof Error?O.message:"提交失败",variant:"destructive"})}finally{p(!1)}},pe=()=>{u(1),F(""),J(""),ue(""),he([]),D(new Set),P(new Set),T(new Set)},ke=2;return e.jsxs(Is,{open:n,onOpenChange:i,children:[e.jsx(Wo,{asChild:!0,children:l||e.jsxs(_,{variant:"outline",children:[e.jsx($j,{className:"w-4 h-4 mr-2"}),"分享配置"]})}),e.jsxs(Os,{className:"max-w-2xl max-h-[85vh] flex flex-col",children:[e.jsxs(Ds,{children:[e.jsxs(Rs,{className:"flex items-center gap-2",children:[e.jsx(ra,{className:"w-5 h-5"}),"分享配置模板"]}),e.jsxs(Ks,{children:["步骤 ",c," / ",ke,":",c===1&&"选择要分享的配置",c===2&&"填写模板信息"]})]}),e.jsx(Ye,{className:"h-[calc(85vh-220px)] pr-4",children:x?e.jsxs("div",{className:"py-8 text-center",children:[e.jsx(Bs,{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(at,{children:[e.jsx(Ht,{className:"h-4 w-4"}),e.jsx(Hn,{children:"安全提示"}),e.jsxs(lt,{children:["分享的配置将",e.jsx("strong",{children:"不包含"})," API Key,其他用户需要自行配置。"]})]}),e.jsxs(ta,{defaultValue:"providers",className:"w-full",children:[e.jsxs(Xt,{className:"grid w-full grid-cols-3",children:[e.jsxs(Je,{value:"providers",children:[e.jsx(Dl,{className:"w-4 h-4 mr-2"}),"API 提供商",e.jsxs(Se,{variant:"secondary",className:"ml-2",children:[R.size,"/",g.length]})]}),e.jsxs(Je,{value:"models",children:[e.jsx(Gn,{className:"w-4 h-4 mr-2"}),"模型配置",e.jsxs(Se,{variant:"secondary",className:"ml-2",children:[S.size,"/",v.length]})]}),e.jsxs(Je,{value:"tasks",children:[e.jsx(Vn,{className:"w-4 h-4 mr-2"}),"任务配置",e.jsxs(Se,{variant:"secondary",className:"ml-2",children:[M.size,"/",Object.keys(w).length]})]})]}),e.jsx(ys,{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:R.size===g.length?"取消全选":"全选"})}),g.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-2",children:"暂无提供商配置"}):g.map(O=>e.jsxs("div",{className:"flex items-center space-x-2 p-2 rounded hover:bg-muted",children:[e.jsx(qs,{id:`provider-${O.name}`,checked:R.has(O.name),onCheckedChange:()=>ve(O.name)}),e.jsxs(E,{htmlFor:`provider-${O.name}`,className:"flex-1 cursor-pointer",children:[e.jsx("span",{className:"font-medium",children:O.name}),e.jsx("span",{className:"text-xs text-muted-foreground ml-2",children:O.base_url})]}),e.jsx(Se,{variant:"outline",className:"text-xs",children:O.client_type})]},O.name))]})}),e.jsx(ys,{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:oe,children:S.size===v.length?"取消全选":"全选"})}),v.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-2",children:"暂无模型配置"}):v.map(O=>e.jsxs("div",{className:"flex items-center space-x-2 p-2 rounded hover:bg-muted",children:[e.jsx(qs,{id:`model-${O.name}`,checked:S.has(O.name),onCheckedChange:()=>je(O.name)}),e.jsxs(E,{htmlFor:`model-${O.name}`,className:"flex-1 cursor-pointer",children:[e.jsx("span",{className:"font-medium",children:O.name}),e.jsx("span",{className:"text-xs text-muted-foreground ml-2",children:O.model_identifier})]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:O.api_provider})]},O.name))]})}),e.jsx(ys,{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:K,children:M.size===Object.keys(w).length?"取消全选":"全选"})}),Object.keys(w).length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-2",children:"暂无任务配置"}):Object.entries(w).map(([O,k])=>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(qs,{id:`task-${O}`,checked:M.has(O),onCheckedChange:()=>z(O)}),e.jsx(E,{htmlFor:`task-${O}`,className:"flex-1 cursor-pointer",children:e.jsx("span",{className:"font-medium",children:gS[O]||O})}),e.jsxs(Se,{variant:"outline",className:"text-xs",children:[k.model_list.length," 个模型"]})]}),k.model_list&&k.model_list.length>0&&e.jsx("div",{className:"ml-6 flex flex-wrap gap-1",children:k.model_list.map(H=>{const se=v.find(Z=>Z.name===H),Ee=S.has(H);return e.jsxs(Se,{variant:Ee?"default":"outline",className:"text-xs cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>je(H),children:[H,se&&e.jsxs("span",{className:"ml-1 opacity-70",children:["(",se.api_provider,")"]})]},H)})})]},O))]})})]})]}),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(Dl,{className:"w-4 h-4"}),R.size," 个提供商"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Gn,{className:"w-4 h-4"}),S.size," 个模型"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Vn,{className:"w-4 h-4"}),M.size," 个任务"]})]}),e.jsx(Yt,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"pack-name",children:"模板名称 *"}),e.jsx(le,{id:"pack-name",placeholder:"例如:高性价比国产模型配置",value:A,onChange:O=>F(O.target.value),maxLength:50}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[A.length,"/50"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"pack-description",children:"模板描述 *"}),e.jsx(ot,{id:"pack-description",placeholder:"详细描述这个配置模板的特点、适用场景等...",value:L,onChange:O=>J(O.target.value),rows:4,maxLength:500}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[L.length,"/500"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"pack-author",children:"作者名称 *"}),e.jsx(le,{id:"pack-author",placeholder:"你的昵称或 ID",value:U,onChange:O=>ue(O.target.value),maxLength:30})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:"标签(可选,最多 5 个)"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:jS.map(O=>e.jsxs(Se,{variant:xe.includes(O)?"default":"outline",className:"cursor-pointer transition-colors",onClick:()=>V(O),children:[xe.includes(O)&&e.jsx(Ct,{className:"w-3 h-3 mr-1"}),e.jsx(Xo,{className:"w-3 h-3 mr-1"}),O]},O))})]})]}),e.jsxs(at,{children:[e.jsx(Ht,{className:"h-4 w-4"}),e.jsx(Hn,{children:"审核说明"}),e.jsx(lt,{children:"提交后需要经过审核才能在市场中展示。审核通常在 1-3 个工作日内完成。"})]})]})]})}),e.jsxs(st,{className:"flex justify-between pt-4 border-t",children:[e.jsx("div",{children:c>1&&e.jsx(_,{variant:"outline",onClick:()=>u(c-1),disabled:f,children:"上一步"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(_,{variant:"outline",onClick:()=>{i(!1),pe()},disabled:f,children:"取消"}),cu(c+1),disabled:x||R.size===0&&S.size===0&&M.size===0,children:"下一步"}):e.jsxs(_,{onClick:_e,disabled:f,children:[f&&e.jsx(Bs,{className:"w-4 h-4 mr-2 animate-spin"}),"提交审核"]})]})]})]})]})}function NS({value:l,label:n,onRemove:i}){const{attributes:c,listeners:u,setNodeRef:x,transform:h,transition:f,isDragging:p}=Wj({id:l}),g={transform:ev.Transform.toString(h),transition:f,opacity:p?.5:1},N=y=>{y.preventDefault(),y.stopPropagation(),i(l)},v=y=>{y.stopPropagation()};return e.jsx("div",{ref:x,style:g,className:I("inline-flex items-center gap-1",p&&"shadow-lg"),children:e.jsxs(Se,{variant:"secondary",className:"cursor-move hover:bg-secondary/80 flex items-center gap-1",children:[e.jsx("div",{...c,...u,className:"cursor-grab active:cursor-grabbing flex items-center",children:e.jsx(Rj,{className:"h-3 w-3 text-muted-foreground"})}),e.jsx("span",{children:n}),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:v,onMouseDown:y=>y.stopPropagation(),onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),N(y))},children:e.jsx(Ea,{className:"h-3 w-3 hover:text-destructive",strokeWidth:2,fill:"none"})})]})})}function bS({options:l,selected:n,onChange:i,placeholder:c="选择选项...",emptyText:u="未找到选项",className:x}){const[h,f]=d.useState(!1),p=Vj(Bo(Qj,{activationConstraint:{distance:8}}),Bo(Kj,{coordinateGetter:qj})),g=y=>{n.includes(y)?i(n.filter(w=>w!==y)):i([...n,y])},N=y=>{i(n.filter(w=>w!==y))},v=y=>{const{active:w,over:b}=y;if(b&&w.id!==b.id){const R=n.indexOf(w.id),D=n.indexOf(b.id);i(Yj(n,R,D))}};return e.jsxs(ol,{open:h,onOpenChange:f,children:[e.jsx(dl,{asChild:!0,children:e.jsxs(_,{variant:"outline",role:"combobox","aria-expanded":h,className:I("w-full justify-between min-h-10 h-auto",x),children:[e.jsx(Jj,{sensors:p,collisionDetection:Xj,onDragEnd:v,children:e.jsx(Zj,{items:n,strategy:O_,children:e.jsx("div",{className:"flex gap-1 flex-wrap flex-1",children:n.length===0?e.jsx("span",{className:"text-muted-foreground",children:c}):n.map(y=>{const w=l.find(b=>b.value===y);return e.jsx(NS,{value:y,label:w?.label||y,onRemove:N},y)})})})}),e.jsx(Ym,{className:"ml-2 h-4 w-4 shrink-0 opacity-50",strokeWidth:2,fill:"none"})]})}),e.jsx(Wa,{className:"w-full p-0",align:"start",children:e.jsxs(sd,{children:[e.jsx(td,{placeholder:"搜索...",className:"h-9"}),e.jsxs(ad,{children:[e.jsx(ld,{children:u}),e.jsx(ac,{children:l.map(y=>{const w=n.includes(y.value);return e.jsxs(lc,{value:y.value,onSelect:()=>g(y.value),children:[e.jsx("div",{className:I("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",w?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(Ct,{className:"h-3 w-3",strokeWidth:2,fill:"none"})}),e.jsx("span",{children:y.label})]},y.value)})})]})]})})]})}const Ml=As.memo(function({title:n,description:i,taskConfig:c,modelNames:u,onChange:x,hideTemperature:h=!1,hideMaxTokens:f=!1,dataTour:p}){const g=N=>{x("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:n}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:i})]}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2","data-tour":p,children:[e.jsx(E,{children:"模型列表"}),e.jsx(bS,{options:u.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(E,{children:"温度"}),e.jsx(le,{type:"number",step:"0.1",min:"0",max:"1",value:c.temperature??.3,onChange:N=>{const v=parseFloat(N.target.value);!isNaN(v)&&v>=0&&v<=1&&x("temperature",v)},className:"w-20 h-8 text-sm"})]}),e.jsx(qa,{value:[c.temperature??.3],onValueChange:N=>x("temperature",N[0]),min:0,max:1,step:.1,className:"w-full"})]}),!f&&e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"最大 Token"}),e.jsx(le,{type:"number",step:"1",min:"1",value:c.max_tokens??1024,onChange:N=>x("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(E,{children:"慢请求阈值 (秒)"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"超时警告"})]}),e.jsx(le,{type:"number",step:"1",min:"1",value:c.slow_threshold??15,onChange:N=>{const v=parseInt(N.target.value);!isNaN(v)&&v>=1&&x("slow_threshold",v)},placeholder:"15"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"模型响应时间超过此阈值将输出警告日志"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"模型选择策略"}),e.jsxs(Ie,{value:c.selection_strategy??"balance",onValueChange:N=>x("selection_strategy",N),children:[e.jsx($e,{children:e.jsx(Pe,{placeholder:"选择模型选择策略"})}),e.jsxs(Be,{children:[e.jsx(X,{value:"balance",children:"负载均衡(balance)"}),e.jsx(X,{value:"random",children:"随机选择(random)"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"负载均衡:优先选择使用次数少的模型。随机选择:完全随机从模型列表中选择"})]})]})]})}),yS=As.memo(function({paginatedModels:n,allModels:i,onEdit:c,onDelete:u,isModelUsed:x,searchQuery:h}){return n.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:n.map((f,p)=>{const g=i.findIndex(v=>v===f),N=x(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(Se,{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(Fn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(_,{size:"sm",onClick:()=>u(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)})})}),wS=As.memo(function({paginatedModels:n,allModels:i,filteredModels:c,selectedModels:u,onEdit:x,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(Rl,{children:[e.jsx(Ll,{children:e.jsxs(ut,{children:[e.jsx(Ze,{className:"w-12",children:e.jsx(qs,{checked:u.size===c.length&&c.length>0,onCheckedChange:p})}),e.jsx(Ze,{className:"w-24",children:"使用状态"}),e.jsx(Ze,{children:"模型名称"}),e.jsx(Ze,{children:"模型标识符"}),e.jsx(Ze,{children:"提供商"}),e.jsx(Ze,{className:"text-center",children:"温度"}),e.jsx(Ze,{className:"text-right",children:"输入价格"}),e.jsx(Ze,{className:"text-right",children:"输出价格"}),e.jsx(Ze,{className:"text-right",children:"操作"})]})}),e.jsx(Ul,{children:n.length===0?e.jsx(ut,{children:e.jsx(qe,{colSpan:9,className:"text-center text-muted-foreground py-8",children:N?"未找到匹配的模型":"暂无模型配置"})}):n.map((v,y)=>{const w=i.findIndex(R=>R===v),b=g(v.name);return e.jsxs(ut,{children:[e.jsx(qe,{children:e.jsx(qs,{checked:u.has(w),onCheckedChange:()=>f(w)})}),e.jsx(qe,{children:e.jsx(Se,{variant:b?"default":"secondary",className:b?"bg-green-600 hover:bg-green-700":"",children:b?"已使用":"未使用"})}),e.jsx(qe,{className:"font-medium",children:v.name}),e.jsx(qe,{className:"max-w-xs truncate",title:v.model_identifier,children:v.model_identifier}),e.jsx(qe,{children:v.api_provider}),e.jsx(qe,{className:"text-center",children:v.temperature!=null?v.temperature:e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsxs(qe,{className:"text-right",children:["¥",v.price_in,"/M"]}),e.jsxs(qe,{className:"text-right",children:["¥",v.price_out,"/M"]}),e.jsx(qe,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>x(v,w),children:[e.jsx(Fn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(_,{size:"sm",onClick:()=>h(w),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)})})]})})})}),_S=300*1e3,Cg=new Map,SS=[10,20,50,100],kS=As.memo(function({page:n,pageSize:i,totalItems:c,jumpToPage:u,onPageChange:x,onPageSizeChange:h,onJumpToPageChange:f,onJumpToPage:p,onSelectionClear:g}){const N=Math.ceil(c/i),v=w=>{h(parseInt(w)),x(1),g?.()},y=w=>{w.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(E,{htmlFor:"page-size-model",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Ie,{value:i.toString(),onValueChange:v,children:[e.jsx($e,{id:"page-size-model",className:"w-20",children:e.jsx(Pe,{})}),e.jsx(Be,{children:SS.map(w=>e.jsx(X,{value:w.toString(),children:w},w))})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(n-1)*i+1," 到"," ",Math.min(n*i,c)," 条,共 ",c," 条"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>x(1),disabled:n===1,className:"hidden sm:flex",children:e.jsx(gn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>x(Math.max(1,n-1)),disabled:n===1,children:[e.jsx(Aa,{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(le,{type:"number",value:u,onChange:w=>f(w.target.value),onKeyDown:y,placeholder:n.toString(),className:"w-16 h-8 text-center",min:1,max:N}),e.jsx(_,{variant:"outline",size:"sm",onClick:p,disabled:!u,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>x(n+1),disabled:n>=N,children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Zt,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>x(N),disabled:n>=N,className:"hidden sm:flex",children:e.jsx(jn,{className:"h-4 w-4"})})]})]})});function CS(l){const{models:n,taskConfig:i,debounceMs:c=2e3,onSavingChange:u,onUnsavedChange:x}=l,h=d.useRef(null),f=d.useRef(null),p=d.useRef(!0),g=d.useCallback(()=>{h.current&&(clearTimeout(h.current),h.current=null),f.current&&(clearTimeout(f.current),f.current=null)},[]),N=d.useCallback(w=>{const b={model_identifier:w.model_identifier,name:w.name,api_provider:w.api_provider,price_in:w.price_in??0,price_out:w.price_out??0,force_stream_mode:w.force_stream_mode??!1,extra_params:w.extra_params??{}};return w.temperature!=null&&(b.temperature=w.temperature),w.max_tokens!=null&&(b.max_tokens=w.max_tokens),b},[]),v=d.useCallback(async w=>{try{u?.(!0);const b=w.map(N);await Bm("models",b),x?.(!1)}catch(b){console.error("自动保存模型列表失败:",b),x?.(!0)}finally{u?.(!1)}},[u,x,N]),y=d.useCallback(async w=>{try{u?.(!0),await Bm("model_task_config",w),x?.(!1)}catch(b){console.error("自动保存任务配置失败:",b),x?.(!0)}finally{u?.(!1)}},[u,x]);return d.useEffect(()=>{if(!p.current)return x?.(!0),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{v(n)},c),()=>{h.current&&clearTimeout(h.current)}},[n,v,c,x]),d.useEffect(()=>{if(!(p.current||!i))return x?.(!0),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{y(i)},c),()=>{f.current&&clearTimeout(f.current)}},[i,y,c,x]),d.useEffect(()=>()=>{g()},[g]),{clearTimers:g,initialLoadRef:p}}function TS(l={}){const{onCloseEditDialog:n}=l,i=ca(),{registerTour:c,startTour:u,state:x,goToStep:h}=ax(),f=d.useRef(x.stepIndex);return d.useEffect(()=>{c(il,Nv)},[c]),d.useEffect(()=>{if(x.activeTourId===il&&x.isRunning){const g=bv[x.stepIndex];g&&!window.location.pathname.endsWith(g.replace("/config/",""))&&i({to:g})}},[x.stepIndex,x.activeTourId,x.isRunning,i]),d.useEffect(()=>{if(x.activeTourId===il&&x.isRunning){const g=f.current,N=x.stepIndex;g>=12&&g<=17&&N<12&&n?.(),f.current=N}},[x.stepIndex,x.activeTourId,x.isRunning,n]),d.useEffect(()=>{if(x.activeTourId!==il||!x.isRunning)return;const g=N=>{const v=N.target,y=x.stepIndex;y===2&&v.closest('[data-tour="add-provider-button"]')?setTimeout(()=>h(3),300):y===9&&v.closest('[data-tour="provider-cancel-button"]')?setTimeout(()=>h(10),300):y===11&&v.closest('[data-tour="add-model-button"]')?setTimeout(()=>h(12),300):y===17&&v.closest('[data-tour="model-cancel-button"]')?setTimeout(()=>h(18),300):y===18&&v.closest('[data-tour="tasks-tab-trigger"]')&&setTimeout(()=>h(19),300)};return document.addEventListener("click",g,!0),()=>document.removeEventListener("click",g,!0)},[x,h]),{startTour:d.useCallback(()=>{u(il)},[u]),isRunning:x.isRunning&&x.activeTourId===il,stepIndex:x.stepIndex}}function ES(l){const{getProviderConfig:n}=l,[i,c]=d.useState([]),[u,x]=d.useState(!1),[h,f]=d.useState(null),[p,g]=d.useState(null),N=d.useCallback(()=>{c([]),f(null),g(null)},[]),v=d.useCallback(async(y,w=!1)=>{const b=n(y);if(!b?.base_url){c([]),g(null),f('提供商配置不完整,请先在"模型提供商配置"中配置');return}if(!b.api_key){c([]),g(null),f('该提供商未配置 API Key,请先在"模型提供商配置"中填写');return}const R=aS(b.base_url);if(g(R),!R?.modelFetcher){c([]),f(null);return}const D=`${y}:${b.base_url}`,S=Cg.get(D);if(!w&&S&&Date.now()-S.timestamp<_S){c(S.models),f(null);return}x(!0),f(null);try{const P=await U2(y,R.modelFetcher.parser,R.modelFetcher.endpoint);c(P),Cg.set(D,{models:P,timestamp:Date.now()})}catch(P){console.error("获取模型列表失败:",P);const M=P.message||"获取模型列表失败";M.includes("无效")||M.includes("过期")||M.includes("API Key")?f('API Key 无效或已过期,请检查"模型提供商配置"中的密钥'):M.includes("权限")?f("没有权限获取模型列表,请检查 API Key 权限"):M.includes("timeout")||M.includes("超时")?f("请求超时,请检查网络连接后重试"):M.includes("不支持")?f("该提供商不支持自动获取模型列表,请手动输入"):f(M),c([])}finally{x(!1)}},[n]);return{availableModels:i,fetchingModels:u,modelFetchError:h,matchedTemplate:p,fetchModelsForProvider:v,clearModels:N}}function MS(){return e.jsx(Yn,{children:e.jsx(zS,{})})}function zS(){const[l,n]=d.useState([]),[i,c]=d.useState([]),[u,x]=d.useState([]),[h,f]=d.useState([]),[p,g]=d.useState(null),[N,v]=d.useState(!0),[y,w]=d.useState(!1),[b,R]=d.useState(!1),[D,S]=d.useState(!1),[P,M]=d.useState(!1),[T,A]=d.useState(null),[F,L]=d.useState(null),[J,U]=d.useState(!1),[ue,xe]=d.useState(!1),[he,ne]=d.useState(null),[ve,je]=d.useState(""),[z,V]=d.useState(new Set),[B,oe]=d.useState(!1),[K,_e]=d.useState(1),[pe,ke]=d.useState(20),[O,k]=d.useState(""),[H,se]=d.useState(!1),[Ee,Z]=d.useState(!1),Oe=d.useRef([]),ns=d.useRef(null),[Q,ee]=d.useState([]),[Ue,ie]=d.useState([]),[Te,de]=d.useState({}),{toast:Me}=Zs(),{triggerRestart:rs,isRestarting:Ut}=vn(),{startTour:aa,isRunning:Qa}=TS({onCloseEditDialog:()=>M(!1)}),{clearTimers:Ft,initialLoadRef:mt}=CS({models:l,taskConfig:p,onSavingChange:R,onUnsavedChange:S}),q=d.useCallback((re,fe)=>{if(!re)return;const ss=new Set(fe.map(ja=>ja.name)),gs=[],is=[],jt=[{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:ja,label:Bl}of jt){const Zn=re[ja];if(!Zn)continue;if(!Zn.model_list||Zn.model_list.length===0){is.push(Bl);continue}const Jr=Zn.model_list.filter(bn=>!ss.has(bn));Jr.length>0&&gs.push({taskName:Bl,invalidModels:Jr})}ee(gs),ie(is)},[]),Ve=d.useCallback(async()=>{try{v(!0);const re=await un(),fe=re.models||[];n(fe),f(fe.map(jt=>jt.name));const ss=re.api_providers||[];c(ss.map(jt=>jt.name)),x(ss);const gs=re.model_task_config||null;g(gs),q(gs,fe);const is=gs?.embedding?.model_list||[];Oe.current=[...is],S(!1),mt.current=!1}catch(re){console.error("加载配置失败:",re)}finally{v(!1)}},[mt,q]);d.useEffect(()=>{Ve()},[Ve]);const Ke=d.useCallback(re=>u.find(fe=>fe.name===re),[u]),{availableModels:We,fetchingModels:Ls,modelFetchError:ts,matchedTemplate:Cs,fetchModelsForProvider:ze,clearModels:Ns}=ES({getProviderConfig:Ke});d.useEffect(()=>{P&&T?.api_provider&&ze(T.api_provider)},[P,T?.api_provider,ze]);const as=async()=>{await rs()},es=d.useCallback(()=>{if(!p)return;const re=new Set(l.map(gs=>gs.name)),fe={...p},ss=Object.keys(fe);for(const gs of ss){const is=fe[gs];is&&is.model_list&&(is.model_list=is.model_list.filter(jt=>re.has(jt)))}g(fe),ee([]),Me({title:"清理完成",description:"已删除所有无效的模型引用"})},[p,l,Me]),bs=re=>{const fe={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&&(fe.temperature=re.temperature),re.max_tokens!=null&&(fe.max_tokens=re.max_tokens),fe},gt=async()=>{try{w(!0),Ft();const re=await un();re.models=l.map(bs),re.model_task_config=p,await Ji(re),S(!1),Me({title:"保存成功",description:"正在重启麦麦..."}),await as()}catch(re){console.error("保存配置失败:",re),Me({title:"保存失败",description:re.message,variant:"destructive"}),w(!1)}},$t=async()=>{try{w(!0),Ft();const re=await un();re.models=l.map(bs),re.model_task_config=p,await Ji(re),S(!1),Me({title:"保存成功",description:"模型配置已保存"}),await Ve()}catch(re){console.error("保存配置失败:",re),Me({title:"保存失败",description:re.message,variant:"destructive"})}finally{w(!1)}},tt=(re,fe)=>{de({}),A(re||{model_identifier:"",name:"",api_provider:i[0]||"",price_in:0,price_out:0,temperature:null,max_tokens:null,force_stream_mode:!1,extra_params:{}}),L(fe),M(!0)},Ms=()=>{if(!T)return;const re={};if(T.name?.trim()?l.some((jt,ja)=>F!==null&&ja===F?!1:jt.name.trim().toLowerCase()===T.name.trim().toLowerCase())&&(re.name="模型名称已存在,请使用其他名称"):re.name="请输入模型名称",T.api_provider?.trim()||(re.api_provider="请选择 API 提供商"),T.model_identifier?.trim()||(re.model_identifier="请输入模型标识符"),Object.keys(re).length>0){de(re);return}de({});const fe={model_identifier:T.model_identifier,name:T.name,api_provider:T.api_provider,price_in:T.price_in??0,price_out:T.price_out??0,force_stream_mode:T.force_stream_mode??!1,extra_params:T.extra_params??{}};T.temperature!=null&&(fe.temperature=T.temperature),T.max_tokens!=null&&(fe.max_tokens=T.max_tokens);let ss,gs=null;if(F!==null?(gs=l[F].name,ss=[...l],ss[F]=fe):ss=[...l,fe],n(ss),f(ss.map(is=>is.name)),gs&&gs!==fe.name&&p){const is=jt=>jt.map(ja=>ja===gs?fe.name:ja);g({...p,utils:{...p.utils,model_list:is(p.utils?.model_list||[])},tool_use:{...p.tool_use,model_list:is(p.tool_use?.model_list||[])},replyer:{...p.replyer,model_list:is(p.replyer?.model_list||[])},planner:{...p.planner,model_list:is(p.planner?.model_list||[])},vlm:{...p.vlm,model_list:is(p.vlm?.model_list||[])},voice:{...p.voice,model_list:is(p.voice?.model_list||[])},embedding:{...p.embedding,model_list:is(p.embedding?.model_list||[])},lpmm_entity_extract:{...p.lpmm_entity_extract,model_list:is(p.lpmm_entity_extract?.model_list||[])},lpmm_rdf_build:{...p.lpmm_rdf_build,model_list:is(p.lpmm_rdf_build?.model_list||[])}})}M(!1),A(null),L(null),Me({title:F!==null?"模型已更新":"模型已添加",description:'配置将在 2 秒后自动保存,或点击右上角"保存配置"按钮立即保存'})},Et=re=>{if(!re&&T){const fe={...T,price_in:T.price_in??0,price_out:T.price_out??0};A(fe)}M(re)},Bt=re=>{ne(re),xe(!0)},Oa=()=>{if(he!==null){const re=l.filter((fe,ss)=>ss!==he);n(re),f(re.map(fe=>fe.name)),q(p,re),Me({title:"删除成功",description:'配置将在 2 秒后自动保存,或点击右上角"保存配置"按钮立即保存'})}xe(!1),ne(null)},tl=re=>{const fe=new Set(z);fe.has(re)?fe.delete(re):fe.add(re),V(fe)},ul=()=>{if(z.size===Dt.length)V(new Set);else{const re=Dt.map((fe,ss)=>l.findIndex(gs=>gs===Dt[ss]));V(new Set(re))}},Xn=()=>{if(z.size===0){Me({title:"提示",description:"请先选择要删除的模型",variant:"default"});return}oe(!0)},W=()=>{const re=z.size,fe=l.filter((ss,gs)=>!z.has(gs));n(fe),f(fe.map(ss=>ss.name)),q(p,fe),V(new Set),oe(!1),Me({title:"批量删除成功",description:`已删除 ${re} 个模型,配置将在 2 秒后自动保存`})},ye=(re,fe,ss)=>{if(!p)return;if(re==="embedding"&&fe==="model_list"&&Array.isArray(ss)){const is=Oe.current,jt=ss;if((is.length!==jt.length||is.some(Bl=>!jt.includes(Bl))||jt.some(Bl=>!is.includes(Bl)))&&is.length>0){ns.current={field:fe,value:ss},Z(!0);return}}const gs={...p,[re]:{...p[re],[fe]:ss}};g(gs),q(gs,l),re==="embedding"&&fe==="model_list"&&Array.isArray(ss)&&(Oe.current=[...ss])},Re=()=>{if(!p||!ns.current)return;const{field:re,value:fe}=ns.current,ss={...p,embedding:{...p.embedding,[re]:fe}};g(ss),q(ss,l),re==="model_list"&&Array.isArray(fe)&&(Oe.current=[...fe]),ns.current=null,Z(!1),Me({title:"嵌入模型已更新",description:"建议重新生成知识库向量以确保最佳匹配精度"})},Hs=()=>{ns.current=null,Z(!1)},Dt=l.filter(re=>{if(!ve)return!0;const fe=ve.toLowerCase();return re.name.toLowerCase().includes(fe)||re.model_identifier.toLowerCase().includes(fe)||re.api_provider.toLowerCase().includes(fe)}),Wt=Math.ceil(Dt.length/pe),rt=Dt.slice((K-1)*pe,K*pe),ea=()=>{const re=parseInt(O);re>=1&&re<=Wt&&(_e(re),k(""))},xt=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(ss=>ss.includes(re)):!1;return N?e.jsx(Ye,{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(Ye,{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(vS,{trigger:e.jsxs(_,{variant:"outline",size:"sm",className:"flex-1 sm:flex-none",children:[e.jsx($j,{className:"mr-2 h-4 w-4"}),"分享配置"]})}),e.jsxs(_,{onClick:$t,disabled:y||b||!D||Ut,size:"sm",variant:"outline",className:"flex-1 sm:flex-none sm:min-w-[120px]",children:[e.jsx(oc,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),y?"保存中...":b?"自动保存中...":D?"保存配置":"已保存"]}),e.jsxs(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{disabled:y||b||Ut,size:"sm",className:"flex-1 sm:flex-none sm:min-w-[120px]",children:[e.jsx(cc,{className:"mr-2 h-4 w-4"}),Ut?"重启中...":D?"保存并重启":"重启麦麦"]})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认重启麦麦?"}),e.jsx(hs,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:D?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})})})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:D?gt:as,children:D?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsxs(at,{children:[e.jsx(Ht,{className:"h-4 w-4"}),e.jsxs(lt,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),Q.length>0&&e.jsxs(at,{variant:"destructive",children:[e.jsx(Jt,{className:"h-4 w-4"}),e.jsxs(lt,{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:Q.map(({taskName:re,invalidModels:fe})=>e.jsxs("div",{className:"text-sm",children:[e.jsx("strong",{children:re})," 引用了不存在的模型: ",fe.join(", ")]},re))})]}),e.jsx(_,{variant:"outline",size:"sm",className:"shrink-0 bg-background hover:bg-accent",onClick:es,children:"一键清理"})]})]}),Ue.length>0&&e.jsxs(at,{variant:"default",className:"border-yellow-500/50 bg-yellow-500/10",children:[e.jsx(Jt,{className:"h-4 w-4 text-yellow-600"}),e.jsxs(lt,{children:[e.jsx("strong",{className:"text-yellow-600",children:"以下任务未配置模型"}),e.jsxs("div",{className:"mt-2 text-sm",children:[Ue.join("、")," 还未分配模型,这些功能将无法正常工作。"]})]})]}),e.jsxs(at,{className:"hidden lg:flex border-primary/30 bg-primary/5 cursor-pointer hover:bg-primary/10 transition-colors",onClick:aa,children:[e.jsx(Ww,{className:"h-4 w-4 text-primary"}),e.jsxs(lt,{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(ta,{defaultValue:"models",className:"w-full",children:[e.jsxs(Xt,{className:"grid w-full max-w-full sm:max-w-md grid-cols-2",children:[e.jsx(Je,{value:"models",children:"添加模型"}),e.jsx(Je,{value:"tasks","data-tour":"tasks-tab-trigger",children:"为模型分配功能"})]}),e.jsxs(ys,{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:[z.size>0&&e.jsxs(_,{onClick:Xn,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"}),"批量删除 (",z.size,")"]}),e.jsxs(_,{onClick:()=>tt(null,null),size:"sm",variant:"outline",className:"w-full sm:w-auto","data-tour":"add-model-button",children:[e.jsx(et,{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(Tt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(le,{placeholder:"搜索模型名称、标识符或提供商...",value:ve,onChange:re=>je(re.target.value),className:"pl-9"})]}),ve&&e.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",Dt.length," 个结果"]})]}),e.jsx(yS,{paginatedModels:rt,allModels:l,onEdit:tt,onDelete:Bt,isModelUsed:xt,searchQuery:ve}),e.jsx(wS,{paginatedModels:rt,allModels:l,filteredModels:Dt,selectedModels:z,onEdit:tt,onDelete:Bt,onToggleSelection:tl,onToggleSelectAll:ul,isModelUsed:xt,searchQuery:ve}),e.jsx(kS,{page:K,pageSize:pe,totalItems:Dt.length,jumpToPage:O,onPageChange:_e,onPageSizeChange:ke,onJumpToPageChange:k,onJumpToPage:ea,onSelectionClear:()=>V(new Set)})]}),e.jsxs(ys,{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(Ml,{title:"组件模型 (utils)",description:"用于表情包、取名、关系、情绪变化等组件",taskConfig:p.utils,modelNames:h,onChange:(re,fe)=>ye("utils",re,fe),dataTour:"task-model-select"}),e.jsx(Ml,{title:"工具调用模型 (tool_use)",description:"需要使用支持工具调用的模型",taskConfig:p.tool_use,modelNames:h,onChange:(re,fe)=>ye("tool_use",re,fe)}),e.jsx(Ml,{title:"首要回复模型 (replyer)",description:"用于表达器和表达方式学习",taskConfig:p.replyer,modelNames:h,onChange:(re,fe)=>ye("replyer",re,fe)}),e.jsx(Ml,{title:"决策模型 (planner)",description:"负责决定麦麦该什么时候回复",taskConfig:p.planner,modelNames:h,onChange:(re,fe)=>ye("planner",re,fe)}),e.jsx(Ml,{title:"图像识别模型 (vlm)",description:"视觉语言模型",taskConfig:p.vlm,modelNames:h,onChange:(re,fe)=>ye("vlm",re,fe),hideTemperature:!0}),e.jsx(Ml,{title:"语音识别模型 (voice)",description:"语音转文字",taskConfig:p.voice,modelNames:h,onChange:(re,fe)=>ye("voice",re,fe),hideTemperature:!0,hideMaxTokens:!0}),e.jsx(Ml,{title:"嵌入模型 (embedding)",description:"用于向量化",taskConfig:p.embedding,modelNames:h,onChange:(re,fe)=>ye("embedding",re,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(Ml,{title:"实体提取模型 (lpmm_entity_extract)",description:"从文本中提取实体",taskConfig:p.lpmm_entity_extract,modelNames:h,onChange:(re,fe)=>ye("lpmm_entity_extract",re,fe)}),e.jsx(Ml,{title:"RDF 构建模型 (lpmm_rdf_build)",description:"构建知识图谱",taskConfig:p.lpmm_rdf_build,modelNames:h,onChange:(re,fe)=>ye("lpmm_rdf_build",re,fe)})]})]})]})]}),e.jsx(Is,{open:P,onOpenChange:Et,children:e.jsxs(Os,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto","data-tour":"model-dialog",preventOutsideClose:Qa,children:[e.jsxs(Ds,{children:[e.jsx(Rs,{children:F!==null?"编辑模型":"添加模型"}),e.jsx(Ks,{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(E,{htmlFor:"model_name",className:Te.name?"text-destructive":"",children:"模型名称 *"}),e.jsx(le,{id:"model_name",value:T?.name||"",onChange:re=>{A(fe=>fe?{...fe,name:re.target.value}:null),Te.name&&de(fe=>({...fe,name:void 0}))},placeholder:"例如: qwen3-30b",className:Te.name?"border-destructive focus-visible:ring-destructive":""}),Te.name?e.jsx("p",{className:"text-xs text-destructive",children:Te.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(E,{htmlFor:"api_provider",className:Te.api_provider?"text-destructive":"",children:"API 提供商 *"}),e.jsxs(Ie,{value:T?.api_provider||"",onValueChange:re=>{A(fe=>fe?{...fe,api_provider:re}:null),Ns(),Te.api_provider&&de(fe=>({...fe,api_provider:void 0}))},children:[e.jsx($e,{id:"api_provider",className:Te.api_provider?"border-destructive focus-visible:ring-destructive":"",children:e.jsx(Pe,{placeholder:"选择提供商"})}),e.jsx(Be,{children:i.map(re=>e.jsx(X,{value:re,children:re},re))})]}),Te.api_provider&&e.jsx("p",{className:"text-xs text-destructive",children:Te.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(E,{htmlFor:"model_identifier",className:Te.model_identifier?"text-destructive":"",children:"模型标识符 *"}),Cs?.modelFetcher&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Se,{variant:"secondary",className:"text-xs",children:Cs.display_name}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-6 px-2",onClick:()=>T?.api_provider&&ze(T.api_provider,!0),disabled:Ls,children:Ls?e.jsx(Bs,{className:"h-3 w-3 animate-spin"}):e.jsx(dt,{className:"h-3 w-3"})})]})]}),Cs?.modelFetcher?e.jsxs(ol,{open:H,onOpenChange:se,children:[e.jsx(dl,{asChild:!0,children:e.jsxs(_,{variant:"outline",role:"combobox","aria-expanded":H,className:"w-full justify-between font-normal",disabled:Ls||!!ts,children:[Ls?e.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(Bs,{className:"h-4 w-4 animate-spin"}),"正在获取模型列表..."]}):ts?e.jsx("span",{className:"text-muted-foreground text-sm",children:"点击下方输入框手动填写"}):T?.model_identifier?e.jsx("span",{className:"truncate",children:T.model_identifier}):e.jsx("span",{className:"text-muted-foreground",children:"搜索或选择模型..."}),e.jsx(Ym,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(Wa,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:e.jsxs(sd,{children:[e.jsx(td,{placeholder:"搜索模型..."}),e.jsx(Ye,{className:"h-[300px]",children:e.jsxs(ad,{className:"max-h-none overflow-visible",children:[e.jsx(ld,{children:ts?e.jsxs("div",{className:"py-4 px-2 text-center space-y-2",children:[e.jsx("p",{className:"text-sm text-destructive",children:ts}),!ts.includes("API Key")&&e.jsx(_,{variant:"link",size:"sm",onClick:()=>T?.api_provider&&ze(T.api_provider,!0),children:"重试"})]}):"未找到匹配的模型"}),e.jsx(ac,{heading:"可用模型",children:We.map(re=>e.jsxs(lc,{value:re.id,onSelect:()=>{A(fe=>fe?{...fe,model_identifier:re.id}:null),se(!1)},children:[e.jsx(Ct,{className:`mr-2 h-4 w-4 ${T?.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(ac,{heading:"手动输入",children:e.jsxs(lc,{value:"__manual_input__",onSelect:()=>{se(!1)},children:[e.jsx(Fn,{className:"mr-2 h-4 w-4"}),"手动输入模型标识符..."]})})]})})]})})]}):e.jsx(le,{id:"model_identifier",value:T?.model_identifier||"",onChange:re=>{A(fe=>fe?{...fe,model_identifier:re.target.value}:null),Te.model_identifier&&de(fe=>({...fe,model_identifier:void 0}))},placeholder:"Qwen/Qwen3-30B-A3B-Instruct-2507",className:Te.model_identifier?"border-destructive focus-visible:ring-destructive":""}),Te.model_identifier&&e.jsx("p",{className:"text-xs text-destructive",children:Te.model_identifier}),ts&&Cs?.modelFetcher&&!Te.model_identifier&&e.jsxs(at,{variant:"destructive",className:"mt-2 py-2",children:[e.jsx(Ht,{className:"h-4 w-4"}),e.jsx(lt,{className:"text-xs",children:ts})]}),Cs?.modelFetcher&&e.jsx(le,{value:T?.model_identifier||"",onChange:re=>{A(fe=>fe?{...fe,model_identifier:re.target.value}:null),Te.model_identifier&&de(fe=>({...fe,model_identifier:void 0}))},placeholder:"或手动输入模型标识符",className:`mt-2 ${Te.model_identifier?"border-destructive focus-visible:ring-destructive":""}`}),!Te.model_identifier&&e.jsx("p",{className:"text-xs text-muted-foreground",children:ts?'请手动输入模型标识符,或前往"模型提供商配置"检查 API Key':Cs?.modelFetcher?`已识别为 ${Cs.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(E,{htmlFor:"price_in",children:"输入价格 (¥/M token)"}),e.jsx(le,{id:"price_in",type:"number",step:"0.1",min:"0",value:T?.price_in??"",onChange:re=>{const fe=re.target.value===""?null:parseFloat(re.target.value);A(ss=>ss?{...ss,price_in:fe}:null)},placeholder:"默认: 0"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"price_out",children:"输出价格 (¥/M token)"}),e.jsx(le,{id:"price_out",type:"number",step:"0.1",min:"0",value:T?.price_out??"",onChange:re=>{const fe=re.target.value===""?null:parseFloat(re.target.value);A(ss=>ss?{...ss,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(E,{htmlFor:"enable_model_temperature",className:"cursor-pointer",children:"自定义模型温度"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后将覆盖「为模型分配功能」中的任务温度配置"})]}),e.jsx(Fe,{id:"enable_model_temperature",checked:T?.temperature!=null,onCheckedChange:re=>{A(re?fe=>fe?{...fe,temperature:.5}:null:fe=>fe?{...fe,temperature:null}:null)}})]}),T?.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(E,{className:"text-sm",children:"温度值"}),e.jsx("span",{className:"text-sm font-medium tabular-nums",children:T.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:[T.temperature],onValueChange:re=>A(fe=>fe?{...fe,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(E,{htmlFor:"enable_model_max_tokens",className:"cursor-pointer",children:"自定义最大 Token"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后将覆盖「为模型分配功能」中的任务最大 Token 配置"})]}),e.jsx(Fe,{id:"enable_model_max_tokens",checked:T?.max_tokens!=null,onCheckedChange:re=>{A(re?fe=>fe?{...fe,max_tokens:2048}:null:fe=>fe?{...fe,max_tokens:null}:null)}})]}),T?.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(E,{className:"text-sm",children:"最大 Token 数"}),e.jsx(le,{type:"number",min:"1",max:"128000",value:T.max_tokens,onChange:re=>{const fe=parseInt(re.target.value);!isNaN(fe)&&fe>=1&&A(ss=>ss?{...ss,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(Fe,{id:"force_stream_mode",checked:T?.force_stream_mode||!1,onCheckedChange:re=>A(fe=>fe?{...fe,force_stream_mode:re}:null)}),e.jsx(E,{htmlFor:"force_stream_mode",className:"cursor-pointer",children:"强制流式输出模式"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{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:()=>U(!0),children:[e.jsx(pn,{className:"h-4 w-4 mr-2"}),Object.keys(T?.extra_params||{}).length>0?e.jsxs("span",{children:["已配置 ",Object.keys(T?.extra_params||{}).length," 个参数"]}):e.jsx("span",{className:"text-muted-foreground",children:"未配置额外参数"})]})}),Object.keys(T?.extra_params||{}).length>0&&e.jsxs("div",{className:"text-xs text-muted-foreground px-1",children:[Object.keys(T?.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(T?.extra_params||{}).length>3&&e.jsx("span",{children:"..."})]})]})]}),e.jsxs(st,{children:[e.jsx(_,{variant:"outline",onClick:()=>M(!1),"data-tour":"model-cancel-button",children:"取消"}),e.jsx(_,{onClick:Ms,"data-tour":"model-save-button",children:"保存"})]})]})}),e.jsx(vs,{open:ue,onOpenChange:xe,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:['确定要删除模型 "',he!==null?l[he]?.name:"",'" 吗? 此操作无法撤销。']})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:Oa,children:"删除"})]})]})}),e.jsx(vs,{open:B,onOpenChange:oe,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认批量删除"}),e.jsxs(hs,{children:["确定要删除选中的 ",z.size," 个模型吗? 此操作无法撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:W,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),e.jsx(vs,{open:Ee,onOpenChange:Z,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsxs(xs,{className:"flex items-center gap-2",children:[e.jsx(Jt,{className:"h-5 w-5 text-amber-500"}),"更换嵌入模型警告"]}),e.jsx(hs,{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(ms,{children:[e.jsx(ps,{onClick:Hs,children:"取消"}),e.jsx(fs,{onClick:Re,className:"bg-amber-600 hover:bg-amber-700",children:"确认更换"})]})]})}),e.jsx(oS,{open:J,onOpenChange:U,value:T?.extra_params||{},onChange:re=>A(fe=>fe?{...fe,extra_params:re}:null)}),e.jsx(Jn,{})]})})}const nc=tj,rc=Q0,ic=Y0,nd="/api/webui/config";async function AS(){const n=await(await we(`${nd}/adapter-config/path`)).json();return!n.success||!n.path?null:{path:n.path,lastModified:n.lastModified}}async function Tg(l){const i=await(await we(`${nd}/adapter-config/path`,{method:"POST",headers:Fs(),body:JSON.stringify({path:l})})).json();if(!i.success)throw new Error(i.message||"保存路径失败")}async function Eg(l){const i=await(await we(`${nd}/adapter-config?path=${encodeURIComponent(l)}`)).json();if(!i.success)throw new Error("读取配置文件失败");return i.content}async function Mg(l,n){const c=await(await we(`${nd}/adapter-config`,{method:"POST",headers:Fs(),body:JSON.stringify({path:l,content:n})})).json();if(!c.success)throw new Error(c.message||"保存配置失败")}const bt={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"}},Mm={oneclick:{name:"一键包",description:"使用一键包部署的适配器配置",path:"../MaiBot-Napcat-Adapter/config.toml",icon:ra},docker:{name:"Docker",description:"Docker Compose 部署的适配器配置",path:"/MaiMBot/adapters-config/config.toml",icon:e_}};function OS(l,n){let i=l.slice(0,n).split(/\r\n|\n|\r/g);return[i.length,i.pop().length+1]}function DS(l,n,i){let c=l.split(/\r\n|\n|\r/g),u="",x=(Math.log10(n+1)|0)+1;for(let h=n-1;h<=n+1;h++){let f=c[h-1];f&&(u+=h.toString().padEnd(x," "),u+=": ",u+=f,u+=` -`,h===n&&(u+=" ".repeat(x+i+2),u+=`^ -`))}return u}class ks extends Error{line;column;codeblock;constructor(n,i){const[c,u]=OS(i.toml,i.ptr),x=DS(i.toml,c,u);super(`Invalid TOML document: ${n} - -${x}`,i),this.line=c,this.column=u,this.codeblock=x}}function RS(l,n){let i=0;for(;l[n-++i]==="\\";);return--i&&i%2}function Ho(l,n=0,i=l.length){let c=l.indexOf(` -`,n);return l[c-1]==="\r"&&c--,c<=i?c:-1}function lx(l,n){for(let i=n;i-1&&i!=="'"&&RS(l,n));return n>-1&&(n+=c.length,c.length>1&&(l[n]===i&&n++,l[n]===i&&n++)),n}let LS=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}:\d{2}(?:\.\d+)?)?(Z|[-+]\d{2}:\d{2})?$/i;class Pr extends Date{#s=!1;#t=!1;#e=null;constructor(n){let i=!0,c=!0,u="Z";if(typeof n=="string"){let x=n.match(LS);x?(x[1]||(i=!1,n=`0000-01-01T${n}`),c=!!x[2],c&&n[10]===" "&&(n=n.replace(" ","T")),x[2]&&+x[2]>23?n="":(u=x[3]||null,n=n.toUpperCase(),!u&&c&&(n+="Z"))):n=""}super(n),isNaN(this.getTime())||(this.#s=i,this.#t=c,this.#e=u)}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 n=super.toISOString();if(this.isDate())return n.slice(0,10);if(this.isTime())return n.slice(11,23);if(this.#e===null)return n.slice(0,-1);if(this.#e==="Z")return n;let i=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return i=this.#e[0]==="-"?i:-i,new Date(this.getTime()-i*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(n,i="Z"){let c=new Pr(n);return c.#e=i,c}static wrapAsLocalDateTime(n){let i=new Pr(n);return i.#e=null,i}static wrapAsLocalDate(n){let i=new Pr(n);return i.#t=!1,i.#e=null,i}static wrapAsLocalTime(n){let i=new Pr(n);return i.#s=!1,i.#e=null,i}}let US=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,$S=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,BS=/^[+-]?0[0-9_]/,IS=/^[0-9a-f]{4,8}$/i,Ag={b:"\b",t:" ",n:` -`,f:"\f",r:"\r",'"':'"',"\\":"\\"};function Cv(l,n=0,i=l.length){let c=l[n]==="'",u=l[n++]===l[n]&&l[n]===l[n+1];u&&(i-=2,l[n+=2]==="\r"&&n++,l[n]===` -`&&n++);let x=0,h,f="",p=n;for(;n-1&&(lx(l,x),u=u.slice(0,x));let h=u.trimEnd();if(!c){let f=u.indexOf(` -`,h.length);if(f>-1)throw new ks("newlines are not allowed in inline tables",{toml:l,ptr:n+f})}return[h,x]}function nx(l,n,i,c,u){if(c===0)throw new ks("document contains excessively nested structures. aborting.",{toml:l,ptr:n});let x=l[n];if(x==="["||x==="{"){let[p,g]=x==="["?VS(l,n,c,u):GS(l,n,c,u),N=i?zg(l,g,",",i):g;if(g-N&&i==="}"){let v=Ho(l,g,N);if(v>-1)throw new ks("newlines are not allowed in inline tables",{toml:l,ptr:v})}return[p,N]}let h;if(x==='"'||x==="'"){h=kv(l,n);let p=Cv(l,n,h);if(i){if(h=Ol(l,h,i!=="]"),l[h]&&l[h]!==","&&l[h]!==i&&l[h]!==` -`&&l[h]!=="\r")throw new ks("unexpected character encountered",{toml:l,ptr:h});h+=+(l[h]===",")}return[p,h]}h=zg(l,n,",",i);let f=HS(l,n,h-+(l[h-1]===","),i==="]");if(!f[0])throw new ks("incomplete key-value declaration: no value specified",{toml:l,ptr:n});return i&&f[1]>-1&&(h=Ol(l,n+f[1]),h+=+(l[h]===",")),[PS(f[0],l,n,u),h]}let FS=/^[a-zA-Z0-9-_]+[ \t]*$/;function Hm(l,n,i="="){let c=n-1,u=[],x=l.indexOf(i,n);if(x<0)throw new ks("incomplete key-value: cannot find end of key",{toml:l,ptr:n});do{let h=l[n=++c];if(h!==" "&&h!==" ")if(h==='"'||h==="'"){if(h===l[n+1]&&h===l[n+2])throw new ks("multiline strings are not allowed in keys",{toml:l,ptr:n});let f=kv(l,n);if(f<0)throw new ks("unfinished string encountered",{toml:l,ptr:n});c=l.indexOf(".",f);let p=l.slice(f,c<0||c>x?x:c),g=Ho(p);if(g>-1)throw new ks("newlines are not allowed in keys",{toml:l,ptr:n+c+g});if(p.trimStart())throw new ks("found extra tokens after the string part",{toml:l,ptr:f});if(xx?x:c);if(!FS.test(f))throw new ks("only letter, numbers, dashes and underscores are allowed in keys",{toml:l,ptr:n});u.push(f.trimEnd())}}while(c+1&&cu===""||u===null||u===void 0?x:u,i={inner:{version:n(l.inner.version,bt.inner.version)},nickname:{nickname:n(l.nickname.nickname,bt.nickname.nickname)},napcat_server:{host:n(l.napcat_server.host,bt.napcat_server.host),port:n(l.napcat_server.port||0,bt.napcat_server.port),token:n(l.napcat_server.token,bt.napcat_server.token),heartbeat_interval:n(l.napcat_server.heartbeat_interval||0,bt.napcat_server.heartbeat_interval)},maibot_server:{host:n(l.maibot_server.host,bt.maibot_server.host),port:n(l.maibot_server.port||0,bt.maibot_server.port)},chat:{group_list_type:n(l.chat.group_list_type,bt.chat.group_list_type),group_list:l.chat.group_list||[],private_list_type:n(l.chat.private_list_type,bt.chat.private_list_type),private_list:l.chat.private_list||[],ban_user_id:l.chat.ban_user_id||[],ban_qq_bot:l.chat.ban_qq_bot??bt.chat.ban_qq_bot,enable_poke:l.chat.enable_poke??bt.chat.enable_poke},voice:{use_tts:l.voice.use_tts??bt.voice.use_tts},debug:{level:n(l.debug.level,bt.debug.level)}};let c=JS(i);return c=XS(c),c}catch(n){throw console.error("TOML 生成失败:",n),new Error(`无法生成 TOML 文件: ${n instanceof Error?n.message:"未知错误"}`)}}function XS(l){const n=l.split(` -`),i=[];for(let c=0;c"|?*\x00-\x1F]/.test(l)?{valid:!1,error:"路径包含非法字符"}:{valid:!0,error:""}}function ZS(){const[l,n]=d.useState("upload"),[i,c]=d.useState(null),[u,x]=d.useState(""),[h,f]=d.useState(""),[p,g]=d.useState("oneclick"),[N,v]=d.useState(""),[y,w]=d.useState(!1),[b,R]=d.useState(!1),[D,S]=d.useState(!1),[P,M]=d.useState(!1),[T,A]=d.useState(null),[F,L]=d.useState(!1),J=d.useRef(null),{toast:U}=Zs(),ue=d.useRef(null),xe=H=>{if(f(H),H.trim()){const se=Om(H);v(se.error)}else v("")},he=d.useCallback(async H=>{const se=Mm[H];R(!0);try{const Ee=await Eg(se.path),Z=zm(Ee);c(Z),g(H),f(se.path),await Tg(se.path),U({title:"加载成功",description:`已从${se.name}预设加载配置`})}catch(Ee){console.error("加载预设配置失败:",Ee),U({title:"加载失败",description:Ee instanceof Error?Ee.message:"无法读取预设配置文件",variant:"destructive"})}finally{R(!1)}},[U]),ne=d.useCallback(async H=>{const se=Om(H);if(!se.valid){v(se.error),U({title:"路径无效",description:se.error,variant:"destructive"});return}v(""),R(!0);try{const Ee=await Eg(H),Z=zm(Ee);c(Z),f(H),await Tg(H),U({title:"加载成功",description:"已从配置文件加载"})}catch(Ee){console.error("加载配置失败:",Ee),U({title:"加载失败",description:Ee instanceof Error?Ee.message:"无法读取配置文件",variant:"destructive"})}finally{R(!1)}},[U]);d.useEffect(()=>{(async()=>{try{const se=await AS();if(se&&se.path){f(se.path);const Ee=Object.entries(Mm).find(([,Z])=>Z.path===se.path);Ee?(n("preset"),g(Ee[0]),await he(Ee[0])):(n("path"),await ne(se.path))}}catch(se){console.error("加载保存的路径失败:",se)}})()},[ne,he]);const ve=d.useCallback(H=>{l!=="path"&&l!=="preset"||!h||(ue.current&&clearTimeout(ue.current),ue.current=setTimeout(async()=>{w(!0);try{const se=Am(H);await Mg(h,se),U({title:"自动保存成功",description:"配置已保存到文件"})}catch(se){console.error("自动保存失败:",se),U({title:"自动保存失败",description:se instanceof Error?se.message:"保存配置失败",variant:"destructive"})}finally{w(!1)}},1e3))},[l,h,U]),je=async()=>{if(!i||!h)return;const H=Om(h);if(!H.valid){U({title:"保存失败",description:H.error,variant:"destructive"});return}w(!0);try{const se=Am(i);await Mg(h,se),U({title:"保存成功",description:"配置已保存到文件"})}catch(se){console.error("保存失败:",se),U({title:"保存失败",description:se instanceof Error?se.message:"保存配置失败",variant:"destructive"})}finally{w(!1)}},z=async()=>{h&&await ne(h)},V=H=>{if(H!==l){if(i){A(H),S(!0);return}B(H)}},B=H=>{c(null),x(""),v(""),n(H),H==="preset"&&he("oneclick"),U({title:"已切换模式",description:{upload:"现在可以上传配置文件",path:"现在可以指定配置文件路径",preset:"现在可以使用预设配置"}[H]})},oe=()=>{T&&(B(T),A(null)),S(!1)},K=()=>{if(i){M(!0);return}_e()},_e=()=>{f(""),c(null),v(""),U({title:"已清空",description:"路径和配置已清空"})},pe=()=>{_e(),M(!1)},ke=H=>{const se=H.target.files?.[0];if(!se)return;const Ee=new FileReader;Ee.onload=Z=>{try{const Oe=Z.target?.result,ns=zm(Oe);c(ns),x(se.name),U({title:"上传成功",description:`已加载配置文件:${se.name}`})}catch(Oe){console.error("解析配置文件失败:",Oe),U({title:"解析失败",description:"配置文件格式错误,请检查文件内容",variant:"destructive"})}},Ee.readAsText(se)},O=()=>{if(!i)return;const H=Am(i),se=new Blob([H],{type:"text/plain;charset=utf-8"}),Ee=URL.createObjectURL(se),Z=document.createElement("a");Z.href=Ee,Z.download=u||"config.toml",document.body.appendChild(Z),Z.click(),document.body.removeChild(Z),URL.revokeObjectURL(Ee),U({title:"下载成功",description:"配置文件已下载,请手动覆盖并重启适配器"})},k=()=>{c(JSON.parse(JSON.stringify(bt))),x("config.toml"),U({title:"已加载默认配置",description:"可以开始编辑配置"})};return e.jsx(Ye,{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(_t,{className:"h-4 w-4 mt-0.5 flex-shrink-0"}),e.jsx("p",{className:"text-sm",children:"适配器配置保存之后使用 WebUI 的重启功能适配器并不会重启,需要手动重启适配器。"})]}),e.jsx(nc,{open:F,onOpenChange:L,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(Le,{children:"工作模式"}),e.jsx(ws,{children:"选择配置文件的管理方式"})]}),e.jsx(rc,{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 ${F?"transform rotate-180":""}`}),e.jsx("span",{className:"sr-only",children:"切换"})]})})]})}),e.jsx(ic,{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 ${l==="preset"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>V("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 ${l==="upload"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>V("upload"),children:e.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[e.jsx(ec,{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 ${l==="path"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>V("path"),children:e.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[e.jsx(s_,{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:"指定配置文件路径,自动加载和保存"})]})]})})]}),l==="preset"&&e.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[e.jsx(E,{className:"text-sm md:text-base",children:"选择部署方式"}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:Object.entries(Mm).map(([H,se])=>{const Ee=se.icon,Z=p===H;return e.jsx("div",{className:`border-2 rounded-lg p-3 cursor-pointer transition-all ${Z?"border-primary bg-primary/5":"border-muted hover:border-primary/50"}`,onClick:()=>{g(H),he(H)},children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Ee,{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:se.name}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:se.description}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 font-mono break-all",children:se.path})]})]})},H)})})]}),l==="path"&&e.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{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(le,{id:"config-path",value:h,onChange:H=>xe(H.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:()=>ne(h),disabled:b||!h||!!N,className:"w-full sm:w-auto",children:b?e.jsxs(e.Fragment,{children:[e.jsx(dt,{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(at,{children:[e.jsx(Ht,{className:"h-4 w-4"}),e.jsx(lt,{children:l==="preset"?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"预设模式:"}),"选择预设的部署方式,配置会自动加载,修改后 1 秒自动保存",y&&" (正在保存...)"]}):l==="upload"?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"上传文件模式:"}),"上传配置文件 → 在线编辑 → 下载文件 → 手动覆盖并重启适配器"]}):e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"指定路径模式:"}),"指定配置文件路径后,配置会自动加载,修改后 1 秒自动保存",y&&" (正在保存...)"]})})]}),l==="upload"&&!i&&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:ke}),e.jsxs(_,{onClick:()=>J.current?.click(),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(ec,{className:"mr-2 h-4 w-4"}),"上传配置"]}),e.jsxs(_,{onClick:k,size:"sm",className:"w-full sm:w-auto",children:[e.jsx(Ca,{className:"mr-2 h-4 w-4"}),"使用默认配置"]})]}),l==="upload"&&i&&e.jsx("div",{className:"flex gap-2",children:e.jsxs(_,{onClick:O,size:"sm",className:"w-full sm:w-auto",children:[e.jsx(sa,{className:"mr-2 h-4 w-4"}),"下载配置"]})}),(l==="preset"||l==="path")&&i&&e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs(_,{onClick:je,size:"sm",disabled:y||!!N,className:"w-full sm:w-auto",children:[e.jsx(oc,{className:"mr-2 h-4 w-4"}),y?"保存中...":"立即保存"]}),e.jsxs(_,{onClick:z,size:"sm",variant:"outline",disabled:b,className:"w-full sm:w-auto",children:[e.jsx(dt,{className:`mr-2 h-4 w-4 ${b?"animate-spin":""}`}),"刷新"]}),l==="path"&&e.jsxs(_,{onClick:K,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(ls,{className:"mr-2 h-4 w-4"}),"清空路径"]})]}),i?e.jsxs(ta,{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(Xt,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5",children:[e.jsxs(Je,{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(Je,{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(Je,{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(Je,{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(Je,{value:"debug",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:"调试"})]})}),e.jsx(ys,{value:"napcat",className:"space-y-4",children:e.jsx(WS,{config:i,onChange:H=>{c(H),ve(H)}})}),e.jsx(ys,{value:"maibot",className:"space-y-4",children:e.jsx(e4,{config:i,onChange:H=>{c(H),ve(H)}})}),e.jsx(ys,{value:"chat",className:"space-y-4",children:e.jsx(s4,{config:i,onChange:H=>{c(H),ve(H)}})}),e.jsx(ys,{value:"voice",className:"space-y-4",children:e.jsx(t4,{config:i,onChange:H=>{c(H),ve(H)}})}),e.jsx(ys,{value:"debug",className:"space-y-4",children:e.jsx(a4,{config:i,onChange:H=>{c(H),ve(H)}})})]}):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(Ca,{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:l==="preset"?"请选择预设的部署方式":l==="upload"?"请上传现有配置文件,或使用默认配置开始编辑":"请指定配置文件路径并点击加载按钮"})]})]})}),e.jsx(vs,{open:D,onOpenChange:S,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认切换模式"}),e.jsxs(hs,{children:["切换模式将清空当前配置,确定要继续吗?",e.jsx("br",{}),e.jsx("span",{className:"text-destructive font-medium",children:"请确保已保存重要配置"})]})]}),e.jsxs(ms,{children:[e.jsx(ps,{onClick:()=>{S(!1),A(null)},children:"取消"}),e.jsx(fs,{onClick:oe,children:"确认切换"})]})]})}),e.jsx(vs,{open:P,onOpenChange:M,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认清空路径"}),e.jsxs(hs,{children:["清空路径将清除当前配置,确定要继续吗?",e.jsx("br",{}),e.jsx("span",{className:"text-muted-foreground text-sm",children:"此操作不会删除配置文件,只是清除界面中的配置"})]})]}),e.jsxs(ms,{children:[e.jsx(ps,{onClick:()=>M(!1),children:"取消"}),e.jsx(fs,{onClick:pe,className:"bg-destructive hover:bg-destructive/90",children:"确认清空"})]})]})})]})})}function WS({config:l,onChange:n}){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(E,{htmlFor:"napcat-host",className:"text-sm md:text-base",children:"主机地址"}),e.jsx(le,{id:"napcat-host",value:l.napcat_server.host,onChange:i=>n({...l,napcat_server:{...l.napcat_server,host:i.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(E,{htmlFor:"napcat-port",className:"text-sm md:text-base",children:"端口"}),e.jsx(le,{id:"napcat-port",type:"number",value:l.napcat_server.port||"",onChange:i=>n({...l,napcat_server:{...l.napcat_server,port:i.target.value?parseInt(i.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(E,{htmlFor:"napcat-token",className:"text-sm md:text-base",children:"访问令牌(Token)"}),e.jsx(le,{id:"napcat-token",type:"password",value:l.napcat_server.token,onChange:i=>n({...l,napcat_server:{...l.napcat_server,token:i.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(E,{htmlFor:"napcat-heartbeat",className:"text-sm md:text-base",children:"心跳间隔(秒)"}),e.jsx(le,{id:"napcat-heartbeat",type:"number",value:l.napcat_server.heartbeat_interval||"",onChange:i=>n({...l,napcat_server:{...l.napcat_server,heartbeat_interval:i.target.value?parseInt(i.target.value):0}}),placeholder:"30",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"与 Napcat 设置的心跳间隔保持一致(留空使用默认值 30)"})]})]})]})})}function e4({config:l,onChange:n}){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(E,{htmlFor:"maibot-host",className:"text-sm md:text-base",children:"主机地址"}),e.jsx(le,{id:"maibot-host",value:l.maibot_server.host,onChange:i=>n({...l,maibot_server:{...l.maibot_server,host:i.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(E,{htmlFor:"maibot-port",className:"text-sm md:text-base",children:"端口"}),e.jsx(le,{id:"maibot-port",type:"number",value:l.maibot_server.port||"",onChange:i=>n({...l,maibot_server:{...l.maibot_server,port:i.target.value?parseInt(i.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 s4({config:l,onChange:n}){const i=x=>{const h={...l};x==="group"?h.chat.group_list=[...h.chat.group_list,0]:x==="private"?h.chat.private_list=[...h.chat.private_list,0]:h.chat.ban_user_id=[...h.chat.ban_user_id,0],n(h)},c=(x,h)=>{const f={...l};x==="group"?f.chat.group_list=f.chat.group_list.filter((p,g)=>g!==h):x==="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),n(f)},u=(x,h,f)=>{const p={...l};x==="group"?p.chat.group_list[h]=f:x==="private"?p.chat.private_list[h]=f:p.chat.ban_user_id[h]=f,n(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(E,{className:"text-sm md:text-base",children:"群组名单类型"}),e.jsxs(Ie,{value:l.chat.group_list_type,onValueChange:x=>n({...l,chat:{...l.chat,group_list_type:x}}),children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(X,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),e.jsx(X,{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(E,{className:"text-sm md:text-base",children:"群组列表"}),e.jsxs(_,{onClick:()=>i("group"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(Ca,{className:"mr-1 h-4 w-4"}),"添加群号"]})]}),l.chat.group_list.map((x,h)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(le,{type:"number",value:x,onChange:f=>u("group",h,parseInt(f.target.value)||0),placeholder:"输入群号",className:"text-sm md:text-base"}),e.jsxs(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(ls,{className:"h-4 w-4"})})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:["确定要删除群号 ",x," 吗?此操作无法撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>c("group",h),children:"删除"})]})]})]})]},h)),l.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(E,{className:"text-sm md:text-base",children:"私聊名单类型"}),e.jsxs(Ie,{value:l.chat.private_list_type,onValueChange:x=>n({...l,chat:{...l.chat,private_list_type:x}}),children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(X,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),e.jsx(X,{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(E,{className:"text-sm md:text-base",children:"私聊列表"}),e.jsxs(_,{onClick:()=>i("private"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(Ca,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),l.chat.private_list.map((x,h)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(le,{type:"number",value:x,onChange:f=>u("private",h,parseInt(f.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),e.jsxs(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(ls,{className:"h-4 w-4"})})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:["确定要删除用户 ",x," 吗?此操作无法撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>c("private",h),children:"删除"})]})]})]})]},h)),l.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(E,{className:"text-sm md:text-base",children:"全局禁止名单"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"名单中的用户无法进行任何聊天"})]}),e.jsxs(_,{onClick:()=>i("ban"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(Ca,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),l.chat.ban_user_id.map((x,h)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(le,{type:"number",value:x,onChange:f=>u("ban",h,parseInt(f.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),e.jsxs(vs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(ls,{className:"h-4 w-4"})})}),e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:["确定要从全局禁止名单中删除用户 ",x," 吗?此操作无法撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>c("ban",h),children:"删除"})]})]})]})]},h)),l.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(E,{className:"text-sm md:text-base",children:"屏蔽QQ官方机器人"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否屏蔽来自QQ官方机器人的消息"})]}),e.jsx(Fe,{checked:l.chat.ban_qq_bot,onCheckedChange:x=>n({...l,chat:{...l.chat,ban_qq_bot:x}})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(E,{className:"text-sm md:text-base",children:"启用戳一戳功能"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否响应戳一戳消息"})]}),e.jsx(Fe,{checked:l.chat.enable_poke,onCheckedChange:x=>n({...l,chat:{...l.chat,enable_poke:x}})})]})]})]})})}function t4({config:l,onChange:n}){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(E,{className:"text-sm md:text-base",children:"使用 TTS 语音"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"请确保已配置 TTS 并有对应的适配器"})]}),e.jsx(Fe,{checked:l.voice.use_tts,onCheckedChange:i=>n({...l,voice:{use_tts:i}})})]})]})})}function a4({config:l,onChange:n}){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(E,{className:"text-sm md:text-base",children:"日志等级"}),e.jsxs(Ie,{value:l.debug.level,onValueChange:i=>n({...l,debug:{level:i}}),children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(X,{value:"DEBUG",children:"DEBUG(调试)"}),e.jsx(X,{value:"INFO",children:"INFO(信息)"}),e.jsx(X,{value:"WARNING",children:"WARNING(警告)"}),e.jsx(X,{value:"ERROR",children:"ERROR(错误)"}),e.jsx(X,{value:"CRITICAL",children:"CRITICAL(严重)"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"设置适配器的日志输出等级"})]})})]})})}const l4=["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"],n4=/^(aria-|data-)/,Mv=l=>Object.fromEntries(Object.entries(l).filter(([n])=>n4.test(n)||l4.includes(n)));function r4(l,n){const i=Mv(l);return Object.keys(l).some(c=>!Object.hasOwn(i,c)&&l[c]!==n[c])}class i4 extends d.Component{container;plugin;componentDidMount(){this.installPlugin()}componentDidUpdate(n){if(n.uppy!==this.props.uppy)this.uninstallPlugin(n),this.installPlugin();else if(r4(this.props,n)){const{uppy:i,...c}={...this.props,target:this.container};this.plugin.setOptions(c)}}componentWillUnmount(){this.uninstallPlugin()}installPlugin(){const{uppy:n,...i}={id:"Dashboard",...this.props,inline:!0,target:this.container};n.use(L_,i),this.plugin=n.getPlugin(i.id)}uninstallPlugin(n=this.props){const{uppy:i}=n;i.removePlugin(this.plugin)}render(){return d.createElement("div",{className:"uppy-Container",ref:n=>{this.container=n},...Mv(this.props)})}}function c4({src:l,alt:n="表情包",className:i,maxRetries:c=5,retryInterval:u=1500}){const[x,h]=d.useState("loading"),[f,p]=d.useState(0),[g,N]=d.useState(null),[v,y]=d.useState(l);l!==v&&(h("loading"),p(0),N(null),y(l));const w=d.useCallback(async()=>{try{const b=await fetch(l,{credentials:"include"});if(b.status===202){h("generating"),f{p(S=>S+1)},u):h("error");return}if(!b.ok){h("error");return}const R=await b.blob(),D=URL.createObjectURL(R);N(D),h("loaded")}catch(b){console.error("加载缩略图失败:",b),h("error")}},[l,f,c,u]);return d.useEffect(()=>{w()},[w]),d.useEffect(()=>()=>{g&&URL.revokeObjectURL(g)},[g]),x==="loading"||x==="generating"?e.jsx(js,{className:I("w-full h-full",i)}):x==="error"||!g?e.jsx("div",{className:I("w-full h-full flex items-center justify-center bg-muted",i),children:e.jsx(Jm,{className:"h-8 w-8 text-muted-foreground"})}):e.jsx("img",{src:g,alt:n,className:I("w-full h-full object-contain",i)})}function o4({children:l,className:n}){return e.jsx(tx,{content:l,className:n})}const Ka="/api/webui/emoji";async function d4(l){const n=new URLSearchParams;l.page&&n.append("page",l.page.toString()),l.page_size&&n.append("page_size",l.page_size.toString()),l.search&&n.append("search",l.search),l.is_registered!==void 0&&n.append("is_registered",l.is_registered.toString()),l.is_banned!==void 0&&n.append("is_banned",l.is_banned.toString()),l.format&&n.append("format",l.format),l.sort_by&&n.append("sort_by",l.sort_by),l.sort_order&&n.append("sort_order",l.sort_order);const i=await we(`${Ka}/list?${n}`,{});if(!i.ok)throw new Error(`获取表情包列表失败: ${i.statusText}`);return i.json()}async function u4(l){const n=await we(`${Ka}/${l}`,{});if(!n.ok)throw new Error(`获取表情包详情失败: ${n.statusText}`);return n.json()}async function m4(l,n){const i=await we(`${Ka}/${l}`,{method:"PATCH",body:JSON.stringify(n)});if(!i.ok)throw new Error(`更新表情包失败: ${i.statusText}`);return i.json()}async function x4(l){const n=await we(`${Ka}/${l}`,{method:"DELETE"});if(!n.ok)throw new Error(`删除表情包失败: ${n.statusText}`);return n.json()}async function h4(){const l=await we(`${Ka}/stats/summary`,{});if(!l.ok)throw new Error(`获取统计数据失败: ${l.statusText}`);return l.json()}async function f4(l){const n=await we(`${Ka}/${l}/register`,{method:"POST"});if(!n.ok)throw new Error(`注册表情包失败: ${n.statusText}`);return n.json()}async function p4(l){const n=await we(`${Ka}/${l}/ban`,{method:"POST"});if(!n.ok)throw new Error(`封禁表情包失败: ${n.statusText}`);return n.json()}function g4(l,n=!1){return n?`${Ka}/${l}/thumbnail?original=true`:`${Ka}/${l}/thumbnail`}function j4(l){return`${Ka}/${l}/thumbnail?original=true`}async function v4(l){const n=await we(`${Ka}/batch/delete`,{method:"POST",body:JSON.stringify({emoji_ids:l})});if(!n.ok){const i=await n.json();throw new Error(i.detail||"批量删除失败")}return n.json()}function N4(){return`${Ka}/upload`}function b4(){const[l,n]=d.useState([]),[i,c]=d.useState(null),[u,x]=d.useState(!1),[h,f]=d.useState(1),[p,g]=d.useState(0),[N,v]=d.useState(20),[y,w]=d.useState("all"),[b,R]=d.useState("all"),[D,S]=d.useState("all"),[P,M]=d.useState("usage_count"),[T,A]=d.useState("desc"),[F,L]=d.useState(null),[J,U]=d.useState(!1),[ue,xe]=d.useState(!1),[he,ne]=d.useState(!1),[ve,je]=d.useState(new Set),[z,V]=d.useState(!1),[B,oe]=d.useState(""),[K,_e]=d.useState("medium"),[pe,ke]=d.useState(!1),{toast:O}=Zs(),k=d.useCallback(async()=>{try{x(!0);const de=await d4({page:h,page_size:N,is_registered:y==="all"?void 0:y==="registered",is_banned:b==="all"?void 0:b==="banned",format:D==="all"?void 0:D,sort_by:P,sort_order:T});n(de.data),g(de.total)}catch(de){const Me=de instanceof Error?de.message:"加载表情包列表失败";O({title:"错误",description:Me,variant:"destructive"})}finally{x(!1)}},[h,N,y,b,D,P,T,O]),H=async()=>{try{const de=await h4();c(de.data)}catch(de){console.error("加载统计数据失败:",de)}};d.useEffect(()=>{k()},[k]),d.useEffect(()=>{H()},[]);const se=async de=>{try{const Me=await u4(de.id);L(Me.data),U(!0)}catch(Me){const rs=Me instanceof Error?Me.message:"加载详情失败";O({title:"错误",description:rs,variant:"destructive"})}},Ee=de=>{L(de),xe(!0)},Z=de=>{L(de),ne(!0)},Oe=async()=>{if(F)try{await x4(F.id),O({title:"成功",description:"表情包已删除"}),ne(!1),L(null),k(),H()}catch(de){const Me=de instanceof Error?de.message:"删除失败";O({title:"错误",description:Me,variant:"destructive"})}},ns=async de=>{try{await f4(de.id),O({title:"成功",description:"表情包已注册"}),k(),H()}catch(Me){const rs=Me instanceof Error?Me.message:"注册失败";O({title:"错误",description:rs,variant:"destructive"})}},Q=async de=>{try{await p4(de.id),O({title:"成功",description:"表情包已封禁"}),k(),H()}catch(Me){const rs=Me instanceof Error?Me.message:"封禁失败";O({title:"错误",description:rs,variant:"destructive"})}},ee=de=>{const Me=new Set(ve);Me.has(de)?Me.delete(de):Me.add(de),je(Me)},Ue=async()=>{try{const de=await v4(Array.from(ve));O({title:"批量删除完成",description:de.message}),je(new Set),V(!1),k(),H()}catch(de){O({title:"批量删除失败",description:de instanceof Error?de.message:"批量删除失败",variant:"destructive"})}},ie=()=>{const de=parseInt(B),Me=Math.ceil(p/N);de>=1&&de<=Me?(f(de),oe("")):O({title:"无效的页码",description:`请输入1-${Me}之间的页码`,variant:"destructive"})},Te=i?.formats?Object.keys(i.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:()=>ke(!0),className:"gap-2",children:[e.jsx(ec,{className:"h-4 w-4"}),"上传表情包"]})]}),e.jsx(Ye,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[i&&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(ws,{children:"总数"}),e.jsx(Le,{className:"text-2xl",children:i.total})]})}),e.jsx(Ce,{children:e.jsxs(De,{className:"pb-2",children:[e.jsx(ws,{children:"已注册"}),e.jsx(Le,{className:"text-2xl text-green-600",children:i.registered})]})}),e.jsx(Ce,{children:e.jsxs(De,{className:"pb-2",children:[e.jsx(ws,{children:"已封禁"}),e.jsx(Le,{className:"text-2xl text-red-600",children:i.banned})]})}),e.jsx(Ce,{children:e.jsxs(De,{className:"pb-2",children:[e.jsx(ws,{children:"未注册"}),e.jsx(Le,{className:"text-2xl text-gray-600",children:i.unregistered})]})})]}),e.jsxs(Ce,{children:[e.jsx(De,{children:e.jsxs(Le,{className:"flex items-center gap-2",children:[e.jsx(zo,{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(E,{children:"排序方式"}),e.jsxs(Ie,{value:`${P}-${T}`,onValueChange:de=>{const[Me,rs]=de.split("-");M(Me),A(rs),f(1)},children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(X,{value:"usage_count-desc",children:"使用次数 (多→少)"}),e.jsx(X,{value:"usage_count-asc",children:"使用次数 (少→多)"}),e.jsx(X,{value:"register_time-desc",children:"注册时间 (新→旧)"}),e.jsx(X,{value:"register_time-asc",children:"注册时间 (旧→新)"}),e.jsx(X,{value:"record_time-desc",children:"记录时间 (新→旧)"}),e.jsx(X,{value:"record_time-asc",children:"记录时间 (旧→新)"}),e.jsx(X,{value:"last_used_time-desc",children:"最后使用 (新→旧)"}),e.jsx(X,{value:"last_used_time-asc",children:"最后使用 (旧→新)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:"注册状态"}),e.jsxs(Ie,{value:y,onValueChange:de=>{w(de),f(1)},children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(X,{value:"all",children:"全部"}),e.jsx(X,{value:"registered",children:"已注册"}),e.jsx(X,{value:"unregistered",children:"未注册"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:"封禁状态"}),e.jsxs(Ie,{value:b,onValueChange:de=>{R(de),f(1)},children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(X,{value:"all",children:"全部"}),e.jsx(X,{value:"banned",children:"已封禁"}),e.jsx(X,{value:"unbanned",children:"未封禁"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:"格式"}),e.jsxs(Ie,{value:D,onValueChange:de=>{S(de),f(1)},children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(X,{value:"all",children:"全部"}),Te.map(de=>e.jsxs(X,{value:de,children:[de.toUpperCase()," (",i?.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:[ve.size>0&&e.jsxs("span",{className:"text-sm text-muted-foreground",children:["已选择 ",ve.size," 个表情包"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(E,{className:"text-sm whitespace-nowrap",children:"卡片大小"}),e.jsxs(Ie,{value:K,onValueChange:de=>_e(de),children:[e.jsx($e,{className:"w-24",children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(X,{value:"small",children:"小"}),e.jsx(X,{value:"medium",children:"中"}),e.jsx(X,{value:"large",children:"大"})]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(E,{htmlFor:"emoji-page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Ie,{value:N.toString(),onValueChange:de=>{v(parseInt(de)),f(1),je(new Set)},children:[e.jsx($e,{id:"emoji-page-size",className:"w-20",children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(X,{value:"20",children:"20"}),e.jsx(X,{value:"40",children:"40"}),e.jsx(X,{value:"60",children:"60"}),e.jsx(X,{value:"100",children:"100"})]})]}),ve.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>je(new Set),children:"取消选择"}),e.jsxs(_,{variant:"destructive",size:"sm",onClick:()=>V(!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:k,disabled:u,children:[e.jsx(dt,{className:`h-4 w-4 mr-2 ${u?"animate-spin":""}`}),"刷新"]})})]})]}),e.jsxs(Ce,{children:[e.jsxs(De,{children:[e.jsx(Le,{children:"表情包列表"}),e.jsxs(ws,{children:["共 ",p," 个表情包,当前第 ",h," 页"]})]}),e.jsxs(Ae,{children:[l.length===0?e.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"暂无数据"}):e.jsx("div",{className:`grid gap-3 ${K==="small"?"grid-cols-3 sm:grid-cols-4 md:grid-cols-6 lg:grid-cols-8 xl:grid-cols-10":K==="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:l.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 ${ve.has(de.id)?"ring-2 ring-primary bg-primary/5":""}`,onClick:()=>ee(de.id),children:[e.jsx("div",{className:`absolute top-1 left-1 z-10 transition-opacity ${ve.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 ${ve.has(de.id)?"bg-primary border-primary text-primary-foreground":"bg-background/80 border-muted-foreground/50"}`,children:ve.has(de.id)&&e.jsx(pt,{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(Se,{variant:"default",className:"bg-green-600 text-[10px] px-1 py-0",children:"已注册"}),de.is_banned&&e.jsx(Se,{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 ${K==="small"?"p-1":K==="medium"?"p-2":"p-3"}`,children:e.jsx(c4,{src:g4(de.id),alt:"表情包"})}),e.jsxs("div",{className:`border-t bg-card ${K==="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(Se,{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 ${K==="small"?"flex-wrap":""}`,children:[e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Me=>{Me.stopPropagation(),Ee(de)},title:"编辑",children:e.jsx(qn,{className:"h-3 w-3"})}),e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Me=>{Me.stopPropagation(),se(de)},title:"详情",children:e.jsx(Ht,{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:Me=>{Me.stopPropagation(),ns(de)},title:"注册",children:e.jsx(pt,{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:Me=>{Me.stopPropagation(),Q(de)},title:"封禁",children:e.jsx(t_,{className:"h-3 w-3"})}),e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6 text-red-600 hover:text-red-700",onClick:Me=>{Me.stopPropagation(),Z(de)},title:"删除",children:e.jsx(ls,{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(gn,{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(Aa,{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(le,{type:"number",value:B,onChange:de=>oe(de.target.value),onKeyDown:de=>de.key==="Enter"&&ie(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(p/N)}),e.jsx(_,{variant:"outline",size:"sm",onClick:ie,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(Zt,{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(jn,{className:"h-4 w-4"})})]})]})]})]}),e.jsx(y4,{emoji:F,open:J,onOpenChange:U}),e.jsx(w4,{emoji:F,open:ue,onOpenChange:xe,onSuccess:()=>{k(),H()}}),e.jsx(_4,{open:pe,onOpenChange:ke,onSuccess:()=>{k(),H()}})]})}),e.jsx(vs,{open:z,onOpenChange:V,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认批量删除"}),e.jsxs(hs,{children:["你确定要删除选中的 ",ve.size," 个表情包吗?此操作不可撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:Ue,children:"确认删除"})]})]})}),e.jsx(Is,{open:he,onOpenChange:ne,children:e.jsxs(Os,{children:[e.jsxs(Ds,{children:[e.jsx(Rs,{children:"确认删除"}),e.jsx(Ks,{children:"确定要删除这个表情包吗?此操作无法撤销。"})]}),e.jsxs(st,{children:[e.jsx(_,{variant:"outline",onClick:()=>ne(!1),children:"取消"}),e.jsx(_,{variant:"destructive",onClick:Oe,children:"删除"})]})]})})]})}function y4({emoji:l,open:n,onOpenChange:i}){if(!l)return null;const c=u=>u?new Date(u*1e3).toLocaleString("zh-CN"):"-";return e.jsx(Is,{open:n,onOpenChange:i,children:e.jsxs(Os,{className:"max-w-2xl max-h-[90vh]",children:[e.jsx(Ds,{children:e.jsx(Rs,{children:"表情包详情"})}),e.jsx(Ye,{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:j4(l.id),alt:l.description||"表情包",className:"w-full h-full object-cover",onError:u=>{const x=u.target;x.style.display="none";const h=x.parentElement;h&&(h.innerHTML='')}})})}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(E,{className:"text-muted-foreground",children:"ID"}),e.jsx("div",{className:"mt-1 font-mono",children:l.id})]}),e.jsxs("div",{children:[e.jsx(E,{className:"text-muted-foreground",children:"格式"}),e.jsx("div",{className:"mt-1",children:e.jsx(Se,{variant:"outline",children:l.format.toUpperCase()})})]})]}),e.jsxs("div",{children:[e.jsx(E,{className:"text-muted-foreground",children:"文件路径"}),e.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:l.full_path})]}),e.jsxs("div",{children:[e.jsx(E,{className:"text-muted-foreground",children:"哈希值"}),e.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:l.emoji_hash})]}),e.jsxs("div",{children:[e.jsx(E,{className:"text-muted-foreground",children:"描述"}),l.description?e.jsx("div",{className:"mt-1 rounded-lg border bg-muted/50 p-3",children:e.jsx(o4,{className:"prose-sm",children:l.description})}):e.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:"-"})]}),e.jsxs("div",{children:[e.jsx(E,{className:"text-muted-foreground",children:"情绪"}),e.jsx("div",{className:"mt-1",children:l.emotion?e.jsx("span",{className:"text-sm",children:l.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(E,{className:"text-muted-foreground",children:"状态"}),e.jsxs("div",{className:"mt-2 flex gap-2",children:[l.is_registered&&e.jsx(Se,{variant:"default",className:"bg-green-600",children:"已注册"}),l.is_banned&&e.jsx(Se,{variant:"destructive",children:"已封禁"}),!l.is_registered&&!l.is_banned&&e.jsx(Se,{variant:"outline",children:"未注册"})]})]}),e.jsxs("div",{children:[e.jsx(E,{className:"text-muted-foreground",children:"使用次数"}),e.jsx("div",{className:"mt-1 font-mono text-lg",children:l.usage_count})]})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(E,{className:"text-muted-foreground",children:"记录时间"}),e.jsx("div",{className:"mt-1 text-sm",children:c(l.record_time)})]}),e.jsxs("div",{children:[e.jsx(E,{className:"text-muted-foreground",children:"注册时间"}),e.jsx("div",{className:"mt-1 text-sm",children:c(l.register_time)})]})]}),e.jsxs("div",{children:[e.jsx(E,{className:"text-muted-foreground",children:"最后使用"}),e.jsx("div",{className:"mt-1 text-sm",children:c(l.last_used_time)})]})]})})]})})}function w4({emoji:l,open:n,onOpenChange:i,onSuccess:c}){const[u,x]=d.useState(""),[h,f]=d.useState(!1),[p,g]=d.useState(!1),[N,v]=d.useState(!1),{toast:y}=Zs();d.useEffect(()=>{l&&(x(l.emotion||""),f(l.is_registered),g(l.is_banned))},[l]);const w=async()=>{if(l)try{v(!0);const b=u.split(/[,,]/).map(R=>R.trim()).filter(Boolean).join(",");await m4(l.id,{emotion:b||void 0,is_registered:h,is_banned:p}),y({title:"成功",description:"表情包信息已更新"}),i(!1),c()}catch(b){const R=b instanceof Error?b.message:"保存失败";y({title:"错误",description:R,variant:"destructive"})}finally{v(!1)}};return l?e.jsx(Is,{open:n,onOpenChange:i,children:e.jsxs(Os,{className:"max-w-2xl",children:[e.jsxs(Ds,{children:[e.jsx(Rs,{children:"编辑表情包"}),e.jsx(Ks,{children:"修改表情包的情绪和状态信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(E,{children:"情绪"}),e.jsx(ot,{value:u,onChange:b=>x(b.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(qs,{id:"is_registered",checked:h,onCheckedChange:b=>{b===!0?(f(!0),g(!1)):f(!1)}}),e.jsx(E,{htmlFor:"is_registered",className:"cursor-pointer",children:"已注册"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qs,{id:"is_banned",checked:p,onCheckedChange:b=>{b===!0?(g(!0),f(!1)):g(!1)}}),e.jsx(E,{htmlFor:"is_banned",className:"cursor-pointer",children:"已封禁"})]})]})]}),e.jsxs(st,{children:[e.jsx(_,{variant:"outline",onClick:()=>i(!1),children:"取消"}),e.jsx(_,{onClick:w,disabled:N,children:N?"保存中...":"保存"})]})]})}):null}function _4({open:l,onOpenChange:n,onSuccess:i}){const[c,u]=d.useState("select"),[x,h]=d.useState([]),[f,p]=d.useState(null),[g,N]=d.useState(!1),{toast:v}=Zs(),y=d.useMemo(()=>new U_({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}"}}}),[]);d.useEffect(()=>{const F=()=>{const L=y.getFiles();if(L.length===0)return;const J=L.map(U=>({id:U.id,name:U.name,previewUrl:U.preview||URL.createObjectURL(U.data),emotion:"",description:"",isRegistered:!0,file:U.data}));h(J),L.length===1?(p(J[0].id),u("edit-single")):u("edit-multiple")};return y.on("upload",F),()=>{y.off("upload",F)}},[y]),d.useEffect(()=>{l||(y.cancelAll(),u("select"),h([]),p(null),N(!1))},[l,y]);const w=d.useCallback((F,L)=>{h(J=>J.map(U=>U.id===F?{...U,...L}:U))},[]),b=d.useCallback(F=>F.emotion.trim().length>0,[]),R=d.useMemo(()=>x.length>0&&x.every(b),[x,b]),D=d.useMemo(()=>x.find(F=>F.id===f)||null,[x,f]),S=d.useCallback(()=>{(c==="edit-single"||c==="edit-multiple")&&(u("select"),h([]),p(null))},[c]),P=d.useCallback(async()=>{if(!R){v({title:"请填写必填项",description:"每个表情包的情感标签都是必填的",variant:"destructive"});return}N(!0);let F=0,L=0;try{for(const J of x){const U=new FormData;U.append("file",J.file),U.append("emotion",J.emotion),U.append("description",J.description),U.append("is_registered",J.isRegistered.toString());try{(await we(N4(),{method:"POST",body:U})).ok?F++:L++}catch{L++}}L===0?(v({title:"上传成功",description:`成功上传 ${F} 个表情包`}),n(!1),i()):(v({title:"部分上传失败",description:`成功 ${F} 个,失败 ${L} 个`,variant:"destructive"}),i())}finally{N(!1)}},[R,x,v,n,i]),M=()=>e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"border rounded-lg overflow-hidden w-full",children:e.jsx(i4,{uppy:y,proudlyDisplayPoweredByUppy:!1,hideProgressDetails:!0,height:350,width:"100%",theme:"auto",note:"支持 JPG、PNG、GIF、WebP 格式,最多 20 个文件"})})}),T=()=>{const F=x[0];return F?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(Ta,{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:F.previewUrl,alt:F.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:F.name})]}),e.jsxs("div",{className:"flex-1 space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(E,{htmlFor:"single-emotion",children:["情感标签 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(le,{id:"single-emotion",value:F.emotion,onChange:L=>w(F.id,{emotion:L.target.value}),placeholder:"多个标签用逗号分隔,如:开心,高兴",className:F.emotion.trim()?"":"border-destructive"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"用于情感匹配,多个标签用逗号分隔"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"single-description",children:"描述"}),e.jsx(le,{id:"single-description",value:F.description,onChange:L=>w(F.id,{description:L.target.value}),placeholder:"输入表情包描述..."})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qs,{id:"single-is-registered",checked:F.isRegistered,onCheckedChange:L=>w(F.id,{isRegistered:L===!0})}),e.jsx(E,{htmlFor:"single-is-registered",className:"cursor-pointer",children:"上传后立即注册(可被麦麦使用)"})]})]})]}),e.jsx(st,{children:e.jsx(_,{onClick:P,disabled:!R||g,children:g?"上传中...":"上传"})})]}):null},A=()=>{const F=x.filter(b).length,L=x.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(Ta,{className:"h-4 w-4 mr-1"}),"返回"]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["编辑表情包信息(",F,"/",L," 已完成)"]})]}),e.jsx(Se,{variant:R?"default":"secondary",children:R?e.jsxs(e.Fragment,{children:[e.jsx(Ct,{className:"h-3 w-3 mr-1"}),"全部完成"]}):e.jsxs(e.Fragment,{children:[e.jsx(Ea,{className:"h-3 w-3 mr-1"}),"未完成"]})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Ye,{className:"h-[350px] pr-2",children:e.jsx("div",{className:"space-y-2",children:x.map(J=>{const U=b(J),ue=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 - ${ue?"ring-2 ring-primary":""} - ${U?"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||"未填写情感标签"})]}),U?e.jsx(pt,{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:D?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:D.previewUrl,alt:D.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:D.name}),b(D)&&e.jsxs(Se,{variant:"outline",className:"text-green-600 border-green-600",children:[e.jsx(Ct,{className:"h-3 w-3 mr-1"}),"已完成"]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(E,{htmlFor:"multi-emotion",children:["情感标签 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(le,{id:"multi-emotion",value:D.emotion,onChange:J=>w(D.id,{emotion:J.target.value}),placeholder:"多个标签用逗号分隔,如:开心,高兴",className:D.emotion.trim()?"":"border-destructive"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"multi-description",children:"描述"}),e.jsx(le,{id:"multi-description",value:D.description,onChange:J=>w(D.id,{description:J.target.value}),placeholder:"输入表情包描述..."})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qs,{id:"multi-is-registered",checked:D.isRegistered,onCheckedChange:J=>w(D.id,{isRegistered:J===!0})}),e.jsx(E,{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(Jm,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"点击左侧卡片编辑"})]})})})]}),e.jsx(st,{children:e.jsx(_,{onClick:P,disabled:!R||g,children:g?"上传中...":`上传全部 (${L})`})})]})};return e.jsx(Is,{open:l,onOpenChange:n,children:e.jsxs(Os,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[e.jsxs(Ds,{children:[e.jsxs(Rs,{className:"flex items-center gap-2",children:[e.jsx(ec,{className:"h-5 w-5"}),c==="select"&&"上传表情包 - 选择文件",c==="edit-single"&&"上传表情包 - 填写信息",c==="edit-multiple"&&"上传表情包 - 批量编辑"]}),e.jsxs(Ks,{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"&&M(),c==="edit-single"&&T(),c==="edit-multiple"&&A()]})]})})}function S4(){const[l,n]=d.useState([]),[i,c]=d.useState(!0),[u,x]=d.useState(0),[h,f]=d.useState(1),[p,g]=d.useState(20),[N,v]=d.useState(""),[y,w]=d.useState(null),[b,R]=d.useState(!1),[D,S]=d.useState(!1),[P,M]=d.useState(!1),[T,A]=d.useState(null),[F,L]=d.useState(new Set),[J,U]=d.useState(!1),[ue,xe]=d.useState(""),[he,ne]=d.useState({total:0,recent_7days:0,chat_count:0,top_chats:{}}),[ve,je]=d.useState([]),[z,V]=d.useState(new Map),[B,oe]=d.useState(!1),[K,_e]=d.useState(0),{toast:pe}=Zs(),ke=async()=>{try{c(!0);const ie=await j1({page:h,page_size:p,search:N||void 0});n(ie.data),x(ie.total)}catch(ie){pe({title:"加载失败",description:ie instanceof Error?ie.message:"无法加载表达方式",variant:"destructive"})}finally{c(!1)}},O=async()=>{try{const ie=await _1();ie?.data&&ne(ie.data)}catch(ie){console.error("加载统计数据失败:",ie)}},k=async()=>{try{const ie=await Wm();_e(ie.unchecked)}catch(ie){console.error("加载审核统计失败:",ie)}},H=async()=>{try{const ie=await Zm();if(ie?.data){je(ie.data);const Te=new Map;ie.data.forEach(de=>{Te.set(de.chat_id,de.chat_name)}),V(Te)}}catch(ie){console.error("加载聊天列表失败:",ie)}},se=ie=>z.get(ie)||ie;d.useEffect(()=>{ke(),k(),O(),H()},[h,p,N]);const Ee=async ie=>{try{const Te=await v1(ie.id);w(Te.data),R(!0)}catch(Te){pe({title:"加载详情失败",description:Te instanceof Error?Te.message:"无法加载表达方式详情",variant:"destructive"})}},Z=ie=>{w(ie),S(!0)},Oe=async ie=>{try{await y1(ie.id),pe({title:"删除成功",description:`已删除表达方式: ${ie.situation}`}),A(null),ke(),O()}catch(Te){pe({title:"删除失败",description:Te instanceof Error?Te.message:"无法删除表达方式",variant:"destructive"})}},ns=ie=>{const Te=new Set(F);Te.has(ie)?Te.delete(ie):Te.add(ie),L(Te)},Q=()=>{F.size===l.length&&l.length>0?L(new Set):L(new Set(l.map(ie=>ie.id)))},ee=async()=>{try{await w1(Array.from(F)),pe({title:"批量删除成功",description:`已删除 ${F.size} 个表达方式`}),L(new Set),U(!1),ke(),O()}catch(ie){pe({title:"批量删除失败",description:ie instanceof Error?ie.message:"无法批量删除表达方式",variant:"destructive"})}},Ue=()=>{const ie=parseInt(ue),Te=Math.ceil(u/p);ie>=1&&ie<=Te?(f(ie),xe("")):pe({title:"无效的页码",description:`请输入1-${Te}之间的页码`,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(Ma,{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:()=>oe(!0),className:"gap-2",children:[e.jsx(Aj,{className:"h-4 w-4"}),"人工审核",K>0&&e.jsx("span",{className:"ml-1 px-1.5 py-0.5 text-xs rounded-full bg-orange-500 text-white",children:K>99?"99+":K})]}),e.jsxs(_,{onClick:()=>M(!0),className:"gap-2",children:[e.jsx(et,{className:"h-4 w-4"}),"新增表达方式"]})]})]})}),e.jsx(Ye,{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:he.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:he.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:he.chat_count})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx(E,{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(Tt,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(le,{id:"search",placeholder:"搜索情境、风格或上下文...",value:N,onChange:ie=>v(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:F.size>0&&e.jsxs("span",{children:["已选择 ",F.size," 个表达方式"]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(E,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Ie,{value:p.toString(),onValueChange:ie=>{g(parseInt(ie)),f(1),L(new Set)},children:[e.jsx($e,{id:"page-size",className:"w-20",children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(X,{value:"10",children:"10"}),e.jsx(X,{value:"20",children:"20"}),e.jsx(X,{value:"50",children:"50"}),e.jsx(X,{value:"100",children:"100"})]})]}),F.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>L(new Set),children:"取消选择"}),e.jsxs(_,{variant:"destructive",size:"sm",onClick:()=>U(!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(Rl,{children:[e.jsx(Ll,{children:e.jsxs(ut,{children:[e.jsx(Ze,{className:"w-12",children:e.jsx(qs,{checked:F.size===l.length&&l.length>0,onCheckedChange:Q})}),e.jsx(Ze,{children:"情境"}),e.jsx(Ze,{children:"风格"}),e.jsx(Ze,{children:"聊天"}),e.jsx(Ze,{className:"text-right",children:"操作"})]})}),e.jsx(Ul,{children:i?e.jsx(ut,{children:e.jsx(qe,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):l.length===0?e.jsx(ut,{children:e.jsx(qe,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):l.map(ie=>e.jsxs(ut,{children:[e.jsx(qe,{children:e.jsx(qs,{checked:F.has(ie.id),onCheckedChange:()=>ns(ie.id)})}),e.jsx(qe,{className:"font-medium max-w-xs truncate",children:ie.situation}),e.jsx(qe,{className:"max-w-xs truncate",children:ie.style}),e.jsx(qe,{className:"max-w-[200px] truncate",title:se(ie.chat_id),style:{wordBreak:"keep-all"},children:e.jsx("span",{className:"whitespace-nowrap overflow-hidden text-ellipsis block",children:se(ie.chat_id)})}),e.jsx(qe,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>Z(ie),children:[e.jsx(qn,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(_,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>Ee(ie),title:"查看详情",children:e.jsx(ia,{className:"h-4 w-4"})}),e.jsxs(_,{size:"sm",onClick:()=>A(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:i?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):l.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):l.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(qs,{checked:F.has(ie.id),onCheckedChange:()=>ns(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:se(ie.chat_id),style:{wordBreak:"keep-all"},children:se(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:()=>Z(ie),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(qn,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>Ee(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:()=>A(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))}),u>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:["共 ",u," 条记录,第 ",h," / ",Math.ceil(u/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(gn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h-1),disabled:h===1,children:[e.jsx(Aa,{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(le,{type:"number",value:ue,onChange:ie=>xe(ie.target.value),onKeyDown:ie=>ie.key==="Enter"&&Ue(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(u/p)}),e.jsx(_,{variant:"outline",size:"sm",onClick:Ue,disabled:!ue,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h+1),disabled:h>=Math.ceil(u/p),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Zt,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(u/p)),disabled:h>=Math.ceil(u/p),className:"hidden sm:flex",children:e.jsx(jn,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(k4,{expression:y,open:b,onOpenChange:R,chatNameMap:z}),e.jsx(C4,{open:P,onOpenChange:M,chatList:ve,onSuccess:()=>{ke(),O(),M(!1)}}),e.jsx(T4,{expression:y,open:D,onOpenChange:S,chatList:ve,onSuccess:()=>{ke(),O(),S(!1)}}),e.jsx(vs,{open:!!T,onOpenChange:()=>A(null),children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:['确定要删除表达方式 "',T?.situation,'" 吗? 此操作不可撤销。']})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>T&&Oe(T),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(E4,{open:J,onOpenChange:U,onConfirm:ee,count:F.size}),e.jsx(cv,{open:B,onOpenChange:ie=>{oe(ie),ie||(ke(),O(),k())}})]})}function k4({expression:l,open:n,onOpenChange:i,chatNameMap:c}){if(!l)return null;const u=h=>h?new Date(h*1e3).toLocaleString("zh-CN"):"-",x=h=>c.get(h)||h;return e.jsx(Is,{open:n,onOpenChange:i,children:e.jsxs(Os,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Ds,{children:[e.jsx(Rs,{children:"表达方式详情"}),e.jsx(Ks,{children:"查看表达方式的完整信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Pi,{label:"情境",value:l.situation}),e.jsx(Pi,{label:"风格",value:l.style}),e.jsx(Pi,{label:"聊天",value:x(l.chat_id)}),e.jsx(Pi,{icon:Gr,label:"记录ID",value:l.id.toString(),mono:!0})]}),e.jsx("div",{className:"grid grid-cols-2 gap-4",children:e.jsx(Pi,{icon:na,label:"创建时间",value:u(l.create_date)})}),e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-4",children:[e.jsx(E,{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:I("flex h-8 w-8 items-center justify-center rounded-full",l.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:l.checked?e.jsx(pt,{className:"h-5 w-5"}):e.jsx(Lo,{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:l.checked?"已通过审核":"未审核"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:I("flex h-8 w-8 items-center justify-center rounded-full",l.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:l.rejected?e.jsx(Va,{className:"h-5 w-5"}):e.jsx(Lo,{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:l.rejected?"不会被使用":"正常"})]})]})]})]})]}),e.jsx(st,{children:e.jsx(_,{onClick:()=>i(!1),children:"关闭"})})]})})}function Pi({icon:l,label:n,value:i,mono:c=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(E,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[l&&e.jsx(l,{className:"h-3 w-3"}),n]}),e.jsx("div",{className:I("text-sm",c&&"font-mono",!i&&"text-muted-foreground"),children:i||"-"})]})}function C4({open:l,onOpenChange:n,chatList:i,onSuccess:c}){const[u,x]=d.useState({situation:"",style:"",chat_id:""}),[h,f]=d.useState(!1),{toast:p}=Zs(),g=async()=>{if(!u.situation||!u.style||!u.chat_id){p({title:"验证失败",description:"请填写必填字段:情境、风格和聊天",variant:"destructive"});return}try{f(!0),await N1(u),p({title:"创建成功",description:"表达方式已创建"}),x({situation:"",style:"",chat_id:""}),c()}catch(N){p({title:"创建失败",description:N instanceof Error?N.message:"无法创建表达方式",variant:"destructive"})}finally{f(!1)}};return e.jsx(Is,{open:l,onOpenChange:n,children:e.jsxs(Os,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Ds,{children:[e.jsx(Rs,{children:"新增表达方式"}),e.jsx(Ks,{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(E,{htmlFor:"situation",children:["情境 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(le,{id:"situation",value:u.situation,onChange:N=>x({...u,situation:N.target.value}),placeholder:"描述使用场景"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(E,{htmlFor:"style",children:["风格 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(le,{id:"style",value:u.style,onChange:N=>x({...u,style:N.target.value}),placeholder:"描述表达风格"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(E,{htmlFor:"chat_id",children:["聊天 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs(Ie,{value:u.chat_id,onValueChange:N=>x({...u,chat_id:N}),children:[e.jsx($e,{children:e.jsx(Pe,{placeholder:"选择关联的聊天"})}),e.jsx(Be,{children:i.map(N=>e.jsx(X,{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(st,{children:[e.jsx(_,{variant:"outline",onClick:()=>n(!1),children:"取消"}),e.jsx(_,{onClick:g,disabled:h,children:h?"创建中...":"创建"})]})]})})}function T4({expression:l,open:n,onOpenChange:i,chatList:c,onSuccess:u}){const[x,h]=d.useState({}),[f,p]=d.useState(!1),{toast:g}=Zs();d.useEffect(()=>{l&&h({situation:l.situation,style:l.style,chat_id:l.chat_id,checked:l.checked,rejected:l.rejected})},[l]);const N=async()=>{if(l)try{p(!0),await b1(l.id,x),g({title:"保存成功",description:"表达方式已更新"}),u()}catch(v){g({title:"保存失败",description:v instanceof Error?v.message:"无法更新表达方式",variant:"destructive"})}finally{p(!1)}};return l?e.jsx(Is,{open:n,onOpenChange:i,children:e.jsxs(Os,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Ds,{children:[e.jsx(Rs,{children:"编辑表达方式"}),e.jsx(Ks,{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(E,{htmlFor:"edit_situation",children:"情境"}),e.jsx(le,{id:"edit_situation",value:x.situation||"",onChange:v=>h({...x,situation:v.target.value}),placeholder:"描述使用场景"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"edit_style",children:"风格"}),e.jsx(le,{id:"edit_style",value:x.style||"",onChange:v=>h({...x,style:v.target.value}),placeholder:"描述表达风格"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"edit_chat_id",children:"聊天"}),e.jsxs(Ie,{value:x.chat_id||"",onValueChange:v=>h({...x,chat_id:v}),children:[e.jsx($e,{children:e.jsx(Pe,{placeholder:"选择关联的聊天"})}),e.jsx(Be,{children:c.map(v=>e.jsx(X,{value:v.chat_id,children:e.jsxs("span",{className:"truncate",style:{wordBreak:"keep-all"},children:[v.chat_name,v.is_group&&e.jsx("span",{className:"text-muted-foreground ml-1",children:"(群聊)"})]})},v.chat_id))})]})]}),e.jsxs(at,{children:[e.jsx(Ht,{className:"h-4 w-4"}),e.jsx(lt,{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(E,{htmlFor:"edit_checked",className:"text-sm font-medium",children:"已检查"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"已通过审核"})]}),e.jsx(Fe,{id:"edit_checked",checked:x.checked??!1,onCheckedChange:v=>h({...x,checked:v})})]}),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(E,{htmlFor:"edit_rejected",className:"text-sm font-medium",children:"已拒绝"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"不会被使用"})]}),e.jsx(Fe,{id:"edit_rejected",checked:x.rejected??!1,onCheckedChange:v=>h({...x,rejected:v})})]})]})]}),e.jsxs(st,{children:[e.jsx(_,{variant:"outline",onClick:()=>i(!1),children:"取消"}),e.jsx(_,{onClick:N,disabled:f,children:f?"保存中...":"保存"})]})]})}):null}function E4({open:l,onOpenChange:n,onConfirm:i,count:c}){return e.jsx(vs,{open:l,onOpenChange:n,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认批量删除"}),e.jsxs(hs,{children:["您即将删除 ",c," 个表达方式,此操作无法撤销。确定要继续吗?"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:i,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})}const $l="/api/webui/jargon";async function M4(){const l=await we(`${$l}/chats`,{});if(!l.ok){const n=await l.json();throw new Error(n.detail||"获取聊天列表失败")}return l.json()}async function z4(l){const n=new URLSearchParams;l.page&&n.append("page",l.page.toString()),l.page_size&&n.append("page_size",l.page_size.toString()),l.search&&n.append("search",l.search),l.chat_id&&n.append("chat_id",l.chat_id),l.is_jargon!==void 0&&l.is_jargon!==null&&n.append("is_jargon",l.is_jargon.toString()),l.is_global!==void 0&&n.append("is_global",l.is_global.toString());const i=await we(`${$l}/list?${n}`,{});if(!i.ok){const c=await i.json();throw new Error(c.detail||"获取黑话列表失败")}return i.json()}async function A4(l){const n=await we(`${$l}/${l}`,{});if(!n.ok){const i=await n.json();throw new Error(i.detail||"获取黑话详情失败")}return n.json()}async function O4(l){const n=await we(`${$l}/`,{method:"POST",body:JSON.stringify(l)});if(!n.ok){const i=await n.json();throw new Error(i.detail||"创建黑话失败")}return n.json()}async function D4(l,n){const i=await we(`${$l}/${l}`,{method:"PATCH",body:JSON.stringify(n)});if(!i.ok){const c=await i.json();throw new Error(c.detail||"更新黑话失败")}return i.json()}async function R4(l){const n=await we(`${$l}/${l}`,{method:"DELETE"});if(!n.ok){const i=await n.json();throw new Error(i.detail||"删除黑话失败")}return n.json()}async function L4(l){const n=await we(`${$l}/batch/delete`,{method:"POST",body:JSON.stringify({ids:l})});if(!n.ok){const i=await n.json();throw new Error(i.detail||"批量删除黑话失败")}return n.json()}async function U4(){const l=await we(`${$l}/stats/summary`,{});if(!l.ok){const n=await l.json();throw new Error(n.detail||"获取黑话统计失败")}return l.json()}async function $4(l,n){const i=new URLSearchParams;l.forEach(u=>i.append("ids",u.toString())),i.append("is_jargon",n.toString());const c=await we(`${$l}/batch/set-jargon?${i}`,{method:"POST"});if(!c.ok){const u=await c.json();throw new Error(u.detail||"批量设置黑话状态失败")}return c.json()}function B4(){const[l,n]=d.useState([]),[i,c]=d.useState(!0),[u,x]=d.useState(0),[h,f]=d.useState(1),[p,g]=d.useState(20),[N,v]=d.useState(""),[y,w]=d.useState("all"),[b,R]=d.useState("all"),[D,S]=d.useState(null),[P,M]=d.useState(!1),[T,A]=d.useState(!1),[F,L]=d.useState(!1),[J,U]=d.useState(null),[ue,xe]=d.useState(new Set),[he,ne]=d.useState(!1),[ve,je]=d.useState(""),[z,V]=d.useState({total:0,confirmed_jargon:0,confirmed_not_jargon:0,pending:0,global_count:0,complete_count:0,chat_count:0,top_chats:{}}),[B,oe]=d.useState([]),{toast:K}=Zs(),_e=async()=>{try{c(!0);const ee=await z4({page:h,page_size:p,search:N||void 0,chat_id:y==="all"?void 0:y,is_jargon:b==="all"?void 0:b==="true"?!0:b==="false"?!1:void 0});n(ee.data),x(ee.total)}catch(ee){K({title:"加载失败",description:ee instanceof Error?ee.message:"无法加载黑话列表",variant:"destructive"})}finally{c(!1)}},pe=async()=>{try{const ee=await U4();ee?.data&&V(ee.data)}catch(ee){console.error("加载统计数据失败:",ee)}},ke=async()=>{try{const ee=await M4();ee?.data&&oe(ee.data)}catch(ee){console.error("加载聊天列表失败:",ee)}};d.useEffect(()=>{_e(),pe(),ke()},[h,p,N,y,b]);const O=async ee=>{try{const Ue=await A4(ee.id);S(Ue.data),M(!0)}catch(Ue){K({title:"加载详情失败",description:Ue instanceof Error?Ue.message:"无法加载黑话详情",variant:"destructive"})}},k=ee=>{S(ee),A(!0)},H=async ee=>{try{await R4(ee.id),K({title:"删除成功",description:`已删除黑话: ${ee.content}`}),U(null),_e(),pe()}catch(Ue){K({title:"删除失败",description:Ue instanceof Error?Ue.message:"无法删除黑话",variant:"destructive"})}},se=ee=>{const Ue=new Set(ue);Ue.has(ee)?Ue.delete(ee):Ue.add(ee),xe(Ue)},Ee=()=>{ue.size===l.length&&l.length>0?xe(new Set):xe(new Set(l.map(ee=>ee.id)))},Z=async()=>{try{await L4(Array.from(ue)),K({title:"批量删除成功",description:`已删除 ${ue.size} 个黑话`}),xe(new Set),ne(!1),_e(),pe()}catch(ee){K({title:"批量删除失败",description:ee instanceof Error?ee.message:"无法批量删除黑话",variant:"destructive"})}},Oe=async ee=>{try{await $4(Array.from(ue),ee),K({title:"操作成功",description:`已将 ${ue.size} 个词条设为${ee?"黑话":"非黑话"}`}),xe(new Set),_e(),pe()}catch(Ue){K({title:"操作失败",description:Ue instanceof Error?Ue.message:"批量设置失败",variant:"destructive"})}},ns=()=>{const ee=parseInt(ve),Ue=Math.ceil(u/p);ee>=1&&ee<=Ue?(f(ee),je("")):K({title:"无效的页码",description:`请输入1-${Ue}之间的页码`,variant:"destructive"})},Q=ee=>ee===!0?e.jsxs(Se,{variant:"default",className:"bg-green-600 hover:bg-green-700",children:[e.jsx(Ct,{className:"h-3 w-3 mr-1"}),"是黑话"]}):ee===!1?e.jsxs(Se,{variant:"secondary",children:[e.jsx(Ea,{className:"h-3 w-3 mr-1"}),"非黑话"]}):e.jsxs(Se,{variant:"outline",children:[e.jsx(Dj,{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(a_,{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:()=>L(!0),className:"gap-2",children:[e.jsx(et,{className:"h-4 w-4"}),"新增黑话"]})]})}),e.jsx(Ye,{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:z.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:z.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:z.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:z.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:z.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:z.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:z.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(E,{htmlFor:"search",children:"搜索"}),e.jsxs("div",{className:"relative",children:[e.jsx(Tt,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(le,{id:"search",placeholder:"搜索内容、含义...",value:N,onChange:ee=>v(ee.target.value),className:"pl-9"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(E,{children:"聊天筛选"}),e.jsxs(Ie,{value:y,onValueChange:w,children:[e.jsx($e,{children:e.jsx(Pe,{placeholder:"全部聊天"})}),e.jsxs(Be,{children:[e.jsx(X,{value:"all",children:"全部聊天"}),B.map(ee=>e.jsx(X,{value:ee.chat_id,children:ee.chat_name},ee.chat_id))]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(E,{children:"状态筛选"}),e.jsxs(Ie,{value:b,onValueChange:R,children:[e.jsx($e,{children:e.jsx(Pe,{placeholder:"全部状态"})}),e.jsxs(Be,{children:[e.jsx(X,{value:"all",children:"全部状态"}),e.jsx(X,{value:"true",children:"是黑话"}),e.jsx(X,{value:"false",children:"非黑话"})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(E,{htmlFor:"page-size",children:"每页显示"}),e.jsxs(Ie,{value:p.toString(),onValueChange:ee=>{g(parseInt(ee)),f(1),xe(new Set)},children:[e.jsx($e,{id:"page-size",children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(X,{value:"10",children:"10"}),e.jsx(X,{value:"20",children:"20"}),e.jsx(X,{value:"50",children:"50"}),e.jsx(X,{value:"100",children:"100"})]})]})]})]}),ue.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:["已选择 ",ue.size," 个"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>Oe(!0),children:[e.jsx(Ct,{className:"h-4 w-4 mr-1"}),"标记为黑话"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>Oe(!1),children:[e.jsx(Ea,{className:"h-4 w-4 mr-1"}),"标记为非黑话"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>xe(new Set),children:"取消选择"}),e.jsxs(_,{variant:"destructive",size:"sm",onClick:()=>ne(!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(Rl,{children:[e.jsx(Ll,{children:e.jsxs(ut,{children:[e.jsx(Ze,{className:"w-12",children:e.jsx(qs,{checked:ue.size===l.length&&l.length>0,onCheckedChange:Ee})}),e.jsx(Ze,{children:"内容"}),e.jsx(Ze,{children:"含义"}),e.jsx(Ze,{children:"聊天"}),e.jsx(Ze,{children:"状态"}),e.jsx(Ze,{className:"text-center",children:"次数"}),e.jsx(Ze,{className:"text-right",children:"操作"})]})}),e.jsx(Ul,{children:i?e.jsx(ut,{children:e.jsx(qe,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):l.length===0?e.jsx(ut,{children:e.jsx(qe,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):l.map(ee=>e.jsxs(ut,{children:[e.jsx(qe,{children:e.jsx(qs,{checked:ue.has(ee.id),onCheckedChange:()=>se(ee.id)})}),e.jsx(qe,{className:"font-medium max-w-[200px]",children:e.jsxs("div",{className:"flex items-center gap-2",children:[ee.is_global&&e.jsx("span",{title:"全局黑话",children:e.jsx(Uo,{className:"h-4 w-4 text-blue-500 flex-shrink-0"})}),e.jsx("span",{className:"truncate",title:ee.content,children:ee.content})]})}),e.jsx(qe,{className:"max-w-[200px] truncate",title:ee.meaning||"",children:ee.meaning||e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx(qe,{className:"max-w-[150px] truncate",title:ee.chat_name||ee.chat_id,children:ee.chat_name||ee.chat_id}),e.jsx(qe,{children:Q(ee.is_jargon)}),e.jsx(qe,{className:"text-center",children:ee.count}),e.jsx(qe,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>k(ee),children:[e.jsx(qn,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(_,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>O(ee),title:"查看详情",children:e.jsx(ia,{className:"h-4 w-4"})}),e.jsxs(_,{size:"sm",onClick:()=>U(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:i?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):l.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):l.map(ee=>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(qs,{checked:ue.has(ee.id),onCheckedChange:()=>se(ee.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:[ee.is_global&&e.jsx(Uo,{className:"h-4 w-4 text-blue-500 flex-shrink-0"}),e.jsx("h3",{className:"font-semibold text-sm break-all",children:ee.content})]}),ee.meaning&&e.jsx("p",{className:"text-sm text-muted-foreground break-all",children:ee.meaning}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[Q(ee.is_jargon),e.jsxs("span",{className:"text-muted-foreground",children:["次数: ",ee.count]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground truncate",children:["聊天: ",ee.chat_name||ee.chat_id]})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>k(ee),className:"text-xs px-2 py-1 h-auto",children:[e.jsx(qn,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>O(ee),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:()=>U(ee),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"}),"删除"]})]})]},ee.id))}),u>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:["共 ",u," 条记录,第 ",h," / ",Math.ceil(u/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(gn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h-1),disabled:h===1,children:[e.jsx(Aa,{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(le,{type:"number",value:ve,onChange:ee=>je(ee.target.value),onKeyDown:ee=>ee.key==="Enter"&&ns(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(u/p)}),e.jsx(_,{variant:"outline",size:"sm",onClick:ns,disabled:!ve,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h+1),disabled:h>=Math.ceil(u/p),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Zt,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(u/p)),disabled:h>=Math.ceil(u/p),className:"hidden sm:flex",children:e.jsx(jn,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(I4,{jargon:D,open:P,onOpenChange:M}),e.jsx(P4,{open:F,onOpenChange:L,chatList:B,onSuccess:()=>{_e(),pe(),L(!1)}}),e.jsx(H4,{jargon:D,open:T,onOpenChange:A,chatList:B,onSuccess:()=>{_e(),pe(),A(!1)}}),e.jsx(vs,{open:!!J,onOpenChange:()=>U(null),children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:['确定要删除黑话 "',J?.content,'" 吗?此操作不可撤销。']})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>J&&H(J),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(vs,{open:he,onOpenChange:ne,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认批量删除"}),e.jsxs(hs,{children:["您即将删除 ",ue.size," 个黑话,此操作无法撤销。确定要继续吗?"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:Z,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})]})}function I4({jargon:l,open:n,onOpenChange:i}){return l?e.jsx(Is,{open:n,onOpenChange:i,children:e.jsxs(Os,{className:"max-w-2xl max-h-[80vh] grid grid-rows-[auto_1fr_auto] overflow-hidden",children:[e.jsxs(Ds,{children:[e.jsx(Rs,{children:"黑话详情"}),e.jsx(Ks,{children:"查看黑话的完整信息"})]}),e.jsx(Ye,{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(Dm,{icon:Gr,label:"记录ID",value:l.id.toString(),mono:!0}),e.jsx(Dm,{label:"使用次数",value:l.count.toString()})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(E,{className:"text-xs text-muted-foreground",children:"内容"}),e.jsx("div",{className:"text-sm p-2 bg-muted rounded break-all whitespace-pre-wrap",children:l.content})]}),l.raw_content&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(E,{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(l.raw_content);return Array.isArray(c)?c.map((u,x)=>e.jsxs("div",{children:[x>0&&e.jsx("hr",{className:"my-3 border-border"}),e.jsx("div",{className:"whitespace-pre-wrap",children:u})]},x)):e.jsx("div",{className:"whitespace-pre-wrap",children:l.raw_content})}catch{return e.jsx("div",{className:"whitespace-pre-wrap",children:l.raw_content})}})()})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(E,{className:"text-xs text-muted-foreground",children:"含义"}),e.jsx("div",{className:"text-sm p-2 bg-muted rounded break-all",children:l.meaning?e.jsx(tx,{content:l.meaning}):"-"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Dm,{label:"聊天",value:l.chat_name||l.chat_id}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(E,{className:"text-xs text-muted-foreground",children:"状态"}),e.jsxs("div",{className:"flex items-center gap-2",children:[l.is_jargon===!0&&e.jsx(Se,{variant:"default",className:"bg-green-600",children:"是黑话"}),l.is_jargon===!1&&e.jsx(Se,{variant:"secondary",children:"非黑话"}),l.is_jargon===null&&e.jsx(Se,{variant:"outline",children:"未判定"}),l.is_global&&e.jsx(Se,{variant:"outline",className:"border-blue-500 text-blue-500",children:"全局"}),l.is_complete&&e.jsx(Se,{variant:"outline",className:"border-purple-500 text-purple-500",children:"推断完成"})]})]})]}),l.inference_with_context&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(E,{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:l.inference_with_context})]}),l.inference_content_only&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(E,{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:l.inference_content_only})]})]})}),e.jsx(st,{className:"flex-shrink-0",children:e.jsx(_,{onClick:()=>i(!1),children:"关闭"})})]})}):null}function Dm({icon:l,label:n,value:i,mono:c=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(E,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[l&&e.jsx(l,{className:"h-3 w-3"}),n]}),e.jsx("div",{className:I("text-sm",c&&"font-mono",!i&&"text-muted-foreground"),children:i||"-"})]})}function P4({open:l,onOpenChange:n,chatList:i,onSuccess:c}){const[u,x]=d.useState({content:"",meaning:"",chat_id:"",is_global:!1}),[h,f]=d.useState(!1),{toast:p}=Zs(),g=async()=>{if(!u.content||!u.chat_id){p({title:"验证失败",description:"请填写必填字段:内容和聊天",variant:"destructive"});return}try{f(!0),await O4(u),p({title:"创建成功",description:"黑话已创建"}),x({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(Is,{open:l,onOpenChange:n,children:e.jsxs(Os,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Ds,{children:[e.jsx(Rs,{children:"新增黑话"}),e.jsx(Ks,{children:"创建新的黑话记录"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(E,{htmlFor:"content",children:["内容 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(le,{id:"content",value:u.content,onChange:N=>x({...u,content:N.target.value}),placeholder:"输入黑话内容"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"meaning",children:"含义"}),e.jsx(ot,{id:"meaning",value:u.meaning||"",onChange:N=>x({...u,meaning:N.target.value}),placeholder:"输入黑话含义(可选)",rows:3})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(E,{htmlFor:"chat_id",children:["聊天 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs(Ie,{value:u.chat_id,onValueChange:N=>x({...u,chat_id:N}),children:[e.jsx($e,{children:e.jsx(Pe,{placeholder:"选择关联的聊天"})}),e.jsx(Be,{children:i.map(N=>e.jsx(X,{value:N.chat_id,children:N.chat_name},N.chat_id))})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Fe,{id:"is_global",checked:u.is_global,onCheckedChange:N=>x({...u,is_global:N})}),e.jsx(E,{htmlFor:"is_global",children:"设为全局黑话"})]})]}),e.jsxs(st,{children:[e.jsx(_,{variant:"outline",onClick:()=>n(!1),children:"取消"}),e.jsx(_,{onClick:g,disabled:h,children:h?"创建中...":"创建"})]})]})})}function H4({jargon:l,open:n,onOpenChange:i,chatList:c,onSuccess:u}){const[x,h]=d.useState({}),[f,p]=d.useState(!1),{toast:g}=Zs();d.useEffect(()=>{l&&h({content:l.content,meaning:l.meaning||"",chat_id:l.stream_id||l.chat_id,is_global:l.is_global,is_jargon:l.is_jargon})},[l]);const N=async()=>{if(l)try{p(!0),await D4(l.id,x),g({title:"保存成功",description:"黑话已更新"}),u()}catch(v){g({title:"保存失败",description:v instanceof Error?v.message:"无法更新黑话",variant:"destructive"})}finally{p(!1)}};return l?e.jsx(Is,{open:n,onOpenChange:i,children:e.jsxs(Os,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Ds,{children:[e.jsx(Rs,{children:"编辑黑话"}),e.jsx(Ks,{children:"修改黑话的信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"edit_content",children:"内容"}),e.jsx(le,{id:"edit_content",value:x.content||"",onChange:v=>h({...x,content:v.target.value}),placeholder:"输入黑话内容"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"edit_meaning",children:"含义"}),e.jsx(ot,{id:"edit_meaning",value:x.meaning||"",onChange:v=>h({...x,meaning:v.target.value}),placeholder:"输入黑话含义",rows:3})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"edit_chat_id",children:"聊天"}),e.jsxs(Ie,{value:x.chat_id||"",onValueChange:v=>h({...x,chat_id:v}),children:[e.jsx($e,{children:e.jsx(Pe,{placeholder:"选择关联的聊天"})}),e.jsx(Be,{children:c.map(v=>e.jsx(X,{value:v.chat_id,children:v.chat_name},v.chat_id))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:"黑话状态"}),e.jsxs(Ie,{value:x.is_jargon===null?"null":x.is_jargon?.toString()||"null",onValueChange:v=>h({...x,is_jargon:v==="null"?null:v==="true"}),children:[e.jsx($e,{children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(X,{value:"null",children:"未判定"}),e.jsx(X,{value:"true",children:"是黑话"}),e.jsx(X,{value:"false",children:"非黑话"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Fe,{id:"edit_is_global",checked:x.is_global,onCheckedChange:v=>h({...x,is_global:v})}),e.jsx(E,{htmlFor:"edit_is_global",children:"全局黑话"})]})]}),e.jsxs(st,{children:[e.jsx(_,{variant:"outline",onClick:()=>i(!1),children:"取消"}),e.jsx(_,{onClick:N,disabled:f,children:f?"保存中...":"保存"})]})]})}):null}const Yr="/api/webui/person";async function F4(l){const n=new URLSearchParams;l.page&&n.append("page",l.page.toString()),l.page_size&&n.append("page_size",l.page_size.toString()),l.search&&n.append("search",l.search),l.is_known!==void 0&&n.append("is_known",l.is_known.toString()),l.platform&&n.append("platform",l.platform);const i=await we(`${Yr}/list?${n}`,{headers:Fs()});if(!i.ok){const c=await i.json();throw new Error(c.detail||"获取人物列表失败")}return i.json()}async function G4(l){const n=await we(`${Yr}/${l}`,{headers:Fs()});if(!n.ok){const i=await n.json();throw new Error(i.detail||"获取人物详情失败")}return n.json()}async function V4(l,n){const i=await we(`${Yr}/${l}`,{method:"PATCH",headers:Fs(),body:JSON.stringify(n)});if(!i.ok){const c=await i.json();throw new Error(c.detail||"更新人物信息失败")}return i.json()}async function q4(l){const n=await we(`${Yr}/${l}`,{method:"DELETE",headers:Fs()});if(!n.ok){const i=await n.json();throw new Error(i.detail||"删除人物信息失败")}return n.json()}async function K4(){const l=await we(`${Yr}/stats/summary`,{headers:Fs()});if(!l.ok){const n=await l.json();throw new Error(n.detail||"获取统计数据失败")}return l.json()}async function Q4(l){const n=await we(`${Yr}/batch/delete`,{method:"POST",headers:Fs(),body:JSON.stringify({person_ids:l})});if(!n.ok){const i=await n.json();throw new Error(i.detail||"批量删除失败")}return n.json()}function Y4(){const[l,n]=d.useState([]),[i,c]=d.useState(!0),[u,x]=d.useState(0),[h,f]=d.useState(1),[p,g]=d.useState(20),[N,v]=d.useState(""),[y,w]=d.useState(void 0),[b,R]=d.useState(void 0),[D,S]=d.useState(null),[P,M]=d.useState(!1),[T,A]=d.useState(!1),[F,L]=d.useState(null),[J,U]=d.useState({total:0,known:0,unknown:0,platforms:{}}),[ue,xe]=d.useState(new Set),[he,ne]=d.useState(!1),[ve,je]=d.useState(""),{toast:z}=Zs(),V=async()=>{try{c(!0);const Z=await F4({page:h,page_size:p,search:N||void 0,is_known:y,platform:b});n(Z.data),x(Z.total)}catch(Z){z({title:"加载失败",description:Z instanceof Error?Z.message:"无法加载人物信息",variant:"destructive"})}finally{c(!1)}},B=async()=>{try{const Z=await K4();Z?.data&&U(Z.data)}catch(Z){console.error("加载统计数据失败:",Z)}};d.useEffect(()=>{V(),B()},[h,p,N,y,b]);const oe=async Z=>{try{const Oe=await G4(Z.person_id);S(Oe.data),M(!0)}catch(Oe){z({title:"加载详情失败",description:Oe instanceof Error?Oe.message:"无法加载人物详情",variant:"destructive"})}},K=Z=>{S(Z),A(!0)},_e=async Z=>{try{await q4(Z.person_id),z({title:"删除成功",description:`已删除人物信息: ${Z.person_name||Z.nickname||Z.user_id}`}),L(null),V(),B()}catch(Oe){z({title:"删除失败",description:Oe instanceof Error?Oe.message:"无法删除人物信息",variant:"destructive"})}},pe=d.useMemo(()=>Object.keys(J.platforms),[J.platforms]),ke=Z=>{const Oe=new Set(ue);Oe.has(Z)?Oe.delete(Z):Oe.add(Z),xe(Oe)},O=()=>{ue.size===l.length&&l.length>0?xe(new Set):xe(new Set(l.map(Z=>Z.person_id)))},k=()=>{if(ue.size===0){z({title:"未选择任何人物",description:"请先选择要删除的人物",variant:"destructive"});return}ne(!0)},H=async()=>{try{const Z=await Q4(Array.from(ue));z({title:"批量删除完成",description:Z.message}),xe(new Set),ne(!1),V(),B()}catch(Z){z({title:"批量删除失败",description:Z instanceof Error?Z.message:"批量删除失败",variant:"destructive"})}},se=()=>{const Z=parseInt(ve),Oe=Math.ceil(u/p);Z>=1&&Z<=Oe?(f(Z),je("")):z({title:"无效的页码",description:`请输入1-${Oe}之间的页码`,variant:"destructive"})},Ee=Z=>Z?new Date(Z*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(sc,{className:"h-8 w-8",strokeWidth:2}),"人物信息管理"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦认识的所有人物信息"})]})})}),e.jsx(Ye,{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(E,{htmlFor:"search",children:"搜索"}),e.jsxs("div",{className:"relative mt-1.5",children:[e.jsx(Tt,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(le,{id:"search",placeholder:"搜索名称、昵称或用户ID...",value:N,onChange:Z=>v(Z.target.value),className:"pl-9"})]})]}),e.jsxs("div",{children:[e.jsx(E,{htmlFor:"filter-known",children:"认识状态"}),e.jsxs(Ie,{value:y===void 0?"all":y.toString(),onValueChange:Z=>{w(Z==="all"?void 0:Z==="true"),f(1)},children:[e.jsx($e,{id:"filter-known",className:"mt-1.5",children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(X,{value:"all",children:"全部"}),e.jsx(X,{value:"true",children:"已认识"}),e.jsx(X,{value:"false",children:"未认识"})]})]})]}),e.jsxs("div",{children:[e.jsx(E,{htmlFor:"filter-platform",children:"平台"}),e.jsxs(Ie,{value:b||"all",onValueChange:Z=>{R(Z==="all"?void 0:Z),f(1)},children:[e.jsx($e,{id:"filter-platform",className:"mt-1.5",children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(X,{value:"all",children:"全部平台"}),pe.map(Z=>e.jsxs(X,{value:Z,children:[Z," (",J.platforms[Z],")"]},Z))]})]})]})]}),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:ue.size>0&&e.jsxs("span",{children:["已选择 ",ue.size," 个人物"]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(E,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Ie,{value:p.toString(),onValueChange:Z=>{g(parseInt(Z)),f(1),xe(new Set)},children:[e.jsx($e,{id:"page-size",className:"w-20",children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(X,{value:"10",children:"10"}),e.jsx(X,{value:"20",children:"20"}),e.jsx(X,{value:"50",children:"50"}),e.jsx(X,{value:"100",children:"100"})]})]}),ue.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>xe(new Set),children:"取消选择"}),e.jsxs(_,{variant:"destructive",size:"sm",onClick:k,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(Rl,{children:[e.jsx(Ll,{children:e.jsxs(ut,{children:[e.jsx(Ze,{className:"w-12",children:e.jsx(qs,{checked:l.length>0&&ue.size===l.length,onCheckedChange:O,"aria-label":"全选"})}),e.jsx(Ze,{children:"状态"}),e.jsx(Ze,{children:"名称"}),e.jsx(Ze,{children:"昵称"}),e.jsx(Ze,{children:"平台"}),e.jsx(Ze,{children:"用户ID"}),e.jsx(Ze,{children:"最后更新"}),e.jsx(Ze,{className:"text-right",children:"操作"})]})}),e.jsx(Ul,{children:i?e.jsx(ut,{children:e.jsx(qe,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):l.length===0?e.jsx(ut,{children:e.jsx(qe,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):l.map(Z=>e.jsxs(ut,{children:[e.jsx(qe,{children:e.jsx(qs,{checked:ue.has(Z.person_id),onCheckedChange:()=>ke(Z.person_id),"aria-label":`选择 ${Z.person_name||Z.nickname||Z.user_id}`})}),e.jsx(qe,{children:e.jsx("div",{className:I("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",Z.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:Z.is_known?"已认识":"未认识"})}),e.jsx(qe,{className:"font-medium",children:Z.person_name||e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx(qe,{children:Z.nickname||"-"}),e.jsx(qe,{children:Z.platform}),e.jsx(qe,{className:"font-mono text-sm",children:Z.user_id}),e.jsx(qe,{className:"text-sm text-muted-foreground",children:Ee(Z.last_know)}),e.jsx(qe,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>oe(Z),children:[e.jsx(ia,{className:"h-4 w-4 mr-1"}),"详情"]}),e.jsxs(_,{variant:"default",size:"sm",onClick:()=>K(Z),children:[e.jsx(qn,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsxs(_,{size:"sm",onClick:()=>L(Z),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(ls,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},Z.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3 p-4",children:i?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):l.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):l.map(Z=>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(qs,{checked:ue.has(Z.person_id),onCheckedChange:()=>ke(Z.person_id),className:"mt-1"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:I("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium mb-2",Z.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:Z.is_known?"已认识":"未认识"}),e.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",children:Z.person_name||e.jsx("span",{className:"text-muted-foreground",children:"未命名"})}),Z.nickname&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-1 w-full break-all",children:["昵称: ",Z.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:Z.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:Z.user_id,children:Z.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:Ee(Z.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:()=>oe(Z),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:()=>K(Z),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(qn,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>L(Z),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"}),"删除"]})]})]},Z.id))}),u>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:["共 ",u," 条记录,第 ",h," / ",Math.ceil(u/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(gn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h-1),disabled:h===1,children:[e.jsx(Aa,{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(le,{type:"number",value:ve,onChange:Z=>je(Z.target.value),onKeyDown:Z=>Z.key==="Enter"&&se(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(u/p)}),e.jsx(_,{variant:"outline",size:"sm",onClick:se,disabled:!ve,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h+1),disabled:h>=Math.ceil(u/p),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Zt,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(u/p)),disabled:h>=Math.ceil(u/p),className:"hidden sm:flex",children:e.jsx(jn,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(J4,{person:D,open:P,onOpenChange:M}),e.jsx(X4,{person:D,open:T,onOpenChange:A,onSuccess:()=>{V(),B(),A(!1)}}),e.jsx(vs,{open:!!F,onOpenChange:()=>L(null),children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:['确定要删除人物信息 "',F?.person_name||F?.nickname||F?.user_id,'" 吗? 此操作不可撤销。']})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>F&&_e(F),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(vs,{open:he,onOpenChange:ne,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认批量删除"}),e.jsxs(hs,{children:["确定要删除选中的 ",ue.size," 个人物信息吗? 此操作不可撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:H,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})})]})}function J4({person:l,open:n,onOpenChange:i}){if(!l)return null;const c=u=>u?new Date(u*1e3).toLocaleString("zh-CN"):"-";return e.jsx(Is,{open:n,onOpenChange:i,children:e.jsxs(Os,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Ds,{children:[e.jsx(Rs,{children:"人物详情"}),e.jsxs(Ks,{children:["查看 ",l.person_name||l.nickname||l.user_id," 的完整信息"]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(zl,{icon:fn,label:"人物名称",value:l.person_name}),e.jsx(zl,{icon:Ma,label:"昵称",value:l.nickname}),e.jsx(zl,{icon:Gr,label:"用户ID",value:l.user_id,mono:!0}),e.jsx(zl,{icon:Gr,label:"人物ID",value:l.person_id,mono:!0}),e.jsx(zl,{label:"平台",value:l.platform}),e.jsx(zl,{label:"状态",value:l.is_known?"已认识":"未认识"})]}),l.name_reason&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[e.jsx(E,{className:"text-xs text-muted-foreground",children:"名称设定原因"}),e.jsx("p",{className:"mt-1 text-sm",children:l.name_reason})]}),l.memory_points&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[e.jsx(E,{className:"text-xs text-muted-foreground",children:"个人印象"}),e.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:l.memory_points})]}),l.group_nick_name&&l.group_nick_name.length>0&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[e.jsx(E,{className:"text-xs text-muted-foreground",children:"群昵称"}),e.jsx("div",{className:"mt-2 space-y-1",children:l.group_nick_name.map((u,x)=>e.jsxs("div",{className:"text-sm flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:u.group_id}),e.jsx("span",{children:"→"}),e.jsx("span",{children:u.group_nick_name})]},x))})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx(zl,{icon:na,label:"认识时间",value:c(l.know_times)}),e.jsx(zl,{icon:na,label:"首次记录",value:c(l.know_since)}),e.jsx(zl,{icon:na,label:"最后更新",value:c(l.last_know)})]})]}),e.jsx(st,{children:e.jsx(_,{onClick:()=>i(!1),children:"关闭"})})]})})}function zl({icon:l,label:n,value:i,mono:c=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(E,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[l&&e.jsx(l,{className:"h-3 w-3"}),n]}),e.jsx("div",{className:I("text-sm",c&&"font-mono",!i&&"text-muted-foreground"),children:i||"-"})]})}function X4({person:l,open:n,onOpenChange:i,onSuccess:c}){const[u,x]=d.useState({}),[h,f]=d.useState(!1),{toast:p}=Zs();d.useEffect(()=>{l&&x({person_name:l.person_name||"",name_reason:l.name_reason||"",nickname:l.nickname||"",is_known:l.is_known})},[l]);const g=async()=>{if(l)try{f(!0),await V4(l.person_id,u),p({title:"保存成功",description:"人物信息已更新"}),c()}catch(N){p({title:"保存失败",description:N instanceof Error?N.message:"无法更新人物信息",variant:"destructive"})}finally{f(!1)}};return l?e.jsx(Is,{open:n,onOpenChange:i,children:e.jsxs(Os,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Ds,{children:[e.jsx(Rs,{children:"编辑人物信息"}),e.jsxs(Ks,{children:["修改 ",l.person_name||l.nickname||l.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(E,{htmlFor:"person_name",children:"人物名称"}),e.jsx(le,{id:"person_name",value:u.person_name||"",onChange:N=>x({...u,person_name:N.target.value}),placeholder:"为这个人设置一个名称"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"nickname",children:"昵称"}),e.jsx(le,{id:"nickname",value:u.nickname||"",onChange:N=>x({...u,nickname:N.target.value}),placeholder:"昵称"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"name_reason",children:"名称设定原因"}),e.jsx(ot,{id:"name_reason",value:u.name_reason||"",onChange:N=>x({...u,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(E,{htmlFor:"is_known",className:"text-base font-medium",children:"已认识"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"标记是否已经认识这个人"})]}),e.jsx(Fe,{id:"is_known",checked:u.is_known,onCheckedChange:N=>x({...u,is_known:N})})]})]}),e.jsxs(st,{children:[e.jsx(_,{variant:"outline",onClick:()=>i(!1),children:"取消"}),e.jsx(_,{onClick:g,disabled:h,children:h?"保存中...":"保存"})]})]})}):null}var Z4=H_();const Dg=E0(Z4),ox="/api/webui";async function W4(l=100,n="all"){const i=`${ox}/knowledge/graph?limit=${l}&node_type=${n}`,c=await fetch(i);if(!c.ok)throw new Error(`获取知识图谱失败: ${c.status}`);return c.json()}async function ek(){const l=await fetch(`${ox}/knowledge/stats`);if(!l.ok)throw new Error("获取知识图谱统计信息失败");return l.json()}async function sk(l){const n=await fetch(`${ox}/knowledge/search?query=${encodeURIComponent(l)}`);if(!n.ok)throw new Error("搜索知识节点失败");return n.json()}const zv=d.memo(({data:l})=>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(Io,{type:"target",position:Po.Top}),e.jsx("div",{className:"font-semibold text-white text-sm truncate max-w-[200px]",title:l.content,children:l.label}),e.jsx(Io,{type:"source",position:Po.Bottom})]}));zv.displayName="EntityNode";const Av=d.memo(({data:l})=>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(Io,{type:"target",position:Po.Top}),e.jsx("div",{className:"font-medium text-white text-xs truncate max-w-[150px]",title:l.content,children:l.label}),e.jsx(Io,{type:"source",position:Po.Bottom})]}));Av.displayName="ParagraphNode";const tk={entity:zv,paragraph:Av};function ak(l,n){const i=new Dg.graphlib.Graph;i.setDefaultEdgeLabel(()=>({})),i.setGraph({rankdir:"TB",ranksep:100,nodesep:80});const c=[],u=[];return l.forEach(x=>{i.setNode(x.id,{width:150,height:50})}),n.forEach(x=>{i.setEdge(x.source,x.target)}),Dg.layout(i),l.forEach(x=>{const h=i.node(x.id);c.push({id:x.id,type:x.type,position:{x:h.x-75,y:h.y-25},data:{label:x.content.slice(0,20)+(x.content.length>20?"...":""),content:x.content}})}),n.forEach((x,h)=>{const f={id:`edge-${h}`,source:x.source,target:x.target,animated:l.length<=200&&x.weight>5,style:{strokeWidth:Math.min(x.weight/2,5),opacity:.6}};x.weight>10&&l.length<100&&(f.label=`${x.weight.toFixed(0)}`),u.push(f)}),{nodes:c,edges:u}}function lk(){const l=ca(),[n,i]=d.useState(!1),[c,u]=d.useState(null),[x,h]=d.useState(""),[f,p]=d.useState("all"),[g,N]=d.useState(50),[v,y]=d.useState("50"),[w,b]=d.useState(!1),[R,D]=d.useState(!0),[S,P]=d.useState(!1),[M,T]=d.useState(!1),[A,F,L]=F_([]),[J,U,ue]=G_([]),[xe,he]=d.useState(0),[ne,ve]=d.useState(null),[je,z]=d.useState(null),{toast:V}=Zs(),B=d.useCallback(H=>H.type==="entity"?"#6366f1":H.type==="paragraph"?"#10b981":"#6b7280",[]),oe=d.useCallback(async(H=!1)=>{try{if(!H&&g>200){T(!0);return}i(!0);const[se,Ee]=await Promise.all([W4(g,f),ek()]);if(u(Ee),se.nodes.length===0){V({title:"提示",description:"知识库为空,请先导入知识数据"}),F([]),U([]);return}const{nodes:Z,edges:Oe}=ak(se.nodes,se.edges);F(Z),U(Oe),he(Z.length),Ee&&Ee.total_nodes>g&&V({title:"提示",description:`知识图谱包含 ${Ee.total_nodes} 个节点,当前显示 ${Z.length} 个`}),V({title:"加载成功",description:`已加载 ${Z.length} 个节点,${Oe.length} 条边`})}catch(se){console.error("加载知识图谱失败:",se),V({title:"加载失败",description:se instanceof Error?se.message:"未知错误",variant:"destructive"})}finally{i(!1)}},[g,f,V]),K=d.useCallback(async()=>{if(!x.trim()){V({title:"提示",description:"请输入搜索关键词"});return}try{const H=await sk(x);if(H.length===0){V({title:"未找到",description:"没有找到匹配的节点"});return}const se=new Set(H.map(Ee=>Ee.id));F(Ee=>Ee.map(Z=>({...Z,style:{...Z.style,opacity:se.has(Z.id)?1:.3,filter:se.has(Z.id)?"brightness(1.2)":"brightness(0.8)"}}))),V({title:"搜索完成",description:`找到 ${H.length} 个匹配节点`})}catch(H){console.error("搜索失败:",H),V({title:"搜索失败",description:H instanceof Error?H.message:"未知错误",variant:"destructive"})}},[x,V]),_e=d.useCallback(()=>{F(H=>H.map(se=>({...se,style:{...se.style,opacity:1,filter:"brightness(1)"}})))},[]),pe=d.useCallback(()=>{D(!1),P(!0),oe()},[oe]),ke=d.useCallback(()=>{T(!1),setTimeout(()=>{oe(!0)},0)},[oe]),O=d.useCallback((H,se)=>{A.find(Z=>Z.id===se.id)&&ve({id:se.id,type:se.type,content:se.data.content})},[A]);d.useEffect(()=>{R||S&&oe()},[g,f,R,S]);const k=d.useCallback((H,se)=>{const Ee=A.find(ns=>ns.id===se.source),Z=A.find(ns=>ns.id===se.target),Oe=J.find(ns=>ns.id===se.id);Ee&&Z&&Oe&&z({source:{id:Ee.id,type:Ee.type,content:Ee.data.content},target:{id:Z.id,type:Z.type,content:Z.data.content},edge:{source:se.source,target:se.target,weight:parseFloat(se.label||"0")}})},[A,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(Se,{variant:"outline",className:"gap-1",children:[e.jsx(Hr,{className:"h-3 w-3"}),"节点: ",c.total_nodes]}),e.jsxs(Se,{variant:"outline",className:"gap-1",children:[e.jsx(Bj,{className:"h-3 w-3"}),"边: ",c.total_edges]}),e.jsxs(Se,{variant:"outline",className:"gap-1",children:[e.jsx(Ht,{className:"h-3 w-3"}),"实体: ",c.entity_nodes]}),e.jsxs(Se,{variant:"outline",className:"gap-1",children:[e.jsx(Ca,{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(le,{placeholder:"搜索节点内容...",value:x,onChange:H=>h(H.target.value),onKeyDown:H=>H.key==="Enter"&&K(),className:"flex-1"}),e.jsx(_,{onClick:K,size:"sm",children:e.jsx(Tt,{className:"h-4 w-4"})}),e.jsx(_,{onClick:_e,variant:"outline",size:"sm",children:"重置"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(Ie,{value:f,onValueChange:H=>p(H),children:[e.jsx($e,{className:"w-[120px]",children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(X,{value:"all",children:"全部节点"}),e.jsx(X,{value:"entity",children:"仅实体"}),e.jsx(X,{value:"paragraph",children:"仅段落"})]})]}),e.jsxs(Ie,{value:g===1e4?"all":w?"custom":g.toString(),onValueChange:H=>{H==="custom"?(b(!0),y(g.toString())):H==="all"?(b(!1),N(1e4)):(b(!1),N(Number(H)))},children:[e.jsx($e,{className:"w-[120px]",children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(X,{value:"50",children:"50 节点"}),e.jsx(X,{value:"100",children:"100 节点"}),e.jsx(X,{value:"200",children:"200 节点"}),e.jsx(X,{value:"500",children:"500 节点"}),e.jsx(X,{value:"1000",children:"1000 节点"}),e.jsx(X,{value:"all",children:"全部 (最多10000)"}),e.jsx(X,{value:"custom",children:"自定义..."})]})]}),w&&e.jsx(le,{type:"number",min:"50",value:v,onChange:H=>y(H.target.value),onBlur:()=>{const H=parseInt(v);!isNaN(H)&&H>=50?N(H):(y("50"),N(50))},onKeyDown:H=>{if(H.key==="Enter"){const se=parseInt(v);!isNaN(se)&&se>=50?N(se):(y("50"),N(50))}},placeholder:"最少50个",className:"w-[120px]"}),e.jsx(_,{onClick:()=>oe(),variant:"outline",size:"sm",disabled:n,children:e.jsx(dt,{className:I("h-4 w-4",n&&"animate-spin")})})]})]})]}),e.jsx("div",{className:"flex-1 relative",children:n?e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(dt,{className:"h-8 w-8 animate-spin mx-auto mb-2 text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground",children:"加载知识图谱中..."})]})}):A.length===0?e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(Hr,{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(V_,{nodes:A,edges:J,onNodesChange:L,onEdgesChange:ue,onNodeClick:O,onEdgeClick:k,nodeTypes:tk,fitView:!0,minZoom:.05,maxZoom:1.5,defaultViewport:{x:0,y:0,zoom:.5},elevateNodesOnSelect:xe<=500,nodesDraggable:xe<=1e3,attributionPosition:"bottom-left",children:[e.jsx(q_,{variant:K_.Dots,gap:12,size:1}),e.jsx(Q_,{}),xe<=500&&e.jsx(Y_,{nodeColor:B,nodeBorderRadius:8,pannable:!0,zoomable:!0}),e.jsxs(J_,{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:"段落节点"})]}),xe>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:"已禁用动画"}),xe>500&&e.jsx("div",{children:"已禁用缩略图"})]})]})]})]})}),e.jsx(Is,{open:!!ne,onOpenChange:H=>!H&&ve(null),children:e.jsxs(Os,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsx(Ds,{children:e.jsx(Rs,{children:"节点详情"})}),ne&&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(Se,{variant:ne.type==="entity"?"default":"secondary",children:ne.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:ne.id})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"内容"}),e.jsx(Ye,{className:"mt-1 h-40 p-3 bg-muted rounded",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:ne.content})})]})]})]})}),e.jsx(Is,{open:!!je,onOpenChange:H=>!H&&z(null),children:e.jsxs(Os,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[e.jsx(Ds,{children:e.jsx(Rs,{children:"边详情"})}),je&&e.jsx(Ye,{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:je.source.content}),e.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[je.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:je.target.content}),e.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[je.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(Se,{variant:"outline",className:"text-base font-mono",children:je.edge.weight.toFixed(4)})})]})]})})]})}),e.jsx(vs,{open:R,onOpenChange:D,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"加载知识图谱"}),e.jsxs(hs,{children:["知识图谱的动态展示会消耗较多系统资源。",e.jsx("br",{}),"确定要加载知识图谱吗?"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{onClick:()=>l({to:"/"}),children:"取消 (返回首页)"}),e.jsx(fs,{onClick:pe,children:"确认加载"})]})]})}),e.jsx(vs,{open:M,onOpenChange:T,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"⚠️ 节点数量较多"}),e.jsx(hs,{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(ms,{children:[e.jsx(ps,{onClick:()=>{T(!1),g>200&&(N(50),b(!1))},children:"取消"}),e.jsx(fs,{onClick:ke,className:"bg-orange-600 hover:bg-orange-700",children:"我了解风险,继续加载"})]})]})})]})}function nk(){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(Hr,{className:"h-10 w-10 text-primary"})}),e.jsx(Le,{className:"text-2xl",children:"麦麦知识库管理"}),e.jsx(ws,{className:"text-base",children:"功能开发中,敬请期待"})]}),e.jsx(Ae,{className:"text-center text-sm text-muted-foreground",children:e.jsx("p",{children:"此功能将提供知识库的创建、编辑、导入和管理能力"})})]})})})]})}function Rg({className:l,classNames:n,showOutsideDays:i=!0,captionLayout:c="label",buttonVariant:u="ghost",formatters:x,components:h,...f}){const p=sv();return e.jsx(R_,{showOutsideDays:i,className:I("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`,l),captionLayout:c,formatters:{formatMonthDropdown:g=>g.toLocaleString("default",{month:"short"}),...x},classNames:{root:I("w-fit",p.root),months:I("relative flex flex-col gap-4 md:flex-row",p.months),month:I("flex w-full flex-col gap-4",p.month),nav:I("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",p.nav),button_previous:I(qr({variant:u}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",p.button_previous),button_next:I(qr({variant:u}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",p.button_next),month_caption:I("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",p.month_caption),dropdowns:I("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",p.dropdowns),dropdown_root:I("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:I("bg-popover absolute inset-0 opacity-0",p.dropdown),caption_label:I("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:I("flex",p.weekdays),weekday:I("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",p.weekday),week:I("mt-2 flex w-full",p.week),week_number_header:I("w-[--cell-size] select-none",p.week_number_header),week_number:I("text-muted-foreground select-none text-[0.8rem]",p.week_number),day:I("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:I("bg-accent rounded-l-md",p.range_start),range_middle:I("rounded-none",p.range_middle),range_end:I("bg-accent rounded-r-md",p.range_end),today:I("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",p.today),outside:I("text-muted-foreground aria-selected:text-muted-foreground",p.outside),disabled:I("text-muted-foreground opacity-50",p.disabled),hidden:I("invisible",p.hidden),...n},components:{Root:({className:g,rootRef:N,...v})=>e.jsx("div",{"data-slot":"calendar",ref:N,className:I(g),...v}),Chevron:({className:g,orientation:N,...v})=>N==="left"?e.jsx(Aa,{className:I("size-4",g),...v}):N==="right"?e.jsx(Zt,{className:I("size-4",g),...v}):e.jsx(za,{className:I("size-4",g),...v}),DayButton:rk,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 rk({className:l,day:n,modifiers:i,...c}){const u=sv(),x=d.useRef(null);return d.useEffect(()=>{i.focused&&x.current?.focus()},[i.focused]),e.jsx(_,{ref:x,variant:"ghost",size:"icon","data-day":n.date.toLocaleDateString(),"data-selected-single":i.selected&&!i.range_start&&!i.range_end&&!i.range_middle,"data-range-start":i.range_start,"data-range-end":i.range_end,"data-range-middle":i.range_middle,className:I("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",u.day,l),...c})}const To={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 ik(){const[l,n]=d.useState([]),[i,c]=d.useState(""),[u,x]=d.useState("all"),[h,f]=d.useState("all"),[p,g]=d.useState(void 0),[N,v]=d.useState(void 0),[y,w]=d.useState(!0),[b,R]=d.useState(!1),[D,S]=d.useState("xs"),[P,M]=d.useState(4),[T,A]=d.useState(!1),F=d.useRef(null);d.useEffect(()=>{const K=In.getAllLogs();n(K);const _e=In.onLog(()=>{n(In.getAllLogs())}),pe=In.onConnectionChange(ke=>{R(ke)});return()=>{_e(),pe()}},[]);const L=d.useMemo(()=>{const K=new Set(l.map(_e=>_e.module).filter(_e=>_e&&_e.trim()!==""));return Array.from(K).sort()},[l]),J=K=>{switch(K){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"}},U=K=>{switch(K){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"}},ue=()=>{window.location.reload()},xe=()=>{In.clearLogs(),n([])},he=()=>{const K=je.map(O=>`${O.timestamp} [${O.level.padEnd(8)}] [${O.module}] ${O.message}`).join(` -`),_e=new Blob([K],{type:"text/plain;charset=utf-8"}),pe=URL.createObjectURL(_e),ke=document.createElement("a");ke.href=pe,ke.download=`logs-${vm(new Date,"yyyy-MM-dd-HHmmss")}.txt`,ke.click(),URL.revokeObjectURL(pe)},ne=()=>{w(!y)},ve=()=>{g(void 0),v(void 0)},je=d.useMemo(()=>l.filter(K=>{const _e=i===""||K.message.toLowerCase().includes(i.toLowerCase())||K.module.toLowerCase().includes(i.toLowerCase()),pe=u==="all"||K.level===u,ke=h==="all"||K.module===h;let O=!0;if(p||N){const k=new Date(K.timestamp);if(p){const H=new Date(p);H.setHours(0,0,0,0),O=O&&k>=H}if(N){const H=new Date(N);H.setHours(23,59,59,999),O=O&&k<=H}}return _e&&pe&&ke&&O}),[l,i,u,h,p,N]),z=To[D].rowHeight+P,V=N0({count:je.length,getScrollElement:()=>F.current,estimateSize:()=>z,overscan:50}),B=d.useRef(!1),oe=d.useRef(je.length);return d.useEffect(()=>{const K=F.current;if(!K)return;const _e=()=>{if(B.current)return;const{scrollTop:pe,scrollHeight:ke,clientHeight:O}=K,k=ke-pe-O;k>100&&y?w(!1):k<50&&!y&&w(!0)};return K.addEventListener("scroll",_e,{passive:!0}),()=>K.removeEventListener("scroll",_e)},[y]),d.useEffect(()=>{const K=je.length>oe.current;oe.current=je.length,y&&je.length>0&&K&&(B.current=!0,V.scrollToIndex(je.length-1,{align:"end",behavior:"auto"}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{B.current=!1})}))},[je.length,y,V]),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:I("h-2 w-2 sm:h-2.5 sm:w-2.5 rounded-full",b?"bg-green-500 animate-pulse":"bg-red-500")}),e.jsx("span",{className:"text-xs text-muted-foreground",children:b?"已连接":"未连接"})]})]}),e.jsx(Ce,{className:"p-2 sm:p-3",children:e.jsx(nc,{open:T,onOpenChange:A,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(Tt,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),e.jsx(le,{placeholder:"搜索日志...",value:i,onChange:K=>c(K.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:ne,className:"h-8 px-2",title:y?"自动滚动":"已暂停",children:[y?e.jsx(l_,{className:"h-3.5 w-3.5"}):e.jsx(n_,{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:xe,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:he,className:"h-8 px-2 hidden sm:flex",title:"导出日志",children:[e.jsx(sa,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"ml-1 text-xs hidden lg:inline",children:"导出"})]}),e.jsx(rc,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:"h-8 px-2",title:T?"收起筛选":"展开筛选",children:[e.jsx(zo,{className:"h-3.5 w-3.5"}),T?e.jsx(Fr,{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:[je.length," / ",l.length]}),e.jsx("span",{className:"ml-1",children:"条日志"})]}),e.jsxs(ic,{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-2",children:[e.jsxs(Ie,{value:u,onValueChange:x,children:[e.jsxs($e,{className:"w-full sm:flex-1 h-8 text-xs",children:[e.jsx(zo,{className:"h-3.5 w-3.5 mr-1.5"}),e.jsx(Pe,{placeholder:"级别"})]}),e.jsxs(Be,{children:[e.jsx(X,{value:"all",children:"全部级别"}),e.jsx(X,{value:"DEBUG",children:"DEBUG"}),e.jsx(X,{value:"INFO",children:"INFO"}),e.jsx(X,{value:"WARNING",children:"WARNING"}),e.jsx(X,{value:"ERROR",children:"ERROR"}),e.jsx(X,{value:"CRITICAL",children:"CRITICAL"})]})]}),e.jsxs(Ie,{value:h,onValueChange:f,children:[e.jsxs($e,{className:"w-full sm:flex-1 h-8 text-xs",children:[e.jsx(zo,{className:"h-3.5 w-3.5 mr-1.5"}),e.jsx(Pe,{placeholder:"模块"})]}),e.jsxs(Be,{children:[e.jsx(X,{value:"all",children:"全部模块"}),L.map(K=>e.jsx(X,{value:K,children:K},K))]})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-2",children:[e.jsxs(ol,{children:[e.jsx(dl,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:I("w-full sm:flex-1 justify-start text-left font-normal h-8",!p&&"text-muted-foreground"),children:[e.jsx($o,{className:"mr-1.5 h-3.5 w-3.5"}),e.jsx("span",{className:"text-xs",children:p?vm(p,"PP",{locale:ko}):"开始日期"})]})}),e.jsx(Wa,{className:"w-auto p-0",align:"start",children:e.jsx(Rg,{mode:"single",selected:p,onSelect:g,initialFocus:!0,locale:ko})})]}),e.jsxs(ol,{children:[e.jsx(dl,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:I("w-full sm:flex-1 justify-start text-left font-normal h-8",!N&&"text-muted-foreground"),children:[e.jsx($o,{className:"mr-1.5 h-3.5 w-3.5"}),e.jsx("span",{className:"text-xs",children:N?vm(N,"PP",{locale:ko}):"结束日期"})]})}),e.jsx(Wa,{className:"w-auto p-0",align:"start",children:e.jsx(Rg,{mode:"single",selected:N,onSelect:v,initialFocus:!0,locale:ko})})]}),(p||N)&&e.jsxs(_,{variant:"outline",size:"sm",onClick:ve,className:"w-full sm:w-auto h-8",children:[e.jsx(Ea,{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(r_,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"字号"})]}),e.jsx("div",{className:"flex gap-1",children:Object.keys(To).map(K=>e.jsx(_,{variant:D===K?"default":"outline",size:"sm",onClick:()=>S(K),className:"h-6 px-2 text-xs",children:To[K].label},K))})]}),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:[P],onValueChange:([K])=>M(K),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:ue,className:"flex-1 h-8",children:[e.jsx(dt,{className:"h-3.5 w-3.5 mr-1"}),e.jsx("span",{className:"text-xs",children:"刷新"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:he,className:"flex-1 h-8",children:[e.jsx(sa,{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:F,className:I("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:I("p-2 sm:p-3 font-mono relative",To[D].class),style:{height:`${V.getTotalSize()}px`},children:je.length===0?e.jsx("div",{className:"text-gray-500 dark:text-gray-600 text-center py-8 text-xs sm:text-sm",children:"暂无日志数据"}):V.getVirtualItems().map(K=>{const _e=je[K.index];return e.jsxs("div",{"data-index":K.index,ref:V.measureElement,className:I("absolute top-0 left-0 w-full px-2 sm:px-3 rounded hover:bg-white/5 transition-colors",U(_e.level)),style:{transform:`translateY(${K.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:I("font-semibold text-[10px]",J(_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:I("flex-shrink-0 w-[65px] lg:w-[75px] font-semibold",J(_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})]})]},K.key)})})})})})]})}async function ck(){return(await we("/api/planner/overview")).json()}async function ok(l,n=1,i=20,c){const u=new URLSearchParams({page:n.toString(),page_size:i.toString()});return c&&u.append("search",c),(await we(`/api/planner/chat/${l}/logs?${u}`)).json()}async function dk(l,n){return(await we(`/api/planner/log/${l}/${n}`)).json()}async function uk(){return(await we("/api/replier/overview")).json()}async function mk(l,n=1,i=20,c){const u=new URLSearchParams({page:n.toString(),page_size:i.toString()});return c&&u.append("search",c),(await we(`/api/replier/chat/${l}/logs?${u}`)).json()}async function xk(l,n){return(await we(`/api/replier/log/${l}/${n}`)).json()}function Ov(){const[l,n]=d.useState(new Map),[i,c]=d.useState(!0),u=d.useCallback(async()=>{try{c(!0);const h=await Zm();if(h?.data){const f=new Map;h.data.forEach(p=>{f.set(p.chat_id,p.chat_name)}),n(f)}}catch(h){console.error("加载聊天列表失败:",h)}finally{c(!1)}},[]);d.useEffect(()=>{u()},[u]);const x=d.useCallback(h=>l.get(h)||h,[l]);return{chatNameMap:l,getChatName:x,loading:i,reload:u}}function Fo(l){return new Date(l*1e3).toLocaleString("zh-CN")}function Dv(l){const i=Date.now()/1e3-l;return i<60?"刚刚":i<3600?`${Math.floor(i/60)} 分钟前`:i<86400?`${Math.floor(i/3600)} 小时前`:`${Math.floor(i/86400)} 天前`}function Rv(l,n,i=1e4){d.useEffect(()=>{if(!l)return;const c=setInterval(n,i);return()=>clearInterval(c)},[l,n,i])}function hk({autoRefresh:l,refreshKey:n}){const[i,c]=d.useState("overview"),[u,x]=d.useState(null),{getChatName:h}=Ov(),[f,p]=d.useState(null),[g,N]=d.useState(!0),[v,y]=d.useState(null),[w,b]=d.useState(!1),[R,D]=d.useState(1),[S,P]=d.useState(20),[M,T]=d.useState(""),[A,F]=d.useState(""),[L,J]=d.useState(""),[U,ue]=d.useState(null),[xe,he]=d.useState(!1),[ne,ve]=d.useState(!1),je=d.useCallback(async()=>{try{N(!0);const k=await ck();p(k)}catch(k){console.error("加载规划器总览失败:",k)}finally{N(!1)}},[]),z=d.useCallback(async()=>{if(u)try{b(!0);const k=await ok(u.chat_id,R,S,A||void 0);y(k)}catch(k){console.error("加载聊天日志失败:",k)}finally{b(!1)}},[u,R,S,A]);d.useEffect(()=>{je()},[je]),d.useEffect(()=>{n>0&&(i==="overview"?je():z())},[n,i,je,z]),d.useEffect(()=>{i==="chat-logs"&&u&&z()},[i,u,z]),Rv(l,d.useCallback(()=>{i==="overview"?je():z()},[i,je,z]));const V=k=>{x(k),D(1),F(""),J(""),c("chat-logs")},B=()=>{c("overview"),x(null),y(null),F(""),J("")},oe=()=>{F(L),D(1)},K=()=>{J(""),F(""),D(1)},_e=async(k,H)=>{try{ve(!0),he(!0);const se=await dk(k,H);ue(se)}catch(se){console.error("加载计划详情失败:",se)}finally{ve(!1)}},pe=k=>{P(Number(k)),D(1)},ke=()=>{const k=parseInt(M),H=v?Math.ceil(v.total/v.page_size):0;!isNaN(k)&&k>=1&&k<=H&&(D(k),T(""))},O=v?Math.ceil(v.total/v.page_size):0;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-4",children:i==="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(Le,{className:"text-sm font-medium",children:"聊天数量"}),e.jsx(Ma,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(Ae,{children:g?e.jsx(js,{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(Le,{className:"text-sm font-medium",children:"计划总数"}),e.jsx(Vm,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(Ae,{children:g?e.jsx(js,{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(Le,{children:"聊天列表"}),e.jsx(ws,{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((k,H)=>e.jsx(js,{className:"h-24 w-full"},H))}):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(k=>e.jsxs("div",{className:"border rounded-lg p-4 hover:bg-accent/50 transition-colors cursor-pointer",onClick:()=>V(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(Ma,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm truncate max-w-[180px]",title:h(k.chat_id),children:h(k.chat_id)})]}),e.jsx(Se,{variant:"secondary",children:k.plan_count})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["最后活动: ",Dv(k.latest_timestamp)]})]},k.chat_id))}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无聊天记录"})})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:B,children:[e.jsx(Ta,{className:"h-4 w-4 mr-2"}),"返回聊天列表"]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:["当前聊天: ",e.jsx("span",{className:"font-medium",children:u?h(u.chat_id):""}),e.jsx("span",{className:"mx-2",children:"•"}),"共 ",v?.total||0," 条计划记录"]})]}),e.jsxs(Ce,{children:[e.jsxs(De,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Le,{children:"计划执行记录"}),e.jsx(ws,{children:u?h(u.chat_id):""})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(le,{placeholder:"搜索提示词内容...",value:L,onChange:k=>J(k.target.value),onKeyDown:k=>k.key==="Enter"&&oe(),className:"w-48"}),e.jsx(_,{variant:"outline",size:"icon",onClick:oe,children:e.jsx(Tt,{className:"h-4 w-4"})}),A&&e.jsx(_,{variant:"ghost",size:"sm",onClick:K,children:"清除"})]}),e.jsxs(Ie,{value:S.toString(),onValueChange:pe,children:[e.jsx($e,{className:"w-32",children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(X,{value:"10",children:"10条/页"}),e.jsx(X,{value:"20",children:"20条/页"}),e.jsx(X,{value:"50",children:"50条/页"}),e.jsx(X,{value:"100",children:"100条/页"})]})]})]})]}),A&&e.jsxs("div",{className:"text-sm text-muted-foreground mt-2",children:["搜索关键词: ",e.jsxs("span",{className:"font-medium",children:['"',A,'"']})]})]}),e.jsx(Ae,{children:w?e.jsx("div",{className:"space-y-2",children:[...Array(5)].map((k,H)=>e.jsx(js,{className:"h-20 w-full"},H))}):v?.data&&v.data.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-2",children:v.data.map(k=>e.jsxs("div",{className:"border rounded-lg p-3 hover:bg-accent/50 transition-colors cursor-pointer",onClick:()=>_e(k.chat_id,k.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:Fo(k.timestamp)}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsxs(Se,{variant:"secondary",className:"text-xs",children:[k.action_count," 个动作"]}),e.jsxs(Se,{variant:"outline",className:"text-xs",children:[k.total_plan_ms.toFixed(0),"ms"]})]})]}),k.action_types&&k.action_types.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:k.action_types.map((H,se)=>e.jsx(Se,{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:H},se))}),e.jsx("p",{className:"text-sm line-clamp-2",children:k.reasoning_preview||"无推理内容"})]},k.filename))}),e.jsxs("div",{className:"flex items-center justify-between mt-4 pt-4 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",v.total," 条记录,第 ",R," / ",O," 页"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>D(1),disabled:R===1,children:e.jsx(gn,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>D(k=>Math.max(1,k-1)),disabled:R===1,children:e.jsx(Aa,{className:"h-4 w-4"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(le,{type:"number",min:1,max:O,value:M,onChange:k=>T(k.target.value),onKeyDown:k=>k.key==="Enter"&&ke(),placeholder:"跳转",className:"w-20 h-8"}),e.jsx(_,{size:"sm",variant:"outline",onClick:ke,children:"跳转"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>D(k=>Math.min(O,k+1)),disabled:R===O,children:e.jsx(Zt,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>D(O),disabled:R===O,children:e.jsx(jn,{className:"h-4 w-4"})})]})]})]}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无计划记录"})})]})]})}),e.jsx(Is,{open:xe,onOpenChange:he,children:e.jsxs(Os,{className:"max-w-4xl max-h-[80vh] grid grid-rows-[auto_1fr_auto] overflow-hidden",children:[e.jsxs(Ds,{children:[e.jsxs(Rs,{className:"flex items-center gap-2",children:[e.jsx(Ca,{className:"h-5 w-5"}),"计划执行详情"]}),e.jsx(Ks,{children:"查看麦麦的详细计划推理过程和执行动作"})]}),e.jsx(Ye,{className:"h-full pr-4",children:e.jsx("div",{className:"space-y-6 pb-4",children:ne?e.jsx("div",{className:"space-y-4",children:[...Array(5)].map((k,H)=>e.jsx(js,{className:"h-24 w-full"},H))}):U?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-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:U.chat_id,children:h(U.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:Fo(U.timestamp)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"类型"}),e.jsx(Se,{variant:"outline",children:U.type})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"动作数量"}),e.jsxs(Se,{children:[U.actions.length," 个动作"]})]})]})]}),e.jsx(Yt,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(Za,{className:"h-4 w-4"}),"性能统计"]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs(Ce,{children:[e.jsx(De,{className:"p-4 pb-2",children:e.jsx(Le,{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:[U.timing.prompt_build_ms?.toFixed(2)||0,"ms"]})})]}),e.jsxs(Ce,{children:[e.jsx(De,{className:"p-4 pb-2",children:e.jsx(Le,{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:[U.timing.llm_duration_ms?.toFixed(2)||0,"ms"]})})]}),e.jsxs(Ce,{children:[e.jsx(De,{className:"p-4 pb-2",children:e.jsx(Le,{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:[U.timing.total_plan_ms?.toFixed(2)||0,"ms"]})})]})]})]}),e.jsx(Yt,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(Xm,{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:U.reasoning||"无推理内容"})})]}),e.jsx(Yt,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(i_,{className:"h-4 w-4"}),"执行动作 (",U.actions.length,")"]}),e.jsx("div",{className:"space-y-3",children:U.actions.map((k,H)=>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(Se,{variant:"default",children:["动作 ",H+1]}),e.jsx(Se,{variant:"outline",children:k.action_type})]})})}),e.jsxs(Ae,{className:"p-4 pt-0 space-y-3",children:[k.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 k.reasoning=="string"?k.reasoning:JSON.stringify(k.reasoning)})]}),k.action_message&&e.jsxs("div",{className:"overflow-hidden",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:"动作消息"}),typeof k.action_message=="string"?e.jsx("p",{className:"text-sm bg-muted/30 p-2 rounded break-all whitespace-pre-wrap",children:k.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(k.action_message,null,2)})]}),k.action_data&&Object.keys(k.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(k.action_data,null,2)})]}),k.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 k.action_reasoning=="string"?k.action_reasoning:JSON.stringify(k.action_reasoning)})]})]})]},H))})]}),e.jsx(Yt,{}),U.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:U.raw_output})})]})]}),U.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:U.prompt})})]})]})]}):e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("p",{className:"text-muted-foreground",children:"无数据"})})})}),e.jsx(st,{className:"flex-shrink-0",children:e.jsx(_,{onClick:()=>he(!1),children:"关闭"})})]})})]})}function fk({autoRefresh:l,refreshKey:n}){const[i,c]=d.useState("overview"),[u,x]=d.useState(null),{getChatName:h}=Ov(),[f,p]=d.useState(null),[g,N]=d.useState(!0),[v,y]=d.useState(null),[w,b]=d.useState(!1),[R,D]=d.useState(1),[S,P]=d.useState(20),[M,T]=d.useState(""),[A,F]=d.useState(""),[L,J]=d.useState(""),[U,ue]=d.useState(null),[xe,he]=d.useState(!1),[ne,ve]=d.useState(!1),je=d.useCallback(async()=>{try{N(!0);const k=await uk();p(k)}catch(k){console.error("加载回复器总览失败:",k)}finally{N(!1)}},[]),z=d.useCallback(async()=>{if(u)try{b(!0);const k=await mk(u.chat_id,R,S,A||void 0);y(k)}catch(k){console.error("加载聊天日志失败:",k)}finally{b(!1)}},[u,R,S,A]);d.useEffect(()=>{je()},[je]),d.useEffect(()=>{n>0&&(i==="overview"?je():z())},[n,i,je,z]),d.useEffect(()=>{i==="chat-logs"&&u&&z()},[i,u,z]),Rv(l,d.useCallback(()=>{i==="overview"?je():z()},[i,je,z]));const V=k=>{x(k),D(1),F(""),J(""),c("chat-logs")},B=()=>{c("overview"),x(null),y(null),F(""),J("")},oe=()=>{F(L),D(1)},K=()=>{J(""),F(""),D(1)},_e=async(k,H)=>{try{ve(!0),he(!0);const se=await xk(k,H);ue(se)}catch(se){console.error("加载回复详情失败:",se)}finally{ve(!1)}},pe=k=>{P(Number(k)),D(1)},ke=()=>{const k=parseInt(M),H=v?Math.ceil(v.total/v.page_size):0;!isNaN(k)&&k>=1&&k<=H&&(D(k),T(""))},O=v?Math.ceil(v.total/v.page_size):0;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-4",children:i==="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(Le,{className:"text-sm font-medium",children:"聊天数量"}),e.jsx(Ma,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(Ae,{children:g?e.jsx(js,{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(Le,{className:"text-sm font-medium",children:"回复总数"}),e.jsx(Vm,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(Ae,{children:g?e.jsx(js,{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(Le,{children:"聊天列表"}),e.jsx(ws,{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((k,H)=>e.jsx(js,{className:"h-24 w-full"},H))}):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(k=>e.jsxs("div",{className:"border rounded-lg p-4 hover:bg-accent/50 transition-colors cursor-pointer",onClick:()=>V(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(Ma,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm truncate max-w-[180px]",title:h(k.chat_id),children:h(k.chat_id)})]}),e.jsx(Se,{variant:"secondary",children:k.reply_count})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["最后活动: ",Dv(k.latest_timestamp)]})]},k.chat_id))}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无聊天记录"})})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:B,children:[e.jsx(Ta,{className:"h-4 w-4 mr-2"}),"返回聊天列表"]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:["当前聊天: ",e.jsx("span",{className:"font-medium",children:u?h(u.chat_id):""}),e.jsx("span",{className:"mx-2",children:"•"}),"共 ",v?.total||0," 条回复记录"]})]}),e.jsxs(Ce,{children:[e.jsxs(De,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Le,{children:"回复生成记录"}),e.jsx(ws,{children:u?h(u.chat_id):""})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(le,{placeholder:"搜索提示词内容...",value:L,onChange:k=>J(k.target.value),onKeyDown:k=>k.key==="Enter"&&oe(),className:"w-48"}),e.jsx(_,{variant:"outline",size:"icon",onClick:oe,children:e.jsx(Tt,{className:"h-4 w-4"})}),A&&e.jsx(_,{variant:"ghost",size:"sm",onClick:K,children:"清除"})]}),e.jsxs(Ie,{value:S.toString(),onValueChange:pe,children:[e.jsx($e,{className:"w-32",children:e.jsx(Pe,{})}),e.jsxs(Be,{children:[e.jsx(X,{value:"10",children:"10条/页"}),e.jsx(X,{value:"20",children:"20条/页"}),e.jsx(X,{value:"50",children:"50条/页"}),e.jsx(X,{value:"100",children:"100条/页"})]})]})]})]}),A&&e.jsxs("div",{className:"text-sm text-muted-foreground mt-2",children:["搜索关键词: ",e.jsxs("span",{className:"font-medium",children:['"',A,'"']})]})]}),e.jsx(Ae,{children:w?e.jsx("div",{className:"space-y-2",children:[...Array(5)].map((k,H)=>e.jsx(js,{className:"h-20 w-full"},H))}):v?.data&&v.data.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-2",children:v.data.map(k=>e.jsxs("div",{className:"border rounded-lg p-3 hover:bg-accent/50 transition-colors cursor-pointer",onClick:()=>_e(k.chat_id,k.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:Fo(k.timestamp)}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[k.success?e.jsxs(Se,{variant:"default",className:"text-xs bg-green-600",children:[e.jsx(ig,{className:"h-3 w-3 mr-1"}),"成功"]}):e.jsxs(Se,{variant:"destructive",className:"text-xs",children:[e.jsx(Va,{className:"h-3 w-3 mr-1"}),"失败"]}),e.jsx(Se,{variant:"outline",className:"text-xs",children:k.model}),e.jsxs(Se,{variant:"secondary",className:"text-xs",children:[k.overall_ms.toFixed(0),"ms"]})]})]}),e.jsx("p",{className:"text-sm line-clamp-2",children:k.output_preview||"无输出内容"})]},k.filename))}),e.jsxs("div",{className:"flex items-center justify-between mt-4 pt-4 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",v.total," 条记录,第 ",R," / ",O," 页"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>D(1),disabled:R===1,children:e.jsx(gn,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>D(k=>Math.max(1,k-1)),disabled:R===1,children:e.jsx(Aa,{className:"h-4 w-4"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(le,{type:"number",min:1,max:O,value:M,onChange:k=>T(k.target.value),onKeyDown:k=>k.key==="Enter"&&ke(),placeholder:"跳转",className:"w-20 h-8"}),e.jsx(_,{size:"sm",variant:"outline",onClick:ke,children:"跳转"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>D(k=>Math.min(O,k+1)),disabled:R===O,children:e.jsx(Zt,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>D(O),disabled:R===O,children:e.jsx(jn,{className:"h-4 w-4"})})]})]})]}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无回复记录"})})]})]})}),e.jsx(Is,{open:xe,onOpenChange:he,children:e.jsxs(Os,{className:"max-w-4xl max-h-[80vh] grid grid-rows-[auto_1fr_auto] overflow-hidden",children:[e.jsxs(Ds,{children:[e.jsxs(Rs,{className:"flex items-center gap-2",children:[e.jsx(Ca,{className:"h-5 w-5"}),"回复生成详情"]}),e.jsx(Ks,{children:"查看麦麦的详细回复生成过程"})]}),e.jsx(Ye,{className:"h-full pr-4",children:e.jsx("div",{className:"space-y-6 pb-4",children:ne?e.jsx("div",{className:"space-y-4",children:[...Array(5)].map((k,H)=>e.jsx(js,{className:"h-24 w-full"},H))}):U?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-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:U.chat_id,children:h(U.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:Fo(U.timestamp)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"状态"}),U.success?e.jsxs(Se,{variant:"default",className:"bg-green-600",children:[e.jsx(ig,{className:"h-3 w-3 mr-1"}),"成功"]}):e.jsxs(Se,{variant:"destructive",children:[e.jsx(Va,{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(Se,{variant:"outline",children:["Level ",U.think_level]})]})]})]}),e.jsx(Yt,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(c_,{className:"h-4 w-4"}),"模型信息"]}),e.jsx("div",{className:"p-4 bg-muted/50 rounded-lg",children:e.jsx(Se,{variant:"secondary",className:"text-sm",children:U.model})})]}),e.jsx(Yt,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(Za,{className:"h-4 w-4"}),"性能统计"]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs(Ce,{children:[e.jsx(De,{className:"p-4 pb-2",children:e.jsx(Le,{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:[U.timing.prompt_ms?.toFixed(2)||0,"ms"]})})]}),e.jsxs(Ce,{children:[e.jsx(De,{className:"p-4 pb-2",children:e.jsx(Le,{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:[U.timing.llm_ms?.toFixed(2)||0,"ms"]})})]}),e.jsxs(Ce,{children:[e.jsx(De,{className:"p-4 pb-2",children:e.jsx(Le,{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:[U.timing.overall_ms?.toFixed(2)||0,"ms"]})})]})]}),U.timing.timing_logs&&U.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:U.timing.timing_logs.map((k,H)=>e.jsx("div",{className:"text-xs text-muted-foreground",children:k},H))})]}),U.timing.almost_zero&&e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:[e.jsx("span",{className:"font-medium",children:"近乎零耗时: "}),U.timing.almost_zero]})]}),e.jsx(Yt,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(Xm,{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:U.output||"无输出内容"})})]}),U.processed_output&&U.processed_output.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(Yt,{}),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:U.processed_output.map((k,H)=>e.jsx("div",{className:"p-3 bg-muted/30 rounded-lg",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:k})},H))})]})]}),U.reasoning&&e.jsxs(e.Fragment,{children:[e.jsx(Yt,{}),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:U.reasoning})})]})]}),U.error&&e.jsxs(e.Fragment,{children:[e.jsx(Yt,{}),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:U.error})})]})]}),U.prompt&&e.jsxs(e.Fragment,{children:[e.jsx(Yt,{}),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:U.prompt})})]})]})]})]}):e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("p",{className:"text-muted-foreground",children:"无数据"})})})}),e.jsx(st,{className:"flex-shrink-0",children:e.jsx(_,{onClick:()=>he(!1),children:"关闭"})})]})})]})}function pk(){const[l,n]=d.useState("planner"),[i,c]=d.useState(!1),[u,x]=d.useState(0),h=d.useCallback(()=>{x(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:i?"default":"outline",size:"sm",onClick:()=>c(!i),children:[e.jsx(dt,{className:`h-4 w-4 mr-2 ${i?"animate-spin":""}`}),i?"自动刷新中":"自动刷新"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:h,children:e.jsx(dt,{className:"h-4 w-4"})})]})]}),e.jsxs(ta,{value:l,onValueChange:f=>n(f),className:"w-full",children:[e.jsxs(Xt,{className:"grid w-full grid-cols-2 gap-0.5 sm:gap-1 h-auto p-1",children:[e.jsxs(Je,{value:"planner",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(Gm,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"计划器监控"})]}),e.jsxs(Je,{value:"replier",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(o_,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"回复器监控"})]})]}),e.jsxs(Ye,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[e.jsx(ys,{value:"planner",className:"mt-0",children:e.jsx(hk,{autoRefresh:i,refreshKey:u})}),e.jsx(ys,{value:"replier",className:"mt-0",children:e.jsx(fk,{autoRefresh:i,refreshKey:u})})]})]})]})}const gk="Mai-with-u",jk="plugin-repo",vk="main",Nk="plugin_details.json";async function bk(){try{const l=await we("/api/webui/plugins/fetch-raw",{method:"POST",body:JSON.stringify({owner:gk,repo:jk,branch:vk,file_path:Nk})});if(!l.ok)throw new Error(`HTTP error! status: ${l.status}`);const n=await l.json();if(!n.success||!n.data)throw new Error(n.error||"获取插件列表失败");return JSON.parse(n.data).filter(u=>!u?.id||!u?.manifest?(console.warn("跳过无效插件数据:",u),!1):!u.manifest.name||!u.manifest.version?(console.warn("跳过缺少必需字段的插件:",u.id),!1):!0).map(u=>({id:u.id,manifest:{manifest_version:u.manifest.manifest_version||1,name:u.manifest.name,version:u.manifest.version,description:u.manifest.description||"",author:u.manifest.author||{name:"Unknown"},license:u.manifest.license||"Unknown",host_application:u.manifest.host_application||{min_version:"0.0.0"},homepage_url:u.manifest.homepage_url,repository_url:u.manifest.repository_url,keywords:u.manifest.keywords||[],categories:u.manifest.categories||[],default_locale:u.manifest.default_locale||"zh-CN",locales_path:u.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!1,published_at:new Date().toISOString(),updated_at:new Date().toISOString()}))}catch(l){throw console.error("Failed to fetch plugin list:",l),l}}async function Lv(){try{const l=await we("/api/webui/plugins/git-status");if(!l.ok)throw new Error(`HTTP error! status: ${l.status}`);return await l.json()}catch(l){return console.error("Failed to check Git status:",l),{installed:!1,error:"无法检测 Git 安装状态"}}}async function Uv(){try{const l=await we("/api/webui/plugins/version");if(!l.ok)throw new Error(`HTTP error! status: ${l.status}`);return await l.json()}catch(l){return console.error("Failed to get Maimai version:",l),{version:"0.0.0",version_major:0,version_minor:0,version_patch:0}}}function $v(l,n,i){const c=l.split(".").map(f=>parseInt(f)||0),u=c[0]||0,x=c[1]||0,h=c[2]||0;if(i.version_majorparseInt(v)||0),p=f[0]||0,g=f[1]||0,N=f[2]||0;if(i.version_major>p||i.version_major===p&&i.version_minor>g||i.version_major===p&&i.version_minor===g&&i.version_patch>N)return!1}return!0}async function yk(){try{const l=await we("/api/webui/ws-token");if(!l.ok)return console.error("获取 WebSocket token 失败:",l.status),null;const n=await l.json();return n.success&&n.token?n.token:null}catch(l){return console.error("获取 WebSocket token 失败:",l),null}}async function wk(l,n){const i=await yk();if(!i)return console.warn("无法获取 WebSocket token,可能未登录"),null;const c=window.location.protocol==="https:"?"wss:":"ws:",u=window.location.host,x=`${c}//${u}/api/webui/ws/plugin-progress?token=${encodeURIComponent(i)}`;try{const h=new WebSocket(x);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);l(p)}catch(p){console.error("Failed to parse progress data:",p)}},h.onerror=f=>{console.error("Plugin progress WebSocket error:",f),n?.(f)},h.onclose=()=>{console.log("Plugin progress WebSocket disconnected")},h}catch(h){return console.error("创建 WebSocket 连接失败:",h),null}}async function Al(){try{const l=await we("/api/webui/plugins/installed",{headers:Fs()});if(!l.ok)throw new Error(`HTTP error! status: ${l.status}`);const n=await l.json();if(!n.success)throw new Error(n.message||"获取已安装插件列表失败");return n.plugins||[]}catch(l){return console.error("Failed to get installed plugins:",l),[]}}function mn(l,n){return n.some(i=>i.id===l)}function xn(l,n){const i=n.find(c=>c.id===l);if(i)return i.manifest?.version||i.version}async function Bv(l,n,i="main"){const c=await we("/api/webui/plugins/install",{method:"POST",body:JSON.stringify({plugin_id:l,repository_url:n,branch:i})});if(!c.ok){const u=await c.json();throw new Error(u.detail||"安装失败")}return await c.json()}async function Iv(l){const n=await we("/api/webui/plugins/uninstall",{method:"POST",body:JSON.stringify({plugin_id:l})});if(!n.ok){const i=await n.json();throw new Error(i.detail||"卸载失败")}return await n.json()}async function Pv(l,n,i="main"){const c=await we("/api/webui/plugins/update",{method:"POST",body:JSON.stringify({plugin_id:l,repository_url:n,branch:i})});if(!c.ok){const u=await c.json();throw new Error(u.detail||"更新失败")}return await c.json()}async function _k(l){const n=await we(`/api/webui/plugins/config/${l}/schema`,{headers:Fs()});if(!n.ok){const c=await n.text();try{const u=JSON.parse(c);throw new Error(u.detail||"获取配置 Schema 失败")}catch{throw new Error(`获取配置 Schema 失败 (${n.status})`)}}const i=await n.json();if(!i.success)throw new Error(i.message||"获取配置 Schema 失败");return i.schema}async function Sk(l){const n=await we(`/api/webui/plugins/config/${l}`,{headers:Fs()});if(!n.ok){const c=await n.text();try{const u=JSON.parse(c);throw new Error(u.detail||"获取配置失败")}catch{throw new Error(`获取配置失败 (${n.status})`)}}const i=await n.json();if(!i.success)throw new Error(i.message||"获取配置失败");return i.config}async function kk(l){const n=await we(`/api/webui/plugins/config/${l}/raw`,{headers:Fs()});if(!n.ok){const c=await n.text();try{const u=JSON.parse(c);throw new Error(u.detail||"获取配置失败")}catch{throw new Error(`获取配置失败 (${n.status})`)}}const i=await n.json();if(!i.success)throw new Error(i.message||"获取配置失败");return i.config}async function Ck(l,n){const i=await we(`/api/webui/plugins/config/${l}`,{method:"PUT",headers:Fs(),body:JSON.stringify({config:n})});if(!i.ok){const c=await i.json();throw new Error(c.detail||"保存配置失败")}return await i.json()}async function Tk(l,n){const i=await we(`/api/webui/plugins/config/${l}/raw`,{method:"PUT",headers:Fs(),body:JSON.stringify({config:n})});if(!i.ok){const c=await i.json();throw new Error(c.detail||"保存配置失败")}return await i.json()}async function Ek(l){const n=await we(`/api/webui/plugins/config/${l}/reset`,{method:"POST",headers:Fs()});if(!n.ok){const i=await n.json();throw new Error(i.detail||"重置配置失败")}return await n.json()}async function Mk(l){const n=await we(`/api/webui/plugins/config/${l}/toggle`,{method:"POST",headers:Fs()});if(!n.ok){const i=await n.json();throw new Error(i.detail||"切换状态失败")}return await n.json()}const uc="https://maibot-plugin-stats.maibot-webui.workers.dev";async function Hv(l){try{const n=await fetch(`${uc}/stats/${l}`);return n.ok?await n.json():(console.error("Failed to fetch plugin stats:",n.statusText),null)}catch(n){return console.error("Error fetching plugin stats:",n),null}}async function zk(l,n){try{const i=n||dx(),c=await fetch(`${uc}/stats/like`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:l,user_id:i})}),u=await c.json();return c.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:c.ok?{success:!0,...u}:{success:!1,error:u.error||"点赞失败"}}catch(i){return console.error("Error liking plugin:",i),{success:!1,error:"网络错误"}}}async function Ak(l,n){try{const i=n||dx(),c=await fetch(`${uc}/stats/dislike`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:l,user_id:i})}),u=await c.json();return c.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:c.ok?{success:!0,...u}:{success:!1,error:u.error||"点踩失败"}}catch(i){return console.error("Error disliking plugin:",i),{success:!1,error:"网络错误"}}}async function Ok(l,n,i,c){if(n<1||n>5)return{success:!1,error:"评分必须在 1-5 之间"};try{const u=c||dx(),x=await fetch(`${uc}/stats/rate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:l,rating:n,comment:i,user_id:u})}),h=await x.json();return x.status===429?{success:!1,error:"每天最多评分 3 次"}:x.ok?{success:!0,...h}:{success:!1,error:h.error||"评分失败"}}catch(u){return console.error("Error rating plugin:",u),{success:!1,error:"网络错误"}}}async function Fv(l){try{const n=await fetch(`${uc}/stats/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:l})}),i=await n.json();return n.status===429?(console.warn("Download recording rate limited"),{success:!0}):n.ok?{success:!0,...i}:(console.error("Failed to record download:",i.error),{success:!1,error:i.error})}catch(n){return console.error("Error recording download:",n),{success:!1,error:"网络错误"}}}function Dk(){const l=navigator,n=[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,l.deviceMemory||0].join("|");let i=0;for(let c=0;c{const ee=Q.map(async Te=>{try{const de=await Hv(Te.id);return{id:Te.id,stats:de}}catch(de){return console.warn(`Failed to load stats for ${Te.id}:`,de),{id:Te.id,stats:null}}}),Ue=await Promise.all(ee),ie={};Ue.forEach(({id:Te,stats:de})=>{de&&(ie[Te]=de)}),U(ie)};d.useEffect(()=>{let Q=null,ee=!1;return(async()=>{if(Q=await wk(ie=>{ee||(T(ie),ie.stage==="success"?setTimeout(()=>{ee||T(null)},2e3):ie.stage==="error"&&(b(!1),D(ie.error||"加载失败")))},ie=>{console.error("WebSocket error:",ie),ee||pe({title:"WebSocket 连接失败",description:"无法实时显示加载进度",variant:"destructive"})}),await new Promise(ie=>{if(!Q){ie();return}const Te=()=>{Q&&Q.readyState===WebSocket.OPEN?(console.log("WebSocket connected, starting to load plugins"),ie()):Q&&Q.readyState===WebSocket.CLOSED?(console.warn("WebSocket closed before loading plugins"),ie()):setTimeout(Te,100)};Te()}),!ee){const ie=await Lv();P(ie),ie.installed||pe({title:"Git 未安装",description:ie.error||"请先安装 Git 才能使用插件安装功能",variant:"destructive"})}if(!ee){const ie=await Uv();F(ie)}if(!ee)try{b(!0),D(null);const ie=await bk();if(!ee){const Te=await Al();L(Te);const de=ie.map(Me=>{const rs=mn(Me.id,Te),Ut=xn(Me.id,Te);return{...Me,installed:rs,installed_version:Ut}});for(const Me of Te)!de.some(Ut=>Ut.id===Me.id)&&Me.manifest&&de.push({id:Me.id,manifest:{manifest_version:Me.manifest.manifest_version||1,name:Me.manifest.name,version:Me.manifest.version,description:Me.manifest.description||"",author:Me.manifest.author,license:Me.manifest.license||"Unknown",host_application:Me.manifest.host_application,homepage_url:Me.manifest.homepage_url,repository_url:Me.manifest.repository_url,keywords:Me.manifest.keywords||[],categories:Me.manifest.categories||[],default_locale:Me.manifest.default_locale||"zh-CN",locales_path:Me.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!0,installed_version:Me.manifest.version,published_at:new Date().toISOString(),updated_at:new Date().toISOString()});y(de),ke(de)}}catch(ie){if(!ee){const Te=ie instanceof Error?ie.message:"加载插件列表失败";D(Te),pe({title:"加载失败",description:Te,variant:"destructive"})}}finally{ee||b(!1)}})(),()=>{ee=!0,Q&&Q.close()}},[pe]);const O=Q=>{if(!Q.installed&&A&&!k(Q))return e.jsxs(Se,{variant:"destructive",className:"gap-1",children:[e.jsx(_t,{className:"h-3 w-3"}),"不兼容"]});if(Q.installed){const ee=Q.installed_version?.trim(),Ue=Q.manifest.version?.trim();if(ee!==Ue){const ie=ee?.split(".").map(Number)||[0,0,0],Te=Ue?.split(".").map(Number)||[0,0,0];for(let de=0;de<3;de++){if((Te[de]||0)>(ie[de]||0))return e.jsxs(Se,{variant:"outline",className:"gap-1 text-orange-600 border-orange-600",children:[e.jsx(_t,{className:"h-3 w-3"}),"可更新"]});if((Te[de]||0)<(ie[de]||0))break}}return e.jsxs(Se,{variant:"default",className:"gap-1",children:[e.jsx(pt,{className:"h-3 w-3"}),"已安装"]})}return null},k=Q=>!A||!Q.manifest?.host_application?!0:$v(Q.manifest.host_application.min_version,Q.manifest.host_application.max_version,A),H=Q=>{if(!Q.installed||!Q.installed_version||!Q.manifest?.version)return!1;const ee=Q.installed_version.trim(),Ue=Q.manifest.version.trim();if(ee===Ue)return!1;const ie=ee.split(".").map(Number),Te=Ue.split(".").map(Number);for(let de=0;de<3;de++){if((Te[de]||0)>(ie[de]||0))return!0;if((Te[de]||0)<(ie[de]||0))return!1}return!1},se=v.filter(Q=>{if(!Q.manifest)return console.warn("[过滤] 跳过无 manifest 的插件:",Q.id),!1;const ee=c===""||Q.manifest.name?.toLowerCase().includes(c.toLowerCase())||Q.manifest.description?.toLowerCase().includes(c.toLowerCase())||Q.manifest.keywords&&Q.manifest.keywords.some(de=>de.toLowerCase().includes(c.toLowerCase())),Ue=x==="all"||Q.manifest.categories&&Q.manifest.categories.includes(x);let ie=!0;f==="installed"?ie=Q.installed===!0:f==="updates"&&(ie=Q.installed===!0&&H(Q));const Te=!g||!A||k(Q);return ee&&Ue&&ie&&Te}),Ee=Q=>{if(!S?.installed){pe({title:"无法安装",description:"Git 未安装",variant:"destructive"});return}if(A&&!k(Q)){pe({title:"无法安装",description:"插件与当前麦麦版本不兼容",variant:"destructive"});return}ne(Q),je("main"),V(""),oe("preset"),_e(!1),xe(!0)},Z=async()=>{if(!he)return;const Q=B==="custom"?z:ve;if(!Q||Q.trim()===""){pe({title:"分支名称不能为空",variant:"destructive"});return}try{xe(!1),await Bv(he.id,he.manifest.repository_url||"",Q),Fv(he.id).catch(Ue=>{console.warn("Failed to record download:",Ue)}),pe({title:"安装成功",description:`${he.manifest.name} 已成功安装`});const ee=await Al();L(ee),y(Ue=>Ue.map(ie=>{if(ie.id===he.id){const Te=mn(ie.id,ee),de=xn(ie.id,ee);return{...ie,installed:Te,installed_version:de}}return ie}))}catch(ee){pe({title:"安装失败",description:ee instanceof Error?ee.message:"未知错误",variant:"destructive"})}finally{ne(null)}},Oe=async Q=>{try{await Iv(Q.id),pe({title:"卸载成功",description:`${Q.manifest.name} 已成功卸载`});const ee=await Al();L(ee),y(Ue=>Ue.map(ie=>{if(ie.id===Q.id){const Te=mn(ie.id,ee),de=xn(ie.id,ee);return{...ie,installed:Te,installed_version:de}}return ie}))}catch(ee){pe({title:"卸载失败",description:ee instanceof Error?ee.message:"未知错误",variant:"destructive"})}},ns=async Q=>{if(!S?.installed){pe({title:"无法更新",description:"Git 未安装",variant:"destructive"});return}try{const ee=await Pv(Q.id,Q.manifest.repository_url||"","main");pe({title:"更新成功",description:`${Q.manifest.name} 已从 ${ee.old_version} 更新到 ${ee.new_version}`});const Ue=await Al();L(Ue),y(ie=>ie.map(Te=>{if(Te.id===Q.id){const de=mn(Te.id,Ue),Me=xn(Te.id,Ue);return{...Te,installed:de,installed_version:Me}}return Te}))}catch(ee){pe({title:"更新失败",description:ee instanceof Error?ee.message:"未知错误",variant:"destructive"})}};return e.jsx(Ye,{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:()=>n(),disabled:i,children:[e.jsx(Ij,{className:`h-4 w-4 mr-2 ${i?"animate-spin":""}`}),"重启麦麦"]}),e.jsxs(_,{onClick:()=>l({to:"/plugin-mirrors"}),children:[e.jsx(d_,{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(Ht,{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(Jt,{className:"h-5 w-5 text-orange-600"}),e.jsxs("div",{children:[e.jsx(Le,{className:"text-lg text-orange-900 dark:text-orange-100",children:"Git 未安装"}),e.jsx(ws,{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(Tt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(le,{placeholder:"搜索插件...",value:c,onChange:Q=>u(Q.target.value),className:"pl-9"})]}),e.jsxs(Ie,{value:x,onValueChange:h,children:[e.jsx($e,{className:"w-full sm:w-[200px]",children:e.jsx(Pe,{placeholder:"选择分类"})}),e.jsxs(Be,{children:[e.jsx(X,{value:"all",children:"全部分类"}),e.jsx(X,{value:"Group Management",children:"群组管理"}),e.jsx(X,{value:"Entertainment & Interaction",children:"娱乐互动"}),e.jsx(X,{value:"Utility Tools",children:"实用工具"}),e.jsx(X,{value:"Content Generation",children:"内容生成"}),e.jsx(X,{value:"Multimedia",children:"多媒体"}),e.jsx(X,{value:"External Integration",children:"外部集成"}),e.jsx(X,{value:"Data Analysis & Insights",children:"数据分析与洞察"}),e.jsx(X,{value:"Other",children:"其他"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qs,{id:"compatible-only",checked:g,onCheckedChange:Q=>N(Q===!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(ta,{value:f,onValueChange:p,className:"w-full",children:e.jsxs(Xt,{className:"grid w-full grid-cols-3",children:[e.jsxs(Je,{value:"all",children:["全部插件 (",v.filter(Q=>{if(!Q.manifest)return!1;const ee=c===""||Q.manifest.name?.toLowerCase().includes(c.toLowerCase())||Q.manifest.description?.toLowerCase().includes(c.toLowerCase())||Q.manifest.keywords&&Q.manifest.keywords.some(Te=>Te.toLowerCase().includes(c.toLowerCase())),Ue=x==="all"||Q.manifest.categories&&Q.manifest.categories.includes(x),ie=!g||!A||k(Q);return ee&&Ue&&ie}).length,")"]}),e.jsxs(Je,{value:"installed",children:["已安装 (",v.filter(Q=>{if(!Q.manifest)return!1;const ee=c===""||Q.manifest.name?.toLowerCase().includes(c.toLowerCase())||Q.manifest.description?.toLowerCase().includes(c.toLowerCase())||Q.manifest.keywords&&Q.manifest.keywords.some(Te=>Te.toLowerCase().includes(c.toLowerCase())),Ue=x==="all"||Q.manifest.categories&&Q.manifest.categories.includes(x),ie=!g||!A||k(Q);return Q.installed&&ee&&Ue&&ie}).length,")"]}),e.jsxs(Je,{value:"updates",children:["可更新 (",v.filter(Q=>{if(!Q.manifest)return!1;const ee=c===""||Q.manifest.name?.toLowerCase().includes(c.toLowerCase())||Q.manifest.description?.toLowerCase().includes(c.toLowerCase())||Q.manifest.keywords&&Q.manifest.keywords.some(Te=>Te.toLowerCase().includes(c.toLowerCase())),Ue=x==="all"||Q.manifest.categories&&Q.manifest.categories.includes(x),ie=!g||!A||k(Q);return Q.installed&&H(Q)&&ee&&Ue&&ie}).length,")"]})]})}),M&&M.stage==="loading"&&M.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(Bs,{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:[M.progress,"%"]})]}),e.jsx(Kn,{value:M.progress,className:"h-2"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:M.message}),M.total_plugins>0&&e.jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["已加载 ",M.loaded_plugins," / ",M.total_plugins," 个插件"]})]})}),M&&M.stage==="error"&&M.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(Jt,{className:"h-5 w-5 text-destructive"}),e.jsxs("div",{children:[e.jsx(Le,{className:"text-lg text-destructive",children:"加载失败"}),e.jsx(ws,{className:"text-destructive/80",children:M.error})]})]})})}),w?e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(Bs,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件列表中..."})]}):R?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(Jt,{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:R}),e.jsx(_,{onClick:()=>window.location.reload(),children:"重新加载"})]})}):se.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(Tt,{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||x!=="all"?"尝试调整搜索条件或筛选器":"暂无可用插件"})]})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:se.map(Q=>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(Le,{className:"text-xl",children:Q.manifest?.name||Q.id}),e.jsxs("div",{className:"flex flex-col gap-1",children:[Q.manifest?.categories&&Q.manifest.categories[0]&&e.jsx(Se,{variant:"secondary",className:"text-xs whitespace-nowrap",children:Rk[Q.manifest.categories[0]]||Q.manifest.categories[0]}),O(Q)]})]}),e.jsx(ws,{className:"line-clamp-2",children:Q.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(sa,{className:"h-4 w-4"}),e.jsx("span",{children:(J[Q.id]?.downloads??Q.downloads??0).toLocaleString()})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(dn,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),e.jsx("span",{children:(J[Q.id]?.rating??Q.rating??0).toFixed(1)})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[Q.manifest?.keywords&&Q.manifest.keywords.slice(0,3).map(ee=>e.jsx(Se,{variant:"outline",className:"text-xs",children:ee},ee)),Q.manifest?.keywords&&Q.manifest.keywords.length>3&&e.jsxs(Se,{variant:"outline",className:"text-xs",children:["+",Q.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",Q.manifest?.version||"unknown"," · ",Q.manifest?.author?.name||"Unknown"]}),Q.manifest?.host_application&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{children:"支持:"}),e.jsxs("span",{className:"font-medium",children:[Q.manifest.host_application.min_version,Q.manifest.host_application.max_version?` - ${Q.manifest.host_application.max_version}`:" - 最新版本"]})]})]})]})}),e.jsx(Zo,{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:()=>l({to:"/plugin-detail",search:{pluginId:Q.id}}),children:"查看详情"}),Q.installed?H(Q)?e.jsxs(_,{size:"sm",disabled:!S?.installed,title:S?.installed?void 0:"Git 未安装",onClick:()=>ns(Q),children:[e.jsx(dt,{className:"h-4 w-4 mr-1"}),"更新"]}):e.jsxs(_,{variant:"destructive",size:"sm",disabled:!S?.installed,title:S?.installed?void 0:"Git 未安装",onClick:()=>Oe(Q),children:[e.jsx(ls,{className:"h-4 w-4 mr-1"}),"卸载"]}):e.jsxs(_,{size:"sm",disabled:!S?.installed||M?.operation==="install"||A!==null&&!k(Q),title:S?.installed?A!==null&&!k(Q)?`不兼容当前版本 (需要 ${Q.manifest?.host_application?.min_version||"未知"}${Q.manifest?.host_application?.max_version?` - ${Q.manifest.host_application.max_version}`:"+"},当前 ${A?.version})`:void 0:"Git 未安装",onClick:()=>Ee(Q),children:[e.jsx(sa,{className:"h-4 w-4 mr-1"}),M?.operation==="install"&&M?.plugin_id===Q.id?"安装中...":"安装"]})]})}),M&&(M.stage==="loading"||M.stage==="success"||M.stage==="error")&&M.operation!=="fetch"&&M.plugin_id===Q.id&&e.jsx("div",{className:"px-6 pb-4 -mt-2",children:e.jsxs("div",{className:`space-y-2 p-3 rounded-lg border ${M.stage==="success"?"bg-green-50 dark:bg-green-950/20 border-green-200 dark:border-green-900":M.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:[M.stage==="loading"?e.jsx(Bs,{className:"h-3 w-3 animate-spin"}):M.stage==="success"?e.jsx(pt,{className:"h-3 w-3 text-green-600"}):e.jsx(_t,{className:"h-3 w-3 text-red-600"}),e.jsx("span",{className:`text-xs font-medium ${M.stage==="success"?"text-green-700 dark:text-green-300":M.stage==="error"?"text-red-700 dark:text-red-300":""}`,children:M.stage==="loading"?e.jsxs(e.Fragment,{children:[M.operation==="install"&&"正在安装",M.operation==="uninstall"&&"正在卸载",M.operation==="update"&&"正在更新"]}):M.stage==="success"?e.jsxs(e.Fragment,{children:[M.operation==="install"&&"安装完成",M.operation==="uninstall"&&"卸载完成",M.operation==="update"&&"更新完成"]}):e.jsxs(e.Fragment,{children:[M.operation==="install"&&"安装失败",M.operation==="uninstall"&&"卸载失败",M.operation==="update"&&"更新失败"]})})]}),M.stage!=="error"&&e.jsxs("span",{className:`text-xs font-medium ${M.stage==="success"?"text-green-700 dark:text-green-300":""}`,children:[M.progress,"%"]})]}),M.stage!=="error"&&e.jsx(Kn,{value:M.progress,className:`h-1.5 ${M.stage==="success"?"[&>div]:bg-green-500":""}`}),e.jsx("div",{className:`text-xs ${M.stage==="success"?"text-green-600 dark:text-green-400 truncate":M.stage==="error"?"text-red-600 dark:text-red-400":"text-muted-foreground truncate"}`,children:M.stage==="error"?M.error||M.message||"操作失败":M.message})]})})]},Q.id))}),e.jsx(Is,{open:ue,onOpenChange:xe,children:e.jsxs(Os,{children:[e.jsxs(Ds,{children:[e.jsx(Rs,{children:"安装插件"}),e.jsxs(Ks,{children:["安装 ",he?.manifest.name]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["版本: ",he?.manifest.version]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["作者: ",typeof he?.manifest.author=="string"?he.manifest.author:he?.manifest.author?.name]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qs,{id:"advanced-options",checked:K,onCheckedChange:Q=>_e(Q)}),e.jsx("label",{htmlFor:"advanced-options",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"高级选项"})]}),K&&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(ta,{value:B,onValueChange:Q=>oe(Q),children:[e.jsxs(Xt,{className:"grid w-full grid-cols-2",children:[e.jsx(Je,{value:"preset",className:"text-xs",children:"预设分支"}),e.jsx(Je,{value:"custom",className:"text-xs",children:"自定义分支"})]}),B==="preset"&&e.jsx("div",{className:"mt-3",children:e.jsxs(Ie,{value:ve,onValueChange:je,children:[e.jsx($e,{children:e.jsx(Pe,{placeholder:"选择分支"})}),e.jsxs(Be,{children:[e.jsx(X,{value:"main",children:"main (默认)"}),e.jsx(X,{value:"master",children:"master"}),e.jsx(X,{value:"dev",children:"dev (开发版)"}),e.jsx(X,{value:"develop",children:"develop"}),e.jsx(X,{value:"beta",children:"beta (测试版)"}),e.jsx(X,{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:z,onChange:Q=>V(Q.target.value)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"输入 Git 分支名称、标签或提交哈希"})]})]})]})}),!K&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"将从默认分支 (main) 安装插件"})]}),e.jsxs(st,{children:[e.jsx(_,{variant:"outline",onClick:()=>xe(!1),children:"取消"}),e.jsxs(_,{onClick:Z,children:[e.jsx(sa,{className:"h-4 w-4 mr-2"}),"安装"]})]})]})}),e.jsx(Jn,{})]})})}function $k(){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(Pj,{className:"h-8 w-8",strokeWidth:2}),"模型分配预设市场"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"浏览和下载社区共享的模型分配预设配置"})]})})}),e.jsx(Ye,{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(ra,{className:"h-16 w-16 text-muted-foreground"})}),e.jsx(Le,{className:"text-2xl",children:"功能开发中"}),e.jsx(ws,{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 Bk({field:l,value:n,onChange:i}){const[c,u]=d.useState(!1);switch(l.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(E,{children:l.label}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]}),e.jsx(Fe,{checked:!!n,onCheckedChange:i,disabled:l.disabled})]});case"number":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:l.label}),e.jsx(le,{type:"number",value:n??l.default,onChange:x=>i(parseFloat(x.target.value)||0),min:l.min,max:l.max,step:l.step??1,placeholder:l.placeholder,disabled:l.disabled}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]});case"slider":return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(E,{children:l.label}),e.jsx("span",{className:"text-sm text-muted-foreground",children:n??l.default})]}),e.jsx(qa,{value:[n??l.default],onValueChange:x=>i(x[0]),min:l.min??0,max:l.max??100,step:l.step??1,disabled:l.disabled}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]});case"select":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:l.label}),e.jsxs(Ie,{value:String(n??l.default),onValueChange:i,disabled:l.disabled,children:[e.jsx($e,{children:e.jsx(Pe,{placeholder:l.placeholder??"请选择"})}),e.jsx(Be,{children:l.choices?.map(x=>e.jsx(X,{value:String(x),children:String(x)},String(x)))})]}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]});case"textarea":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:l.label}),e.jsx(ot,{value:n??l.default,onChange:x=>i(x.target.value),placeholder:l.placeholder,rows:l.rows??3,disabled:l.disabled}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]});case"password":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:l.label}),e.jsxs("div",{className:"relative",children:[e.jsx(le,{type:c?"text":"password",value:n??"",onChange:x=>i(x.target.value),placeholder:l.placeholder,disabled:l.disabled,className:"pr-10"}),e.jsx(_,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3",onClick:()=>u(!c),children:c?e.jsx(Wi,{className:"h-4 w-4"}):e.jsx(ia,{className:"h-4 w-4"})})]}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]});case"list":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:l.label}),e.jsx(G2,{value:Array.isArray(n)?n:[],onChange:x=>i(x),itemType:l.item_type??"string",itemFields:l.item_fields,minItems:l.min_items,maxItems:l.max_items,disabled:l.disabled,placeholder:l.placeholder}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]});case"text":default:return e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:l.label}),e.jsx(le,{type:"text",value:n??l.default??"",onChange:x=>i(x.target.value),placeholder:l.placeholder,maxLength:l.max_length,disabled:l.disabled}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]})}}function Lg({section:l,config:n,onChange:i}){const[c,u]=d.useState(!l.collapsed),x=Object.entries(l.fields).filter(([,h])=>!h.hidden).sort(([,h],[,f])=>h.order-f.order);return e.jsx(nc,{open:c,onOpenChange:u,children:e.jsxs(Ce,{children:[e.jsx(rc,{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(za,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(Zt,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(Le,{className:"text-lg",children:l.title})]}),e.jsxs(Se,{variant:"secondary",className:"text-xs",children:[x.length," 项"]})]}),l.description&&e.jsx(ws,{className:"ml-6",children:l.description})]})}),e.jsx(ic,{children:e.jsx(Ae,{className:"space-y-4 pt-0",children:x.map(([h,f])=>e.jsx(Bk,{field:f,value:n[l.name]?.[h],onChange:p=>i(l.name,h,p),sectionName:l.name},h))})})]})})}function Ik({plugin:l,onBack:n}){const{toast:i}=Zs(),{triggerRestart:c,isRestarting:u}=vn(),[x,h]=d.useState("visual"),[f,p]=d.useState(null),[g,N]=d.useState({}),[v,y]=d.useState({}),[w,b]=d.useState(""),[R,D]=d.useState(""),[S,P]=d.useState(!0),[M,T]=d.useState(!1),[A,F]=d.useState(!1),[L,J]=d.useState(!1),[U,ue]=d.useState(!1),xe=d.useCallback(async()=>{P(!0);try{const[B,oe,K]=await Promise.all([_k(l.id),Sk(l.id),kk(l.id)]);p(B),N(oe),y(JSON.parse(JSON.stringify(oe))),b(K),D(K)}catch(B){i({title:"加载配置失败",description:B instanceof Error?B.message:"未知错误",variant:"destructive"})}finally{P(!1)}},[l.id,i]);d.useEffect(()=>{xe()},[xe]),d.useEffect(()=>{F(x==="visual"?JSON.stringify(g)!==JSON.stringify(v):w!==R)},[g,v,w,R,x]);const he=(B,oe,K)=>{N(_e=>({..._e,[B]:{..._e[B]||{},[oe]:K}}))},ne=async()=>{T(!0);try{if(x==="source"){try{Tv(w)}catch(B){J(!0),i({title:"TOML 格式错误",description:B instanceof Error?B.message:"无法解析 TOML 配置,请检查语法",variant:"destructive"}),T(!1);return}await Tk(l.id,w),D(w),J(!1)}else await Ck(l.id,g),y(JSON.parse(JSON.stringify(g)));i({title:"配置已保存",description:"更改将在插件重新加载后生效"})}catch(B){i({title:"保存失败",description:B instanceof Error?B.message:"未知错误",variant:"destructive"})}finally{T(!1)}},ve=async()=>{try{await Ek(l.id),i({title:"配置已重置",description:"下次加载插件时将使用默认配置"}),ue(!1),xe()}catch(B){i({title:"重置失败",description:B instanceof Error?B.message:"未知错误",variant:"destructive"})}},je=async()=>{try{const B=await Mk(l.id);i({title:B.message,description:B.note}),xe()}catch(B){i({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(Bs,{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(_t,{className:"h-12 w-12 text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground",children:"无法加载配置"}),e.jsxs(_,{onClick:n,variant:"outline",children:[e.jsx(Ta,{className:"h-4 w-4 mr-2"}),"返回"]})]});const z=Object.values(f.sections).sort((B,oe)=>B.order-oe.order),V=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:n,children:e.jsx(Ta,{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||l.manifest.name}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx(Se,{variant:V?"default":"secondary",children:V?"已启用":"已禁用"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["v",f.plugin_info.version||l.manifest.version]})]})]})]}),e.jsxs("div",{className:"flex gap-2 ml-10 sm:ml-0",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>h(x==="visual"?"source":"visual"),children:x==="visual"?e.jsxs(e.Fragment,{children:[e.jsx(Uj,{className:"h-4 w-4 mr-2"}),"源代码"]}):e.jsxs(e.Fragment,{children:[e.jsx(Lj,{className:"h-4 w-4 mr-2"}),"可视化"]})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>c(),disabled:u,children:[e.jsx(Ij,{className:`h-4 w-4 mr-2 ${u?"animate-spin":""}`}),"重启麦麦"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:je,children:[e.jsx(cc,{className:"h-4 w-4 mr-2"}),V?"禁用":"启用"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>ue(!0),children:[e.jsx(Zi,{className:"h-4 w-4 mr-2"}),"重置"]}),e.jsxs(_,{size:"sm",onClick:ne,disabled:!A||M,children:[M?e.jsx(Bs,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(oc,{className:"h-4 w-4 mr-2"}),"保存"]})]})]}),A&&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(Ht,{className:"h-4 w-4 text-orange-600"}),e.jsx("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:"有未保存的更改"})]})})}),x==="source"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(at,{children:[e.jsx(_t,{className:"h-4 w-4"}),e.jsxs(lt,{children:[e.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。保存时会验证格式,只有格式正确才能保存。",L&&e.jsx("span",{className:"text-destructive font-semibold ml-2",children:"⚠️ 上次保存失败,请检查 TOML 格式"})]})]}),e.jsx(gv,{value:w,onChange:B=>{b(B),L&&J(!1)},language:"toml",theme:"dark",height:"calc(100vh - 350px)",minHeight:"500px",placeholder:"TOML 配置内容"})]}),x==="visual"&&e.jsxs(e.Fragment,{children:[e.jsxs(at,{children:[e.jsx(Ht,{className:"h-4 w-4"}),e.jsxs(lt,{children:[e.jsx("strong",{children:"提示:"}),"如果插件当前未加载或未启用,WebUI 适配器的高级插件可视化编辑功能可能会不可用。 请确保插件已启用并成功加载后,再进行配置编辑。"]})]}),f.layout.type==="tabs"&&f.layout.tabs.length>0?e.jsxs(ta,{defaultValue:f.layout.tabs[0]?.id,children:[e.jsx(Xt,{children:f.layout.tabs.map(B=>e.jsxs(Je,{value:B.id,children:[B.title,B.badge&&e.jsx(Se,{variant:"secondary",className:"ml-2 text-xs",children:B.badge})]},B.id))}),f.layout.tabs.map(B=>e.jsx(ys,{value:B.id,className:"space-y-4 mt-4",children:B.sections.map(oe=>{const K=f.sections[oe];return K?e.jsx(Lg,{section:K,config:g,onChange:he},oe):null})},B.id))]}):e.jsx("div",{className:"space-y-4",children:z.map(B=>e.jsx(Lg,{section:B,config:g,onChange:he},B.name))})]}),e.jsx(Is,{open:U,onOpenChange:ue,children:e.jsxs(Os,{children:[e.jsxs(Ds,{children:[e.jsx(Rs,{children:"确认重置配置"}),e.jsx(Ks,{children:"这将删除当前配置文件,下次加载插件时将使用默认配置。此操作不可撤销。"})]}),e.jsxs(st,{children:[e.jsx(_,{variant:"outline",onClick:()=>ue(!1),children:"取消"}),e.jsx(_,{variant:"destructive",onClick:ve,children:"确认重置"})]})]})})]})}function Pk(){return e.jsx(Yn,{children:e.jsx(Hk,{})})}function Hk(){const{toast:l}=Zs(),[n,i]=d.useState([]),[c,u]=d.useState(!0),[x,h]=d.useState(""),[f,p]=d.useState(null),g=async()=>{u(!0);try{const b=await Al();i(b)}catch(b){l({title:"加载插件列表失败",description:b instanceof Error?b.message:"未知错误",variant:"destructive"})}finally{u(!1)}};d.useEffect(()=>{g()},[]);const v=n.filter(b=>{const R=x.toLowerCase();return b.id.toLowerCase().includes(R)||b.manifest.name.toLowerCase().includes(R)||b.manifest.description?.toLowerCase().includes(R)}).filter((b,R,D)=>R===D.findIndex(S=>S.id===b.id)),y=n.length,w=0;return f?e.jsxs(e.Fragment,{children:[e.jsx(Ye,{className:"h-full",children:e.jsx("div",{className:"p-4 sm:p-6",children:e.jsx(Ik,{plugin:f,onBack:()=>p(null)})})}),e.jsx(Jn,{})]}):e.jsx(Ye,{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(dt,{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(Le,{className:"text-sm font-medium",children:"已安装插件"}),e.jsx(ra,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ae,{children:[e.jsx("div",{className:"text-2xl font-bold",children:n.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(Le,{className:"text-sm font-medium",children:"已启用"}),e.jsx(pt,{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(Le,{className:"text-sm font-medium",children:"已禁用"}),e.jsx(_t,{className:"h-4 w-4 text-orange-600"})]}),e.jsxs(Ae,{children:[e.jsx("div",{className:"text-2xl font-bold",children:w}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"未激活的插件"})]})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(Tt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(le,{placeholder:"搜索插件...",value:x,onChange:b=>h(b.target.value),className:"pl-9"})]}),e.jsxs(Ce,{children:[e.jsxs(De,{children:[e.jsx(Le,{children:"已安装的插件"}),e.jsx(ws,{children:"点击插件查看和编辑配置"})]}),e.jsx(Ae,{children:c?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(Bs,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):v.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:x?"没有找到匹配的插件":"暂无已安装的插件"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:x?"尝试其他搜索关键词":"前往插件市场安装插件"})]})]}):e.jsx("div",{className:"space-y-2",children:v.map(b=>e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg border hover:bg-muted/50 cursor-pointer transition-colors",onClick:()=>p(b),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:b.manifest.name}),e.jsxs(Se,{variant:"secondary",className:"text-xs flex-shrink-0",children:["v",b.manifest.version]})]}),e.jsx("p",{className:"text-sm text-muted-foreground truncate",children:b.manifest.description||"暂无描述"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(_,{variant:"ghost",size:"sm",children:e.jsx(pn,{className:"h-4 w-4"})}),e.jsx(Zt,{className:"h-4 w-4 text-muted-foreground"})]})]},b.id))})})]})]})})}function Fk(){const l=ca(),{toast:n}=Zs(),[i,c]=d.useState([]),[u,x]=d.useState(!0),[h,f]=d.useState(null),[p,g]=d.useState(null),[N,v]=d.useState(!1),[y,w]=d.useState(!1),[b,R]=d.useState({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),D=d.useCallback(async()=>{try{x(!0),f(null);const L=await we("/api/webui/plugins/mirrors");if(!L.ok)throw new Error("获取镜像源列表失败");const J=await L.json();c(J.mirrors||[])}catch(L){const J=L instanceof Error?L.message:"加载镜像源失败";f(J),n({title:"加载失败",description:J,variant:"destructive"})}finally{x(!1)}},[n]);d.useEffect(()=>{D()},[D]);const S=async()=>{try{const L=await we("/api/webui/plugins/mirrors",{method:"POST",body:JSON.stringify(b)});if(!L.ok){const J=await L.json();throw new Error(J.detail||"添加镜像源失败")}n({title:"添加成功",description:"镜像源已添加"}),v(!1),R({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),D()}catch(L){n({title:"添加失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"})}},P=async()=>{if(p)try{if(!(await we(`/api/webui/plugins/mirrors/${p.id}`,{method:"PUT",body:JSON.stringify({name:b.name,raw_prefix:b.raw_prefix,clone_prefix:b.clone_prefix,enabled:b.enabled,priority:b.priority})})).ok)throw new Error("更新镜像源失败");n({title:"更新成功",description:"镜像源已更新"}),w(!1),g(null),D()}catch(L){n({title:"更新失败",description:L instanceof Error?L.message:"未知错误",variant:"destructive"})}},M=async L=>{if(confirm("确定要删除这个镜像源吗?"))try{if(!(await we(`/api/webui/plugins/mirrors/${L}`,{method:"DELETE"})).ok)throw new Error("删除镜像源失败");n({title:"删除成功",description:"镜像源已删除"}),D()}catch(J){n({title:"删除失败",description:J instanceof Error?J.message:"未知错误",variant:"destructive"})}},T=async L=>{try{if(!(await we(`/api/webui/plugins/mirrors/${L.id}`,{method:"PUT",body:JSON.stringify({enabled:!L.enabled})})).ok)throw new Error("更新状态失败");D()}catch(J){n({title:"更新失败",description:J instanceof Error?J.message:"未知错误",variant:"destructive"})}},A=L=>{g(L),R({id:L.id,name:L.name,raw_prefix:L.raw_prefix,clone_prefix:L.clone_prefix,enabled:L.enabled,priority:L.priority}),w(!0)},F=async(L,J)=>{const U=J==="up"?L.priority-1:L.priority+1;if(!(U<1))try{if(!(await we(`/api/webui/plugins/mirrors/${L.id}`,{method:"PUT",body:JSON.stringify({priority:U})})).ok)throw new Error("更新优先级失败");D()}catch(ue){n({title:"更新失败",description:ue instanceof Error?ue.message:"未知错误",variant:"destructive"})}};return e.jsx(Ye,{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:()=>l({to:"/plugins"}),children:e.jsx(Ta,{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:()=>v(!0),children:[e.jsx(et,{className:"h-4 w-4 mr-2"}),"添加镜像源"]})]}),u?e.jsx(Ce,{className:"p-6",children:e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Bs,{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(Jt,{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:D,children:"重新加载"})]})}):e.jsxs(Ce,{children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs(Rl,{children:[e.jsx(Ll,{children:e.jsxs(ut,{children:[e.jsx(Ze,{children:"状态"}),e.jsx(Ze,{children:"名称"}),e.jsx(Ze,{children:"ID"}),e.jsx(Ze,{children:"优先级"}),e.jsx(Ze,{className:"text-right",children:"操作"})]})}),e.jsx(Ul,{children:i.map(L=>e.jsxs(ut,{children:[e.jsx(qe,{children:e.jsx(Fe,{checked:L.enabled,onCheckedChange:()=>T(L)})}),e.jsx(qe,{children:e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:L.name}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Raw: ",L.raw_prefix]})]})}),e.jsx(qe,{children:e.jsx(Se,{variant:"outline",children:L.id})}),e.jsx(qe,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-mono",children:L.priority}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(_,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>F(L,"up"),disabled:L.priority===1,children:e.jsx(Fr,{className:"h-3 w-3"})}),e.jsx(_,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>F(L,"down"),children:e.jsx(za,{className:"h-3 w-3"})})]})]})}),e.jsx(qe,{className:"text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>A(L),children:e.jsx(Fn,{className:"h-4 w-4"})}),e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>M(L.id),children:e.jsx(ls,{className:"h-4 w-4 text-destructive"})})]})})]},L.id))})]})}),e.jsx("div",{className:"md:hidden p-4 space-y-4",children:i.map(L=>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:L.name}),L.enabled&&e.jsx(Se,{variant:"default",className:"text-xs",children:"启用"})]}),e.jsx(Se,{variant:"outline",className:"mt-1 text-xs",children:L.id})]}),e.jsx(Fe,{checked:L.enabled,onCheckedChange:()=>T(L)})]}),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:L.raw_prefix})]}),e.jsxs("div",{className:"text-muted-foreground",children:[e.jsx("span",{className:"font-medium",children:"优先级: "}),e.jsx("span",{className:"font-mono",children:L.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:()=>A(L),children:[e.jsx(Fn,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>F(L,"up"),disabled:L.priority===1,children:e.jsx(Fr,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>F(L,"down"),children:e.jsx(za,{className:"h-4 w-4"})}),e.jsx(_,{variant:"destructive",size:"sm",onClick:()=>M(L.id),children:e.jsx(ls,{className:"h-4 w-4"})})]})]})},L.id))})]}),e.jsx(Is,{open:N,onOpenChange:v,children:e.jsxs(Os,{className:"max-w-lg",children:[e.jsxs(Ds,{children:[e.jsx(Rs,{children:"添加镜像源"}),e.jsx(Ks,{children:"添加新的 Git 镜像源配置"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"add-id",children:"镜像源 ID *"}),e.jsx(le,{id:"add-id",placeholder:"例如: my-mirror",value:b.id,onChange:L=>R({...b,id:L.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"add-name",children:"名称 *"}),e.jsx(le,{id:"add-name",placeholder:"例如: 我的镜像源",value:b.name,onChange:L=>R({...b,name:L.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"add-raw",children:"Raw 文件前缀 *"}),e.jsx(le,{id:"add-raw",placeholder:"https://example.com/raw",value:b.raw_prefix,onChange:L=>R({...b,raw_prefix:L.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"add-clone",children:"克隆前缀 *"}),e.jsx(le,{id:"add-clone",placeholder:"https://example.com/clone",value:b.clone_prefix,onChange:L=>R({...b,clone_prefix:L.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"add-priority",children:"优先级"}),e.jsx(le,{id:"add-priority",type:"number",min:"1",value:b.priority,onChange:L=>R({...b,priority:parseInt(L.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(Fe,{id:"add-enabled",checked:b.enabled,onCheckedChange:L=>R({...b,enabled:L})}),e.jsx(E,{htmlFor:"add-enabled",children:"启用此镜像源"})]})]}),e.jsxs(st,{children:[e.jsx(_,{variant:"outline",onClick:()=>v(!1),children:"取消"}),e.jsx(_,{onClick:S,children:"添加"})]})]})}),e.jsx(Is,{open:y,onOpenChange:w,children:e.jsxs(Os,{className:"max-w-lg",children:[e.jsxs(Ds,{children:[e.jsx(Rs,{children:"编辑镜像源"}),e.jsx(Ks,{children:"修改镜像源配置"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:"镜像源 ID"}),e.jsx(le,{value:b.id,disabled:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"edit-name",children:"名称 *"}),e.jsx(le,{id:"edit-name",value:b.name,onChange:L=>R({...b,name:L.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"edit-raw",children:"Raw 文件前缀 *"}),e.jsx(le,{id:"edit-raw",value:b.raw_prefix,onChange:L=>R({...b,raw_prefix:L.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"edit-clone",children:"克隆前缀 *"}),e.jsx(le,{id:"edit-clone",value:b.clone_prefix,onChange:L=>R({...b,clone_prefix:L.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"edit-priority",children:"优先级"}),e.jsx(le,{id:"edit-priority",type:"number",min:"1",value:b.priority,onChange:L=>R({...b,priority:parseInt(L.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(Fe,{id:"edit-enabled",checked:b.enabled,onCheckedChange:L=>R({...b,enabled:L})}),e.jsx(E,{htmlFor:"edit-enabled",children:"启用此镜像源"})]})]}),e.jsxs(st,{children:[e.jsx(_,{variant:"outline",onClick:()=>w(!1),children:"取消"}),e.jsx(_,{onClick:P,children:"保存"})]})]})})]})})}function Gk({pluginId:l,compact:n=!1}){const[i,c]=d.useState(null),[u,x]=d.useState(!0),[h,f]=d.useState(0),[p,g]=d.useState(""),[N,v]=d.useState(!1),{toast:y}=Zs(),w=async()=>{x(!0);const S=await Hv(l);S&&c(S),x(!1)};d.useEffect(()=>{w()},[l]);const b=async()=>{const S=await zk(l);S.success?(y({title:"已点赞",description:"感谢你的支持!"}),w()):y({title:"点赞失败",description:S.error||"未知错误",variant:"destructive"})},R=async()=>{const S=await Ak(l);S.success?(y({title:"已反馈",description:"感谢你的反馈!"}),w()):y({title:"操作失败",description:S.error||"未知错误",variant:"destructive"})},D=async()=>{if(h===0){y({title:"请选择评分",description:"至少选择 1 颗星",variant:"destructive"});return}const S=await Ok(l,h,p||void 0);S.success?(y({title:"评分成功",description:"感谢你的评价!"}),v(!1),f(0),g(""),w()):y({title:"评分失败",description:S.error||"未知错误",variant:"destructive"})};return u?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(sa,{className:"h-4 w-4"}),e.jsx("span",{children:"-"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(dn,{className:"h-4 w-4"}),e.jsx("span",{children:"-"})]})]}):i?n?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:`下载量: ${i.downloads.toLocaleString()}`,children:[e.jsx(sa,{className:"h-4 w-4"}),e.jsx("span",{children:i.downloads.toLocaleString()})]}),e.jsxs("div",{className:"flex items-center gap-1",title:`评分: ${i.rating.toFixed(1)} (${i.rating_count} 条评价)`,children:[e.jsx(dn,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),e.jsx("span",{children:i.rating.toFixed(1)})]}),e.jsxs("div",{className:"flex items-center gap-1",title:`点赞数: ${i.likes}`,children:[e.jsx(Nm,{className:"h-4 w-4"}),e.jsx("span",{children:i.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(sa,{className:"h-5 w-5 text-muted-foreground mb-1"}),e.jsx("span",{className:"text-2xl font-bold",children:i.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(dn,{className:"h-5 w-5 text-yellow-400 mb-1 fill-yellow-400"}),e.jsx("span",{className:"text-2xl font-bold",children:i.rating.toFixed(1)}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[i.rating_count," 条评价"]})]}),e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(Nm,{className:"h-5 w-5 text-green-500 mb-1"}),e.jsx("span",{className:"text-2xl font-bold",children:i.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(cg,{className:"h-5 w-5 text-red-500 mb-1"}),e.jsx("span",{className:"text-2xl font-bold",children:i.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:b,children:[e.jsx(Nm,{className:"h-4 w-4 mr-1"}),"点赞"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:R,children:[e.jsx(cg,{className:"h-4 w-4 mr-1"}),"点踩"]}),e.jsxs(Is,{open:N,onOpenChange:v,children:[e.jsx(Wo,{asChild:!0,children:e.jsxs(_,{variant:"default",size:"sm",children:[e.jsx(dn,{className:"h-4 w-4 mr-1"}),"评分"]})}),e.jsxs(Os,{children:[e.jsxs(Ds,{children:[e.jsx(Rs,{children:"为插件评分"}),e.jsx(Ks,{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(dn,{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(ot,{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(st,{children:[e.jsx(_,{variant:"outline",onClick:()=>v(!1),children:"取消"}),e.jsx(_,{onClick:D,disabled:h===0,children:"提交评分"})]})]})]})]}),i.recent_ratings&&i.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:i.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(M=>e.jsx(dn,{className:`h-3 w-3 ${M<=S.rating?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},M))}),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 Vk={"Group Management":"群组管理","Entertainment & Interaction":"娱乐互动","Utility Tools":"实用工具","Content Generation":"内容生成",Multimedia:"多媒体","External Integration":"外部集成","Data Analysis & Insights":"数据分析与洞察",Other:"其他"};function qk(){const l=ca(),n=b0({strict:!1}),{toast:i}=Zs(),[c,u]=d.useState(null),[x,h]=d.useState(""),[f,p]=d.useState(!0),[g,N]=d.useState(!0),[v,y]=d.useState(null),[w,b]=d.useState(null),[R,D]=d.useState(null),[S,P]=d.useState(!1),[M,T]=d.useState(),[A,F]=d.useState(!1);d.useEffect(()=>{(async()=>{if(!n.pluginId){y("缺少插件 ID"),p(!1);return}try{p(!0),y(null);const ve=await we("/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(!ve.ok)throw new Error("获取插件列表失败");const je=await ve.json();if(!je.success||!je.data)throw new Error(je.error||"获取插件列表失败");const V=JSON.parse(je.data).find(pe=>pe.id===n.pluginId);if(!V)throw new Error("未找到该插件");const B={id:V.id,manifest:V.manifest,downloads:0,rating:0,review_count:0,installed:!1,published_at:new Date().toISOString(),updated_at:new Date().toISOString()};u(B);const[oe,K,_e]=await Promise.all([Lv(),Uv(),Al()]);b(oe),D(K),P(mn(n.pluginId,_e)),T(xn(n.pluginId,_e))}catch(ve){y(ve instanceof Error?ve.message:"加载失败")}finally{p(!1)}})()},[n.pluginId]),d.useEffect(()=>{(async()=>{if(!c?.manifest?.repository_url){N(!1);return}try{if(N(!0),S&&n.pluginId)try{const K=await we(`/api/webui/plugins/local-readme/${n.pluginId}`);if(K.ok){const _e=await K.json();if(_e.success&&_e.data){h(_e.data),N(!1);return}}}catch(K){console.log("本地 README 获取失败,尝试远程获取:",K)}const ve=c.manifest.repository_url.match(/github\.com\/([^/]+)\/([^/\s]+)/);if(!ve){h("无法解析仓库地址");return}const[,je,z]=ve,V=z.replace(/\.git$/,""),B=await we("/api/webui/plugins/fetch-raw",{method:"POST",body:JSON.stringify({owner:je,repo:V,branch:"main",file_path:"README.md"})});if(!B.ok)throw new Error("获取 README 失败");const oe=await B.json();oe.success&&oe.data?h(oe.data):h("该插件暂无 README 文档")}catch(ve){console.error("加载 README 失败:",ve),h("加载 README 失败")}finally{N(!1)}})()},[c,S,n.pluginId]);const L=()=>!c||!S||!M?!1:M!==c.manifest.version,J=()=>!c||!R?!0:$v(c.manifest.host_application.min_version,c.manifest.host_application.max_version,R),U=async()=>{if(!(!c||!w?.installed))try{F(!0),await Bv(c.id,c.manifest.repository_url||"","main"),Fv(c.id).catch(ve=>{console.warn("Failed to record download:",ve)}),i({title:"安装成功",description:`${c.manifest.name} 已成功安装`});const ne=await Al();P(mn(c.id,ne)),T(xn(c.id,ne))}catch(ne){i({title:"安装失败",description:ne instanceof Error?ne.message:"未知错误",variant:"destructive"})}finally{F(!1)}},ue=async()=>{if(c)try{F(!0),await Iv(c.id),i({title:"卸载成功",description:`${c.manifest.name} 已成功卸载`});const ne=await Al();P(mn(c.id,ne)),T(xn(c.id,ne))}catch(ne){i({title:"卸载失败",description:ne instanceof Error?ne.message:"未知错误",variant:"destructive"})}finally{F(!1)}},xe=async()=>{if(!(!c||!w?.installed))try{F(!0);const ne=await Pv(c.id,c.manifest.repository_url||"","main");i({title:"更新成功",description:`${c.manifest.name} 已从 ${ne.old_version} 更新到 ${ne.new_version}`});const ve=await Al();P(mn(c.id,ve)),T(xn(c.id,ve))}catch(ne){i({title:"更新失败",description:ne instanceof Error?ne.message:"未知错误",variant:"destructive"})}finally{F(!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:()=>l({to:"/plugins"}),children:e.jsx(Ta,{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(Bs,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件信息中..."})]})]});if(v||!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:()=>l({to:"/plugins"}),children:e.jsx(Ta,{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(_t,{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:v}),e.jsx(_,{onClick:()=>l({to:"/plugins"}),children:"返回插件列表"})]})})]});const he=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:()=>l({to:"/plugins"}),className:"shrink-0",children:e.jsx(Ta,{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:[L()?e.jsx(_,{disabled:!w?.installed||A,onClick:xe,title:w?.installed?void 0:"Git 未安装",children:A?e.jsxs(e.Fragment,{children:[e.jsx(Bs,{className:"h-4 w-4 mr-2 animate-spin"}),"更新中..."]}):e.jsxs(e.Fragment,{children:[e.jsx(dt,{className:"h-4 w-4 mr-2"}),"更新"]})}):null,e.jsx(_,{variant:"destructive",disabled:!w?.installed||A,onClick:ue,title:w?.installed?void 0:"Git 未安装",children:A?e.jsxs(e.Fragment,{children:[e.jsx(Bs,{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:!w?.installed||!he||A,onClick:U,title:w?.installed?he?void 0:`不兼容当前版本 (需要 ${c.manifest.host_application.min_version}${c.manifest.host_application.max_version?` - ${c.manifest.host_application.max_version}`:"+"},当前 ${R?.version})`:"Git 未安装",children:A?e.jsxs(e.Fragment,{children:[e.jsx(Bs,{className:"h-4 w-4 mr-2 animate-spin"}),"安装中..."]}):e.jsxs(e.Fragment,{children:[e.jsx(sa,{className:"h-4 w-4 mr-2"}),"安装"]})})})]}),e.jsx(Ye,{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(Le,{className:"text-2xl",children:c.manifest.name}),e.jsxs(Se,{variant:"secondary",className:"text-sm",children:["v",c.manifest.version]}),S&&e.jsxs(Se,{variant:"default",className:"text-sm",children:[e.jsx(pt,{className:"h-3 w-3 mr-1"}),"已安装 ",M&&`(v${M})`]}),L()&&e.jsxs(Se,{variant:"outline",className:"text-sm border-orange-500 text-orange-500",children:[e.jsx(dt,{className:"h-3 w-3 mr-1"}),"可更新"]}),!he&&e.jsxs(Se,{variant:"destructive",className:"text-sm",children:[e.jsx(_t,{className:"h-3 w-3 mr-1"}),"不兼容"]})]}),e.jsx(ws,{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(Le,{className:"text-lg",children:"统计信息"})}),e.jsx(Ae,{children:e.jsx(Gk,{pluginId:c.id})})]}),e.jsxs(Ce,{children:[e.jsx(De,{children:e.jsx(Le,{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(fn,{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(Mo,{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(Oj,{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(Uo,{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(Mo,{className:"h-3 w-3"})]})]}),c.manifest.repository_url&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(u_,{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(Mo,{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(Ht,{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(Le,{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(ne=>e.jsx(Se,{variant:"secondary",children:Vk[ne]||ne},ne))})]}),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(ne=>e.jsxs(Se,{variant:"outline",className:"text-xs",children:[e.jsx(Xo,{className:"h-3 w-3 mr-1"}),ne]},ne))})]})]})]})]}),e.jsxs(Ce,{className:"lg:col-span-2",children:[e.jsx(De,{children:e.jsx(Le,{className:"text-lg",children:"插件说明"})}),e.jsx(Ae,{children:e.jsx(Ye,{className:"h-[600px] pr-4",children:g?e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(Bs,{className:"h-6 w-6 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-sm text-muted-foreground",children:"加载说明文档中..."})]}):x?e.jsx(tx,{content:x}):e.jsx("div",{className:"text-center text-muted-foreground py-12",children:"暂无说明文档"})})})]})]})]})})]})}const qi=d.forwardRef(({className:l,...n},i)=>e.jsx(aj,{ref:i,className:I("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",l),...n}));qi.displayName=aj.displayName;const Kk=d.forwardRef(({className:l,...n},i)=>e.jsx(lj,{ref:i,className:I("aspect-square h-full w-full",l),...n}));Kk.displayName=lj.displayName;const Ki=d.forwardRef(({className:l,...n},i)=>e.jsx(nj,{ref:i,className:I("flex h-full w-full items-center justify-center rounded-full bg-muted",l),...n}));Ki.displayName=nj.displayName;function Qk(){return"webui_"+Math.random().toString(36).substr(2,9)+"_"+Date.now().toString(36)}function Yk(){const l="maibot_webui_user_id";let n=localStorage.getItem(l);return n||(n=Qk(),localStorage.setItem(l,n)),n}function Jk(){return localStorage.getItem("maibot_webui_user_name")||"WebUI用户"}function Xk(l){localStorage.setItem("maibot_webui_user_name",l)}const Gv="maibot_webui_virtual_tabs";function Zk(){try{const l=localStorage.getItem(Gv);if(l)return JSON.parse(l)}catch(l){console.error("[Chat] 加载虚拟标签页失败:",l)}return[]}function Ug(l){try{localStorage.setItem(Gv,JSON.stringify(l))}catch(n){console.error("[Chat] 保存虚拟标签页失败:",n)}}function Wk({segment:l}){switch(l.type){case"text":return e.jsx("span",{className:"whitespace-pre-wrap",children:String(l.data)});case"image":case"emoji":return e.jsx("img",{src:String(l.data),alt:l.type==="emoji"?"表情包":"图片",className:I("rounded-lg max-w-full",l.type==="emoji"?"max-h-32":"max-h-64"),loading:"lazy",onError:n=>{const i=n.target;i.style.display="none",i.parentElement?.insertAdjacentHTML("beforeend",`[${l.type==="emoji"?"表情包":"图片"}加载失败]`)}});case"voice":return e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("audio",{controls:!0,src:String(l.data),className:"max-w-[200px] h-8",children:"您的浏览器不支持音频播放"})});case"video":return e.jsx("video",{controls:!0,src:String(l.data),className:"rounded-lg max-w-full max-h-64",children:"您的浏览器不支持视频播放"});case"face":return e.jsxs("span",{className:"text-muted-foreground",children:["[表情:",String(l.data),"]"]});case"music":return e.jsx("span",{className:"text-muted-foreground",children:"[音乐分享]"});case"file":return e.jsxs("span",{className:"text-muted-foreground",children:["[文件: ",String(l.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:["[",l.original_type||"未知消息","]"]})}}function eC({message:l,isBot:n}){return l.message_type==="rich"&&l.segments&&l.segments.length>0?e.jsx("div",{className:"flex flex-col gap-2",children:l.segments.map((i,c)=>e.jsx(Wk,{segment:i},c))}):e.jsx("span",{className:"whitespace-pre-wrap",children:l.content})}function sC(){const l={id:"webui-default",type:"webui",label:"WebUI",messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}},n=()=>{const Ve=Zk().map(Ke=>{const We=Ke.virtualConfig;return!We.groupId&&We.platform&&We.userId&&(We.groupId=`webui_virtual_group_${We.platform}_${We.userId}`),{id:Ke.id,type:"virtual",label:Ke.label,virtualConfig:We,messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}}});return[l,...Ve]},[i,c]=d.useState(n),[u,x]=d.useState("webui-default"),h=i.find(q=>q.id===u)||i[0],[f,p]=d.useState(""),[g,N]=d.useState(!1),[v,y]=d.useState(!0),[w,b]=d.useState(Jk()),[R,D]=d.useState(!1),[S,P]=d.useState(""),[M,T]=d.useState(!1),[A,F]=d.useState([]),[L,J]=d.useState([]),[U,ue]=d.useState(!1),[xe,he]=d.useState(!1),[ne,ve]=d.useState(""),[je,z]=d.useState({platform:"",personId:"",userId:"",userName:"",groupName:"",groupId:""}),V=d.useRef(Yk()),B=d.useRef(new Map),oe=d.useRef(null),K=d.useRef(new Map),_e=d.useRef(0),pe=d.useRef(new Map),{toast:ke}=Zs(),O=q=>(_e.current+=1,`${q}-${Date.now()}-${_e.current}-${Math.random().toString(36).substr(2,9)}`),k=d.useCallback((q,Ve)=>{c(Ke=>Ke.map(We=>We.id===q?{...We,...Ve}:We))},[]),H=d.useCallback((q,Ve)=>{c(Ke=>Ke.map(We=>We.id===q?{...We,messages:[...We.messages,Ve]}:We))},[]),se=d.useCallback(()=>{oe.current?.scrollIntoView({behavior:"smooth"})},[]);d.useEffect(()=>{se()},[h?.messages,se]);const Ee=d.useCallback(async()=>{ue(!0);try{const q=await we("/api/chat/platforms");if(console.log("[Chat] 平台列表响应:",q.status,q.headers.get("content-type")),q.ok){const Ve=q.headers.get("content-type");if(Ve&&Ve.includes("application/json")){const Ke=await q.json();console.log("[Chat] 平台列表数据:",Ke),F(Ke.platforms||[])}else{const Ke=await q.text();console.error("[Chat] 获取平台列表失败: 非 JSON 响应:",Ke.substring(0,200)),ke({title:"连接失败",description:"无法连接到后端服务,请确保 MaiBot 已启动",variant:"destructive"})}}else console.error("[Chat] 获取平台列表失败: HTTP",q.status),ke({title:"获取平台失败",description:`服务器返回错误: ${q.status}`,variant:"destructive"})}catch(q){console.error("[Chat] 获取平台列表失败:",q),ke({title:"网络错误",description:"无法连接到后端服务",variant:"destructive"})}finally{ue(!1)}},[ke]),Z=d.useCallback(async(q,Ve)=>{he(!0);try{const Ke=new URLSearchParams;q&&Ke.append("platform",q),Ve&&Ke.append("search",Ve),Ke.append("limit","50");const We=await we(`/api/chat/persons?${Ke.toString()}`);if(We.ok){const Ls=We.headers.get("content-type");if(Ls&&Ls.includes("application/json")){const ts=await We.json();J(ts.persons||[])}else console.error("[Chat] 获取用户列表失败: 后端返回非 JSON 响应")}}catch(Ke){console.error("[Chat] 获取用户列表失败:",Ke)}finally{he(!1)}},[]);d.useEffect(()=>{je.platform&&Z(je.platform,ne)},[je.platform,ne,Z]);const Oe=d.useCallback(async(q,Ve)=>{y(!0);try{const Ke=new URLSearchParams;Ke.append("user_id",V.current),Ke.append("limit","50"),Ve&&Ke.append("group_id",Ve);const We=`/api/chat/history?${Ke.toString()}`;console.log("[Chat] 正在加载历史消息:",We);const Ls=await we(We);if(Ls.ok){const ts=await Ls.text();try{const Cs=JSON.parse(ts);if(Cs.messages&&Cs.messages.length>0){const ze=Cs.messages.map(as=>({id:as.id,type:as.type,content:as.content,timestamp:as.timestamp,sender:{name:as.sender_name||(as.is_bot?"麦麦":"WebUI用户"),user_id:as.user_id,is_bot:as.is_bot}}));k(q,{messages:ze});const Ns=pe.current.get(q)||new Set;ze.forEach(as=>{if(as.type==="bot"){const es=`bot-${as.content}-${Math.floor(as.timestamp*1e3)}`;Ns.add(es)}}),pe.current.set(q,Ns)}}catch(Cs){console.error("[Chat] JSON 解析失败:",Cs)}}}catch(Ke){console.error("[Chat] 加载历史消息失败:",Ke)}finally{y(!1)}},[k]),ns=d.useCallback(async(q,Ve,Ke)=>{const We=B.current.get(q);if(We?.readyState===WebSocket.OPEN||We?.readyState===WebSocket.CONNECTING){console.log(`[Tab ${q}] WebSocket 已存在,跳过连接`);return}N(!0);let Ls=null;try{const Ns=await we("/api/webui/ws-token");if(Ns.ok){const as=await Ns.json();if(as.success&&as.token)Ls=as.token;else{console.warn(`[Tab ${q}] 获取 WebSocket token 失败: ${as.message||"未登录"}`),N(!1);return}}}catch(Ns){console.error(`[Tab ${q}] 获取 WebSocket token 失败:`,Ns),N(!1);return}if(!Ls){N(!1);return}const ts=window.location.protocol==="https:"?"wss:":"ws:",Cs=new URLSearchParams;Cs.append("token",Ls),Ve==="virtual"&&Ke?(Cs.append("user_id",Ke.userId),Cs.append("user_name",Ke.userName),Cs.append("platform",Ke.platform),Cs.append("person_id",Ke.personId),Cs.append("group_name",Ke.groupName||"WebUI虚拟群聊"),Ke.groupId&&Cs.append("group_id",Ke.groupId)):(Cs.append("user_id",V.current),Cs.append("user_name",w));const ze=`${ts}//${window.location.host}/api/chat/ws?${Cs.toString()}`;console.log(`[Tab ${q}] 正在连接 WebSocket:`,ze);try{const Ns=new WebSocket(ze);B.current.set(q,Ns),Ns.onopen=()=>{k(q,{isConnected:!0}),N(!1),console.log(`[Tab ${q}] WebSocket 已连接`)},Ns.onmessage=as=>{try{const es=JSON.parse(as.data);switch(es.type){case"session_info":k(q,{sessionInfo:{session_id:es.session_id,user_id:es.user_id,user_name:es.user_name,bot_name:es.bot_name}});break;case"system":H(q,{id:O("sys"),type:"system",content:es.content||"",timestamp:es.timestamp||Date.now()/1e3});break;case"user_message":{const bs=es.sender?.user_id,gt=Ve==="virtual"&&Ke?Ke.userId:V.current;console.log(`[Tab ${q}] 收到 user_message, sender: ${bs}, current: ${gt}`);const $t=bs?bs.replace(/^webui_user_/,""):"",tt=gt?gt.replace(/^webui_user_/,""):"";if($t&&tt&&$t===tt){console.log(`[Tab ${q}] 跳过自己的消息(user_id 匹配)`);break}const Ms=pe.current.get(q)||new Set,Et=`user-${es.content}-${Math.floor((es.timestamp||0)*1e3)}`;if(Ms.has(Et)){console.log(`[Tab ${q}] 跳过自己的消息(内容去重)`);break}if(Ms.add(Et),pe.current.set(q,Ms),Ms.size>100){const Bt=Ms.values().next().value;Bt&&Ms.delete(Bt)}H(q,{id:es.message_id||O("user"),type:"user",content:es.content||"",timestamp:es.timestamp||Date.now()/1e3,sender:es.sender});break}case"bot_message":{k(q,{isTyping:!1});const bs=pe.current.get(q)||new Set,gt=`bot-${es.content}-${Math.floor((es.timestamp||0)*1e3)}`;if(bs.has(gt))break;if(bs.add(gt),pe.current.set(q,bs),bs.size>100){const $t=bs.values().next().value;$t&&bs.delete($t)}c($t=>$t.map(tt=>{if(tt.id!==q)return tt;const Ms=tt.messages.filter(Bt=>Bt.type!=="thinking"),Et={id:O("bot"),type:"bot",content:es.content||"",message_type:es.message_type==="rich"?"rich":"text",segments:es.segments,timestamp:es.timestamp||Date.now()/1e3,sender:es.sender};return{...tt,messages:[...Ms,Et]}}));break}case"typing":k(q,{isTyping:es.is_typing||!1});break;case"error":c(bs=>bs.map(gt=>{if(gt.id!==q)return gt;const $t=gt.messages.filter(tt=>tt.type!=="thinking");return{...gt,messages:[...$t,{id:O("error"),type:"error",content:es.content||"发生错误",timestamp:es.timestamp||Date.now()/1e3}]}})),ke({title:"错误",description:es.content,variant:"destructive"});break;case"pong":break;case"history":{const bs=es.messages||[];if(bs.length>0){const gt=pe.current.get(q)||new Set,$t=bs.map(tt=>{const Ms=tt.is_bot||!1,Et=tt.id||O(Ms?"bot":"user"),Bt=`${Ms?"bot":"user"}-${tt.content}-${Math.floor(tt.timestamp*1e3)}`;return gt.add(Bt),{id:Et,type:Ms?"bot":"user",content:tt.content,timestamp:tt.timestamp,sender:{name:tt.sender_name||(Ms?"麦麦":"用户"),user_id:tt.sender_id,is_bot:Ms}}});pe.current.set(q,gt),k(q,{messages:$t}),console.log(`[Tab ${q}] 已加载 ${$t.length} 条历史消息`)}break}default:console.log("未知消息类型:",es.type)}}catch(es){console.error("解析消息失败:",es)}},Ns.onclose=()=>{k(q,{isConnected:!1}),N(!1),B.current.delete(q),console.log(`[Tab ${q}] WebSocket 已断开`);const as=K.current.get(q);as&&clearTimeout(as);const es=window.setTimeout(()=>{if(!Q.current){const bs=i.find(gt=>gt.id===q);bs&&ns(q,bs.type,bs.virtualConfig)}},5e3);K.current.set(q,es)},Ns.onerror=as=>{console.error(`[Tab ${q}] WebSocket 错误:`,as),N(!1)}}catch(Ns){console.error(`[Tab ${q}] 创建 WebSocket 失败:`,Ns),N(!1)}},[w,k,H,ke,i]),Q=d.useRef(!1);d.useEffect(()=>{Q.current=!1;const q=B.current,Ve=K.current,Ke=pe.current;Oe("webui-default");const We=setTimeout(()=>{Q.current||(ns("webui-default","webui"),i.forEach(ts=>{ts.type==="virtual"&&ts.virtualConfig&&(Ke.set(ts.id,new Set),setTimeout(()=>{Q.current||ns(ts.id,"virtual",ts.virtualConfig)},200))}))},100),Ls=setInterval(()=>{q.forEach(ts=>{ts.readyState===WebSocket.OPEN&&ts.send(JSON.stringify({type:"ping"}))})},3e4);return()=>{Q.current=!0,clearTimeout(We),clearInterval(Ls),Ve.forEach(ts=>{clearTimeout(ts)}),Ve.clear(),q.forEach(ts=>{ts.close()}),q.clear()}},[]);const ee=d.useCallback(()=>{const q=B.current.get(u);if(!f.trim()||!q||q.readyState!==WebSocket.OPEN)return;const Ve=h?.type==="virtual"&&h.virtualConfig?.userName||w,Ke=f.trim(),We=Date.now()/1e3;q.send(JSON.stringify({type:"message",content:Ke,user_name:Ve}));const Ls=pe.current.get(u)||new Set,ts=`user-${Ke}-${Math.floor(We*1e3)}`;if(Ls.add(ts),pe.current.set(u,Ls),Ls.size>100){const Ns=Ls.values().next().value;Ns&&Ls.delete(Ns)}const Cs={id:O("user"),type:"user",content:Ke,timestamp:We,sender:{name:Ve,is_bot:!1}};H(u,Cs);const ze={id:O("thinking"),type:"thinking",content:"",timestamp:We+.001,sender:{name:h?.sessionInfo.bot_name||"麦麦",is_bot:!0}};H(u,ze),p("")},[f,w,u,h,H]),Ue=q=>{q.key==="Enter"&&!q.shiftKey&&(q.preventDefault(),ee())},ie=()=>{P(w),D(!0)},Te=()=>{const q=S.trim()||"WebUI用户";b(q),Xk(q),D(!1);const Ve=B.current.get(u);Ve?.readyState===WebSocket.OPEN&&Ve.send(JSON.stringify({type:"update_nickname",user_name:q}))},de=()=>{P(""),D(!1)},Me=q=>new Date(q*1e3).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}),rs=()=>{const q=B.current.get(u);q&&(q.close(),B.current.delete(u)),ns(u,h?.type||"webui",h?.virtualConfig)},Ut=()=>{z({platform:"",personId:"",userId:"",userName:"",groupName:"",groupId:""}),ve(""),Ee(),T(!0)},aa=()=>{if(!je.platform||!je.personId){ke({title:"配置不完整",description:"请选择平台和用户",variant:"destructive"});return}const q=`webui_virtual_group_${je.platform}_${je.userId}`,Ve=`virtual-${je.platform}-${je.userId}-${Date.now()}`,Ke=je.userName||je.userId,We={id:Ve,type:"virtual",label:Ke,virtualConfig:{...je,groupId:q},messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}};c(Ls=>{const ts=[...Ls,We],Cs=ts.filter(ze=>ze.type==="virtual"&&ze.virtualConfig).map(ze=>({id:ze.id,label:ze.label,virtualConfig:ze.virtualConfig,createdAt:Date.now()}));return Ug(Cs),ts}),x(Ve),T(!1),pe.current.set(Ve,new Set),setTimeout(()=>{ns(Ve,"virtual",je)},100),ke({title:"虚拟身份标签页",description:`已创建 ${Ke} 的对话`})},Qa=(q,Ve)=>{if(Ve?.stopPropagation(),q==="webui-default")return;const Ke=B.current.get(q);Ke&&(Ke.close(),B.current.delete(q));const We=K.current.get(q);We&&(clearTimeout(We),K.current.delete(q)),pe.current.delete(q),c(Ls=>{const ts=Ls.filter(ze=>ze.id!==q),Cs=ts.filter(ze=>ze.type==="virtual"&&ze.virtualConfig).map(ze=>({id:ze.id,label:ze.label,virtualConfig:ze.virtualConfig,createdAt:Date.now()}));return Ug(Cs),ts}),u===q&&x("webui-default")},Ft=q=>{x(q)},mt=q=>{z(Ve=>({...Ve,personId:q.person_id,userId:q.user_id,userName:q.nickname||q.person_name}))};return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(Is,{open:M,onOpenChange:T,children:e.jsxs(Os,{className:"sm:max-w-[500px] max-h-[85vh] overflow-hidden flex flex-col",children:[e.jsxs(Ds,{children:[e.jsxs(Rs,{className:"flex items-center gap-2",children:[e.jsx(bm,{className:"h-5 w-5"}),"新建虚拟身份对话"]}),e.jsx(Ks,{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(E,{className:"flex items-center gap-2",children:[e.jsx(Uo,{className:"h-4 w-4"}),"选择平台"]}),e.jsxs(Ie,{value:je.platform,onValueChange:q=>{z(Ve=>({...Ve,platform:q,personId:"",userId:"",userName:""})),J([])},children:[e.jsx($e,{disabled:U,children:e.jsx(Pe,{placeholder:U?"加载中...":"选择平台"})}),e.jsx(Be,{children:A.map(q=>e.jsxs(X,{value:q.platform,children:[q.platform," (",q.count," 人)"]},q.platform))})]})]}),je.platform&&e.jsxs("div",{className:"space-y-2 flex-1 overflow-hidden flex flex-col",children:[e.jsxs(E,{className:"flex items-center gap-2",children:[e.jsx(sc,{className:"h-4 w-4"}),"选择用户"]}),e.jsxs("div",{className:"relative",children:[e.jsx(Tt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(le,{placeholder:"搜索用户名...",value:ne,onChange:q=>ve(q.target.value),className:"pl-9"})]}),e.jsx(Ye,{className:"h-[250px] border rounded-md",children:e.jsx("div",{className:"p-2",children:xe?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Bs,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):L.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground",children:[e.jsx(sc,{className:"h-8 w-8 mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"没有找到用户"})]}):e.jsx("div",{className:"space-y-1",children:L.map(q=>e.jsxs("button",{onClick:()=>mt(q),className:I("w-full flex items-center gap-3 p-2 rounded-md text-left transition-colors",je.personId===q.person_id?"bg-primary text-primary-foreground":"hover:bg-muted"),children:[e.jsx(qi,{className:"h-8 w-8 shrink-0",children:e.jsx(Ki,{className:I("text-xs",je.personId===q.person_id?"bg-primary-foreground/20":"bg-muted"),children:(q.nickname||q.person_name||"?").charAt(0)})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-medium truncate",children:q.nickname||q.person_name}),e.jsxs("div",{className:I("text-xs truncate",je.personId===q.person_id?"text-primary-foreground/70":"text-muted-foreground"),children:["ID: ",q.user_id,q.is_known&&" · 已认识"]})]})]},q.person_id))})})})]}),je.personId&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:"虚拟群名(可选)"}),e.jsx(le,{placeholder:"WebUI虚拟群聊",value:je.groupName,onChange:q=>z(Ve=>({...Ve,groupName:q.target.value}))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦会认为这是一个名为此名称的群聊"})]})]}),e.jsxs(st,{className:"gap-2 sm:gap-0",children:[e.jsx(_,{variant:"outline",onClick:()=>T(!1),children:"取消"}),e.jsx(_,{onClick:aa,disabled:!je.platform||!je.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:[i.map(q=>e.jsxs("div",{className:I("flex items-center gap-1.5 px-3 py-1.5 rounded-md text-sm whitespace-nowrap transition-colors cursor-pointer","hover:bg-muted",u===q.id?"bg-background shadow-sm border":"text-muted-foreground"),onClick:()=>Ft(q.id),children:[q.type==="webui"?e.jsx(Ma,{className:"h-3.5 w-3.5"}):e.jsx(bm,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"max-w-[100px] truncate",children:q.label}),e.jsx("span",{className:I("w-1.5 h-1.5 rounded-full",q.isConnected?"bg-green-500":"bg-muted-foreground/50")}),q.id!=="webui-default"&&e.jsx("span",{onClick:Ve=>Qa(q.id,Ve),className:"ml-0.5 p-0.5 rounded hover:bg-muted-foreground/20 cursor-pointer",role:"button",tabIndex:0,onKeyDown:Ve=>{(Ve.key==="Enter"||Ve.key===" ")&&(Ve.preventDefault(),Qa(q.id,Ve))},children:e.jsx(Ea,{className:"h-3 w-3"})})]},q.id)),e.jsx("button",{onClick:Ut,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(et,{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(qi,{className:"h-8 w-8 sm:h-10 sm:w-10 shrink-0",children:e.jsx(Ki,{className:"bg-primary/10 text-primary",children:e.jsx(Pn,{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(m_,{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(Bs,{className:"h-3 w-3 animate-spin"}),e.jsx("span",{children:"连接中..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(x_,{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:[v&&e.jsx(Bs,{className:"h-4 w-4 animate-spin text-muted-foreground"}),e.jsx(_,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:rs,disabled:g,title:"重新连接",children:e.jsx(dt,{className:I("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(bm,{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(fn,{className:"h-3 w-3"}),e.jsx("span",{children:"当前身份:"}),R?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(le,{value:S,onChange:q=>P(q.target.value),onKeyDown:q=>{q.key==="Enter"&&Te(),q.key==="Escape"&&de()},className:"h-7 w-32",placeholder:"输入昵称",autoFocus:!0}),e.jsx(_,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:Te,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:w}),e.jsx(_,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:ie,title:"修改昵称",children:e.jsx(h_,{className:"h-3 w-3"})})]})]})})]})}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(Ye,{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&&!v&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[e.jsx(Pn,{className:"h-12 w-12 mb-4 opacity-50"}),e.jsxs("p",{className:"text-sm",children:["开始与 ",h?.sessionInfo.bot_name||"麦麦"," 对话吧!"]})]}),h?.messages.map(q=>e.jsxs("div",{className:I("flex gap-2 sm:gap-3",q.type==="user"&&"flex-row-reverse",q.type==="system"&&"justify-center",q.type==="error"&&"justify-center"),children:[q.type==="system"&&e.jsx("div",{className:"text-xs text-muted-foreground bg-muted/50 px-3 py-1 rounded-full max-w-[90%]",children:q.content}),q.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:q.content}),q.type==="thinking"&&e.jsxs(e.Fragment,{children:[e.jsx(qi,{className:"h-7 w-7 sm:h-8 sm:w-8 shrink-0",children:e.jsx(Ki,{className:"bg-primary/10 text-primary",children:e.jsx(Pn,{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:q.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:"思考中..."})]})})]})]}),(q.type==="user"||q.type==="bot")&&e.jsxs(e.Fragment,{children:[e.jsx(qi,{className:"h-7 w-7 sm:h-8 sm:w-8 shrink-0",children:e.jsx(Ki,{className:I("text-xs",q.type==="bot"?"bg-primary/10 text-primary":"bg-secondary text-secondary-foreground"),children:q.type==="bot"?e.jsx(Pn,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"}):e.jsx(fn,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"})})}),e.jsxs("div",{className:I("flex flex-col gap-1 max-w-[75%] sm:max-w-[70%]",q.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:q.sender?.name||(q.type==="bot"?h?.sessionInfo.bot_name:w)}),e.jsx("span",{children:Me(q.timestamp)})]}),e.jsx("div",{className:I("rounded-2xl px-3 py-2 text-sm break-words",q.type==="bot"?"bg-muted rounded-tl-sm":"bg-primary text-primary-foreground rounded-tr-sm"),children:e.jsx(eC,{message:q,isBot:q.type==="bot"})})]})]})]},q.id)),e.jsx("div",{ref:oe})]})})}),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(le,{value:f,onChange:q=>p(q.target.value),onKeyDown:Ue,placeholder:h?.isConnected?"输入消息...":"等待连接...",disabled:!h?.isConnected,className:"flex-1 h-10 sm:h-10"}),e.jsx(_,{onClick:ee,disabled:!h?.isConnected||!f.trim(),size:"icon",className:"h-10 w-10 shrink-0",children:e.jsx(f_,{className:"h-4 w-4"})})]})})})]})}var ux="Radio",[tC,Vv]=Ko(ux),[aC,lC]=tC(ux),qv=d.forwardRef((l,n)=>{const{__scopeRadio:i,name:c,checked:u=!1,required:x,disabled:h,value:f="on",onCheck:p,form:g,...N}=l,[v,y]=d.useState(null),w=Qo(n,D=>y(D)),b=d.useRef(!1),R=v?g||!!v.closest("form"):!0;return e.jsxs(aC,{scope:i,checked:u,disabled:h,children:[e.jsx(Qn.button,{type:"button",role:"radio","aria-checked":u,"data-state":Jv(u),"data-disabled":h?"":void 0,disabled:h,value:f,...N,ref:w,onClick:hn(l.onClick,D=>{u||p?.(),R&&(b.current=D.isPropagationStopped(),b.current||D.stopPropagation())})}),R&&e.jsx(Yv,{control:v,bubbles:!b.current,name:c,value:f,checked:u,required:x,disabled:h,form:g,style:{transform:"translateX(-100%)"}})]})});qv.displayName=ux;var Kv="RadioIndicator",Qv=d.forwardRef((l,n)=>{const{__scopeRadio:i,forceMount:c,...u}=l,x=lC(Kv,i);return e.jsx(Dw,{present:c||x.checked,children:e.jsx(Qn.span,{"data-state":Jv(x.checked),"data-disabled":x.disabled?"":void 0,...u,ref:n})})});Qv.displayName=Kv;var nC="RadioBubbleInput",Yv=d.forwardRef(({__scopeRadio:l,control:n,checked:i,bubbles:c=!0,...u},x)=>{const h=d.useRef(null),f=Qo(h,x),p=Rw(i),g=Lw(n);return d.useEffect(()=>{const N=h.current;if(!N)return;const v=window.HTMLInputElement.prototype,w=Object.getOwnPropertyDescriptor(v,"checked").set;if(p!==i&&w){const b=new Event("click",{bubbles:c});w.call(N,i),N.dispatchEvent(b)}},[p,i,c]),e.jsx(Qn.input,{type:"radio","aria-hidden":!0,defaultChecked:i,...u,tabIndex:-1,ref:f,style:{...u.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Yv.displayName=nC;function Jv(l){return l?"checked":"unchecked"}var rC=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],rd="RadioGroup",[iC]=Ko(rd,[rj,Vv]),Xv=rj(),Zv=Vv(),[cC,oC]=iC(rd),Wv=d.forwardRef((l,n)=>{const{__scopeRadioGroup:i,name:c,defaultValue:u,value:x,required:h=!1,disabled:f=!1,orientation:p,dir:g,loop:N=!0,onValueChange:v,...y}=l,w=Xv(i),b=_j(g),[R,D]=qo({prop:x,defaultProp:u??null,onChange:v,caller:rd});return e.jsx(cC,{scope:i,name:c,required:h,disabled:f,value:R,onValueChange:D,children:e.jsx(J0,{asChild:!0,...w,orientation:p,dir:b,loop:N,children:e.jsx(Qn.div,{role:"radiogroup","aria-required":h,"aria-orientation":p,"data-disabled":f?"":void 0,dir:b,...y,ref:n})})})});Wv.displayName=rd;var eN="RadioGroupItem",sN=d.forwardRef((l,n)=>{const{__scopeRadioGroup:i,disabled:c,...u}=l,x=oC(eN,i),h=x.disabled||c,f=Xv(i),p=Zv(i),g=d.useRef(null),N=Qo(n,g),v=x.value===u.value,y=d.useRef(!1);return d.useEffect(()=>{const w=R=>{rC.includes(R.key)&&(y.current=!0)},b=()=>y.current=!1;return document.addEventListener("keydown",w),document.addEventListener("keyup",b),()=>{document.removeEventListener("keydown",w),document.removeEventListener("keyup",b)}},[]),e.jsx(X0,{asChild:!0,...f,focusable:!h,active:v,children:e.jsx(qv,{disabled:h,required:x.required,checked:v,...p,...u,name:x.name,ref:N,onCheck:()=>x.onValueChange(u.value),onKeyDown:hn(w=>{w.key==="Enter"&&w.preventDefault()}),onFocus:hn(u.onFocus,()=>{y.current&&g.current?.click()})})})});sN.displayName=eN;var dC="RadioGroupIndicator",tN=d.forwardRef((l,n)=>{const{__scopeRadioGroup:i,...c}=l,u=Zv(i);return e.jsx(Qv,{...u,...c,ref:n})});tN.displayName=dC;var aN=Wv,lN=sN,uC=tN;const mx=d.forwardRef(({className:l,...n},i)=>e.jsx(aN,{className:I("grid gap-2",l),...n,ref:i}));mx.displayName=aN.displayName;const Go=d.forwardRef(({className:l,...n},i)=>e.jsx(lN,{ref:i,className:I("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",l),...n,children:e.jsx(uC,{className:"flex items-center justify-center",children:e.jsx(Lo,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Go.displayName=lN.displayName;function mC({question:l,value:n,onChange:i,error:c,disabled:u=!1}){const[x,h]=d.useState(null),f=u||l.readOnly,p=()=>{switch(l.type){case"single":return e.jsx(mx,{value:n||"",onValueChange:i,disabled:f,className:"space-y-2",children:l.options?.map(g=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Go,{value:g.value,id:`${l.id}-${g.id}`}),e.jsx(E,{htmlFor:`${l.id}-${g.id}`,className:"cursor-pointer font-normal",children:g.label})]},g.id))});case"multiple":{const g=n||[];return e.jsxs("div",{className:"space-y-2",children:[l.options?.map(N=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qs,{id:`${l.id}-${N.id}`,checked:g.includes(N.value),disabled:f||l.maxSelections!==void 0&&g.length>=l.maxSelections&&!g.includes(N.value),onCheckedChange:v=>{i(v?[...g,N.value]:g.filter(y=>y!==N.value))}}),e.jsx(E,{htmlFor:`${l.id}-${N.id}`,className:"cursor-pointer font-normal",children:N.label})]},N.id)),l.maxSelections&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["最多选择 ",l.maxSelections," 项"]})]})}case"text":return e.jsx(le,{value:n||"",onChange:g=>i(g.target.value),placeholder:l.placeholder||"请输入...",disabled:f,readOnly:l.readOnly,maxLength:l.maxLength,className:I(l.readOnly&&"bg-muted cursor-not-allowed")});case"textarea":return e.jsxs("div",{className:"space-y-1",children:[e.jsx(ot,{value:n||"",onChange:g=>i(g.target.value),placeholder:l.placeholder||"请输入...",disabled:f,readOnly:l.readOnly,maxLength:l.maxLength,rows:4,className:I(l.readOnly&&"bg-muted cursor-not-allowed")}),l.maxLength&&e.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[(n||"").length," / ",l.maxLength]})]});case"rating":{const g=n||0,N=x!==null?x:g;return e.jsxs("div",{className:"flex items-center gap-1",children:[[1,2,3,4,5].map(v=>e.jsx("button",{type:"button",disabled:f,className:I("p-1 transition-colors focus:outline-none focus:ring-2 focus:ring-ring rounded",f&&"cursor-not-allowed opacity-50"),onMouseEnter:()=>!f&&h(v),onMouseLeave:()=>h(null),onClick:()=>!f&&i(v),children:e.jsx(dn,{className:I("h-6 w-6 transition-colors",v<=N?"fill-yellow-400 text-yellow-400":"text-muted-foreground")})},v)),g>0&&e.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:[g," / 5"]})]})}case"scale":{const g=l.min??1,N=l.max??10,v=l.step??1,y=n??g;return e.jsxs("div",{className:"space-y-4",children:[e.jsx(qa,{value:[y],onValueChange:([w])=>i(w),min:g,max:N,step:v,disabled:f}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:l.minLabel||g}),e.jsx("span",{className:"font-medium text-foreground",children:y}),e.jsx("span",{children:l.maxLabel||N})]})]})}case"dropdown":return e.jsxs(Ie,{value:n||"",onValueChange:i,disabled:f,children:[e.jsx($e,{children:e.jsx(Pe,{placeholder:l.placeholder||"请选择..."})}),e.jsx(Be,{children:l.options?.map(g=>e.jsx(X,{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(E,{className:"text-base font-medium",children:[l.title,l.required&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),l.description&&e.jsx("p",{className:"text-sm text-muted-foreground",children:l.description})]}),p(),c&&e.jsx("p",{className:"text-sm text-destructive",children:c})]})}const nN="https://maibot-plugin-stats.maibot-webui.workers.dev";function rN(){const l="maibot_user_id";let n=localStorage.getItem(l);if(!n){const i=Math.random().toString(36).substring(2,10),c=Date.now().toString(36),u=Math.random().toString(36).substring(2,10);n=`fp_${i}_${c}_${u}`,localStorage.setItem(l,n)}return n}async function xC(l,n,i,c){try{const u=c?.userId||rN(),x={surveyId:l,surveyVersion:n,userId:u,answers:i,submittedAt:new Date().toISOString(),allowMultiple:c?.allowMultiple,metadata:{userAgent:navigator.userAgent,language:navigator.language}},h=await fetch(`${nN}/survey/submit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(x)}),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(u){return console.error("Error submitting survey:",u),{success:!1,error:"网络错误"}}}async function hC(l,n){try{const i=n||rN(),c=new URLSearchParams({user_id:i,survey_id:l}),u=await fetch(`${nN}/survey/check?${c}`);return u.ok?{success:!0,hasSubmitted:(await u.json()).hasSubmitted}:{success:!1,error:(await u.json()).error||"检查失败"}}catch(i){return console.error("Error checking submission:",i),{success:!1,error:"网络错误"}}}function iN({config:l,initialAnswers:n,onSubmitSuccess:i,onSubmitError:c,showProgress:u=!0,paginateQuestions:x=!1,className:h}){const f=d.useCallback(()=>!n||n.length===0?{}:n.reduce((B,oe)=>(B[oe.questionId]=oe.value,B),{}),[n]),[p,g]=d.useState(()=>f()),[N,v]=d.useState({}),[y,w]=d.useState(0),[b,R]=d.useState(!1),[D,S]=d.useState(!1),[P,M]=d.useState(null),[T,A]=d.useState(null),[F,L]=d.useState(!1),[J,U]=d.useState(!0);d.useEffect(()=>{n&&n.length>0&&g(B=>({...B,...f()}))},[n,f]),d.useEffect(()=>{(async()=>{if(!l.settings?.allowMultiple){const oe=await hC(l.id);oe.success&&oe.hasSubmitted&&L(!0)}U(!1)})()},[l.id,l.settings?.allowMultiple]);const ue=d.useCallback(()=>{const B=new Date;return!(l.settings?.startTime&&new Date(l.settings.startTime)>B||l.settings?.endTime&&new Date(l.settings.endTime){const oe=p[B.id];return oe==null?!1:Array.isArray(oe)?oe.length>0:typeof oe=="string"?oe.trim()!=="":!0}).length,he=xe/l.questions.length*100,ne=d.useCallback((B,oe)=>{g(K=>({...K,[B]:oe})),v(K=>{const _e={...K};return delete _e[B],_e})},[]),ve=d.useCallback(()=>{const B={};for(const oe of l.questions){if(oe.required){const K=p[oe.id];if(K==null){B[oe.id]="此题为必填项";continue}if(Array.isArray(K)&&K.length===0){B[oe.id]="请至少选择一项";continue}if(typeof K=="string"&&K.trim()===""){B[oe.id]="此题为必填项";continue}}oe.minLength&&typeof p[oe.id]=="string"&&p[oe.id].length{if(!ve()){if(x){const B=l.questions.findIndex(oe=>N[oe.id]);B>=0&&w(B)}return}R(!0),M(null);try{const B=l.questions.filter(K=>p[K.id]!==void 0).map(K=>({questionId:K.id,value:p[K.id]})),oe=await xC(l.id,l.version,B,{allowMultiple:l.settings?.allowMultiple});if(oe.success&&oe.submissionId)S(!0),A(oe.submissionId),i?.(oe.submissionId);else{const K=oe.error||"提交失败";M(K),c?.(K)}}catch(B){const oe=B instanceof Error?B.message:"提交失败";M(oe),c?.(oe)}finally{R(!1)}},[ve,x,l,p,N,i,c]),z=d.useCallback(B=>{B>=0&&Be.jsxs("div",{className:I("p-4 rounded-lg border bg-card",N[B.id]?"border-destructive bg-destructive/5":"border-border"),children:[x&&e.jsxs("div",{className:"text-xs text-muted-foreground mb-2",children:["问题 ",y+1," / ",l.questions.length]}),!x&&e.jsxs("div",{className:"text-xs text-muted-foreground mb-2",children:[oe+1,"."]}),e.jsx(mC,{question:B,value:p[B.id],onChange:K=>ne(B.id,K),error:N[B.id],disabled:b})]},B.id)),P&&e.jsxs(at,{variant:"destructive",children:[e.jsx(_t,{className:"h-4 w-4"}),e.jsx(lt,{children:P})]}),e.jsx("div",{className:"flex justify-between items-center py-4",children:x?e.jsxs(e.Fragment,{children:[e.jsxs(_,{variant:"outline",onClick:()=>z(y-1),disabled:y===0||b,children:[e.jsx(Aa,{className:"h-4 w-4 mr-1"}),"上一题"]}),y===l.questions.length-1?e.jsxs(_,{onClick:je,disabled:b,children:[b&&e.jsx(Bs,{className:"h-4 w-4 mr-2 animate-spin"}),"提交问卷"]}):e.jsxs(_,{onClick:()=>z(y+1),disabled:b,children:["下一题",e.jsx(Zt,{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:je,disabled:b,size:"lg",children:[b&&e.jsx(Bs,{className:"h-4 w-4 mr-2 animate-spin"}),"提交问卷"]})]})})]})})]})}const fC={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:"感谢你的反馈!你的意见对我们非常重要,我们会认真考虑每一条建议。"}},pC={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 gC(){const[l,n]=d.useState(!0),i=d.useMemo(()=>JSON.parse(JSON.stringify(fC)),[]);d.useEffect(()=>{n(!1)},[]);const c=d.useMemo(()=>[{questionId:"webui_version",value:`v${ed}`}],[]),u=d.useCallback(h=>{console.log("WebUI Survey submitted:",h)},[]),x=d.useCallback(h=>{console.error("WebUI Survey submission error:",h)},[]);return l?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx(Bs,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):i?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(Hj,{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(iN,{config:i,initialAnswers:c,showProgress:!0,paginateQuestions:!1,onSubmitSuccess:u,onSubmitError:x})})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-4",children:[e.jsxs(at,{variant:"destructive",className:"max-w-md",children:[e.jsx(_t,{className:"h-4 w-4"}),e.jsx(lt,{children:"无法加载问卷配置"})]}),e.jsx(_,{variant:"outline",onClick:()=>window.location.reload(),children:"重试"})]})}function jC(){const[l,n]=d.useState(null),[i,c]=d.useState(!0),[u,x]=d.useState("未知版本");d.useEffect(()=>{(async()=>{try{const v=await c1();x(v.version||"未知版本")}catch(v){console.error("Failed to get MaiBot version:",v),x("获取失败")}const N=JSON.parse(JSON.stringify(pC));n(N),c(!1)})()},[]);const h=d.useMemo(()=>[{questionId:"maibot_version",value:u}],[u]),f=d.useCallback(g=>{console.log("MaiBot Survey submitted:",g)},[]),p=d.useCallback(g=>{console.error("MaiBot Survey submission error:",g)},[]);return i?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx(Bs,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):l?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(Hj,{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(iN,{config:l,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(at,{variant:"destructive",className:"max-w-md",children:[e.jsx(_t,{className:"h-4 w-4"}),e.jsx(lt,{children:"无法加载问卷配置"})]}),e.jsx(_,{variant:"outline",onClick:()=>window.location.reload(),children:"重试"})]})}async function vC(l=2025){const n=await we(`/api/webui/annual-report/full?year=${l}`);if(!n.ok){const i=await n.json();throw new Error(i.detail||"获取年度报告失败")}return n.json()}const $g=["#0088FE","#00C49F","#FFBB28","#FF8042","#8884d8","#82ca9d"];function NC(){const[l]=d.useState(2025),[n,i]=d.useState(null),[c,u]=d.useState(!0),[x,h]=d.useState(null),f=d.useRef(null),p=d.useCallback(async()=>{try{u(!0),h(null);const g=await vC(l);i(g)}catch(g){h(g instanceof Error?g:new Error("获取年度报告失败"))}finally{u(!1)}},[l]);return d.useEffect(()=>{p()},[p]),c?e.jsx(bC,{}):x?e.jsxs("div",{className:"flex h-screen items-center justify-center text-red-500",children:["获取年度报告失败: ",x.message]}):n?e.jsx(Ye,{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",children:e.jsxs("div",{className:"mx-auto max-w-5xl space-y-8 print:space-y-4",ref:f,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.jsxs("div",{className:"relative z-10 flex flex-col items-center text-center",children:[e.jsx(Pn,{className:"mb-4 h-16 w-16 animate-bounce"}),e.jsxs("h1",{className:"text-4xl font-bold tracking-tighter sm:text-6xl",children:["麦麦 ",n.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($o,{className:"h-4 w-4"}),e.jsxs("span",{children:["生成时间: ",n.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(ka,{title:"年度在线时长",value:`${n.time_footprint.total_online_hours} 小时`,description:"相当于陪伴大家绕了太阳一圈",icon:e.jsx(na,{className:"h-4 w-4"})}),e.jsx(ka,{title:"最忙碌的一天",value:n.time_footprint.busiest_day||"N/A",description:`处理了 ${n.time_footprint.busiest_day_count} 条消息`,icon:e.jsx($o,{className:"h-4 w-4"})}),e.jsx(ka,{title:"深夜互动 (0-4点)",value:`${n.time_footprint.midnight_chat_count} 次`,description:"在万籁俱寂时交换秘密",icon:e.jsx(Qi,{className:"h-4 w-4"})}),e.jsx(ka,{title:"作息属性",value:n.time_footprint.is_night_owl?"夜猫子":"早起鸟",description:n.time_footprint.is_night_owl?"越夜越精神":"早睡早起身体好",icon:n.time_footprint.is_night_owl?e.jsx(Qi,{className:"h-4 w-4"}):e.jsx(qm,{className:"h-4 w-4"})})]}),e.jsxs(Ce,{className:"overflow-hidden",children:[e.jsxs(De,{children:[e.jsx(Le,{children:"24小时活跃时钟"}),e.jsx(ws,{children:"麦麦在一天中各个时段的活跃程度"})]}),e.jsx(Ae,{className:"h-[300px]",children:e.jsx(oj,{width:"100%",height:"100%",children:e.jsxs(Eo,{data:n.time_footprint.hourly_distribution.map((g,N)=>({hour:`${N}点`,count:g})),children:[e.jsx(Hi,{strokeDasharray:"3 3",vertical:!1}),e.jsx(Fi,{dataKey:"hour"}),e.jsx(Ur,{}),e.jsx(dj,{contentStyle:{borderRadius:"8px",border:"none",boxShadow:"0 4px 12px rgba(0,0,0,0.1)"},cursor:{fill:"transparent"}}),e.jsx(Gi,{dataKey:"count",fill:"hsl(var(--primary))",radius:[4,4,0,0]})]})})})]}),n.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:n.time_footprint.first_message_time}),e.jsxs("p",{className:"text-lg",children:[e.jsx("span",{className:"font-semibold text-foreground",children:n.time_footprint.first_message_user})," 说:",e.jsxs("span",{className:"italic text-muted-foreground",children:['"',n.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(sc,{className:"h-8 w-8"}),e.jsx("h2",{children:"社交网络"})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsx(ka,{title:"社交圈子",value:`${n.social_network.total_groups} 个群组`,description:`今年新认识了 ${n.social_network.new_friends_count} 位朋友`,icon:e.jsx(sc,{className:"h-4 w-4"})}),e.jsx(ka,{title:"被呼叫次数",value:`${n.social_network.at_count+n.social_network.mentioned_count} 次`,description:"我的名字被大家频繁提起",icon:e.jsx(p_,{className:"h-4 w-4"})}),e.jsx(ka,{title:"最长情陪伴",value:n.social_network.longest_companion_user||"N/A",description:`始终都在,已陪伴 ${n.social_network.longest_companion_days} 天`,icon:e.jsx(Vr,{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(Le,{children:"话痨群组 TOP3"})}),e.jsx(Ae,{children:e.jsx("div",{className:"space-y-4",children:n.social_network.top_groups.map((g,N)=>e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Se,{variant:N===0?"default":"secondary",className:"h-6 w-6 rounded-full p-0 flex items-center justify-center",children:N+1}),e.jsx("span",{className:"font-medium truncate max-w-[150px]",children:g.group_name})]}),e.jsxs("span",{className:"text-muted-foreground text-sm",children:[g.message_count," 条消息"]})]},g.group_id))})})]}),e.jsxs(Ce,{children:[e.jsx(De,{children:e.jsx(Le,{children:"年度最佳损友 TOP3"})}),e.jsx(Ae,{children:e.jsx("div",{className:"space-y-4",children:n.social_network.top_users.map((g,N)=>e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Se,{variant:N===0?"default":"secondary",className:"h-6 w-6 rounded-full p-0 flex items-center justify-center",children:N+1}),e.jsx("span",{className:"font-medium truncate max-w-[150px]",children:g.user_nickname})]}),e.jsxs("span",{className:"text-muted-foreground text-sm",children:[g.message_count," 次互动"]})]},g.user_id))})})]})]})]}),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(Xm,{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(ka,{title:"年度 Token 消耗",value:(n.brain_power.total_tokens/1e6).toFixed(2)+" M",description:"连起来可以绕地球 0.5 圈",icon:e.jsx(Za,{className:"h-4 w-4"})}),e.jsx(ka,{title:"年度总花费",value:`$${n.brain_power.total_cost.toFixed(2)}`,description:"为了陪大家聊天也是拼了",icon:e.jsx("span",{className:"font-bold",children:"$"})}),e.jsx(ka,{title:"高冷指数",value:`${n.brain_power.silence_rate}%`,description:`有 ${n.brain_power.no_reply_count} 次选择了沉默`,icon:e.jsx(Qi,{className:"h-4 w-4"})}),e.jsx(ka,{title:"最高兴趣值",value:n.brain_power.max_interest_value??"N/A",description:n.brain_power.max_interest_time?`出现在 ${n.brain_power.max_interest_time}`:"暂无数据",icon:e.jsx(Vr,{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(Le,{children:"模型偏好分布"})}),e.jsx(Ae,{children:e.jsx("div",{className:"space-y-3",children:n.brain_power.model_distribution.slice(0,5).map((g,N)=>{const v=n.brain_power.model_distribution[0]?.count||1,y=Math.round(g.count/v*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:g.model}),e.jsxs("span",{className:"text-muted-foreground",children:[g.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:`${y}%`,backgroundColor:$g[N%$g.length]}})})]},g.model)})})})]}),e.jsxs(Ce,{children:[e.jsxs(De,{children:[e.jsx(Le,{children:"烧钱大户 TOP3"}),e.jsx(ws,{children:"谁消耗了最多的 API 额度"})]}),e.jsx(Ae,{children:e.jsx("div",{className:"space-y-6",children:n.brain_power.top_token_consumers.map(g=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between text-sm font-medium",children:[e.jsxs("span",{children:["用户 ",g.user_id]}),e.jsxs("span",{children:["$",g.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:`${g.cost/(n.brain_power.top_token_consumers[0]?.cost||1)*100}%`}})})]},g.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(Le,{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:["$",n.brain_power.most_expensive_cost.toFixed(4)]}),n.brain_power.most_expensive_time&&e.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:["发生在 ",n.brain_power.most_expensive_time]}),e.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"为了让你满意,这次我可是下了血本!"})]})]}),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(Le,{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:n.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:n.brain_power.max_reasoning_length?.toLocaleString()||0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"最长思考字数"})]})]}),n.brain_power.max_reasoning_time&&e.jsxs("p",{className:"mt-4 text-center text-xs text-muted-foreground",children:["最深沉的思考发生在 ",n.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(Yo,{className:"h-8 w-8"}),e.jsx("h2",{children:"个性与表达"})]}),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(Le,{children:"表情包之王"}),e.jsx(ws,{children:"年度使用次数最多的表情包"})]}),e.jsx(Ae,{className:"flex flex-col items-center justify-center",children:n.expression_vibe.top_emoji?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative mb-4 h-48 w-48 overflow-hidden rounded-lg shadow-lg transition-transform hover:scale-105",children:[e.jsx("img",{src:`/api/webui/emoji/${n.expression_vibe.top_emoji.id}/thumbnail?original=true`,alt:"Top Emoji",className:"h-full w-full object-cover"}),e.jsx(Se,{className:"absolute right-2 top-2 bg-yellow-500",children:"NO.1"})]}),e.jsxs("p",{className:"text-center font-medium text-lg",children:['"',n.expression_vibe.top_emoji.description,'"']}),e.jsxs("p",{className:"text-muted-foreground",children:["使用了 ",n.expression_vibe.top_emoji.usage_count," 次"]})]}):e.jsx("div",{className:"flex h-48 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(Le,{children:"百变麦麦"}),e.jsx(ws,{children:"最常使用的表达风格"})]}),e.jsx(Ae,{children:e.jsx("div",{className:"flex flex-wrap gap-2",children:n.expression_vibe.top_expressions.map((g,N)=>e.jsxs(Se,{variant:"outline",className:I("px-3 py-1 text-sm",N===0&&"border-primary bg-primary/10 text-primary text-base px-4 py-2"),children:[g.style," (",g.count,")"]},g.style))})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(ka,{title:"图片鉴赏",value:`${n.expression_vibe.image_processed_count} 张`,description:"我看过的图比你吃过的盐还多",icon:e.jsx(Jm,{className:"h-4 w-4"})}),e.jsx(ka,{title:"成长的足迹",value:`${n.expression_vibe.rejected_expression_count} 次`,description:"被大家纠正表达的次数",icon:e.jsx(Za,{className:"h-4 w-4"})})]})]})]}),n.expression_vibe.action_types.length>0&&e.jsxs(Ce,{children:[e.jsxs(De,{children:[e.jsxs(Le,{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-2xl",children:"⚡"}),"行动派"]}),e.jsx(ws,{children:"除了聊天,我还帮大家做了这些事"})]}),e.jsx(Ae,{children:e.jsx("div",{className:"flex flex-wrap gap-3",children:n.expression_vibe.action_types.map(g=>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:g.action}),e.jsxs(Se,{variant:"secondary",children:[g.count," 次"]})]},g.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(g_,{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(Le,{children:'新学到的"黑话"'}),e.jsxs(ws,{children:["今年我学会了 ",n.achievements.new_jargon_count," 个新词"]})]}),e.jsx(Ae,{children:e.jsx("div",{className:"flex flex-wrap gap-3",children:n.achievements.sample_jargons.map(g=>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:g.content}),e.jsx("div",{className:"text-xs text-muted-foreground mt-1 line-clamp-2 max-w-[200px]",children:g.meaning||"暂无解释"})]},g.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(Ma,{className:"h-12 w-12 mb-4 opacity-80"}),e.jsx("div",{className:"text-4xl font-bold mb-2",children:n.achievements.total_messages.toLocaleString()}),e.jsx("div",{className:"text-sm opacity-80",children:"年度总消息数"}),e.jsxs("div",{className:"mt-4 text-xs opacity-60",children:["其中回复了 ",n.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 ka({title:l,value:n,description:i,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(Le,{className:"text-sm font-medium",children:l}),e.jsx("div",{className:"text-muted-foreground",children:c})]}),e.jsxs(Ae,{children:[e.jsx("div",{className:"text-2xl font-bold",children:n}),e.jsx("p",{className:"text-xs text-muted-foreground",children:i})]})]})}function bC(){return e.jsxs("div",{className:"container mx-auto space-y-8 p-8",children:[e.jsx(js,{className:"h-64 w-full rounded-3xl"}),e.jsx("div",{className:"grid gap-4 md:grid-cols-4",children:[...Array(4)].map((l,n)=>e.jsx(js,{className:"h-32 w-full"},n))}),e.jsx(js,{className:"h-96 w-full"})]})}var id="DropdownMenu",[yC]=Ko(id,[ij]),oa=ij(),[wC,cN]=yC(id),oN=l=>{const{__scopeDropdownMenu:n,children:i,dir:c,open:u,defaultOpen:x,onOpenChange:h,modal:f=!0}=l,p=oa(n),g=d.useRef(null),[N,v]=qo({prop:u,defaultProp:x??!1,onChange:h,caller:id});return e.jsx(wC,{scope:n,triggerId:Lm(),triggerRef:g,contentId:Lm(),open:N,onOpenChange:v,onOpenToggle:d.useCallback(()=>v(y=>!y),[v]),modal:f,children:e.jsx(cw,{...p,open:N,onOpenChange:v,dir:c,modal:f,children:i})})};oN.displayName=id;var dN="DropdownMenuTrigger",uN=d.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,disabled:c=!1,...u}=l,x=cN(dN,i),h=oa(i);return e.jsx(ow,{asChild:!0,...h,children:e.jsx(Qn.button,{type:"button",id:x.triggerId,"aria-haspopup":"menu","aria-expanded":x.open,"aria-controls":x.open?x.contentId:void 0,"data-state":x.open?"open":"closed","data-disabled":c?"":void 0,disabled:c,...u,ref:Uw(n,x.triggerRef),onPointerDown:hn(l.onPointerDown,f=>{!c&&f.button===0&&f.ctrlKey===!1&&(x.onOpenToggle(),x.open||f.preventDefault())}),onKeyDown:hn(l.onKeyDown,f=>{c||(["Enter"," "].includes(f.key)&&x.onOpenToggle(),f.key==="ArrowDown"&&x.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(f.key)&&f.preventDefault())})})})});uN.displayName=dN;var _C="DropdownMenuPortal",mN=l=>{const{__scopeDropdownMenu:n,...i}=l,c=oa(n);return e.jsx(ew,{...c,...i})};mN.displayName=_C;var xN="DropdownMenuContent",hN=d.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=cN(xN,i),x=oa(i),h=d.useRef(!1);return e.jsx(sw,{id:u.contentId,"aria-labelledby":u.triggerId,...x,...c,ref:n,onCloseAutoFocus:hn(l.onCloseAutoFocus,f=>{h.current||u.triggerRef.current?.focus(),h.current=!1,f.preventDefault()}),onInteractOutside:hn(l.onInteractOutside,f=>{const p=f.detail.originalEvent,g=p.button===0&&p.ctrlKey===!0,N=p.button===2||g;(!u.modal||N)&&(h.current=!0)}),style:{...l.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)"}})});hN.displayName=xN;var SC="DropdownMenuGroup",kC=d.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=oa(i);return e.jsx(dw,{...u,...c,ref:n})});kC.displayName=SC;var CC="DropdownMenuLabel",fN=d.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=oa(i);return e.jsx(rw,{...u,...c,ref:n})});fN.displayName=CC;var TC="DropdownMenuItem",pN=d.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=oa(i);return e.jsx(tw,{...u,...c,ref:n})});pN.displayName=TC;var EC="DropdownMenuCheckboxItem",gN=d.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=oa(i);return e.jsx(aw,{...u,...c,ref:n})});gN.displayName=EC;var MC="DropdownMenuRadioGroup",zC=d.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=oa(i);return e.jsx(uw,{...u,...c,ref:n})});zC.displayName=MC;var AC="DropdownMenuRadioItem",jN=d.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=oa(i);return e.jsx(nw,{...u,...c,ref:n})});jN.displayName=AC;var OC="DropdownMenuItemIndicator",vN=d.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=oa(i);return e.jsx(lw,{...u,...c,ref:n})});vN.displayName=OC;var DC="DropdownMenuSeparator",NN=d.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=oa(i);return e.jsx(iw,{...u,...c,ref:n})});NN.displayName=DC;var RC="DropdownMenuArrow",LC=d.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=oa(i);return e.jsx(mw,{...u,...c,ref:n})});LC.displayName=RC;var UC="DropdownMenuSubTrigger",bN=d.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=oa(i);return e.jsx(Z0,{...u,...c,ref:n})});bN.displayName=UC;var $C="DropdownMenuSubContent",yN=d.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=oa(i);return e.jsx(W0,{...u,...c,ref:n,style:{...l.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)"}})});yN.displayName=$C;var BC=oN,IC=uN,PC=mN,wN=hN,_N=fN,SN=pN,kN=gN,CN=jN,TN=vN,EN=NN,MN=bN,zN=yN;const HC=BC,FC=IC,GC=d.forwardRef(({className:l,inset:n,children:i,...c},u)=>e.jsxs(MN,{ref:u,className:I("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",n&&"pl-8",l),...c,children:[i,e.jsx(Zt,{className:"ml-auto h-4 w-4"})]}));GC.displayName=MN.displayName;const VC=d.forwardRef(({className:l,...n},i)=>e.jsx(zN,{ref:i,className:I("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",l),...n}));VC.displayName=zN.displayName;const AN=d.forwardRef(({className:l,sideOffset:n=4,...i},c)=>e.jsx(PC,{children:e.jsx(wN,{ref:c,sideOffset:n,className:I("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",l),...i})}));AN.displayName=wN.displayName;const ON=d.forwardRef(({className:l,inset:n,...i},c)=>e.jsx(SN,{ref:c,className:I("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",n&&"pl-8",l),...i}));ON.displayName=SN.displayName;const qC=d.forwardRef(({className:l,children:n,checked:i,...c},u)=>e.jsxs(kN,{ref:u,className:I("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",l),checked:i,...c,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(TN,{children:e.jsx(Ct,{className:"h-4 w-4"})})}),n]}));qC.displayName=kN.displayName;const KC=d.forwardRef(({className:l,children:n,...i},c)=>e.jsxs(CN,{ref:c,className:I("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",l),...i,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(TN,{children:e.jsx(Lo,{className:"h-2 w-2 fill-current"})})}),n]}));KC.displayName=CN.displayName;const QC=d.forwardRef(({className:l,inset:n,...i},c)=>e.jsx(_N,{ref:c,className:I("px-2 py-1.5 text-sm font-semibold",n&&"pl-8",l),...i}));QC.displayName=_N.displayName;const YC=d.forwardRef(({className:l,...n},i)=>e.jsx(EN,{ref:i,className:I("-mx-1 my-1 h-px bg-muted",l),...n}));YC.displayName=EN.displayName;const DN=({className:l,...n})=>e.jsx("nav",{role:"navigation","aria-label":"pagination",className:I("mx-auto flex w-full justify-center",l),...n});DN.displayName="Pagination";const RN=d.forwardRef(({className:l,...n},i)=>e.jsx("ul",{ref:i,className:I("flex flex-row items-center gap-1",l),...n}));RN.displayName="PaginationContent";const Do=d.forwardRef(({className:l,...n},i)=>e.jsx("li",{ref:i,className:I("",l),...n}));Do.displayName="PaginationItem";const cd=({className:l,isActive:n,size:i="icon",...c})=>e.jsx("a",{"aria-current":n?"page":void 0,className:I(qr({variant:n?"outline":"ghost",size:i}),l),...c});cd.displayName="PaginationLink";const LN=({className:l,...n})=>e.jsxs(cd,{"aria-label":"Go to previous page",size:"default",className:I("gap-1 pl-2.5",l),...n,children:[e.jsx(Aa,{className:"h-4 w-4"}),e.jsx("span",{children:"上一页"})]});LN.displayName="PaginationPrevious";const UN=({className:l,...n})=>e.jsxs(cd,{"aria-label":"Go to next page",size:"default",className:I("gap-1 pr-2.5",l),...n,children:[e.jsx("span",{children:"下一页"}),e.jsx(Zt,{className:"h-4 w-4"})]});UN.displayName="PaginationNext";const Rm=[{value:"created_at",label:"最新发布",icon:na},{value:"downloads",label:"下载最多",icon:sa},{value:"likes",label:"最受欢迎",icon:Vr}];function JC(){const l=ca(),[n,i]=d.useState([]),[c,u]=d.useState(!0),[x,h]=d.useState(""),[f,p]=d.useState("downloads"),[g,N]=d.useState(1),[v,y]=d.useState(1),[w,b]=d.useState(0),[R,D]=d.useState(new Set),[S,P]=d.useState(new Set),M=Sv(),T=d.useCallback(async()=>{u(!0);try{const U=await dS({status:"approved",page:g,page_size:12,search:x||void 0,sort_by:f,sort_order:"desc"});i(U.packs),y(U.total_pages),b(U.total);const ue=new Set;for(const xe of U.packs)await _v(xe.id,M)&&ue.add(xe.id);D(ue)}catch(U){console.error("加载 Pack 列表失败:",U),Qt({title:"加载 Pack 列表失败",variant:"destructive"})}finally{u(!1)}},[g,x,f,M]);d.useEffect(()=>{T()},[T]);const A=U=>{U.preventDefault(),N(1),T()},F=async U=>{if(!S.has(U)){P(ue=>new Set(ue).add(U));try{const ue=await wv(U,M);D(xe=>{const he=new Set(xe);return ue.liked?he.add(U):he.delete(U),he}),i(xe=>xe.map(he=>he.id===U?{...he,likes:ue.likes}:he))}catch(ue){console.error("点赞失败:",ue),Qt({title:"点赞失败",variant:"destructive"})}finally{P(ue=>{const xe=new Set(ue);return xe.delete(U),xe})}}},L=U=>{l({to:"/config/pack-market/$packId",params:{packId:U}})},J=Rm.find(U=>U.value===f)||Rm[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:T,disabled:c,className:"gap-2",children:[e.jsx(dt,{className:`h-4 w-4 ${c?"animate-spin":""}`}),"刷新"]})]})}),e.jsx(Ye,{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:A,className:"flex-1 min-w-[200px] max-w-md",children:e.jsxs("div",{className:"relative",children:[e.jsx(Tt,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(le,{placeholder:"搜索模板名称、描述...",value:x,onChange:U=>h(U.target.value),className:"pl-10"})]})}),e.jsxs(HC,{children:[e.jsx(FC,{asChild:!0,children:e.jsxs(_,{variant:"outline",className:"min-w-[140px] gap-2",children:[e.jsx(j_,{className:"w-4 h-4"}),J.label,e.jsx(za,{className:"w-4 h-4 ml-auto"})]})}),e.jsx(AN,{align:"end",children:Rm.map(U=>e.jsxs(ON,{onClick:()=>{p(U.value),N(1)},children:[e.jsx(U.icon,{className:"w-4 h-4 mr-2"}),U.label]},U.value))})]})]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共找到 ",e.jsx("span",{className:"font-medium text-foreground",children:w})," 个模板"]}),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((U,ue)=>e.jsxs(Ce,{children:[e.jsxs(De,{children:[e.jsx(js,{className:"h-6 w-3/4"}),e.jsx(js,{className:"h-4 w-full mt-2"})]}),e.jsx(Ae,{children:e.jsx(js,{className:"h-20 w-full"})}),e.jsx(Zo,{children:e.jsx(js,{className:"h-9 w-full"})})]},ue))}):n.length===0?e.jsx(Ce,{className:"py-12",children:e.jsxs(Ae,{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:n.map(U=>e.jsx(XC,{pack:U,liked:R.has(U.id),liking:S.has(U.id),onLike:()=>F(U.id),onView:()=>L(U.id)},U.id))}),v>1&&e.jsx(DN,{children:e.jsxs(RN,{children:[e.jsx(Do,{children:e.jsx(LN,{onClick:()=>N(U=>Math.max(1,U-1)),className:g===1?"pointer-events-none opacity-50":"cursor-pointer"})}),Array.from({length:v},(U,ue)=>ue+1).filter(U=>U===1||U===v||Math.abs(U-g)<=1).map((U,ue,xe)=>{const he=ue>0&&U-xe[ue-1]>1;return e.jsxs(Do,{children:[he&&e.jsx("span",{className:"px-2",children:"..."}),e.jsx(cd,{onClick:()=>N(U),isActive:U===g,className:"cursor-pointer",children:U})]},U)}),e.jsx(Do,{children:e.jsx(UN,{onClick:()=>N(U=>Math.min(v,U+1)),className:g===v?"pointer-events-none opacity-50":"cursor-pointer"})})]})})]})})]})}function XC({pack:l,liked:n,liking:i,onLike:c,onView:u}){const x=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(Le,{className:"text-lg line-clamp-1",children:l.name}),e.jsxs(Se,{variant:"secondary",className:"text-xs",children:["v",l.version]})]}),e.jsx(ws,{className:"line-clamp-2 min-h-[40px]",children:l.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(fn,{className:"w-3.5 h-3.5"}),l.author]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(na,{className:"w-3.5 h-3.5"}),x(l.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(Dl,{className:"w-3.5 h-3.5"}),l.provider_count]}),e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",title:"模型数量",children:[e.jsx(Gn,{className:"w-3.5 h-3.5"}),l.model_count]}),e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",title:"任务配置数",children:[e.jsx(Vn,{className:"w-3.5 h-3.5"}),l.task_count]})]}),l.tags&&l.tags.length>0&&e.jsxs("div",{className:"flex flex-wrap gap-1",children:[l.tags.slice(0,3).map(h=>e.jsxs(Se,{variant:"outline",className:"text-xs",children:[e.jsx(Xo,{className:"w-2.5 h-2.5 mr-1"}),h]},h)),l.tags.length>3&&e.jsxs(Se,{variant:"outline",className:"text-xs",children:["+",l.tags.length-3]})]})]}),e.jsx(Zo,{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(sa,{className:"w-4 h-4"}),l.downloads]}),e.jsxs("button",{onClick:h=>{h.stopPropagation(),c()},disabled:i,className:`flex items-center gap-1 transition-colors ${n?"text-red-500":"hover:text-red-500"} ${i?"opacity-50":""}`,children:[e.jsx(Vr,{className:`w-4 h-4 ${n?"fill-current":""}`}),l.likes]})]}),e.jsx(_,{size:"sm",onClick:u,children:"查看详情"})]})})]})}var sl="Accordion",ZC=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[xx,WC,e3]=$w(sl),[od]=Ko(sl,[e3,cj]),hx=cj(),$N=As.forwardRef((l,n)=>{const{type:i,...c}=l,u=c,x=c;return e.jsx(xx.Provider,{scope:l.__scopeAccordion,children:i==="multiple"?e.jsx(l3,{...x,ref:n}):e.jsx(a3,{...u,ref:n})})});$N.displayName=sl;var[BN,s3]=od(sl),[IN,t3]=od(sl,{collapsible:!1}),a3=As.forwardRef((l,n)=>{const{value:i,defaultValue:c,onValueChange:u=()=>{},collapsible:x=!1,...h}=l,[f,p]=qo({prop:i,defaultProp:c??"",onChange:u,caller:sl});return e.jsx(BN,{scope:l.__scopeAccordion,value:As.useMemo(()=>f?[f]:[],[f]),onItemOpen:p,onItemClose:As.useCallback(()=>x&&p(""),[x,p]),children:e.jsx(IN,{scope:l.__scopeAccordion,collapsible:x,children:e.jsx(PN,{...h,ref:n})})})}),l3=As.forwardRef((l,n)=>{const{value:i,defaultValue:c,onValueChange:u=()=>{},...x}=l,[h,f]=qo({prop:i,defaultProp:c??[],onChange:u,caller:sl}),p=As.useCallback(N=>f((v=[])=>[...v,N]),[f]),g=As.useCallback(N=>f((v=[])=>v.filter(y=>y!==N)),[f]);return e.jsx(BN,{scope:l.__scopeAccordion,value:h,onItemOpen:p,onItemClose:g,children:e.jsx(IN,{scope:l.__scopeAccordion,collapsible:!0,children:e.jsx(PN,{...x,ref:n})})})}),[n3,dd]=od(sl),PN=As.forwardRef((l,n)=>{const{__scopeAccordion:i,disabled:c,dir:u,orientation:x="vertical",...h}=l,f=As.useRef(null),p=Qo(f,n),g=WC(i),v=_j(u)==="ltr",y=hn(l.onKeyDown,w=>{if(!ZC.includes(w.key))return;const b=w.target,R=g().filter(J=>!J.ref.current?.disabled),D=R.findIndex(J=>J.ref.current===b),S=R.length;if(D===-1)return;w.preventDefault();let P=D;const M=0,T=S-1,A=()=>{P=D+1,P>T&&(P=M)},F=()=>{P=D-1,P{const{__scopeAccordion:i,value:c,...u}=l,x=dd(Vo,i),h=s3(Vo,i),f=hx(i),p=Lm(),g=c&&h.value.includes(c)||!1,N=x.disabled||l.disabled;return e.jsx(r3,{scope:i,open:g,disabled:N,triggerId:p,children:e.jsx(tj,{"data-orientation":x.orientation,"data-state":QN(g),...f,...u,ref:n,disabled:N,open:g,onOpenChange:v=>{v?h.onItemOpen(c):h.onItemClose(c)}})})});HN.displayName=Vo;var FN="AccordionHeader",GN=As.forwardRef((l,n)=>{const{__scopeAccordion:i,...c}=l,u=dd(sl,i),x=fx(FN,i);return e.jsx(Qn.h3,{"data-orientation":u.orientation,"data-state":QN(x.open),"data-disabled":x.disabled?"":void 0,...c,ref:n})});GN.displayName=FN;var Fm="AccordionTrigger",VN=As.forwardRef((l,n)=>{const{__scopeAccordion:i,...c}=l,u=dd(sl,i),x=fx(Fm,i),h=t3(Fm,i),f=hx(i);return e.jsx(xx.ItemSlot,{scope:i,children:e.jsx(xw,{"aria-disabled":x.open&&!h.collapsible||void 0,"data-orientation":u.orientation,id:x.triggerId,...f,...c,ref:n})})});VN.displayName=Fm;var qN="AccordionContent",KN=As.forwardRef((l,n)=>{const{__scopeAccordion:i,...c}=l,u=dd(sl,i),x=fx(qN,i),h=hx(i);return e.jsx(hw,{role:"region","aria-labelledby":x.triggerId,"data-orientation":u.orientation,...h,...c,ref:n,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...l.style}})});KN.displayName=qN;function QN(l){return l?"open":"closed"}var i3=$N,c3=HN,o3=GN,YN=VN,JN=KN;const d3=i3,XN=d.forwardRef(({className:l,...n},i)=>e.jsx(c3,{ref:i,className:I("border-b",l),...n}));XN.displayName="AccordionItem";const ZN=d.forwardRef(({className:l,children:n,...i},c)=>e.jsx(o3,{className:"flex",children:e.jsxs(YN,{ref:c,className:I("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",l),...i,children:[n,e.jsx(za,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));ZN.displayName=YN.displayName;const WN=d.forwardRef(({className:l,children:n,...i},c)=>e.jsx(JN,{ref:c,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...i,children:e.jsx("div",{className:I("pb-4 pt-0",l),children:n})}));WN.displayName=JN.displayName;const u3={utils:"通用工具",utils_small:"轻量工具",tool_use:"工具调用",replyer:"回复生成",planner:"规划推理",vlm:"视觉模型",voice:"语音处理",embedding:"向量嵌入",lpmm_entity_extract:"实体提取",lpmm_rdf_build:"RDF构建",lpmm_qa:"问答模型"};function m3(){const{packId:l}=lb.useParams(),n=ca(),[i,c]=d.useState(null),[u,x]=d.useState(!0),[h,f]=d.useState(!1),[p,g]=d.useState(!1),[N,v]=d.useState(!1),[y,w]=d.useState(1),[b,R]=d.useState(null),[D,S]=d.useState(!1),[P,M]=d.useState(!1),[T,A]=d.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}),[F,L]=d.useState({}),[J,U]=d.useState({}),ue=Sv(),xe=d.useCallback(async()=>{if(l){x(!0);try{const z=await uS(l);c(z);const V=await _v(l,ue);f(V)}catch(z){console.error("加载 Pack 失败:",z),Qt({title:"加载模板失败",variant:"destructive"})}finally{x(!1)}}},[l,ue]);d.useEffect(()=>{xe()},[xe]);const he=async()=>{if(!(!l||p)){g(!0);try{const z=await wv(l,ue);f(z.liked),i&&c({...i,likes:z.likes})}catch(z){console.error("点赞失败:",z),Qt({title:"点赞失败",variant:"destructive"})}finally{g(!1)}}},ne=async()=>{if(i){v(!0),w(1),S(!0);try{const z=await hS(i);R(z);const V={};for(const oe of z.existing_providers)V[oe.pack_provider.name]=oe.local_providers[0].name;L(V);const B={};for(const oe of z.new_providers)B[oe.name]="";U(B)}catch(z){console.error("检测冲突失败:",z),Qt({title:"检测配置冲突失败",variant:"destructive"}),v(!1)}finally{S(!1)}}},ve=async()=>{if(i){if(T.apply_providers&&b){for(const z of b.new_providers)if(!J[z.name]){Qt({title:`请填写提供商 "${z.name}" 的 API Key`,variant:"destructive"});return}}M(!0);try{await fS(i,T,F,J),await xS(i.id,ue),c({...i,downloads:i.downloads+1}),Qt({title:"配置模板应用成功!"}),v(!1)}catch(z){console.error("应用 Pack 失败:",z),Qt({title:z instanceof Error?z.message:"应用配置失败",variant:"destructive"})}finally{M(!1)}}},je=z=>new Date(z).toLocaleDateString("zh-CN",{year:"numeric",month:"long",day:"numeric"});return u?e.jsx(h3,{}):i?e.jsx("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:e.jsx(Ye,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsxs(_,{variant:"ghost",size:"sm",onClick:()=>n({to:"/config/pack-market"}),className:"gap-2",children:[e.jsx(Ta,{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:[i.name,e.jsxs(Se,{variant:"secondary",children:["v",i.version]})]}),e.jsx("p",{className:"text-muted-foreground mt-1",children:i.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(fn,{className:"w-4 h-4"}),i.author]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(na,{className:"w-4 h-4"}),je(i.created_at)]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(sa,{className:"w-4 h-4"}),i.downloads," 次下载"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Vr,{className:`w-4 h-4 ${h?"fill-red-500 text-red-500":""}`}),i.likes," 赞"]})]}),i.tags&&i.tags.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:i.tags.map(z=>e.jsxs(Se,{variant:"outline",children:[e.jsx(Xo,{className:"w-3 h-3 mr-1"}),z]},z))})]}),e.jsxs("div",{className:"flex flex-col gap-2 min-w-[160px]",children:[e.jsxs(_,{size:"lg",onClick:ne,children:[e.jsx(sa,{className:"w-4 h-4 mr-2"}),"应用模板"]}),e.jsxs(_,{variant:"outline",onClick:he,disabled:p,className:h?"text-red-500 border-red-200":"",children:[e.jsx(Vr,{className:`w-4 h-4 mr-2 ${h?"fill-current":""}`}),h?"已点赞":"点赞"]})]})]}),e.jsx(Yt,{}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx(Ce,{children:e.jsxs(Ae,{className:"flex items-center gap-3 py-4",children:[e.jsx(Dl,{className:"w-8 h-8 text-blue-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:i.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(Gn,{className:"w-8 h-8 text-green-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:i.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(Vn,{className:"w-8 h-8 text-purple-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:Object.keys(i.task_config).length}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"任务配置"})]})]})})]}),e.jsxs(ta,{defaultValue:"providers",className:"space-y-4",children:[e.jsxs(Xt,{children:[e.jsxs(Je,{value:"providers",children:[e.jsx(Dl,{className:"w-4 h-4 mr-2"}),"提供商 (",i.providers.length,")"]}),e.jsxs(Je,{value:"models",children:[e.jsx(Gn,{className:"w-4 h-4 mr-2"}),"模型 (",i.models.length,")"]}),e.jsxs(Je,{value:"tasks",children:[e.jsx(Vn,{className:"w-4 h-4 mr-2"}),"任务配置 (",Object.keys(i.task_config).length,")"]})]}),e.jsx(ys,{value:"providers",children:e.jsxs(Ce,{children:[e.jsxs(De,{children:[e.jsx(Le,{children:"API 提供商"}),e.jsx(ws,{children:"模板中包含的 API 提供商配置(不含 API Key)"})]}),e.jsx(Ae,{children:e.jsxs(Rl,{children:[e.jsx(Ll,{children:e.jsxs(ut,{children:[e.jsx(Ze,{children:"名称"}),e.jsx(Ze,{children:"Base URL"}),e.jsx(Ze,{children:"类型"})]})}),e.jsx(Ul,{children:i.providers.map(z=>e.jsxs(ut,{children:[e.jsx(qe,{className:"font-medium",children:z.name}),e.jsx(qe,{className:"text-muted-foreground font-mono text-sm",children:z.base_url}),e.jsx(qe,{children:e.jsx(Se,{variant:"outline",children:z.client_type})})]},z.name))})]})})]})}),e.jsx(ys,{value:"models",children:e.jsxs(Ce,{children:[e.jsxs(De,{children:[e.jsx(Le,{children:"模型配置"}),e.jsx(ws,{children:"模板中包含的模型配置"})]}),e.jsx(Ae,{children:e.jsxs(Rl,{children:[e.jsx(Ll,{children:e.jsxs(ut,{children:[e.jsx(Ze,{children:"模型名称"}),e.jsx(Ze,{children:"标识符"}),e.jsx(Ze,{children:"提供商"}),e.jsx(Ze,{className:"text-right",children:"价格 (入/出)"})]})}),e.jsx(Ul,{children:i.models.map(z=>e.jsxs(ut,{children:[e.jsx(qe,{className:"font-medium",children:z.name}),e.jsx(qe,{className:"text-muted-foreground font-mono text-sm",children:z.model_identifier}),e.jsx(qe,{children:z.api_provider}),e.jsxs(qe,{className:"text-right text-muted-foreground",children:["¥",z.price_in," / ¥",z.price_out]})]},z.name))})]})})]})}),e.jsx(ys,{value:"tasks",children:e.jsxs(Ce,{children:[e.jsxs(De,{children:[e.jsx(Le,{children:"任务配置"}),e.jsx(ws,{children:"模板中各任务类型的模型分配"})]}),e.jsx(Ae,{children:e.jsx(d3,{type:"multiple",className:"w-full",children:Object.entries(i.task_config).map(([z,V])=>e.jsxs(XN,{value:z,children:[e.jsx(ZN,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(pn,{className:"w-4 h-4"}),u3[z]||z,e.jsxs(Se,{variant:"secondary",className:"ml-2",children:[V.model_list.length," 个模型"]})]})}),e.jsx(WN,{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:V.model_list.map(B=>e.jsx(Se,{variant:"outline",children:B},B))}),V.temperature!==void 0&&e.jsxs("div",{className:"text-sm",children:["Temperature: ",e.jsx("span",{className:"font-mono",children:V.temperature})]}),V.max_tokens!==void 0&&e.jsxs("div",{className:"text-sm",children:["Max Tokens: ",e.jsx("span",{className:"font-mono",children:V.max_tokens})]})]})})]},z))})})]})})]}),e.jsx(x3,{open:N,onOpenChange:v,pack:i,step:y,setStep:w,conflicts:b,detectingConflicts:D,applying:P,options:T,setOptions:A,_providerMapping:F,_setProviderMapping:L,newProviderApiKeys:J,setNewProviderApiKeys:U,onApply:ve})]})})}):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:()=>n({to:"/config/pack-market"}),children:[e.jsx(Ta,{className:"w-4 h-4 mr-2"}),"返回市场"]})]})}function x3({open:l,onOpenChange:n,pack:i,step:c,setStep:u,conflicts:x,detectingConflicts:h,applying:f,options:p,setOptions:g,_providerMapping:N,_setProviderMapping:v,newProviderApiKeys:y,setNewProviderApiKeys:w,onApply:b}){return e.jsx(Is,{open:l,onOpenChange:n,children:e.jsxs(Os,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Ds,{children:[e.jsxs(Rs,{className:"flex items-center gap-2",children:[e.jsx(ra,{className:"w-5 h-5"}),"应用配置模板"]}),e.jsxs(Ks,{children:["步骤 ",c," / ",3,":",c===1&&"选择要应用的内容",c===2&&"配置提供商映射",c===3&&"确认并应用"]})]}),h?e.jsxs("div",{className:"py-8 text-center",children:[e.jsx(Bs,{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(qs,{id:"apply_providers",checked:p.apply_providers,onCheckedChange:D=>g({...p,apply_providers:D})}),e.jsxs(E,{htmlFor:"apply_providers",className:"flex items-center gap-2",children:[e.jsx(Dl,{className:"w-4 h-4"}),"应用提供商配置 (",i.providers.length," 个)"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qs,{id:"apply_models",checked:p.apply_models,onCheckedChange:D=>g({...p,apply_models:D})}),e.jsxs(E,{htmlFor:"apply_models",className:"flex items-center gap-2",children:[e.jsx(Gn,{className:"w-4 h-4"}),"应用模型配置 (",i.models.length," 个)"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qs,{id:"apply_task_config",checked:p.apply_task_config,onCheckedChange:D=>g({...p,apply_task_config:D})}),e.jsxs(E,{htmlFor:"apply_task_config",className:"flex items-center gap-2",children:[e.jsx(Vn,{className:"w-4 h-4"}),"应用任务配置 (",Object.keys(i.task_config).length," 个)"]})]})]}),p.apply_task_config&&e.jsxs("div",{className:"pl-6 space-y-2 border-l-2 border-muted",children:[e.jsx(E,{className:"text-sm font-medium",children:"任务配置应用模式"}),e.jsxs(mx,{value:p.task_mode,onValueChange:D=>g({...p,task_mode:D}),children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Go,{value:"append",id:"mode_append"}),e.jsx(E,{htmlFor:"mode_append",className:"font-normal",children:"追加模式 - 将模板中的模型添加到现有配置"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Go,{value:"replace",id:"mode_replace"}),e.jsx(E,{htmlFor:"mode_replace",className:"font-normal",children:"替换模式 - 用模板配置完全替换现有配置"})]})]})]})]}),c===2&&x&&e.jsxs("div",{className:"space-y-4",children:[p.apply_providers&&x.existing_providers.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs(at,{children:[e.jsx(Ht,{className:"h-4 w-4"}),e.jsx(Hn,{children:"发现已有的提供商"}),e.jsx(lt,{children:"以下提供商的 URL 与您本地配置中的提供商匹配,将自动使用本地提供商:"})]}),e.jsx("div",{className:"space-y-2",children:x.existing_providers.map(({pack_provider:D,local_providers:S})=>e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-lg",children:[e.jsx(Ct,{className:"w-4 h-4 text-green-500 flex-shrink-0"}),e.jsx("span",{className:"font-medium flex-shrink-0",children:D.name}),e.jsx(Zt,{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(Se,{variant:"outline",className:"ml-auto",children:"URL 匹配"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(Ie,{value:N[D.name]||S[0].name,onValueChange:P=>v({...N,[D.name]:P}),children:[e.jsx($e,{className:"w-[200px]",children:e.jsx(Pe,{})}),e.jsx(Be,{children:S.map(P=>e.jsx(X,{value:P.name,children:P.name},P.name))})]}),e.jsxs(Se,{variant:"outline",className:"ml-auto",children:[S.length," 个匹配"]})]})]},D.name))})]}),p.apply_providers&&x.new_providers.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs(at,{variant:"destructive",children:[e.jsx(Jt,{className:"h-4 w-4"}),e.jsx(Hn,{children:"需要配置 API Key"}),e.jsx(lt,{children:"以下提供商在您的本地配置中不存在,需要填写 API Key:"})]}),e.jsx("div",{className:"space-y-4",children:x.new_providers.map(D=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Km,{className:"w-4 h-4 text-amber-500"}),e.jsx("span",{className:"font-medium",children:D.name}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",D.base_url,")"]})]}),e.jsx(le,{type:"password",placeholder:`输入 ${D.name} 的 API Key`,value:y[D.name]||"",onChange:S=>w({...y,[D.name]:S.target.value})})]},D.name))})]}),(!p.apply_providers||x.existing_providers.length===0&&x.new_providers.length===0)&&e.jsxs(at,{children:[e.jsx(Ct,{className:"h-4 w-4"}),e.jsx(Hn,{children:"无需配置"}),e.jsx(lt,{children:"模板中没有提供商配置,或您选择不应用提供商。"})]})]}),c===3&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(at,{children:[e.jsx(Ht,{className:"h-4 w-4"}),e.jsx(Hn,{children:"确认应用"}),e.jsx(lt,{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(Ct,{className:"w-4 h-4 text-green-500"}),e.jsx(Dl,{className:"w-4 h-4"}),e.jsxs("span",{children:["应用 ",i.providers.length," 个提供商配置"]})]}),p.apply_models&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Ct,{className:"w-4 h-4 text-green-500"}),e.jsx(Gn,{className:"w-4 h-4"}),e.jsxs("span",{children:["应用 ",i.models.length," 个模型配置"]})]}),p.apply_task_config&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Ct,{className:"w-4 h-4 text-green-500"}),e.jsx(Vn,{className:"w-4 h-4"}),e.jsxs("span",{children:[p.task_mode==="append"?"追加":"替换"," ",Object.keys(i.task_config).length," 个任务配置"]})]})]}),x&&x.new_providers.length>0&&e.jsxs(at,{variant:"destructive",children:[e.jsx(Jt,{className:"h-4 w-4"}),e.jsxs(lt,{children:["将添加 ",x.new_providers.length," 个新提供商,请确保已填写正确的 API Key。"]})]})]})]}),e.jsxs(st,{className:"flex justify-between",children:[e.jsx("div",{children:c>1&&!h&&e.jsx(_,{variant:"outline",onClick:()=>u(c-1),disabled:f,children:"上一步"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(_,{variant:"outline",onClick:()=>n(!1),disabled:f,children:"取消"}),c<3?e.jsx(_,{onClick:()=>u(c+1),disabled:h,children:"下一步"}):e.jsxs(_,{onClick:b,disabled:f,children:[f&&e.jsx(Bs,{className:"w-4 h-4 mr-2 animate-spin"}),"应用模板"]})]})]})]})})}function h3(){return e.jsx("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:e.jsx(Ye,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsx(js,{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(js,{className:"w-10 h-10"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(js,{className:"h-8 w-2/3"}),e.jsx(js,{className:"h-4 w-full"})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-4",children:[e.jsx(js,{className:"h-4 w-24"}),e.jsx(js,{className:"h-4 w-32"}),e.jsx(js,{className:"h-4 w-28"}),e.jsx(js,{className:"h-4 w-20"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(js,{className:"h-6 w-20"}),e.jsx(js,{className:"h-6 w-24"}),e.jsx(js,{className:"h-6 w-16"})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 min-w-[160px]",children:[e.jsx(js,{className:"h-10 w-full"}),e.jsx(js,{className:"h-10 w-full"})]})]}),e.jsx(js,{className:"h-px w-full"}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx(js,{className:"h-24"}),e.jsx(js,{className:"h-24"}),e.jsx(js,{className:"h-24"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(js,{className:"h-10 w-32"}),e.jsx(js,{className:"h-10 w-32"}),e.jsx(js,{className:"h-10 w-32"})]}),e.jsx(js,{className:"h-96 w-full"})]})]})})})}function f3(){const l=ca(),[n,i]=d.useState(!0);return d.useEffect(()=>{let c=!1;return(async()=>{try{const x=await tc();!c&&!x&&l({to:"/auth"})}catch{c||l({to:"/auth"})}finally{c||i(!1)}})(),()=>{c=!0}},[l]),{checking:n}}async function p3(){return await tc()}const g3=Kr("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=d.forwardRef(({className:l,size:n,abbrTitle:i,children:c,...u},x)=>e.jsx("kbd",{className:I(g3({size:n,className:l})),ref:x,...u,children:i?e.jsx("abbr",{title:i,children:c}):c}));eb.displayName="Kbd";const j3=[{icon:Jo,title:"首页",description:"查看仪表板概览",path:"/",category:"概览"},{icon:Ca,title:"麦麦主程序配置",description:"配置麦麦的核心设置",path:"/config/bot",category:"配置"},{icon:Dl,title:"麦麦模型提供商配置",description:"配置模型提供商",path:"/config/modelProvider",category:"配置"},{icon:Fj,title:"麦麦模型配置",description:"配置模型参数",path:"/config/model",category:"配置"},{icon:Yo,title:"表情包管理",description:"管理麦麦的表情包",path:"/resource/emoji",category:"资源"},{icon:Ma,title:"表达方式管理",description:"管理麦麦的表达方式",path:"/resource/expression",category:"资源"},{icon:Gj,title:"人物信息管理",description:"管理人物信息",path:"/resource/person",category:"资源"},{icon:Gr,title:"黑话管理",description:"管理麦麦学习到的黑话和俚语",path:"/resource/jargon",category:"资源"},{icon:v_,title:"统计信息",description:"查看使用统计",path:"/statistics",category:"监控"},{icon:ra,title:"插件市场",description:"浏览和安装插件",path:"/plugins",category:"扩展"},{icon:Qm,title:"日志查看器",description:"查看系统日志",path:"/logs",category:"监控"},{icon:pn,title:"系统设置",description:"配置系统参数",path:"/settings",category:"系统"}];function v3({open:l,onOpenChange:n}){const[i,c]=d.useState(""),[u,x]=d.useState(0),h=ca(),f=j3.filter(N=>N.title.toLowerCase().includes(i.toLowerCase())||N.description.toLowerCase().includes(i.toLowerCase())||N.category.toLowerCase().includes(i.toLowerCase())),p=d.useCallback(N=>{h({to:N}),n(!1),c(""),x(0)},[h,n]),g=d.useCallback(N=>{N.key==="ArrowDown"?(N.preventDefault(),x(v=>(v+1)%f.length)):N.key==="ArrowUp"?(N.preventDefault(),x(v=>(v-1+f.length)%f.length)):N.key==="Enter"&&f[u]&&(N.preventDefault(),p(f[u].path))},[f,u,p]);return e.jsx(Is,{open:l,onOpenChange:n,children:e.jsxs(Os,{className:"max-w-2xl p-0 gap-0",children:[e.jsxs(Ds,{className:"px-4 pt-4 pb-0",children:[e.jsx(Rs,{className:"sr-only",children:"搜索"}),e.jsxs("div",{className:"relative",children:[e.jsx(Tt,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground"}),e.jsx(le,{value:i,onChange:N=>{c(N.target.value),x(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(Ye,{className:"h-[400px]",children:f.length>0?e.jsx("div",{className:"p-2",children:f.map((N,v)=>{const y=N.icon;return e.jsxs("button",{onClick:()=>p(N.path),onMouseEnter:()=>x(v),className:I("w-full flex items-center gap-3 px-3 py-2.5 rounded-md text-left transition-colors",v===u?"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(Tt,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:i?"未找到匹配的页面":"输入关键词开始搜索"})]})})}),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 N3(){const l=window.location.protocol==="http:",n=window.location.hostname.toLowerCase(),i=n==="localhost"||n==="127.0.0.1"||n==="::1",c=sessionStorage.getItem("http-warning-dismissed")==="true",[u,x]=d.useState(l&&!i&&!c),[h,f]=d.useState(!1),p=()=>{f(!0),x(!1),sessionStorage.setItem("http-warning-dismissed","true")};return!u||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(Jt,{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(Ea,{className:"h-4 w-4"})})]})})})}function b3(){const[l,n]=d.useState(0),[i,c]=d.useState(!1),u=d.useRef(null);d.useEffect(()=>{const g=N=>{const v=N.target;if(v.scrollHeight>v.clientHeight+100){u.current=v;const y=v.scrollTop,w=v.scrollHeight-v.clientHeight,b=w>0?y/w*100:0;n(b),c(y>300)}};return window.addEventListener("scroll",g,{capture:!0,passive:!0}),()=>window.removeEventListener("scroll",g,{capture:!0})},[]);const x=()=>{u.current?.scrollTo({top:0,behavior:"smooth"})},h=18,f=2*Math.PI*h,p=f-l/100*f;return e.jsx("div",{className:I("fixed bottom-24 right-8 z-50 transition-all duration-500 ease-in-out transform",i?"translate-x-0 opacity-100":"translate-x-32 opacity-0 pointer-events-none"),children:e.jsxs(_,{variant:"outline",size:"icon",className:I("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:x,"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(N_,{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 y3=Iw,w3=Pw,_3=Hw,sb=d.forwardRef(({className:l,sideOffset:n=4,...i},c)=>e.jsx(Bw,{children:e.jsx(Sj,{ref:c,sideOffset:n,className:I("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]",l),...i})}));sb.displayName=Sj.displayName;function S3({children:l}){const{checking:n}=f3(),[i,c]=d.useState(!0),[u,x]=d.useState(!1),[h,f]=d.useState(!1),{theme:p,setTheme:g}=ex(),N=y0();if(d.useEffect(()=>{const R=D=>{(D.metaKey||D.ctrlKey)&&D.key==="k"&&(D.preventDefault(),f(!0))};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[]),n)return e.jsx("div",{className:"flex h-screen items-center justify-center bg-background",children:e.jsx("div",{className:"text-muted-foreground",children:"正在验证登录状态..."})});const v=[{title:"概览",items:[{icon:Jo,label:"首页",path:"/"}]},{title:"麦麦配置编辑",items:[{icon:Ca,label:"麦麦主程序配置",path:"/config/bot"},{icon:Dl,label:"AI模型厂商配置",path:"/config/modelProvider",tourId:"sidebar-model-provider"},{icon:Fj,label:"模型管理与分配",path:"/config/model",tourId:"sidebar-model-management"},{icon:og,label:"麦麦适配器配置",path:"/config/adapter"}]},{title:"麦麦资源管理",items:[{icon:Yo,label:"表情包管理",path:"/resource/emoji"},{icon:Ma,label:"表达方式管理",path:"/resource/expression"},{icon:Gr,label:"黑话管理",path:"/resource/jargon"},{icon:Gj,label:"人物信息管理",path:"/resource/person"},{icon:Bj,label:"知识库图谱可视化",path:"/resource/knowledge-graph"},{icon:Hr,label:"麦麦知识库管理",path:"/resource/knowledge-base"}]},{title:"扩展与监控",items:[{icon:ra,label:"插件市场",path:"/plugins"},{icon:Pj,label:"配置模板市场",path:"/config/pack-market"},{icon:og,label:"插件配置",path:"/plugin-config"},{icon:Qm,label:"日志查看器",path:"/logs"},{icon:Gm,label:"计划器&回复器监控",path:"/planner-monitor"},{icon:Ma,label:"本地聊天室",path:"/chat"}]},{title:"系统",items:[{icon:pn,label:"系统设置",path:"/settings"}]}],w=p==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":p,b=async()=>{await t1()};return e.jsx(y3,{delayDuration:300,children:e.jsxs("div",{className:"flex h-screen overflow-hidden",children:[e.jsxs("aside",{className:I("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",i?"lg:w-64":"lg:w-16",u?"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:I("relative flex items-center justify-center flex-1 transition-all overflow-hidden","lg:flex-1",!i&&"lg:flex-none lg:w-8"),children:[e.jsxs("div",{className:I("flex items-baseline gap-2",!i&&"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:R1()})]}),!i&&e.jsx("span",{className:"hidden lg:block font-bold text-primary-gradient text-2xl",children:"M"})]})}),e.jsx(Ye,{className:I("flex-1 overflow-x-hidden",!i&&"lg:w-16"),children:e.jsx("nav",{className:I("p-4",!i&&"lg:p-2 lg:w-16"),children:e.jsx("ul",{className:I("space-y-6",!i&&"lg:space-y-3 lg:w-full"),children:v.map((R,D)=>e.jsxs("li",{children:[e.jsx("div",{className:I("px-3 h-[1.25rem]","mb-2",!i&&"lg:mb-1 lg:invisible"),children:e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground/60 whitespace-nowrap",children:R.title})}),!i&&D>0&&e.jsx("div",{className:"hidden lg:block mb-2 border-t border-border"}),e.jsx("ul",{className:"space-y-1",children:R.items.map(S=>{const P=N({to:S.path}),M=S.icon,T=e.jsxs(e.Fragment,{children:[P&&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:I("flex items-center transition-all duration-300",i?"gap-3":"gap-3 lg:gap-0"),children:[e.jsx(M,{className:I("h-5 w-5 flex-shrink-0",P&&"text-primary"),strokeWidth:2,fill:"none"}),e.jsx("span",{className:I("text-sm font-medium whitespace-nowrap transition-all duration-300",P&&"font-semibold",i?"opacity-100 max-w-[200px]":"opacity-100 max-w-[200px] lg:opacity-0 lg:max-w-0 lg:overflow-hidden"),children:S.label})]})]});return e.jsx("li",{className:"relative",children:e.jsxs(w3,{children:[e.jsx(_3,{asChild:!0,children:e.jsx(Bn,{to:S.path,"data-tour":S.tourId,className:I("relative flex items-center rounded-lg py-2 transition-all duration-300","hover:bg-accent hover:text-accent-foreground",P?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground",i?"px-3":"px-3 lg:px-0 lg:justify-center lg:w-12 lg:mx-auto"),onClick:()=>x(!1),children:T})}),!i&&e.jsx(sb,{side:"right",className:"hidden lg:block",children:e.jsx("p",{children:S.label})})]})},S.path)})})]},R.title))})})})]}),u&&e.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 lg:hidden",onClick:()=>x(!1)}),e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[e.jsx(N3,{}),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:()=>x(!u),className:"rounded-lg p-2 hover:bg-accent lg:hidden",children:e.jsx(b_,{className:"h-5 w-5"})}),e.jsx("button",{onClick:()=>c(!i),className:"hidden rounded-lg p-2 hover:bg-accent lg:block",title:i?"收起侧边栏":"展开侧边栏",children:e.jsx(Aa,{className:I("h-5 w-5 transition-transform",!i&&"rotate-180")})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Bn,{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(y_,{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(Tt,{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(v3,{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:R=>{M1(w==="dark"?"light":"dark",g,R)},className:"rounded-lg p-2 hover:bg-accent",title:w==="dark"?"切换到浅色模式":"切换到深色模式",children:w==="dark"?e.jsx(qm,{className:"h-5 w-5"}):e.jsx(Qi,{className:"h-5 w-5"})}),e.jsx("div",{className:"h-6 w-px bg-border"}),e.jsxs(_,{variant:"ghost",size:"sm",onClick:b,className:"gap-2",title:"登出系统",children:[e.jsx(__,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"登出"})]})]})]}),e.jsx("main",{className:"flex-1 overflow-hidden bg-background",children:l}),e.jsx(b3,{})]})]})})}function k3(l){const n=l.split(` -`).slice(1),i=[];for(const c of n){const u=c.trim();if(!u.startsWith("at "))continue;const x=u.match(/at\s+(?:(.+?)\s+\()?(.+?):(\d+):(\d+)\)?$/);x?i.push({functionName:x[1]||"",fileName:x[2],lineNumber:x[3],columnNumber:x[4],raw:u}):i.push({functionName:"",fileName:"",lineNumber:"",columnNumber:"",raw:u})}return i}function C3({error:l,errorInfo:n}){const[i,c]=d.useState(!0),[u,x]=d.useState(!1),[h,f]=d.useState(!1),p=l.stack?k3(l.stack):[],g=async()=>{const N=` -Error: ${l.name} -Message: ${l.message} - -Stack Trace: -${l.stack||"No stack trace available"} - -Component Stack: -${n?.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(v){console.error("Failed to copy:",v)}};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs(at,{variant:"destructive",className:"border-red-500/50 bg-red-500/10",children:[e.jsx(Jt,{className:"h-4 w-4"}),e.jsxs(lt,{className:"font-mono text-sm",children:[e.jsxs("span",{className:"font-semibold",children:[l.name,":"]})," ",l.message]})]}),p.length>0&&e.jsxs(nc,{open:i,onOpenChange:c,children:[e.jsx(rc,{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(S_,{className:"h-4 w-4"}),"Stack Trace (",p.length," frames)"]}),i?e.jsx(Fr,{className:"h-4 w-4"}):e.jsx(za,{className:"h-4 w-4"})]})}),e.jsx(ic,{children:e.jsx(Ye,{className:"h-[280px] rounded-md border bg-muted/30",children:e.jsx("div",{className:"p-3 space-y-1",children:p.map((N,v)=>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:[v+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]})]})]})]})},v))})})})]}),n?.componentStack&&e.jsxs(nc,{open:u,onOpenChange:x,children:[e.jsx(rc,{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(Jt,{className:"h-4 w-4"}),"Component Stack"]}),u?e.jsx(Fr,{className:"h-4 w-4"}):e.jsx(za,{className:"h-4 w-4"})]})}),e.jsx(ic,{children:e.jsx(Ye,{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:n.componentStack})})})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:g,className:"w-full",children:h?e.jsxs(e.Fragment,{children:[e.jsx(Ct,{className:"mr-2 h-4 w-4 text-green-500"}),"已复制到剪贴板"]}):e.jsxs(e.Fragment,{children:[e.jsx(Ro,{className:"mr-2 h-4 w-4"}),"复制错误信息"]})})]})}function tb({error:l,errorInfo:n}){const i=()=>{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(Jt,{className:"h-8 w-8 text-red-600 dark:text-red-400"})}),e.jsx(Le,{className:"text-2xl font-bold",children:"页面出现了问题"}),e.jsx(ws,{className:"text-base mt-2",children:"应用程序遇到了意外错误。您可以尝试刷新页面或返回首页。"})]}),e.jsxs(Ae,{className:"space-y-4",children:[e.jsx(C3,{error:l,errorInfo:n}),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(dt,{className:"mr-2 h-4 w-4"}),"刷新页面"]}),e.jsxs(_,{onClick:i,variant:"outline",className:"flex-1",children:[e.jsx(Jo,{className:"mr-2 h-4 w-4"}),"返回首页"]})]}),e.jsx("p",{className:"text-xs text-center text-muted-foreground pt-2",children:"如果问题持续存在,请将错误信息复制并反馈给开发者"})]})]})})}class T3 extends d.Component{constructor(n){super(n),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(n){return{hasError:!0,error:n}}componentDidCatch(n,i){console.error("ErrorBoundary caught an error:",n,i),this.setState({errorInfo:i})}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(tb,{error:this.state.error,errorInfo:this.state.errorInfo}):this.props.children}}function ab({error:l}){return e.jsx(tb,{error:l,errorInfo:null})}const mc=w0({component:()=>e.jsxs(e.Fragment,{children:[e.jsx(Bg,{}),!1]}),beforeLoad:()=>{if(window.location.pathname==="/"&&!p3())throw S0({to:"/auth"})}}),E3=Qs({getParentRoute:()=>mc,path:"/auth",component:X1}),M3=Qs({getParentRoute:()=>mc,path:"/setup",component:x2}),nt=Qs({getParentRoute:()=>mc,id:"protected",component:()=>e.jsx(S3,{children:e.jsx(Bg,{})}),errorComponent:({error:l})=>e.jsx(ab,{error:l})}),z3=Qs({getParentRoute:()=>nt,path:"/",component:k1}),A3=Qs({getParentRoute:()=>nt,path:"/config/bot",component:K2}),O3=Qs({getParentRoute:()=>nt,path:"/config/modelProvider",component:nS}),D3=Qs({getParentRoute:()=>nt,path:"/config/model",component:MS}),R3=Qs({getParentRoute:()=>nt,path:"/config/adapter",component:ZS}),L3=Qs({getParentRoute:()=>nt,path:"/resource/emoji",component:b4}),U3=Qs({getParentRoute:()=>nt,path:"/resource/expression",component:S4}),$3=Qs({getParentRoute:()=>nt,path:"/resource/person",component:Y4}),B3=Qs({getParentRoute:()=>nt,path:"/resource/jargon",component:B4}),I3=Qs({getParentRoute:()=>nt,path:"/resource/knowledge-graph",component:lk}),P3=Qs({getParentRoute:()=>nt,path:"/resource/knowledge-base",component:nk}),H3=Qs({getParentRoute:()=>nt,path:"/logs",component:ik}),F3=Qs({getParentRoute:()=>nt,path:"/planner-monitor",component:pk}),G3=Qs({getParentRoute:()=>nt,path:"/chat",component:sC}),V3=Qs({getParentRoute:()=>nt,path:"/plugins",component:Lk}),q3=Qs({getParentRoute:()=>nt,path:"/plugin-detail",component:qk}),K3=Qs({getParentRoute:()=>nt,path:"/model-presets",component:$k}),Q3=Qs({getParentRoute:()=>nt,path:"/plugin-config",component:Pk}),Y3=Qs({getParentRoute:()=>nt,path:"/plugin-mirrors",component:Fk}),J3=Qs({getParentRoute:()=>nt,path:"/settings",component:G1}),X3=Qs({getParentRoute:()=>nt,path:"/config/pack-market",component:JC}),lb=Qs({getParentRoute:()=>nt,path:"/config/pack-market/$packId",component:m3}),Z3=Qs({getParentRoute:()=>nt,path:"/survey/webui-feedback",component:gC}),W3=Qs({getParentRoute:()=>nt,path:"/survey/maibot-feedback",component:jC}),e5=Qs({getParentRoute:()=>nt,path:"/annual-report",component:NC}),s5=Qs({getParentRoute:()=>mc,path:"*",component:hv}),t5=mc.addChildren([E3,M3,nt.addChildren([z3,A3,O3,D3,R3,L3,U3,B3,$3,I3,P3,V3,q3,K3,Q3,Y3,H3,F3,G3,J3,X3,lb,Z3,W3,e5]),s5]),a5=_0({routeTree:t5,defaultNotFoundComponent:hv,defaultErrorComponent:({error:l})=>e.jsx(ab,{error:l})});function l5({children:l,defaultTheme:n="system",storageKey:i="ui-theme",...c}){const[u,x]=d.useState(()=>localStorage.getItem(i)||n);d.useEffect(()=>{const f=window.document.documentElement;if(f.classList.remove("light","dark"),u==="system"){const p=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";f.classList.add(p);return}f.classList.add(u)},[u]),d.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:u,setTheme:f=>{localStorage.setItem(i,f),x(f)}};return e.jsx(ov.Provider,{...c,value:h,children:l})}function n5({children:l,defaultEnabled:n=!0,defaultWavesEnabled:i=!0,storageKey:c="enable-animations",wavesStorageKey:u="enable-waves-background"}){const[x,h]=d.useState(()=>{const N=localStorage.getItem(c);return N!==null?N==="true":n}),[f,p]=d.useState(()=>{const N=localStorage.getItem(u);return N!==null?N==="true":i});d.useEffect(()=>{const N=document.documentElement;x?N.classList.remove("no-animations"):N.classList.add("no-animations"),localStorage.setItem(c,String(x))},[x,c]),d.useEffect(()=>{localStorage.setItem(u,String(f))},[f,u]);const g={enableAnimations:x,setEnableAnimations:h,enableWavesBackground:f,setEnableWavesBackground:p};return e.jsx(dv.Provider,{value:g,children:l})}const r5=Fw,nb=d.forwardRef(({className:l,...n},i)=>e.jsx(kj,{ref:i,className:I("fixed bottom-0 right-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:max-w-[420px] gap-2",l),...n}));nb.displayName=kj.displayName;const i5=Kr("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"}}),rb=d.forwardRef(({className:l,variant:n,...i},c)=>e.jsx(Cj,{ref:c,className:I(i5({variant:n}),l),...i}));rb.displayName=Cj.displayName;const c5=d.forwardRef(({className:l,...n},i)=>e.jsx(Tj,{ref:i,className:I("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",l),...n}));c5.displayName=Tj.displayName;const ib=d.forwardRef(({className:l,...n},i)=>e.jsx(Ej,{ref:i,className:I("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",l),"toast-close":"",...n,children:e.jsx(Ea,{className:"h-4 w-4"})}));ib.displayName=Ej.displayName;const cb=d.forwardRef(({className:l,...n},i)=>e.jsx(Mj,{ref:i,className:I("text-sm font-semibold [&+div]:text-xs",l),...n}));cb.displayName=Mj.displayName;const ob=d.forwardRef(({className:l,...n},i)=>e.jsx(zj,{ref:i,className:I("text-sm opacity-90",l),...n}));ob.displayName=zj.displayName;function o5(){const{toasts:l}=Zs();return e.jsxs(r5,{children:[l.map(function({id:n,title:i,description:c,action:u,...x}){return e.jsxs(rb,{...x,children:[e.jsxs("div",{className:"grid gap-1",children:[i&&e.jsx(cb,{children:i}),c&&e.jsx(ob,{children:c})]}),u,e.jsx(ib,{})]},n)}),e.jsx(nb,{})]})}s1.createRoot(document.getElementById("root")).render(e.jsx(d.StrictMode,{children:e.jsx(T3,{children:e.jsx(l5,{defaultTheme:"system",children:e.jsx(n5,{children:e.jsxs(W2,{children:[e.jsx(k0,{router:a5}),e.jsx(tS,{}),e.jsx(o5,{})]})})})})})); diff --git a/webui/dist/assets/index-nIBlQvSe.css b/webui/dist/assets/index-nIBlQvSe.css deleted file mode 100644 index caadd1c9..00000000 --- a/webui/dist/assets/index-nIBlQvSe.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-20{right:-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-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-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-\[85vh\]{height:85vh}.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-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-48{width:12rem}.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-\[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-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-\[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-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-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-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-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-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)}.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}.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}.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\/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\: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-purple-950\/20:is(.dark *){--tw-gradient-to: rgb(59 7 100 / .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-\[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-4{width:1rem}.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-\[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\:py-2{padding-top:.5rem;padding-bottom:.5rem}.sm\:pb-3{padding-bottom:.75rem}.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\: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\: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/misc-Dw5FBFSX.js b/webui/dist/assets/misc-CJqnlRwD.js similarity index 99% rename from webui/dist/assets/misc-Dw5FBFSX.js rename to webui/dist/assets/misc-CJqnlRwD.js index 559af6c3..1ed34b3f 100644 --- a/webui/dist/assets/misc-Dw5FBFSX.js +++ b/webui/dist/assets/misc-CJqnlRwD.js @@ -1,4 +1,4 @@ -import{k as fi,u as Ze,R as di,o as pi,O as hi,C as mi,r as mt}from"./radix-core-CEUnGg09.js";import{r as b,j as yi,R as w,c as Nt,b as Dt}from"./router-9vIXuQkh.js";import{g as gt}from"./react-vendor-BmxF9s7Q.js";import{b as Vt,i as vi,a as ot,d as it,e as gi,f as st,g as pt,h as bi,j as wi,k as Oi,l as Si,m as Ei,n as ki,o as Ci,p as Ti,q as Mi,r as Pi,s as xi,t as Ni,u as Di,v as Ii,w as Wi,x as Ri,y as Ai,z as _i,A as Fi,B as ji,C as Bi,D as Li,E as $i,F as Hi,G as zi,H as Ui,I as Yi,J as qi,K as Gi,L as Vi,M as Ki}from"./utils-BqoaXoQ1.js";var jn=1,Zi=.9,Ji=.8,Xi=.17,Kt=.1,Zt=.999,Qi=.9999,es=.99,ts=/[\\\/_+.#"@\[\(\{&]/,ns=/[\\\/_+.#"@\[\(\{&]/g,rs=/[\s-]/,Nr=/[\s-]/g;function dn(e,t,n,r,o,i,s){if(i===t.length)return o===e.length?jn:es;var a=`${o},${i}`;if(s[a]!==void 0)return s[a];for(var l=r.charAt(i),u=n.indexOf(l,o),f=0,c,d,p,h;u>=0;)c=dn(e,t,n,r,u+1,i+1,s),c>f&&(u===o?c*=jn:ts.test(e.charAt(u-1))?(c*=Ji,p=e.slice(o,u-1).match(ns),p&&o>0&&(c*=Math.pow(Zt,p.length))):rs.test(e.charAt(u-1))?(c*=Zi,h=e.slice(o,u-1).match(Nr),h&&o>0&&(c*=Math.pow(Zt,h.length))):(c*=Xi,o>0&&(c*=Math.pow(Zt,u-o))),e.charAt(u)!==t.charAt(i)&&(c*=Qi)),(cc&&(c=d*Kt)),c>f&&(f=c),u=n.indexOf(l,u+1);return s[a]=f,f}function Bn(e){return e.toLowerCase().replace(Nr," ")}function os(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,dn(e,t,Bn(e),Bn(t),0,0,{})}var is=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Be=is.reduce((e,t)=>{const n=fi(`Primitive.${t}`),r=b.forwardRef((o,i)=>{const{asChild:s,...a}=o,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),yi.jsx(l,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),at='[cmdk-group=""]',Jt='[cmdk-group-items=""]',ss='[cmdk-group-heading=""]',Dr='[cmdk-item=""]',Ln=`${Dr}:not([aria-disabled="true"])`,pn="cmdk-item-select",Ve="data-value",as=(e,t,n)=>os(e,t,n),Ir=b.createContext(void 0),bt=()=>b.useContext(Ir),Wr=b.createContext(void 0),On=()=>b.useContext(Wr),Rr=b.createContext(void 0),Ar=b.forwardRef((e,t)=>{let n=Ke(()=>{var k,R;return{search:"",value:(R=(k=e.value)!=null?k:e.defaultValue)!=null?R:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Ke(()=>new Set),o=Ke(()=>new Map),i=Ke(()=>new Map),s=Ke(()=>new Set),a=_r(e),{label:l,children:u,value:f,onValueChange:c,filter:d,shouldFilter:p,loop:h,disablePointerSelection:v=!1,vimBindings:S=!0,...y}=e,m=Ze(),E=Ze(),M=Ze(),C=b.useRef(null),O=gs();ze(()=>{if(f!==void 0){let k=f.trim();n.current.value=k,D.emit()}},[f]),ze(()=>{O(6,fe)},[]);let D=b.useMemo(()=>({subscribe:k=>(s.current.add(k),()=>s.current.delete(k)),snapshot:()=>n.current,setState:(k,R,B)=>{var W,U,V,ne;if(!Object.is(n.current[k],R)){if(n.current[k]=R,k==="search")ue(),$(),O(1,oe);else if(k==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Q=document.getElementById(M);Q?Q.focus():(W=document.getElementById(m))==null||W.focus()}if(O(7,()=>{var Q;n.current.selectedItemId=(Q=X())==null?void 0:Q.id,D.emit()}),B||O(5,fe),((U=a.current)==null?void 0:U.value)!==void 0){let Q=R??"";(ne=(V=a.current).onValueChange)==null||ne.call(V,Q);return}}D.emit()}},emit:()=>{s.current.forEach(k=>k())}}),[]),j=b.useMemo(()=>({value:(k,R,B)=>{var W;R!==((W=i.current.get(k))==null?void 0:W.value)&&(i.current.set(k,{value:R,keywords:B}),n.current.filtered.items.set(k,Z(R,B)),O(2,()=>{$(),D.emit()}))},item:(k,R)=>(r.current.add(k),R&&(o.current.has(R)?o.current.get(R).add(k):o.current.set(R,new Set([k]))),O(3,()=>{ue(),$(),n.current.value||oe(),D.emit()}),()=>{i.current.delete(k),r.current.delete(k),n.current.filtered.items.delete(k);let B=X();O(4,()=>{ue(),B?.getAttribute("id")===k&&oe(),D.emit()})}),group:k=>(o.current.has(k)||o.current.set(k,new Set),()=>{i.current.delete(k),o.current.delete(k)}),filter:()=>a.current.shouldFilter,label:l||e["aria-label"],getDisablePointerSelection:()=>a.current.disablePointerSelection,listId:m,inputId:M,labelId:E,listInnerRef:C}),[]);function Z(k,R){var B,W;let U=(W=(B=a.current)==null?void 0:B.filter)!=null?W:as;return k?U(k,n.current.search,R):0}function $(){if(!n.current.search||a.current.shouldFilter===!1)return;let k=n.current.filtered.items,R=[];n.current.filtered.groups.forEach(W=>{let U=o.current.get(W),V=0;U.forEach(ne=>{let Q=k.get(ne);V=Math.max(Q,V)}),R.push([W,V])});let B=C.current;de().sort((W,U)=>{var V,ne;let Q=W.getAttribute("id"),xe=U.getAttribute("id");return((V=k.get(xe))!=null?V:0)-((ne=k.get(Q))!=null?ne:0)}).forEach(W=>{let U=W.closest(Jt);U?U.appendChild(W.parentElement===U?W:W.closest(`${Jt} > *`)):B.appendChild(W.parentElement===B?W:W.closest(`${Jt} > *`))}),R.sort((W,U)=>U[1]-W[1]).forEach(W=>{var U;let V=(U=C.current)==null?void 0:U.querySelector(`${at}[${Ve}="${encodeURIComponent(W[0])}"]`);V?.parentElement.appendChild(V)})}function oe(){let k=de().find(B=>B.getAttribute("aria-disabled")!=="true"),R=k?.getAttribute(Ve);D.setState("value",R||void 0)}function ue(){var k,R,B,W;if(!n.current.search||a.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let U=0;for(let V of r.current){let ne=(R=(k=i.current.get(V))==null?void 0:k.value)!=null?R:"",Q=(W=(B=i.current.get(V))==null?void 0:B.keywords)!=null?W:[],xe=Z(ne,Q);n.current.filtered.items.set(V,xe),xe>0&&U++}for(let[V,ne]of o.current)for(let Q of ne)if(n.current.filtered.items.get(Q)>0){n.current.filtered.groups.add(V);break}n.current.filtered.count=U}function fe(){var k,R,B;let W=X();W&&(((k=W.parentElement)==null?void 0:k.firstChild)===W&&((B=(R=W.closest(at))==null?void 0:R.querySelector(ss))==null||B.scrollIntoView({block:"nearest"})),W.scrollIntoView({block:"nearest"}))}function X(){var k;return(k=C.current)==null?void 0:k.querySelector(`${Dr}[aria-selected="true"]`)}function de(){var k;return Array.from(((k=C.current)==null?void 0:k.querySelectorAll(Ln))||[])}function Ae(k){let R=de()[k];R&&D.setState("value",R.getAttribute(Ve))}function Le(k){var R;let B=X(),W=de(),U=W.findIndex(ne=>ne===B),V=W[U+k];(R=a.current)!=null&&R.loop&&(V=U+k<0?W[W.length-1]:U+k===W.length?W[0]:W[U+k]),V&&D.setState("value",V.getAttribute(Ve))}function qe(k){let R=X(),B=R?.closest(at),W;for(;B&&!W;)B=k>0?ys(B,at):vs(B,at),W=B?.querySelector(Ln);W?D.setState("value",W.getAttribute(Ve)):Le(k)}let ie=()=>Ae(de().length-1),se=k=>{k.preventDefault(),k.metaKey?ie():k.altKey?qe(1):Le(1)},pe=k=>{k.preventDefault(),k.metaKey?Ae(0):k.altKey?qe(-1):Le(-1)};return b.createElement(Be.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:k=>{var R;(R=y.onKeyDown)==null||R.call(y,k);let B=k.nativeEvent.isComposing||k.keyCode===229;if(!(k.defaultPrevented||B))switch(k.key){case"n":case"j":{S&&k.ctrlKey&&se(k);break}case"ArrowDown":{se(k);break}case"p":case"k":{S&&k.ctrlKey&&pe(k);break}case"ArrowUp":{pe(k);break}case"Home":{k.preventDefault(),Ae(0);break}case"End":{k.preventDefault(),ie();break}case"Enter":{k.preventDefault();let W=X();if(W){let U=new Event(pn);W.dispatchEvent(U)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:j.inputId,id:j.labelId,style:ws},l),jt(e,k=>b.createElement(Wr.Provider,{value:D},b.createElement(Ir.Provider,{value:j},k))))}),ls=b.forwardRef((e,t)=>{var n,r;let o=Ze(),i=b.useRef(null),s=b.useContext(Rr),a=bt(),l=_r(e),u=(r=(n=l.current)==null?void 0:n.forceMount)!=null?r:s?.forceMount;ze(()=>{if(!u)return a.item(o,s?.id)},[u]);let f=Fr(o,i,[e.value,e.children,i],e.keywords),c=On(),d=Fe(O=>O.value&&O.value===f.current),p=Fe(O=>u||a.filter()===!1?!0:O.search?O.filtered.items.get(o)>0:!0);b.useEffect(()=>{let O=i.current;if(!(!O||e.disabled))return O.addEventListener(pn,h),()=>O.removeEventListener(pn,h)},[p,e.onSelect,e.disabled]);function h(){var O,D;v(),(D=(O=l.current).onSelect)==null||D.call(O,f.current)}function v(){c.setState("value",f.current,!0)}if(!p)return null;let{disabled:S,value:y,onSelect:m,forceMount:E,keywords:M,...C}=e;return b.createElement(Be.div,{ref:mt(i,t),...C,id:o,"cmdk-item":"",role:"option","aria-disabled":!!S,"aria-selected":!!d,"data-disabled":!!S,"data-selected":!!d,onPointerMove:S||a.getDisablePointerSelection()?void 0:v,onClick:S?void 0:h},e.children)}),cs=b.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:o,...i}=e,s=Ze(),a=b.useRef(null),l=b.useRef(null),u=Ze(),f=bt(),c=Fe(p=>o||f.filter()===!1?!0:p.search?p.filtered.groups.has(s):!0);ze(()=>f.group(s),[]),Fr(s,a,[e.value,e.heading,l]);let d=b.useMemo(()=>({id:s,forceMount:o}),[o]);return b.createElement(Be.div,{ref:mt(a,t),...i,"cmdk-group":"",role:"presentation",hidden:c?void 0:!0},n&&b.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:u},n),jt(e,p=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},b.createElement(Rr.Provider,{value:d},p))))}),us=b.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,o=b.useRef(null),i=Fe(s=>!s.search);return!n&&!i?null:b.createElement(Be.div,{ref:mt(o,t),...r,"cmdk-separator":"",role:"separator"})}),fs=b.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,o=e.value!=null,i=On(),s=Fe(u=>u.search),a=Fe(u=>u.selectedItemId),l=bt();return b.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),b.createElement(Be.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":a,id:l.inputId,type:"text",value:o?e.value:s,onChange:u=>{o||i.setState("search",u.target.value),n?.(u.target.value)}})}),ds=b.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...o}=e,i=b.useRef(null),s=b.useRef(null),a=Fe(u=>u.selectedItemId),l=bt();return b.useEffect(()=>{if(s.current&&i.current){let u=s.current,f=i.current,c,d=new ResizeObserver(()=>{c=requestAnimationFrame(()=>{let p=u.offsetHeight;f.style.setProperty("--cmdk-list-height",p.toFixed(1)+"px")})});return d.observe(u),()=>{cancelAnimationFrame(c),d.unobserve(u)}}},[]),b.createElement(Be.div,{ref:mt(i,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":a,"aria-label":r,id:l.listId},jt(e,u=>b.createElement("div",{ref:mt(s,l.listInnerRef),"cmdk-list-sizer":""},u)))}),ps=b.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:o,contentClassName:i,container:s,...a}=e;return b.createElement(di,{open:n,onOpenChange:r},b.createElement(pi,{container:s},b.createElement(hi,{"cmdk-overlay":"",className:o}),b.createElement(mi,{"aria-label":e.label,"cmdk-dialog":"",className:i},b.createElement(Ar,{ref:t,...a}))))}),hs=b.forwardRef((e,t)=>Fe(n=>n.filtered.count===0)?b.createElement(Be.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),ms=b.forwardRef((e,t)=>{let{progress:n,children:r,label:o="Loading...",...i}=e;return b.createElement(Be.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},jt(e,s=>b.createElement("div",{"aria-hidden":!0},s)))}),nf=Object.assign(Ar,{List:ds,Item:ls,Input:fs,Group:cs,Separator:us,Dialog:ps,Empty:hs,Loading:ms});function ys(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function vs(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function _r(e){let t=b.useRef(e);return ze(()=>{t.current=e}),t}var ze=typeof window>"u"?b.useEffect:b.useLayoutEffect;function Ke(e){let t=b.useRef();return t.current===void 0&&(t.current=e()),t}function Fe(e){let t=On(),n=()=>e(t.snapshot());return b.useSyncExternalStore(t.subscribe,n,n)}function Fr(e,t,n,r=[]){let o=b.useRef(),i=bt();return ze(()=>{var s;let a=(()=>{var u;for(let f of n){if(typeof f=="string")return f.trim();if(typeof f=="object"&&"current"in f)return f.current?(u=f.current.textContent)==null?void 0:u.trim():o.current}})(),l=r.map(u=>u.trim());i.value(e,a,l),(s=t.current)==null||s.setAttribute(Ve,a),o.current=a}),o}var gs=()=>{let[e,t]=b.useState(),n=Ke(()=>new Map);return ze(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,o)=>{n.current.set(r,o),t({})}};function bs(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function jt({asChild:e,children:t},n){return e&&b.isValidElement(t)?b.cloneElement(bs(t),{ref:t.ref},n(t.props.children)):n(t)}var ws={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function jr(e){return t=>typeof t===e}var Os=jr("function"),Ss=e=>e===null,$n=e=>Object.prototype.toString.call(e).slice(8,-1)==="RegExp",Hn=e=>!Es(e)&&!Ss(e)&&(Os(e)||typeof e=="object"),Es=jr("undefined");function ks(e,t){const{length:n}=e;if(n!==t.length)return!1;for(let r=n;r--!==0;)if(!re(e[r],t[r]))return!1;return!0}function Cs(e,t){if(e.byteLength!==t.byteLength)return!1;const n=new DataView(e.buffer),r=new DataView(t.buffer);let o=e.byteLength;for(;o--;)if(n.getUint8(o)!==r.getUint8(o))return!1;return!0}function Ts(e,t){if(e.size!==t.size)return!1;for(const n of e.entries())if(!t.has(n[0]))return!1;for(const n of e.entries())if(!re(n[1],t.get(n[0])))return!1;return!0}function Ms(e,t){if(e.size!==t.size)return!1;for(const n of e.entries())if(!t.has(n[0]))return!1;return!0}function re(e,t){if(e===t)return!0;if(e&&Hn(e)&&t&&Hn(t)){if(e.constructor!==t.constructor)return!1;if(Array.isArray(e)&&Array.isArray(t))return ks(e,t);if(e instanceof Map&&t instanceof Map)return Ts(e,t);if(e instanceof Set&&t instanceof Set)return Ms(e,t);if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t))return Cs(e,t);if($n(e)&&$n(t))return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let o=n.length;o--!==0;)if(!Object.prototype.hasOwnProperty.call(t,n[o]))return!1;for(let o=n.length;o--!==0;){const i=n[o];if(!(i==="_owner"&&e.$$typeof)&&!re(e[i],t[i]))return!1}return!0}return Number.isNaN(e)&&Number.isNaN(t)?!0:e===t}var Ps=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","WeakMap","WeakSet"],xs=["bigint","boolean","null","number","string","symbol","undefined"];function Bt(e){const t=Object.prototype.toString.call(e).slice(8,-1);if(/HTML\w+Element/.test(t))return"HTMLElement";if(Ns(t))return t}function be(e){return t=>Bt(t)===e}function Ns(e){return Ps.includes(e)}function tt(e){return t=>typeof t===e}function Ds(e){return xs.includes(e)}var Is=["innerHTML","ownerDocument","style","attributes","nodeValue"];function P(e){if(e===null)return"null";switch(typeof e){case"bigint":return"bigint";case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"symbol":return"symbol";case"undefined":return"undefined"}if(P.array(e))return"Array";if(P.plainFunction(e))return"Function";const t=Bt(e);return t||"Object"}P.array=Array.isArray;P.arrayOf=(e,t)=>!P.array(e)&&!P.function(t)?!1:e.every(n=>t(n));P.asyncGeneratorFunction=e=>Bt(e)==="AsyncGeneratorFunction";P.asyncFunction=be("AsyncFunction");P.bigint=tt("bigint");P.boolean=e=>e===!0||e===!1;P.date=be("Date");P.defined=e=>!P.undefined(e);P.domElement=e=>P.object(e)&&!P.plainObject(e)&&e.nodeType===1&&P.string(e.nodeName)&&Is.every(t=>t in e);P.empty=e=>P.string(e)&&e.length===0||P.array(e)&&e.length===0||P.object(e)&&!P.map(e)&&!P.set(e)&&Object.keys(e).length===0||P.set(e)&&e.size===0||P.map(e)&&e.size===0;P.error=be("Error");P.function=tt("function");P.generator=e=>P.iterable(e)&&P.function(e.next)&&P.function(e.throw);P.generatorFunction=be("GeneratorFunction");P.instanceOf=(e,t)=>!e||!t?!1:Object.getPrototypeOf(e)===t.prototype;P.iterable=e=>!P.nullOrUndefined(e)&&P.function(e[Symbol.iterator]);P.map=be("Map");P.nan=e=>Number.isNaN(e);P.null=e=>e===null;P.nullOrUndefined=e=>P.null(e)||P.undefined(e);P.number=e=>tt("number")(e)&&!P.nan(e);P.numericString=e=>P.string(e)&&e.length>0&&!Number.isNaN(Number(e));P.object=e=>!P.nullOrUndefined(e)&&(P.function(e)||typeof e=="object");P.oneOf=(e,t)=>P.array(e)?e.indexOf(t)>-1:!1;P.plainFunction=be("Function");P.plainObject=e=>{if(Bt(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})};P.primitive=e=>P.null(e)||Ds(typeof e);P.promise=be("Promise");P.propertyOf=(e,t,n)=>{if(!P.object(e)||!t)return!1;const r=e[t];return P.function(n)?n(r):P.defined(r)};P.regexp=be("RegExp");P.set=be("Set");P.string=tt("string");P.symbol=tt("symbol");P.undefined=tt("undefined");P.weakMap=be("WeakMap");P.weakSet=be("WeakSet");var x=P;function Ws(...e){return e.every(t=>x.string(t)||x.array(t)||x.plainObject(t))}function Rs(e,t,n){return Br(e,t)?[e,t].every(x.array)?!e.some(Gn(n))&&t.some(Gn(n)):[e,t].every(x.plainObject)?!Object.entries(e).some(qn(n))&&Object.entries(t).some(qn(n)):t===n:!1}function zn(e,t,n){const{actual:r,key:o,previous:i,type:s}=n,a=Ce(e,o),l=Ce(t,o);let u=[a,l].every(x.number)&&(s==="increased"?al);return x.undefined(r)||(u=u&&l===r),x.undefined(i)||(u=u&&a===i),u}function Un(e,t,n){const{key:r,type:o,value:i}=n,s=Ce(e,r),a=Ce(t,r),l=o==="added"?s:a,u=o==="added"?a:s;if(!x.nullOrUndefined(i)){if(x.defined(l)){if(x.array(l)||x.plainObject(l))return Rs(l,u,i)}else return re(u,i);return!1}return[s,a].every(x.array)?!u.every(Sn(l)):[s,a].every(x.plainObject)?As(Object.keys(l),Object.keys(u)):![s,a].every(f=>x.primitive(f)&&x.defined(f))&&(o==="added"?!x.defined(s)&&x.defined(a):x.defined(s)&&!x.defined(a))}function Yn(e,t,{key:n}={}){let r=Ce(e,n),o=Ce(t,n);if(!Br(r,o))throw new TypeError("Inputs have different types");if(!Ws(r,o))throw new TypeError("Inputs don't have length");return[r,o].every(x.plainObject)&&(r=Object.keys(r),o=Object.keys(o)),[r,o]}function qn(e){return([t,n])=>x.array(e)?re(e,n)||e.some(r=>re(r,n)||x.array(n)&&Sn(n)(r)):x.plainObject(e)&&e[t]?!!e[t]&&re(e[t],n):re(e,n)}function As(e,t){return t.some(n=>!e.includes(n))}function Gn(e){return t=>x.array(e)?e.some(n=>re(n,t)||x.array(t)&&Sn(t)(n)):re(e,t)}function lt(e,t){return x.array(e)?e.some(n=>re(n,t)):re(e,t)}function Sn(e){return t=>e.some(n=>re(n,t))}function Br(...e){return e.every(x.array)||e.every(x.number)||e.every(x.plainObject)||e.every(x.string)}function Ce(e,t){return x.plainObject(e)||x.array(e)?x.string(t)?t.split(".").reduce((r,o)=>r&&r[o],e):x.number(t)?e[t]:e:e}function Rt(e,t){if([e,t].some(x.nullOrUndefined))throw new Error("Missing required parameters");if(![e,t].every(f=>x.plainObject(f)||x.array(f)))throw new Error("Expected plain objects or array");return{added:(f,c)=>{try{return Un(e,t,{key:f,type:"added",value:c})}catch{return!1}},changed:(f,c,d)=>{try{const p=Ce(e,f),h=Ce(t,f),v=x.defined(c),S=x.defined(d);if(v||S){const y=S?lt(d,p):!lt(c,p),m=lt(c,h);return y&&m}return[p,h].every(x.array)||[p,h].every(x.plainObject)?!re(p,h):p!==h}catch{return!1}},changedFrom:(f,c,d)=>{if(!x.defined(f))return!1;try{const p=Ce(e,f),h=Ce(t,f),v=x.defined(d);return lt(c,p)&&(v?lt(d,h):!v)}catch{return!1}},decreased:(f,c,d)=>{if(!x.defined(f))return!1;try{return zn(e,t,{key:f,actual:c,previous:d,type:"decreased"})}catch{return!1}},emptied:f=>{try{const[c,d]=Yn(e,t,{key:f});return!!c.length&&!d.length}catch{return!1}},filled:f=>{try{const[c,d]=Yn(e,t,{key:f});return!c.length&&!!d.length}catch{return!1}},increased:(f,c,d)=>{if(!x.defined(f))return!1;try{return zn(e,t,{key:f,actual:c,previous:d,type:"increased"})}catch{return!1}},removed:(f,c)=>{try{return Un(e,t,{key:f,type:"removed",value:c})}catch{return!1}}}}var Xt,Vn;function _s(){if(Vn)return Xt;Vn=1;var e=new Error("Element already at target scroll position"),t=new Error("Scroll cancelled"),n=Math.min,r=Date.now;Xt={left:o("scrollLeft"),top:o("scrollTop")};function o(a){return function(u,f,c,d){c=c||{},typeof c=="function"&&(d=c,c={}),typeof d!="function"&&(d=s);var p=r(),h=u[a],v=c.ease||i,S=isNaN(c.duration)?350:+c.duration,y=!1;return h===f?d(e,u[a]):requestAnimationFrame(E),m;function m(){y=!0}function E(M){if(y)return d(t,u[a]);var C=r(),O=n(1,(C-p)/S),D=v(O);u[a]=D*(f-h)+h,O<1?requestAnimationFrame(E):requestAnimationFrame(function(){d(null,u[a])})}}}function i(a){return .5*(1-Math.cos(Math.PI*a))}function s(){}return Xt}var Fs=_s();const js=gt(Fs);var It={exports:{}},Bs=It.exports,Kn;function Ls(){return Kn||(Kn=1,(function(e){(function(t,n){e.exports?e.exports=n():t.Scrollparent=n()})(Bs,function(){function t(r){var o=getComputedStyle(r,null).getPropertyValue("overflow");return o.indexOf("scroll")>-1||o.indexOf("auto")>-1}function n(r){if(r instanceof HTMLElement||r instanceof SVGElement){for(var o=r.parentNode;o.parentNode;){if(t(o))return o;o=o.parentNode}return document.scrollingElement||document.documentElement}}return n})})(It)),It.exports}var $s=Ls();const Lr=gt($s);var Qt,Zn;function Hs(){if(Zn)return Qt;Zn=1;var e=function(r){return Object.prototype.hasOwnProperty.call(r,"props")},t=function(r,o){return r+n(o)},n=function(r){return r===null||typeof r=="boolean"||typeof r>"u"?"":typeof r=="number"?r.toString():typeof r=="string"?r:Array.isArray(r)?r.reduce(t,""):e(r)&&Object.prototype.hasOwnProperty.call(r.props,"children")?n(r.props.children):""};return n.default=n,Qt=n,Qt}var zs=Hs();const Jn=gt(zs);var en,Xn;function Us(){if(Xn)return en;Xn=1;var e=function(m){return t(m)&&!n(m)};function t(y){return!!y&&typeof y=="object"}function n(y){var m=Object.prototype.toString.call(y);return m==="[object RegExp]"||m==="[object Date]"||i(y)}var r=typeof Symbol=="function"&&Symbol.for,o=r?Symbol.for("react.element"):60103;function i(y){return y.$$typeof===o}function s(y){return Array.isArray(y)?[]:{}}function a(y,m){return m.clone!==!1&&m.isMergeableObject(y)?v(s(y),y,m):y}function l(y,m,E){return y.concat(m).map(function(M){return a(M,E)})}function u(y,m){if(!m.customMerge)return v;var E=m.customMerge(y);return typeof E=="function"?E:v}function f(y){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(y).filter(function(m){return Object.propertyIsEnumerable.call(y,m)}):[]}function c(y){return Object.keys(y).concat(f(y))}function d(y,m){try{return m in y}catch{return!1}}function p(y,m){return d(y,m)&&!(Object.hasOwnProperty.call(y,m)&&Object.propertyIsEnumerable.call(y,m))}function h(y,m,E){var M={};return E.isMergeableObject(y)&&c(y).forEach(function(C){M[C]=a(y[C],E)}),c(m).forEach(function(C){p(y,C)||(d(y,C)&&E.isMergeableObject(m[C])?M[C]=u(C,E)(y[C],m[C],E):M[C]=a(m[C],E))}),M}function v(y,m,E){E=E||{},E.arrayMerge=E.arrayMerge||l,E.isMergeableObject=E.isMergeableObject||e,E.cloneUnlessOtherwiseSpecified=a;var M=Array.isArray(m),C=Array.isArray(y),O=M===C;return O?M?E.arrayMerge(y,m,E):h(y,m,E):a(m,E)}v.all=function(m,E){if(!Array.isArray(m))throw new Error("first argument should be an array");return m.reduce(function(M,C){return v(M,C,E)},{})};var S=v;return en=S,en}var Ys=Us();const ve=gt(Ys);var tn={exports:{}},nn,Qn;function qs(){if(Qn)return nn;Qn=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return nn=e,nn}var rn,er;function Gs(){if(er)return rn;er=1;var e=qs();function t(){}function n(){}return n.resetWarningCache=t,rn=function(){function r(s,a,l,u,f,c){if(c!==e){var d=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw d.name="Invariant Violation",d}}r.isRequired=r;function o(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},rn}var tr;function Vs(){return tr||(tr=1,tn.exports=Gs()()),tn.exports}var Ks=Vs();const T=gt(Ks);var wt=typeof window<"u"&&typeof document<"u"&&typeof navigator<"u",Zs=(function(){for(var e=["Edge","Trident","Firefox"],t=0;t=0)return 1;return 0})();function Js(e){var t=!1;return function(){t||(t=!0,window.Promise.resolve().then(function(){t=!1,e()}))}}function Xs(e){var t=!1;return function(){t||(t=!0,setTimeout(function(){t=!1,e()},Zs))}}var Qs=wt&&window.Promise,ea=Qs?Js:Xs;function $r(e){var t={};return e&&t.toString.call(e)==="[object Function]"}function Ye(e,t){if(e.nodeType!==1)return[];var n=e.ownerDocument.defaultView,r=n.getComputedStyle(e,null);return t?r[t]:r}function En(e){return e.nodeName==="HTML"?e:e.parentNode||e.host}function Ot(e){if(!e)return document.body;switch(e.nodeName){case"HTML":case"BODY":return e.ownerDocument.body;case"#document":return e.body}var t=Ye(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/(auto|scroll|overlay)/.test(n+o+r)?e:Ot(En(e))}function Hr(e){return e&&e.referenceNode?e.referenceNode:e}var nr=wt&&!!(window.MSInputMethodContext&&document.documentMode),rr=wt&&/MSIE 10/.test(navigator.userAgent);function nt(e){return e===11?nr:e===10?rr:nr||rr}function Je(e){if(!e)return document.documentElement;for(var t=nt(10)?document.body:null,n=e.offsetParent||null;n===t&&e.nextElementSibling;)n=(e=e.nextElementSibling).offsetParent;var r=n&&n.nodeName;return!r||r==="BODY"||r==="HTML"?e?e.ownerDocument.documentElement:document.documentElement:["TH","TD","TABLE"].indexOf(n.nodeName)!==-1&&Ye(n,"position")==="static"?Je(n):n}function ta(e){var t=e.nodeName;return t==="BODY"?!1:t==="HTML"||Je(e.firstElementChild)===e}function hn(e){return e.parentNode!==null?hn(e.parentNode):e}function At(e,t){if(!e||!e.nodeType||!t||!t.nodeType)return document.documentElement;var n=e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING,r=n?e:t,o=n?t:e,i=document.createRange();i.setStart(r,0),i.setEnd(o,0);var s=i.commonAncestorContainer;if(e!==s&&t!==s||r.contains(o))return ta(s)?s:Je(s);var a=hn(e);return a.host?At(a.host,t):At(e,hn(t).host)}function Xe(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"top",n=t==="top"?"scrollTop":"scrollLeft",r=e.nodeName;if(r==="BODY"||r==="HTML"){var o=e.ownerDocument.documentElement,i=e.ownerDocument.scrollingElement||o;return i[n]}return e[n]}function na(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=Xe(t,"top"),o=Xe(t,"left"),i=n?-1:1;return e.top+=r*i,e.bottom+=r*i,e.left+=o*i,e.right+=o*i,e}function or(e,t){var n=t==="x"?"Left":"Top",r=n==="Left"?"Right":"Bottom";return parseFloat(e["border"+n+"Width"])+parseFloat(e["border"+r+"Width"])}function ir(e,t,n,r){return Math.max(t["offset"+e],t["scroll"+e],n["client"+e],n["offset"+e],n["scroll"+e],nt(10)?parseInt(n["offset"+e])+parseInt(r["margin"+(e==="Height"?"Top":"Left")])+parseInt(r["margin"+(e==="Height"?"Bottom":"Right")]):0)}function zr(e){var t=e.body,n=e.documentElement,r=nt(10)&&getComputedStyle(n);return{height:ir("Height",t,n,r),width:ir("Width",t,n,r)}}var ra=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},oa=(function(){function e(t,n){for(var r=0;r2&&arguments[2]!==void 0?arguments[2]:!1,r=nt(10),o=t.nodeName==="HTML",i=mn(e),s=mn(t),a=Ot(e),l=Ye(t),u=parseFloat(l.borderTopWidth),f=parseFloat(l.borderLeftWidth);n&&o&&(s.top=Math.max(s.top,0),s.left=Math.max(s.left,0));var c=je({top:i.top-s.top-u,left:i.left-s.left-f,width:i.width,height:i.height});if(c.marginTop=0,c.marginLeft=0,!r&&o){var d=parseFloat(l.marginTop),p=parseFloat(l.marginLeft);c.top-=u-d,c.bottom-=u-d,c.left-=f-p,c.right-=f-p,c.marginTop=d,c.marginLeft=p}return(r&&!n?t.contains(a):t===a&&a.nodeName!=="BODY")&&(c=na(c,t)),c}function ia(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=e.ownerDocument.documentElement,r=kn(e,n),o=Math.max(n.clientWidth,window.innerWidth||0),i=Math.max(n.clientHeight,window.innerHeight||0),s=t?0:Xe(n),a=t?0:Xe(n,"left"),l={top:s-r.top+r.marginTop,left:a-r.left+r.marginLeft,width:o,height:i};return je(l)}function Ur(e){var t=e.nodeName;if(t==="BODY"||t==="HTML")return!1;if(Ye(e,"position")==="fixed")return!0;var n=En(e);return n?Ur(n):!1}function Yr(e){if(!e||!e.parentElement||nt())return document.documentElement;for(var t=e.parentElement;t&&Ye(t,"transform")==="none";)t=t.parentElement;return t||document.documentElement}function Cn(e,t,n,r){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1,i={top:0,left:0},s=o?Yr(e):At(e,Hr(t));if(r==="viewport")i=ia(s,o);else{var a=void 0;r==="scrollParent"?(a=Ot(En(t)),a.nodeName==="BODY"&&(a=e.ownerDocument.documentElement)):r==="window"?a=e.ownerDocument.documentElement:a=r;var l=kn(a,s,o);if(a.nodeName==="HTML"&&!Ur(s)){var u=zr(e.ownerDocument),f=u.height,c=u.width;i.top+=l.top-l.marginTop,i.bottom=f+l.top,i.left+=l.left-l.marginLeft,i.right=c+l.left}else i=l}n=n||0;var d=typeof n=="number";return i.left+=d?n:n.left||0,i.top+=d?n:n.top||0,i.right-=d?n:n.right||0,i.bottom-=d?n:n.bottom||0,i}function sa(e){var t=e.width,n=e.height;return t*n}function qr(e,t,n,r,o){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0;if(e.indexOf("auto")===-1)return e;var s=Cn(n,r,i,o),a={top:{width:s.width,height:t.top-s.top},right:{width:s.right-t.right,height:s.height},bottom:{width:s.width,height:s.bottom-t.bottom},left:{width:t.left-s.left,height:s.height}},l=Object.keys(a).map(function(d){return he({key:d},a[d],{area:sa(a[d])})}).sort(function(d,p){return p.area-d.area}),u=l.filter(function(d){var p=d.width,h=d.height;return p>=n.clientWidth&&h>=n.clientHeight}),f=u.length>0?u[0].key:l[0].key,c=e.split("-")[1];return f+(c?"-"+c:"")}function Gr(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,o=r?Yr(t):At(t,Hr(n));return kn(n,o,r)}function Vr(e){var t=e.ownerDocument.defaultView,n=t.getComputedStyle(e),r=parseFloat(n.marginTop||0)+parseFloat(n.marginBottom||0),o=parseFloat(n.marginLeft||0)+parseFloat(n.marginRight||0),i={width:e.offsetWidth+o,height:e.offsetHeight+r};return i}function _t(e){var t={left:"right",right:"left",bottom:"top",top:"bottom"};return e.replace(/left|right|bottom|top/g,function(n){return t[n]})}function Kr(e,t,n){n=n.split("-")[0];var r=Vr(e),o={width:r.width,height:r.height},i=["right","left"].indexOf(n)!==-1,s=i?"top":"left",a=i?"left":"top",l=i?"height":"width",u=i?"width":"height";return o[s]=t[s]+t[l]/2-r[l]/2,n===a?o[a]=t[a]-r[u]:o[a]=t[_t(a)],o}function St(e,t){return Array.prototype.find?e.find(t):e.filter(t)[0]}function aa(e,t,n){if(Array.prototype.findIndex)return e.findIndex(function(o){return o[t]===n});var r=St(e,function(o){return o[t]===n});return e.indexOf(r)}function Zr(e,t,n){var r=n===void 0?e:e.slice(0,aa(e,"name",n));return r.forEach(function(o){o.function&&console.warn("`modifier.function` is deprecated, use `modifier.fn`!");var i=o.function||o.fn;o.enabled&&$r(i)&&(t.offsets.popper=je(t.offsets.popper),t.offsets.reference=je(t.offsets.reference),t=i(t,o))}),t}function la(){if(!this.state.isDestroyed){var e={instance:this,styles:{},arrowStyles:{},attributes:{},flipped:!1,offsets:{}};e.offsets.reference=Gr(this.state,this.popper,this.reference,this.options.positionFixed),e.placement=qr(this.options.placement,e.offsets.reference,this.popper,this.reference,this.options.modifiers.flip.boundariesElement,this.options.modifiers.flip.padding),e.originalPlacement=e.placement,e.positionFixed=this.options.positionFixed,e.offsets.popper=Kr(this.popper,e.offsets.reference,e.placement),e.offsets.popper.position=this.options.positionFixed?"fixed":"absolute",e=Zr(this.modifiers,e),this.state.isCreated?this.options.onUpdate(e):(this.state.isCreated=!0,this.options.onCreate(e))}}function Jr(e,t){return e.some(function(n){var r=n.name,o=n.enabled;return o&&r===t})}function Tn(e){for(var t=[!1,"ms","Webkit","Moz","O"],n=e.charAt(0).toUpperCase()+e.slice(1),r=0;rs[p]&&(e.offsets.popper[c]+=a[c]+h-s[p]),e.offsets.popper=je(e.offsets.popper);var v=a[c]+a[u]/2-h/2,S=Ye(e.instance.popper),y=parseFloat(S["margin"+f]),m=parseFloat(S["border"+f+"Width"]),E=v-e.offsets.popper[c]-y-m;return E=Math.max(Math.min(s[u]-h,E),0),e.arrowElement=r,e.offsets.arrow=(n={},Qe(n,c,Math.round(E)),Qe(n,d,""),n),e}function Oa(e){return e==="end"?"start":e==="start"?"end":e}var to=["auto-start","auto","auto-end","top-start","top","top-end","right-start","right","right-end","bottom-end","bottom","bottom-start","left-end","left","left-start"],on=to.slice(3);function sr(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=on.indexOf(e),r=on.slice(n+1).concat(on.slice(0,n));return t?r.reverse():r}var sn={FLIP:"flip",CLOCKWISE:"clockwise",COUNTERCLOCKWISE:"counterclockwise"};function Sa(e,t){if(Jr(e.instance.modifiers,"inner")||e.flipped&&e.placement===e.originalPlacement)return e;var n=Cn(e.instance.popper,e.instance.reference,t.padding,t.boundariesElement,e.positionFixed),r=e.placement.split("-")[0],o=_t(r),i=e.placement.split("-")[1]||"",s=[];switch(t.behavior){case sn.FLIP:s=[r,o];break;case sn.CLOCKWISE:s=sr(r);break;case sn.COUNTERCLOCKWISE:s=sr(r,!0);break;default:s=t.behavior}return s.forEach(function(a,l){if(r!==a||s.length===l+1)return e;r=e.placement.split("-")[0],o=_t(r);var u=e.offsets.popper,f=e.offsets.reference,c=Math.floor,d=r==="left"&&c(u.right)>c(f.left)||r==="right"&&c(u.left)c(f.top)||r==="bottom"&&c(u.top)c(n.right),v=c(u.top)c(n.bottom),y=r==="left"&&p||r==="right"&&h||r==="top"&&v||r==="bottom"&&S,m=["top","bottom"].indexOf(r)!==-1,E=!!t.flipVariations&&(m&&i==="start"&&p||m&&i==="end"&&h||!m&&i==="start"&&v||!m&&i==="end"&&S),M=!!t.flipVariationsByContent&&(m&&i==="start"&&h||m&&i==="end"&&p||!m&&i==="start"&&S||!m&&i==="end"&&v),C=E||M;(d||y||C)&&(e.flipped=!0,(d||y)&&(r=s[l+1]),C&&(i=Oa(i)),e.placement=r+(i?"-"+i:""),e.offsets.popper=he({},e.offsets.popper,Kr(e.instance.popper,e.offsets.reference,e.placement)),e=Zr(e.instance.modifiers,e,"flip"))}),e}function Ea(e){var t=e.offsets,n=t.popper,r=t.reference,o=e.placement.split("-")[0],i=Math.floor,s=["top","bottom"].indexOf(o)!==-1,a=s?"right":"bottom",l=s?"left":"top",u=s?"width":"height";return n[a]i(r[a])&&(e.offsets.popper[l]=i(r[a])),e}function ka(e,t,n,r){var o=e.match(/((?:\-|\+)?\d*\.?\d*)(.*)/),i=+o[1],s=o[2];if(!i)return e;if(s.indexOf("%")===0){var a=void 0;switch(s){case"%p":a=n;break;case"%":case"%r":default:a=r}var l=je(a);return l[t]/100*i}else if(s==="vh"||s==="vw"){var u=void 0;return s==="vh"?u=Math.max(document.documentElement.clientHeight,window.innerHeight||0):u=Math.max(document.documentElement.clientWidth,window.innerWidth||0),u/100*i}else return i}function Ca(e,t,n,r){var o=[0,0],i=["right","left"].indexOf(r)!==-1,s=e.split(/(\+|\-)/).map(function(f){return f.trim()}),a=s.indexOf(St(s,function(f){return f.search(/,|\s/)!==-1}));s[a]&&s[a].indexOf(",")===-1&&console.warn("Offsets separated by white space(s) are deprecated, use a comma (,) instead.");var l=/\s*,\s*|\s+/,u=a!==-1?[s.slice(0,a).concat([s[a].split(l)[0]]),[s[a].split(l)[1]].concat(s.slice(a+1))]:[s];return u=u.map(function(f,c){var d=(c===1?!i:i)?"height":"width",p=!1;return f.reduce(function(h,v){return h[h.length-1]===""&&["+","-"].indexOf(v)!==-1?(h[h.length-1]=v,p=!0,h):p?(h[h.length-1]+=v,p=!1,h):h.concat(v)},[]).map(function(h){return ka(h,d,t,n)})}),u.forEach(function(f,c){f.forEach(function(d,p){Mn(d)&&(o[c]+=d*(f[p-1]==="-"?-1:1))})}),o}function Ta(e,t){var n=t.offset,r=e.placement,o=e.offsets,i=o.popper,s=o.reference,a=r.split("-")[0],l=void 0;return Mn(+n)?l=[+n,0]:l=Ca(n,i,s,a),a==="left"?(i.top+=l[0],i.left-=l[1]):a==="right"?(i.top+=l[0],i.left+=l[1]):a==="top"?(i.left+=l[0],i.top-=l[1]):a==="bottom"&&(i.left+=l[0],i.top+=l[1]),e.popper=i,e}function Ma(e,t){var n=t.boundariesElement||Je(e.instance.popper);e.instance.reference===n&&(n=Je(n));var r=Tn("transform"),o=e.instance.popper.style,i=o.top,s=o.left,a=o[r];o.top="",o.left="",o[r]="";var l=Cn(e.instance.popper,e.instance.reference,t.padding,n,e.positionFixed);o.top=i,o.left=s,o[r]=a,t.boundaries=l;var u=t.priority,f=e.offsets.popper,c={primary:function(p){var h=f[p];return f[p]l[p]&&!t.escapeWithReference&&(v=Math.min(f[h],l[p]-(p==="right"?f.width:f.height))),Qe({},h,v)}};return u.forEach(function(d){var p=["left","top"].indexOf(d)!==-1?"primary":"secondary";f=he({},f,c[p](d))}),e.offsets.popper=f,e}function Pa(e){var t=e.placement,n=t.split("-")[0],r=t.split("-")[1];if(r){var o=e.offsets,i=o.reference,s=o.popper,a=["bottom","top"].indexOf(n)!==-1,l=a?"left":"top",u=a?"width":"height",f={start:Qe({},l,i[l]),end:Qe({},l,i[l]+i[u]-s[u])};e.offsets.popper=he({},s,f[r])}return e}function xa(e){if(!eo(e.instance.modifiers,"hide","preventOverflow"))return e;var t=e.offsets.reference,n=St(e.instance.modifiers,function(r){return r.name==="preventOverflow"}).boundaries;if(t.bottomn.right||t.top>n.bottom||t.right2&&arguments[2]!==void 0?arguments[2]:{};ra(this,e),this.scheduleUpdate=function(){return requestAnimationFrame(r.update)},this.update=ea(this.update.bind(this)),this.options=he({},e.Defaults,o),this.state={isDestroyed:!1,isCreated:!1,scrollParents:[]},this.reference=t&&t.jquery?t[0]:t,this.popper=n&&n.jquery?n[0]:n,this.options.modifiers={},Object.keys(he({},e.Defaults.modifiers,o.modifiers)).forEach(function(s){r.options.modifiers[s]=he({},e.Defaults.modifiers[s]||{},o.modifiers?o.modifiers[s]:{})}),this.modifiers=Object.keys(this.options.modifiers).map(function(s){return he({name:s},r.options.modifiers[s])}).sort(function(s,a){return s.order-a.order}),this.modifiers.forEach(function(s){s.enabled&&$r(s.onLoad)&&s.onLoad(r.reference,r.popper,r.options,s,r.state)}),this.update();var i=this.options.eventsEnabled;i&&this.enableEventListeners(),this.state.eventsEnabled=i}return oa(e,[{key:"update",value:function(){return la.call(this)}},{key:"destroy",value:function(){return ca.call(this)}},{key:"enableEventListeners",value:function(){return fa.call(this)}},{key:"disableEventListeners",value:function(){return pa.call(this)}}]),e})();yt.Utils=(typeof window<"u"?window:global).PopperUtils;yt.placements=to;yt.Defaults=Ia;var Wa=["innerHTML","ownerDocument","style","attributes","nodeValue"],Ra=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","WeakMap","WeakSet"],Aa=["bigint","boolean","null","number","string","symbol","undefined"];function Lt(e){var t=Object.prototype.toString.call(e).slice(8,-1);if(/HTML\w+Element/.test(t))return"HTMLElement";if(_a(t))return t}function we(e){return function(t){return Lt(t)===e}}function _a(e){return Ra.includes(e)}function rt(e){return function(t){return typeof t===e}}function Fa(e){return Aa.includes(e)}function g(e){if(e===null)return"null";switch(typeof e){case"bigint":return"bigint";case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"symbol":return"symbol";case"undefined":return"undefined"}if(g.array(e))return"Array";if(g.plainFunction(e))return"Function";var t=Lt(e);return t||"Object"}g.array=Array.isArray;g.arrayOf=function(e,t){return!g.array(e)&&!g.function(t)?!1:e.every(function(n){return t(n)})};g.asyncGeneratorFunction=function(e){return Lt(e)==="AsyncGeneratorFunction"};g.asyncFunction=we("AsyncFunction");g.bigint=rt("bigint");g.boolean=function(e){return e===!0||e===!1};g.date=we("Date");g.defined=function(e){return!g.undefined(e)};g.domElement=function(e){return g.object(e)&&!g.plainObject(e)&&e.nodeType===1&&g.string(e.nodeName)&&Wa.every(function(t){return t in e})};g.empty=function(e){return g.string(e)&&e.length===0||g.array(e)&&e.length===0||g.object(e)&&!g.map(e)&&!g.set(e)&&Object.keys(e).length===0||g.set(e)&&e.size===0||g.map(e)&&e.size===0};g.error=we("Error");g.function=rt("function");g.generator=function(e){return g.iterable(e)&&g.function(e.next)&&g.function(e.throw)};g.generatorFunction=we("GeneratorFunction");g.instanceOf=function(e,t){return!e||!t?!1:Object.getPrototypeOf(e)===t.prototype};g.iterable=function(e){return!g.nullOrUndefined(e)&&g.function(e[Symbol.iterator])};g.map=we("Map");g.nan=function(e){return Number.isNaN(e)};g.null=function(e){return e===null};g.nullOrUndefined=function(e){return g.null(e)||g.undefined(e)};g.number=function(e){return rt("number")(e)&&!g.nan(e)};g.numericString=function(e){return g.string(e)&&e.length>0&&!Number.isNaN(Number(e))};g.object=function(e){return!g.nullOrUndefined(e)&&(g.function(e)||typeof e=="object")};g.oneOf=function(e,t){return g.array(e)?e.indexOf(t)>-1:!1};g.plainFunction=we("Function");g.plainObject=function(e){if(Lt(e)!=="Object")return!1;var t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})};g.primitive=function(e){return g.null(e)||Fa(typeof e)};g.promise=we("Promise");g.propertyOf=function(e,t,n){if(!g.object(e)||!t)return!1;var r=e[t];return g.function(n)?n(r):g.defined(r)};g.regexp=we("RegExp");g.set=we("Set");g.string=rt("string");g.symbol=rt("symbol");g.undefined=rt("undefined");g.weakMap=we("WeakMap");g.weakSet=we("WeakSet");function no(e){return function(t){return typeof t===e}}var ja=no("function"),Ba=function(e){return e===null},ar=function(e){return Object.prototype.toString.call(e).slice(8,-1)==="RegExp"},lr=function(e){return!La(e)&&!Ba(e)&&(ja(e)||typeof e=="object")},La=no("undefined"),vn=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function $a(e,t){var n=e.length;if(n!==t.length)return!1;for(var r=n;r--!==0;)if(!ae(e[r],t[r]))return!1;return!0}function Ha(e,t){if(e.byteLength!==t.byteLength)return!1;for(var n=new DataView(e.buffer),r=new DataView(t.buffer),o=e.byteLength;o--;)if(n.getUint8(o)!==r.getUint8(o))return!1;return!0}function za(e,t){var n,r,o,i;if(e.size!==t.size)return!1;try{for(var s=vn(e.entries()),a=s.next();!a.done;a=s.next()){var l=a.value;if(!t.has(l[0]))return!1}}catch(c){n={error:c}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}try{for(var u=vn(e.entries()),f=u.next();!f.done;f=u.next()){var l=f.value;if(!ae(l[1],t.get(l[0])))return!1}}catch(c){o={error:c}}finally{try{f&&!f.done&&(i=u.return)&&i.call(u)}finally{if(o)throw o.error}}return!0}function Ua(e,t){var n,r;if(e.size!==t.size)return!1;try{for(var o=vn(e.entries()),i=o.next();!i.done;i=o.next()){var s=i.value;if(!t.has(s[0]))return!1}}catch(a){n={error:a}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return!0}function ae(e,t){if(e===t)return!0;if(e&&lr(e)&&t&&lr(t)){if(e.constructor!==t.constructor)return!1;if(Array.isArray(e)&&Array.isArray(t))return $a(e,t);if(e instanceof Map&&t instanceof Map)return za(e,t);if(e instanceof Set&&t instanceof Set)return Ua(e,t);if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t))return Ha(e,t);if(ar(e)&&ar(t))return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(var o=n.length;o--!==0;)if(!Object.prototype.hasOwnProperty.call(t,n[o]))return!1;for(var o=n.length;o--!==0;){var i=n[o];if(!(i==="_owner"&&e.$$typeof)&&!ae(e[i],t[i]))return!1}return!0}return Number.isNaN(e)&&Number.isNaN(t)?!0:e===t}function Ya(){for(var e=[],t=0;tl);return g.undefined(r)||(u=u&&l===r),g.undefined(i)||(u=u&&a===i),u}function ur(e,t,n){var r=n.key,o=n.type,i=n.value,s=Te(e,r),a=Te(t,r),l=o==="added"?s:a,u=o==="added"?a:s;if(!g.nullOrUndefined(i)){if(g.defined(l)){if(g.array(l)||g.plainObject(l))return qa(l,u,i)}else return ae(u,i);return!1}return[s,a].every(g.array)?!u.every(Pn(l)):[s,a].every(g.plainObject)?Ga(Object.keys(l),Object.keys(u)):![s,a].every(function(f){return g.primitive(f)&&g.defined(f)})&&(o==="added"?!g.defined(s)&&g.defined(a):g.defined(s)&&!g.defined(a))}function fr(e,t,n){var r=n===void 0?{}:n,o=r.key,i=Te(e,o),s=Te(t,o);if(!ro(i,s))throw new TypeError("Inputs have different types");if(!Ya(i,s))throw new TypeError("Inputs don't have length");return[i,s].every(g.plainObject)&&(i=Object.keys(i),s=Object.keys(s)),[i,s]}function dr(e){return function(t){var n=t[0],r=t[1];return g.array(e)?ae(e,r)||e.some(function(o){return ae(o,r)||g.array(r)&&Pn(r)(o)}):g.plainObject(e)&&e[n]?!!e[n]&&ae(e[n],r):ae(e,r)}}function Ga(e,t){return t.some(function(n){return!e.includes(n)})}function pr(e){return function(t){return g.array(e)?e.some(function(n){return ae(n,t)||g.array(t)&&Pn(t)(n)}):ae(e,t)}}function ct(e,t){return g.array(e)?e.some(function(n){return ae(n,t)}):ae(e,t)}function Pn(e){return function(t){return e.some(function(n){return ae(n,t)})}}function ro(){for(var e=[],t=0;t"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ja(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i=0)&&(n[o]=e[o]);return n}function oo(e,t){if(e==null)return{};var n=Ja(e,t),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Ne(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Xa(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ne(e)}function Tt(e){var t=Za();return function(){var r=Ft(e),o;if(t){var i=Ft(this).constructor;o=Reflect.construct(r,arguments,i)}else o=r.apply(this,arguments);return Xa(this,o)}}function Qa(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function io(e){var t=Qa(e,"string");return typeof t=="symbol"?t:String(t)}var el={flip:{padding:20},preventOverflow:{padding:10}},tl="The typeValidator argument must be a function with the signature function(props, propName, componentName).",nl="The error message is optional, but must be a string if provided.";function rl(e,t,n,r){return typeof e=="boolean"?e:typeof e=="function"?e(t,n,r):e?!!e:!1}function ol(e,t){return Object.hasOwnProperty.call(e,t)}function il(e,t,n,r){return new Error("Required ".concat(e[t]," `").concat(t,"` was not specified in `").concat(n,"`."))}function sl(e,t){if(typeof e!="function")throw new TypeError(tl);if(t&&typeof t!="string")throw new TypeError(nl)}function mr(e,t,n){return sl(e,n),function(r,o,i){for(var s=arguments.length,a=new Array(s>3?s-3:0),l=3;l3&&arguments[3]!==void 0?arguments[3]:!1;e.addEventListener(t,n,r)}function ll(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;e.removeEventListener(t,n,r)}function cl(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,o;o=function(s){n(s),ll(e,t,o)},al(e,t,o,r)}function yr(){}var so=(function(e){Ct(n,e);var t=Tt(n);function n(){return Et(this,n),t.apply(this,arguments)}return kt(n,[{key:"componentDidMount",value:function(){Ee()&&(this.node||this.appendNode(),ut||this.renderPortal())}},{key:"componentDidUpdate",value:function(){Ee()&&(ut||this.renderPortal())}},{key:"componentWillUnmount",value:function(){!Ee()||!this.node||(ut||Nt.unmountComponentAtNode(this.node),this.node&&this.node.parentNode===document.body&&(document.body.removeChild(this.node),this.node=void 0))}},{key:"appendNode",value:function(){var o=this.props,i=o.id,s=o.zIndex;this.node||(this.node=document.createElement("div"),i&&(this.node.id=i),s&&(this.node.style.zIndex=s),document.body.appendChild(this.node))}},{key:"renderPortal",value:function(){if(!Ee())return null;var o=this.props,i=o.children,s=o.setRef;if(this.node||this.appendNode(),ut)return Nt.createPortal(i,this.node);var a=Nt.unstable_renderSubtreeIntoContainer(this,i.length>1?w.createElement("div",null,i):i[0],this.node);return s(a),null}},{key:"renderReact16",value:function(){var o=this.props,i=o.hasChildren,s=o.placement,a=o.target;return i?this.renderPortal():a||s==="center"?this.renderPortal():null}},{key:"render",value:function(){return ut?this.renderReact16():null}}]),n})(w.Component);te(so,"propTypes",{children:T.oneOfType([T.element,T.array]),hasChildren:T.bool,id:T.oneOfType([T.string,T.number]),placement:T.string,setRef:T.func.isRequired,target:T.oneOfType([T.object,T.string]),zIndex:T.number});var ao=(function(e){Ct(n,e);var t=Tt(n);function n(){return Et(this,n),t.apply(this,arguments)}return kt(n,[{key:"parentStyle",get:function(){var o=this.props,i=o.placement,s=o.styles,a=s.arrow.length,l={pointerEvents:"none",position:"absolute",width:"100%"};return i.startsWith("top")?(l.bottom=0,l.left=0,l.right=0,l.height=a):i.startsWith("bottom")?(l.left=0,l.right=0,l.top=0,l.height=a):i.startsWith("left")?(l.right=0,l.top=0,l.bottom=0):i.startsWith("right")&&(l.left=0,l.top=0),l}},{key:"render",value:function(){var o=this.props,i=o.placement,s=o.setArrowRef,a=o.styles,l=a.arrow,u=l.color,f=l.display,c=l.length,d=l.margin,p=l.position,h=l.spread,v={display:f,position:p},S,y=h,m=c;return i.startsWith("top")?(S="0,0 ".concat(y/2,",").concat(m," ").concat(y,",0"),v.bottom=0,v.marginLeft=d,v.marginRight=d):i.startsWith("bottom")?(S="".concat(y,",").concat(m," ").concat(y/2,",0 0,").concat(m),v.top=0,v.marginLeft=d,v.marginRight=d):i.startsWith("left")?(m=h,y=c,S="0,0 ".concat(y,",").concat(m/2," 0,").concat(m),v.right=0,v.marginTop=d,v.marginBottom=d):i.startsWith("right")&&(m=h,y=c,S="".concat(y,",").concat(m," ").concat(y,",0 0,").concat(m/2),v.left=0,v.marginTop=d,v.marginBottom=d),w.createElement("div",{className:"__floater__arrow",style:this.parentStyle},w.createElement("span",{ref:s,style:v},w.createElement("svg",{width:y,height:m,version:"1.1",xmlns:"http://www.w3.org/2000/svg"},w.createElement("polygon",{points:S,fill:u}))))}}]),n})(w.Component);te(ao,"propTypes",{placement:T.string.isRequired,setArrowRef:T.func.isRequired,styles:T.object.isRequired});var ul=["color","height","width"];function lo(e){var t=e.handleClick,n=e.styles,r=n.color,o=n.height,i=n.width,s=oo(n,ul);return w.createElement("button",{"aria-label":"close",onClick:t,style:s,type:"button"},w.createElement("svg",{width:"".concat(i,"px"),height:"".concat(o,"px"),viewBox:"0 0 18 18",version:"1.1",xmlns:"http://www.w3.org/2000/svg",preserveAspectRatio:"xMidYMid"},w.createElement("g",null,w.createElement("path",{d:"M8.13911129,9.00268191 L0.171521827,17.0258467 C-0.0498027049,17.248715 -0.0498027049,17.6098394 0.171521827,17.8327545 C0.28204354,17.9443526 0.427188206,17.9998706 0.572051765,17.9998706 C0.71714958,17.9998706 0.862013139,17.9443526 0.972581703,17.8327545 L9.0000937,9.74924618 L17.0276057,17.8327545 C17.1384085,17.9443526 17.2832721,17.9998706 17.4281356,17.9998706 C17.5729992,17.9998706 17.718097,17.9443526 17.8286656,17.8327545 C18.0499901,17.6098862 18.0499901,17.2487618 17.8286656,17.0258467 L9.86135722,9.00268191 L17.8340066,0.973848225 C18.0553311,0.750979934 18.0553311,0.389855532 17.8340066,0.16694039 C17.6126821,-0.0556467968 17.254037,-0.0556467968 17.0329467,0.16694039 L9.00042166,8.25611765 L0.967006424,0.167268345 C0.745681892,-0.0553188426 0.387317931,-0.0553188426 0.165993399,0.167268345 C-0.0553311331,0.390136635 -0.0553311331,0.751261038 0.165993399,0.974176179 L8.13920499,9.00268191 L8.13911129,9.00268191 Z",fill:r}))))}lo.propTypes={handleClick:T.func.isRequired,styles:T.object.isRequired};function co(e){var t=e.content,n=e.footer,r=e.handleClick,o=e.open,i=e.positionWrapper,s=e.showCloseButton,a=e.title,l=e.styles,u={content:w.isValidElement(t)?t:w.createElement("div",{className:"__floater__content",style:l.content},t)};return a&&(u.title=w.isValidElement(a)?a:w.createElement("div",{className:"__floater__title",style:l.title},a)),n&&(u.footer=w.isValidElement(n)?n:w.createElement("div",{className:"__floater__footer",style:l.footer},n)),(s||i)&&!g.boolean(o)&&(u.close=w.createElement(lo,{styles:l.close,handleClick:r})),w.createElement("div",{className:"__floater__container",style:l.container},u.close,u.title,u.content,u.footer)}co.propTypes={content:T.node.isRequired,footer:T.node,handleClick:T.func.isRequired,open:T.bool,positionWrapper:T.bool.isRequired,showCloseButton:T.bool.isRequired,styles:T.object.isRequired,title:T.node};var uo=(function(e){Ct(n,e);var t=Tt(n);function n(){return Et(this,n),t.apply(this,arguments)}return kt(n,[{key:"style",get:function(){var o=this.props,i=o.disableAnimation,s=o.component,a=o.placement,l=o.hideArrow,u=o.status,f=o.styles,c=f.arrow.length,d=f.floater,p=f.floaterCentered,h=f.floaterClosing,v=f.floaterOpening,S=f.floaterWithAnimation,y=f.floaterWithComponent,m={};return l||(a.startsWith("top")?m.padding="0 0 ".concat(c,"px"):a.startsWith("bottom")?m.padding="".concat(c,"px 0 0"):a.startsWith("left")?m.padding="0 ".concat(c,"px 0 0"):a.startsWith("right")&&(m.padding="0 0 0 ".concat(c,"px"))),[z.OPENING,z.OPEN].indexOf(u)!==-1&&(m=K(K({},m),v)),u===z.CLOSING&&(m=K(K({},m),h)),u===z.OPEN&&!i&&(m=K(K({},m),S)),a==="center"&&(m=K(K({},m),p)),s&&(m=K(K({},m),y)),K(K({},d),m)}},{key:"render",value:function(){var o=this.props,i=o.component,s=o.handleClick,a=o.hideArrow,l=o.setFloaterRef,u=o.status,f={},c=["__floater"];return i?w.isValidElement(i)?f.content=w.cloneElement(i,{closeFn:s}):f.content=i({closeFn:s}):f.content=w.createElement(co,this.props),u===z.OPEN&&c.push("__floater__open"),a||(f.arrow=w.createElement(ao,this.props)),w.createElement("div",{ref:l,className:c.join(" "),style:this.style},w.createElement("div",{className:"__floater__body"},f.content,f.arrow))}}]),n})(w.Component);te(uo,"propTypes",{component:T.oneOfType([T.func,T.element]),content:T.node,disableAnimation:T.bool.isRequired,footer:T.node,handleClick:T.func.isRequired,hideArrow:T.bool.isRequired,open:T.bool,placement:T.string.isRequired,positionWrapper:T.bool.isRequired,setArrowRef:T.func.isRequired,setFloaterRef:T.func.isRequired,showCloseButton:T.bool,status:T.string.isRequired,styles:T.object.isRequired,title:T.node});var fo=(function(e){Ct(n,e);var t=Tt(n);function n(){return Et(this,n),t.apply(this,arguments)}return kt(n,[{key:"render",value:function(){var o=this.props,i=o.children,s=o.handleClick,a=o.handleMouseEnter,l=o.handleMouseLeave,u=o.setChildRef,f=o.setWrapperRef,c=o.style,d=o.styles,p;if(i)if(w.Children.count(i)===1)if(!w.isValidElement(i))p=w.createElement("span",null,i);else{var h=g.function(i.type)?"innerRef":"ref";p=w.cloneElement(w.Children.only(i),te({},h,u))}else p=i;return p?w.createElement("span",{ref:f,style:K(K({},d),c),onClick:s,onMouseEnter:a,onMouseLeave:l},p):null}}]),n})(w.Component);te(fo,"propTypes",{children:T.node,handleClick:T.func.isRequired,handleMouseEnter:T.func.isRequired,handleMouseLeave:T.func.isRequired,setChildRef:T.func.isRequired,setWrapperRef:T.func.isRequired,style:T.object,styles:T.object.isRequired});var fl={zIndex:100};function dl(e){var t=ve(fl,e.options||{});return{wrapper:{cursor:"help",display:"inline-flex",flexDirection:"column",zIndex:t.zIndex},wrapperPosition:{left:-1e3,position:"absolute",top:-1e3,visibility:"hidden"},floater:{display:"inline-block",filter:"drop-shadow(0 0 3px rgba(0, 0, 0, 0.3))",maxWidth:300,opacity:0,position:"relative",transition:"opacity 0.3s",visibility:"hidden",zIndex:t.zIndex},floaterOpening:{opacity:1,visibility:"visible"},floaterWithAnimation:{opacity:1,transition:"opacity 0.3s, transform 0.2s",visibility:"visible"},floaterWithComponent:{maxWidth:"100%"},floaterClosing:{opacity:0,visibility:"visible"},floaterCentered:{left:"50%",position:"fixed",top:"50%",transform:"translate(-50%, -50%)"},container:{backgroundColor:"#fff",color:"#666",minHeight:60,minWidth:200,padding:20,position:"relative",zIndex:10},title:{borderBottom:"1px solid #555",color:"#555",fontSize:18,marginBottom:5,paddingBottom:6,paddingRight:18},content:{fontSize:15},close:{backgroundColor:"transparent",border:0,borderRadius:0,color:"#555",fontSize:0,height:15,outline:"none",padding:10,position:"absolute",right:0,top:0,width:15,WebkitAppearance:"none"},footer:{borderTop:"1px solid #ccc",fontSize:13,marginTop:10,paddingTop:5},arrow:{color:"#fff",display:"inline-flex",length:16,margin:8,position:"absolute",spread:32},options:t}}var pl=["arrow","flip","offset"],hl=["position","top","right","bottom","left"],xn=(function(e){Ct(n,e);var t=Tt(n);function n(r){var o;return Et(this,n),o=t.call(this,r),te(Ne(o),"setArrowRef",function(i){o.arrowRef=i}),te(Ne(o),"setChildRef",function(i){o.childRef=i}),te(Ne(o),"setFloaterRef",function(i){o.floaterRef=i}),te(Ne(o),"setWrapperRef",function(i){o.wrapperRef=i}),te(Ne(o),"handleTransitionEnd",function(){var i=o.state.status,s=o.props.callback;o.wrapperPopper&&o.wrapperPopper.instance.update(),o.setState({status:i===z.OPENING?z.OPEN:z.IDLE},function(){var a=o.state.status;s(a===z.OPEN?"open":"close",o.props)})}),te(Ne(o),"handleClick",function(){var i=o.props,s=i.event,a=i.open;if(!g.boolean(a)){var l=o.state,u=l.positionWrapper,f=l.status;(o.event==="click"||o.event==="hover"&&u)&&(xt({title:"click",data:[{event:s,status:f===z.OPEN?"closing":"opening"}],debug:o.debug}),o.toggle())}}),te(Ne(o),"handleMouseEnter",function(){var i=o.props,s=i.event,a=i.open;if(!(g.boolean(a)||an())){var l=o.state.status;o.event==="hover"&&l===z.IDLE&&(xt({title:"mouseEnter",data:[{key:"originalEvent",value:s}],debug:o.debug}),clearTimeout(o.eventDelayTimeout),o.toggle())}}),te(Ne(o),"handleMouseLeave",function(){var i=o.props,s=i.event,a=i.eventDelay,l=i.open;if(!(g.boolean(l)||an())){var u=o.state,f=u.status,c=u.positionWrapper;o.event==="hover"&&(xt({title:"mouseLeave",data:[{key:"originalEvent",value:s}],debug:o.debug}),a?[z.OPENING,z.OPEN].indexOf(f)!==-1&&!c&&!o.eventDelayTimeout&&(o.eventDelayTimeout=setTimeout(function(){delete o.eventDelayTimeout,o.toggle()},a*1e3)):o.toggle(z.IDLE))}}),o.state={currentPlacement:r.placement,needsUpdate:!1,positionWrapper:r.wrapperOptions.position&&!!r.target,status:z.INIT,statusWrapper:z.INIT},o._isMounted=!1,o.hasMounted=!1,Ee()&&window.addEventListener("load",function(){o.popper&&o.popper.instance.update(),o.wrapperPopper&&o.wrapperPopper.instance.update()}),o}return kt(n,[{key:"componentDidMount",value:function(){if(Ee()){var o=this.state.positionWrapper,i=this.props,s=i.children,a=i.open,l=i.target;this._isMounted=!0,xt({title:"init",data:{hasChildren:!!s,hasTarget:!!l,isControlled:g.boolean(a),positionWrapper:o,target:this.target,floater:this.floaterRef},debug:this.debug}),this.hasMounted||(this.initPopper(),this.hasMounted=!0),!s&&l&&g.boolean(a)}}},{key:"componentDidUpdate",value:function(o,i){if(Ee()){var s=this.props,a=s.autoOpen,l=s.open,u=s.target,f=s.wrapperOptions,c=Va(i,this.state),d=c.changedFrom,p=c.changed;if(o.open!==l){var h;g.boolean(l)&&(h=l?z.OPENING:z.CLOSING),this.toggle(h)}(o.wrapperOptions.position!==f.position||o.target!==u)&&this.changeWrapperPosition(this.props),p("status",z.IDLE)&&l?this.toggle(z.OPEN):d("status",z.INIT,z.IDLE)&&a&&this.toggle(z.OPEN),this.popper&&p("status",z.OPENING)&&this.popper.instance.update(),this.floaterRef&&(p("status",z.OPENING)||p("status",z.CLOSING))&&cl(this.floaterRef,"transitionend",this.handleTransitionEnd),p("needsUpdate",!0)&&this.rebuildPopper()}}},{key:"componentWillUnmount",value:function(){Ee()&&(this._isMounted=!1,this.popper&&this.popper.instance.destroy(),this.wrapperPopper&&this.wrapperPopper.instance.destroy())}},{key:"initPopper",value:function(){var o=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.target,s=this.state.positionWrapper,a=this.props,l=a.disableFlip,u=a.getPopper,f=a.hideArrow,c=a.offset,d=a.placement,p=a.wrapperOptions,h=d==="top"||d==="bottom"?"flip":["right","bottom-end","top-end","left","top-start","bottom-start"];if(d==="center")this.setState({status:z.IDLE});else if(i&&this.floaterRef){var v=this.options,S=v.arrow,y=v.flip,m=v.offset,E=oo(v,pl);new yt(i,this.floaterRef,{placement:d,modifiers:K({arrow:K({enabled:!f,element:this.arrowRef},S),flip:K({enabled:!l,behavior:h},y),offset:K({offset:"0, ".concat(c,"px")},m)},E),onCreate:function(O){var D;if(o.popper=O,!((D=o.floaterRef)!==null&&D!==void 0&&D.isConnected)){o.setState({needsUpdate:!0});return}u(O,"floater"),o._isMounted&&o.setState({currentPlacement:O.placement,status:z.IDLE}),d!==O.placement&&setTimeout(function(){O.instance.update()},1)},onUpdate:function(O){o.popper=O;var D=o.state.currentPlacement;o._isMounted&&O.placement!==D&&o.setState({currentPlacement:O.placement})}})}if(s){var M=g.undefined(p.offset)?0:p.offset;new yt(this.target,this.wrapperRef,{placement:p.placement||d,modifiers:{arrow:{enabled:!1},offset:{offset:"0, ".concat(M,"px")},flip:{enabled:!1}},onCreate:function(O){o.wrapperPopper=O,o._isMounted&&o.setState({statusWrapper:z.IDLE}),u(O,"wrapper"),d!==O.placement&&setTimeout(function(){O.instance.update()},1)}})}}},{key:"rebuildPopper",value:function(){var o=this;this.floaterRefInterval=setInterval(function(){var i;(i=o.floaterRef)!==null&&i!==void 0&&i.isConnected&&(clearInterval(o.floaterRefInterval),o.setState({needsUpdate:!1}),o.initPopper())},50)}},{key:"changeWrapperPosition",value:function(o){var i=o.target,s=o.wrapperOptions;this.setState({positionWrapper:s.position&&!!i})}},{key:"toggle",value:function(o){var i=this.state.status,s=i===z.OPEN?z.CLOSING:z.OPENING;g.undefined(o)||(s=o),this.setState({status:s})}},{key:"debug",get:function(){var o=this.props.debug;return o||Ee()&&"ReactFloaterDebug"in window&&!!window.ReactFloaterDebug}},{key:"event",get:function(){var o=this.props,i=o.disableHoverToClick,s=o.event;return s==="hover"&&an()&&!i?"click":s}},{key:"options",get:function(){var o=this.props.options;return ve(el,o||{})}},{key:"styles",get:function(){var o=this,i=this.state,s=i.status,a=i.positionWrapper,l=i.statusWrapper,u=this.props.styles,f=ve(dl(u),u);if(a){var c;[z.IDLE].indexOf(s)===-1||[z.IDLE].indexOf(l)===-1?c=f.wrapperPosition:c=this.wrapperPopper.styles,f.wrapper=K(K({},f.wrapper),c)}if(this.target){var d=window.getComputedStyle(this.target);this.wrapperStyles?f.wrapper=K(K({},f.wrapper),this.wrapperStyles):["relative","static"].indexOf(d.position)===-1&&(this.wrapperStyles={},a||(hl.forEach(function(p){o.wrapperStyles[p]=d[p]}),f.wrapper=K(K({},f.wrapper),this.wrapperStyles),this.target.style.position="relative",this.target.style.top="auto",this.target.style.right="auto",this.target.style.bottom="auto",this.target.style.left="auto"))}return f}},{key:"target",get:function(){if(!Ee())return null;var o=this.props.target;return o?g.domElement(o)?o:document.querySelector(o):this.childRef||this.wrapperRef}},{key:"render",value:function(){var o=this.state,i=o.currentPlacement,s=o.positionWrapper,a=o.status,l=this.props,u=l.children,f=l.component,c=l.content,d=l.disableAnimation,p=l.footer,h=l.hideArrow,v=l.id,S=l.open,y=l.showCloseButton,m=l.style,E=l.target,M=l.title,C=w.createElement(fo,{handleClick:this.handleClick,handleMouseEnter:this.handleMouseEnter,handleMouseLeave:this.handleMouseLeave,setChildRef:this.setChildRef,setWrapperRef:this.setWrapperRef,style:m,styles:this.styles.wrapper},u),O={};return s?O.wrapperInPortal=C:O.wrapperAsChildren=C,w.createElement("span",null,w.createElement(so,{hasChildren:!!u,id:v,placement:i,setRef:this.setFloaterRef,target:E,zIndex:this.styles.options.zIndex},w.createElement(uo,{component:f,content:c,disableAnimation:d,footer:p,handleClick:this.handleClick,hideArrow:h||i==="center",open:S,placement:i,positionWrapper:s,setArrowRef:this.setArrowRef,setFloaterRef:this.setFloaterRef,showCloseButton:y,status:a,styles:this.styles,title:M}),O.wrapperInPortal),O.wrapperAsChildren)}}]),n})(w.Component);te(xn,"propTypes",{autoOpen:T.bool,callback:T.func,children:T.node,component:mr(T.oneOfType([T.func,T.element]),function(e){return!e.content}),content:mr(T.node,function(e){return!e.component}),debug:T.bool,disableAnimation:T.bool,disableFlip:T.bool,disableHoverToClick:T.bool,event:T.oneOf(["hover","click"]),eventDelay:T.number,footer:T.node,getPopper:T.func,hideArrow:T.bool,id:T.oneOfType([T.string,T.number]),offset:T.number,open:T.bool,options:T.object,placement:T.oneOf(["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end","auto","center"]),showCloseButton:T.bool,style:T.object,styles:T.object,target:T.oneOfType([T.object,T.string]),title:T.node,wrapperOptions:T.shape({offset:T.number,placement:T.oneOf(["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end","auto"]),position:T.bool})});te(xn,"defaultProps",{autoOpen:!1,callback:yr,debug:!1,disableAnimation:!1,disableFlip:!1,disableHoverToClick:!1,event:"click",eventDelay:.4,getPopper:yr,hideArrow:!1,offset:15,placement:"bottom",showCloseButton:!1,styles:{},target:null,wrapperOptions:{position:!1}});var ml=Object.defineProperty,yl=(e,t,n)=>t in e?ml(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,N=(e,t,n)=>yl(e,typeof t!="symbol"?t+"":t,n),q={INIT:"init",START:"start",STOP:"stop",RESET:"reset",PREV:"prev",NEXT:"next",GO:"go",CLOSE:"close",SKIP:"skip",UPDATE:"update"},ye={TOUR_START:"tour:start",STEP_BEFORE:"step:before",BEACON:"beacon",TOOLTIP:"tooltip",STEP_AFTER:"step:after",TOUR_END:"tour:end",TOUR_STATUS:"tour:status",TARGET_NOT_FOUND:"error:target_not_found"},A={INIT:"init",READY:"ready",BEACON:"beacon",TOOLTIP:"tooltip",COMPLETE:"complete",ERROR:"error"},L={IDLE:"idle",READY:"ready",WAITING:"waiting",RUNNING:"running",PAUSED:"paused",SKIPPED:"skipped",FINISHED:"finished"};function _e(){var e;return!!(typeof window<"u"&&((e=window.document)!=null&&e.createElement))}function po(e){return e?e.getBoundingClientRect():null}function vl(e=!1){const{body:t,documentElement:n}=document;if(!t||!n)return 0;if(e){const r=[t.scrollHeight,t.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight].sort((i,s)=>i-s),o=Math.floor(r.length/2);return r.length%2===0?(r[o-1]+r[o])/2:r[o]}return Math.max(t.scrollHeight,t.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight)}function De(e){if(typeof e=="string")try{return document.querySelector(e)}catch{return null}return e}function gl(e){return!e||e.nodeType!==1?null:getComputedStyle(e)}function vt(e,t,n){if(!e)return $e();const r=Lr(e);if(r){if(r.isSameNode($e()))return n?document:$e();if(!(r.scrollHeight>r.offsetHeight)&&!t)return r.style.overflow="initial",$e()}return r}function $t(e,t){if(!e)return!1;const n=vt(e,t);return n?!n.isSameNode($e()):!1}function bl(e){return e.offsetParent!==document.body}function et(e,t="fixed"){if(!e||!(e instanceof HTMLElement))return!1;const{nodeName:n}=e,r=gl(e);return n==="BODY"||n==="HTML"?!1:r&&r.position===t?!0:e.parentNode?et(e.parentNode,t):!1}function wl(e){var t;if(!e)return!1;let n=e;for(;n&&n!==document.body;){if(n instanceof HTMLElement){const{display:r,visibility:o}=getComputedStyle(n);if(r==="none"||o==="hidden")return!1}n=(t=n.parentElement)!=null?t:null}return!0}function Ol(e,t,n){var r,o,i;const s=po(e),a=vt(e,n),l=$t(e,n),u=et(e);let f=0,c=(r=s?.top)!=null?r:0;if(l&&u){const d=(o=e?.offsetTop)!=null?o:0,p=(i=a?.scrollTop)!=null?i:0;c=d-p}else a instanceof HTMLElement&&(f=a.scrollTop,!l&&!et(e)&&(c+=f),a.isSameNode($e())||(c+=$e().scrollTop));return Math.floor(c-t)}function Sl(e,t,n){var r;if(!e)return 0;const{offsetTop:o=0,scrollTop:i=0}=(r=Lr(e))!=null?r:{};let s=e.getBoundingClientRect().top+i;o&&($t(e,n)||bl(e))&&(s-=o);const a=Math.floor(s-t);return a<0?0:a}function $e(){var e;return(e=document.scrollingElement)!=null?e:document.documentElement}function El(e,t){const{duration:n,element:r}=t;return new Promise((o,i)=>{const{scrollTop:s}=r,a=e>s?e-s:s-e;js.top(r,e,{duration:a<100?50:n},l=>l&&l.message!=="Element already at target scroll position"?i(l):o())})}var ft=Dt.createPortal!==void 0;function ho(e=navigator.userAgent){let t=e;return typeof window>"u"?t="node":document.documentMode?t="ie":/Edge/.test(e)?t="edge":window.opera||e.includes(" OPR/")?t="opera":typeof window.InstallTrigger<"u"?t="firefox":window.chrome?t="chrome":/(Version\/([\d._]+).*Safari|CriOS|FxiOS| Mobile\/)/.test(e)&&(t="safari"),t}function Wt(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function ke(e,t={}){const{defaultValue:n,step:r,steps:o}=t;let i=Jn(e);if(i)(i.includes("{step}")||i.includes("{steps}"))&&r&&o&&(i=i.replace("{step}",r.toString()).replace("{steps}",o.toString()));else if(b.isValidElement(e)&&!Object.values(e.props).length&&Wt(e.type)==="function"){const s=e.type({});i=ke(s,t)}else i=Jn(n);return i}function kl(e,t){return!x.plainObject(e)||!x.array(t)?!1:Object.keys(e).every(n=>t.includes(n))}function Cl(e){const t=/^#?([\da-f])([\da-f])([\da-f])$/i,n=e.replace(t,(o,i,s,a)=>i+i+s+s+a+a),r=/^#?([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i.exec(n);return r?[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)]:[]}function vr(e){return e.disableBeacon||e.placement==="center"}function gr(){return!["chrome","safari","firefox","opera"].includes(ho())}function Ue({data:e,debug:t=!1,title:n,warn:r=!1}){const o=r?console.warn||console.error:console.log;t&&(n&&e?(console.groupCollapsed(`%creact-joyride: ${n}`,"color: #ff0044; font-weight: bold; font-size: 12px;"),Array.isArray(e)?e.forEach(i=>{x.plainObject(i)&&i.key?o.apply(console,[i.key,i.value]):o.apply(console,[i])}):o.apply(console,[e]),console.groupEnd()):console.error("Missing title or data props"))}function Tl(e){return Object.keys(e)}function mo(e,...t){if(!x.plainObject(e))throw new TypeError("Expected an object");const n={};for(const r in e)({}).hasOwnProperty.call(e,r)&&(t.includes(r)||(n[r]=e[r]));return n}function Ml(e,...t){if(!x.plainObject(e))throw new TypeError("Expected an object");if(!t.length)return e;const n={};for(const r in e)({}).hasOwnProperty.call(e,r)&&t.includes(r)&&(n[r]=e[r]);return n}function bn(e,t,n){const r=i=>i.replace("{step}",String(t)).replace("{steps}",String(n));if(Wt(e)==="string")return r(e);if(!b.isValidElement(e))return e;const{children:o}=e.props;if(Wt(o)==="string"&&o.includes("{step}"))return b.cloneElement(e,{children:r(o)});if(Array.isArray(o))return b.cloneElement(e,{children:o.map(i=>typeof i=="string"?r(i):bn(i,t,n))});if(Wt(e.type)==="function"&&!Object.values(e.props).length){const i=e.type({});return bn(i,t,n)}return e}function Pl(e){const{isFirstStep:t,lifecycle:n,previousLifecycle:r,scrollToFirstStep:o,step:i,target:s}=e;return!i.disableScrolling&&(!t||o||n===A.TOOLTIP)&&i.placement!=="center"&&(!i.isFixed||!et(s))&&r!==n&&[A.BEACON,A.TOOLTIP].includes(n)}var xl={options:{preventOverflow:{boundariesElement:"scrollParent"}},wrapperOptions:{offset:-18,position:!0}},yo={back:"Back",close:"Close",last:"Last",next:"Next",nextLabelWithProgress:"Next (Step {step} of {steps})",open:"Open the dialog",skip:"Skip"},Nl={event:"click",placement:"bottom",offset:10,disableBeacon:!1,disableCloseOnEsc:!1,disableOverlay:!1,disableOverlayClose:!1,disableScrollParentFix:!1,disableScrolling:!1,hideBackButton:!1,hideCloseButton:!1,hideFooter:!1,isFixed:!1,locale:yo,showProgress:!1,showSkipButton:!1,spotlightClicks:!1,spotlightPadding:10},Dl={continuous:!1,debug:!1,disableCloseOnEsc:!1,disableOverlay:!1,disableOverlayClose:!1,disableScrolling:!1,disableScrollParentFix:!1,getHelpers:void 0,hideBackButton:!1,run:!0,scrollOffset:20,scrollDuration:300,scrollToFirstStep:!1,showSkipButton:!1,showProgress:!1,spotlightClicks:!1,spotlightPadding:10,steps:[]},Il={arrowColor:"#fff",backgroundColor:"#fff",beaconSize:36,overlayColor:"rgba(0, 0, 0, 0.5)",primaryColor:"#f04",spotlightShadow:"0 0 15px rgba(0, 0, 0, 0.5)",textColor:"#333",width:380,zIndex:100},dt={backgroundColor:"transparent",border:0,borderRadius:0,color:"#555",cursor:"pointer",fontSize:16,lineHeight:1,padding:8,WebkitAppearance:"none"},br={borderRadius:4,position:"absolute"};function Wl(e,t){var n,r,o,i,s;const{floaterProps:a,styles:l}=e,u=ve((n=t.floaterProps)!=null?n:{},a??{}),f=ve(l??{},(r=t.styles)!=null?r:{}),c=ve(Il,f.options||{}),d=t.placement==="center"||t.disableBeacon;let{width:p}=c;window.innerWidth>480&&(p=380),"width"in c&&(p=typeof c.width=="number"&&window.innerWidthvo(n,t)):(Ue({title:"validateSteps",data:"steps must be an array",warn:!0,debug:t}),!1)}var go={action:"init",controlled:!1,index:0,lifecycle:A.INIT,origin:null,size:0,status:L.IDLE},Or=Tl(mo(go,"controlled","size")),Al=class{constructor(e){N(this,"beaconPopper"),N(this,"tooltipPopper"),N(this,"data",new Map),N(this,"listener"),N(this,"store",new Map),N(this,"addListener",o=>{this.listener=o}),N(this,"setSteps",o=>{const{size:i,status:s}=this.getState(),a={size:o.length,status:s};this.data.set("steps",o),s===L.WAITING&&!i&&o.length&&(a.status=L.RUNNING),this.setState(a)}),N(this,"getPopper",o=>o==="beacon"?this.beaconPopper:this.tooltipPopper),N(this,"setPopper",(o,i)=>{o==="beacon"?this.beaconPopper=i:this.tooltipPopper=i}),N(this,"cleanupPoppers",()=>{this.beaconPopper=null,this.tooltipPopper=null}),N(this,"close",(o=null)=>{const{index:i,status:s}=this.getState();s===L.RUNNING&&this.setState({...this.getNextState({action:q.CLOSE,index:i+1,origin:o})})}),N(this,"go",o=>{const{controlled:i,status:s}=this.getState();if(i||s!==L.RUNNING)return;const a=this.getSteps()[o];this.setState({...this.getNextState({action:q.GO,index:o}),status:a?s:L.FINISHED})}),N(this,"info",()=>this.getState()),N(this,"next",()=>{const{index:o,status:i}=this.getState();i===L.RUNNING&&this.setState(this.getNextState({action:q.NEXT,index:o+1}))}),N(this,"open",()=>{const{status:o}=this.getState();o===L.RUNNING&&this.setState({...this.getNextState({action:q.UPDATE,lifecycle:A.TOOLTIP})})}),N(this,"prev",()=>{const{index:o,status:i}=this.getState();i===L.RUNNING&&this.setState({...this.getNextState({action:q.PREV,index:o-1})})}),N(this,"reset",(o=!1)=>{const{controlled:i}=this.getState();i||this.setState({...this.getNextState({action:q.RESET,index:0}),status:o?L.RUNNING:L.READY})}),N(this,"skip",()=>{const{status:o}=this.getState();o===L.RUNNING&&this.setState({action:q.SKIP,lifecycle:A.INIT,status:L.SKIPPED})}),N(this,"start",o=>{const{index:i,size:s}=this.getState();this.setState({...this.getNextState({action:q.START,index:x.number(o)?o:i},!0),status:s?L.RUNNING:L.WAITING})}),N(this,"stop",(o=!1)=>{const{index:i,status:s}=this.getState();[L.FINISHED,L.SKIPPED].includes(s)||this.setState({...this.getNextState({action:q.STOP,index:i+(o?1:0)}),status:L.PAUSED})}),N(this,"update",o=>{var i,s;if(!kl(o,Or))throw new Error(`State is not valid. Valid keys: ${Or.join(", ")}`);this.setState({...this.getNextState({...this.getState(),...o,action:(i=o.action)!=null?i:q.UPDATE,origin:(s=o.origin)!=null?s:null},!0)})});const{continuous:t=!1,stepIndex:n,steps:r=[]}=e??{};this.setState({action:q.INIT,controlled:x.number(n),continuous:t,index:x.number(n)?n:0,lifecycle:A.INIT,origin:null,status:r.length?L.READY:L.IDLE},!0),this.beaconPopper=null,this.tooltipPopper=null,this.listener=null,this.setSteps(r)}getState(){return this.store.size?{action:this.store.get("action")||"",controlled:this.store.get("controlled")||!1,index:parseInt(this.store.get("index"),10),lifecycle:this.store.get("lifecycle")||"",origin:this.store.get("origin")||null,size:this.store.get("size")||0,status:this.store.get("status")||""}:{...go}}getNextState(e,t=!1){var n,r,o,i,s;const{action:a,controlled:l,index:u,size:f,status:c}=this.getState(),d=x.number(e.index)?e.index:u,p=l&&!t?u:Math.min(Math.max(d,0),f);return{action:(n=e.action)!=null?n:a,controlled:l,index:p,lifecycle:(r=e.lifecycle)!=null?r:A.INIT,origin:(o=e.origin)!=null?o:null,size:(i=e.size)!=null?i:f,status:p===f?L.FINISHED:(s=e.status)!=null?s:c}}getSteps(){const e=this.data.get("steps");return Array.isArray(e)?e:[]}hasUpdatedState(e){const t=JSON.stringify(e),n=JSON.stringify(this.getState());return t!==n}setState(e,t=!1){const n=this.getState(),{action:r,index:o,lifecycle:i,origin:s=null,size:a,status:l}={...n,...e};this.store.set("action",r),this.store.set("index",o),this.store.set("lifecycle",i),this.store.set("origin",s),this.store.set("size",a),this.store.set("status",l),t&&(this.store.set("controlled",e.controlled),this.store.set("continuous",e.continuous)),this.listener&&this.hasUpdatedState(n)&&this.listener(this.getState())}getHelpers(){return{close:this.close,go:this.go,info:this.info,next:this.next,open:this.open,prev:this.prev,reset:this.reset,skip:this.skip}}};function _l(e){return new Al(e)}function Fl({styles:e}){return b.createElement("div",{key:"JoyrideSpotlight",className:"react-joyride__spotlight","data-test-id":"spotlight",style:e})}var jl=Fl,Bl=class extends b.Component{constructor(){super(...arguments),N(this,"isActive",!1),N(this,"resizeTimeout"),N(this,"scrollTimeout"),N(this,"scrollParent"),N(this,"state",{isScrolling:!1,mouseOverSpotlight:!1,showSpotlight:!0}),N(this,"hideSpotlight",()=>{const{continuous:e,disableOverlay:t,lifecycle:n}=this.props,r=[A.INIT,A.BEACON,A.COMPLETE,A.ERROR];return t||(e?r.includes(n):n!==A.TOOLTIP)}),N(this,"handleMouseMove",e=>{const{mouseOverSpotlight:t}=this.state,{height:n,left:r,position:o,top:i,width:s}=this.spotlightStyles,a=o==="fixed"?e.clientY:e.pageY,l=o==="fixed"?e.clientX:e.pageX,u=a>=i&&a<=i+n,c=l>=r&&l<=r+s&&u;c!==t&&this.updateState({mouseOverSpotlight:c})}),N(this,"handleScroll",()=>{const{target:e}=this.props,t=De(e);if(this.scrollParent!==document){const{isScrolling:n}=this.state;n||this.updateState({isScrolling:!0,showSpotlight:!1}),clearTimeout(this.scrollTimeout),this.scrollTimeout=window.setTimeout(()=>{this.updateState({isScrolling:!1,showSpotlight:!0})},50)}else et(t,"sticky")&&this.updateState({})}),N(this,"handleResize",()=>{clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(()=>{this.isActive&&this.forceUpdate()},100)})}componentDidMount(){const{debug:e,disableScrolling:t,disableScrollParentFix:n=!1,target:r}=this.props,o=De(r);this.scrollParent=vt(o??document.body,n,!0),this.isActive=!0,window.addEventListener("resize",this.handleResize)}componentDidUpdate(e){var t;const{disableScrollParentFix:n,lifecycle:r,spotlightClicks:o,target:i}=this.props,{changed:s}=Rt(e,this.props);if(s("target")||s("disableScrollParentFix")){const a=De(i);this.scrollParent=vt(a??document.body,n,!0)}s("lifecycle",A.TOOLTIP)&&((t=this.scrollParent)==null||t.addEventListener("scroll",this.handleScroll,{passive:!0}),setTimeout(()=>{const{isScrolling:a}=this.state;a||this.updateState({showSpotlight:!0})},100)),(s("spotlightClicks")||s("disableOverlay")||s("lifecycle"))&&(o&&r===A.TOOLTIP?window.addEventListener("mousemove",this.handleMouseMove,!1):r!==A.TOOLTIP&&window.removeEventListener("mousemove",this.handleMouseMove))}componentWillUnmount(){var e;this.isActive=!1,window.removeEventListener("mousemove",this.handleMouseMove),window.removeEventListener("resize",this.handleResize),clearTimeout(this.resizeTimeout),clearTimeout(this.scrollTimeout),(e=this.scrollParent)==null||e.removeEventListener("scroll",this.handleScroll)}get overlayStyles(){const{mouseOverSpotlight:e}=this.state,{disableOverlayClose:t,placement:n,styles:r}=this.props;let o=r.overlay;return gr()&&(o=n==="center"?r.overlayLegacyCenter:r.overlayLegacy),{cursor:t?"default":"pointer",height:vl(),pointerEvents:e?"none":"auto",...o}}get spotlightStyles(){var e,t,n;const{showSpotlight:r}=this.state,{disableScrollParentFix:o=!1,spotlightClicks:i,spotlightPadding:s=0,styles:a,target:l}=this.props,u=De(l),f=po(u),c=et(u),d=Ol(u,s,o);return{...gr()?a.spotlightLegacy:a.spotlight,height:Math.round(((e=f?.height)!=null?e:0)+s*2),left:Math.round(((t=f?.left)!=null?t:0)-s),opacity:r?1:0,pointerEvents:i?"none":"auto",position:c?"fixed":"absolute",top:d,transition:"opacity 0.2s",width:Math.round(((n=f?.width)!=null?n:0)+s*2)}}updateState(e){this.isActive&&this.setState(t=>({...t,...e}))}render(){const{showSpotlight:e}=this.state,{onClickOverlay:t,placement:n}=this.props,{hideSpotlight:r,overlayStyles:o,spotlightStyles:i}=this;if(r())return null;let s=n!=="center"&&e&&b.createElement(jl,{styles:i});if(ho()==="safari"){const{mixBlendMode:a,zIndex:l,...u}=o;s=b.createElement("div",{style:{...u}},s),delete o.backgroundColor}return b.createElement("div",{className:"react-joyride__overlay","data-test-id":"overlay",onClick:t,role:"presentation",style:o},s)}},Ll=class extends b.Component{constructor(){super(...arguments),N(this,"node",null)}componentDidMount(){const{id:e}=this.props;_e()&&(this.node=document.createElement("div"),this.node.id=e,document.body.appendChild(this.node),ft||this.renderReact15())}componentDidUpdate(){_e()&&(ft||this.renderReact15())}componentWillUnmount(){!_e()||!this.node||(ft||Dt.unmountComponentAtNode(this.node),this.node.parentNode===document.body&&(document.body.removeChild(this.node),this.node=null))}renderReact15(){if(!_e())return;const{children:e}=this.props;this.node&&Dt.unstable_renderSubtreeIntoContainer(this,e,this.node)}renderReact16(){if(!_e()||!ft)return null;const{children:e}=this.props;return this.node?Dt.createPortal(e,this.node):null}render(){return ft?this.renderReact16():null}},$l=class{constructor(e,t){if(N(this,"element"),N(this,"options"),N(this,"canBeTabbed",n=>{const{tabIndex:r}=n;return r===null||r<0?!1:this.canHaveFocus(n)}),N(this,"canHaveFocus",n=>{const r=/input|select|textarea|button|object/,o=n.nodeName.toLowerCase();return(r.test(o)&&!n.getAttribute("disabled")||o==="a"&&!!n.getAttribute("href"))&&this.isVisible(n)}),N(this,"findValidTabElements",()=>[].slice.call(this.element.querySelectorAll("*"),0).filter(this.canBeTabbed)),N(this,"handleKeyDown",n=>{const{code:r="Tab"}=this.options;n.code===r&&this.interceptTab(n)}),N(this,"interceptTab",n=>{n.preventDefault();const r=this.findValidTabElements(),{shiftKey:o}=n;if(!r.length)return;let i=document.activeElement?r.indexOf(document.activeElement):0;i===-1||!o&&i+1===r.length?i=0:o&&i===0?i=r.length-1:i+=o?-1:1,r[i].focus()}),N(this,"isHidden",n=>{const r=n.offsetWidth<=0&&n.offsetHeight<=0,o=window.getComputedStyle(n);return r&&!n.innerHTML?!0:r&&o.getPropertyValue("overflow")!=="visible"||o.getPropertyValue("display")==="none"}),N(this,"isVisible",n=>{let r=n;for(;r;)if(r instanceof HTMLElement){if(r===document.body)break;if(this.isHidden(r))return!1;r=r.parentNode}return!0}),N(this,"removeScope",()=>{window.removeEventListener("keydown",this.handleKeyDown)}),N(this,"checkFocus",n=>{document.activeElement!==n&&(n.focus(),window.requestAnimationFrame(()=>this.checkFocus(n)))}),N(this,"setFocus",()=>{const{selector:n}=this.options;if(!n)return;const r=this.element.querySelector(n);r&&window.requestAnimationFrame(()=>this.checkFocus(r))}),!(e instanceof HTMLElement))throw new TypeError("Invalid parameter: element must be an HTMLElement");this.element=e,this.options=t,window.addEventListener("keydown",this.handleKeyDown,!1),this.setFocus()}},Hl=class extends b.Component{constructor(e){if(super(e),N(this,"beacon",null),N(this,"setBeaconRef",o=>{this.beacon=o}),e.beaconComponent)return;const t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.id="joyride-beacon-animation",e.nonce&&n.setAttribute("nonce",e.nonce),n.appendChild(document.createTextNode(` +import{k as fi,u as Ze,R as di,o as pi,O as hi,C as mi,r as mt}from"./radix-core-DyJi0yyw.js";import{r as b,j as yi,R as w,c as Nt,b as Dt}from"./router-9vIXuQkh.js";import{g as gt}from"./react-vendor-BmxF9s7Q.js";import{b as Vt,i as vi,a as ot,d as it,e as gi,f as st,g as pt,h as bi,j as wi,k as Oi,l as Si,m as Ei,n as ki,o as Ci,p as Ti,q as Mi,r as Pi,s as xi,t as Ni,u as Di,v as Ii,w as Wi,x as Ri,y as Ai,z as _i,A as Fi,B as ji,C as Bi,D as Li,E as $i,F as Hi,G as zi,H as Ui,I as Yi,J as qi,K as Gi,L as Vi,M as Ki}from"./utils-BqoaXoQ1.js";var jn=1,Zi=.9,Ji=.8,Xi=.17,Kt=.1,Zt=.999,Qi=.9999,es=.99,ts=/[\\\/_+.#"@\[\(\{&]/,ns=/[\\\/_+.#"@\[\(\{&]/g,rs=/[\s-]/,Nr=/[\s-]/g;function dn(e,t,n,r,o,i,s){if(i===t.length)return o===e.length?jn:es;var a=`${o},${i}`;if(s[a]!==void 0)return s[a];for(var l=r.charAt(i),u=n.indexOf(l,o),f=0,c,d,p,h;u>=0;)c=dn(e,t,n,r,u+1,i+1,s),c>f&&(u===o?c*=jn:ts.test(e.charAt(u-1))?(c*=Ji,p=e.slice(o,u-1).match(ns),p&&o>0&&(c*=Math.pow(Zt,p.length))):rs.test(e.charAt(u-1))?(c*=Zi,h=e.slice(o,u-1).match(Nr),h&&o>0&&(c*=Math.pow(Zt,h.length))):(c*=Xi,o>0&&(c*=Math.pow(Zt,u-o))),e.charAt(u)!==t.charAt(i)&&(c*=Qi)),(cc&&(c=d*Kt)),c>f&&(f=c),u=n.indexOf(l,u+1);return s[a]=f,f}function Bn(e){return e.toLowerCase().replace(Nr," ")}function os(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,dn(e,t,Bn(e),Bn(t),0,0,{})}var is=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Be=is.reduce((e,t)=>{const n=fi(`Primitive.${t}`),r=b.forwardRef((o,i)=>{const{asChild:s,...a}=o,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),yi.jsx(l,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),at='[cmdk-group=""]',Jt='[cmdk-group-items=""]',ss='[cmdk-group-heading=""]',Dr='[cmdk-item=""]',Ln=`${Dr}:not([aria-disabled="true"])`,pn="cmdk-item-select",Ve="data-value",as=(e,t,n)=>os(e,t,n),Ir=b.createContext(void 0),bt=()=>b.useContext(Ir),Wr=b.createContext(void 0),On=()=>b.useContext(Wr),Rr=b.createContext(void 0),Ar=b.forwardRef((e,t)=>{let n=Ke(()=>{var k,R;return{search:"",value:(R=(k=e.value)!=null?k:e.defaultValue)!=null?R:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Ke(()=>new Set),o=Ke(()=>new Map),i=Ke(()=>new Map),s=Ke(()=>new Set),a=_r(e),{label:l,children:u,value:f,onValueChange:c,filter:d,shouldFilter:p,loop:h,disablePointerSelection:v=!1,vimBindings:S=!0,...y}=e,m=Ze(),E=Ze(),M=Ze(),C=b.useRef(null),O=gs();ze(()=>{if(f!==void 0){let k=f.trim();n.current.value=k,D.emit()}},[f]),ze(()=>{O(6,fe)},[]);let D=b.useMemo(()=>({subscribe:k=>(s.current.add(k),()=>s.current.delete(k)),snapshot:()=>n.current,setState:(k,R,B)=>{var W,U,V,ne;if(!Object.is(n.current[k],R)){if(n.current[k]=R,k==="search")ue(),$(),O(1,oe);else if(k==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Q=document.getElementById(M);Q?Q.focus():(W=document.getElementById(m))==null||W.focus()}if(O(7,()=>{var Q;n.current.selectedItemId=(Q=X())==null?void 0:Q.id,D.emit()}),B||O(5,fe),((U=a.current)==null?void 0:U.value)!==void 0){let Q=R??"";(ne=(V=a.current).onValueChange)==null||ne.call(V,Q);return}}D.emit()}},emit:()=>{s.current.forEach(k=>k())}}),[]),j=b.useMemo(()=>({value:(k,R,B)=>{var W;R!==((W=i.current.get(k))==null?void 0:W.value)&&(i.current.set(k,{value:R,keywords:B}),n.current.filtered.items.set(k,Z(R,B)),O(2,()=>{$(),D.emit()}))},item:(k,R)=>(r.current.add(k),R&&(o.current.has(R)?o.current.get(R).add(k):o.current.set(R,new Set([k]))),O(3,()=>{ue(),$(),n.current.value||oe(),D.emit()}),()=>{i.current.delete(k),r.current.delete(k),n.current.filtered.items.delete(k);let B=X();O(4,()=>{ue(),B?.getAttribute("id")===k&&oe(),D.emit()})}),group:k=>(o.current.has(k)||o.current.set(k,new Set),()=>{i.current.delete(k),o.current.delete(k)}),filter:()=>a.current.shouldFilter,label:l||e["aria-label"],getDisablePointerSelection:()=>a.current.disablePointerSelection,listId:m,inputId:M,labelId:E,listInnerRef:C}),[]);function Z(k,R){var B,W;let U=(W=(B=a.current)==null?void 0:B.filter)!=null?W:as;return k?U(k,n.current.search,R):0}function $(){if(!n.current.search||a.current.shouldFilter===!1)return;let k=n.current.filtered.items,R=[];n.current.filtered.groups.forEach(W=>{let U=o.current.get(W),V=0;U.forEach(ne=>{let Q=k.get(ne);V=Math.max(Q,V)}),R.push([W,V])});let B=C.current;de().sort((W,U)=>{var V,ne;let Q=W.getAttribute("id"),xe=U.getAttribute("id");return((V=k.get(xe))!=null?V:0)-((ne=k.get(Q))!=null?ne:0)}).forEach(W=>{let U=W.closest(Jt);U?U.appendChild(W.parentElement===U?W:W.closest(`${Jt} > *`)):B.appendChild(W.parentElement===B?W:W.closest(`${Jt} > *`))}),R.sort((W,U)=>U[1]-W[1]).forEach(W=>{var U;let V=(U=C.current)==null?void 0:U.querySelector(`${at}[${Ve}="${encodeURIComponent(W[0])}"]`);V?.parentElement.appendChild(V)})}function oe(){let k=de().find(B=>B.getAttribute("aria-disabled")!=="true"),R=k?.getAttribute(Ve);D.setState("value",R||void 0)}function ue(){var k,R,B,W;if(!n.current.search||a.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let U=0;for(let V of r.current){let ne=(R=(k=i.current.get(V))==null?void 0:k.value)!=null?R:"",Q=(W=(B=i.current.get(V))==null?void 0:B.keywords)!=null?W:[],xe=Z(ne,Q);n.current.filtered.items.set(V,xe),xe>0&&U++}for(let[V,ne]of o.current)for(let Q of ne)if(n.current.filtered.items.get(Q)>0){n.current.filtered.groups.add(V);break}n.current.filtered.count=U}function fe(){var k,R,B;let W=X();W&&(((k=W.parentElement)==null?void 0:k.firstChild)===W&&((B=(R=W.closest(at))==null?void 0:R.querySelector(ss))==null||B.scrollIntoView({block:"nearest"})),W.scrollIntoView({block:"nearest"}))}function X(){var k;return(k=C.current)==null?void 0:k.querySelector(`${Dr}[aria-selected="true"]`)}function de(){var k;return Array.from(((k=C.current)==null?void 0:k.querySelectorAll(Ln))||[])}function Ae(k){let R=de()[k];R&&D.setState("value",R.getAttribute(Ve))}function Le(k){var R;let B=X(),W=de(),U=W.findIndex(ne=>ne===B),V=W[U+k];(R=a.current)!=null&&R.loop&&(V=U+k<0?W[W.length-1]:U+k===W.length?W[0]:W[U+k]),V&&D.setState("value",V.getAttribute(Ve))}function qe(k){let R=X(),B=R?.closest(at),W;for(;B&&!W;)B=k>0?ys(B,at):vs(B,at),W=B?.querySelector(Ln);W?D.setState("value",W.getAttribute(Ve)):Le(k)}let ie=()=>Ae(de().length-1),se=k=>{k.preventDefault(),k.metaKey?ie():k.altKey?qe(1):Le(1)},pe=k=>{k.preventDefault(),k.metaKey?Ae(0):k.altKey?qe(-1):Le(-1)};return b.createElement(Be.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:k=>{var R;(R=y.onKeyDown)==null||R.call(y,k);let B=k.nativeEvent.isComposing||k.keyCode===229;if(!(k.defaultPrevented||B))switch(k.key){case"n":case"j":{S&&k.ctrlKey&&se(k);break}case"ArrowDown":{se(k);break}case"p":case"k":{S&&k.ctrlKey&&pe(k);break}case"ArrowUp":{pe(k);break}case"Home":{k.preventDefault(),Ae(0);break}case"End":{k.preventDefault(),ie();break}case"Enter":{k.preventDefault();let W=X();if(W){let U=new Event(pn);W.dispatchEvent(U)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:j.inputId,id:j.labelId,style:ws},l),jt(e,k=>b.createElement(Wr.Provider,{value:D},b.createElement(Ir.Provider,{value:j},k))))}),ls=b.forwardRef((e,t)=>{var n,r;let o=Ze(),i=b.useRef(null),s=b.useContext(Rr),a=bt(),l=_r(e),u=(r=(n=l.current)==null?void 0:n.forceMount)!=null?r:s?.forceMount;ze(()=>{if(!u)return a.item(o,s?.id)},[u]);let f=Fr(o,i,[e.value,e.children,i],e.keywords),c=On(),d=Fe(O=>O.value&&O.value===f.current),p=Fe(O=>u||a.filter()===!1?!0:O.search?O.filtered.items.get(o)>0:!0);b.useEffect(()=>{let O=i.current;if(!(!O||e.disabled))return O.addEventListener(pn,h),()=>O.removeEventListener(pn,h)},[p,e.onSelect,e.disabled]);function h(){var O,D;v(),(D=(O=l.current).onSelect)==null||D.call(O,f.current)}function v(){c.setState("value",f.current,!0)}if(!p)return null;let{disabled:S,value:y,onSelect:m,forceMount:E,keywords:M,...C}=e;return b.createElement(Be.div,{ref:mt(i,t),...C,id:o,"cmdk-item":"",role:"option","aria-disabled":!!S,"aria-selected":!!d,"data-disabled":!!S,"data-selected":!!d,onPointerMove:S||a.getDisablePointerSelection()?void 0:v,onClick:S?void 0:h},e.children)}),cs=b.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:o,...i}=e,s=Ze(),a=b.useRef(null),l=b.useRef(null),u=Ze(),f=bt(),c=Fe(p=>o||f.filter()===!1?!0:p.search?p.filtered.groups.has(s):!0);ze(()=>f.group(s),[]),Fr(s,a,[e.value,e.heading,l]);let d=b.useMemo(()=>({id:s,forceMount:o}),[o]);return b.createElement(Be.div,{ref:mt(a,t),...i,"cmdk-group":"",role:"presentation",hidden:c?void 0:!0},n&&b.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:u},n),jt(e,p=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},b.createElement(Rr.Provider,{value:d},p))))}),us=b.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,o=b.useRef(null),i=Fe(s=>!s.search);return!n&&!i?null:b.createElement(Be.div,{ref:mt(o,t),...r,"cmdk-separator":"",role:"separator"})}),fs=b.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,o=e.value!=null,i=On(),s=Fe(u=>u.search),a=Fe(u=>u.selectedItemId),l=bt();return b.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),b.createElement(Be.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":a,id:l.inputId,type:"text",value:o?e.value:s,onChange:u=>{o||i.setState("search",u.target.value),n?.(u.target.value)}})}),ds=b.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...o}=e,i=b.useRef(null),s=b.useRef(null),a=Fe(u=>u.selectedItemId),l=bt();return b.useEffect(()=>{if(s.current&&i.current){let u=s.current,f=i.current,c,d=new ResizeObserver(()=>{c=requestAnimationFrame(()=>{let p=u.offsetHeight;f.style.setProperty("--cmdk-list-height",p.toFixed(1)+"px")})});return d.observe(u),()=>{cancelAnimationFrame(c),d.unobserve(u)}}},[]),b.createElement(Be.div,{ref:mt(i,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":a,"aria-label":r,id:l.listId},jt(e,u=>b.createElement("div",{ref:mt(s,l.listInnerRef),"cmdk-list-sizer":""},u)))}),ps=b.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:o,contentClassName:i,container:s,...a}=e;return b.createElement(di,{open:n,onOpenChange:r},b.createElement(pi,{container:s},b.createElement(hi,{"cmdk-overlay":"",className:o}),b.createElement(mi,{"aria-label":e.label,"cmdk-dialog":"",className:i},b.createElement(Ar,{ref:t,...a}))))}),hs=b.forwardRef((e,t)=>Fe(n=>n.filtered.count===0)?b.createElement(Be.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),ms=b.forwardRef((e,t)=>{let{progress:n,children:r,label:o="Loading...",...i}=e;return b.createElement(Be.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},jt(e,s=>b.createElement("div",{"aria-hidden":!0},s)))}),nf=Object.assign(Ar,{List:ds,Item:ls,Input:fs,Group:cs,Separator:us,Dialog:ps,Empty:hs,Loading:ms});function ys(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function vs(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function _r(e){let t=b.useRef(e);return ze(()=>{t.current=e}),t}var ze=typeof window>"u"?b.useEffect:b.useLayoutEffect;function Ke(e){let t=b.useRef();return t.current===void 0&&(t.current=e()),t}function Fe(e){let t=On(),n=()=>e(t.snapshot());return b.useSyncExternalStore(t.subscribe,n,n)}function Fr(e,t,n,r=[]){let o=b.useRef(),i=bt();return ze(()=>{var s;let a=(()=>{var u;for(let f of n){if(typeof f=="string")return f.trim();if(typeof f=="object"&&"current"in f)return f.current?(u=f.current.textContent)==null?void 0:u.trim():o.current}})(),l=r.map(u=>u.trim());i.value(e,a,l),(s=t.current)==null||s.setAttribute(Ve,a),o.current=a}),o}var gs=()=>{let[e,t]=b.useState(),n=Ke(()=>new Map);return ze(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,o)=>{n.current.set(r,o),t({})}};function bs(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function jt({asChild:e,children:t},n){return e&&b.isValidElement(t)?b.cloneElement(bs(t),{ref:t.ref},n(t.props.children)):n(t)}var ws={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function jr(e){return t=>typeof t===e}var Os=jr("function"),Ss=e=>e===null,$n=e=>Object.prototype.toString.call(e).slice(8,-1)==="RegExp",Hn=e=>!Es(e)&&!Ss(e)&&(Os(e)||typeof e=="object"),Es=jr("undefined");function ks(e,t){const{length:n}=e;if(n!==t.length)return!1;for(let r=n;r--!==0;)if(!re(e[r],t[r]))return!1;return!0}function Cs(e,t){if(e.byteLength!==t.byteLength)return!1;const n=new DataView(e.buffer),r=new DataView(t.buffer);let o=e.byteLength;for(;o--;)if(n.getUint8(o)!==r.getUint8(o))return!1;return!0}function Ts(e,t){if(e.size!==t.size)return!1;for(const n of e.entries())if(!t.has(n[0]))return!1;for(const n of e.entries())if(!re(n[1],t.get(n[0])))return!1;return!0}function Ms(e,t){if(e.size!==t.size)return!1;for(const n of e.entries())if(!t.has(n[0]))return!1;return!0}function re(e,t){if(e===t)return!0;if(e&&Hn(e)&&t&&Hn(t)){if(e.constructor!==t.constructor)return!1;if(Array.isArray(e)&&Array.isArray(t))return ks(e,t);if(e instanceof Map&&t instanceof Map)return Ts(e,t);if(e instanceof Set&&t instanceof Set)return Ms(e,t);if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t))return Cs(e,t);if($n(e)&&$n(t))return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let o=n.length;o--!==0;)if(!Object.prototype.hasOwnProperty.call(t,n[o]))return!1;for(let o=n.length;o--!==0;){const i=n[o];if(!(i==="_owner"&&e.$$typeof)&&!re(e[i],t[i]))return!1}return!0}return Number.isNaN(e)&&Number.isNaN(t)?!0:e===t}var Ps=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","WeakMap","WeakSet"],xs=["bigint","boolean","null","number","string","symbol","undefined"];function Bt(e){const t=Object.prototype.toString.call(e).slice(8,-1);if(/HTML\w+Element/.test(t))return"HTMLElement";if(Ns(t))return t}function be(e){return t=>Bt(t)===e}function Ns(e){return Ps.includes(e)}function tt(e){return t=>typeof t===e}function Ds(e){return xs.includes(e)}var Is=["innerHTML","ownerDocument","style","attributes","nodeValue"];function P(e){if(e===null)return"null";switch(typeof e){case"bigint":return"bigint";case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"symbol":return"symbol";case"undefined":return"undefined"}if(P.array(e))return"Array";if(P.plainFunction(e))return"Function";const t=Bt(e);return t||"Object"}P.array=Array.isArray;P.arrayOf=(e,t)=>!P.array(e)&&!P.function(t)?!1:e.every(n=>t(n));P.asyncGeneratorFunction=e=>Bt(e)==="AsyncGeneratorFunction";P.asyncFunction=be("AsyncFunction");P.bigint=tt("bigint");P.boolean=e=>e===!0||e===!1;P.date=be("Date");P.defined=e=>!P.undefined(e);P.domElement=e=>P.object(e)&&!P.plainObject(e)&&e.nodeType===1&&P.string(e.nodeName)&&Is.every(t=>t in e);P.empty=e=>P.string(e)&&e.length===0||P.array(e)&&e.length===0||P.object(e)&&!P.map(e)&&!P.set(e)&&Object.keys(e).length===0||P.set(e)&&e.size===0||P.map(e)&&e.size===0;P.error=be("Error");P.function=tt("function");P.generator=e=>P.iterable(e)&&P.function(e.next)&&P.function(e.throw);P.generatorFunction=be("GeneratorFunction");P.instanceOf=(e,t)=>!e||!t?!1:Object.getPrototypeOf(e)===t.prototype;P.iterable=e=>!P.nullOrUndefined(e)&&P.function(e[Symbol.iterator]);P.map=be("Map");P.nan=e=>Number.isNaN(e);P.null=e=>e===null;P.nullOrUndefined=e=>P.null(e)||P.undefined(e);P.number=e=>tt("number")(e)&&!P.nan(e);P.numericString=e=>P.string(e)&&e.length>0&&!Number.isNaN(Number(e));P.object=e=>!P.nullOrUndefined(e)&&(P.function(e)||typeof e=="object");P.oneOf=(e,t)=>P.array(e)?e.indexOf(t)>-1:!1;P.plainFunction=be("Function");P.plainObject=e=>{if(Bt(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})};P.primitive=e=>P.null(e)||Ds(typeof e);P.promise=be("Promise");P.propertyOf=(e,t,n)=>{if(!P.object(e)||!t)return!1;const r=e[t];return P.function(n)?n(r):P.defined(r)};P.regexp=be("RegExp");P.set=be("Set");P.string=tt("string");P.symbol=tt("symbol");P.undefined=tt("undefined");P.weakMap=be("WeakMap");P.weakSet=be("WeakSet");var x=P;function Ws(...e){return e.every(t=>x.string(t)||x.array(t)||x.plainObject(t))}function Rs(e,t,n){return Br(e,t)?[e,t].every(x.array)?!e.some(Gn(n))&&t.some(Gn(n)):[e,t].every(x.plainObject)?!Object.entries(e).some(qn(n))&&Object.entries(t).some(qn(n)):t===n:!1}function zn(e,t,n){const{actual:r,key:o,previous:i,type:s}=n,a=Ce(e,o),l=Ce(t,o);let u=[a,l].every(x.number)&&(s==="increased"?al);return x.undefined(r)||(u=u&&l===r),x.undefined(i)||(u=u&&a===i),u}function Un(e,t,n){const{key:r,type:o,value:i}=n,s=Ce(e,r),a=Ce(t,r),l=o==="added"?s:a,u=o==="added"?a:s;if(!x.nullOrUndefined(i)){if(x.defined(l)){if(x.array(l)||x.plainObject(l))return Rs(l,u,i)}else return re(u,i);return!1}return[s,a].every(x.array)?!u.every(Sn(l)):[s,a].every(x.plainObject)?As(Object.keys(l),Object.keys(u)):![s,a].every(f=>x.primitive(f)&&x.defined(f))&&(o==="added"?!x.defined(s)&&x.defined(a):x.defined(s)&&!x.defined(a))}function Yn(e,t,{key:n}={}){let r=Ce(e,n),o=Ce(t,n);if(!Br(r,o))throw new TypeError("Inputs have different types");if(!Ws(r,o))throw new TypeError("Inputs don't have length");return[r,o].every(x.plainObject)&&(r=Object.keys(r),o=Object.keys(o)),[r,o]}function qn(e){return([t,n])=>x.array(e)?re(e,n)||e.some(r=>re(r,n)||x.array(n)&&Sn(n)(r)):x.plainObject(e)&&e[t]?!!e[t]&&re(e[t],n):re(e,n)}function As(e,t){return t.some(n=>!e.includes(n))}function Gn(e){return t=>x.array(e)?e.some(n=>re(n,t)||x.array(t)&&Sn(t)(n)):re(e,t)}function lt(e,t){return x.array(e)?e.some(n=>re(n,t)):re(e,t)}function Sn(e){return t=>e.some(n=>re(n,t))}function Br(...e){return e.every(x.array)||e.every(x.number)||e.every(x.plainObject)||e.every(x.string)}function Ce(e,t){return x.plainObject(e)||x.array(e)?x.string(t)?t.split(".").reduce((r,o)=>r&&r[o],e):x.number(t)?e[t]:e:e}function Rt(e,t){if([e,t].some(x.nullOrUndefined))throw new Error("Missing required parameters");if(![e,t].every(f=>x.plainObject(f)||x.array(f)))throw new Error("Expected plain objects or array");return{added:(f,c)=>{try{return Un(e,t,{key:f,type:"added",value:c})}catch{return!1}},changed:(f,c,d)=>{try{const p=Ce(e,f),h=Ce(t,f),v=x.defined(c),S=x.defined(d);if(v||S){const y=S?lt(d,p):!lt(c,p),m=lt(c,h);return y&&m}return[p,h].every(x.array)||[p,h].every(x.plainObject)?!re(p,h):p!==h}catch{return!1}},changedFrom:(f,c,d)=>{if(!x.defined(f))return!1;try{const p=Ce(e,f),h=Ce(t,f),v=x.defined(d);return lt(c,p)&&(v?lt(d,h):!v)}catch{return!1}},decreased:(f,c,d)=>{if(!x.defined(f))return!1;try{return zn(e,t,{key:f,actual:c,previous:d,type:"decreased"})}catch{return!1}},emptied:f=>{try{const[c,d]=Yn(e,t,{key:f});return!!c.length&&!d.length}catch{return!1}},filled:f=>{try{const[c,d]=Yn(e,t,{key:f});return!c.length&&!!d.length}catch{return!1}},increased:(f,c,d)=>{if(!x.defined(f))return!1;try{return zn(e,t,{key:f,actual:c,previous:d,type:"increased"})}catch{return!1}},removed:(f,c)=>{try{return Un(e,t,{key:f,type:"removed",value:c})}catch{return!1}}}}var Xt,Vn;function _s(){if(Vn)return Xt;Vn=1;var e=new Error("Element already at target scroll position"),t=new Error("Scroll cancelled"),n=Math.min,r=Date.now;Xt={left:o("scrollLeft"),top:o("scrollTop")};function o(a){return function(u,f,c,d){c=c||{},typeof c=="function"&&(d=c,c={}),typeof d!="function"&&(d=s);var p=r(),h=u[a],v=c.ease||i,S=isNaN(c.duration)?350:+c.duration,y=!1;return h===f?d(e,u[a]):requestAnimationFrame(E),m;function m(){y=!0}function E(M){if(y)return d(t,u[a]);var C=r(),O=n(1,(C-p)/S),D=v(O);u[a]=D*(f-h)+h,O<1?requestAnimationFrame(E):requestAnimationFrame(function(){d(null,u[a])})}}}function i(a){return .5*(1-Math.cos(Math.PI*a))}function s(){}return Xt}var Fs=_s();const js=gt(Fs);var It={exports:{}},Bs=It.exports,Kn;function Ls(){return Kn||(Kn=1,(function(e){(function(t,n){e.exports?e.exports=n():t.Scrollparent=n()})(Bs,function(){function t(r){var o=getComputedStyle(r,null).getPropertyValue("overflow");return o.indexOf("scroll")>-1||o.indexOf("auto")>-1}function n(r){if(r instanceof HTMLElement||r instanceof SVGElement){for(var o=r.parentNode;o.parentNode;){if(t(o))return o;o=o.parentNode}return document.scrollingElement||document.documentElement}}return n})})(It)),It.exports}var $s=Ls();const Lr=gt($s);var Qt,Zn;function Hs(){if(Zn)return Qt;Zn=1;var e=function(r){return Object.prototype.hasOwnProperty.call(r,"props")},t=function(r,o){return r+n(o)},n=function(r){return r===null||typeof r=="boolean"||typeof r>"u"?"":typeof r=="number"?r.toString():typeof r=="string"?r:Array.isArray(r)?r.reduce(t,""):e(r)&&Object.prototype.hasOwnProperty.call(r.props,"children")?n(r.props.children):""};return n.default=n,Qt=n,Qt}var zs=Hs();const Jn=gt(zs);var en,Xn;function Us(){if(Xn)return en;Xn=1;var e=function(m){return t(m)&&!n(m)};function t(y){return!!y&&typeof y=="object"}function n(y){var m=Object.prototype.toString.call(y);return m==="[object RegExp]"||m==="[object Date]"||i(y)}var r=typeof Symbol=="function"&&Symbol.for,o=r?Symbol.for("react.element"):60103;function i(y){return y.$$typeof===o}function s(y){return Array.isArray(y)?[]:{}}function a(y,m){return m.clone!==!1&&m.isMergeableObject(y)?v(s(y),y,m):y}function l(y,m,E){return y.concat(m).map(function(M){return a(M,E)})}function u(y,m){if(!m.customMerge)return v;var E=m.customMerge(y);return typeof E=="function"?E:v}function f(y){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(y).filter(function(m){return Object.propertyIsEnumerable.call(y,m)}):[]}function c(y){return Object.keys(y).concat(f(y))}function d(y,m){try{return m in y}catch{return!1}}function p(y,m){return d(y,m)&&!(Object.hasOwnProperty.call(y,m)&&Object.propertyIsEnumerable.call(y,m))}function h(y,m,E){var M={};return E.isMergeableObject(y)&&c(y).forEach(function(C){M[C]=a(y[C],E)}),c(m).forEach(function(C){p(y,C)||(d(y,C)&&E.isMergeableObject(m[C])?M[C]=u(C,E)(y[C],m[C],E):M[C]=a(m[C],E))}),M}function v(y,m,E){E=E||{},E.arrayMerge=E.arrayMerge||l,E.isMergeableObject=E.isMergeableObject||e,E.cloneUnlessOtherwiseSpecified=a;var M=Array.isArray(m),C=Array.isArray(y),O=M===C;return O?M?E.arrayMerge(y,m,E):h(y,m,E):a(m,E)}v.all=function(m,E){if(!Array.isArray(m))throw new Error("first argument should be an array");return m.reduce(function(M,C){return v(M,C,E)},{})};var S=v;return en=S,en}var Ys=Us();const ve=gt(Ys);var tn={exports:{}},nn,Qn;function qs(){if(Qn)return nn;Qn=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return nn=e,nn}var rn,er;function Gs(){if(er)return rn;er=1;var e=qs();function t(){}function n(){}return n.resetWarningCache=t,rn=function(){function r(s,a,l,u,f,c){if(c!==e){var d=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw d.name="Invariant Violation",d}}r.isRequired=r;function o(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},rn}var tr;function Vs(){return tr||(tr=1,tn.exports=Gs()()),tn.exports}var Ks=Vs();const T=gt(Ks);var wt=typeof window<"u"&&typeof document<"u"&&typeof navigator<"u",Zs=(function(){for(var e=["Edge","Trident","Firefox"],t=0;t=0)return 1;return 0})();function Js(e){var t=!1;return function(){t||(t=!0,window.Promise.resolve().then(function(){t=!1,e()}))}}function Xs(e){var t=!1;return function(){t||(t=!0,setTimeout(function(){t=!1,e()},Zs))}}var Qs=wt&&window.Promise,ea=Qs?Js:Xs;function $r(e){var t={};return e&&t.toString.call(e)==="[object Function]"}function Ye(e,t){if(e.nodeType!==1)return[];var n=e.ownerDocument.defaultView,r=n.getComputedStyle(e,null);return t?r[t]:r}function En(e){return e.nodeName==="HTML"?e:e.parentNode||e.host}function Ot(e){if(!e)return document.body;switch(e.nodeName){case"HTML":case"BODY":return e.ownerDocument.body;case"#document":return e.body}var t=Ye(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/(auto|scroll|overlay)/.test(n+o+r)?e:Ot(En(e))}function Hr(e){return e&&e.referenceNode?e.referenceNode:e}var nr=wt&&!!(window.MSInputMethodContext&&document.documentMode),rr=wt&&/MSIE 10/.test(navigator.userAgent);function nt(e){return e===11?nr:e===10?rr:nr||rr}function Je(e){if(!e)return document.documentElement;for(var t=nt(10)?document.body:null,n=e.offsetParent||null;n===t&&e.nextElementSibling;)n=(e=e.nextElementSibling).offsetParent;var r=n&&n.nodeName;return!r||r==="BODY"||r==="HTML"?e?e.ownerDocument.documentElement:document.documentElement:["TH","TD","TABLE"].indexOf(n.nodeName)!==-1&&Ye(n,"position")==="static"?Je(n):n}function ta(e){var t=e.nodeName;return t==="BODY"?!1:t==="HTML"||Je(e.firstElementChild)===e}function hn(e){return e.parentNode!==null?hn(e.parentNode):e}function At(e,t){if(!e||!e.nodeType||!t||!t.nodeType)return document.documentElement;var n=e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING,r=n?e:t,o=n?t:e,i=document.createRange();i.setStart(r,0),i.setEnd(o,0);var s=i.commonAncestorContainer;if(e!==s&&t!==s||r.contains(o))return ta(s)?s:Je(s);var a=hn(e);return a.host?At(a.host,t):At(e,hn(t).host)}function Xe(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"top",n=t==="top"?"scrollTop":"scrollLeft",r=e.nodeName;if(r==="BODY"||r==="HTML"){var o=e.ownerDocument.documentElement,i=e.ownerDocument.scrollingElement||o;return i[n]}return e[n]}function na(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=Xe(t,"top"),o=Xe(t,"left"),i=n?-1:1;return e.top+=r*i,e.bottom+=r*i,e.left+=o*i,e.right+=o*i,e}function or(e,t){var n=t==="x"?"Left":"Top",r=n==="Left"?"Right":"Bottom";return parseFloat(e["border"+n+"Width"])+parseFloat(e["border"+r+"Width"])}function ir(e,t,n,r){return Math.max(t["offset"+e],t["scroll"+e],n["client"+e],n["offset"+e],n["scroll"+e],nt(10)?parseInt(n["offset"+e])+parseInt(r["margin"+(e==="Height"?"Top":"Left")])+parseInt(r["margin"+(e==="Height"?"Bottom":"Right")]):0)}function zr(e){var t=e.body,n=e.documentElement,r=nt(10)&&getComputedStyle(n);return{height:ir("Height",t,n,r),width:ir("Width",t,n,r)}}var ra=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},oa=(function(){function e(t,n){for(var r=0;r2&&arguments[2]!==void 0?arguments[2]:!1,r=nt(10),o=t.nodeName==="HTML",i=mn(e),s=mn(t),a=Ot(e),l=Ye(t),u=parseFloat(l.borderTopWidth),f=parseFloat(l.borderLeftWidth);n&&o&&(s.top=Math.max(s.top,0),s.left=Math.max(s.left,0));var c=je({top:i.top-s.top-u,left:i.left-s.left-f,width:i.width,height:i.height});if(c.marginTop=0,c.marginLeft=0,!r&&o){var d=parseFloat(l.marginTop),p=parseFloat(l.marginLeft);c.top-=u-d,c.bottom-=u-d,c.left-=f-p,c.right-=f-p,c.marginTop=d,c.marginLeft=p}return(r&&!n?t.contains(a):t===a&&a.nodeName!=="BODY")&&(c=na(c,t)),c}function ia(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=e.ownerDocument.documentElement,r=kn(e,n),o=Math.max(n.clientWidth,window.innerWidth||0),i=Math.max(n.clientHeight,window.innerHeight||0),s=t?0:Xe(n),a=t?0:Xe(n,"left"),l={top:s-r.top+r.marginTop,left:a-r.left+r.marginLeft,width:o,height:i};return je(l)}function Ur(e){var t=e.nodeName;if(t==="BODY"||t==="HTML")return!1;if(Ye(e,"position")==="fixed")return!0;var n=En(e);return n?Ur(n):!1}function Yr(e){if(!e||!e.parentElement||nt())return document.documentElement;for(var t=e.parentElement;t&&Ye(t,"transform")==="none";)t=t.parentElement;return t||document.documentElement}function Cn(e,t,n,r){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1,i={top:0,left:0},s=o?Yr(e):At(e,Hr(t));if(r==="viewport")i=ia(s,o);else{var a=void 0;r==="scrollParent"?(a=Ot(En(t)),a.nodeName==="BODY"&&(a=e.ownerDocument.documentElement)):r==="window"?a=e.ownerDocument.documentElement:a=r;var l=kn(a,s,o);if(a.nodeName==="HTML"&&!Ur(s)){var u=zr(e.ownerDocument),f=u.height,c=u.width;i.top+=l.top-l.marginTop,i.bottom=f+l.top,i.left+=l.left-l.marginLeft,i.right=c+l.left}else i=l}n=n||0;var d=typeof n=="number";return i.left+=d?n:n.left||0,i.top+=d?n:n.top||0,i.right-=d?n:n.right||0,i.bottom-=d?n:n.bottom||0,i}function sa(e){var t=e.width,n=e.height;return t*n}function qr(e,t,n,r,o){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0;if(e.indexOf("auto")===-1)return e;var s=Cn(n,r,i,o),a={top:{width:s.width,height:t.top-s.top},right:{width:s.right-t.right,height:s.height},bottom:{width:s.width,height:s.bottom-t.bottom},left:{width:t.left-s.left,height:s.height}},l=Object.keys(a).map(function(d){return he({key:d},a[d],{area:sa(a[d])})}).sort(function(d,p){return p.area-d.area}),u=l.filter(function(d){var p=d.width,h=d.height;return p>=n.clientWidth&&h>=n.clientHeight}),f=u.length>0?u[0].key:l[0].key,c=e.split("-")[1];return f+(c?"-"+c:"")}function Gr(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,o=r?Yr(t):At(t,Hr(n));return kn(n,o,r)}function Vr(e){var t=e.ownerDocument.defaultView,n=t.getComputedStyle(e),r=parseFloat(n.marginTop||0)+parseFloat(n.marginBottom||0),o=parseFloat(n.marginLeft||0)+parseFloat(n.marginRight||0),i={width:e.offsetWidth+o,height:e.offsetHeight+r};return i}function _t(e){var t={left:"right",right:"left",bottom:"top",top:"bottom"};return e.replace(/left|right|bottom|top/g,function(n){return t[n]})}function Kr(e,t,n){n=n.split("-")[0];var r=Vr(e),o={width:r.width,height:r.height},i=["right","left"].indexOf(n)!==-1,s=i?"top":"left",a=i?"left":"top",l=i?"height":"width",u=i?"width":"height";return o[s]=t[s]+t[l]/2-r[l]/2,n===a?o[a]=t[a]-r[u]:o[a]=t[_t(a)],o}function St(e,t){return Array.prototype.find?e.find(t):e.filter(t)[0]}function aa(e,t,n){if(Array.prototype.findIndex)return e.findIndex(function(o){return o[t]===n});var r=St(e,function(o){return o[t]===n});return e.indexOf(r)}function Zr(e,t,n){var r=n===void 0?e:e.slice(0,aa(e,"name",n));return r.forEach(function(o){o.function&&console.warn("`modifier.function` is deprecated, use `modifier.fn`!");var i=o.function||o.fn;o.enabled&&$r(i)&&(t.offsets.popper=je(t.offsets.popper),t.offsets.reference=je(t.offsets.reference),t=i(t,o))}),t}function la(){if(!this.state.isDestroyed){var e={instance:this,styles:{},arrowStyles:{},attributes:{},flipped:!1,offsets:{}};e.offsets.reference=Gr(this.state,this.popper,this.reference,this.options.positionFixed),e.placement=qr(this.options.placement,e.offsets.reference,this.popper,this.reference,this.options.modifiers.flip.boundariesElement,this.options.modifiers.flip.padding),e.originalPlacement=e.placement,e.positionFixed=this.options.positionFixed,e.offsets.popper=Kr(this.popper,e.offsets.reference,e.placement),e.offsets.popper.position=this.options.positionFixed?"fixed":"absolute",e=Zr(this.modifiers,e),this.state.isCreated?this.options.onUpdate(e):(this.state.isCreated=!0,this.options.onCreate(e))}}function Jr(e,t){return e.some(function(n){var r=n.name,o=n.enabled;return o&&r===t})}function Tn(e){for(var t=[!1,"ms","Webkit","Moz","O"],n=e.charAt(0).toUpperCase()+e.slice(1),r=0;rs[p]&&(e.offsets.popper[c]+=a[c]+h-s[p]),e.offsets.popper=je(e.offsets.popper);var v=a[c]+a[u]/2-h/2,S=Ye(e.instance.popper),y=parseFloat(S["margin"+f]),m=parseFloat(S["border"+f+"Width"]),E=v-e.offsets.popper[c]-y-m;return E=Math.max(Math.min(s[u]-h,E),0),e.arrowElement=r,e.offsets.arrow=(n={},Qe(n,c,Math.round(E)),Qe(n,d,""),n),e}function Oa(e){return e==="end"?"start":e==="start"?"end":e}var to=["auto-start","auto","auto-end","top-start","top","top-end","right-start","right","right-end","bottom-end","bottom","bottom-start","left-end","left","left-start"],on=to.slice(3);function sr(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=on.indexOf(e),r=on.slice(n+1).concat(on.slice(0,n));return t?r.reverse():r}var sn={FLIP:"flip",CLOCKWISE:"clockwise",COUNTERCLOCKWISE:"counterclockwise"};function Sa(e,t){if(Jr(e.instance.modifiers,"inner")||e.flipped&&e.placement===e.originalPlacement)return e;var n=Cn(e.instance.popper,e.instance.reference,t.padding,t.boundariesElement,e.positionFixed),r=e.placement.split("-")[0],o=_t(r),i=e.placement.split("-")[1]||"",s=[];switch(t.behavior){case sn.FLIP:s=[r,o];break;case sn.CLOCKWISE:s=sr(r);break;case sn.COUNTERCLOCKWISE:s=sr(r,!0);break;default:s=t.behavior}return s.forEach(function(a,l){if(r!==a||s.length===l+1)return e;r=e.placement.split("-")[0],o=_t(r);var u=e.offsets.popper,f=e.offsets.reference,c=Math.floor,d=r==="left"&&c(u.right)>c(f.left)||r==="right"&&c(u.left)c(f.top)||r==="bottom"&&c(u.top)c(n.right),v=c(u.top)c(n.bottom),y=r==="left"&&p||r==="right"&&h||r==="top"&&v||r==="bottom"&&S,m=["top","bottom"].indexOf(r)!==-1,E=!!t.flipVariations&&(m&&i==="start"&&p||m&&i==="end"&&h||!m&&i==="start"&&v||!m&&i==="end"&&S),M=!!t.flipVariationsByContent&&(m&&i==="start"&&h||m&&i==="end"&&p||!m&&i==="start"&&S||!m&&i==="end"&&v),C=E||M;(d||y||C)&&(e.flipped=!0,(d||y)&&(r=s[l+1]),C&&(i=Oa(i)),e.placement=r+(i?"-"+i:""),e.offsets.popper=he({},e.offsets.popper,Kr(e.instance.popper,e.offsets.reference,e.placement)),e=Zr(e.instance.modifiers,e,"flip"))}),e}function Ea(e){var t=e.offsets,n=t.popper,r=t.reference,o=e.placement.split("-")[0],i=Math.floor,s=["top","bottom"].indexOf(o)!==-1,a=s?"right":"bottom",l=s?"left":"top",u=s?"width":"height";return n[a]i(r[a])&&(e.offsets.popper[l]=i(r[a])),e}function ka(e,t,n,r){var o=e.match(/((?:\-|\+)?\d*\.?\d*)(.*)/),i=+o[1],s=o[2];if(!i)return e;if(s.indexOf("%")===0){var a=void 0;switch(s){case"%p":a=n;break;case"%":case"%r":default:a=r}var l=je(a);return l[t]/100*i}else if(s==="vh"||s==="vw"){var u=void 0;return s==="vh"?u=Math.max(document.documentElement.clientHeight,window.innerHeight||0):u=Math.max(document.documentElement.clientWidth,window.innerWidth||0),u/100*i}else return i}function Ca(e,t,n,r){var o=[0,0],i=["right","left"].indexOf(r)!==-1,s=e.split(/(\+|\-)/).map(function(f){return f.trim()}),a=s.indexOf(St(s,function(f){return f.search(/,|\s/)!==-1}));s[a]&&s[a].indexOf(",")===-1&&console.warn("Offsets separated by white space(s) are deprecated, use a comma (,) instead.");var l=/\s*,\s*|\s+/,u=a!==-1?[s.slice(0,a).concat([s[a].split(l)[0]]),[s[a].split(l)[1]].concat(s.slice(a+1))]:[s];return u=u.map(function(f,c){var d=(c===1?!i:i)?"height":"width",p=!1;return f.reduce(function(h,v){return h[h.length-1]===""&&["+","-"].indexOf(v)!==-1?(h[h.length-1]=v,p=!0,h):p?(h[h.length-1]+=v,p=!1,h):h.concat(v)},[]).map(function(h){return ka(h,d,t,n)})}),u.forEach(function(f,c){f.forEach(function(d,p){Mn(d)&&(o[c]+=d*(f[p-1]==="-"?-1:1))})}),o}function Ta(e,t){var n=t.offset,r=e.placement,o=e.offsets,i=o.popper,s=o.reference,a=r.split("-")[0],l=void 0;return Mn(+n)?l=[+n,0]:l=Ca(n,i,s,a),a==="left"?(i.top+=l[0],i.left-=l[1]):a==="right"?(i.top+=l[0],i.left+=l[1]):a==="top"?(i.left+=l[0],i.top-=l[1]):a==="bottom"&&(i.left+=l[0],i.top+=l[1]),e.popper=i,e}function Ma(e,t){var n=t.boundariesElement||Je(e.instance.popper);e.instance.reference===n&&(n=Je(n));var r=Tn("transform"),o=e.instance.popper.style,i=o.top,s=o.left,a=o[r];o.top="",o.left="",o[r]="";var l=Cn(e.instance.popper,e.instance.reference,t.padding,n,e.positionFixed);o.top=i,o.left=s,o[r]=a,t.boundaries=l;var u=t.priority,f=e.offsets.popper,c={primary:function(p){var h=f[p];return f[p]l[p]&&!t.escapeWithReference&&(v=Math.min(f[h],l[p]-(p==="right"?f.width:f.height))),Qe({},h,v)}};return u.forEach(function(d){var p=["left","top"].indexOf(d)!==-1?"primary":"secondary";f=he({},f,c[p](d))}),e.offsets.popper=f,e}function Pa(e){var t=e.placement,n=t.split("-")[0],r=t.split("-")[1];if(r){var o=e.offsets,i=o.reference,s=o.popper,a=["bottom","top"].indexOf(n)!==-1,l=a?"left":"top",u=a?"width":"height",f={start:Qe({},l,i[l]),end:Qe({},l,i[l]+i[u]-s[u])};e.offsets.popper=he({},s,f[r])}return e}function xa(e){if(!eo(e.instance.modifiers,"hide","preventOverflow"))return e;var t=e.offsets.reference,n=St(e.instance.modifiers,function(r){return r.name==="preventOverflow"}).boundaries;if(t.bottomn.right||t.top>n.bottom||t.right2&&arguments[2]!==void 0?arguments[2]:{};ra(this,e),this.scheduleUpdate=function(){return requestAnimationFrame(r.update)},this.update=ea(this.update.bind(this)),this.options=he({},e.Defaults,o),this.state={isDestroyed:!1,isCreated:!1,scrollParents:[]},this.reference=t&&t.jquery?t[0]:t,this.popper=n&&n.jquery?n[0]:n,this.options.modifiers={},Object.keys(he({},e.Defaults.modifiers,o.modifiers)).forEach(function(s){r.options.modifiers[s]=he({},e.Defaults.modifiers[s]||{},o.modifiers?o.modifiers[s]:{})}),this.modifiers=Object.keys(this.options.modifiers).map(function(s){return he({name:s},r.options.modifiers[s])}).sort(function(s,a){return s.order-a.order}),this.modifiers.forEach(function(s){s.enabled&&$r(s.onLoad)&&s.onLoad(r.reference,r.popper,r.options,s,r.state)}),this.update();var i=this.options.eventsEnabled;i&&this.enableEventListeners(),this.state.eventsEnabled=i}return oa(e,[{key:"update",value:function(){return la.call(this)}},{key:"destroy",value:function(){return ca.call(this)}},{key:"enableEventListeners",value:function(){return fa.call(this)}},{key:"disableEventListeners",value:function(){return pa.call(this)}}]),e})();yt.Utils=(typeof window<"u"?window:global).PopperUtils;yt.placements=to;yt.Defaults=Ia;var Wa=["innerHTML","ownerDocument","style","attributes","nodeValue"],Ra=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","WeakMap","WeakSet"],Aa=["bigint","boolean","null","number","string","symbol","undefined"];function Lt(e){var t=Object.prototype.toString.call(e).slice(8,-1);if(/HTML\w+Element/.test(t))return"HTMLElement";if(_a(t))return t}function we(e){return function(t){return Lt(t)===e}}function _a(e){return Ra.includes(e)}function rt(e){return function(t){return typeof t===e}}function Fa(e){return Aa.includes(e)}function g(e){if(e===null)return"null";switch(typeof e){case"bigint":return"bigint";case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"symbol":return"symbol";case"undefined":return"undefined"}if(g.array(e))return"Array";if(g.plainFunction(e))return"Function";var t=Lt(e);return t||"Object"}g.array=Array.isArray;g.arrayOf=function(e,t){return!g.array(e)&&!g.function(t)?!1:e.every(function(n){return t(n)})};g.asyncGeneratorFunction=function(e){return Lt(e)==="AsyncGeneratorFunction"};g.asyncFunction=we("AsyncFunction");g.bigint=rt("bigint");g.boolean=function(e){return e===!0||e===!1};g.date=we("Date");g.defined=function(e){return!g.undefined(e)};g.domElement=function(e){return g.object(e)&&!g.plainObject(e)&&e.nodeType===1&&g.string(e.nodeName)&&Wa.every(function(t){return t in e})};g.empty=function(e){return g.string(e)&&e.length===0||g.array(e)&&e.length===0||g.object(e)&&!g.map(e)&&!g.set(e)&&Object.keys(e).length===0||g.set(e)&&e.size===0||g.map(e)&&e.size===0};g.error=we("Error");g.function=rt("function");g.generator=function(e){return g.iterable(e)&&g.function(e.next)&&g.function(e.throw)};g.generatorFunction=we("GeneratorFunction");g.instanceOf=function(e,t){return!e||!t?!1:Object.getPrototypeOf(e)===t.prototype};g.iterable=function(e){return!g.nullOrUndefined(e)&&g.function(e[Symbol.iterator])};g.map=we("Map");g.nan=function(e){return Number.isNaN(e)};g.null=function(e){return e===null};g.nullOrUndefined=function(e){return g.null(e)||g.undefined(e)};g.number=function(e){return rt("number")(e)&&!g.nan(e)};g.numericString=function(e){return g.string(e)&&e.length>0&&!Number.isNaN(Number(e))};g.object=function(e){return!g.nullOrUndefined(e)&&(g.function(e)||typeof e=="object")};g.oneOf=function(e,t){return g.array(e)?e.indexOf(t)>-1:!1};g.plainFunction=we("Function");g.plainObject=function(e){if(Lt(e)!=="Object")return!1;var t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})};g.primitive=function(e){return g.null(e)||Fa(typeof e)};g.promise=we("Promise");g.propertyOf=function(e,t,n){if(!g.object(e)||!t)return!1;var r=e[t];return g.function(n)?n(r):g.defined(r)};g.regexp=we("RegExp");g.set=we("Set");g.string=rt("string");g.symbol=rt("symbol");g.undefined=rt("undefined");g.weakMap=we("WeakMap");g.weakSet=we("WeakSet");function no(e){return function(t){return typeof t===e}}var ja=no("function"),Ba=function(e){return e===null},ar=function(e){return Object.prototype.toString.call(e).slice(8,-1)==="RegExp"},lr=function(e){return!La(e)&&!Ba(e)&&(ja(e)||typeof e=="object")},La=no("undefined"),vn=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function $a(e,t){var n=e.length;if(n!==t.length)return!1;for(var r=n;r--!==0;)if(!ae(e[r],t[r]))return!1;return!0}function Ha(e,t){if(e.byteLength!==t.byteLength)return!1;for(var n=new DataView(e.buffer),r=new DataView(t.buffer),o=e.byteLength;o--;)if(n.getUint8(o)!==r.getUint8(o))return!1;return!0}function za(e,t){var n,r,o,i;if(e.size!==t.size)return!1;try{for(var s=vn(e.entries()),a=s.next();!a.done;a=s.next()){var l=a.value;if(!t.has(l[0]))return!1}}catch(c){n={error:c}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}try{for(var u=vn(e.entries()),f=u.next();!f.done;f=u.next()){var l=f.value;if(!ae(l[1],t.get(l[0])))return!1}}catch(c){o={error:c}}finally{try{f&&!f.done&&(i=u.return)&&i.call(u)}finally{if(o)throw o.error}}return!0}function Ua(e,t){var n,r;if(e.size!==t.size)return!1;try{for(var o=vn(e.entries()),i=o.next();!i.done;i=o.next()){var s=i.value;if(!t.has(s[0]))return!1}}catch(a){n={error:a}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return!0}function ae(e,t){if(e===t)return!0;if(e&&lr(e)&&t&&lr(t)){if(e.constructor!==t.constructor)return!1;if(Array.isArray(e)&&Array.isArray(t))return $a(e,t);if(e instanceof Map&&t instanceof Map)return za(e,t);if(e instanceof Set&&t instanceof Set)return Ua(e,t);if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t))return Ha(e,t);if(ar(e)&&ar(t))return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(var o=n.length;o--!==0;)if(!Object.prototype.hasOwnProperty.call(t,n[o]))return!1;for(var o=n.length;o--!==0;){var i=n[o];if(!(i==="_owner"&&e.$$typeof)&&!ae(e[i],t[i]))return!1}return!0}return Number.isNaN(e)&&Number.isNaN(t)?!0:e===t}function Ya(){for(var e=[],t=0;tl);return g.undefined(r)||(u=u&&l===r),g.undefined(i)||(u=u&&a===i),u}function ur(e,t,n){var r=n.key,o=n.type,i=n.value,s=Te(e,r),a=Te(t,r),l=o==="added"?s:a,u=o==="added"?a:s;if(!g.nullOrUndefined(i)){if(g.defined(l)){if(g.array(l)||g.plainObject(l))return qa(l,u,i)}else return ae(u,i);return!1}return[s,a].every(g.array)?!u.every(Pn(l)):[s,a].every(g.plainObject)?Ga(Object.keys(l),Object.keys(u)):![s,a].every(function(f){return g.primitive(f)&&g.defined(f)})&&(o==="added"?!g.defined(s)&&g.defined(a):g.defined(s)&&!g.defined(a))}function fr(e,t,n){var r=n===void 0?{}:n,o=r.key,i=Te(e,o),s=Te(t,o);if(!ro(i,s))throw new TypeError("Inputs have different types");if(!Ya(i,s))throw new TypeError("Inputs don't have length");return[i,s].every(g.plainObject)&&(i=Object.keys(i),s=Object.keys(s)),[i,s]}function dr(e){return function(t){var n=t[0],r=t[1];return g.array(e)?ae(e,r)||e.some(function(o){return ae(o,r)||g.array(r)&&Pn(r)(o)}):g.plainObject(e)&&e[n]?!!e[n]&&ae(e[n],r):ae(e,r)}}function Ga(e,t){return t.some(function(n){return!e.includes(n)})}function pr(e){return function(t){return g.array(e)?e.some(function(n){return ae(n,t)||g.array(t)&&Pn(t)(n)}):ae(e,t)}}function ct(e,t){return g.array(e)?e.some(function(n){return ae(n,t)}):ae(e,t)}function Pn(e){return function(t){return e.some(function(n){return ae(n,t)})}}function ro(){for(var e=[],t=0;t"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ja(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i=0)&&(n[o]=e[o]);return n}function oo(e,t){if(e==null)return{};var n=Ja(e,t),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Ne(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Xa(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ne(e)}function Tt(e){var t=Za();return function(){var r=Ft(e),o;if(t){var i=Ft(this).constructor;o=Reflect.construct(r,arguments,i)}else o=r.apply(this,arguments);return Xa(this,o)}}function Qa(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function io(e){var t=Qa(e,"string");return typeof t=="symbol"?t:String(t)}var el={flip:{padding:20},preventOverflow:{padding:10}},tl="The typeValidator argument must be a function with the signature function(props, propName, componentName).",nl="The error message is optional, but must be a string if provided.";function rl(e,t,n,r){return typeof e=="boolean"?e:typeof e=="function"?e(t,n,r):e?!!e:!1}function ol(e,t){return Object.hasOwnProperty.call(e,t)}function il(e,t,n,r){return new Error("Required ".concat(e[t]," `").concat(t,"` was not specified in `").concat(n,"`."))}function sl(e,t){if(typeof e!="function")throw new TypeError(tl);if(t&&typeof t!="string")throw new TypeError(nl)}function mr(e,t,n){return sl(e,n),function(r,o,i){for(var s=arguments.length,a=new Array(s>3?s-3:0),l=3;l3&&arguments[3]!==void 0?arguments[3]:!1;e.addEventListener(t,n,r)}function ll(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;e.removeEventListener(t,n,r)}function cl(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,o;o=function(s){n(s),ll(e,t,o)},al(e,t,o,r)}function yr(){}var so=(function(e){Ct(n,e);var t=Tt(n);function n(){return Et(this,n),t.apply(this,arguments)}return kt(n,[{key:"componentDidMount",value:function(){Ee()&&(this.node||this.appendNode(),ut||this.renderPortal())}},{key:"componentDidUpdate",value:function(){Ee()&&(ut||this.renderPortal())}},{key:"componentWillUnmount",value:function(){!Ee()||!this.node||(ut||Nt.unmountComponentAtNode(this.node),this.node&&this.node.parentNode===document.body&&(document.body.removeChild(this.node),this.node=void 0))}},{key:"appendNode",value:function(){var o=this.props,i=o.id,s=o.zIndex;this.node||(this.node=document.createElement("div"),i&&(this.node.id=i),s&&(this.node.style.zIndex=s),document.body.appendChild(this.node))}},{key:"renderPortal",value:function(){if(!Ee())return null;var o=this.props,i=o.children,s=o.setRef;if(this.node||this.appendNode(),ut)return Nt.createPortal(i,this.node);var a=Nt.unstable_renderSubtreeIntoContainer(this,i.length>1?w.createElement("div",null,i):i[0],this.node);return s(a),null}},{key:"renderReact16",value:function(){var o=this.props,i=o.hasChildren,s=o.placement,a=o.target;return i?this.renderPortal():a||s==="center"?this.renderPortal():null}},{key:"render",value:function(){return ut?this.renderReact16():null}}]),n})(w.Component);te(so,"propTypes",{children:T.oneOfType([T.element,T.array]),hasChildren:T.bool,id:T.oneOfType([T.string,T.number]),placement:T.string,setRef:T.func.isRequired,target:T.oneOfType([T.object,T.string]),zIndex:T.number});var ao=(function(e){Ct(n,e);var t=Tt(n);function n(){return Et(this,n),t.apply(this,arguments)}return kt(n,[{key:"parentStyle",get:function(){var o=this.props,i=o.placement,s=o.styles,a=s.arrow.length,l={pointerEvents:"none",position:"absolute",width:"100%"};return i.startsWith("top")?(l.bottom=0,l.left=0,l.right=0,l.height=a):i.startsWith("bottom")?(l.left=0,l.right=0,l.top=0,l.height=a):i.startsWith("left")?(l.right=0,l.top=0,l.bottom=0):i.startsWith("right")&&(l.left=0,l.top=0),l}},{key:"render",value:function(){var o=this.props,i=o.placement,s=o.setArrowRef,a=o.styles,l=a.arrow,u=l.color,f=l.display,c=l.length,d=l.margin,p=l.position,h=l.spread,v={display:f,position:p},S,y=h,m=c;return i.startsWith("top")?(S="0,0 ".concat(y/2,",").concat(m," ").concat(y,",0"),v.bottom=0,v.marginLeft=d,v.marginRight=d):i.startsWith("bottom")?(S="".concat(y,",").concat(m," ").concat(y/2,",0 0,").concat(m),v.top=0,v.marginLeft=d,v.marginRight=d):i.startsWith("left")?(m=h,y=c,S="0,0 ".concat(y,",").concat(m/2," 0,").concat(m),v.right=0,v.marginTop=d,v.marginBottom=d):i.startsWith("right")&&(m=h,y=c,S="".concat(y,",").concat(m," ").concat(y,",0 0,").concat(m/2),v.left=0,v.marginTop=d,v.marginBottom=d),w.createElement("div",{className:"__floater__arrow",style:this.parentStyle},w.createElement("span",{ref:s,style:v},w.createElement("svg",{width:y,height:m,version:"1.1",xmlns:"http://www.w3.org/2000/svg"},w.createElement("polygon",{points:S,fill:u}))))}}]),n})(w.Component);te(ao,"propTypes",{placement:T.string.isRequired,setArrowRef:T.func.isRequired,styles:T.object.isRequired});var ul=["color","height","width"];function lo(e){var t=e.handleClick,n=e.styles,r=n.color,o=n.height,i=n.width,s=oo(n,ul);return w.createElement("button",{"aria-label":"close",onClick:t,style:s,type:"button"},w.createElement("svg",{width:"".concat(i,"px"),height:"".concat(o,"px"),viewBox:"0 0 18 18",version:"1.1",xmlns:"http://www.w3.org/2000/svg",preserveAspectRatio:"xMidYMid"},w.createElement("g",null,w.createElement("path",{d:"M8.13911129,9.00268191 L0.171521827,17.0258467 C-0.0498027049,17.248715 -0.0498027049,17.6098394 0.171521827,17.8327545 C0.28204354,17.9443526 0.427188206,17.9998706 0.572051765,17.9998706 C0.71714958,17.9998706 0.862013139,17.9443526 0.972581703,17.8327545 L9.0000937,9.74924618 L17.0276057,17.8327545 C17.1384085,17.9443526 17.2832721,17.9998706 17.4281356,17.9998706 C17.5729992,17.9998706 17.718097,17.9443526 17.8286656,17.8327545 C18.0499901,17.6098862 18.0499901,17.2487618 17.8286656,17.0258467 L9.86135722,9.00268191 L17.8340066,0.973848225 C18.0553311,0.750979934 18.0553311,0.389855532 17.8340066,0.16694039 C17.6126821,-0.0556467968 17.254037,-0.0556467968 17.0329467,0.16694039 L9.00042166,8.25611765 L0.967006424,0.167268345 C0.745681892,-0.0553188426 0.387317931,-0.0553188426 0.165993399,0.167268345 C-0.0553311331,0.390136635 -0.0553311331,0.751261038 0.165993399,0.974176179 L8.13920499,9.00268191 L8.13911129,9.00268191 Z",fill:r}))))}lo.propTypes={handleClick:T.func.isRequired,styles:T.object.isRequired};function co(e){var t=e.content,n=e.footer,r=e.handleClick,o=e.open,i=e.positionWrapper,s=e.showCloseButton,a=e.title,l=e.styles,u={content:w.isValidElement(t)?t:w.createElement("div",{className:"__floater__content",style:l.content},t)};return a&&(u.title=w.isValidElement(a)?a:w.createElement("div",{className:"__floater__title",style:l.title},a)),n&&(u.footer=w.isValidElement(n)?n:w.createElement("div",{className:"__floater__footer",style:l.footer},n)),(s||i)&&!g.boolean(o)&&(u.close=w.createElement(lo,{styles:l.close,handleClick:r})),w.createElement("div",{className:"__floater__container",style:l.container},u.close,u.title,u.content,u.footer)}co.propTypes={content:T.node.isRequired,footer:T.node,handleClick:T.func.isRequired,open:T.bool,positionWrapper:T.bool.isRequired,showCloseButton:T.bool.isRequired,styles:T.object.isRequired,title:T.node};var uo=(function(e){Ct(n,e);var t=Tt(n);function n(){return Et(this,n),t.apply(this,arguments)}return kt(n,[{key:"style",get:function(){var o=this.props,i=o.disableAnimation,s=o.component,a=o.placement,l=o.hideArrow,u=o.status,f=o.styles,c=f.arrow.length,d=f.floater,p=f.floaterCentered,h=f.floaterClosing,v=f.floaterOpening,S=f.floaterWithAnimation,y=f.floaterWithComponent,m={};return l||(a.startsWith("top")?m.padding="0 0 ".concat(c,"px"):a.startsWith("bottom")?m.padding="".concat(c,"px 0 0"):a.startsWith("left")?m.padding="0 ".concat(c,"px 0 0"):a.startsWith("right")&&(m.padding="0 0 0 ".concat(c,"px"))),[z.OPENING,z.OPEN].indexOf(u)!==-1&&(m=K(K({},m),v)),u===z.CLOSING&&(m=K(K({},m),h)),u===z.OPEN&&!i&&(m=K(K({},m),S)),a==="center"&&(m=K(K({},m),p)),s&&(m=K(K({},m),y)),K(K({},d),m)}},{key:"render",value:function(){var o=this.props,i=o.component,s=o.handleClick,a=o.hideArrow,l=o.setFloaterRef,u=o.status,f={},c=["__floater"];return i?w.isValidElement(i)?f.content=w.cloneElement(i,{closeFn:s}):f.content=i({closeFn:s}):f.content=w.createElement(co,this.props),u===z.OPEN&&c.push("__floater__open"),a||(f.arrow=w.createElement(ao,this.props)),w.createElement("div",{ref:l,className:c.join(" "),style:this.style},w.createElement("div",{className:"__floater__body"},f.content,f.arrow))}}]),n})(w.Component);te(uo,"propTypes",{component:T.oneOfType([T.func,T.element]),content:T.node,disableAnimation:T.bool.isRequired,footer:T.node,handleClick:T.func.isRequired,hideArrow:T.bool.isRequired,open:T.bool,placement:T.string.isRequired,positionWrapper:T.bool.isRequired,setArrowRef:T.func.isRequired,setFloaterRef:T.func.isRequired,showCloseButton:T.bool,status:T.string.isRequired,styles:T.object.isRequired,title:T.node});var fo=(function(e){Ct(n,e);var t=Tt(n);function n(){return Et(this,n),t.apply(this,arguments)}return kt(n,[{key:"render",value:function(){var o=this.props,i=o.children,s=o.handleClick,a=o.handleMouseEnter,l=o.handleMouseLeave,u=o.setChildRef,f=o.setWrapperRef,c=o.style,d=o.styles,p;if(i)if(w.Children.count(i)===1)if(!w.isValidElement(i))p=w.createElement("span",null,i);else{var h=g.function(i.type)?"innerRef":"ref";p=w.cloneElement(w.Children.only(i),te({},h,u))}else p=i;return p?w.createElement("span",{ref:f,style:K(K({},d),c),onClick:s,onMouseEnter:a,onMouseLeave:l},p):null}}]),n})(w.Component);te(fo,"propTypes",{children:T.node,handleClick:T.func.isRequired,handleMouseEnter:T.func.isRequired,handleMouseLeave:T.func.isRequired,setChildRef:T.func.isRequired,setWrapperRef:T.func.isRequired,style:T.object,styles:T.object.isRequired});var fl={zIndex:100};function dl(e){var t=ve(fl,e.options||{});return{wrapper:{cursor:"help",display:"inline-flex",flexDirection:"column",zIndex:t.zIndex},wrapperPosition:{left:-1e3,position:"absolute",top:-1e3,visibility:"hidden"},floater:{display:"inline-block",filter:"drop-shadow(0 0 3px rgba(0, 0, 0, 0.3))",maxWidth:300,opacity:0,position:"relative",transition:"opacity 0.3s",visibility:"hidden",zIndex:t.zIndex},floaterOpening:{opacity:1,visibility:"visible"},floaterWithAnimation:{opacity:1,transition:"opacity 0.3s, transform 0.2s",visibility:"visible"},floaterWithComponent:{maxWidth:"100%"},floaterClosing:{opacity:0,visibility:"visible"},floaterCentered:{left:"50%",position:"fixed",top:"50%",transform:"translate(-50%, -50%)"},container:{backgroundColor:"#fff",color:"#666",minHeight:60,minWidth:200,padding:20,position:"relative",zIndex:10},title:{borderBottom:"1px solid #555",color:"#555",fontSize:18,marginBottom:5,paddingBottom:6,paddingRight:18},content:{fontSize:15},close:{backgroundColor:"transparent",border:0,borderRadius:0,color:"#555",fontSize:0,height:15,outline:"none",padding:10,position:"absolute",right:0,top:0,width:15,WebkitAppearance:"none"},footer:{borderTop:"1px solid #ccc",fontSize:13,marginTop:10,paddingTop:5},arrow:{color:"#fff",display:"inline-flex",length:16,margin:8,position:"absolute",spread:32},options:t}}var pl=["arrow","flip","offset"],hl=["position","top","right","bottom","left"],xn=(function(e){Ct(n,e);var t=Tt(n);function n(r){var o;return Et(this,n),o=t.call(this,r),te(Ne(o),"setArrowRef",function(i){o.arrowRef=i}),te(Ne(o),"setChildRef",function(i){o.childRef=i}),te(Ne(o),"setFloaterRef",function(i){o.floaterRef=i}),te(Ne(o),"setWrapperRef",function(i){o.wrapperRef=i}),te(Ne(o),"handleTransitionEnd",function(){var i=o.state.status,s=o.props.callback;o.wrapperPopper&&o.wrapperPopper.instance.update(),o.setState({status:i===z.OPENING?z.OPEN:z.IDLE},function(){var a=o.state.status;s(a===z.OPEN?"open":"close",o.props)})}),te(Ne(o),"handleClick",function(){var i=o.props,s=i.event,a=i.open;if(!g.boolean(a)){var l=o.state,u=l.positionWrapper,f=l.status;(o.event==="click"||o.event==="hover"&&u)&&(xt({title:"click",data:[{event:s,status:f===z.OPEN?"closing":"opening"}],debug:o.debug}),o.toggle())}}),te(Ne(o),"handleMouseEnter",function(){var i=o.props,s=i.event,a=i.open;if(!(g.boolean(a)||an())){var l=o.state.status;o.event==="hover"&&l===z.IDLE&&(xt({title:"mouseEnter",data:[{key:"originalEvent",value:s}],debug:o.debug}),clearTimeout(o.eventDelayTimeout),o.toggle())}}),te(Ne(o),"handleMouseLeave",function(){var i=o.props,s=i.event,a=i.eventDelay,l=i.open;if(!(g.boolean(l)||an())){var u=o.state,f=u.status,c=u.positionWrapper;o.event==="hover"&&(xt({title:"mouseLeave",data:[{key:"originalEvent",value:s}],debug:o.debug}),a?[z.OPENING,z.OPEN].indexOf(f)!==-1&&!c&&!o.eventDelayTimeout&&(o.eventDelayTimeout=setTimeout(function(){delete o.eventDelayTimeout,o.toggle()},a*1e3)):o.toggle(z.IDLE))}}),o.state={currentPlacement:r.placement,needsUpdate:!1,positionWrapper:r.wrapperOptions.position&&!!r.target,status:z.INIT,statusWrapper:z.INIT},o._isMounted=!1,o.hasMounted=!1,Ee()&&window.addEventListener("load",function(){o.popper&&o.popper.instance.update(),o.wrapperPopper&&o.wrapperPopper.instance.update()}),o}return kt(n,[{key:"componentDidMount",value:function(){if(Ee()){var o=this.state.positionWrapper,i=this.props,s=i.children,a=i.open,l=i.target;this._isMounted=!0,xt({title:"init",data:{hasChildren:!!s,hasTarget:!!l,isControlled:g.boolean(a),positionWrapper:o,target:this.target,floater:this.floaterRef},debug:this.debug}),this.hasMounted||(this.initPopper(),this.hasMounted=!0),!s&&l&&g.boolean(a)}}},{key:"componentDidUpdate",value:function(o,i){if(Ee()){var s=this.props,a=s.autoOpen,l=s.open,u=s.target,f=s.wrapperOptions,c=Va(i,this.state),d=c.changedFrom,p=c.changed;if(o.open!==l){var h;g.boolean(l)&&(h=l?z.OPENING:z.CLOSING),this.toggle(h)}(o.wrapperOptions.position!==f.position||o.target!==u)&&this.changeWrapperPosition(this.props),p("status",z.IDLE)&&l?this.toggle(z.OPEN):d("status",z.INIT,z.IDLE)&&a&&this.toggle(z.OPEN),this.popper&&p("status",z.OPENING)&&this.popper.instance.update(),this.floaterRef&&(p("status",z.OPENING)||p("status",z.CLOSING))&&cl(this.floaterRef,"transitionend",this.handleTransitionEnd),p("needsUpdate",!0)&&this.rebuildPopper()}}},{key:"componentWillUnmount",value:function(){Ee()&&(this._isMounted=!1,this.popper&&this.popper.instance.destroy(),this.wrapperPopper&&this.wrapperPopper.instance.destroy())}},{key:"initPopper",value:function(){var o=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.target,s=this.state.positionWrapper,a=this.props,l=a.disableFlip,u=a.getPopper,f=a.hideArrow,c=a.offset,d=a.placement,p=a.wrapperOptions,h=d==="top"||d==="bottom"?"flip":["right","bottom-end","top-end","left","top-start","bottom-start"];if(d==="center")this.setState({status:z.IDLE});else if(i&&this.floaterRef){var v=this.options,S=v.arrow,y=v.flip,m=v.offset,E=oo(v,pl);new yt(i,this.floaterRef,{placement:d,modifiers:K({arrow:K({enabled:!f,element:this.arrowRef},S),flip:K({enabled:!l,behavior:h},y),offset:K({offset:"0, ".concat(c,"px")},m)},E),onCreate:function(O){var D;if(o.popper=O,!((D=o.floaterRef)!==null&&D!==void 0&&D.isConnected)){o.setState({needsUpdate:!0});return}u(O,"floater"),o._isMounted&&o.setState({currentPlacement:O.placement,status:z.IDLE}),d!==O.placement&&setTimeout(function(){O.instance.update()},1)},onUpdate:function(O){o.popper=O;var D=o.state.currentPlacement;o._isMounted&&O.placement!==D&&o.setState({currentPlacement:O.placement})}})}if(s){var M=g.undefined(p.offset)?0:p.offset;new yt(this.target,this.wrapperRef,{placement:p.placement||d,modifiers:{arrow:{enabled:!1},offset:{offset:"0, ".concat(M,"px")},flip:{enabled:!1}},onCreate:function(O){o.wrapperPopper=O,o._isMounted&&o.setState({statusWrapper:z.IDLE}),u(O,"wrapper"),d!==O.placement&&setTimeout(function(){O.instance.update()},1)}})}}},{key:"rebuildPopper",value:function(){var o=this;this.floaterRefInterval=setInterval(function(){var i;(i=o.floaterRef)!==null&&i!==void 0&&i.isConnected&&(clearInterval(o.floaterRefInterval),o.setState({needsUpdate:!1}),o.initPopper())},50)}},{key:"changeWrapperPosition",value:function(o){var i=o.target,s=o.wrapperOptions;this.setState({positionWrapper:s.position&&!!i})}},{key:"toggle",value:function(o){var i=this.state.status,s=i===z.OPEN?z.CLOSING:z.OPENING;g.undefined(o)||(s=o),this.setState({status:s})}},{key:"debug",get:function(){var o=this.props.debug;return o||Ee()&&"ReactFloaterDebug"in window&&!!window.ReactFloaterDebug}},{key:"event",get:function(){var o=this.props,i=o.disableHoverToClick,s=o.event;return s==="hover"&&an()&&!i?"click":s}},{key:"options",get:function(){var o=this.props.options;return ve(el,o||{})}},{key:"styles",get:function(){var o=this,i=this.state,s=i.status,a=i.positionWrapper,l=i.statusWrapper,u=this.props.styles,f=ve(dl(u),u);if(a){var c;[z.IDLE].indexOf(s)===-1||[z.IDLE].indexOf(l)===-1?c=f.wrapperPosition:c=this.wrapperPopper.styles,f.wrapper=K(K({},f.wrapper),c)}if(this.target){var d=window.getComputedStyle(this.target);this.wrapperStyles?f.wrapper=K(K({},f.wrapper),this.wrapperStyles):["relative","static"].indexOf(d.position)===-1&&(this.wrapperStyles={},a||(hl.forEach(function(p){o.wrapperStyles[p]=d[p]}),f.wrapper=K(K({},f.wrapper),this.wrapperStyles),this.target.style.position="relative",this.target.style.top="auto",this.target.style.right="auto",this.target.style.bottom="auto",this.target.style.left="auto"))}return f}},{key:"target",get:function(){if(!Ee())return null;var o=this.props.target;return o?g.domElement(o)?o:document.querySelector(o):this.childRef||this.wrapperRef}},{key:"render",value:function(){var o=this.state,i=o.currentPlacement,s=o.positionWrapper,a=o.status,l=this.props,u=l.children,f=l.component,c=l.content,d=l.disableAnimation,p=l.footer,h=l.hideArrow,v=l.id,S=l.open,y=l.showCloseButton,m=l.style,E=l.target,M=l.title,C=w.createElement(fo,{handleClick:this.handleClick,handleMouseEnter:this.handleMouseEnter,handleMouseLeave:this.handleMouseLeave,setChildRef:this.setChildRef,setWrapperRef:this.setWrapperRef,style:m,styles:this.styles.wrapper},u),O={};return s?O.wrapperInPortal=C:O.wrapperAsChildren=C,w.createElement("span",null,w.createElement(so,{hasChildren:!!u,id:v,placement:i,setRef:this.setFloaterRef,target:E,zIndex:this.styles.options.zIndex},w.createElement(uo,{component:f,content:c,disableAnimation:d,footer:p,handleClick:this.handleClick,hideArrow:h||i==="center",open:S,placement:i,positionWrapper:s,setArrowRef:this.setArrowRef,setFloaterRef:this.setFloaterRef,showCloseButton:y,status:a,styles:this.styles,title:M}),O.wrapperInPortal),O.wrapperAsChildren)}}]),n})(w.Component);te(xn,"propTypes",{autoOpen:T.bool,callback:T.func,children:T.node,component:mr(T.oneOfType([T.func,T.element]),function(e){return!e.content}),content:mr(T.node,function(e){return!e.component}),debug:T.bool,disableAnimation:T.bool,disableFlip:T.bool,disableHoverToClick:T.bool,event:T.oneOf(["hover","click"]),eventDelay:T.number,footer:T.node,getPopper:T.func,hideArrow:T.bool,id:T.oneOfType([T.string,T.number]),offset:T.number,open:T.bool,options:T.object,placement:T.oneOf(["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end","auto","center"]),showCloseButton:T.bool,style:T.object,styles:T.object,target:T.oneOfType([T.object,T.string]),title:T.node,wrapperOptions:T.shape({offset:T.number,placement:T.oneOf(["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end","auto"]),position:T.bool})});te(xn,"defaultProps",{autoOpen:!1,callback:yr,debug:!1,disableAnimation:!1,disableFlip:!1,disableHoverToClick:!1,event:"click",eventDelay:.4,getPopper:yr,hideArrow:!1,offset:15,placement:"bottom",showCloseButton:!1,styles:{},target:null,wrapperOptions:{position:!1}});var ml=Object.defineProperty,yl=(e,t,n)=>t in e?ml(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,N=(e,t,n)=>yl(e,typeof t!="symbol"?t+"":t,n),q={INIT:"init",START:"start",STOP:"stop",RESET:"reset",PREV:"prev",NEXT:"next",GO:"go",CLOSE:"close",SKIP:"skip",UPDATE:"update"},ye={TOUR_START:"tour:start",STEP_BEFORE:"step:before",BEACON:"beacon",TOOLTIP:"tooltip",STEP_AFTER:"step:after",TOUR_END:"tour:end",TOUR_STATUS:"tour:status",TARGET_NOT_FOUND:"error:target_not_found"},A={INIT:"init",READY:"ready",BEACON:"beacon",TOOLTIP:"tooltip",COMPLETE:"complete",ERROR:"error"},L={IDLE:"idle",READY:"ready",WAITING:"waiting",RUNNING:"running",PAUSED:"paused",SKIPPED:"skipped",FINISHED:"finished"};function _e(){var e;return!!(typeof window<"u"&&((e=window.document)!=null&&e.createElement))}function po(e){return e?e.getBoundingClientRect():null}function vl(e=!1){const{body:t,documentElement:n}=document;if(!t||!n)return 0;if(e){const r=[t.scrollHeight,t.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight].sort((i,s)=>i-s),o=Math.floor(r.length/2);return r.length%2===0?(r[o-1]+r[o])/2:r[o]}return Math.max(t.scrollHeight,t.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight)}function De(e){if(typeof e=="string")try{return document.querySelector(e)}catch{return null}return e}function gl(e){return!e||e.nodeType!==1?null:getComputedStyle(e)}function vt(e,t,n){if(!e)return $e();const r=Lr(e);if(r){if(r.isSameNode($e()))return n?document:$e();if(!(r.scrollHeight>r.offsetHeight)&&!t)return r.style.overflow="initial",$e()}return r}function $t(e,t){if(!e)return!1;const n=vt(e,t);return n?!n.isSameNode($e()):!1}function bl(e){return e.offsetParent!==document.body}function et(e,t="fixed"){if(!e||!(e instanceof HTMLElement))return!1;const{nodeName:n}=e,r=gl(e);return n==="BODY"||n==="HTML"?!1:r&&r.position===t?!0:e.parentNode?et(e.parentNode,t):!1}function wl(e){var t;if(!e)return!1;let n=e;for(;n&&n!==document.body;){if(n instanceof HTMLElement){const{display:r,visibility:o}=getComputedStyle(n);if(r==="none"||o==="hidden")return!1}n=(t=n.parentElement)!=null?t:null}return!0}function Ol(e,t,n){var r,o,i;const s=po(e),a=vt(e,n),l=$t(e,n),u=et(e);let f=0,c=(r=s?.top)!=null?r:0;if(l&&u){const d=(o=e?.offsetTop)!=null?o:0,p=(i=a?.scrollTop)!=null?i:0;c=d-p}else a instanceof HTMLElement&&(f=a.scrollTop,!l&&!et(e)&&(c+=f),a.isSameNode($e())||(c+=$e().scrollTop));return Math.floor(c-t)}function Sl(e,t,n){var r;if(!e)return 0;const{offsetTop:o=0,scrollTop:i=0}=(r=Lr(e))!=null?r:{};let s=e.getBoundingClientRect().top+i;o&&($t(e,n)||bl(e))&&(s-=o);const a=Math.floor(s-t);return a<0?0:a}function $e(){var e;return(e=document.scrollingElement)!=null?e:document.documentElement}function El(e,t){const{duration:n,element:r}=t;return new Promise((o,i)=>{const{scrollTop:s}=r,a=e>s?e-s:s-e;js.top(r,e,{duration:a<100?50:n},l=>l&&l.message!=="Element already at target scroll position"?i(l):o())})}var ft=Dt.createPortal!==void 0;function ho(e=navigator.userAgent){let t=e;return typeof window>"u"?t="node":document.documentMode?t="ie":/Edge/.test(e)?t="edge":window.opera||e.includes(" OPR/")?t="opera":typeof window.InstallTrigger<"u"?t="firefox":window.chrome?t="chrome":/(Version\/([\d._]+).*Safari|CriOS|FxiOS| Mobile\/)/.test(e)&&(t="safari"),t}function Wt(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function ke(e,t={}){const{defaultValue:n,step:r,steps:o}=t;let i=Jn(e);if(i)(i.includes("{step}")||i.includes("{steps}"))&&r&&o&&(i=i.replace("{step}",r.toString()).replace("{steps}",o.toString()));else if(b.isValidElement(e)&&!Object.values(e.props).length&&Wt(e.type)==="function"){const s=e.type({});i=ke(s,t)}else i=Jn(n);return i}function kl(e,t){return!x.plainObject(e)||!x.array(t)?!1:Object.keys(e).every(n=>t.includes(n))}function Cl(e){const t=/^#?([\da-f])([\da-f])([\da-f])$/i,n=e.replace(t,(o,i,s,a)=>i+i+s+s+a+a),r=/^#?([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i.exec(n);return r?[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)]:[]}function vr(e){return e.disableBeacon||e.placement==="center"}function gr(){return!["chrome","safari","firefox","opera"].includes(ho())}function Ue({data:e,debug:t=!1,title:n,warn:r=!1}){const o=r?console.warn||console.error:console.log;t&&(n&&e?(console.groupCollapsed(`%creact-joyride: ${n}`,"color: #ff0044; font-weight: bold; font-size: 12px;"),Array.isArray(e)?e.forEach(i=>{x.plainObject(i)&&i.key?o.apply(console,[i.key,i.value]):o.apply(console,[i])}):o.apply(console,[e]),console.groupEnd()):console.error("Missing title or data props"))}function Tl(e){return Object.keys(e)}function mo(e,...t){if(!x.plainObject(e))throw new TypeError("Expected an object");const n={};for(const r in e)({}).hasOwnProperty.call(e,r)&&(t.includes(r)||(n[r]=e[r]));return n}function Ml(e,...t){if(!x.plainObject(e))throw new TypeError("Expected an object");if(!t.length)return e;const n={};for(const r in e)({}).hasOwnProperty.call(e,r)&&t.includes(r)&&(n[r]=e[r]);return n}function bn(e,t,n){const r=i=>i.replace("{step}",String(t)).replace("{steps}",String(n));if(Wt(e)==="string")return r(e);if(!b.isValidElement(e))return e;const{children:o}=e.props;if(Wt(o)==="string"&&o.includes("{step}"))return b.cloneElement(e,{children:r(o)});if(Array.isArray(o))return b.cloneElement(e,{children:o.map(i=>typeof i=="string"?r(i):bn(i,t,n))});if(Wt(e.type)==="function"&&!Object.values(e.props).length){const i=e.type({});return bn(i,t,n)}return e}function Pl(e){const{isFirstStep:t,lifecycle:n,previousLifecycle:r,scrollToFirstStep:o,step:i,target:s}=e;return!i.disableScrolling&&(!t||o||n===A.TOOLTIP)&&i.placement!=="center"&&(!i.isFixed||!et(s))&&r!==n&&[A.BEACON,A.TOOLTIP].includes(n)}var xl={options:{preventOverflow:{boundariesElement:"scrollParent"}},wrapperOptions:{offset:-18,position:!0}},yo={back:"Back",close:"Close",last:"Last",next:"Next",nextLabelWithProgress:"Next (Step {step} of {steps})",open:"Open the dialog",skip:"Skip"},Nl={event:"click",placement:"bottom",offset:10,disableBeacon:!1,disableCloseOnEsc:!1,disableOverlay:!1,disableOverlayClose:!1,disableScrollParentFix:!1,disableScrolling:!1,hideBackButton:!1,hideCloseButton:!1,hideFooter:!1,isFixed:!1,locale:yo,showProgress:!1,showSkipButton:!1,spotlightClicks:!1,spotlightPadding:10},Dl={continuous:!1,debug:!1,disableCloseOnEsc:!1,disableOverlay:!1,disableOverlayClose:!1,disableScrolling:!1,disableScrollParentFix:!1,getHelpers:void 0,hideBackButton:!1,run:!0,scrollOffset:20,scrollDuration:300,scrollToFirstStep:!1,showSkipButton:!1,showProgress:!1,spotlightClicks:!1,spotlightPadding:10,steps:[]},Il={arrowColor:"#fff",backgroundColor:"#fff",beaconSize:36,overlayColor:"rgba(0, 0, 0, 0.5)",primaryColor:"#f04",spotlightShadow:"0 0 15px rgba(0, 0, 0, 0.5)",textColor:"#333",width:380,zIndex:100},dt={backgroundColor:"transparent",border:0,borderRadius:0,color:"#555",cursor:"pointer",fontSize:16,lineHeight:1,padding:8,WebkitAppearance:"none"},br={borderRadius:4,position:"absolute"};function Wl(e,t){var n,r,o,i,s;const{floaterProps:a,styles:l}=e,u=ve((n=t.floaterProps)!=null?n:{},a??{}),f=ve(l??{},(r=t.styles)!=null?r:{}),c=ve(Il,f.options||{}),d=t.placement==="center"||t.disableBeacon;let{width:p}=c;window.innerWidth>480&&(p=380),"width"in c&&(p=typeof c.width=="number"&&window.innerWidthvo(n,t)):(Ue({title:"validateSteps",data:"steps must be an array",warn:!0,debug:t}),!1)}var go={action:"init",controlled:!1,index:0,lifecycle:A.INIT,origin:null,size:0,status:L.IDLE},Or=Tl(mo(go,"controlled","size")),Al=class{constructor(e){N(this,"beaconPopper"),N(this,"tooltipPopper"),N(this,"data",new Map),N(this,"listener"),N(this,"store",new Map),N(this,"addListener",o=>{this.listener=o}),N(this,"setSteps",o=>{const{size:i,status:s}=this.getState(),a={size:o.length,status:s};this.data.set("steps",o),s===L.WAITING&&!i&&o.length&&(a.status=L.RUNNING),this.setState(a)}),N(this,"getPopper",o=>o==="beacon"?this.beaconPopper:this.tooltipPopper),N(this,"setPopper",(o,i)=>{o==="beacon"?this.beaconPopper=i:this.tooltipPopper=i}),N(this,"cleanupPoppers",()=>{this.beaconPopper=null,this.tooltipPopper=null}),N(this,"close",(o=null)=>{const{index:i,status:s}=this.getState();s===L.RUNNING&&this.setState({...this.getNextState({action:q.CLOSE,index:i+1,origin:o})})}),N(this,"go",o=>{const{controlled:i,status:s}=this.getState();if(i||s!==L.RUNNING)return;const a=this.getSteps()[o];this.setState({...this.getNextState({action:q.GO,index:o}),status:a?s:L.FINISHED})}),N(this,"info",()=>this.getState()),N(this,"next",()=>{const{index:o,status:i}=this.getState();i===L.RUNNING&&this.setState(this.getNextState({action:q.NEXT,index:o+1}))}),N(this,"open",()=>{const{status:o}=this.getState();o===L.RUNNING&&this.setState({...this.getNextState({action:q.UPDATE,lifecycle:A.TOOLTIP})})}),N(this,"prev",()=>{const{index:o,status:i}=this.getState();i===L.RUNNING&&this.setState({...this.getNextState({action:q.PREV,index:o-1})})}),N(this,"reset",(o=!1)=>{const{controlled:i}=this.getState();i||this.setState({...this.getNextState({action:q.RESET,index:0}),status:o?L.RUNNING:L.READY})}),N(this,"skip",()=>{const{status:o}=this.getState();o===L.RUNNING&&this.setState({action:q.SKIP,lifecycle:A.INIT,status:L.SKIPPED})}),N(this,"start",o=>{const{index:i,size:s}=this.getState();this.setState({...this.getNextState({action:q.START,index:x.number(o)?o:i},!0),status:s?L.RUNNING:L.WAITING})}),N(this,"stop",(o=!1)=>{const{index:i,status:s}=this.getState();[L.FINISHED,L.SKIPPED].includes(s)||this.setState({...this.getNextState({action:q.STOP,index:i+(o?1:0)}),status:L.PAUSED})}),N(this,"update",o=>{var i,s;if(!kl(o,Or))throw new Error(`State is not valid. Valid keys: ${Or.join(", ")}`);this.setState({...this.getNextState({...this.getState(),...o,action:(i=o.action)!=null?i:q.UPDATE,origin:(s=o.origin)!=null?s:null},!0)})});const{continuous:t=!1,stepIndex:n,steps:r=[]}=e??{};this.setState({action:q.INIT,controlled:x.number(n),continuous:t,index:x.number(n)?n:0,lifecycle:A.INIT,origin:null,status:r.length?L.READY:L.IDLE},!0),this.beaconPopper=null,this.tooltipPopper=null,this.listener=null,this.setSteps(r)}getState(){return this.store.size?{action:this.store.get("action")||"",controlled:this.store.get("controlled")||!1,index:parseInt(this.store.get("index"),10),lifecycle:this.store.get("lifecycle")||"",origin:this.store.get("origin")||null,size:this.store.get("size")||0,status:this.store.get("status")||""}:{...go}}getNextState(e,t=!1){var n,r,o,i,s;const{action:a,controlled:l,index:u,size:f,status:c}=this.getState(),d=x.number(e.index)?e.index:u,p=l&&!t?u:Math.min(Math.max(d,0),f);return{action:(n=e.action)!=null?n:a,controlled:l,index:p,lifecycle:(r=e.lifecycle)!=null?r:A.INIT,origin:(o=e.origin)!=null?o:null,size:(i=e.size)!=null?i:f,status:p===f?L.FINISHED:(s=e.status)!=null?s:c}}getSteps(){const e=this.data.get("steps");return Array.isArray(e)?e:[]}hasUpdatedState(e){const t=JSON.stringify(e),n=JSON.stringify(this.getState());return t!==n}setState(e,t=!1){const n=this.getState(),{action:r,index:o,lifecycle:i,origin:s=null,size:a,status:l}={...n,...e};this.store.set("action",r),this.store.set("index",o),this.store.set("lifecycle",i),this.store.set("origin",s),this.store.set("size",a),this.store.set("status",l),t&&(this.store.set("controlled",e.controlled),this.store.set("continuous",e.continuous)),this.listener&&this.hasUpdatedState(n)&&this.listener(this.getState())}getHelpers(){return{close:this.close,go:this.go,info:this.info,next:this.next,open:this.open,prev:this.prev,reset:this.reset,skip:this.skip}}};function _l(e){return new Al(e)}function Fl({styles:e}){return b.createElement("div",{key:"JoyrideSpotlight",className:"react-joyride__spotlight","data-test-id":"spotlight",style:e})}var jl=Fl,Bl=class extends b.Component{constructor(){super(...arguments),N(this,"isActive",!1),N(this,"resizeTimeout"),N(this,"scrollTimeout"),N(this,"scrollParent"),N(this,"state",{isScrolling:!1,mouseOverSpotlight:!1,showSpotlight:!0}),N(this,"hideSpotlight",()=>{const{continuous:e,disableOverlay:t,lifecycle:n}=this.props,r=[A.INIT,A.BEACON,A.COMPLETE,A.ERROR];return t||(e?r.includes(n):n!==A.TOOLTIP)}),N(this,"handleMouseMove",e=>{const{mouseOverSpotlight:t}=this.state,{height:n,left:r,position:o,top:i,width:s}=this.spotlightStyles,a=o==="fixed"?e.clientY:e.pageY,l=o==="fixed"?e.clientX:e.pageX,u=a>=i&&a<=i+n,c=l>=r&&l<=r+s&&u;c!==t&&this.updateState({mouseOverSpotlight:c})}),N(this,"handleScroll",()=>{const{target:e}=this.props,t=De(e);if(this.scrollParent!==document){const{isScrolling:n}=this.state;n||this.updateState({isScrolling:!0,showSpotlight:!1}),clearTimeout(this.scrollTimeout),this.scrollTimeout=window.setTimeout(()=>{this.updateState({isScrolling:!1,showSpotlight:!0})},50)}else et(t,"sticky")&&this.updateState({})}),N(this,"handleResize",()=>{clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(()=>{this.isActive&&this.forceUpdate()},100)})}componentDidMount(){const{debug:e,disableScrolling:t,disableScrollParentFix:n=!1,target:r}=this.props,o=De(r);this.scrollParent=vt(o??document.body,n,!0),this.isActive=!0,window.addEventListener("resize",this.handleResize)}componentDidUpdate(e){var t;const{disableScrollParentFix:n,lifecycle:r,spotlightClicks:o,target:i}=this.props,{changed:s}=Rt(e,this.props);if(s("target")||s("disableScrollParentFix")){const a=De(i);this.scrollParent=vt(a??document.body,n,!0)}s("lifecycle",A.TOOLTIP)&&((t=this.scrollParent)==null||t.addEventListener("scroll",this.handleScroll,{passive:!0}),setTimeout(()=>{const{isScrolling:a}=this.state;a||this.updateState({showSpotlight:!0})},100)),(s("spotlightClicks")||s("disableOverlay")||s("lifecycle"))&&(o&&r===A.TOOLTIP?window.addEventListener("mousemove",this.handleMouseMove,!1):r!==A.TOOLTIP&&window.removeEventListener("mousemove",this.handleMouseMove))}componentWillUnmount(){var e;this.isActive=!1,window.removeEventListener("mousemove",this.handleMouseMove),window.removeEventListener("resize",this.handleResize),clearTimeout(this.resizeTimeout),clearTimeout(this.scrollTimeout),(e=this.scrollParent)==null||e.removeEventListener("scroll",this.handleScroll)}get overlayStyles(){const{mouseOverSpotlight:e}=this.state,{disableOverlayClose:t,placement:n,styles:r}=this.props;let o=r.overlay;return gr()&&(o=n==="center"?r.overlayLegacyCenter:r.overlayLegacy),{cursor:t?"default":"pointer",height:vl(),pointerEvents:e?"none":"auto",...o}}get spotlightStyles(){var e,t,n;const{showSpotlight:r}=this.state,{disableScrollParentFix:o=!1,spotlightClicks:i,spotlightPadding:s=0,styles:a,target:l}=this.props,u=De(l),f=po(u),c=et(u),d=Ol(u,s,o);return{...gr()?a.spotlightLegacy:a.spotlight,height:Math.round(((e=f?.height)!=null?e:0)+s*2),left:Math.round(((t=f?.left)!=null?t:0)-s),opacity:r?1:0,pointerEvents:i?"none":"auto",position:c?"fixed":"absolute",top:d,transition:"opacity 0.2s",width:Math.round(((n=f?.width)!=null?n:0)+s*2)}}updateState(e){this.isActive&&this.setState(t=>({...t,...e}))}render(){const{showSpotlight:e}=this.state,{onClickOverlay:t,placement:n}=this.props,{hideSpotlight:r,overlayStyles:o,spotlightStyles:i}=this;if(r())return null;let s=n!=="center"&&e&&b.createElement(jl,{styles:i});if(ho()==="safari"){const{mixBlendMode:a,zIndex:l,...u}=o;s=b.createElement("div",{style:{...u}},s),delete o.backgroundColor}return b.createElement("div",{className:"react-joyride__overlay","data-test-id":"overlay",onClick:t,role:"presentation",style:o},s)}},Ll=class extends b.Component{constructor(){super(...arguments),N(this,"node",null)}componentDidMount(){const{id:e}=this.props;_e()&&(this.node=document.createElement("div"),this.node.id=e,document.body.appendChild(this.node),ft||this.renderReact15())}componentDidUpdate(){_e()&&(ft||this.renderReact15())}componentWillUnmount(){!_e()||!this.node||(ft||Dt.unmountComponentAtNode(this.node),this.node.parentNode===document.body&&(document.body.removeChild(this.node),this.node=null))}renderReact15(){if(!_e())return;const{children:e}=this.props;this.node&&Dt.unstable_renderSubtreeIntoContainer(this,e,this.node)}renderReact16(){if(!_e()||!ft)return null;const{children:e}=this.props;return this.node?Dt.createPortal(e,this.node):null}render(){return ft?this.renderReact16():null}},$l=class{constructor(e,t){if(N(this,"element"),N(this,"options"),N(this,"canBeTabbed",n=>{const{tabIndex:r}=n;return r===null||r<0?!1:this.canHaveFocus(n)}),N(this,"canHaveFocus",n=>{const r=/input|select|textarea|button|object/,o=n.nodeName.toLowerCase();return(r.test(o)&&!n.getAttribute("disabled")||o==="a"&&!!n.getAttribute("href"))&&this.isVisible(n)}),N(this,"findValidTabElements",()=>[].slice.call(this.element.querySelectorAll("*"),0).filter(this.canBeTabbed)),N(this,"handleKeyDown",n=>{const{code:r="Tab"}=this.options;n.code===r&&this.interceptTab(n)}),N(this,"interceptTab",n=>{n.preventDefault();const r=this.findValidTabElements(),{shiftKey:o}=n;if(!r.length)return;let i=document.activeElement?r.indexOf(document.activeElement):0;i===-1||!o&&i+1===r.length?i=0:o&&i===0?i=r.length-1:i+=o?-1:1,r[i].focus()}),N(this,"isHidden",n=>{const r=n.offsetWidth<=0&&n.offsetHeight<=0,o=window.getComputedStyle(n);return r&&!n.innerHTML?!0:r&&o.getPropertyValue("overflow")!=="visible"||o.getPropertyValue("display")==="none"}),N(this,"isVisible",n=>{let r=n;for(;r;)if(r instanceof HTMLElement){if(r===document.body)break;if(this.isHidden(r))return!1;r=r.parentNode}return!0}),N(this,"removeScope",()=>{window.removeEventListener("keydown",this.handleKeyDown)}),N(this,"checkFocus",n=>{document.activeElement!==n&&(n.focus(),window.requestAnimationFrame(()=>this.checkFocus(n)))}),N(this,"setFocus",()=>{const{selector:n}=this.options;if(!n)return;const r=this.element.querySelector(n);r&&window.requestAnimationFrame(()=>this.checkFocus(r))}),!(e instanceof HTMLElement))throw new TypeError("Invalid parameter: element must be an HTMLElement");this.element=e,this.options=t,window.addEventListener("keydown",this.handleKeyDown,!1),this.setFocus()}},Hl=class extends b.Component{constructor(e){if(super(e),N(this,"beacon",null),N(this,"setBeaconRef",o=>{this.beacon=o}),e.beaconComponent)return;const t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.id="joyride-beacon-animation",e.nonce&&n.setAttribute("nonce",e.nonce),n.appendChild(document.createTextNode(` @keyframes joyride-beacon-inner { 20% { opacity: 0.9; diff --git a/webui/dist/assets/radix-core-CEUnGg09.js b/webui/dist/assets/radix-core-CEUnGg09.js deleted file mode 100644 index 51e6765e..00000000 --- a/webui/dist/assets/radix-core-CEUnGg09.js +++ /dev/null @@ -1,45 +0,0 @@ -import{r as i,j as v,R as Ee,a as sn,b as Ye,c as ds}from"./router-9vIXuQkh.js";function N(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function fs(e,t){const n=i.createContext(t),o=s=>{const{children:a,...c}=s,l=i.useMemo(()=>c,Object.values(c));return v.jsx(n.Provider,{value:l,children:a})};o.displayName=e+"Provider";function r(s){const a=i.useContext(n);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[o,r]}function Oe(e,t=[]){let n=[];function o(s,a){const c=i.createContext(a),l=n.length;n=[...n,a];const u=p=>{const{scope:y,children:h,...x}=p,d=y?.[e]?.[l]||c,m=i.useMemo(()=>x,Object.values(x));return v.jsx(d.Provider,{value:m,children:h})};u.displayName=s+"Provider";function f(p,y){const h=y?.[e]?.[l]||c,x=i.useContext(h);if(x)return x;if(a!==void 0)return a;throw new Error(`\`${p}\` must be used within \`${s}\``)}return[u,f]}const r=()=>{const s=n.map(a=>i.createContext(a));return function(c){const l=c?.[e]||s;return i.useMemo(()=>({[`__scope${e}`]:{...c,[e]:l}}),[c,l])}};return r.scopeName=e,[o,ps(r,...t)]}function ps(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const o=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(s){const a=o.reduce((c,{useScope:l,scopeName:u})=>{const p=l(s)[`__scope${u}`];return{...c,...p}},{});return i.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}function Pn(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function $e(...e){return t=>{let n=!1;const o=e.map(r=>{const s=Pn(r,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let r=0;r{const{children:s,...a}=o,c=i.Children.toArray(s),l=c.find(vs);if(l){const u=l.props.children,f=c.map(p=>p===l?i.Children.count(u)>1?i.Children.only(null):i.isValidElement(u)?u.props.children:null:p);return v.jsx(t,{...a,ref:r,children:i.isValidElement(u)?i.cloneElement(u,void 0,f):null})}return v.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}function ms(e){const t=i.forwardRef((n,o)=>{const{children:r,...s}=n;if(i.isValidElement(r)){const a=ys(r),c=gs(s,r.props);return r.type!==i.Fragment&&(c.ref=o?$e(o,a):a),i.cloneElement(r,c)}return i.Children.count(r)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var hs=Symbol("radix.slottable");function vs(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===hs}function gs(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...c)=>{const l=s(...c);return r(...c),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function ys(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function eo(e){const t=e+"CollectionProvider",[n,o]=Oe(t),[r,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=d=>{const{scope:m,children:w}=d,g=Ee.useRef(null),C=Ee.useRef(new Map).current;return v.jsx(r,{scope:m,itemMap:C,collectionRef:g,children:w})};a.displayName=t;const c=e+"CollectionSlot",l=An(c),u=Ee.forwardRef((d,m)=>{const{scope:w,children:g}=d,C=s(c,w),b=B(m,C.collectionRef);return v.jsx(l,{ref:b,children:g})});u.displayName=c;const f=e+"CollectionItemSlot",p="data-radix-collection-item",y=An(f),h=Ee.forwardRef((d,m)=>{const{scope:w,children:g,...C}=d,b=Ee.useRef(null),E=B(m,b),R=s(f,w);return Ee.useEffect(()=>(R.itemMap.set(b,{ref:b,...C}),()=>void R.itemMap.delete(b))),v.jsx(y,{[p]:"",ref:E,children:g})});h.displayName=f;function x(d){const m=s(e+"CollectionConsumer",d);return Ee.useCallback(()=>{const g=m.collectionRef.current;if(!g)return[];const C=Array.from(g.querySelectorAll(`[${p}]`));return Array.from(m.itemMap.values()).sort((R,S)=>C.indexOf(R.ref.current)-C.indexOf(S.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:a,Slot:u,ItemSlot:h},x,o]}var z=globalThis?.document?i.useLayoutEffect:()=>{},ws=sn[" useId ".trim().toString()]||(()=>{}),xs=0;function Se(e){const[t,n]=i.useState(ws());return z(()=>{n(o=>o??String(xs++))},[e]),t?`radix-${t}`:""}function Cs(e){const t=bs(e),n=i.forwardRef((o,r)=>{const{children:s,...a}=o,c=i.Children.toArray(s),l=c.find(Ss);if(l){const u=l.props.children,f=c.map(p=>p===l?i.Children.count(u)>1?i.Children.only(null):i.isValidElement(u)?u.props.children:null:p);return v.jsx(t,{...a,ref:r,children:i.isValidElement(u)?i.cloneElement(u,void 0,f):null})}return v.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}function bs(e){const t=i.forwardRef((n,o)=>{const{children:r,...s}=n;if(i.isValidElement(r)){const a=Rs(r),c=Ts(s,r.props);return r.type!==i.Fragment&&(c.ref=o?$e(o,a):a),i.cloneElement(r,c)}return i.Children.count(r)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Es=Symbol("radix.slottable");function Ss(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Es}function Ts(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...c)=>{const l=s(...c);return r(...c),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function Rs(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Ps=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],D=Ps.reduce((e,t)=>{const n=Cs(`Primitive.${t}`),o=i.forwardRef((r,s)=>{const{asChild:a,...c}=r,l=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),v.jsx(l,{...c,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function to(e,t){e&&Ye.flushSync(()=>e.dispatchEvent(t))}function ee(e){const t=i.useRef(e);return i.useEffect(()=>{t.current=e}),i.useMemo(()=>(...n)=>t.current?.(...n),[])}var As=sn[" useInsertionEffect ".trim().toString()]||z;function ke({prop:e,defaultProp:t,onChange:n=()=>{},caller:o}){const[r,s,a]=Os({defaultProp:t,onChange:n}),c=e!==void 0,l=c?e:r;{const f=i.useRef(e!==void 0);i.useEffect(()=>{const p=f.current;p!==c&&console.warn(`${o} is changing from ${p?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=c},[c,o])}const u=i.useCallback(f=>{if(c){const p=Is(f)?f(e):f;p!==e&&a.current?.(p)}else s(f)},[c,e,s,a]);return[l,u]}function Os({defaultProp:e,onChange:t}){const[n,o]=i.useState(e),r=i.useRef(n),s=i.useRef(t);return As(()=>{s.current=t},[t]),i.useEffect(()=>{r.current!==n&&(s.current?.(n),r.current=n)},[n,r]),[n,o,s]}function Is(e){return typeof e=="function"}var Ns=i.createContext(void 0);function _s(e){const t=i.useContext(Ns);return e||t||"ltr"}function Ds(e,t){return i.useReducer((n,o)=>t[n][o]??n,e)}var ye=e=>{const{present:t,children:n}=e,o=Ms(t),r=typeof n=="function"?n({present:o.isPresent}):i.Children.only(n),s=B(o.ref,Ls(r));return typeof n=="function"||o.isPresent?i.cloneElement(r,{ref:s}):null};ye.displayName="Presence";function Ms(e){const[t,n]=i.useState(),o=i.useRef(null),r=i.useRef(e),s=i.useRef("none"),a=e?"mounted":"unmounted",[c,l]=Ds(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return i.useEffect(()=>{const u=Je(o.current);s.current=c==="mounted"?u:"none"},[c]),z(()=>{const u=o.current,f=r.current;if(f!==e){const y=s.current,h=Je(u);e?l("MOUNT"):h==="none"||u?.display==="none"?l("UNMOUNT"):l(f&&y!==h?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,l]),z(()=>{if(t){let u;const f=t.ownerDocument.defaultView??window,p=h=>{const d=Je(o.current).includes(CSS.escape(h.animationName));if(h.target===t&&d&&(l("ANIMATION_END"),!r.current)){const m=t.style.animationFillMode;t.style.animationFillMode="forwards",u=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=m)})}},y=h=>{h.target===t&&(s.current=Je(o.current))};return t.addEventListener("animationstart",y),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{f.clearTimeout(u),t.removeEventListener("animationstart",y),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:i.useCallback(u=>{o.current=u?getComputedStyle(u):null,n(u)},[])}}function Je(e){return e?.animationName||"none"}function Ls(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function On(e,[t,n]){return Math.min(n,Math.max(t,e))}var ks=Symbol.for("react.lazy"),lt=sn[" use ".trim().toString()];function js(e){return typeof e=="object"&&e!==null&&"then"in e}function no(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===ks&&"_payload"in e&&js(e._payload)}function oo(e){const t=Fs(e),n=i.forwardRef((o,r)=>{let{children:s,...a}=o;no(s)&&typeof lt=="function"&&(s=lt(s._payload));const c=i.Children.toArray(s),l=c.find(Ws);if(l){const u=l.props.children,f=c.map(p=>p===l?i.Children.count(u)>1?i.Children.only(null):i.isValidElement(u)?u.props.children:null:p);return v.jsx(t,{...a,ref:r,children:i.isValidElement(u)?i.cloneElement(u,void 0,f):null})}return v.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}var Ul=oo("Slot");function Fs(e){const t=i.forwardRef((n,o)=>{let{children:r,...s}=n;if(no(r)&&typeof lt=="function"&&(r=lt(r._payload)),i.isValidElement(r)){const a=Vs(r),c=Bs(s,r.props);return r.type!==i.Fragment&&(c.ref=o?$e(o,a):a),i.cloneElement(r,c)}return i.Children.count(r)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var $s=Symbol("radix.slottable");function Ws(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===$s}function Bs(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...c)=>{const l=s(...c);return r(...c),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function Vs(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Hs(e,t=globalThis?.document){const n=ee(e);i.useEffect(()=>{const o=r=>{r.key==="Escape"&&n(r)};return t.addEventListener("keydown",o,{capture:!0}),()=>t.removeEventListener("keydown",o,{capture:!0})},[n,t])}var Us="DismissableLayer",Ut="dismissableLayer.update",Ks="dismissableLayer.pointerDownOutside",zs="dismissableLayer.focusOutside",In,ro=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Xe=i.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:o,onPointerDownOutside:r,onFocusOutside:s,onInteractOutside:a,onDismiss:c,...l}=e,u=i.useContext(ro),[f,p]=i.useState(null),y=f?.ownerDocument??globalThis?.document,[,h]=i.useState({}),x=B(t,S=>p(S)),d=Array.from(u.layers),[m]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),w=d.indexOf(m),g=f?d.indexOf(f):-1,C=u.layersWithOutsidePointerEventsDisabled.size>0,b=g>=w,E=Xs(S=>{const O=S.target,M=[...u.branches].some(L=>L.contains(O));!b||M||(r?.(S),a?.(S),S.defaultPrevented||c?.())},y),R=Gs(S=>{const O=S.target;[...u.branches].some(L=>L.contains(O))||(s?.(S),a?.(S),S.defaultPrevented||c?.())},y);return Hs(S=>{g===u.layers.size-1&&(o?.(S),!S.defaultPrevented&&c&&(S.preventDefault(),c()))},y),i.useEffect(()=>{if(f)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(In=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),Nn(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(y.body.style.pointerEvents=In)}},[f,y,n,u]),i.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),Nn())},[f,u]),i.useEffect(()=>{const S=()=>h({});return document.addEventListener(Ut,S),()=>document.removeEventListener(Ut,S)},[]),v.jsx(D.div,{...l,ref:x,style:{pointerEvents:C?b?"auto":"none":void 0,...e.style},onFocusCapture:N(e.onFocusCapture,R.onFocusCapture),onBlurCapture:N(e.onBlurCapture,R.onBlurCapture),onPointerDownCapture:N(e.onPointerDownCapture,E.onPointerDownCapture)})});Xe.displayName=Us;var Ys="DismissableLayerBranch",so=i.forwardRef((e,t)=>{const n=i.useContext(ro),o=i.useRef(null),r=B(t,o);return i.useEffect(()=>{const s=o.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),v.jsx(D.div,{...e,ref:r})});so.displayName=Ys;function Xs(e,t=globalThis?.document){const n=ee(e),o=i.useRef(!1),r=i.useRef(()=>{});return i.useEffect(()=>{const s=c=>{if(c.target&&!o.current){let l=function(){io(Ks,n,u,{discrete:!0})};const u={originalEvent:c};c.pointerType==="touch"?(t.removeEventListener("click",r.current),r.current=l,t.addEventListener("click",r.current,{once:!0})):l()}else t.removeEventListener("click",r.current);o.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",s),t.removeEventListener("click",r.current)}},[t,n]),{onPointerDownCapture:()=>o.current=!0}}function Gs(e,t=globalThis?.document){const n=ee(e),o=i.useRef(!1);return i.useEffect(()=>{const r=s=>{s.target&&!o.current&&io(zs,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",r),()=>t.removeEventListener("focusin",r)},[t,n]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function Nn(){const e=new CustomEvent(Ut);document.dispatchEvent(e)}function io(e,t,n,{discrete:o}){const r=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),o?to(r,s):r.dispatchEvent(s)}var qs=Xe,Zs=so,Mt="focusScope.autoFocusOnMount",Lt="focusScope.autoFocusOnUnmount",_n={bubbles:!1,cancelable:!0},Qs="FocusScope",an=i.forwardRef((e,t)=>{const{loop:n=!1,trapped:o=!1,onMountAutoFocus:r,onUnmountAutoFocus:s,...a}=e,[c,l]=i.useState(null),u=ee(r),f=ee(s),p=i.useRef(null),y=B(t,d=>l(d)),h=i.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;i.useEffect(()=>{if(o){let d=function(C){if(h.paused||!c)return;const b=C.target;c.contains(b)?p.current=b:me(p.current,{select:!0})},m=function(C){if(h.paused||!c)return;const b=C.relatedTarget;b!==null&&(c.contains(b)||me(p.current,{select:!0}))},w=function(C){if(document.activeElement===document.body)for(const E of C)E.removedNodes.length>0&&me(c)};document.addEventListener("focusin",d),document.addEventListener("focusout",m);const g=new MutationObserver(w);return c&&g.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",d),document.removeEventListener("focusout",m),g.disconnect()}}},[o,c,h.paused]),i.useEffect(()=>{if(c){Mn.add(h);const d=document.activeElement;if(!c.contains(d)){const w=new CustomEvent(Mt,_n);c.addEventListener(Mt,u),c.dispatchEvent(w),w.defaultPrevented||(Js(ri(ao(c)),{select:!0}),document.activeElement===d&&me(c))}return()=>{c.removeEventListener(Mt,u),setTimeout(()=>{const w=new CustomEvent(Lt,_n);c.addEventListener(Lt,f),c.dispatchEvent(w),w.defaultPrevented||me(d??document.body,{select:!0}),c.removeEventListener(Lt,f),Mn.remove(h)},0)}}},[c,u,f,h]);const x=i.useCallback(d=>{if(!n&&!o||h.paused)return;const m=d.key==="Tab"&&!d.altKey&&!d.ctrlKey&&!d.metaKey,w=document.activeElement;if(m&&w){const g=d.currentTarget,[C,b]=ei(g);C&&b?!d.shiftKey&&w===b?(d.preventDefault(),n&&me(C,{select:!0})):d.shiftKey&&w===C&&(d.preventDefault(),n&&me(b,{select:!0})):w===g&&d.preventDefault()}},[n,o,h.paused]);return v.jsx(D.div,{tabIndex:-1,...a,ref:y,onKeyDown:x})});an.displayName=Qs;function Js(e,{select:t=!1}={}){const n=document.activeElement;for(const o of e)if(me(o,{select:t}),document.activeElement!==n)return}function ei(e){const t=ao(e),n=Dn(t,e),o=Dn(t.reverse(),e);return[n,o]}function ao(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const r=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||r?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Dn(e,t){for(const n of e)if(!ti(n,{upTo:t}))return n}function ti(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function ni(e){return e instanceof HTMLInputElement&&"select"in e}function me(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&ni(e)&&t&&e.select()}}var Mn=oi();function oi(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Ln(e,t),e.unshift(t)},remove(t){e=Ln(e,t),e[0]?.resume()}}}function Ln(e,t){const n=[...e],o=n.indexOf(t);return o!==-1&&n.splice(o,1),n}function ri(e){return e.filter(t=>t.tagName!=="A")}var si="Portal",Ge=i.forwardRef((e,t)=>{const{container:n,...o}=e,[r,s]=i.useState(!1);z(()=>s(!0),[]);const a=n||r&&globalThis?.document?.body;return a?ds.createPortal(v.jsx(D.div,{...o,ref:t}),a):null});Ge.displayName=si;var kt=0;function co(){i.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??kn()),document.body.insertAdjacentElement("beforeend",e[1]??kn()),kt++,()=>{kt===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),kt--}},[])}function kn(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var se=function(){return se=Object.assign||function(t){for(var n,o=1,r=arguments.length;o"u")return bi;var t=Ei(e),n=document.documentElement.clientWidth,o=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,o-n+t[2]-t[0])}},Ti=po(),Me="data-scroll-locked",Ri=function(e,t,n,o){var r=e.left,s=e.top,a=e.right,c=e.gap;return n===void 0&&(n="margin"),` - .`.concat(ai,` { - overflow: hidden `).concat(o,`; - padding-right: `).concat(c,"px ").concat(o,`; - } - body[`).concat(Me,`] { - overflow: hidden `).concat(o,`; - overscroll-behavior: contain; - `).concat([t&&"position: relative ".concat(o,";"),n==="margin"&&` - padding-left: `.concat(r,`px; - padding-top: `).concat(s,`px; - padding-right: `).concat(a,`px; - margin-left:0; - margin-top:0; - margin-right: `).concat(c,"px ").concat(o,`; - `),n==="padding"&&"padding-right: ".concat(c,"px ").concat(o,";")].filter(Boolean).join(""),` - } - - .`).concat(it,` { - right: `).concat(c,"px ").concat(o,`; - } - - .`).concat(at,` { - margin-right: `).concat(c,"px ").concat(o,`; - } - - .`).concat(it," .").concat(it,` { - right: 0 `).concat(o,`; - } - - .`).concat(at," .").concat(at,` { - margin-right: 0 `).concat(o,`; - } - - body[`).concat(Me,`] { - `).concat(ci,": ").concat(c,`px; - } -`)},Fn=function(){var e=parseInt(document.body.getAttribute(Me)||"0",10);return isFinite(e)?e:0},Pi=function(){i.useEffect(function(){return document.body.setAttribute(Me,(Fn()+1).toString()),function(){var e=Fn()-1;e<=0?document.body.removeAttribute(Me):document.body.setAttribute(Me,e.toString())}},[])},Ai=function(e){var t=e.noRelative,n=e.noImportant,o=e.gapMode,r=o===void 0?"margin":o;Pi();var s=i.useMemo(function(){return Si(r)},[r]);return i.createElement(Ti,{styles:Ri(s,!t,r,n?"":"!important")})},Kt=!1;if(typeof window<"u")try{var et=Object.defineProperty({},"passive",{get:function(){return Kt=!0,!0}});window.addEventListener("test",et,et),window.removeEventListener("test",et,et)}catch{Kt=!1}var Ne=Kt?{passive:!1}:!1,Oi=function(e){return e.tagName==="TEXTAREA"},mo=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Oi(e)&&n[t]==="visible")},Ii=function(e){return mo(e,"overflowY")},Ni=function(e){return mo(e,"overflowX")},$n=function(e,t){var n=t.ownerDocument,o=t;do{typeof ShadowRoot<"u"&&o instanceof ShadowRoot&&(o=o.host);var r=ho(e,o);if(r){var s=vo(e,o),a=s[1],c=s[2];if(a>c)return!0}o=o.parentNode}while(o&&o!==n.body);return!1},_i=function(e){var t=e.scrollTop,n=e.scrollHeight,o=e.clientHeight;return[t,n,o]},Di=function(e){var t=e.scrollLeft,n=e.scrollWidth,o=e.clientWidth;return[t,n,o]},ho=function(e,t){return e==="v"?Ii(t):Ni(t)},vo=function(e,t){return e==="v"?_i(t):Di(t)},Mi=function(e,t){return e==="h"&&t==="rtl"?-1:1},Li=function(e,t,n,o,r){var s=Mi(e,window.getComputedStyle(t).direction),a=s*o,c=n.target,l=t.contains(c),u=!1,f=a>0,p=0,y=0;do{if(!c)break;var h=vo(e,c),x=h[0],d=h[1],m=h[2],w=d-m-s*x;(x||w)&&ho(e,c)&&(p+=w,y+=x);var g=c.parentNode;c=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!l&&c!==document.body||l&&(t.contains(c)||t===c));return(f&&Math.abs(p)<1||!f&&Math.abs(y)<1)&&(u=!0),u},tt=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Wn=function(e){return[e.deltaX,e.deltaY]},Bn=function(e){return e&&"current"in e?e.current:e},ki=function(e,t){return e[0]===t[0]&&e[1]===t[1]},ji=function(e){return` - .block-interactivity-`.concat(e,` {pointer-events: none;} - .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},Fi=0,_e=[];function $i(e){var t=i.useRef([]),n=i.useRef([0,0]),o=i.useRef(),r=i.useState(Fi++)[0],s=i.useState(po)[0],a=i.useRef(e);i.useEffect(function(){a.current=e},[e]),i.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(r));var d=ii([e.lockRef.current],(e.shards||[]).map(Bn),!0).filter(Boolean);return d.forEach(function(m){return m.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),d.forEach(function(m){return m.classList.remove("allow-interactivity-".concat(r))})}}},[e.inert,e.lockRef.current,e.shards]);var c=i.useCallback(function(d,m){if("touches"in d&&d.touches.length===2||d.type==="wheel"&&d.ctrlKey)return!a.current.allowPinchZoom;var w=tt(d),g=n.current,C="deltaX"in d?d.deltaX:g[0]-w[0],b="deltaY"in d?d.deltaY:g[1]-w[1],E,R=d.target,S=Math.abs(C)>Math.abs(b)?"h":"v";if("touches"in d&&S==="h"&&R.type==="range")return!1;var O=$n(S,R);if(!O)return!0;if(O?E=S:(E=S==="v"?"h":"v",O=$n(S,R)),!O)return!1;if(!o.current&&"changedTouches"in d&&(C||b)&&(o.current=E),!E)return!0;var M=o.current||E;return Li(M,m,d,M==="h"?C:b)},[]),l=i.useCallback(function(d){var m=d;if(!(!_e.length||_e[_e.length-1]!==s)){var w="deltaY"in m?Wn(m):tt(m),g=t.current.filter(function(E){return E.name===m.type&&(E.target===m.target||m.target===E.shadowParent)&&ki(E.delta,w)})[0];if(g&&g.should){m.cancelable&&m.preventDefault();return}if(!g){var C=(a.current.shards||[]).map(Bn).filter(Boolean).filter(function(E){return E.contains(m.target)}),b=C.length>0?c(m,C[0]):!a.current.noIsolation;b&&m.cancelable&&m.preventDefault()}}},[]),u=i.useCallback(function(d,m,w,g){var C={name:d,delta:m,target:w,should:g,shadowParent:Wi(w)};t.current.push(C),setTimeout(function(){t.current=t.current.filter(function(b){return b!==C})},1)},[]),f=i.useCallback(function(d){n.current=tt(d),o.current=void 0},[]),p=i.useCallback(function(d){u(d.type,Wn(d),d.target,c(d,e.lockRef.current))},[]),y=i.useCallback(function(d){u(d.type,tt(d),d.target,c(d,e.lockRef.current))},[]);i.useEffect(function(){return _e.push(s),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:y}),document.addEventListener("wheel",l,Ne),document.addEventListener("touchmove",l,Ne),document.addEventListener("touchstart",f,Ne),function(){_e=_e.filter(function(d){return d!==s}),document.removeEventListener("wheel",l,Ne),document.removeEventListener("touchmove",l,Ne),document.removeEventListener("touchstart",f,Ne)}},[]);var h=e.removeScrollBar,x=e.inert;return i.createElement(i.Fragment,null,x?i.createElement(s,{styles:ji(r)}):null,h?i.createElement(Ai,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Wi(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Bi=hi(fo,$i);var cn=i.forwardRef(function(e,t){return i.createElement(vt,se({},e,{ref:t,sideCar:Bi}))});cn.classNames=vt.classNames;var Vi=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},De=new WeakMap,nt=new WeakMap,ot={},Wt=0,go=function(e){return e&&(e.host||go(e.parentNode))},Hi=function(e,t){return t.map(function(n){if(e.contains(n))return n;var o=go(n);return o&&e.contains(o)?o:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Ui=function(e,t,n,o){var r=Hi(t,Array.isArray(e)?e:[e]);ot[n]||(ot[n]=new WeakMap);var s=ot[n],a=[],c=new Set,l=new Set(r),u=function(p){!p||c.has(p)||(c.add(p),u(p.parentNode))};r.forEach(u);var f=function(p){!p||l.has(p)||Array.prototype.forEach.call(p.children,function(y){if(c.has(y))f(y);else try{var h=y.getAttribute(o),x=h!==null&&h!=="false",d=(De.get(y)||0)+1,m=(s.get(y)||0)+1;De.set(y,d),s.set(y,m),a.push(y),d===1&&x&&nt.set(y,!0),m===1&&y.setAttribute(n,"true"),x||y.setAttribute(o,"true")}catch(w){console.error("aria-hidden: cannot operate on ",y,w)}})};return f(t),c.clear(),Wt++,function(){a.forEach(function(p){var y=De.get(p)-1,h=s.get(p)-1;De.set(p,y),s.set(p,h),y||(nt.has(p)||p.removeAttribute(o),nt.delete(p)),h||p.removeAttribute(n)}),Wt--,Wt||(De=new WeakMap,De=new WeakMap,nt=new WeakMap,ot={})}},yo=function(e,t,n){n===void 0&&(n="data-aria-hidden");var o=Array.from(Array.isArray(e)?e:[e]),r=Vi(e);return r?(o.push.apply(o,Array.from(r.querySelectorAll("[aria-live], script"))),Ui(o,r,n,"aria-hidden")):function(){return null}};function Ki(e){const t=zi(e),n=i.forwardRef((o,r)=>{const{children:s,...a}=o,c=i.Children.toArray(s),l=c.find(Xi);if(l){const u=l.props.children,f=c.map(p=>p===l?i.Children.count(u)>1?i.Children.only(null):i.isValidElement(u)?u.props.children:null:p);return v.jsx(t,{...a,ref:r,children:i.isValidElement(u)?i.cloneElement(u,void 0,f):null})}return v.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}function zi(e){const t=i.forwardRef((n,o)=>{const{children:r,...s}=n;if(i.isValidElement(r)){const a=qi(r),c=Gi(s,r.props);return r.type!==i.Fragment&&(c.ref=o?$e(o,a):a),i.cloneElement(r,c)}return i.Children.count(r)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Yi=Symbol("radix.slottable");function Xi(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Yi}function Gi(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...c)=>{const l=s(...c);return r(...c),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function qi(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var gt="Dialog",[wo,Kl]=Oe(gt),[Zi,oe]=wo(gt),xo=e=>{const{__scopeDialog:t,children:n,open:o,defaultOpen:r,onOpenChange:s,modal:a=!0}=e,c=i.useRef(null),l=i.useRef(null),[u,f]=ke({prop:o,defaultProp:r??!1,onChange:s,caller:gt});return v.jsx(Zi,{scope:t,triggerRef:c,contentRef:l,contentId:Se(),titleId:Se(),descriptionId:Se(),open:u,onOpenChange:f,onOpenToggle:i.useCallback(()=>f(p=>!p),[f]),modal:a,children:n})};xo.displayName=gt;var Co="DialogTrigger",bo=i.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=oe(Co,n),s=B(t,r.triggerRef);return v.jsx(D.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":dn(r.open),...o,ref:s,onClick:N(e.onClick,r.onOpenToggle)})});bo.displayName=Co;var ln="DialogPortal",[Qi,Eo]=wo(ln,{forceMount:void 0}),So=e=>{const{__scopeDialog:t,forceMount:n,children:o,container:r}=e,s=oe(ln,t);return v.jsx(Qi,{scope:t,forceMount:n,children:i.Children.map(o,a=>v.jsx(ye,{present:n||s.open,children:v.jsx(Ge,{asChild:!0,container:r,children:a})}))})};So.displayName=ln;var ut="DialogOverlay",To=i.forwardRef((e,t)=>{const n=Eo(ut,e.__scopeDialog),{forceMount:o=n.forceMount,...r}=e,s=oe(ut,e.__scopeDialog);return s.modal?v.jsx(ye,{present:o||s.open,children:v.jsx(ea,{...r,ref:t})}):null});To.displayName=ut;var Ji=Ki("DialogOverlay.RemoveScroll"),ea=i.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=oe(ut,n);return v.jsx(cn,{as:Ji,allowPinchZoom:!0,shards:[r.contentRef],children:v.jsx(D.div,{"data-state":dn(r.open),...o,ref:t,style:{pointerEvents:"auto",...o.style}})})}),Te="DialogContent",Ro=i.forwardRef((e,t)=>{const n=Eo(Te,e.__scopeDialog),{forceMount:o=n.forceMount,...r}=e,s=oe(Te,e.__scopeDialog);return v.jsx(ye,{present:o||s.open,children:s.modal?v.jsx(ta,{...r,ref:t}):v.jsx(na,{...r,ref:t})})});Ro.displayName=Te;var ta=i.forwardRef((e,t)=>{const n=oe(Te,e.__scopeDialog),o=i.useRef(null),r=B(t,n.contentRef,o);return i.useEffect(()=>{const s=o.current;if(s)return yo(s)},[]),v.jsx(Po,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:N(e.onCloseAutoFocus,s=>{s.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:N(e.onPointerDownOutside,s=>{const a=s.detail.originalEvent,c=a.button===0&&a.ctrlKey===!0;(a.button===2||c)&&s.preventDefault()}),onFocusOutside:N(e.onFocusOutside,s=>s.preventDefault())})}),na=i.forwardRef((e,t)=>{const n=oe(Te,e.__scopeDialog),o=i.useRef(!1),r=i.useRef(!1);return v.jsx(Po,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{e.onCloseAutoFocus?.(s),s.defaultPrevented||(o.current||n.triggerRef.current?.focus(),s.preventDefault()),o.current=!1,r.current=!1},onInteractOutside:s=>{e.onInteractOutside?.(s),s.defaultPrevented||(o.current=!0,s.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const a=s.target;n.triggerRef.current?.contains(a)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&r.current&&s.preventDefault()}})}),Po=i.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:o,onOpenAutoFocus:r,onCloseAutoFocus:s,...a}=e,c=oe(Te,n),l=i.useRef(null),u=B(t,l);return co(),v.jsxs(v.Fragment,{children:[v.jsx(an,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:r,onUnmountAutoFocus:s,children:v.jsx(Xe,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":dn(c.open),...a,ref:u,onDismiss:()=>c.onOpenChange(!1)})}),v.jsxs(v.Fragment,{children:[v.jsx(oa,{titleId:c.titleId}),v.jsx(sa,{contentRef:l,descriptionId:c.descriptionId})]})]})}),un="DialogTitle",Ao=i.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=oe(un,n);return v.jsx(D.h2,{id:r.titleId,...o,ref:t})});Ao.displayName=un;var Oo="DialogDescription",Io=i.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=oe(Oo,n);return v.jsx(D.p,{id:r.descriptionId,...o,ref:t})});Io.displayName=Oo;var No="DialogClose",_o=i.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=oe(No,n);return v.jsx(D.button,{type:"button",...o,ref:t,onClick:N(e.onClick,()=>r.onOpenChange(!1))})});_o.displayName=No;function dn(e){return e?"open":"closed"}var Do="DialogTitleWarning",[zl,Mo]=fs(Do,{contentName:Te,titleName:un,docsSlug:"dialog"}),oa=({titleId:e})=>{const t=Mo(Do),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. - -If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. - -For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return i.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},ra="DialogDescriptionWarning",sa=({contentRef:e,descriptionId:t})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Mo(ra).contentName}}.`;return i.useEffect(()=>{const r=e.current?.getAttribute("aria-describedby");t&&r&&(document.getElementById(t)||console.warn(o))},[o,e,t]),null},Yl=xo,Xl=bo,Gl=So,ql=To,Zl=Ro,Ql=Ao,Jl=Io,eu=_o;function Lo(e){const t=i.useRef({value:e,previous:e});return i.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function ko(e){const[t,n]=i.useState(void 0);return z(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const s=r[0];let a,c;if("borderBoxSize"in s){const l=s.borderBoxSize,u=Array.isArray(l)?l[0]:l;a=u.inlineSize,c=u.blockSize}else a=e.offsetWidth,c=e.offsetHeight;n({width:a,height:c})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else n(void 0)},[e]),t}var yt="Checkbox",[ia]=Oe(yt),[aa,fn]=ia(yt);function ca(e){const{__scopeCheckbox:t,checked:n,children:o,defaultChecked:r,disabled:s,form:a,name:c,onCheckedChange:l,required:u,value:f="on",internal_do_not_use_render:p}=e,[y,h]=ke({prop:n,defaultProp:r??!1,onChange:l,caller:yt}),[x,d]=i.useState(null),[m,w]=i.useState(null),g=i.useRef(!1),C=x?!!a||!!x.closest("form"):!0,b={checked:y,disabled:s,setChecked:h,control:x,setControl:d,name:c,form:a,value:f,hasConsumerStoppedPropagationRef:g,required:u,defaultChecked:he(r)?!1:r,isFormControl:C,bubbleInput:m,setBubbleInput:w};return v.jsx(aa,{scope:t,...b,children:da(p)?p(b):o})}var jo="CheckboxTrigger",Fo=i.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...o},r)=>{const{control:s,value:a,disabled:c,checked:l,required:u,setControl:f,setChecked:p,hasConsumerStoppedPropagationRef:y,isFormControl:h,bubbleInput:x}=fn(jo,e),d=B(r,f),m=i.useRef(l);return i.useEffect(()=>{const w=s?.form;if(w){const g=()=>p(m.current);return w.addEventListener("reset",g),()=>w.removeEventListener("reset",g)}},[s,p]),v.jsx(D.button,{type:"button",role:"checkbox","aria-checked":he(l)?"mixed":l,"aria-required":u,"data-state":Vo(l),"data-disabled":c?"":void 0,disabled:c,value:a,...o,ref:d,onKeyDown:N(t,w=>{w.key==="Enter"&&w.preventDefault()}),onClick:N(n,w=>{p(g=>he(g)?!0:!g),x&&h&&(y.current=w.isPropagationStopped(),y.current||w.stopPropagation())})})});Fo.displayName=jo;var la=i.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:o,checked:r,defaultChecked:s,required:a,disabled:c,value:l,onCheckedChange:u,form:f,...p}=e;return v.jsx(ca,{__scopeCheckbox:n,checked:r,defaultChecked:s,disabled:c,required:a,onCheckedChange:u,name:o,form:f,value:l,internal_do_not_use_render:({isFormControl:y})=>v.jsxs(v.Fragment,{children:[v.jsx(Fo,{...p,ref:t,__scopeCheckbox:n}),y&&v.jsx(Bo,{__scopeCheckbox:n})]})})});la.displayName=yt;var $o="CheckboxIndicator",ua=i.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:o,...r}=e,s=fn($o,n);return v.jsx(ye,{present:o||he(s.checked)||s.checked===!0,children:v.jsx(D.span,{"data-state":Vo(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:t,style:{pointerEvents:"none",...e.style}})})});ua.displayName=$o;var Wo="CheckboxBubbleInput",Bo=i.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:o,hasConsumerStoppedPropagationRef:r,checked:s,defaultChecked:a,required:c,disabled:l,name:u,value:f,form:p,bubbleInput:y,setBubbleInput:h}=fn(Wo,e),x=B(n,h),d=Lo(s),m=ko(o);i.useEffect(()=>{const g=y;if(!g)return;const C=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(C,"checked").set,R=!r.current;if(d!==s&&E){const S=new Event("click",{bubbles:R});g.indeterminate=he(s),E.call(g,he(s)?!1:s),g.dispatchEvent(S)}},[y,d,s,r]);const w=i.useRef(he(s)?!1:s);return v.jsx(D.input,{type:"checkbox","aria-hidden":!0,defaultChecked:a??w.current,required:c,disabled:l,name:u,value:f,form:p,...t,tabIndex:-1,ref:x,style:{...t.style,...m,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Bo.displayName=Wo;function da(e){return typeof e=="function"}function he(e){return e==="indeterminate"}function Vo(e){return he(e)?"indeterminate":e?"checked":"unchecked"}var fa=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],pa=fa.reduce((e,t)=>{const n=oo(`Primitive.${t}`),o=i.forwardRef((r,s)=>{const{asChild:a,...c}=r,l=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),v.jsx(l,{...c,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{}),ma="Label",Ho=i.forwardRef((e,t)=>v.jsx(pa.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Ho.displayName=ma;var tu=Ho;const ha=["top","right","bottom","left"],ve=Math.min,G=Math.max,dt=Math.round,rt=Math.floor,ae=e=>({x:e,y:e}),va={left:"right",right:"left",bottom:"top",top:"bottom"},ga={start:"end",end:"start"};function zt(e,t,n){return G(e,ve(t,n))}function fe(e,t){return typeof e=="function"?e(t):e}function pe(e){return e.split("-")[0]}function We(e){return e.split("-")[1]}function pn(e){return e==="x"?"y":"x"}function mn(e){return e==="y"?"height":"width"}const ya=new Set(["top","bottom"]);function ie(e){return ya.has(pe(e))?"y":"x"}function hn(e){return pn(ie(e))}function wa(e,t,n){n===void 0&&(n=!1);const o=We(e),r=hn(e),s=mn(r);let a=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=ft(a)),[a,ft(a)]}function xa(e){const t=ft(e);return[Yt(e),t,Yt(t)]}function Yt(e){return e.replace(/start|end/g,t=>ga[t])}const Vn=["left","right"],Hn=["right","left"],Ca=["top","bottom"],ba=["bottom","top"];function Ea(e,t,n){switch(e){case"top":case"bottom":return n?t?Hn:Vn:t?Vn:Hn;case"left":case"right":return t?Ca:ba;default:return[]}}function Sa(e,t,n,o){const r=We(e);let s=Ea(pe(e),n==="start",o);return r&&(s=s.map(a=>a+"-"+r),t&&(s=s.concat(s.map(Yt)))),s}function ft(e){return e.replace(/left|right|bottom|top/g,t=>va[t])}function Ta(e){return{top:0,right:0,bottom:0,left:0,...e}}function Uo(e){return typeof e!="number"?Ta(e):{top:e,right:e,bottom:e,left:e}}function pt(e){const{x:t,y:n,width:o,height:r}=e;return{width:o,height:r,top:n,left:t,right:t+o,bottom:n+r,x:t,y:n}}function Un(e,t,n){let{reference:o,floating:r}=e;const s=ie(t),a=hn(t),c=mn(a),l=pe(t),u=s==="y",f=o.x+o.width/2-r.width/2,p=o.y+o.height/2-r.height/2,y=o[c]/2-r[c]/2;let h;switch(l){case"top":h={x:f,y:o.y-r.height};break;case"bottom":h={x:f,y:o.y+o.height};break;case"right":h={x:o.x+o.width,y:p};break;case"left":h={x:o.x-r.width,y:p};break;default:h={x:o.x,y:o.y}}switch(We(t)){case"start":h[a]-=y*(n&&u?-1:1);break;case"end":h[a]+=y*(n&&u?-1:1);break}return h}const Ra=async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:s=[],platform:a}=n,c=s.filter(Boolean),l=await(a.isRTL==null?void 0:a.isRTL(t));let u=await a.getElementRects({reference:e,floating:t,strategy:r}),{x:f,y:p}=Un(u,o,l),y=o,h={},x=0;for(let d=0;d({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:r,rects:s,platform:a,elements:c,middlewareData:l}=t,{element:u,padding:f=0}=fe(e,t)||{};if(u==null)return{};const p=Uo(f),y={x:n,y:o},h=hn(r),x=mn(h),d=await a.getDimensions(u),m=h==="y",w=m?"top":"left",g=m?"bottom":"right",C=m?"clientHeight":"clientWidth",b=s.reference[x]+s.reference[h]-y[h]-s.floating[x],E=y[h]-s.reference[h],R=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u));let S=R?R[C]:0;(!S||!await(a.isElement==null?void 0:a.isElement(R)))&&(S=c.floating[C]||s.floating[x]);const O=b/2-E/2,M=S/2-d[x]/2-1,L=ve(p[w],M),k=ve(p[g],M),$=L,F=S-d[x]-k,T=S/2-d[x]/2+O,j=zt($,T,F),I=!l.arrow&&We(r)!=null&&T!==j&&s.reference[x]/2-(T<$?L:k)-d[x]/2<0,_=I?T<$?T-$:T-F:0;return{[h]:y[h]+_,data:{[h]:j,centerOffset:T-j-_,...I&&{alignmentOffset:_}},reset:I}}}),Aa=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:r,middlewareData:s,rects:a,initialPlacement:c,platform:l,elements:u}=t,{mainAxis:f=!0,crossAxis:p=!0,fallbackPlacements:y,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:d=!0,...m}=fe(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const w=pe(r),g=ie(c),C=pe(c)===c,b=await(l.isRTL==null?void 0:l.isRTL(u.floating)),E=y||(C||!d?[ft(c)]:xa(c)),R=x!=="none";!y&&R&&E.push(...Sa(c,d,x,b));const S=[c,...E],O=await Ue(t,m),M=[];let L=((o=s.flip)==null?void 0:o.overflows)||[];if(f&&M.push(O[w]),p){const T=wa(r,a,b);M.push(O[T[0]],O[T[1]])}if(L=[...L,{placement:r,overflows:M}],!M.every(T=>T<=0)){var k,$;const T=(((k=s.flip)==null?void 0:k.index)||0)+1,j=S[T];if(j&&(!(p==="alignment"?g!==ie(j):!1)||L.every(P=>ie(P.placement)===g?P.overflows[0]>0:!0)))return{data:{index:T,overflows:L},reset:{placement:j}};let I=($=L.filter(_=>_.overflows[0]<=0).sort((_,P)=>_.overflows[1]-P.overflows[1])[0])==null?void 0:$.placement;if(!I)switch(h){case"bestFit":{var F;const _=(F=L.filter(P=>{if(R){const W=ie(P.placement);return W===g||W==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(W=>W>0).reduce((W,Y)=>W+Y,0)]).sort((P,W)=>P[1]-W[1])[0])==null?void 0:F[0];_&&(I=_);break}case"initialPlacement":I=c;break}if(r!==I)return{reset:{placement:I}}}return{}}}};function Kn(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function zn(e){return ha.some(t=>e[t]>=0)}const Oa=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:o="referenceHidden",...r}=fe(e,t);switch(o){case"referenceHidden":{const s=await Ue(t,{...r,elementContext:"reference"}),a=Kn(s,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:zn(a)}}}case"escaped":{const s=await Ue(t,{...r,altBoundary:!0}),a=Kn(s,n.floating);return{data:{escapedOffsets:a,escaped:zn(a)}}}default:return{}}}}},Ko=new Set(["left","top"]);async function Ia(e,t){const{placement:n,platform:o,elements:r}=e,s=await(o.isRTL==null?void 0:o.isRTL(r.floating)),a=pe(n),c=We(n),l=ie(n)==="y",u=Ko.has(a)?-1:1,f=s&&l?-1:1,p=fe(t,e);let{mainAxis:y,crossAxis:h,alignmentAxis:x}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return c&&typeof x=="number"&&(h=c==="end"?x*-1:x),l?{x:h*f,y:y*u}:{x:y*u,y:h*f}}const Na=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:r,y:s,placement:a,middlewareData:c}=t,l=await Ia(t,e);return a===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:r+l.x,y:s+l.y,data:{...l,placement:a}}}}},_a=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r}=t,{mainAxis:s=!0,crossAxis:a=!1,limiter:c={fn:m=>{let{x:w,y:g}=m;return{x:w,y:g}}},...l}=fe(e,t),u={x:n,y:o},f=await Ue(t,l),p=ie(pe(r)),y=pn(p);let h=u[y],x=u[p];if(s){const m=y==="y"?"top":"left",w=y==="y"?"bottom":"right",g=h+f[m],C=h-f[w];h=zt(g,h,C)}if(a){const m=p==="y"?"top":"left",w=p==="y"?"bottom":"right",g=x+f[m],C=x-f[w];x=zt(g,x,C)}const d=c.fn({...t,[y]:h,[p]:x});return{...d,data:{x:d.x-n,y:d.y-o,enabled:{[y]:s,[p]:a}}}}}},Da=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:o,placement:r,rects:s,middlewareData:a}=t,{offset:c=0,mainAxis:l=!0,crossAxis:u=!0}=fe(e,t),f={x:n,y:o},p=ie(r),y=pn(p);let h=f[y],x=f[p];const d=fe(c,t),m=typeof d=="number"?{mainAxis:d,crossAxis:0}:{mainAxis:0,crossAxis:0,...d};if(l){const C=y==="y"?"height":"width",b=s.reference[y]-s.floating[C]+m.mainAxis,E=s.reference[y]+s.reference[C]-m.mainAxis;hE&&(h=E)}if(u){var w,g;const C=y==="y"?"width":"height",b=Ko.has(pe(r)),E=s.reference[p]-s.floating[C]+(b&&((w=a.offset)==null?void 0:w[p])||0)+(b?0:m.crossAxis),R=s.reference[p]+s.reference[C]+(b?0:((g=a.offset)==null?void 0:g[p])||0)-(b?m.crossAxis:0);xR&&(x=R)}return{[y]:h,[p]:x}}}},Ma=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:r,rects:s,platform:a,elements:c}=t,{apply:l=()=>{},...u}=fe(e,t),f=await Ue(t,u),p=pe(r),y=We(r),h=ie(r)==="y",{width:x,height:d}=s.floating;let m,w;p==="top"||p==="bottom"?(m=p,w=y===(await(a.isRTL==null?void 0:a.isRTL(c.floating))?"start":"end")?"left":"right"):(w=p,m=y==="end"?"top":"bottom");const g=d-f.top-f.bottom,C=x-f.left-f.right,b=ve(d-f[m],g),E=ve(x-f[w],C),R=!t.middlewareData.shift;let S=b,O=E;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(O=C),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(S=g),R&&!y){const L=G(f.left,0),k=G(f.right,0),$=G(f.top,0),F=G(f.bottom,0);h?O=x-2*(L!==0||k!==0?L+k:G(f.left,f.right)):S=d-2*($!==0||F!==0?$+F:G(f.top,f.bottom))}await l({...t,availableWidth:O,availableHeight:S});const M=await a.getDimensions(c.floating);return x!==M.width||d!==M.height?{reset:{rects:!0}}:{}}}};function wt(){return typeof window<"u"}function Be(e){return zo(e)?(e.nodeName||"").toLowerCase():"#document"}function q(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function le(e){var t;return(t=(zo(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function zo(e){return wt()?e instanceof Node||e instanceof q(e).Node:!1}function te(e){return wt()?e instanceof Element||e instanceof q(e).Element:!1}function ce(e){return wt()?e instanceof HTMLElement||e instanceof q(e).HTMLElement:!1}function Yn(e){return!wt()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof q(e).ShadowRoot}const La=new Set(["inline","contents"]);function qe(e){const{overflow:t,overflowX:n,overflowY:o,display:r}=ne(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!La.has(r)}const ka=new Set(["table","td","th"]);function ja(e){return ka.has(Be(e))}const Fa=[":popover-open",":modal"];function xt(e){return Fa.some(t=>{try{return e.matches(t)}catch{return!1}})}const $a=["transform","translate","scale","rotate","perspective"],Wa=["transform","translate","scale","rotate","perspective","filter"],Ba=["paint","layout","strict","content"];function vn(e){const t=gn(),n=te(e)?ne(e):e;return $a.some(o=>n[o]?n[o]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||Wa.some(o=>(n.willChange||"").includes(o))||Ba.some(o=>(n.contain||"").includes(o))}function Va(e){let t=ge(e);for(;ce(t)&&!je(t);){if(vn(t))return t;if(xt(t))return null;t=ge(t)}return null}function gn(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Ha=new Set(["html","body","#document"]);function je(e){return Ha.has(Be(e))}function ne(e){return q(e).getComputedStyle(e)}function Ct(e){return te(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ge(e){if(Be(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Yn(e)&&e.host||le(e);return Yn(t)?t.host:t}function Yo(e){const t=ge(e);return je(t)?e.ownerDocument?e.ownerDocument.body:e.body:ce(t)&&qe(t)?t:Yo(t)}function Ke(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=Yo(e),s=r===((o=e.ownerDocument)==null?void 0:o.body),a=q(r);if(s){const c=Xt(a);return t.concat(a,a.visualViewport||[],qe(r)?r:[],c&&n?Ke(c):[])}return t.concat(r,Ke(r,[],n))}function Xt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Xo(e){const t=ne(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=ce(e),s=r?e.offsetWidth:n,a=r?e.offsetHeight:o,c=dt(n)!==s||dt(o)!==a;return c&&(n=s,o=a),{width:n,height:o,$:c}}function yn(e){return te(e)?e:e.contextElement}function Le(e){const t=yn(e);if(!ce(t))return ae(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:s}=Xo(t);let a=(s?dt(n.width):n.width)/o,c=(s?dt(n.height):n.height)/r;return(!a||!Number.isFinite(a))&&(a=1),(!c||!Number.isFinite(c))&&(c=1),{x:a,y:c}}const Ua=ae(0);function Go(e){const t=q(e);return!gn()||!t.visualViewport?Ua:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ka(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==q(e)?!1:t}function Re(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),s=yn(e);let a=ae(1);t&&(o?te(o)&&(a=Le(o)):a=Le(e));const c=Ka(s,n,o)?Go(s):ae(0);let l=(r.left+c.x)/a.x,u=(r.top+c.y)/a.y,f=r.width/a.x,p=r.height/a.y;if(s){const y=q(s),h=o&&te(o)?q(o):o;let x=y,d=Xt(x);for(;d&&o&&h!==x;){const m=Le(d),w=d.getBoundingClientRect(),g=ne(d),C=w.left+(d.clientLeft+parseFloat(g.paddingLeft))*m.x,b=w.top+(d.clientTop+parseFloat(g.paddingTop))*m.y;l*=m.x,u*=m.y,f*=m.x,p*=m.y,l+=C,u+=b,x=q(d),d=Xt(x)}}return pt({width:f,height:p,x:l,y:u})}function bt(e,t){const n=Ct(e).scrollLeft;return t?t.left+n:Re(le(e)).left+n}function qo(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-bt(e,n),r=n.top+t.scrollTop;return{x:o,y:r}}function za(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const s=r==="fixed",a=le(o),c=t?xt(t.floating):!1;if(o===a||c&&s)return n;let l={scrollLeft:0,scrollTop:0},u=ae(1);const f=ae(0),p=ce(o);if((p||!p&&!s)&&((Be(o)!=="body"||qe(a))&&(l=Ct(o)),ce(o))){const h=Re(o);u=Le(o),f.x=h.x+o.clientLeft,f.y=h.y+o.clientTop}const y=a&&!p&&!s?qo(a,l):ae(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+f.x+y.x,y:n.y*u.y-l.scrollTop*u.y+f.y+y.y}}function Ya(e){return Array.from(e.getClientRects())}function Xa(e){const t=le(e),n=Ct(e),o=e.ownerDocument.body,r=G(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),s=G(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let a=-n.scrollLeft+bt(e);const c=-n.scrollTop;return ne(o).direction==="rtl"&&(a+=G(t.clientWidth,o.clientWidth)-r),{width:r,height:s,x:a,y:c}}const Xn=25;function Ga(e,t){const n=q(e),o=le(e),r=n.visualViewport;let s=o.clientWidth,a=o.clientHeight,c=0,l=0;if(r){s=r.width,a=r.height;const f=gn();(!f||f&&t==="fixed")&&(c=r.offsetLeft,l=r.offsetTop)}const u=bt(o);if(u<=0){const f=o.ownerDocument,p=f.body,y=getComputedStyle(p),h=f.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,x=Math.abs(o.clientWidth-p.clientWidth-h);x<=Xn&&(s-=x)}else u<=Xn&&(s+=u);return{width:s,height:a,x:c,y:l}}const qa=new Set(["absolute","fixed"]);function Za(e,t){const n=Re(e,!0,t==="fixed"),o=n.top+e.clientTop,r=n.left+e.clientLeft,s=ce(e)?Le(e):ae(1),a=e.clientWidth*s.x,c=e.clientHeight*s.y,l=r*s.x,u=o*s.y;return{width:a,height:c,x:l,y:u}}function Gn(e,t,n){let o;if(t==="viewport")o=Ga(e,n);else if(t==="document")o=Xa(le(e));else if(te(t))o=Za(t,n);else{const r=Go(e);o={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return pt(o)}function Zo(e,t){const n=ge(e);return n===t||!te(n)||je(n)?!1:ne(n).position==="fixed"||Zo(n,t)}function Qa(e,t){const n=t.get(e);if(n)return n;let o=Ke(e,[],!1).filter(c=>te(c)&&Be(c)!=="body"),r=null;const s=ne(e).position==="fixed";let a=s?ge(e):e;for(;te(a)&&!je(a);){const c=ne(a),l=vn(a);!l&&c.position==="fixed"&&(r=null),(s?!l&&!r:!l&&c.position==="static"&&!!r&&qa.has(r.position)||qe(a)&&!l&&Zo(e,a))?o=o.filter(f=>f!==a):r=c,a=ge(a)}return t.set(e,o),o}function Ja(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const a=[...n==="clippingAncestors"?xt(t)?[]:Qa(t,this._c):[].concat(n),o],c=a[0],l=a.reduce((u,f)=>{const p=Gn(t,f,r);return u.top=G(p.top,u.top),u.right=ve(p.right,u.right),u.bottom=ve(p.bottom,u.bottom),u.left=G(p.left,u.left),u},Gn(t,c,r));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function ec(e){const{width:t,height:n}=Xo(e);return{width:t,height:n}}function tc(e,t,n){const o=ce(t),r=le(t),s=n==="fixed",a=Re(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const l=ae(0);function u(){l.x=bt(r)}if(o||!o&&!s)if((Be(t)!=="body"||qe(r))&&(c=Ct(t)),o){const h=Re(t,!0,s,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}else r&&u();s&&!o&&r&&u();const f=r&&!o&&!s?qo(r,c):ae(0),p=a.left+c.scrollLeft-l.x-f.x,y=a.top+c.scrollTop-l.y-f.y;return{x:p,y,width:a.width,height:a.height}}function Bt(e){return ne(e).position==="static"}function qn(e,t){if(!ce(e)||ne(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return le(e)===n&&(n=n.ownerDocument.body),n}function Qo(e,t){const n=q(e);if(xt(e))return n;if(!ce(e)){let r=ge(e);for(;r&&!je(r);){if(te(r)&&!Bt(r))return r;r=ge(r)}return n}let o=qn(e,t);for(;o&&ja(o)&&Bt(o);)o=qn(o,t);return o&&je(o)&&Bt(o)&&!vn(o)?n:o||Va(e)||n}const nc=async function(e){const t=this.getOffsetParent||Qo,n=this.getDimensions,o=await n(e.floating);return{reference:tc(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function oc(e){return ne(e).direction==="rtl"}const rc={convertOffsetParentRelativeRectToViewportRelativeRect:za,getDocumentElement:le,getClippingRect:Ja,getOffsetParent:Qo,getElementRects:nc,getClientRects:Ya,getDimensions:ec,getScale:Le,isElement:te,isRTL:oc};function Jo(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function sc(e,t){let n=null,o;const r=le(e);function s(){var c;clearTimeout(o),(c=n)==null||c.disconnect(),n=null}function a(c,l){c===void 0&&(c=!1),l===void 0&&(l=1),s();const u=e.getBoundingClientRect(),{left:f,top:p,width:y,height:h}=u;if(c||t(),!y||!h)return;const x=rt(p),d=rt(r.clientWidth-(f+y)),m=rt(r.clientHeight-(p+h)),w=rt(f),C={rootMargin:-x+"px "+-d+"px "+-m+"px "+-w+"px",threshold:G(0,ve(1,l))||1};let b=!0;function E(R){const S=R[0].intersectionRatio;if(S!==l){if(!b)return a();S?a(!1,S):o=setTimeout(()=>{a(!1,1e-7)},1e3)}S===1&&!Jo(u,e.getBoundingClientRect())&&a(),b=!1}try{n=new IntersectionObserver(E,{...C,root:r.ownerDocument})}catch{n=new IntersectionObserver(E,C)}n.observe(e)}return a(!0),s}function ic(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=o,u=yn(e),f=r||s?[...u?Ke(u):[],...Ke(t)]:[];f.forEach(w=>{r&&w.addEventListener("scroll",n,{passive:!0}),s&&w.addEventListener("resize",n)});const p=u&&c?sc(u,n):null;let y=-1,h=null;a&&(h=new ResizeObserver(w=>{let[g]=w;g&&g.target===u&&h&&(h.unobserve(t),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var C;(C=h)==null||C.observe(t)})),n()}),u&&!l&&h.observe(u),h.observe(t));let x,d=l?Re(e):null;l&&m();function m(){const w=Re(e);d&&!Jo(d,w)&&n(),d=w,x=requestAnimationFrame(m)}return n(),()=>{var w;f.forEach(g=>{r&&g.removeEventListener("scroll",n),s&&g.removeEventListener("resize",n)}),p?.(),(w=h)==null||w.disconnect(),h=null,l&&cancelAnimationFrame(x)}}const ac=Na,cc=_a,lc=Aa,uc=Ma,dc=Oa,Zn=Pa,fc=Da,pc=(e,t,n)=>{const o=new Map,r={platform:rc,...n},s={...r.platform,_c:o};return Ra(e,t,{...r,platform:s})};var mc=typeof document<"u",hc=function(){},ct=mc?i.useLayoutEffect:hc;function mt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,o,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;o--!==0;)if(!mt(e[o],t[o]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,r[o]))return!1;for(o=n;o--!==0;){const s=r[o];if(!(s==="_owner"&&e.$$typeof)&&!mt(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function er(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Qn(e,t){const n=er(e);return Math.round(t*n)/n}function Vt(e){const t=i.useRef(e);return ct(()=>{t.current=e}),t}function vc(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:s,floating:a}={},transform:c=!0,whileElementsMounted:l,open:u}=e,[f,p]=i.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[y,h]=i.useState(o);mt(y,o)||h(o);const[x,d]=i.useState(null),[m,w]=i.useState(null),g=i.useCallback(P=>{P!==R.current&&(R.current=P,d(P))},[]),C=i.useCallback(P=>{P!==S.current&&(S.current=P,w(P))},[]),b=s||x,E=a||m,R=i.useRef(null),S=i.useRef(null),O=i.useRef(f),M=l!=null,L=Vt(l),k=Vt(r),$=Vt(u),F=i.useCallback(()=>{if(!R.current||!S.current)return;const P={placement:t,strategy:n,middleware:y};k.current&&(P.platform=k.current),pc(R.current,S.current,P).then(W=>{const Y={...W,isPositioned:$.current!==!1};T.current&&!mt(O.current,Y)&&(O.current=Y,Ye.flushSync(()=>{p(Y)}))})},[y,t,n,k,$]);ct(()=>{u===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,p(P=>({...P,isPositioned:!1})))},[u]);const T=i.useRef(!1);ct(()=>(T.current=!0,()=>{T.current=!1}),[]),ct(()=>{if(b&&(R.current=b),E&&(S.current=E),b&&E){if(L.current)return L.current(b,E,F);F()}},[b,E,F,L,M]);const j=i.useMemo(()=>({reference:R,floating:S,setReference:g,setFloating:C}),[g,C]),I=i.useMemo(()=>({reference:b,floating:E}),[b,E]),_=i.useMemo(()=>{const P={position:n,left:0,top:0};if(!I.floating)return P;const W=Qn(I.floating,f.x),Y=Qn(I.floating,f.y);return c?{...P,transform:"translate("+W+"px, "+Y+"px)",...er(I.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:Y}},[n,c,I.floating,f.x,f.y]);return i.useMemo(()=>({...f,update:F,refs:j,elements:I,floatingStyles:_}),[f,F,j,I,_])}const gc=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:o,padding:r}=typeof e=="function"?e(n):e;return o&&t(o)?o.current!=null?Zn({element:o.current,padding:r}).fn(n):{}:o?Zn({element:o,padding:r}).fn(n):{}}}},yc=(e,t)=>({...ac(e),options:[e,t]}),wc=(e,t)=>({...cc(e),options:[e,t]}),xc=(e,t)=>({...fc(e),options:[e,t]}),Cc=(e,t)=>({...lc(e),options:[e,t]}),bc=(e,t)=>({...uc(e),options:[e,t]}),Ec=(e,t)=>({...dc(e),options:[e,t]}),Sc=(e,t)=>({...gc(e),options:[e,t]});var Tc="Arrow",tr=i.forwardRef((e,t)=>{const{children:n,width:o=10,height:r=5,...s}=e;return v.jsx(D.svg,{...s,ref:t,width:o,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:v.jsx("polygon",{points:"0,0 30,0 15,10"})})});tr.displayName=Tc;var Rc=tr,wn="Popper",[nr,Et]=Oe(wn),[Pc,or]=nr(wn),rr=e=>{const{__scopePopper:t,children:n}=e,[o,r]=i.useState(null);return v.jsx(Pc,{scope:t,anchor:o,onAnchorChange:r,children:n})};rr.displayName=wn;var sr="PopperAnchor",ir=i.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:o,...r}=e,s=or(sr,n),a=i.useRef(null),c=B(t,a),l=i.useRef(null);return i.useEffect(()=>{const u=l.current;l.current=o?.current||a.current,u!==l.current&&s.onAnchorChange(l.current)}),o?null:v.jsx(D.div,{...r,ref:c})});ir.displayName=sr;var xn="PopperContent",[Ac,Oc]=nr(xn),ar=i.forwardRef((e,t)=>{const{__scopePopper:n,side:o="bottom",sideOffset:r=0,align:s="center",alignOffset:a=0,arrowPadding:c=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:f=0,sticky:p="partial",hideWhenDetached:y=!1,updatePositionStrategy:h="optimized",onPlaced:x,...d}=e,m=or(xn,n),[w,g]=i.useState(null),C=B(t,A=>g(A)),[b,E]=i.useState(null),R=ko(b),S=R?.width??0,O=R?.height??0,M=o+(s!=="center"?"-"+s:""),L=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},k=Array.isArray(u)?u:[u],$=k.length>0,F={padding:L,boundary:k.filter(Nc),altBoundary:$},{refs:T,floatingStyles:j,placement:I,isPositioned:_,middlewareData:P}=vc({strategy:"fixed",placement:M,whileElementsMounted:(...A)=>ic(...A,{animationFrame:h==="always"}),elements:{reference:m.anchor},middleware:[yc({mainAxis:r+O,alignmentAxis:a}),l&&wc({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?xc():void 0,...F}),l&&Cc({...F}),bc({...F,apply:({elements:A,rects:U,availableWidth:X,availableHeight:V})=>{const{width:H,height:K}=U.reference,Z=A.floating.style;Z.setProperty("--radix-popper-available-width",`${X}px`),Z.setProperty("--radix-popper-available-height",`${V}px`),Z.setProperty("--radix-popper-anchor-width",`${H}px`),Z.setProperty("--radix-popper-anchor-height",`${K}px`)}}),b&&Sc({element:b,padding:c}),_c({arrowWidth:S,arrowHeight:O}),y&&Ec({strategy:"referenceHidden",...F})]}),[W,Y]=ur(I),ue=ee(x);z(()=>{_&&ue?.()},[_,ue]);const de=P.arrow?.x,re=P.arrow?.y,Q=P.arrow?.centerOffset!==0,[Ie,Ce]=i.useState();return z(()=>{w&&Ce(window.getComputedStyle(w).zIndex)},[w]),v.jsx("div",{ref:T.setFloating,"data-radix-popper-content-wrapper":"",style:{...j,transform:_?j.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Ie,"--radix-popper-transform-origin":[P.transformOrigin?.x,P.transformOrigin?.y].join(" "),...P.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:v.jsx(Ac,{scope:n,placedSide:W,onArrowChange:E,arrowX:de,arrowY:re,shouldHideArrow:Q,children:v.jsx(D.div,{"data-side":W,"data-align":Y,...d,ref:C,style:{...d.style,animation:_?void 0:"none"}})})})});ar.displayName=xn;var cr="PopperArrow",Ic={top:"bottom",right:"left",bottom:"top",left:"right"},lr=i.forwardRef(function(t,n){const{__scopePopper:o,...r}=t,s=Oc(cr,o),a=Ic[s.placedSide];return v.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:v.jsx(Rc,{...r,ref:n,style:{...r.style,display:"block"}})})});lr.displayName=cr;function Nc(e){return e!==null}var _c=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:o,middlewareData:r}=t,a=r.arrow?.centerOffset!==0,c=a?0:e.arrowWidth,l=a?0:e.arrowHeight,[u,f]=ur(n),p={start:"0%",center:"50%",end:"100%"}[f],y=(r.arrow?.x??0)+c/2,h=(r.arrow?.y??0)+l/2;let x="",d="";return u==="bottom"?(x=a?p:`${y}px`,d=`${-l}px`):u==="top"?(x=a?p:`${y}px`,d=`${o.floating.height+l}px`):u==="right"?(x=`${-l}px`,d=a?p:`${h}px`):u==="left"&&(x=`${o.floating.width+l}px`,d=a?p:`${h}px`),{data:{x,y:d}}}});function ur(e){const[t,n="center"]=e.split("-");return[t,n]}var dr=rr,fr=ir,pr=ar,mr=lr;function Dc(e){const t=Mc(e),n=i.forwardRef((o,r)=>{const{children:s,...a}=o,c=i.Children.toArray(s),l=c.find(kc);if(l){const u=l.props.children,f=c.map(p=>p===l?i.Children.count(u)>1?i.Children.only(null):i.isValidElement(u)?u.props.children:null:p);return v.jsx(t,{...a,ref:r,children:i.isValidElement(u)?i.cloneElement(u,void 0,f):null})}return v.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}function Mc(e){const t=i.forwardRef((n,o)=>{const{children:r,...s}=n;if(i.isValidElement(r)){const a=Fc(r),c=jc(s,r.props);return r.type!==i.Fragment&&(c.ref=o?$e(o,a):a),i.cloneElement(r,c)}return i.Children.count(r)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Lc=Symbol("radix.slottable");function kc(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Lc}function jc(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...c)=>{const l=s(...c);return r(...c),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function Fc(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var hr=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),$c="VisuallyHidden",St=i.forwardRef((e,t)=>v.jsx(D.span,{...e,ref:t,style:{...hr,...e.style}}));St.displayName=$c;var Wc=St,Bc=[" ","Enter","ArrowUp","ArrowDown"],Vc=[" ","Enter"],Pe="Select",[Tt,Rt,Hc]=eo(Pe),[Ve]=Oe(Pe,[Hc,Et]),Pt=Et(),[Uc,we]=Ve(Pe),[Kc,zc]=Ve(Pe),vr=e=>{const{__scopeSelect:t,children:n,open:o,defaultOpen:r,onOpenChange:s,value:a,defaultValue:c,onValueChange:l,dir:u,name:f,autoComplete:p,disabled:y,required:h,form:x}=e,d=Pt(t),[m,w]=i.useState(null),[g,C]=i.useState(null),[b,E]=i.useState(!1),R=_s(u),[S,O]=ke({prop:o,defaultProp:r??!1,onChange:s,caller:Pe}),[M,L]=ke({prop:a,defaultProp:c,onChange:l,caller:Pe}),k=i.useRef(null),$=m?x||!!m.closest("form"):!0,[F,T]=i.useState(new Set),j=Array.from(F).map(I=>I.props.value).join(";");return v.jsx(dr,{...d,children:v.jsxs(Uc,{required:h,scope:t,trigger:m,onTriggerChange:w,valueNode:g,onValueNodeChange:C,valueNodeHasChildren:b,onValueNodeHasChildrenChange:E,contentId:Se(),value:M,onValueChange:L,open:S,onOpenChange:O,dir:R,triggerPointerDownPosRef:k,disabled:y,children:[v.jsx(Tt.Provider,{scope:t,children:v.jsx(Kc,{scope:e.__scopeSelect,onNativeOptionAdd:i.useCallback(I=>{T(_=>new Set(_).add(I))},[]),onNativeOptionRemove:i.useCallback(I=>{T(_=>{const P=new Set(_);return P.delete(I),P})},[]),children:n})}),$?v.jsxs(Wr,{"aria-hidden":!0,required:h,tabIndex:-1,name:f,autoComplete:p,value:M,onChange:I=>L(I.target.value),disabled:y,form:x,children:[M===void 0?v.jsx("option",{value:""}):null,Array.from(F)]},j):null]})})};vr.displayName=Pe;var gr="SelectTrigger",yr=i.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:o=!1,...r}=e,s=Pt(n),a=we(gr,n),c=a.disabled||o,l=B(t,a.onTriggerChange),u=Rt(n),f=i.useRef("touch"),[p,y,h]=Vr(d=>{const m=u().filter(C=>!C.disabled),w=m.find(C=>C.value===a.value),g=Hr(m,d,w);g!==void 0&&a.onValueChange(g.value)}),x=d=>{c||(a.onOpenChange(!0),h()),d&&(a.triggerPointerDownPosRef.current={x:Math.round(d.pageX),y:Math.round(d.pageY)})};return v.jsx(fr,{asChild:!0,...s,children:v.jsx(D.button,{type:"button",role:"combobox","aria-controls":a.contentId,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":Br(a.value)?"":void 0,...r,ref:l,onClick:N(r.onClick,d=>{d.currentTarget.focus(),f.current!=="mouse"&&x(d)}),onPointerDown:N(r.onPointerDown,d=>{f.current=d.pointerType;const m=d.target;m.hasPointerCapture(d.pointerId)&&m.releasePointerCapture(d.pointerId),d.button===0&&d.ctrlKey===!1&&d.pointerType==="mouse"&&(x(d),d.preventDefault())}),onKeyDown:N(r.onKeyDown,d=>{const m=p.current!=="";!(d.ctrlKey||d.altKey||d.metaKey)&&d.key.length===1&&y(d.key),!(m&&d.key===" ")&&Bc.includes(d.key)&&(x(),d.preventDefault())})})})});yr.displayName=gr;var wr="SelectValue",xr=i.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:r,children:s,placeholder:a="",...c}=e,l=we(wr,n),{onValueNodeHasChildrenChange:u}=l,f=s!==void 0,p=B(t,l.onValueNodeChange);return z(()=>{u(f)},[u,f]),v.jsx(D.span,{...c,ref:p,style:{pointerEvents:"none"},children:Br(l.value)?v.jsx(v.Fragment,{children:a}):s})});xr.displayName=wr;var Yc="SelectIcon",Cr=i.forwardRef((e,t)=>{const{__scopeSelect:n,children:o,...r}=e;return v.jsx(D.span,{"aria-hidden":!0,...r,ref:t,children:o||"▼"})});Cr.displayName=Yc;var Xc="SelectPortal",br=e=>v.jsx(Ge,{asChild:!0,...e});br.displayName=Xc;var Ae="SelectContent",Er=i.forwardRef((e,t)=>{const n=we(Ae,e.__scopeSelect),[o,r]=i.useState();if(z(()=>{r(new DocumentFragment)},[]),!n.open){const s=o;return s?Ye.createPortal(v.jsx(Sr,{scope:e.__scopeSelect,children:v.jsx(Tt.Slot,{scope:e.__scopeSelect,children:v.jsx("div",{children:e.children})})}),s):null}return v.jsx(Tr,{...e,ref:t})});Er.displayName=Ae;var J=10,[Sr,xe]=Ve(Ae),Gc="SelectContentImpl",qc=Dc("SelectContent.RemoveScroll"),Tr=i.forwardRef((e,t)=>{const{__scopeSelect:n,position:o="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:s,onPointerDownOutside:a,side:c,sideOffset:l,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:y,collisionPadding:h,sticky:x,hideWhenDetached:d,avoidCollisions:m,...w}=e,g=we(Ae,n),[C,b]=i.useState(null),[E,R]=i.useState(null),S=B(t,A=>b(A)),[O,M]=i.useState(null),[L,k]=i.useState(null),$=Rt(n),[F,T]=i.useState(!1),j=i.useRef(!1);i.useEffect(()=>{if(C)return yo(C)},[C]),co();const I=i.useCallback(A=>{const[U,...X]=$().map(K=>K.ref.current),[V]=X.slice(-1),H=document.activeElement;for(const K of A)if(K===H||(K?.scrollIntoView({block:"nearest"}),K===U&&E&&(E.scrollTop=0),K===V&&E&&(E.scrollTop=E.scrollHeight),K?.focus(),document.activeElement!==H))return},[$,E]),_=i.useCallback(()=>I([O,C]),[I,O,C]);i.useEffect(()=>{F&&_()},[F,_]);const{onOpenChange:P,triggerPointerDownPosRef:W}=g;i.useEffect(()=>{if(C){let A={x:0,y:0};const U=V=>{A={x:Math.abs(Math.round(V.pageX)-(W.current?.x??0)),y:Math.abs(Math.round(V.pageY)-(W.current?.y??0))}},X=V=>{A.x<=10&&A.y<=10?V.preventDefault():C.contains(V.target)||P(!1),document.removeEventListener("pointermove",U),W.current=null};return W.current!==null&&(document.addEventListener("pointermove",U),document.addEventListener("pointerup",X,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",U),document.removeEventListener("pointerup",X,{capture:!0})}}},[C,P,W]),i.useEffect(()=>{const A=()=>P(!1);return window.addEventListener("blur",A),window.addEventListener("resize",A),()=>{window.removeEventListener("blur",A),window.removeEventListener("resize",A)}},[P]);const[Y,ue]=Vr(A=>{const U=$().filter(H=>!H.disabled),X=U.find(H=>H.ref.current===document.activeElement),V=Hr(U,A,X);V&&setTimeout(()=>V.ref.current.focus())}),de=i.useCallback((A,U,X)=>{const V=!j.current&&!X;(g.value!==void 0&&g.value===U||V)&&(M(A),V&&(j.current=!0))},[g.value]),re=i.useCallback(()=>C?.focus(),[C]),Q=i.useCallback((A,U,X)=>{const V=!j.current&&!X;(g.value!==void 0&&g.value===U||V)&&k(A)},[g.value]),Ie=o==="popper"?Gt:Rr,Ce=Ie===Gt?{side:c,sideOffset:l,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:y,collisionPadding:h,sticky:x,hideWhenDetached:d,avoidCollisions:m}:{};return v.jsx(Sr,{scope:n,content:C,viewport:E,onViewportChange:R,itemRefCallback:de,selectedItem:O,onItemLeave:re,itemTextRefCallback:Q,focusSelectedItem:_,selectedItemText:L,position:o,isPositioned:F,searchRef:Y,children:v.jsx(cn,{as:qc,allowPinchZoom:!0,children:v.jsx(an,{asChild:!0,trapped:g.open,onMountAutoFocus:A=>{A.preventDefault()},onUnmountAutoFocus:N(r,A=>{g.trigger?.focus({preventScroll:!0}),A.preventDefault()}),children:v.jsx(Xe,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:A=>A.preventDefault(),onDismiss:()=>g.onOpenChange(!1),children:v.jsx(Ie,{role:"listbox",id:g.contentId,"data-state":g.open?"open":"closed",dir:g.dir,onContextMenu:A=>A.preventDefault(),...w,...Ce,onPlaced:()=>T(!0),ref:S,style:{display:"flex",flexDirection:"column",outline:"none",...w.style},onKeyDown:N(w.onKeyDown,A=>{const U=A.ctrlKey||A.altKey||A.metaKey;if(A.key==="Tab"&&A.preventDefault(),!U&&A.key.length===1&&ue(A.key),["ArrowUp","ArrowDown","Home","End"].includes(A.key)){let V=$().filter(H=>!H.disabled).map(H=>H.ref.current);if(["ArrowUp","End"].includes(A.key)&&(V=V.slice().reverse()),["ArrowUp","ArrowDown"].includes(A.key)){const H=A.target,K=V.indexOf(H);V=V.slice(K+1)}setTimeout(()=>I(V)),A.preventDefault()}})})})})})})});Tr.displayName=Gc;var Zc="SelectItemAlignedPosition",Rr=i.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:o,...r}=e,s=we(Ae,n),a=xe(Ae,n),[c,l]=i.useState(null),[u,f]=i.useState(null),p=B(t,S=>f(S)),y=Rt(n),h=i.useRef(!1),x=i.useRef(!0),{viewport:d,selectedItem:m,selectedItemText:w,focusSelectedItem:g}=a,C=i.useCallback(()=>{if(s.trigger&&s.valueNode&&c&&u&&d&&m&&w){const S=s.trigger.getBoundingClientRect(),O=u.getBoundingClientRect(),M=s.valueNode.getBoundingClientRect(),L=w.getBoundingClientRect();if(s.dir!=="rtl"){const H=L.left-O.left,K=M.left-H,Z=S.left-K,be=S.width+Z,Nt=Math.max(be,O.width),_t=window.innerWidth-J,Dt=On(K,[J,Math.max(J,_t-Nt)]);c.style.minWidth=be+"px",c.style.left=Dt+"px"}else{const H=O.right-L.right,K=window.innerWidth-M.right-H,Z=window.innerWidth-S.right-K,be=S.width+Z,Nt=Math.max(be,O.width),_t=window.innerWidth-J,Dt=On(K,[J,Math.max(J,_t-Nt)]);c.style.minWidth=be+"px",c.style.right=Dt+"px"}const k=y(),$=window.innerHeight-J*2,F=d.scrollHeight,T=window.getComputedStyle(u),j=parseInt(T.borderTopWidth,10),I=parseInt(T.paddingTop,10),_=parseInt(T.borderBottomWidth,10),P=parseInt(T.paddingBottom,10),W=j+I+F+P+_,Y=Math.min(m.offsetHeight*5,W),ue=window.getComputedStyle(d),de=parseInt(ue.paddingTop,10),re=parseInt(ue.paddingBottom,10),Q=S.top+S.height/2-J,Ie=$-Q,Ce=m.offsetHeight/2,A=m.offsetTop+Ce,U=j+I+A,X=W-U;if(U<=Q){const H=k.length>0&&m===k[k.length-1].ref.current;c.style.bottom="0px";const K=u.clientHeight-d.offsetTop-d.offsetHeight,Z=Math.max(Ie,Ce+(H?re:0)+K+_),be=U+Z;c.style.height=be+"px"}else{const H=k.length>0&&m===k[0].ref.current;c.style.top="0px";const Z=Math.max(Q,j+d.offsetTop+(H?de:0)+Ce)+X;c.style.height=Z+"px",d.scrollTop=U-Q+d.offsetTop}c.style.margin=`${J}px 0`,c.style.minHeight=Y+"px",c.style.maxHeight=$+"px",o?.(),requestAnimationFrame(()=>h.current=!0)}},[y,s.trigger,s.valueNode,c,u,d,m,w,s.dir,o]);z(()=>C(),[C]);const[b,E]=i.useState();z(()=>{u&&E(window.getComputedStyle(u).zIndex)},[u]);const R=i.useCallback(S=>{S&&x.current===!0&&(C(),g?.(),x.current=!1)},[C,g]);return v.jsx(Jc,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:h,onScrollButtonChange:R,children:v.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:b},children:v.jsx(D.div,{...r,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});Rr.displayName=Zc;var Qc="SelectPopperPosition",Gt=i.forwardRef((e,t)=>{const{__scopeSelect:n,align:o="start",collisionPadding:r=J,...s}=e,a=Pt(n);return v.jsx(pr,{...a,...s,ref:t,align:o,collisionPadding:r,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Gt.displayName=Qc;var[Jc,Cn]=Ve(Ae,{}),qt="SelectViewport",Pr=i.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:o,...r}=e,s=xe(qt,n),a=Cn(qt,n),c=B(t,s.onViewportChange),l=i.useRef(0);return v.jsxs(v.Fragment,{children:[v.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),v.jsx(Tt.Slot,{scope:n,children:v.jsx(D.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:N(r.onScroll,u=>{const f=u.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:y}=a;if(y?.current&&p){const h=Math.abs(l.current-f.scrollTop);if(h>0){const x=window.innerHeight-J*2,d=parseFloat(p.style.minHeight),m=parseFloat(p.style.height),w=Math.max(d,m);if(w0?b:0,p.style.justifyContent="flex-end")}}}l.current=f.scrollTop})})})]})});Pr.displayName=qt;var Ar="SelectGroup",[el,tl]=Ve(Ar),nl=i.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,r=Se();return v.jsx(el,{scope:n,id:r,children:v.jsx(D.div,{role:"group","aria-labelledby":r,...o,ref:t})})});nl.displayName=Ar;var Or="SelectLabel",Ir=i.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,r=tl(Or,n);return v.jsx(D.div,{id:r.id,...o,ref:t})});Ir.displayName=Or;var ht="SelectItem",[ol,Nr]=Ve(ht),_r=i.forwardRef((e,t)=>{const{__scopeSelect:n,value:o,disabled:r=!1,textValue:s,...a}=e,c=we(ht,n),l=xe(ht,n),u=c.value===o,[f,p]=i.useState(s??""),[y,h]=i.useState(!1),x=B(t,g=>l.itemRefCallback?.(g,o,r)),d=Se(),m=i.useRef("touch"),w=()=>{r||(c.onValueChange(o),c.onOpenChange(!1))};if(o==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return v.jsx(ol,{scope:n,value:o,disabled:r,textId:d,isSelected:u,onItemTextChange:i.useCallback(g=>{p(C=>C||(g?.textContent??"").trim())},[]),children:v.jsx(Tt.ItemSlot,{scope:n,value:o,disabled:r,textValue:f,children:v.jsx(D.div,{role:"option","aria-labelledby":d,"data-highlighted":y?"":void 0,"aria-selected":u&&y,"data-state":u?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...a,ref:x,onFocus:N(a.onFocus,()=>h(!0)),onBlur:N(a.onBlur,()=>h(!1)),onClick:N(a.onClick,()=>{m.current!=="mouse"&&w()}),onPointerUp:N(a.onPointerUp,()=>{m.current==="mouse"&&w()}),onPointerDown:N(a.onPointerDown,g=>{m.current=g.pointerType}),onPointerMove:N(a.onPointerMove,g=>{m.current=g.pointerType,r?l.onItemLeave?.():m.current==="mouse"&&g.currentTarget.focus({preventScroll:!0})}),onPointerLeave:N(a.onPointerLeave,g=>{g.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:N(a.onKeyDown,g=>{l.searchRef?.current!==""&&g.key===" "||(Vc.includes(g.key)&&w(),g.key===" "&&g.preventDefault())})})})})});_r.displayName=ht;var He="SelectItemText",Dr=i.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:r,...s}=e,a=we(He,n),c=xe(He,n),l=Nr(He,n),u=zc(He,n),[f,p]=i.useState(null),y=B(t,w=>p(w),l.onItemTextChange,w=>c.itemTextRefCallback?.(w,l.value,l.disabled)),h=f?.textContent,x=i.useMemo(()=>v.jsx("option",{value:l.value,disabled:l.disabled,children:h},l.value),[l.disabled,l.value,h]),{onNativeOptionAdd:d,onNativeOptionRemove:m}=u;return z(()=>(d(x),()=>m(x)),[d,m,x]),v.jsxs(v.Fragment,{children:[v.jsx(D.span,{id:l.textId,...s,ref:y}),l.isSelected&&a.valueNode&&!a.valueNodeHasChildren?Ye.createPortal(s.children,a.valueNode):null]})});Dr.displayName=He;var Mr="SelectItemIndicator",Lr=i.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return Nr(Mr,n).isSelected?v.jsx(D.span,{"aria-hidden":!0,...o,ref:t}):null});Lr.displayName=Mr;var Zt="SelectScrollUpButton",kr=i.forwardRef((e,t)=>{const n=xe(Zt,e.__scopeSelect),o=Cn(Zt,e.__scopeSelect),[r,s]=i.useState(!1),a=B(t,o.onScrollButtonChange);return z(()=>{if(n.viewport&&n.isPositioned){let c=function(){const u=l.scrollTop>0;s(u)};const l=n.viewport;return c(),l.addEventListener("scroll",c),()=>l.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),r?v.jsx(Fr,{...e,ref:a,onAutoScroll:()=>{const{viewport:c,selectedItem:l}=n;c&&l&&(c.scrollTop=c.scrollTop-l.offsetHeight)}}):null});kr.displayName=Zt;var Qt="SelectScrollDownButton",jr=i.forwardRef((e,t)=>{const n=xe(Qt,e.__scopeSelect),o=Cn(Qt,e.__scopeSelect),[r,s]=i.useState(!1),a=B(t,o.onScrollButtonChange);return z(()=>{if(n.viewport&&n.isPositioned){let c=function(){const u=l.scrollHeight-l.clientHeight,f=Math.ceil(l.scrollTop)l.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),r?v.jsx(Fr,{...e,ref:a,onAutoScroll:()=>{const{viewport:c,selectedItem:l}=n;c&&l&&(c.scrollTop=c.scrollTop+l.offsetHeight)}}):null});jr.displayName=Qt;var Fr=i.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:o,...r}=e,s=xe("SelectScrollButton",n),a=i.useRef(null),c=Rt(n),l=i.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return i.useEffect(()=>()=>l(),[l]),z(()=>{c().find(f=>f.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[c]),v.jsx(D.div,{"aria-hidden":!0,...r,ref:t,style:{flexShrink:0,...r.style},onPointerDown:N(r.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(o,50))}),onPointerMove:N(r.onPointerMove,()=>{s.onItemLeave?.(),a.current===null&&(a.current=window.setInterval(o,50))}),onPointerLeave:N(r.onPointerLeave,()=>{l()})})}),rl="SelectSeparator",$r=i.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return v.jsx(D.div,{"aria-hidden":!0,...o,ref:t})});$r.displayName=rl;var Jt="SelectArrow",sl=i.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,r=Pt(n),s=we(Jt,n),a=xe(Jt,n);return s.open&&a.position==="popper"?v.jsx(mr,{...r,...o,ref:t}):null});sl.displayName=Jt;var il="SelectBubbleInput",Wr=i.forwardRef(({__scopeSelect:e,value:t,...n},o)=>{const r=i.useRef(null),s=B(o,r),a=Lo(t);return i.useEffect(()=>{const c=r.current;if(!c)return;const l=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(l,"value").set;if(a!==t&&f){const p=new Event("change",{bubbles:!0});f.call(c,t),c.dispatchEvent(p)}},[a,t]),v.jsx(D.select,{...n,style:{...hr,...n.style},ref:s,defaultValue:t})});Wr.displayName=il;function Br(e){return e===""||e===void 0}function Vr(e){const t=ee(e),n=i.useRef(""),o=i.useRef(0),r=i.useCallback(a=>{const c=n.current+a;t(c),(function l(u){n.current=u,window.clearTimeout(o.current),u!==""&&(o.current=window.setTimeout(()=>l(""),1e3))})(c)},[t]),s=i.useCallback(()=>{n.current="",window.clearTimeout(o.current)},[]);return i.useEffect(()=>()=>window.clearTimeout(o.current),[]),[n,r,s]}function Hr(e,t,n){const r=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let a=al(e,Math.max(s,0));r.length===1&&(a=a.filter(u=>u!==n));const l=a.find(u=>u.textValue.toLowerCase().startsWith(r.toLowerCase()));return l!==n?l:void 0}function al(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var nu=vr,ou=yr,ru=xr,su=Cr,iu=br,au=Er,cu=Pr,lu=Ir,uu=_r,du=Dr,fu=Lr,pu=kr,mu=jr,hu=$r,cl=Symbol("radix.slottable");function ll(e){const t=({children:n})=>v.jsx(v.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=cl,t}var[At]=Oe("Tooltip",[Et]),Ot=Et(),Ur="TooltipProvider",ul=700,en="tooltip.open",[dl,bn]=At(Ur),Kr=e=>{const{__scopeTooltip:t,delayDuration:n=ul,skipDelayDuration:o=300,disableHoverableContent:r=!1,children:s}=e,a=i.useRef(!0),c=i.useRef(!1),l=i.useRef(0);return i.useEffect(()=>{const u=l.current;return()=>window.clearTimeout(u)},[]),v.jsx(dl,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:i.useCallback(()=>{window.clearTimeout(l.current),a.current=!1},[]),onClose:i.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>a.current=!0,o)},[o]),isPointerInTransitRef:c,onPointerInTransitChange:i.useCallback(u=>{c.current=u},[]),disableHoverableContent:r,children:s})};Kr.displayName=Ur;var ze="Tooltip",[fl,Ze]=At(ze),zr=e=>{const{__scopeTooltip:t,children:n,open:o,defaultOpen:r,onOpenChange:s,disableHoverableContent:a,delayDuration:c}=e,l=bn(ze,e.__scopeTooltip),u=Ot(t),[f,p]=i.useState(null),y=Se(),h=i.useRef(0),x=a??l.disableHoverableContent,d=c??l.delayDuration,m=i.useRef(!1),[w,g]=ke({prop:o,defaultProp:r??!1,onChange:S=>{S?(l.onOpen(),document.dispatchEvent(new CustomEvent(en))):l.onClose(),s?.(S)},caller:ze}),C=i.useMemo(()=>w?m.current?"delayed-open":"instant-open":"closed",[w]),b=i.useCallback(()=>{window.clearTimeout(h.current),h.current=0,m.current=!1,g(!0)},[g]),E=i.useCallback(()=>{window.clearTimeout(h.current),h.current=0,g(!1)},[g]),R=i.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{m.current=!0,g(!0),h.current=0},d)},[d,g]);return i.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),v.jsx(dr,{...u,children:v.jsx(fl,{scope:t,contentId:y,open:w,stateAttribute:C,trigger:f,onTriggerChange:p,onTriggerEnter:i.useCallback(()=>{l.isOpenDelayedRef.current?R():b()},[l.isOpenDelayedRef,R,b]),onTriggerLeave:i.useCallback(()=>{x?E():(window.clearTimeout(h.current),h.current=0)},[E,x]),onOpen:b,onClose:E,disableHoverableContent:x,children:n})})};zr.displayName=ze;var tn="TooltipTrigger",Yr=i.forwardRef((e,t)=>{const{__scopeTooltip:n,...o}=e,r=Ze(tn,n),s=bn(tn,n),a=Ot(n),c=i.useRef(null),l=B(t,c,r.onTriggerChange),u=i.useRef(!1),f=i.useRef(!1),p=i.useCallback(()=>u.current=!1,[]);return i.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),v.jsx(fr,{asChild:!0,...a,children:v.jsx(D.button,{"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute,...o,ref:l,onPointerMove:N(e.onPointerMove,y=>{y.pointerType!=="touch"&&!f.current&&!s.isPointerInTransitRef.current&&(r.onTriggerEnter(),f.current=!0)}),onPointerLeave:N(e.onPointerLeave,()=>{r.onTriggerLeave(),f.current=!1}),onPointerDown:N(e.onPointerDown,()=>{r.open&&r.onClose(),u.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:N(e.onFocus,()=>{u.current||r.onOpen()}),onBlur:N(e.onBlur,r.onClose),onClick:N(e.onClick,r.onClose)})})});Yr.displayName=tn;var En="TooltipPortal",[pl,ml]=At(En,{forceMount:void 0}),Xr=e=>{const{__scopeTooltip:t,forceMount:n,children:o,container:r}=e,s=Ze(En,t);return v.jsx(pl,{scope:t,forceMount:n,children:v.jsx(ye,{present:n||s.open,children:v.jsx(Ge,{asChild:!0,container:r,children:o})})})};Xr.displayName=En;var Fe="TooltipContent",Gr=i.forwardRef((e,t)=>{const n=ml(Fe,e.__scopeTooltip),{forceMount:o=n.forceMount,side:r="top",...s}=e,a=Ze(Fe,e.__scopeTooltip);return v.jsx(ye,{present:o||a.open,children:a.disableHoverableContent?v.jsx(qr,{side:r,...s,ref:t}):v.jsx(hl,{side:r,...s,ref:t})})}),hl=i.forwardRef((e,t)=>{const n=Ze(Fe,e.__scopeTooltip),o=bn(Fe,e.__scopeTooltip),r=i.useRef(null),s=B(t,r),[a,c]=i.useState(null),{trigger:l,onClose:u}=n,f=r.current,{onPointerInTransitChange:p}=o,y=i.useCallback(()=>{c(null),p(!1)},[p]),h=i.useCallback((x,d)=>{const m=x.currentTarget,w={x:x.clientX,y:x.clientY},g=xl(w,m.getBoundingClientRect()),C=Cl(w,g),b=bl(d.getBoundingClientRect()),E=Sl([...C,...b]);c(E),p(!0)},[p]);return i.useEffect(()=>()=>y(),[y]),i.useEffect(()=>{if(l&&f){const x=m=>h(m,f),d=m=>h(m,l);return l.addEventListener("pointerleave",x),f.addEventListener("pointerleave",d),()=>{l.removeEventListener("pointerleave",x),f.removeEventListener("pointerleave",d)}}},[l,f,h,y]),i.useEffect(()=>{if(a){const x=d=>{const m=d.target,w={x:d.clientX,y:d.clientY},g=l?.contains(m)||f?.contains(m),C=!El(w,a);g?y():C&&(y(),u())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[l,f,a,u,y]),v.jsx(qr,{...e,ref:s})}),[vl,gl]=At(ze,{isInside:!1}),yl=ll("TooltipContent"),qr=i.forwardRef((e,t)=>{const{__scopeTooltip:n,children:o,"aria-label":r,onEscapeKeyDown:s,onPointerDownOutside:a,...c}=e,l=Ze(Fe,n),u=Ot(n),{onClose:f}=l;return i.useEffect(()=>(document.addEventListener(en,f),()=>document.removeEventListener(en,f)),[f]),i.useEffect(()=>{if(l.trigger){const p=y=>{y.target?.contains(l.trigger)&&f()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[l.trigger,f]),v.jsx(Xe,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:p=>p.preventDefault(),onDismiss:f,children:v.jsxs(pr,{"data-state":l.stateAttribute,...u,...c,ref:t,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[v.jsx(yl,{children:o}),v.jsx(vl,{scope:n,isInside:!0,children:v.jsx(Wc,{id:l.contentId,role:"tooltip",children:r||o})})]})})});Gr.displayName=Fe;var Zr="TooltipArrow",wl=i.forwardRef((e,t)=>{const{__scopeTooltip:n,...o}=e,r=Ot(n);return gl(Zr,n).isInside?null:v.jsx(mr,{...r,...o,ref:t})});wl.displayName=Zr;function xl(e,t){const n=Math.abs(t.top-e.y),o=Math.abs(t.bottom-e.y),r=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,o,r,s)){case s:return"left";case r:return"right";case n:return"top";case o:return"bottom";default:throw new Error("unreachable")}}function Cl(e,t,n=5){const o=[];switch(t){case"top":o.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":o.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":o.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":o.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return o}function bl(e){const{top:t,right:n,bottom:o,left:r}=e;return[{x:r,y:t},{x:n,y:t},{x:n,y:o},{x:r,y:o}]}function El(e,t){const{x:n,y:o}=e;let r=!1;for(let s=0,a=t.length-1;so!=y>o&&n<(p-u)*(o-f)/(y-f)+u&&(r=!r)}return r}function Sl(e){const t=e.slice();return t.sort((n,o)=>n.xo.x?1:n.yo.y?1:0),Tl(t)}function Tl(e){if(e.length<=1)return e.slice();const t=[];for(let o=0;o=2;){const s=t[t.length-1],a=t[t.length-2];if((s.x-a.x)*(r.y-a.y)>=(s.y-a.y)*(r.x-a.x))t.pop();else break}t.push(r)}t.pop();const n=[];for(let o=e.length-1;o>=0;o--){const r=e[o];for(;n.length>=2;){const s=n[n.length-1],a=n[n.length-2];if((s.x-a.x)*(r.y-a.y)>=(s.y-a.y)*(r.x-a.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var vu=Kr,gu=zr,yu=Yr,wu=Xr,xu=Gr,Sn="ToastProvider",[Tn,Rl,Pl]=eo("Toast"),[Qr]=Oe("Toast",[Pl]),[Al,It]=Qr(Sn),Jr=e=>{const{__scopeToast:t,label:n="Notification",duration:o=5e3,swipeDirection:r="right",swipeThreshold:s=50,children:a}=e,[c,l]=i.useState(null),[u,f]=i.useState(0),p=i.useRef(!1),y=i.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Sn}\`. Expected non-empty \`string\`.`),v.jsx(Tn.Provider,{scope:t,children:v.jsx(Al,{scope:t,label:n,duration:o,swipeDirection:r,swipeThreshold:s,toastCount:u,viewport:c,onViewportChange:l,onToastAdd:i.useCallback(()=>f(h=>h+1),[]),onToastRemove:i.useCallback(()=>f(h=>h-1),[]),isFocusedToastEscapeKeyDownRef:p,isClosePausedRef:y,children:a})})};Jr.displayName=Sn;var es="ToastViewport",Ol=["F8"],nn="toast.viewportPause",on="toast.viewportResume",ts=i.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:o=Ol,label:r="Notifications ({hotkey})",...s}=e,a=It(es,n),c=Rl(n),l=i.useRef(null),u=i.useRef(null),f=i.useRef(null),p=i.useRef(null),y=B(t,p,a.onViewportChange),h=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),x=a.toastCount>0;i.useEffect(()=>{const m=w=>{o.length!==0&&o.every(C=>w[C]||w.code===C)&&p.current?.focus()};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[o]),i.useEffect(()=>{const m=l.current,w=p.current;if(x&&m&&w){const g=()=>{if(!a.isClosePausedRef.current){const R=new CustomEvent(nn);w.dispatchEvent(R),a.isClosePausedRef.current=!0}},C=()=>{if(a.isClosePausedRef.current){const R=new CustomEvent(on);w.dispatchEvent(R),a.isClosePausedRef.current=!1}},b=R=>{!m.contains(R.relatedTarget)&&C()},E=()=>{m.contains(document.activeElement)||C()};return m.addEventListener("focusin",g),m.addEventListener("focusout",b),m.addEventListener("pointermove",g),m.addEventListener("pointerleave",E),window.addEventListener("blur",g),window.addEventListener("focus",C),()=>{m.removeEventListener("focusin",g),m.removeEventListener("focusout",b),m.removeEventListener("pointermove",g),m.removeEventListener("pointerleave",E),window.removeEventListener("blur",g),window.removeEventListener("focus",C)}}},[x,a.isClosePausedRef]);const d=i.useCallback(({tabbingDirection:m})=>{const g=c().map(C=>{const b=C.ref.current,E=[b,...Vl(b)];return m==="forwards"?E:E.reverse()});return(m==="forwards"?g.reverse():g).flat()},[c]);return i.useEffect(()=>{const m=p.current;if(m){const w=g=>{const C=g.altKey||g.ctrlKey||g.metaKey;if(g.key==="Tab"&&!C){const E=document.activeElement,R=g.shiftKey;if(g.target===m&&R){u.current?.focus();return}const M=d({tabbingDirection:R?"backwards":"forwards"}),L=M.findIndex(k=>k===E);Ht(M.slice(L+1))?g.preventDefault():R?u.current?.focus():f.current?.focus()}};return m.addEventListener("keydown",w),()=>m.removeEventListener("keydown",w)}},[c,d]),v.jsxs(Zs,{ref:l,role:"region","aria-label":r.replace("{hotkey}",h),tabIndex:-1,style:{pointerEvents:x?void 0:"none"},children:[x&&v.jsx(rn,{ref:u,onFocusFromOutsideViewport:()=>{const m=d({tabbingDirection:"forwards"});Ht(m)}}),v.jsx(Tn.Slot,{scope:n,children:v.jsx(D.ol,{tabIndex:-1,...s,ref:y})}),x&&v.jsx(rn,{ref:f,onFocusFromOutsideViewport:()=>{const m=d({tabbingDirection:"backwards"});Ht(m)}})]})});ts.displayName=es;var ns="ToastFocusProxy",rn=i.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:o,...r}=e,s=It(ns,n);return v.jsx(St,{tabIndex:0,...r,ref:t,style:{position:"fixed"},onFocus:a=>{const c=a.relatedTarget;!s.viewport?.contains(c)&&o()}})});rn.displayName=ns;var Qe="Toast",Il="toast.swipeStart",Nl="toast.swipeMove",_l="toast.swipeCancel",Dl="toast.swipeEnd",os=i.forwardRef((e,t)=>{const{forceMount:n,open:o,defaultOpen:r,onOpenChange:s,...a}=e,[c,l]=ke({prop:o,defaultProp:r??!0,onChange:s,caller:Qe});return v.jsx(ye,{present:n||c,children:v.jsx(kl,{open:c,...a,ref:t,onClose:()=>l(!1),onPause:ee(e.onPause),onResume:ee(e.onResume),onSwipeStart:N(e.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:N(e.onSwipeMove,u=>{const{x:f,y:p}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","move"),u.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${f}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${p}px`)}),onSwipeCancel:N(e.onSwipeCancel,u=>{u.currentTarget.setAttribute("data-swipe","cancel"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:N(e.onSwipeEnd,u=>{const{x:f,y:p}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","end"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${f}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${p}px`),l(!1)})})})});os.displayName=Qe;var[Ml,Ll]=Qr(Qe,{onClose(){}}),kl=i.forwardRef((e,t)=>{const{__scopeToast:n,type:o="foreground",duration:r,open:s,onClose:a,onEscapeKeyDown:c,onPause:l,onResume:u,onSwipeStart:f,onSwipeMove:p,onSwipeCancel:y,onSwipeEnd:h,...x}=e,d=It(Qe,n),[m,w]=i.useState(null),g=B(t,T=>w(T)),C=i.useRef(null),b=i.useRef(null),E=r||d.duration,R=i.useRef(0),S=i.useRef(E),O=i.useRef(0),{onToastAdd:M,onToastRemove:L}=d,k=ee(()=>{m?.contains(document.activeElement)&&d.viewport?.focus(),a()}),$=i.useCallback(T=>{!T||T===1/0||(window.clearTimeout(O.current),R.current=new Date().getTime(),O.current=window.setTimeout(k,T))},[k]);i.useEffect(()=>{const T=d.viewport;if(T){const j=()=>{$(S.current),u?.()},I=()=>{const _=new Date().getTime()-R.current;S.current=S.current-_,window.clearTimeout(O.current),l?.()};return T.addEventListener(nn,I),T.addEventListener(on,j),()=>{T.removeEventListener(nn,I),T.removeEventListener(on,j)}}},[d.viewport,E,l,u,$]),i.useEffect(()=>{s&&!d.isClosePausedRef.current&&$(E)},[s,E,d.isClosePausedRef,$]),i.useEffect(()=>(M(),()=>L()),[M,L]);const F=i.useMemo(()=>m?us(m):null,[m]);return d.viewport?v.jsxs(v.Fragment,{children:[F&&v.jsx(jl,{__scopeToast:n,role:"status","aria-live":o==="foreground"?"assertive":"polite",children:F}),v.jsx(Ml,{scope:n,onClose:k,children:Ye.createPortal(v.jsx(Tn.ItemSlot,{scope:n,children:v.jsx(qs,{asChild:!0,onEscapeKeyDown:N(c,()=>{d.isFocusedToastEscapeKeyDownRef.current||k(),d.isFocusedToastEscapeKeyDownRef.current=!1}),children:v.jsx(D.li,{tabIndex:0,"data-state":s?"open":"closed","data-swipe-direction":d.swipeDirection,...x,ref:g,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:N(e.onKeyDown,T=>{T.key==="Escape"&&(c?.(T.nativeEvent),T.nativeEvent.defaultPrevented||(d.isFocusedToastEscapeKeyDownRef.current=!0,k()))}),onPointerDown:N(e.onPointerDown,T=>{T.button===0&&(C.current={x:T.clientX,y:T.clientY})}),onPointerMove:N(e.onPointerMove,T=>{if(!C.current)return;const j=T.clientX-C.current.x,I=T.clientY-C.current.y,_=!!b.current,P=["left","right"].includes(d.swipeDirection),W=["left","up"].includes(d.swipeDirection)?Math.min:Math.max,Y=P?W(0,j):0,ue=P?0:W(0,I),de=T.pointerType==="touch"?10:2,re={x:Y,y:ue},Q={originalEvent:T,delta:re};_?(b.current=re,st(Nl,p,Q,{discrete:!1})):Jn(re,d.swipeDirection,de)?(b.current=re,st(Il,f,Q,{discrete:!1}),T.target.setPointerCapture(T.pointerId)):(Math.abs(j)>de||Math.abs(I)>de)&&(C.current=null)}),onPointerUp:N(e.onPointerUp,T=>{const j=b.current,I=T.target;if(I.hasPointerCapture(T.pointerId)&&I.releasePointerCapture(T.pointerId),b.current=null,C.current=null,j){const _=T.currentTarget,P={originalEvent:T,delta:j};Jn(j,d.swipeDirection,d.swipeThreshold)?st(Dl,h,P,{discrete:!0}):st(_l,y,P,{discrete:!0}),_.addEventListener("click",W=>W.preventDefault(),{once:!0})}})})})}),d.viewport)})]}):null}),jl=e=>{const{__scopeToast:t,children:n,...o}=e,r=It(Qe,t),[s,a]=i.useState(!1),[c,l]=i.useState(!1);return Wl(()=>a(!0)),i.useEffect(()=>{const u=window.setTimeout(()=>l(!0),1e3);return()=>window.clearTimeout(u)},[]),c?null:v.jsx(Ge,{asChild:!0,children:v.jsx(St,{...o,children:s&&v.jsxs(v.Fragment,{children:[r.label," ",n]})})})},Fl="ToastTitle",rs=i.forwardRef((e,t)=>{const{__scopeToast:n,...o}=e;return v.jsx(D.div,{...o,ref:t})});rs.displayName=Fl;var $l="ToastDescription",ss=i.forwardRef((e,t)=>{const{__scopeToast:n,...o}=e;return v.jsx(D.div,{...o,ref:t})});ss.displayName=$l;var is="ToastAction",as=i.forwardRef((e,t)=>{const{altText:n,...o}=e;return n.trim()?v.jsx(ls,{altText:n,asChild:!0,children:v.jsx(Rn,{...o,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${is}\`. Expected non-empty \`string\`.`),null)});as.displayName=is;var cs="ToastClose",Rn=i.forwardRef((e,t)=>{const{__scopeToast:n,...o}=e,r=Ll(cs,n);return v.jsx(ls,{asChild:!0,children:v.jsx(D.button,{type:"button",...o,ref:t,onClick:N(e.onClick,r.onClose)})})});Rn.displayName=cs;var ls=i.forwardRef((e,t)=>{const{__scopeToast:n,altText:o,...r}=e;return v.jsx(D.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":o||void 0,...r,ref:t})});function us(e){const t=[];return Array.from(e.childNodes).forEach(o=>{if(o.nodeType===o.TEXT_NODE&&o.textContent&&t.push(o.textContent),Bl(o)){const r=o.ariaHidden||o.hidden||o.style.display==="none",s=o.dataset.radixToastAnnounceExclude==="";if(!r)if(s){const a=o.dataset.radixToastAnnounceAlt;a&&t.push(a)}else t.push(...us(o))}}),t}function st(e,t,n,{discrete:o}){const r=n.originalEvent.currentTarget,s=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),o?to(r,s):r.dispatchEvent(s)}var Jn=(e,t,n=0)=>{const o=Math.abs(e.x),r=Math.abs(e.y),s=o>r;return t==="left"||t==="right"?s&&o>n:!s&&r>n};function Wl(e=()=>{}){const t=ee(e);z(()=>{let n=0,o=0;return n=window.requestAnimationFrame(()=>o=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(o)}},[t])}function Bl(e){return e.nodeType===e.ELEMENT_NODE}function Vl(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const r=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||r?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Ht(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var Cu=Jr,bu=ts,Eu=os,Su=rs,Tu=ss,Ru=as,Pu=Rn;export{hu as $,dr as A,fr as B,Zl as C,Jl as D,mr as E,an as F,to as G,la as H,ua as I,tu as J,ou as K,su as L,pu as M,mu as N,ql as O,D as P,iu as Q,Yl as R,Ul as S,Ql as T,au as U,cu as V,zl as W,lu as X,uu as Y,fu as Z,du as _,eo as a,nu as a0,ru as a1,wu as a2,xu as a3,vu as a4,gu as a5,yu as a6,bu as a7,Eu as a8,Ru as a9,Pu as aa,Su as ab,Tu as ac,Cu as ad,N as b,Oe as c,B as d,_s as e,ke as f,ee as g,ye as h,z as i,On as j,oo as k,Lo as l,ko as m,Kl as n,Gl as o,eu as p,Xl as q,$e as r,Ge as s,Et as t,Se as u,yo as v,cn as w,co as x,Xe as y,pr as z}; diff --git a/webui/dist/assets/radix-core-DyJi0yyw.js b/webui/dist/assets/radix-core-DyJi0yyw.js new file mode 100644 index 00000000..2dee8fdf --- /dev/null +++ b/webui/dist/assets/radix-core-DyJi0yyw.js @@ -0,0 +1,45 @@ +import{r as i,j as v,R as Ee,a as sn,b as Ye,c as ds}from"./router-9vIXuQkh.js";function N(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function fs(e,t){const n=i.createContext(t),o=s=>{const{children:a,...c}=s,l=i.useMemo(()=>c,Object.values(c));return v.jsx(n.Provider,{value:l,children:a})};o.displayName=e+"Provider";function r(s){const a=i.useContext(n);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[o,r]}function Oe(e,t=[]){let n=[];function o(s,a){const c=i.createContext(a),l=n.length;n=[...n,a];const u=p=>{const{scope:y,children:h,...x}=p,d=y?.[e]?.[l]||c,m=i.useMemo(()=>x,Object.values(x));return v.jsx(d.Provider,{value:m,children:h})};u.displayName=s+"Provider";function f(p,y){const h=y?.[e]?.[l]||c,x=i.useContext(h);if(x)return x;if(a!==void 0)return a;throw new Error(`\`${p}\` must be used within \`${s}\``)}return[u,f]}const r=()=>{const s=n.map(a=>i.createContext(a));return function(c){const l=c?.[e]||s;return i.useMemo(()=>({[`__scope${e}`]:{...c,[e]:l}}),[c,l])}};return r.scopeName=e,[o,ps(r,...t)]}function ps(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const o=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(s){const a=o.reduce((c,{useScope:l,scopeName:u})=>{const p=l(s)[`__scope${u}`];return{...c,...p}},{});return i.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}function Pn(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function $e(...e){return t=>{let n=!1;const o=e.map(r=>{const s=Pn(r,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let r=0;r{const{children:s,...a}=o,c=i.Children.toArray(s),l=c.find(vs);if(l){const u=l.props.children,f=c.map(p=>p===l?i.Children.count(u)>1?i.Children.only(null):i.isValidElement(u)?u.props.children:null:p);return v.jsx(t,{...a,ref:r,children:i.isValidElement(u)?i.cloneElement(u,void 0,f):null})}return v.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}function ms(e){const t=i.forwardRef((n,o)=>{const{children:r,...s}=n;if(i.isValidElement(r)){const a=ys(r),c=gs(s,r.props);return r.type!==i.Fragment&&(c.ref=o?$e(o,a):a),i.cloneElement(r,c)}return i.Children.count(r)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var hs=Symbol("radix.slottable");function vs(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===hs}function gs(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...c)=>{const l=s(...c);return r(...c),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function ys(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function eo(e){const t=e+"CollectionProvider",[n,o]=Oe(t),[r,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=d=>{const{scope:m,children:w}=d,g=Ee.useRef(null),C=Ee.useRef(new Map).current;return v.jsx(r,{scope:m,itemMap:C,collectionRef:g,children:w})};a.displayName=t;const c=e+"CollectionSlot",l=An(c),u=Ee.forwardRef((d,m)=>{const{scope:w,children:g}=d,C=s(c,w),b=B(m,C.collectionRef);return v.jsx(l,{ref:b,children:g})});u.displayName=c;const f=e+"CollectionItemSlot",p="data-radix-collection-item",y=An(f),h=Ee.forwardRef((d,m)=>{const{scope:w,children:g,...C}=d,b=Ee.useRef(null),E=B(m,b),R=s(f,w);return Ee.useEffect(()=>(R.itemMap.set(b,{ref:b,...C}),()=>void R.itemMap.delete(b))),v.jsx(y,{[p]:"",ref:E,children:g})});h.displayName=f;function x(d){const m=s(e+"CollectionConsumer",d);return Ee.useCallback(()=>{const g=m.collectionRef.current;if(!g)return[];const C=Array.from(g.querySelectorAll(`[${p}]`));return Array.from(m.itemMap.values()).sort((R,S)=>C.indexOf(R.ref.current)-C.indexOf(S.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:a,Slot:u,ItemSlot:h},x,o]}var z=globalThis?.document?i.useLayoutEffect:()=>{},ws=sn[" useId ".trim().toString()]||(()=>{}),xs=0;function Se(e){const[t,n]=i.useState(ws());return z(()=>{n(o=>o??String(xs++))},[e]),t?`radix-${t}`:""}function Cs(e){const t=bs(e),n=i.forwardRef((o,r)=>{const{children:s,...a}=o,c=i.Children.toArray(s),l=c.find(Ss);if(l){const u=l.props.children,f=c.map(p=>p===l?i.Children.count(u)>1?i.Children.only(null):i.isValidElement(u)?u.props.children:null:p);return v.jsx(t,{...a,ref:r,children:i.isValidElement(u)?i.cloneElement(u,void 0,f):null})}return v.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}function bs(e){const t=i.forwardRef((n,o)=>{const{children:r,...s}=n;if(i.isValidElement(r)){const a=Rs(r),c=Ts(s,r.props);return r.type!==i.Fragment&&(c.ref=o?$e(o,a):a),i.cloneElement(r,c)}return i.Children.count(r)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Es=Symbol("radix.slottable");function Ss(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Es}function Ts(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...c)=>{const l=s(...c);return r(...c),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function Rs(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Ps=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],D=Ps.reduce((e,t)=>{const n=Cs(`Primitive.${t}`),o=i.forwardRef((r,s)=>{const{asChild:a,...c}=r,l=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),v.jsx(l,{...c,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function to(e,t){e&&Ye.flushSync(()=>e.dispatchEvent(t))}function ee(e){const t=i.useRef(e);return i.useEffect(()=>{t.current=e}),i.useMemo(()=>(...n)=>t.current?.(...n),[])}var As=sn[" useInsertionEffect ".trim().toString()]||z;function ke({prop:e,defaultProp:t,onChange:n=()=>{},caller:o}){const[r,s,a]=Os({defaultProp:t,onChange:n}),c=e!==void 0,l=c?e:r;{const f=i.useRef(e!==void 0);i.useEffect(()=>{const p=f.current;p!==c&&console.warn(`${o} is changing from ${p?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=c},[c,o])}const u=i.useCallback(f=>{if(c){const p=Is(f)?f(e):f;p!==e&&a.current?.(p)}else s(f)},[c,e,s,a]);return[l,u]}function Os({defaultProp:e,onChange:t}){const[n,o]=i.useState(e),r=i.useRef(n),s=i.useRef(t);return As(()=>{s.current=t},[t]),i.useEffect(()=>{r.current!==n&&(s.current?.(n),r.current=n)},[n,r]),[n,o,s]}function Is(e){return typeof e=="function"}var Ns=i.createContext(void 0);function _s(e){const t=i.useContext(Ns);return e||t||"ltr"}function Ds(e,t){return i.useReducer((n,o)=>t[n][o]??n,e)}var ye=e=>{const{present:t,children:n}=e,o=Ms(t),r=typeof n=="function"?n({present:o.isPresent}):i.Children.only(n),s=B(o.ref,Ls(r));return typeof n=="function"||o.isPresent?i.cloneElement(r,{ref:s}):null};ye.displayName="Presence";function Ms(e){const[t,n]=i.useState(),o=i.useRef(null),r=i.useRef(e),s=i.useRef("none"),a=e?"mounted":"unmounted",[c,l]=Ds(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return i.useEffect(()=>{const u=Je(o.current);s.current=c==="mounted"?u:"none"},[c]),z(()=>{const u=o.current,f=r.current;if(f!==e){const y=s.current,h=Je(u);e?l("MOUNT"):h==="none"||u?.display==="none"?l("UNMOUNT"):l(f&&y!==h?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,l]),z(()=>{if(t){let u;const f=t.ownerDocument.defaultView??window,p=h=>{const d=Je(o.current).includes(CSS.escape(h.animationName));if(h.target===t&&d&&(l("ANIMATION_END"),!r.current)){const m=t.style.animationFillMode;t.style.animationFillMode="forwards",u=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=m)})}},y=h=>{h.target===t&&(s.current=Je(o.current))};return t.addEventListener("animationstart",y),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{f.clearTimeout(u),t.removeEventListener("animationstart",y),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:i.useCallback(u=>{o.current=u?getComputedStyle(u):null,n(u)},[])}}function Je(e){return e?.animationName||"none"}function Ls(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function On(e,[t,n]){return Math.min(n,Math.max(t,e))}var ks=Symbol.for("react.lazy"),lt=sn[" use ".trim().toString()];function js(e){return typeof e=="object"&&e!==null&&"then"in e}function no(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===ks&&"_payload"in e&&js(e._payload)}function oo(e){const t=Fs(e),n=i.forwardRef((o,r)=>{let{children:s,...a}=o;no(s)&&typeof lt=="function"&&(s=lt(s._payload));const c=i.Children.toArray(s),l=c.find(Ws);if(l){const u=l.props.children,f=c.map(p=>p===l?i.Children.count(u)>1?i.Children.only(null):i.isValidElement(u)?u.props.children:null:p);return v.jsx(t,{...a,ref:r,children:i.isValidElement(u)?i.cloneElement(u,void 0,f):null})}return v.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}var Ul=oo("Slot");function Fs(e){const t=i.forwardRef((n,o)=>{let{children:r,...s}=n;if(no(r)&&typeof lt=="function"&&(r=lt(r._payload)),i.isValidElement(r)){const a=Vs(r),c=Bs(s,r.props);return r.type!==i.Fragment&&(c.ref=o?$e(o,a):a),i.cloneElement(r,c)}return i.Children.count(r)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var $s=Symbol("radix.slottable");function Ws(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===$s}function Bs(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...c)=>{const l=s(...c);return r(...c),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function Vs(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Hs(e,t=globalThis?.document){const n=ee(e);i.useEffect(()=>{const o=r=>{r.key==="Escape"&&n(r)};return t.addEventListener("keydown",o,{capture:!0}),()=>t.removeEventListener("keydown",o,{capture:!0})},[n,t])}var Us="DismissableLayer",Ut="dismissableLayer.update",Ks="dismissableLayer.pointerDownOutside",zs="dismissableLayer.focusOutside",In,ro=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Xe=i.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:o,onPointerDownOutside:r,onFocusOutside:s,onInteractOutside:a,onDismiss:c,...l}=e,u=i.useContext(ro),[f,p]=i.useState(null),y=f?.ownerDocument??globalThis?.document,[,h]=i.useState({}),x=B(t,S=>p(S)),d=Array.from(u.layers),[m]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),w=d.indexOf(m),g=f?d.indexOf(f):-1,C=u.layersWithOutsidePointerEventsDisabled.size>0,b=g>=w,E=Xs(S=>{const O=S.target,M=[...u.branches].some(L=>L.contains(O));!b||M||(r?.(S),a?.(S),S.defaultPrevented||c?.())},y),R=Gs(S=>{const O=S.target;[...u.branches].some(L=>L.contains(O))||(s?.(S),a?.(S),S.defaultPrevented||c?.())},y);return Hs(S=>{g===u.layers.size-1&&(o?.(S),!S.defaultPrevented&&c&&(S.preventDefault(),c()))},y),i.useEffect(()=>{if(f)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(In=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),Nn(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(y.body.style.pointerEvents=In)}},[f,y,n,u]),i.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),Nn())},[f,u]),i.useEffect(()=>{const S=()=>h({});return document.addEventListener(Ut,S),()=>document.removeEventListener(Ut,S)},[]),v.jsx(D.div,{...l,ref:x,style:{pointerEvents:C?b?"auto":"none":void 0,...e.style},onFocusCapture:N(e.onFocusCapture,R.onFocusCapture),onBlurCapture:N(e.onBlurCapture,R.onBlurCapture),onPointerDownCapture:N(e.onPointerDownCapture,E.onPointerDownCapture)})});Xe.displayName=Us;var Ys="DismissableLayerBranch",so=i.forwardRef((e,t)=>{const n=i.useContext(ro),o=i.useRef(null),r=B(t,o);return i.useEffect(()=>{const s=o.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),v.jsx(D.div,{...e,ref:r})});so.displayName=Ys;function Xs(e,t=globalThis?.document){const n=ee(e),o=i.useRef(!1),r=i.useRef(()=>{});return i.useEffect(()=>{const s=c=>{if(c.target&&!o.current){let l=function(){io(Ks,n,u,{discrete:!0})};const u={originalEvent:c};c.pointerType==="touch"?(t.removeEventListener("click",r.current),r.current=l,t.addEventListener("click",r.current,{once:!0})):l()}else t.removeEventListener("click",r.current);o.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",s),t.removeEventListener("click",r.current)}},[t,n]),{onPointerDownCapture:()=>o.current=!0}}function Gs(e,t=globalThis?.document){const n=ee(e),o=i.useRef(!1);return i.useEffect(()=>{const r=s=>{s.target&&!o.current&&io(zs,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",r),()=>t.removeEventListener("focusin",r)},[t,n]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function Nn(){const e=new CustomEvent(Ut);document.dispatchEvent(e)}function io(e,t,n,{discrete:o}){const r=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),o?to(r,s):r.dispatchEvent(s)}var qs=Xe,Zs=so,Mt="focusScope.autoFocusOnMount",Lt="focusScope.autoFocusOnUnmount",_n={bubbles:!1,cancelable:!0},Qs="FocusScope",an=i.forwardRef((e,t)=>{const{loop:n=!1,trapped:o=!1,onMountAutoFocus:r,onUnmountAutoFocus:s,...a}=e,[c,l]=i.useState(null),u=ee(r),f=ee(s),p=i.useRef(null),y=B(t,d=>l(d)),h=i.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;i.useEffect(()=>{if(o){let d=function(C){if(h.paused||!c)return;const b=C.target;c.contains(b)?p.current=b:me(p.current,{select:!0})},m=function(C){if(h.paused||!c)return;const b=C.relatedTarget;b!==null&&(c.contains(b)||me(p.current,{select:!0}))},w=function(C){if(document.activeElement===document.body)for(const E of C)E.removedNodes.length>0&&me(c)};document.addEventListener("focusin",d),document.addEventListener("focusout",m);const g=new MutationObserver(w);return c&&g.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",d),document.removeEventListener("focusout",m),g.disconnect()}}},[o,c,h.paused]),i.useEffect(()=>{if(c){Mn.add(h);const d=document.activeElement;if(!c.contains(d)){const w=new CustomEvent(Mt,_n);c.addEventListener(Mt,u),c.dispatchEvent(w),w.defaultPrevented||(Js(ri(ao(c)),{select:!0}),document.activeElement===d&&me(c))}return()=>{c.removeEventListener(Mt,u),setTimeout(()=>{const w=new CustomEvent(Lt,_n);c.addEventListener(Lt,f),c.dispatchEvent(w),w.defaultPrevented||me(d??document.body,{select:!0}),c.removeEventListener(Lt,f),Mn.remove(h)},0)}}},[c,u,f,h]);const x=i.useCallback(d=>{if(!n&&!o||h.paused)return;const m=d.key==="Tab"&&!d.altKey&&!d.ctrlKey&&!d.metaKey,w=document.activeElement;if(m&&w){const g=d.currentTarget,[C,b]=ei(g);C&&b?!d.shiftKey&&w===b?(d.preventDefault(),n&&me(C,{select:!0})):d.shiftKey&&w===C&&(d.preventDefault(),n&&me(b,{select:!0})):w===g&&d.preventDefault()}},[n,o,h.paused]);return v.jsx(D.div,{tabIndex:-1,...a,ref:y,onKeyDown:x})});an.displayName=Qs;function Js(e,{select:t=!1}={}){const n=document.activeElement;for(const o of e)if(me(o,{select:t}),document.activeElement!==n)return}function ei(e){const t=ao(e),n=Dn(t,e),o=Dn(t.reverse(),e);return[n,o]}function ao(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const r=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||r?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Dn(e,t){for(const n of e)if(!ti(n,{upTo:t}))return n}function ti(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function ni(e){return e instanceof HTMLInputElement&&"select"in e}function me(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&ni(e)&&t&&e.select()}}var Mn=oi();function oi(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Ln(e,t),e.unshift(t)},remove(t){e=Ln(e,t),e[0]?.resume()}}}function Ln(e,t){const n=[...e],o=n.indexOf(t);return o!==-1&&n.splice(o,1),n}function ri(e){return e.filter(t=>t.tagName!=="A")}var si="Portal",Ge=i.forwardRef((e,t)=>{const{container:n,...o}=e,[r,s]=i.useState(!1);z(()=>s(!0),[]);const a=n||r&&globalThis?.document?.body;return a?ds.createPortal(v.jsx(D.div,{...o,ref:t}),a):null});Ge.displayName=si;var kt=0;function co(){i.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??kn()),document.body.insertAdjacentElement("beforeend",e[1]??kn()),kt++,()=>{kt===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),kt--}},[])}function kn(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var se=function(){return se=Object.assign||function(t){for(var n,o=1,r=arguments.length;o"u")return bi;var t=Ei(e),n=document.documentElement.clientWidth,o=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,o-n+t[2]-t[0])}},Ti=po(),Me="data-scroll-locked",Ri=function(e,t,n,o){var r=e.left,s=e.top,a=e.right,c=e.gap;return n===void 0&&(n="margin"),` + .`.concat(ai,` { + overflow: hidden `).concat(o,`; + padding-right: `).concat(c,"px ").concat(o,`; + } + body[`).concat(Me,`] { + overflow: hidden `).concat(o,`; + overscroll-behavior: contain; + `).concat([t&&"position: relative ".concat(o,";"),n==="margin"&&` + padding-left: `.concat(r,`px; + padding-top: `).concat(s,`px; + padding-right: `).concat(a,`px; + margin-left:0; + margin-top:0; + margin-right: `).concat(c,"px ").concat(o,`; + `),n==="padding"&&"padding-right: ".concat(c,"px ").concat(o,";")].filter(Boolean).join(""),` + } + + .`).concat(it,` { + right: `).concat(c,"px ").concat(o,`; + } + + .`).concat(at,` { + margin-right: `).concat(c,"px ").concat(o,`; + } + + .`).concat(it," .").concat(it,` { + right: 0 `).concat(o,`; + } + + .`).concat(at," .").concat(at,` { + margin-right: 0 `).concat(o,`; + } + + body[`).concat(Me,`] { + `).concat(ci,": ").concat(c,`px; + } +`)},Fn=function(){var e=parseInt(document.body.getAttribute(Me)||"0",10);return isFinite(e)?e:0},Pi=function(){i.useEffect(function(){return document.body.setAttribute(Me,(Fn()+1).toString()),function(){var e=Fn()-1;e<=0?document.body.removeAttribute(Me):document.body.setAttribute(Me,e.toString())}},[])},Ai=function(e){var t=e.noRelative,n=e.noImportant,o=e.gapMode,r=o===void 0?"margin":o;Pi();var s=i.useMemo(function(){return Si(r)},[r]);return i.createElement(Ti,{styles:Ri(s,!t,r,n?"":"!important")})},Kt=!1;if(typeof window<"u")try{var et=Object.defineProperty({},"passive",{get:function(){return Kt=!0,!0}});window.addEventListener("test",et,et),window.removeEventListener("test",et,et)}catch{Kt=!1}var Ne=Kt?{passive:!1}:!1,Oi=function(e){return e.tagName==="TEXTAREA"},mo=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Oi(e)&&n[t]==="visible")},Ii=function(e){return mo(e,"overflowY")},Ni=function(e){return mo(e,"overflowX")},$n=function(e,t){var n=t.ownerDocument,o=t;do{typeof ShadowRoot<"u"&&o instanceof ShadowRoot&&(o=o.host);var r=ho(e,o);if(r){var s=vo(e,o),a=s[1],c=s[2];if(a>c)return!0}o=o.parentNode}while(o&&o!==n.body);return!1},_i=function(e){var t=e.scrollTop,n=e.scrollHeight,o=e.clientHeight;return[t,n,o]},Di=function(e){var t=e.scrollLeft,n=e.scrollWidth,o=e.clientWidth;return[t,n,o]},ho=function(e,t){return e==="v"?Ii(t):Ni(t)},vo=function(e,t){return e==="v"?_i(t):Di(t)},Mi=function(e,t){return e==="h"&&t==="rtl"?-1:1},Li=function(e,t,n,o,r){var s=Mi(e,window.getComputedStyle(t).direction),a=s*o,c=n.target,l=t.contains(c),u=!1,f=a>0,p=0,y=0;do{if(!c)break;var h=vo(e,c),x=h[0],d=h[1],m=h[2],w=d-m-s*x;(x||w)&&ho(e,c)&&(p+=w,y+=x);var g=c.parentNode;c=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!l&&c!==document.body||l&&(t.contains(c)||t===c));return(f&&Math.abs(p)<1||!f&&Math.abs(y)<1)&&(u=!0),u},tt=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Wn=function(e){return[e.deltaX,e.deltaY]},Bn=function(e){return e&&"current"in e?e.current:e},ki=function(e,t){return e[0]===t[0]&&e[1]===t[1]},ji=function(e){return` + .block-interactivity-`.concat(e,` {pointer-events: none;} + .allow-interactivity-`).concat(e,` {pointer-events: all;} +`)},Fi=0,_e=[];function $i(e){var t=i.useRef([]),n=i.useRef([0,0]),o=i.useRef(),r=i.useState(Fi++)[0],s=i.useState(po)[0],a=i.useRef(e);i.useEffect(function(){a.current=e},[e]),i.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(r));var d=ii([e.lockRef.current],(e.shards||[]).map(Bn),!0).filter(Boolean);return d.forEach(function(m){return m.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),d.forEach(function(m){return m.classList.remove("allow-interactivity-".concat(r))})}}},[e.inert,e.lockRef.current,e.shards]);var c=i.useCallback(function(d,m){if("touches"in d&&d.touches.length===2||d.type==="wheel"&&d.ctrlKey)return!a.current.allowPinchZoom;var w=tt(d),g=n.current,C="deltaX"in d?d.deltaX:g[0]-w[0],b="deltaY"in d?d.deltaY:g[1]-w[1],E,R=d.target,S=Math.abs(C)>Math.abs(b)?"h":"v";if("touches"in d&&S==="h"&&R.type==="range")return!1;var O=$n(S,R);if(!O)return!0;if(O?E=S:(E=S==="v"?"h":"v",O=$n(S,R)),!O)return!1;if(!o.current&&"changedTouches"in d&&(C||b)&&(o.current=E),!E)return!0;var M=o.current||E;return Li(M,m,d,M==="h"?C:b)},[]),l=i.useCallback(function(d){var m=d;if(!(!_e.length||_e[_e.length-1]!==s)){var w="deltaY"in m?Wn(m):tt(m),g=t.current.filter(function(E){return E.name===m.type&&(E.target===m.target||m.target===E.shadowParent)&&ki(E.delta,w)})[0];if(g&&g.should){m.cancelable&&m.preventDefault();return}if(!g){var C=(a.current.shards||[]).map(Bn).filter(Boolean).filter(function(E){return E.contains(m.target)}),b=C.length>0?c(m,C[0]):!a.current.noIsolation;b&&m.cancelable&&m.preventDefault()}}},[]),u=i.useCallback(function(d,m,w,g){var C={name:d,delta:m,target:w,should:g,shadowParent:Wi(w)};t.current.push(C),setTimeout(function(){t.current=t.current.filter(function(b){return b!==C})},1)},[]),f=i.useCallback(function(d){n.current=tt(d),o.current=void 0},[]),p=i.useCallback(function(d){u(d.type,Wn(d),d.target,c(d,e.lockRef.current))},[]),y=i.useCallback(function(d){u(d.type,tt(d),d.target,c(d,e.lockRef.current))},[]);i.useEffect(function(){return _e.push(s),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:y}),document.addEventListener("wheel",l,Ne),document.addEventListener("touchmove",l,Ne),document.addEventListener("touchstart",f,Ne),function(){_e=_e.filter(function(d){return d!==s}),document.removeEventListener("wheel",l,Ne),document.removeEventListener("touchmove",l,Ne),document.removeEventListener("touchstart",f,Ne)}},[]);var h=e.removeScrollBar,x=e.inert;return i.createElement(i.Fragment,null,x?i.createElement(s,{styles:ji(r)}):null,h?i.createElement(Ai,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Wi(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Bi=hi(fo,$i);var cn=i.forwardRef(function(e,t){return i.createElement(vt,se({},e,{ref:t,sideCar:Bi}))});cn.classNames=vt.classNames;var Vi=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},De=new WeakMap,nt=new WeakMap,ot={},Wt=0,go=function(e){return e&&(e.host||go(e.parentNode))},Hi=function(e,t){return t.map(function(n){if(e.contains(n))return n;var o=go(n);return o&&e.contains(o)?o:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Ui=function(e,t,n,o){var r=Hi(t,Array.isArray(e)?e:[e]);ot[n]||(ot[n]=new WeakMap);var s=ot[n],a=[],c=new Set,l=new Set(r),u=function(p){!p||c.has(p)||(c.add(p),u(p.parentNode))};r.forEach(u);var f=function(p){!p||l.has(p)||Array.prototype.forEach.call(p.children,function(y){if(c.has(y))f(y);else try{var h=y.getAttribute(o),x=h!==null&&h!=="false",d=(De.get(y)||0)+1,m=(s.get(y)||0)+1;De.set(y,d),s.set(y,m),a.push(y),d===1&&x&&nt.set(y,!0),m===1&&y.setAttribute(n,"true"),x||y.setAttribute(o,"true")}catch(w){console.error("aria-hidden: cannot operate on ",y,w)}})};return f(t),c.clear(),Wt++,function(){a.forEach(function(p){var y=De.get(p)-1,h=s.get(p)-1;De.set(p,y),s.set(p,h),y||(nt.has(p)||p.removeAttribute(o),nt.delete(p)),h||p.removeAttribute(n)}),Wt--,Wt||(De=new WeakMap,De=new WeakMap,nt=new WeakMap,ot={})}},yo=function(e,t,n){n===void 0&&(n="data-aria-hidden");var o=Array.from(Array.isArray(e)?e:[e]),r=Vi(e);return r?(o.push.apply(o,Array.from(r.querySelectorAll("[aria-live], script"))),Ui(o,r,n,"aria-hidden")):function(){return null}};function Ki(e){const t=zi(e),n=i.forwardRef((o,r)=>{const{children:s,...a}=o,c=i.Children.toArray(s),l=c.find(Xi);if(l){const u=l.props.children,f=c.map(p=>p===l?i.Children.count(u)>1?i.Children.only(null):i.isValidElement(u)?u.props.children:null:p);return v.jsx(t,{...a,ref:r,children:i.isValidElement(u)?i.cloneElement(u,void 0,f):null})}return v.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}function zi(e){const t=i.forwardRef((n,o)=>{const{children:r,...s}=n;if(i.isValidElement(r)){const a=qi(r),c=Gi(s,r.props);return r.type!==i.Fragment&&(c.ref=o?$e(o,a):a),i.cloneElement(r,c)}return i.Children.count(r)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Yi=Symbol("radix.slottable");function Xi(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Yi}function Gi(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...c)=>{const l=s(...c);return r(...c),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function qi(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var gt="Dialog",[wo,Kl]=Oe(gt),[Zi,oe]=wo(gt),xo=e=>{const{__scopeDialog:t,children:n,open:o,defaultOpen:r,onOpenChange:s,modal:a=!0}=e,c=i.useRef(null),l=i.useRef(null),[u,f]=ke({prop:o,defaultProp:r??!1,onChange:s,caller:gt});return v.jsx(Zi,{scope:t,triggerRef:c,contentRef:l,contentId:Se(),titleId:Se(),descriptionId:Se(),open:u,onOpenChange:f,onOpenToggle:i.useCallback(()=>f(p=>!p),[f]),modal:a,children:n})};xo.displayName=gt;var Co="DialogTrigger",bo=i.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=oe(Co,n),s=B(t,r.triggerRef);return v.jsx(D.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":dn(r.open),...o,ref:s,onClick:N(e.onClick,r.onOpenToggle)})});bo.displayName=Co;var ln="DialogPortal",[Qi,Eo]=wo(ln,{forceMount:void 0}),So=e=>{const{__scopeDialog:t,forceMount:n,children:o,container:r}=e,s=oe(ln,t);return v.jsx(Qi,{scope:t,forceMount:n,children:i.Children.map(o,a=>v.jsx(ye,{present:n||s.open,children:v.jsx(Ge,{asChild:!0,container:r,children:a})}))})};So.displayName=ln;var ut="DialogOverlay",To=i.forwardRef((e,t)=>{const n=Eo(ut,e.__scopeDialog),{forceMount:o=n.forceMount,...r}=e,s=oe(ut,e.__scopeDialog);return s.modal?v.jsx(ye,{present:o||s.open,children:v.jsx(ea,{...r,ref:t})}):null});To.displayName=ut;var Ji=Ki("DialogOverlay.RemoveScroll"),ea=i.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=oe(ut,n);return v.jsx(cn,{as:Ji,allowPinchZoom:!0,shards:[r.contentRef],children:v.jsx(D.div,{"data-state":dn(r.open),...o,ref:t,style:{pointerEvents:"auto",...o.style}})})}),Te="DialogContent",Ro=i.forwardRef((e,t)=>{const n=Eo(Te,e.__scopeDialog),{forceMount:o=n.forceMount,...r}=e,s=oe(Te,e.__scopeDialog);return v.jsx(ye,{present:o||s.open,children:s.modal?v.jsx(ta,{...r,ref:t}):v.jsx(na,{...r,ref:t})})});Ro.displayName=Te;var ta=i.forwardRef((e,t)=>{const n=oe(Te,e.__scopeDialog),o=i.useRef(null),r=B(t,n.contentRef,o);return i.useEffect(()=>{const s=o.current;if(s)return yo(s)},[]),v.jsx(Po,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:N(e.onCloseAutoFocus,s=>{s.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:N(e.onPointerDownOutside,s=>{const a=s.detail.originalEvent,c=a.button===0&&a.ctrlKey===!0;(a.button===2||c)&&s.preventDefault()}),onFocusOutside:N(e.onFocusOutside,s=>s.preventDefault())})}),na=i.forwardRef((e,t)=>{const n=oe(Te,e.__scopeDialog),o=i.useRef(!1),r=i.useRef(!1);return v.jsx(Po,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{e.onCloseAutoFocus?.(s),s.defaultPrevented||(o.current||n.triggerRef.current?.focus(),s.preventDefault()),o.current=!1,r.current=!1},onInteractOutside:s=>{e.onInteractOutside?.(s),s.defaultPrevented||(o.current=!0,s.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const a=s.target;n.triggerRef.current?.contains(a)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&r.current&&s.preventDefault()}})}),Po=i.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:o,onOpenAutoFocus:r,onCloseAutoFocus:s,...a}=e,c=oe(Te,n),l=i.useRef(null),u=B(t,l);return co(),v.jsxs(v.Fragment,{children:[v.jsx(an,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:r,onUnmountAutoFocus:s,children:v.jsx(Xe,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":dn(c.open),...a,ref:u,onDismiss:()=>c.onOpenChange(!1)})}),v.jsxs(v.Fragment,{children:[v.jsx(oa,{titleId:c.titleId}),v.jsx(sa,{contentRef:l,descriptionId:c.descriptionId})]})]})}),un="DialogTitle",Ao=i.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=oe(un,n);return v.jsx(D.h2,{id:r.titleId,...o,ref:t})});Ao.displayName=un;var Oo="DialogDescription",Io=i.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=oe(Oo,n);return v.jsx(D.p,{id:r.descriptionId,...o,ref:t})});Io.displayName=Oo;var No="DialogClose",_o=i.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=oe(No,n);return v.jsx(D.button,{type:"button",...o,ref:t,onClick:N(e.onClick,()=>r.onOpenChange(!1))})});_o.displayName=No;function dn(e){return e?"open":"closed"}var Do="DialogTitleWarning",[zl,Mo]=fs(Do,{contentName:Te,titleName:un,docsSlug:"dialog"}),oa=({titleId:e})=>{const t=Mo(Do),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. + +If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. + +For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return i.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},ra="DialogDescriptionWarning",sa=({contentRef:e,descriptionId:t})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Mo(ra).contentName}}.`;return i.useEffect(()=>{const r=e.current?.getAttribute("aria-describedby");t&&r&&(document.getElementById(t)||console.warn(o))},[o,e,t]),null},Yl=xo,Xl=bo,Gl=So,ql=To,Zl=Ro,Ql=Ao,Jl=Io,eu=_o;function Lo(e){const t=i.useRef({value:e,previous:e});return i.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function ko(e){const[t,n]=i.useState(void 0);return z(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const s=r[0];let a,c;if("borderBoxSize"in s){const l=s.borderBoxSize,u=Array.isArray(l)?l[0]:l;a=u.inlineSize,c=u.blockSize}else a=e.offsetWidth,c=e.offsetHeight;n({width:a,height:c})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else n(void 0)},[e]),t}var yt="Checkbox",[ia]=Oe(yt),[aa,fn]=ia(yt);function ca(e){const{__scopeCheckbox:t,checked:n,children:o,defaultChecked:r,disabled:s,form:a,name:c,onCheckedChange:l,required:u,value:f="on",internal_do_not_use_render:p}=e,[y,h]=ke({prop:n,defaultProp:r??!1,onChange:l,caller:yt}),[x,d]=i.useState(null),[m,w]=i.useState(null),g=i.useRef(!1),C=x?!!a||!!x.closest("form"):!0,b={checked:y,disabled:s,setChecked:h,control:x,setControl:d,name:c,form:a,value:f,hasConsumerStoppedPropagationRef:g,required:u,defaultChecked:he(r)?!1:r,isFormControl:C,bubbleInput:m,setBubbleInput:w};return v.jsx(aa,{scope:t,...b,children:da(p)?p(b):o})}var jo="CheckboxTrigger",Fo=i.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...o},r)=>{const{control:s,value:a,disabled:c,checked:l,required:u,setControl:f,setChecked:p,hasConsumerStoppedPropagationRef:y,isFormControl:h,bubbleInput:x}=fn(jo,e),d=B(r,f),m=i.useRef(l);return i.useEffect(()=>{const w=s?.form;if(w){const g=()=>p(m.current);return w.addEventListener("reset",g),()=>w.removeEventListener("reset",g)}},[s,p]),v.jsx(D.button,{type:"button",role:"checkbox","aria-checked":he(l)?"mixed":l,"aria-required":u,"data-state":Vo(l),"data-disabled":c?"":void 0,disabled:c,value:a,...o,ref:d,onKeyDown:N(t,w=>{w.key==="Enter"&&w.preventDefault()}),onClick:N(n,w=>{p(g=>he(g)?!0:!g),x&&h&&(y.current=w.isPropagationStopped(),y.current||w.stopPropagation())})})});Fo.displayName=jo;var la=i.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:o,checked:r,defaultChecked:s,required:a,disabled:c,value:l,onCheckedChange:u,form:f,...p}=e;return v.jsx(ca,{__scopeCheckbox:n,checked:r,defaultChecked:s,disabled:c,required:a,onCheckedChange:u,name:o,form:f,value:l,internal_do_not_use_render:({isFormControl:y})=>v.jsxs(v.Fragment,{children:[v.jsx(Fo,{...p,ref:t,__scopeCheckbox:n}),y&&v.jsx(Bo,{__scopeCheckbox:n})]})})});la.displayName=yt;var $o="CheckboxIndicator",ua=i.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:o,...r}=e,s=fn($o,n);return v.jsx(ye,{present:o||he(s.checked)||s.checked===!0,children:v.jsx(D.span,{"data-state":Vo(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:t,style:{pointerEvents:"none",...e.style}})})});ua.displayName=$o;var Wo="CheckboxBubbleInput",Bo=i.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:o,hasConsumerStoppedPropagationRef:r,checked:s,defaultChecked:a,required:c,disabled:l,name:u,value:f,form:p,bubbleInput:y,setBubbleInput:h}=fn(Wo,e),x=B(n,h),d=Lo(s),m=ko(o);i.useEffect(()=>{const g=y;if(!g)return;const C=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(C,"checked").set,R=!r.current;if(d!==s&&E){const S=new Event("click",{bubbles:R});g.indeterminate=he(s),E.call(g,he(s)?!1:s),g.dispatchEvent(S)}},[y,d,s,r]);const w=i.useRef(he(s)?!1:s);return v.jsx(D.input,{type:"checkbox","aria-hidden":!0,defaultChecked:a??w.current,required:c,disabled:l,name:u,value:f,form:p,...t,tabIndex:-1,ref:x,style:{...t.style,...m,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Bo.displayName=Wo;function da(e){return typeof e=="function"}function he(e){return e==="indeterminate"}function Vo(e){return he(e)?"indeterminate":e?"checked":"unchecked"}const fa=["top","right","bottom","left"],ve=Math.min,G=Math.max,dt=Math.round,rt=Math.floor,ae=e=>({x:e,y:e}),pa={left:"right",right:"left",bottom:"top",top:"bottom"},ma={start:"end",end:"start"};function zt(e,t,n){return G(e,ve(t,n))}function fe(e,t){return typeof e=="function"?e(t):e}function pe(e){return e.split("-")[0]}function We(e){return e.split("-")[1]}function pn(e){return e==="x"?"y":"x"}function mn(e){return e==="y"?"height":"width"}const ha=new Set(["top","bottom"]);function ie(e){return ha.has(pe(e))?"y":"x"}function hn(e){return pn(ie(e))}function va(e,t,n){n===void 0&&(n=!1);const o=We(e),r=hn(e),s=mn(r);let a=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=ft(a)),[a,ft(a)]}function ga(e){const t=ft(e);return[Yt(e),t,Yt(t)]}function Yt(e){return e.replace(/start|end/g,t=>ma[t])}const Vn=["left","right"],Hn=["right","left"],ya=["top","bottom"],wa=["bottom","top"];function xa(e,t,n){switch(e){case"top":case"bottom":return n?t?Hn:Vn:t?Vn:Hn;case"left":case"right":return t?ya:wa;default:return[]}}function Ca(e,t,n,o){const r=We(e);let s=xa(pe(e),n==="start",o);return r&&(s=s.map(a=>a+"-"+r),t&&(s=s.concat(s.map(Yt)))),s}function ft(e){return e.replace(/left|right|bottom|top/g,t=>pa[t])}function ba(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ho(e){return typeof e!="number"?ba(e):{top:e,right:e,bottom:e,left:e}}function pt(e){const{x:t,y:n,width:o,height:r}=e;return{width:o,height:r,top:n,left:t,right:t+o,bottom:n+r,x:t,y:n}}function Un(e,t,n){let{reference:o,floating:r}=e;const s=ie(t),a=hn(t),c=mn(a),l=pe(t),u=s==="y",f=o.x+o.width/2-r.width/2,p=o.y+o.height/2-r.height/2,y=o[c]/2-r[c]/2;let h;switch(l){case"top":h={x:f,y:o.y-r.height};break;case"bottom":h={x:f,y:o.y+o.height};break;case"right":h={x:o.x+o.width,y:p};break;case"left":h={x:o.x-r.width,y:p};break;default:h={x:o.x,y:o.y}}switch(We(t)){case"start":h[a]-=y*(n&&u?-1:1);break;case"end":h[a]+=y*(n&&u?-1:1);break}return h}const Ea=async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:s=[],platform:a}=n,c=s.filter(Boolean),l=await(a.isRTL==null?void 0:a.isRTL(t));let u=await a.getElementRects({reference:e,floating:t,strategy:r}),{x:f,y:p}=Un(u,o,l),y=o,h={},x=0;for(let d=0;d({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:r,rects:s,platform:a,elements:c,middlewareData:l}=t,{element:u,padding:f=0}=fe(e,t)||{};if(u==null)return{};const p=Ho(f),y={x:n,y:o},h=hn(r),x=mn(h),d=await a.getDimensions(u),m=h==="y",w=m?"top":"left",g=m?"bottom":"right",C=m?"clientHeight":"clientWidth",b=s.reference[x]+s.reference[h]-y[h]-s.floating[x],E=y[h]-s.reference[h],R=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u));let S=R?R[C]:0;(!S||!await(a.isElement==null?void 0:a.isElement(R)))&&(S=c.floating[C]||s.floating[x]);const O=b/2-E/2,M=S/2-d[x]/2-1,L=ve(p[w],M),k=ve(p[g],M),$=L,F=S-d[x]-k,T=S/2-d[x]/2+O,j=zt($,T,F),I=!l.arrow&&We(r)!=null&&T!==j&&s.reference[x]/2-(T<$?L:k)-d[x]/2<0,_=I?T<$?T-$:T-F:0;return{[h]:y[h]+_,data:{[h]:j,centerOffset:T-j-_,...I&&{alignmentOffset:_}},reset:I}}}),Ta=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:r,middlewareData:s,rects:a,initialPlacement:c,platform:l,elements:u}=t,{mainAxis:f=!0,crossAxis:p=!0,fallbackPlacements:y,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:d=!0,...m}=fe(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const w=pe(r),g=ie(c),C=pe(c)===c,b=await(l.isRTL==null?void 0:l.isRTL(u.floating)),E=y||(C||!d?[ft(c)]:ga(c)),R=x!=="none";!y&&R&&E.push(...Ca(c,d,x,b));const S=[c,...E],O=await Ue(t,m),M=[];let L=((o=s.flip)==null?void 0:o.overflows)||[];if(f&&M.push(O[w]),p){const T=va(r,a,b);M.push(O[T[0]],O[T[1]])}if(L=[...L,{placement:r,overflows:M}],!M.every(T=>T<=0)){var k,$;const T=(((k=s.flip)==null?void 0:k.index)||0)+1,j=S[T];if(j&&(!(p==="alignment"?g!==ie(j):!1)||L.every(P=>ie(P.placement)===g?P.overflows[0]>0:!0)))return{data:{index:T,overflows:L},reset:{placement:j}};let I=($=L.filter(_=>_.overflows[0]<=0).sort((_,P)=>_.overflows[1]-P.overflows[1])[0])==null?void 0:$.placement;if(!I)switch(h){case"bestFit":{var F;const _=(F=L.filter(P=>{if(R){const W=ie(P.placement);return W===g||W==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(W=>W>0).reduce((W,Y)=>W+Y,0)]).sort((P,W)=>P[1]-W[1])[0])==null?void 0:F[0];_&&(I=_);break}case"initialPlacement":I=c;break}if(r!==I)return{reset:{placement:I}}}return{}}}};function Kn(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function zn(e){return fa.some(t=>e[t]>=0)}const Ra=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:o="referenceHidden",...r}=fe(e,t);switch(o){case"referenceHidden":{const s=await Ue(t,{...r,elementContext:"reference"}),a=Kn(s,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:zn(a)}}}case"escaped":{const s=await Ue(t,{...r,altBoundary:!0}),a=Kn(s,n.floating);return{data:{escapedOffsets:a,escaped:zn(a)}}}default:return{}}}}},Uo=new Set(["left","top"]);async function Pa(e,t){const{placement:n,platform:o,elements:r}=e,s=await(o.isRTL==null?void 0:o.isRTL(r.floating)),a=pe(n),c=We(n),l=ie(n)==="y",u=Uo.has(a)?-1:1,f=s&&l?-1:1,p=fe(t,e);let{mainAxis:y,crossAxis:h,alignmentAxis:x}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return c&&typeof x=="number"&&(h=c==="end"?x*-1:x),l?{x:h*f,y:y*u}:{x:y*u,y:h*f}}const Aa=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:r,y:s,placement:a,middlewareData:c}=t,l=await Pa(t,e);return a===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:r+l.x,y:s+l.y,data:{...l,placement:a}}}}},Oa=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r}=t,{mainAxis:s=!0,crossAxis:a=!1,limiter:c={fn:m=>{let{x:w,y:g}=m;return{x:w,y:g}}},...l}=fe(e,t),u={x:n,y:o},f=await Ue(t,l),p=ie(pe(r)),y=pn(p);let h=u[y],x=u[p];if(s){const m=y==="y"?"top":"left",w=y==="y"?"bottom":"right",g=h+f[m],C=h-f[w];h=zt(g,h,C)}if(a){const m=p==="y"?"top":"left",w=p==="y"?"bottom":"right",g=x+f[m],C=x-f[w];x=zt(g,x,C)}const d=c.fn({...t,[y]:h,[p]:x});return{...d,data:{x:d.x-n,y:d.y-o,enabled:{[y]:s,[p]:a}}}}}},Ia=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:o,placement:r,rects:s,middlewareData:a}=t,{offset:c=0,mainAxis:l=!0,crossAxis:u=!0}=fe(e,t),f={x:n,y:o},p=ie(r),y=pn(p);let h=f[y],x=f[p];const d=fe(c,t),m=typeof d=="number"?{mainAxis:d,crossAxis:0}:{mainAxis:0,crossAxis:0,...d};if(l){const C=y==="y"?"height":"width",b=s.reference[y]-s.floating[C]+m.mainAxis,E=s.reference[y]+s.reference[C]-m.mainAxis;hE&&(h=E)}if(u){var w,g;const C=y==="y"?"width":"height",b=Uo.has(pe(r)),E=s.reference[p]-s.floating[C]+(b&&((w=a.offset)==null?void 0:w[p])||0)+(b?0:m.crossAxis),R=s.reference[p]+s.reference[C]+(b?0:((g=a.offset)==null?void 0:g[p])||0)-(b?m.crossAxis:0);xR&&(x=R)}return{[y]:h,[p]:x}}}},Na=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:r,rects:s,platform:a,elements:c}=t,{apply:l=()=>{},...u}=fe(e,t),f=await Ue(t,u),p=pe(r),y=We(r),h=ie(r)==="y",{width:x,height:d}=s.floating;let m,w;p==="top"||p==="bottom"?(m=p,w=y===(await(a.isRTL==null?void 0:a.isRTL(c.floating))?"start":"end")?"left":"right"):(w=p,m=y==="end"?"top":"bottom");const g=d-f.top-f.bottom,C=x-f.left-f.right,b=ve(d-f[m],g),E=ve(x-f[w],C),R=!t.middlewareData.shift;let S=b,O=E;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(O=C),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(S=g),R&&!y){const L=G(f.left,0),k=G(f.right,0),$=G(f.top,0),F=G(f.bottom,0);h?O=x-2*(L!==0||k!==0?L+k:G(f.left,f.right)):S=d-2*($!==0||F!==0?$+F:G(f.top,f.bottom))}await l({...t,availableWidth:O,availableHeight:S});const M=await a.getDimensions(c.floating);return x!==M.width||d!==M.height?{reset:{rects:!0}}:{}}}};function wt(){return typeof window<"u"}function Be(e){return Ko(e)?(e.nodeName||"").toLowerCase():"#document"}function q(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function le(e){var t;return(t=(Ko(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Ko(e){return wt()?e instanceof Node||e instanceof q(e).Node:!1}function te(e){return wt()?e instanceof Element||e instanceof q(e).Element:!1}function ce(e){return wt()?e instanceof HTMLElement||e instanceof q(e).HTMLElement:!1}function Yn(e){return!wt()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof q(e).ShadowRoot}const _a=new Set(["inline","contents"]);function qe(e){const{overflow:t,overflowX:n,overflowY:o,display:r}=ne(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!_a.has(r)}const Da=new Set(["table","td","th"]);function Ma(e){return Da.has(Be(e))}const La=[":popover-open",":modal"];function xt(e){return La.some(t=>{try{return e.matches(t)}catch{return!1}})}const ka=["transform","translate","scale","rotate","perspective"],ja=["transform","translate","scale","rotate","perspective","filter"],Fa=["paint","layout","strict","content"];function vn(e){const t=gn(),n=te(e)?ne(e):e;return ka.some(o=>n[o]?n[o]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||ja.some(o=>(n.willChange||"").includes(o))||Fa.some(o=>(n.contain||"").includes(o))}function $a(e){let t=ge(e);for(;ce(t)&&!je(t);){if(vn(t))return t;if(xt(t))return null;t=ge(t)}return null}function gn(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Wa=new Set(["html","body","#document"]);function je(e){return Wa.has(Be(e))}function ne(e){return q(e).getComputedStyle(e)}function Ct(e){return te(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ge(e){if(Be(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Yn(e)&&e.host||le(e);return Yn(t)?t.host:t}function zo(e){const t=ge(e);return je(t)?e.ownerDocument?e.ownerDocument.body:e.body:ce(t)&&qe(t)?t:zo(t)}function Ke(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=zo(e),s=r===((o=e.ownerDocument)==null?void 0:o.body),a=q(r);if(s){const c=Xt(a);return t.concat(a,a.visualViewport||[],qe(r)?r:[],c&&n?Ke(c):[])}return t.concat(r,Ke(r,[],n))}function Xt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Yo(e){const t=ne(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=ce(e),s=r?e.offsetWidth:n,a=r?e.offsetHeight:o,c=dt(n)!==s||dt(o)!==a;return c&&(n=s,o=a),{width:n,height:o,$:c}}function yn(e){return te(e)?e:e.contextElement}function Le(e){const t=yn(e);if(!ce(t))return ae(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:s}=Yo(t);let a=(s?dt(n.width):n.width)/o,c=(s?dt(n.height):n.height)/r;return(!a||!Number.isFinite(a))&&(a=1),(!c||!Number.isFinite(c))&&(c=1),{x:a,y:c}}const Ba=ae(0);function Xo(e){const t=q(e);return!gn()||!t.visualViewport?Ba:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Va(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==q(e)?!1:t}function Re(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),s=yn(e);let a=ae(1);t&&(o?te(o)&&(a=Le(o)):a=Le(e));const c=Va(s,n,o)?Xo(s):ae(0);let l=(r.left+c.x)/a.x,u=(r.top+c.y)/a.y,f=r.width/a.x,p=r.height/a.y;if(s){const y=q(s),h=o&&te(o)?q(o):o;let x=y,d=Xt(x);for(;d&&o&&h!==x;){const m=Le(d),w=d.getBoundingClientRect(),g=ne(d),C=w.left+(d.clientLeft+parseFloat(g.paddingLeft))*m.x,b=w.top+(d.clientTop+parseFloat(g.paddingTop))*m.y;l*=m.x,u*=m.y,f*=m.x,p*=m.y,l+=C,u+=b,x=q(d),d=Xt(x)}}return pt({width:f,height:p,x:l,y:u})}function bt(e,t){const n=Ct(e).scrollLeft;return t?t.left+n:Re(le(e)).left+n}function Go(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-bt(e,n),r=n.top+t.scrollTop;return{x:o,y:r}}function Ha(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const s=r==="fixed",a=le(o),c=t?xt(t.floating):!1;if(o===a||c&&s)return n;let l={scrollLeft:0,scrollTop:0},u=ae(1);const f=ae(0),p=ce(o);if((p||!p&&!s)&&((Be(o)!=="body"||qe(a))&&(l=Ct(o)),ce(o))){const h=Re(o);u=Le(o),f.x=h.x+o.clientLeft,f.y=h.y+o.clientTop}const y=a&&!p&&!s?Go(a,l):ae(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+f.x+y.x,y:n.y*u.y-l.scrollTop*u.y+f.y+y.y}}function Ua(e){return Array.from(e.getClientRects())}function Ka(e){const t=le(e),n=Ct(e),o=e.ownerDocument.body,r=G(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),s=G(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let a=-n.scrollLeft+bt(e);const c=-n.scrollTop;return ne(o).direction==="rtl"&&(a+=G(t.clientWidth,o.clientWidth)-r),{width:r,height:s,x:a,y:c}}const Xn=25;function za(e,t){const n=q(e),o=le(e),r=n.visualViewport;let s=o.clientWidth,a=o.clientHeight,c=0,l=0;if(r){s=r.width,a=r.height;const f=gn();(!f||f&&t==="fixed")&&(c=r.offsetLeft,l=r.offsetTop)}const u=bt(o);if(u<=0){const f=o.ownerDocument,p=f.body,y=getComputedStyle(p),h=f.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,x=Math.abs(o.clientWidth-p.clientWidth-h);x<=Xn&&(s-=x)}else u<=Xn&&(s+=u);return{width:s,height:a,x:c,y:l}}const Ya=new Set(["absolute","fixed"]);function Xa(e,t){const n=Re(e,!0,t==="fixed"),o=n.top+e.clientTop,r=n.left+e.clientLeft,s=ce(e)?Le(e):ae(1),a=e.clientWidth*s.x,c=e.clientHeight*s.y,l=r*s.x,u=o*s.y;return{width:a,height:c,x:l,y:u}}function Gn(e,t,n){let o;if(t==="viewport")o=za(e,n);else if(t==="document")o=Ka(le(e));else if(te(t))o=Xa(t,n);else{const r=Xo(e);o={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return pt(o)}function qo(e,t){const n=ge(e);return n===t||!te(n)||je(n)?!1:ne(n).position==="fixed"||qo(n,t)}function Ga(e,t){const n=t.get(e);if(n)return n;let o=Ke(e,[],!1).filter(c=>te(c)&&Be(c)!=="body"),r=null;const s=ne(e).position==="fixed";let a=s?ge(e):e;for(;te(a)&&!je(a);){const c=ne(a),l=vn(a);!l&&c.position==="fixed"&&(r=null),(s?!l&&!r:!l&&c.position==="static"&&!!r&&Ya.has(r.position)||qe(a)&&!l&&qo(e,a))?o=o.filter(f=>f!==a):r=c,a=ge(a)}return t.set(e,o),o}function qa(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const a=[...n==="clippingAncestors"?xt(t)?[]:Ga(t,this._c):[].concat(n),o],c=a[0],l=a.reduce((u,f)=>{const p=Gn(t,f,r);return u.top=G(p.top,u.top),u.right=ve(p.right,u.right),u.bottom=ve(p.bottom,u.bottom),u.left=G(p.left,u.left),u},Gn(t,c,r));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function Za(e){const{width:t,height:n}=Yo(e);return{width:t,height:n}}function Qa(e,t,n){const o=ce(t),r=le(t),s=n==="fixed",a=Re(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const l=ae(0);function u(){l.x=bt(r)}if(o||!o&&!s)if((Be(t)!=="body"||qe(r))&&(c=Ct(t)),o){const h=Re(t,!0,s,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}else r&&u();s&&!o&&r&&u();const f=r&&!o&&!s?Go(r,c):ae(0),p=a.left+c.scrollLeft-l.x-f.x,y=a.top+c.scrollTop-l.y-f.y;return{x:p,y,width:a.width,height:a.height}}function Bt(e){return ne(e).position==="static"}function qn(e,t){if(!ce(e)||ne(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return le(e)===n&&(n=n.ownerDocument.body),n}function Zo(e,t){const n=q(e);if(xt(e))return n;if(!ce(e)){let r=ge(e);for(;r&&!je(r);){if(te(r)&&!Bt(r))return r;r=ge(r)}return n}let o=qn(e,t);for(;o&&Ma(o)&&Bt(o);)o=qn(o,t);return o&&je(o)&&Bt(o)&&!vn(o)?n:o||$a(e)||n}const Ja=async function(e){const t=this.getOffsetParent||Zo,n=this.getDimensions,o=await n(e.floating);return{reference:Qa(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function ec(e){return ne(e).direction==="rtl"}const tc={convertOffsetParentRelativeRectToViewportRelativeRect:Ha,getDocumentElement:le,getClippingRect:qa,getOffsetParent:Zo,getElementRects:Ja,getClientRects:Ua,getDimensions:Za,getScale:Le,isElement:te,isRTL:ec};function Qo(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function nc(e,t){let n=null,o;const r=le(e);function s(){var c;clearTimeout(o),(c=n)==null||c.disconnect(),n=null}function a(c,l){c===void 0&&(c=!1),l===void 0&&(l=1),s();const u=e.getBoundingClientRect(),{left:f,top:p,width:y,height:h}=u;if(c||t(),!y||!h)return;const x=rt(p),d=rt(r.clientWidth-(f+y)),m=rt(r.clientHeight-(p+h)),w=rt(f),C={rootMargin:-x+"px "+-d+"px "+-m+"px "+-w+"px",threshold:G(0,ve(1,l))||1};let b=!0;function E(R){const S=R[0].intersectionRatio;if(S!==l){if(!b)return a();S?a(!1,S):o=setTimeout(()=>{a(!1,1e-7)},1e3)}S===1&&!Qo(u,e.getBoundingClientRect())&&a(),b=!1}try{n=new IntersectionObserver(E,{...C,root:r.ownerDocument})}catch{n=new IntersectionObserver(E,C)}n.observe(e)}return a(!0),s}function oc(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=o,u=yn(e),f=r||s?[...u?Ke(u):[],...Ke(t)]:[];f.forEach(w=>{r&&w.addEventListener("scroll",n,{passive:!0}),s&&w.addEventListener("resize",n)});const p=u&&c?nc(u,n):null;let y=-1,h=null;a&&(h=new ResizeObserver(w=>{let[g]=w;g&&g.target===u&&h&&(h.unobserve(t),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var C;(C=h)==null||C.observe(t)})),n()}),u&&!l&&h.observe(u),h.observe(t));let x,d=l?Re(e):null;l&&m();function m(){const w=Re(e);d&&!Qo(d,w)&&n(),d=w,x=requestAnimationFrame(m)}return n(),()=>{var w;f.forEach(g=>{r&&g.removeEventListener("scroll",n),s&&g.removeEventListener("resize",n)}),p?.(),(w=h)==null||w.disconnect(),h=null,l&&cancelAnimationFrame(x)}}const rc=Aa,sc=Oa,ic=Ta,ac=Na,cc=Ra,Zn=Sa,lc=Ia,uc=(e,t,n)=>{const o=new Map,r={platform:tc,...n},s={...r.platform,_c:o};return Ea(e,t,{...r,platform:s})};var dc=typeof document<"u",fc=function(){},ct=dc?i.useLayoutEffect:fc;function mt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,o,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;o--!==0;)if(!mt(e[o],t[o]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,r[o]))return!1;for(o=n;o--!==0;){const s=r[o];if(!(s==="_owner"&&e.$$typeof)&&!mt(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Jo(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Qn(e,t){const n=Jo(e);return Math.round(t*n)/n}function Vt(e){const t=i.useRef(e);return ct(()=>{t.current=e}),t}function pc(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:s,floating:a}={},transform:c=!0,whileElementsMounted:l,open:u}=e,[f,p]=i.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[y,h]=i.useState(o);mt(y,o)||h(o);const[x,d]=i.useState(null),[m,w]=i.useState(null),g=i.useCallback(P=>{P!==R.current&&(R.current=P,d(P))},[]),C=i.useCallback(P=>{P!==S.current&&(S.current=P,w(P))},[]),b=s||x,E=a||m,R=i.useRef(null),S=i.useRef(null),O=i.useRef(f),M=l!=null,L=Vt(l),k=Vt(r),$=Vt(u),F=i.useCallback(()=>{if(!R.current||!S.current)return;const P={placement:t,strategy:n,middleware:y};k.current&&(P.platform=k.current),uc(R.current,S.current,P).then(W=>{const Y={...W,isPositioned:$.current!==!1};T.current&&!mt(O.current,Y)&&(O.current=Y,Ye.flushSync(()=>{p(Y)}))})},[y,t,n,k,$]);ct(()=>{u===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,p(P=>({...P,isPositioned:!1})))},[u]);const T=i.useRef(!1);ct(()=>(T.current=!0,()=>{T.current=!1}),[]),ct(()=>{if(b&&(R.current=b),E&&(S.current=E),b&&E){if(L.current)return L.current(b,E,F);F()}},[b,E,F,L,M]);const j=i.useMemo(()=>({reference:R,floating:S,setReference:g,setFloating:C}),[g,C]),I=i.useMemo(()=>({reference:b,floating:E}),[b,E]),_=i.useMemo(()=>{const P={position:n,left:0,top:0};if(!I.floating)return P;const W=Qn(I.floating,f.x),Y=Qn(I.floating,f.y);return c?{...P,transform:"translate("+W+"px, "+Y+"px)",...Jo(I.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:Y}},[n,c,I.floating,f.x,f.y]);return i.useMemo(()=>({...f,update:F,refs:j,elements:I,floatingStyles:_}),[f,F,j,I,_])}const mc=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:o,padding:r}=typeof e=="function"?e(n):e;return o&&t(o)?o.current!=null?Zn({element:o.current,padding:r}).fn(n):{}:o?Zn({element:o,padding:r}).fn(n):{}}}},hc=(e,t)=>({...rc(e),options:[e,t]}),vc=(e,t)=>({...sc(e),options:[e,t]}),gc=(e,t)=>({...lc(e),options:[e,t]}),yc=(e,t)=>({...ic(e),options:[e,t]}),wc=(e,t)=>({...ac(e),options:[e,t]}),xc=(e,t)=>({...cc(e),options:[e,t]}),Cc=(e,t)=>({...mc(e),options:[e,t]});var bc="Arrow",er=i.forwardRef((e,t)=>{const{children:n,width:o=10,height:r=5,...s}=e;return v.jsx(D.svg,{...s,ref:t,width:o,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:v.jsx("polygon",{points:"0,0 30,0 15,10"})})});er.displayName=bc;var Ec=er,wn="Popper",[tr,Et]=Oe(wn),[Sc,nr]=tr(wn),or=e=>{const{__scopePopper:t,children:n}=e,[o,r]=i.useState(null);return v.jsx(Sc,{scope:t,anchor:o,onAnchorChange:r,children:n})};or.displayName=wn;var rr="PopperAnchor",sr=i.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:o,...r}=e,s=nr(rr,n),a=i.useRef(null),c=B(t,a),l=i.useRef(null);return i.useEffect(()=>{const u=l.current;l.current=o?.current||a.current,u!==l.current&&s.onAnchorChange(l.current)}),o?null:v.jsx(D.div,{...r,ref:c})});sr.displayName=rr;var xn="PopperContent",[Tc,Rc]=tr(xn),ir=i.forwardRef((e,t)=>{const{__scopePopper:n,side:o="bottom",sideOffset:r=0,align:s="center",alignOffset:a=0,arrowPadding:c=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:f=0,sticky:p="partial",hideWhenDetached:y=!1,updatePositionStrategy:h="optimized",onPlaced:x,...d}=e,m=nr(xn,n),[w,g]=i.useState(null),C=B(t,A=>g(A)),[b,E]=i.useState(null),R=ko(b),S=R?.width??0,O=R?.height??0,M=o+(s!=="center"?"-"+s:""),L=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},k=Array.isArray(u)?u:[u],$=k.length>0,F={padding:L,boundary:k.filter(Ac),altBoundary:$},{refs:T,floatingStyles:j,placement:I,isPositioned:_,middlewareData:P}=pc({strategy:"fixed",placement:M,whileElementsMounted:(...A)=>oc(...A,{animationFrame:h==="always"}),elements:{reference:m.anchor},middleware:[hc({mainAxis:r+O,alignmentAxis:a}),l&&vc({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?gc():void 0,...F}),l&&yc({...F}),wc({...F,apply:({elements:A,rects:U,availableWidth:X,availableHeight:V})=>{const{width:H,height:K}=U.reference,Z=A.floating.style;Z.setProperty("--radix-popper-available-width",`${X}px`),Z.setProperty("--radix-popper-available-height",`${V}px`),Z.setProperty("--radix-popper-anchor-width",`${H}px`),Z.setProperty("--radix-popper-anchor-height",`${K}px`)}}),b&&Cc({element:b,padding:c}),Oc({arrowWidth:S,arrowHeight:O}),y&&xc({strategy:"referenceHidden",...F})]}),[W,Y]=lr(I),ue=ee(x);z(()=>{_&&ue?.()},[_,ue]);const de=P.arrow?.x,re=P.arrow?.y,Q=P.arrow?.centerOffset!==0,[Ie,Ce]=i.useState();return z(()=>{w&&Ce(window.getComputedStyle(w).zIndex)},[w]),v.jsx("div",{ref:T.setFloating,"data-radix-popper-content-wrapper":"",style:{...j,transform:_?j.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Ie,"--radix-popper-transform-origin":[P.transformOrigin?.x,P.transformOrigin?.y].join(" "),...P.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:v.jsx(Tc,{scope:n,placedSide:W,onArrowChange:E,arrowX:de,arrowY:re,shouldHideArrow:Q,children:v.jsx(D.div,{"data-side":W,"data-align":Y,...d,ref:C,style:{...d.style,animation:_?void 0:"none"}})})})});ir.displayName=xn;var ar="PopperArrow",Pc={top:"bottom",right:"left",bottom:"top",left:"right"},cr=i.forwardRef(function(t,n){const{__scopePopper:o,...r}=t,s=Rc(ar,o),a=Pc[s.placedSide];return v.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:v.jsx(Ec,{...r,ref:n,style:{...r.style,display:"block"}})})});cr.displayName=ar;function Ac(e){return e!==null}var Oc=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:o,middlewareData:r}=t,a=r.arrow?.centerOffset!==0,c=a?0:e.arrowWidth,l=a?0:e.arrowHeight,[u,f]=lr(n),p={start:"0%",center:"50%",end:"100%"}[f],y=(r.arrow?.x??0)+c/2,h=(r.arrow?.y??0)+l/2;let x="",d="";return u==="bottom"?(x=a?p:`${y}px`,d=`${-l}px`):u==="top"?(x=a?p:`${y}px`,d=`${o.floating.height+l}px`):u==="right"?(x=`${-l}px`,d=a?p:`${h}px`):u==="left"&&(x=`${o.floating.width+l}px`,d=a?p:`${h}px`),{data:{x,y:d}}}});function lr(e){const[t,n="center"]=e.split("-");return[t,n]}var ur=or,dr=sr,fr=ir,pr=cr;function Ic(e){const t=Nc(e),n=i.forwardRef((o,r)=>{const{children:s,...a}=o,c=i.Children.toArray(s),l=c.find(Dc);if(l){const u=l.props.children,f=c.map(p=>p===l?i.Children.count(u)>1?i.Children.only(null):i.isValidElement(u)?u.props.children:null:p);return v.jsx(t,{...a,ref:r,children:i.isValidElement(u)?i.cloneElement(u,void 0,f):null})}return v.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}function Nc(e){const t=i.forwardRef((n,o)=>{const{children:r,...s}=n;if(i.isValidElement(r)){const a=Lc(r),c=Mc(s,r.props);return r.type!==i.Fragment&&(c.ref=o?$e(o,a):a),i.cloneElement(r,c)}return i.Children.count(r)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var _c=Symbol("radix.slottable");function Dc(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===_c}function Mc(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...c)=>{const l=s(...c);return r(...c),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function Lc(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var mr=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),kc="VisuallyHidden",St=i.forwardRef((e,t)=>v.jsx(D.span,{...e,ref:t,style:{...mr,...e.style}}));St.displayName=kc;var jc=St,Fc=[" ","Enter","ArrowUp","ArrowDown"],$c=[" ","Enter"],Pe="Select",[Tt,Rt,Wc]=eo(Pe),[Ve]=Oe(Pe,[Wc,Et]),Pt=Et(),[Bc,we]=Ve(Pe),[Vc,Hc]=Ve(Pe),hr=e=>{const{__scopeSelect:t,children:n,open:o,defaultOpen:r,onOpenChange:s,value:a,defaultValue:c,onValueChange:l,dir:u,name:f,autoComplete:p,disabled:y,required:h,form:x}=e,d=Pt(t),[m,w]=i.useState(null),[g,C]=i.useState(null),[b,E]=i.useState(!1),R=_s(u),[S,O]=ke({prop:o,defaultProp:r??!1,onChange:s,caller:Pe}),[M,L]=ke({prop:a,defaultProp:c,onChange:l,caller:Pe}),k=i.useRef(null),$=m?x||!!m.closest("form"):!0,[F,T]=i.useState(new Set),j=Array.from(F).map(I=>I.props.value).join(";");return v.jsx(ur,{...d,children:v.jsxs(Bc,{required:h,scope:t,trigger:m,onTriggerChange:w,valueNode:g,onValueNodeChange:C,valueNodeHasChildren:b,onValueNodeHasChildrenChange:E,contentId:Se(),value:M,onValueChange:L,open:S,onOpenChange:O,dir:R,triggerPointerDownPosRef:k,disabled:y,children:[v.jsx(Tt.Provider,{scope:t,children:v.jsx(Vc,{scope:e.__scopeSelect,onNativeOptionAdd:i.useCallback(I=>{T(_=>new Set(_).add(I))},[]),onNativeOptionRemove:i.useCallback(I=>{T(_=>{const P=new Set(_);return P.delete(I),P})},[]),children:n})}),$?v.jsxs($r,{"aria-hidden":!0,required:h,tabIndex:-1,name:f,autoComplete:p,value:M,onChange:I=>L(I.target.value),disabled:y,form:x,children:[M===void 0?v.jsx("option",{value:""}):null,Array.from(F)]},j):null]})})};hr.displayName=Pe;var vr="SelectTrigger",gr=i.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:o=!1,...r}=e,s=Pt(n),a=we(vr,n),c=a.disabled||o,l=B(t,a.onTriggerChange),u=Rt(n),f=i.useRef("touch"),[p,y,h]=Br(d=>{const m=u().filter(C=>!C.disabled),w=m.find(C=>C.value===a.value),g=Vr(m,d,w);g!==void 0&&a.onValueChange(g.value)}),x=d=>{c||(a.onOpenChange(!0),h()),d&&(a.triggerPointerDownPosRef.current={x:Math.round(d.pageX),y:Math.round(d.pageY)})};return v.jsx(dr,{asChild:!0,...s,children:v.jsx(D.button,{type:"button",role:"combobox","aria-controls":a.contentId,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":Wr(a.value)?"":void 0,...r,ref:l,onClick:N(r.onClick,d=>{d.currentTarget.focus(),f.current!=="mouse"&&x(d)}),onPointerDown:N(r.onPointerDown,d=>{f.current=d.pointerType;const m=d.target;m.hasPointerCapture(d.pointerId)&&m.releasePointerCapture(d.pointerId),d.button===0&&d.ctrlKey===!1&&d.pointerType==="mouse"&&(x(d),d.preventDefault())}),onKeyDown:N(r.onKeyDown,d=>{const m=p.current!=="";!(d.ctrlKey||d.altKey||d.metaKey)&&d.key.length===1&&y(d.key),!(m&&d.key===" ")&&Fc.includes(d.key)&&(x(),d.preventDefault())})})})});gr.displayName=vr;var yr="SelectValue",wr=i.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:r,children:s,placeholder:a="",...c}=e,l=we(yr,n),{onValueNodeHasChildrenChange:u}=l,f=s!==void 0,p=B(t,l.onValueNodeChange);return z(()=>{u(f)},[u,f]),v.jsx(D.span,{...c,ref:p,style:{pointerEvents:"none"},children:Wr(l.value)?v.jsx(v.Fragment,{children:a}):s})});wr.displayName=yr;var Uc="SelectIcon",xr=i.forwardRef((e,t)=>{const{__scopeSelect:n,children:o,...r}=e;return v.jsx(D.span,{"aria-hidden":!0,...r,ref:t,children:o||"▼"})});xr.displayName=Uc;var Kc="SelectPortal",Cr=e=>v.jsx(Ge,{asChild:!0,...e});Cr.displayName=Kc;var Ae="SelectContent",br=i.forwardRef((e,t)=>{const n=we(Ae,e.__scopeSelect),[o,r]=i.useState();if(z(()=>{r(new DocumentFragment)},[]),!n.open){const s=o;return s?Ye.createPortal(v.jsx(Er,{scope:e.__scopeSelect,children:v.jsx(Tt.Slot,{scope:e.__scopeSelect,children:v.jsx("div",{children:e.children})})}),s):null}return v.jsx(Sr,{...e,ref:t})});br.displayName=Ae;var J=10,[Er,xe]=Ve(Ae),zc="SelectContentImpl",Yc=Ic("SelectContent.RemoveScroll"),Sr=i.forwardRef((e,t)=>{const{__scopeSelect:n,position:o="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:s,onPointerDownOutside:a,side:c,sideOffset:l,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:y,collisionPadding:h,sticky:x,hideWhenDetached:d,avoidCollisions:m,...w}=e,g=we(Ae,n),[C,b]=i.useState(null),[E,R]=i.useState(null),S=B(t,A=>b(A)),[O,M]=i.useState(null),[L,k]=i.useState(null),$=Rt(n),[F,T]=i.useState(!1),j=i.useRef(!1);i.useEffect(()=>{if(C)return yo(C)},[C]),co();const I=i.useCallback(A=>{const[U,...X]=$().map(K=>K.ref.current),[V]=X.slice(-1),H=document.activeElement;for(const K of A)if(K===H||(K?.scrollIntoView({block:"nearest"}),K===U&&E&&(E.scrollTop=0),K===V&&E&&(E.scrollTop=E.scrollHeight),K?.focus(),document.activeElement!==H))return},[$,E]),_=i.useCallback(()=>I([O,C]),[I,O,C]);i.useEffect(()=>{F&&_()},[F,_]);const{onOpenChange:P,triggerPointerDownPosRef:W}=g;i.useEffect(()=>{if(C){let A={x:0,y:0};const U=V=>{A={x:Math.abs(Math.round(V.pageX)-(W.current?.x??0)),y:Math.abs(Math.round(V.pageY)-(W.current?.y??0))}},X=V=>{A.x<=10&&A.y<=10?V.preventDefault():C.contains(V.target)||P(!1),document.removeEventListener("pointermove",U),W.current=null};return W.current!==null&&(document.addEventListener("pointermove",U),document.addEventListener("pointerup",X,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",U),document.removeEventListener("pointerup",X,{capture:!0})}}},[C,P,W]),i.useEffect(()=>{const A=()=>P(!1);return window.addEventListener("blur",A),window.addEventListener("resize",A),()=>{window.removeEventListener("blur",A),window.removeEventListener("resize",A)}},[P]);const[Y,ue]=Br(A=>{const U=$().filter(H=>!H.disabled),X=U.find(H=>H.ref.current===document.activeElement),V=Vr(U,A,X);V&&setTimeout(()=>V.ref.current.focus())}),de=i.useCallback((A,U,X)=>{const V=!j.current&&!X;(g.value!==void 0&&g.value===U||V)&&(M(A),V&&(j.current=!0))},[g.value]),re=i.useCallback(()=>C?.focus(),[C]),Q=i.useCallback((A,U,X)=>{const V=!j.current&&!X;(g.value!==void 0&&g.value===U||V)&&k(A)},[g.value]),Ie=o==="popper"?Gt:Tr,Ce=Ie===Gt?{side:c,sideOffset:l,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:y,collisionPadding:h,sticky:x,hideWhenDetached:d,avoidCollisions:m}:{};return v.jsx(Er,{scope:n,content:C,viewport:E,onViewportChange:R,itemRefCallback:de,selectedItem:O,onItemLeave:re,itemTextRefCallback:Q,focusSelectedItem:_,selectedItemText:L,position:o,isPositioned:F,searchRef:Y,children:v.jsx(cn,{as:Yc,allowPinchZoom:!0,children:v.jsx(an,{asChild:!0,trapped:g.open,onMountAutoFocus:A=>{A.preventDefault()},onUnmountAutoFocus:N(r,A=>{g.trigger?.focus({preventScroll:!0}),A.preventDefault()}),children:v.jsx(Xe,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:A=>A.preventDefault(),onDismiss:()=>g.onOpenChange(!1),children:v.jsx(Ie,{role:"listbox",id:g.contentId,"data-state":g.open?"open":"closed",dir:g.dir,onContextMenu:A=>A.preventDefault(),...w,...Ce,onPlaced:()=>T(!0),ref:S,style:{display:"flex",flexDirection:"column",outline:"none",...w.style},onKeyDown:N(w.onKeyDown,A=>{const U=A.ctrlKey||A.altKey||A.metaKey;if(A.key==="Tab"&&A.preventDefault(),!U&&A.key.length===1&&ue(A.key),["ArrowUp","ArrowDown","Home","End"].includes(A.key)){let V=$().filter(H=>!H.disabled).map(H=>H.ref.current);if(["ArrowUp","End"].includes(A.key)&&(V=V.slice().reverse()),["ArrowUp","ArrowDown"].includes(A.key)){const H=A.target,K=V.indexOf(H);V=V.slice(K+1)}setTimeout(()=>I(V)),A.preventDefault()}})})})})})})});Sr.displayName=zc;var Xc="SelectItemAlignedPosition",Tr=i.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:o,...r}=e,s=we(Ae,n),a=xe(Ae,n),[c,l]=i.useState(null),[u,f]=i.useState(null),p=B(t,S=>f(S)),y=Rt(n),h=i.useRef(!1),x=i.useRef(!0),{viewport:d,selectedItem:m,selectedItemText:w,focusSelectedItem:g}=a,C=i.useCallback(()=>{if(s.trigger&&s.valueNode&&c&&u&&d&&m&&w){const S=s.trigger.getBoundingClientRect(),O=u.getBoundingClientRect(),M=s.valueNode.getBoundingClientRect(),L=w.getBoundingClientRect();if(s.dir!=="rtl"){const H=L.left-O.left,K=M.left-H,Z=S.left-K,be=S.width+Z,Nt=Math.max(be,O.width),_t=window.innerWidth-J,Dt=On(K,[J,Math.max(J,_t-Nt)]);c.style.minWidth=be+"px",c.style.left=Dt+"px"}else{const H=O.right-L.right,K=window.innerWidth-M.right-H,Z=window.innerWidth-S.right-K,be=S.width+Z,Nt=Math.max(be,O.width),_t=window.innerWidth-J,Dt=On(K,[J,Math.max(J,_t-Nt)]);c.style.minWidth=be+"px",c.style.right=Dt+"px"}const k=y(),$=window.innerHeight-J*2,F=d.scrollHeight,T=window.getComputedStyle(u),j=parseInt(T.borderTopWidth,10),I=parseInt(T.paddingTop,10),_=parseInt(T.borderBottomWidth,10),P=parseInt(T.paddingBottom,10),W=j+I+F+P+_,Y=Math.min(m.offsetHeight*5,W),ue=window.getComputedStyle(d),de=parseInt(ue.paddingTop,10),re=parseInt(ue.paddingBottom,10),Q=S.top+S.height/2-J,Ie=$-Q,Ce=m.offsetHeight/2,A=m.offsetTop+Ce,U=j+I+A,X=W-U;if(U<=Q){const H=k.length>0&&m===k[k.length-1].ref.current;c.style.bottom="0px";const K=u.clientHeight-d.offsetTop-d.offsetHeight,Z=Math.max(Ie,Ce+(H?re:0)+K+_),be=U+Z;c.style.height=be+"px"}else{const H=k.length>0&&m===k[0].ref.current;c.style.top="0px";const Z=Math.max(Q,j+d.offsetTop+(H?de:0)+Ce)+X;c.style.height=Z+"px",d.scrollTop=U-Q+d.offsetTop}c.style.margin=`${J}px 0`,c.style.minHeight=Y+"px",c.style.maxHeight=$+"px",o?.(),requestAnimationFrame(()=>h.current=!0)}},[y,s.trigger,s.valueNode,c,u,d,m,w,s.dir,o]);z(()=>C(),[C]);const[b,E]=i.useState();z(()=>{u&&E(window.getComputedStyle(u).zIndex)},[u]);const R=i.useCallback(S=>{S&&x.current===!0&&(C(),g?.(),x.current=!1)},[C,g]);return v.jsx(qc,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:h,onScrollButtonChange:R,children:v.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:b},children:v.jsx(D.div,{...r,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});Tr.displayName=Xc;var Gc="SelectPopperPosition",Gt=i.forwardRef((e,t)=>{const{__scopeSelect:n,align:o="start",collisionPadding:r=J,...s}=e,a=Pt(n);return v.jsx(fr,{...a,...s,ref:t,align:o,collisionPadding:r,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Gt.displayName=Gc;var[qc,Cn]=Ve(Ae,{}),qt="SelectViewport",Rr=i.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:o,...r}=e,s=xe(qt,n),a=Cn(qt,n),c=B(t,s.onViewportChange),l=i.useRef(0);return v.jsxs(v.Fragment,{children:[v.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),v.jsx(Tt.Slot,{scope:n,children:v.jsx(D.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:N(r.onScroll,u=>{const f=u.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:y}=a;if(y?.current&&p){const h=Math.abs(l.current-f.scrollTop);if(h>0){const x=window.innerHeight-J*2,d=parseFloat(p.style.minHeight),m=parseFloat(p.style.height),w=Math.max(d,m);if(w0?b:0,p.style.justifyContent="flex-end")}}}l.current=f.scrollTop})})})]})});Rr.displayName=qt;var Pr="SelectGroup",[Zc,Qc]=Ve(Pr),Jc=i.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,r=Se();return v.jsx(Zc,{scope:n,id:r,children:v.jsx(D.div,{role:"group","aria-labelledby":r,...o,ref:t})})});Jc.displayName=Pr;var Ar="SelectLabel",Or=i.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,r=Qc(Ar,n);return v.jsx(D.div,{id:r.id,...o,ref:t})});Or.displayName=Ar;var ht="SelectItem",[el,Ir]=Ve(ht),Nr=i.forwardRef((e,t)=>{const{__scopeSelect:n,value:o,disabled:r=!1,textValue:s,...a}=e,c=we(ht,n),l=xe(ht,n),u=c.value===o,[f,p]=i.useState(s??""),[y,h]=i.useState(!1),x=B(t,g=>l.itemRefCallback?.(g,o,r)),d=Se(),m=i.useRef("touch"),w=()=>{r||(c.onValueChange(o),c.onOpenChange(!1))};if(o==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return v.jsx(el,{scope:n,value:o,disabled:r,textId:d,isSelected:u,onItemTextChange:i.useCallback(g=>{p(C=>C||(g?.textContent??"").trim())},[]),children:v.jsx(Tt.ItemSlot,{scope:n,value:o,disabled:r,textValue:f,children:v.jsx(D.div,{role:"option","aria-labelledby":d,"data-highlighted":y?"":void 0,"aria-selected":u&&y,"data-state":u?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...a,ref:x,onFocus:N(a.onFocus,()=>h(!0)),onBlur:N(a.onBlur,()=>h(!1)),onClick:N(a.onClick,()=>{m.current!=="mouse"&&w()}),onPointerUp:N(a.onPointerUp,()=>{m.current==="mouse"&&w()}),onPointerDown:N(a.onPointerDown,g=>{m.current=g.pointerType}),onPointerMove:N(a.onPointerMove,g=>{m.current=g.pointerType,r?l.onItemLeave?.():m.current==="mouse"&&g.currentTarget.focus({preventScroll:!0})}),onPointerLeave:N(a.onPointerLeave,g=>{g.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:N(a.onKeyDown,g=>{l.searchRef?.current!==""&&g.key===" "||($c.includes(g.key)&&w(),g.key===" "&&g.preventDefault())})})})})});Nr.displayName=ht;var He="SelectItemText",_r=i.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:r,...s}=e,a=we(He,n),c=xe(He,n),l=Ir(He,n),u=Hc(He,n),[f,p]=i.useState(null),y=B(t,w=>p(w),l.onItemTextChange,w=>c.itemTextRefCallback?.(w,l.value,l.disabled)),h=f?.textContent,x=i.useMemo(()=>v.jsx("option",{value:l.value,disabled:l.disabled,children:h},l.value),[l.disabled,l.value,h]),{onNativeOptionAdd:d,onNativeOptionRemove:m}=u;return z(()=>(d(x),()=>m(x)),[d,m,x]),v.jsxs(v.Fragment,{children:[v.jsx(D.span,{id:l.textId,...s,ref:y}),l.isSelected&&a.valueNode&&!a.valueNodeHasChildren?Ye.createPortal(s.children,a.valueNode):null]})});_r.displayName=He;var Dr="SelectItemIndicator",Mr=i.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return Ir(Dr,n).isSelected?v.jsx(D.span,{"aria-hidden":!0,...o,ref:t}):null});Mr.displayName=Dr;var Zt="SelectScrollUpButton",Lr=i.forwardRef((e,t)=>{const n=xe(Zt,e.__scopeSelect),o=Cn(Zt,e.__scopeSelect),[r,s]=i.useState(!1),a=B(t,o.onScrollButtonChange);return z(()=>{if(n.viewport&&n.isPositioned){let c=function(){const u=l.scrollTop>0;s(u)};const l=n.viewport;return c(),l.addEventListener("scroll",c),()=>l.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),r?v.jsx(jr,{...e,ref:a,onAutoScroll:()=>{const{viewport:c,selectedItem:l}=n;c&&l&&(c.scrollTop=c.scrollTop-l.offsetHeight)}}):null});Lr.displayName=Zt;var Qt="SelectScrollDownButton",kr=i.forwardRef((e,t)=>{const n=xe(Qt,e.__scopeSelect),o=Cn(Qt,e.__scopeSelect),[r,s]=i.useState(!1),a=B(t,o.onScrollButtonChange);return z(()=>{if(n.viewport&&n.isPositioned){let c=function(){const u=l.scrollHeight-l.clientHeight,f=Math.ceil(l.scrollTop)l.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),r?v.jsx(jr,{...e,ref:a,onAutoScroll:()=>{const{viewport:c,selectedItem:l}=n;c&&l&&(c.scrollTop=c.scrollTop+l.offsetHeight)}}):null});kr.displayName=Qt;var jr=i.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:o,...r}=e,s=xe("SelectScrollButton",n),a=i.useRef(null),c=Rt(n),l=i.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return i.useEffect(()=>()=>l(),[l]),z(()=>{c().find(f=>f.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[c]),v.jsx(D.div,{"aria-hidden":!0,...r,ref:t,style:{flexShrink:0,...r.style},onPointerDown:N(r.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(o,50))}),onPointerMove:N(r.onPointerMove,()=>{s.onItemLeave?.(),a.current===null&&(a.current=window.setInterval(o,50))}),onPointerLeave:N(r.onPointerLeave,()=>{l()})})}),tl="SelectSeparator",Fr=i.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return v.jsx(D.div,{"aria-hidden":!0,...o,ref:t})});Fr.displayName=tl;var Jt="SelectArrow",nl=i.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,r=Pt(n),s=we(Jt,n),a=xe(Jt,n);return s.open&&a.position==="popper"?v.jsx(pr,{...r,...o,ref:t}):null});nl.displayName=Jt;var ol="SelectBubbleInput",$r=i.forwardRef(({__scopeSelect:e,value:t,...n},o)=>{const r=i.useRef(null),s=B(o,r),a=Lo(t);return i.useEffect(()=>{const c=r.current;if(!c)return;const l=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(l,"value").set;if(a!==t&&f){const p=new Event("change",{bubbles:!0});f.call(c,t),c.dispatchEvent(p)}},[a,t]),v.jsx(D.select,{...n,style:{...mr,...n.style},ref:s,defaultValue:t})});$r.displayName=ol;function Wr(e){return e===""||e===void 0}function Br(e){const t=ee(e),n=i.useRef(""),o=i.useRef(0),r=i.useCallback(a=>{const c=n.current+a;t(c),(function l(u){n.current=u,window.clearTimeout(o.current),u!==""&&(o.current=window.setTimeout(()=>l(""),1e3))})(c)},[t]),s=i.useCallback(()=>{n.current="",window.clearTimeout(o.current)},[]);return i.useEffect(()=>()=>window.clearTimeout(o.current),[]),[n,r,s]}function Vr(e,t,n){const r=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let a=rl(e,Math.max(s,0));r.length===1&&(a=a.filter(u=>u!==n));const l=a.find(u=>u.textValue.toLowerCase().startsWith(r.toLowerCase()));return l!==n?l:void 0}function rl(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var tu=hr,nu=gr,ou=wr,ru=xr,su=Cr,iu=br,au=Rr,cu=Or,lu=Nr,uu=_r,du=Mr,fu=Lr,pu=kr,mu=Fr,sl=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],il=sl.reduce((e,t)=>{const n=oo(`Primitive.${t}`),o=i.forwardRef((r,s)=>{const{asChild:a,...c}=r,l=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),v.jsx(l,{...c,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{}),al="Label",Hr=i.forwardRef((e,t)=>v.jsx(il.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Hr.displayName=al;var hu=Hr,cl=Symbol("radix.slottable");function ll(e){const t=({children:n})=>v.jsx(v.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=cl,t}var[At]=Oe("Tooltip",[Et]),Ot=Et(),Ur="TooltipProvider",ul=700,en="tooltip.open",[dl,bn]=At(Ur),Kr=e=>{const{__scopeTooltip:t,delayDuration:n=ul,skipDelayDuration:o=300,disableHoverableContent:r=!1,children:s}=e,a=i.useRef(!0),c=i.useRef(!1),l=i.useRef(0);return i.useEffect(()=>{const u=l.current;return()=>window.clearTimeout(u)},[]),v.jsx(dl,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:i.useCallback(()=>{window.clearTimeout(l.current),a.current=!1},[]),onClose:i.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>a.current=!0,o)},[o]),isPointerInTransitRef:c,onPointerInTransitChange:i.useCallback(u=>{c.current=u},[]),disableHoverableContent:r,children:s})};Kr.displayName=Ur;var ze="Tooltip",[fl,Ze]=At(ze),zr=e=>{const{__scopeTooltip:t,children:n,open:o,defaultOpen:r,onOpenChange:s,disableHoverableContent:a,delayDuration:c}=e,l=bn(ze,e.__scopeTooltip),u=Ot(t),[f,p]=i.useState(null),y=Se(),h=i.useRef(0),x=a??l.disableHoverableContent,d=c??l.delayDuration,m=i.useRef(!1),[w,g]=ke({prop:o,defaultProp:r??!1,onChange:S=>{S?(l.onOpen(),document.dispatchEvent(new CustomEvent(en))):l.onClose(),s?.(S)},caller:ze}),C=i.useMemo(()=>w?m.current?"delayed-open":"instant-open":"closed",[w]),b=i.useCallback(()=>{window.clearTimeout(h.current),h.current=0,m.current=!1,g(!0)},[g]),E=i.useCallback(()=>{window.clearTimeout(h.current),h.current=0,g(!1)},[g]),R=i.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{m.current=!0,g(!0),h.current=0},d)},[d,g]);return i.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),v.jsx(ur,{...u,children:v.jsx(fl,{scope:t,contentId:y,open:w,stateAttribute:C,trigger:f,onTriggerChange:p,onTriggerEnter:i.useCallback(()=>{l.isOpenDelayedRef.current?R():b()},[l.isOpenDelayedRef,R,b]),onTriggerLeave:i.useCallback(()=>{x?E():(window.clearTimeout(h.current),h.current=0)},[E,x]),onOpen:b,onClose:E,disableHoverableContent:x,children:n})})};zr.displayName=ze;var tn="TooltipTrigger",Yr=i.forwardRef((e,t)=>{const{__scopeTooltip:n,...o}=e,r=Ze(tn,n),s=bn(tn,n),a=Ot(n),c=i.useRef(null),l=B(t,c,r.onTriggerChange),u=i.useRef(!1),f=i.useRef(!1),p=i.useCallback(()=>u.current=!1,[]);return i.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),v.jsx(dr,{asChild:!0,...a,children:v.jsx(D.button,{"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute,...o,ref:l,onPointerMove:N(e.onPointerMove,y=>{y.pointerType!=="touch"&&!f.current&&!s.isPointerInTransitRef.current&&(r.onTriggerEnter(),f.current=!0)}),onPointerLeave:N(e.onPointerLeave,()=>{r.onTriggerLeave(),f.current=!1}),onPointerDown:N(e.onPointerDown,()=>{r.open&&r.onClose(),u.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:N(e.onFocus,()=>{u.current||r.onOpen()}),onBlur:N(e.onBlur,r.onClose),onClick:N(e.onClick,r.onClose)})})});Yr.displayName=tn;var En="TooltipPortal",[pl,ml]=At(En,{forceMount:void 0}),Xr=e=>{const{__scopeTooltip:t,forceMount:n,children:o,container:r}=e,s=Ze(En,t);return v.jsx(pl,{scope:t,forceMount:n,children:v.jsx(ye,{present:n||s.open,children:v.jsx(Ge,{asChild:!0,container:r,children:o})})})};Xr.displayName=En;var Fe="TooltipContent",Gr=i.forwardRef((e,t)=>{const n=ml(Fe,e.__scopeTooltip),{forceMount:o=n.forceMount,side:r="top",...s}=e,a=Ze(Fe,e.__scopeTooltip);return v.jsx(ye,{present:o||a.open,children:a.disableHoverableContent?v.jsx(qr,{side:r,...s,ref:t}):v.jsx(hl,{side:r,...s,ref:t})})}),hl=i.forwardRef((e,t)=>{const n=Ze(Fe,e.__scopeTooltip),o=bn(Fe,e.__scopeTooltip),r=i.useRef(null),s=B(t,r),[a,c]=i.useState(null),{trigger:l,onClose:u}=n,f=r.current,{onPointerInTransitChange:p}=o,y=i.useCallback(()=>{c(null),p(!1)},[p]),h=i.useCallback((x,d)=>{const m=x.currentTarget,w={x:x.clientX,y:x.clientY},g=xl(w,m.getBoundingClientRect()),C=Cl(w,g),b=bl(d.getBoundingClientRect()),E=Sl([...C,...b]);c(E),p(!0)},[p]);return i.useEffect(()=>()=>y(),[y]),i.useEffect(()=>{if(l&&f){const x=m=>h(m,f),d=m=>h(m,l);return l.addEventListener("pointerleave",x),f.addEventListener("pointerleave",d),()=>{l.removeEventListener("pointerleave",x),f.removeEventListener("pointerleave",d)}}},[l,f,h,y]),i.useEffect(()=>{if(a){const x=d=>{const m=d.target,w={x:d.clientX,y:d.clientY},g=l?.contains(m)||f?.contains(m),C=!El(w,a);g?y():C&&(y(),u())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[l,f,a,u,y]),v.jsx(qr,{...e,ref:s})}),[vl,gl]=At(ze,{isInside:!1}),yl=ll("TooltipContent"),qr=i.forwardRef((e,t)=>{const{__scopeTooltip:n,children:o,"aria-label":r,onEscapeKeyDown:s,onPointerDownOutside:a,...c}=e,l=Ze(Fe,n),u=Ot(n),{onClose:f}=l;return i.useEffect(()=>(document.addEventListener(en,f),()=>document.removeEventListener(en,f)),[f]),i.useEffect(()=>{if(l.trigger){const p=y=>{y.target?.contains(l.trigger)&&f()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[l.trigger,f]),v.jsx(Xe,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:p=>p.preventDefault(),onDismiss:f,children:v.jsxs(fr,{"data-state":l.stateAttribute,...u,...c,ref:t,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[v.jsx(yl,{children:o}),v.jsx(vl,{scope:n,isInside:!0,children:v.jsx(jc,{id:l.contentId,role:"tooltip",children:r||o})})]})})});Gr.displayName=Fe;var Zr="TooltipArrow",wl=i.forwardRef((e,t)=>{const{__scopeTooltip:n,...o}=e,r=Ot(n);return gl(Zr,n).isInside?null:v.jsx(pr,{...r,...o,ref:t})});wl.displayName=Zr;function xl(e,t){const n=Math.abs(t.top-e.y),o=Math.abs(t.bottom-e.y),r=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,o,r,s)){case s:return"left";case r:return"right";case n:return"top";case o:return"bottom";default:throw new Error("unreachable")}}function Cl(e,t,n=5){const o=[];switch(t){case"top":o.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":o.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":o.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":o.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return o}function bl(e){const{top:t,right:n,bottom:o,left:r}=e;return[{x:r,y:t},{x:n,y:t},{x:n,y:o},{x:r,y:o}]}function El(e,t){const{x:n,y:o}=e;let r=!1;for(let s=0,a=t.length-1;so!=y>o&&n<(p-u)*(o-f)/(y-f)+u&&(r=!r)}return r}function Sl(e){const t=e.slice();return t.sort((n,o)=>n.xo.x?1:n.yo.y?1:0),Tl(t)}function Tl(e){if(e.length<=1)return e.slice();const t=[];for(let o=0;o=2;){const s=t[t.length-1],a=t[t.length-2];if((s.x-a.x)*(r.y-a.y)>=(s.y-a.y)*(r.x-a.x))t.pop();else break}t.push(r)}t.pop();const n=[];for(let o=e.length-1;o>=0;o--){const r=e[o];for(;n.length>=2;){const s=n[n.length-1],a=n[n.length-2];if((s.x-a.x)*(r.y-a.y)>=(s.y-a.y)*(r.x-a.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var vu=Kr,gu=zr,yu=Yr,wu=Xr,xu=Gr,Sn="ToastProvider",[Tn,Rl,Pl]=eo("Toast"),[Qr]=Oe("Toast",[Pl]),[Al,It]=Qr(Sn),Jr=e=>{const{__scopeToast:t,label:n="Notification",duration:o=5e3,swipeDirection:r="right",swipeThreshold:s=50,children:a}=e,[c,l]=i.useState(null),[u,f]=i.useState(0),p=i.useRef(!1),y=i.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Sn}\`. Expected non-empty \`string\`.`),v.jsx(Tn.Provider,{scope:t,children:v.jsx(Al,{scope:t,label:n,duration:o,swipeDirection:r,swipeThreshold:s,toastCount:u,viewport:c,onViewportChange:l,onToastAdd:i.useCallback(()=>f(h=>h+1),[]),onToastRemove:i.useCallback(()=>f(h=>h-1),[]),isFocusedToastEscapeKeyDownRef:p,isClosePausedRef:y,children:a})})};Jr.displayName=Sn;var es="ToastViewport",Ol=["F8"],nn="toast.viewportPause",on="toast.viewportResume",ts=i.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:o=Ol,label:r="Notifications ({hotkey})",...s}=e,a=It(es,n),c=Rl(n),l=i.useRef(null),u=i.useRef(null),f=i.useRef(null),p=i.useRef(null),y=B(t,p,a.onViewportChange),h=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),x=a.toastCount>0;i.useEffect(()=>{const m=w=>{o.length!==0&&o.every(C=>w[C]||w.code===C)&&p.current?.focus()};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[o]),i.useEffect(()=>{const m=l.current,w=p.current;if(x&&m&&w){const g=()=>{if(!a.isClosePausedRef.current){const R=new CustomEvent(nn);w.dispatchEvent(R),a.isClosePausedRef.current=!0}},C=()=>{if(a.isClosePausedRef.current){const R=new CustomEvent(on);w.dispatchEvent(R),a.isClosePausedRef.current=!1}},b=R=>{!m.contains(R.relatedTarget)&&C()},E=()=>{m.contains(document.activeElement)||C()};return m.addEventListener("focusin",g),m.addEventListener("focusout",b),m.addEventListener("pointermove",g),m.addEventListener("pointerleave",E),window.addEventListener("blur",g),window.addEventListener("focus",C),()=>{m.removeEventListener("focusin",g),m.removeEventListener("focusout",b),m.removeEventListener("pointermove",g),m.removeEventListener("pointerleave",E),window.removeEventListener("blur",g),window.removeEventListener("focus",C)}}},[x,a.isClosePausedRef]);const d=i.useCallback(({tabbingDirection:m})=>{const g=c().map(C=>{const b=C.ref.current,E=[b,...Vl(b)];return m==="forwards"?E:E.reverse()});return(m==="forwards"?g.reverse():g).flat()},[c]);return i.useEffect(()=>{const m=p.current;if(m){const w=g=>{const C=g.altKey||g.ctrlKey||g.metaKey;if(g.key==="Tab"&&!C){const E=document.activeElement,R=g.shiftKey;if(g.target===m&&R){u.current?.focus();return}const M=d({tabbingDirection:R?"backwards":"forwards"}),L=M.findIndex(k=>k===E);Ht(M.slice(L+1))?g.preventDefault():R?u.current?.focus():f.current?.focus()}};return m.addEventListener("keydown",w),()=>m.removeEventListener("keydown",w)}},[c,d]),v.jsxs(Zs,{ref:l,role:"region","aria-label":r.replace("{hotkey}",h),tabIndex:-1,style:{pointerEvents:x?void 0:"none"},children:[x&&v.jsx(rn,{ref:u,onFocusFromOutsideViewport:()=>{const m=d({tabbingDirection:"forwards"});Ht(m)}}),v.jsx(Tn.Slot,{scope:n,children:v.jsx(D.ol,{tabIndex:-1,...s,ref:y})}),x&&v.jsx(rn,{ref:f,onFocusFromOutsideViewport:()=>{const m=d({tabbingDirection:"backwards"});Ht(m)}})]})});ts.displayName=es;var ns="ToastFocusProxy",rn=i.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:o,...r}=e,s=It(ns,n);return v.jsx(St,{tabIndex:0,...r,ref:t,style:{position:"fixed"},onFocus:a=>{const c=a.relatedTarget;!s.viewport?.contains(c)&&o()}})});rn.displayName=ns;var Qe="Toast",Il="toast.swipeStart",Nl="toast.swipeMove",_l="toast.swipeCancel",Dl="toast.swipeEnd",os=i.forwardRef((e,t)=>{const{forceMount:n,open:o,defaultOpen:r,onOpenChange:s,...a}=e,[c,l]=ke({prop:o,defaultProp:r??!0,onChange:s,caller:Qe});return v.jsx(ye,{present:n||c,children:v.jsx(kl,{open:c,...a,ref:t,onClose:()=>l(!1),onPause:ee(e.onPause),onResume:ee(e.onResume),onSwipeStart:N(e.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:N(e.onSwipeMove,u=>{const{x:f,y:p}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","move"),u.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${f}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${p}px`)}),onSwipeCancel:N(e.onSwipeCancel,u=>{u.currentTarget.setAttribute("data-swipe","cancel"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:N(e.onSwipeEnd,u=>{const{x:f,y:p}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","end"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${f}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${p}px`),l(!1)})})})});os.displayName=Qe;var[Ml,Ll]=Qr(Qe,{onClose(){}}),kl=i.forwardRef((e,t)=>{const{__scopeToast:n,type:o="foreground",duration:r,open:s,onClose:a,onEscapeKeyDown:c,onPause:l,onResume:u,onSwipeStart:f,onSwipeMove:p,onSwipeCancel:y,onSwipeEnd:h,...x}=e,d=It(Qe,n),[m,w]=i.useState(null),g=B(t,T=>w(T)),C=i.useRef(null),b=i.useRef(null),E=r||d.duration,R=i.useRef(0),S=i.useRef(E),O=i.useRef(0),{onToastAdd:M,onToastRemove:L}=d,k=ee(()=>{m?.contains(document.activeElement)&&d.viewport?.focus(),a()}),$=i.useCallback(T=>{!T||T===1/0||(window.clearTimeout(O.current),R.current=new Date().getTime(),O.current=window.setTimeout(k,T))},[k]);i.useEffect(()=>{const T=d.viewport;if(T){const j=()=>{$(S.current),u?.()},I=()=>{const _=new Date().getTime()-R.current;S.current=S.current-_,window.clearTimeout(O.current),l?.()};return T.addEventListener(nn,I),T.addEventListener(on,j),()=>{T.removeEventListener(nn,I),T.removeEventListener(on,j)}}},[d.viewport,E,l,u,$]),i.useEffect(()=>{s&&!d.isClosePausedRef.current&&$(E)},[s,E,d.isClosePausedRef,$]),i.useEffect(()=>(M(),()=>L()),[M,L]);const F=i.useMemo(()=>m?us(m):null,[m]);return d.viewport?v.jsxs(v.Fragment,{children:[F&&v.jsx(jl,{__scopeToast:n,role:"status","aria-live":o==="foreground"?"assertive":"polite",children:F}),v.jsx(Ml,{scope:n,onClose:k,children:Ye.createPortal(v.jsx(Tn.ItemSlot,{scope:n,children:v.jsx(qs,{asChild:!0,onEscapeKeyDown:N(c,()=>{d.isFocusedToastEscapeKeyDownRef.current||k(),d.isFocusedToastEscapeKeyDownRef.current=!1}),children:v.jsx(D.li,{tabIndex:0,"data-state":s?"open":"closed","data-swipe-direction":d.swipeDirection,...x,ref:g,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:N(e.onKeyDown,T=>{T.key==="Escape"&&(c?.(T.nativeEvent),T.nativeEvent.defaultPrevented||(d.isFocusedToastEscapeKeyDownRef.current=!0,k()))}),onPointerDown:N(e.onPointerDown,T=>{T.button===0&&(C.current={x:T.clientX,y:T.clientY})}),onPointerMove:N(e.onPointerMove,T=>{if(!C.current)return;const j=T.clientX-C.current.x,I=T.clientY-C.current.y,_=!!b.current,P=["left","right"].includes(d.swipeDirection),W=["left","up"].includes(d.swipeDirection)?Math.min:Math.max,Y=P?W(0,j):0,ue=P?0:W(0,I),de=T.pointerType==="touch"?10:2,re={x:Y,y:ue},Q={originalEvent:T,delta:re};_?(b.current=re,st(Nl,p,Q,{discrete:!1})):Jn(re,d.swipeDirection,de)?(b.current=re,st(Il,f,Q,{discrete:!1}),T.target.setPointerCapture(T.pointerId)):(Math.abs(j)>de||Math.abs(I)>de)&&(C.current=null)}),onPointerUp:N(e.onPointerUp,T=>{const j=b.current,I=T.target;if(I.hasPointerCapture(T.pointerId)&&I.releasePointerCapture(T.pointerId),b.current=null,C.current=null,j){const _=T.currentTarget,P={originalEvent:T,delta:j};Jn(j,d.swipeDirection,d.swipeThreshold)?st(Dl,h,P,{discrete:!0}):st(_l,y,P,{discrete:!0}),_.addEventListener("click",W=>W.preventDefault(),{once:!0})}})})})}),d.viewport)})]}):null}),jl=e=>{const{__scopeToast:t,children:n,...o}=e,r=It(Qe,t),[s,a]=i.useState(!1),[c,l]=i.useState(!1);return Wl(()=>a(!0)),i.useEffect(()=>{const u=window.setTimeout(()=>l(!0),1e3);return()=>window.clearTimeout(u)},[]),c?null:v.jsx(Ge,{asChild:!0,children:v.jsx(St,{...o,children:s&&v.jsxs(v.Fragment,{children:[r.label," ",n]})})})},Fl="ToastTitle",rs=i.forwardRef((e,t)=>{const{__scopeToast:n,...o}=e;return v.jsx(D.div,{...o,ref:t})});rs.displayName=Fl;var $l="ToastDescription",ss=i.forwardRef((e,t)=>{const{__scopeToast:n,...o}=e;return v.jsx(D.div,{...o,ref:t})});ss.displayName=$l;var is="ToastAction",as=i.forwardRef((e,t)=>{const{altText:n,...o}=e;return n.trim()?v.jsx(ls,{altText:n,asChild:!0,children:v.jsx(Rn,{...o,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${is}\`. Expected non-empty \`string\`.`),null)});as.displayName=is;var cs="ToastClose",Rn=i.forwardRef((e,t)=>{const{__scopeToast:n,...o}=e,r=Ll(cs,n);return v.jsx(ls,{asChild:!0,children:v.jsx(D.button,{type:"button",...o,ref:t,onClick:N(e.onClick,r.onClose)})})});Rn.displayName=cs;var ls=i.forwardRef((e,t)=>{const{__scopeToast:n,altText:o,...r}=e;return v.jsx(D.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":o||void 0,...r,ref:t})});function us(e){const t=[];return Array.from(e.childNodes).forEach(o=>{if(o.nodeType===o.TEXT_NODE&&o.textContent&&t.push(o.textContent),Bl(o)){const r=o.ariaHidden||o.hidden||o.style.display==="none",s=o.dataset.radixToastAnnounceExclude==="";if(!r)if(s){const a=o.dataset.radixToastAnnounceAlt;a&&t.push(a)}else t.push(...us(o))}}),t}function st(e,t,n,{discrete:o}){const r=n.originalEvent.currentTarget,s=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),o?to(r,s):r.dispatchEvent(s)}var Jn=(e,t,n=0)=>{const o=Math.abs(e.x),r=Math.abs(e.y),s=o>r;return t==="left"||t==="right"?s&&o>n:!s&&r>n};function Wl(e=()=>{}){const t=ee(e);z(()=>{let n=0,o=0;return n=window.requestAnimationFrame(()=>o=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(o)}},[t])}function Bl(e){return e.nodeType===e.ELEMENT_NODE}function Vl(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const r=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||r?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Ht(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var Cu=Jr,bu=ts,Eu=os,Su=rs,Tu=ss,Ru=as,Pu=Rn;export{tu as $,ur as A,dr as B,Zl as C,Jl as D,pr as E,an as F,to as G,la as H,ua as I,nu as J,ru as K,fu as L,pu as M,su as N,ql as O,D as P,iu as Q,Yl as R,Ul as S,Ql as T,cu as U,au as V,zl as W,lu as X,du as Y,uu as Z,mu as _,eo as a,ou as a0,hu as a1,wu as a2,xu as a3,vu as a4,gu as a5,yu as a6,bu as a7,Eu as a8,Ru as a9,Pu as aa,Su as ab,Tu as ac,Cu as ad,N as b,Oe as c,B as d,_s as e,ke as f,ee as g,ye as h,z as i,On as j,oo as k,Lo as l,ko as m,Kl as n,Gl as o,eu as p,Xl as q,$e as r,Ge as s,Et as t,Se as u,yo as v,cn as w,co as x,Xe as y,fr as z}; diff --git a/webui/dist/assets/radix-extra-tU0cN6gS.js b/webui/dist/assets/radix-extra-DmmnfeQE.js similarity index 99% rename from webui/dist/assets/radix-extra-tU0cN6gS.js rename to webui/dist/assets/radix-extra-DmmnfeQE.js index 6cf47f5c..e13199cb 100644 --- a/webui/dist/assets/radix-extra-tU0cN6gS.js +++ b/webui/dist/assets/radix-extra-DmmnfeQE.js @@ -1,4 +1,4 @@ -import{r as s,j as u,d as jr}from"./router-9vIXuQkh.js";import{c as G,a as Be,u as Ce,P as E,b,d as T,e as de,f as re,g as B,h as $,i as ce,j as Ke,k as Ge,l as xt,m as Ct,n as wt,O as Or,o as Lr,W as Fr,C as kr,T as $r,D as Vr,p as Pt,R as Br,q as Kr,r as He,s as Rt,t as we,v as Et,w as _t,x as yt,F as At,y as Tt,z as Mt,A as It,B as Ue,E as Dt,G as Gr}from"./radix-core-CEUnGg09.js";var Oe="rovingFocusGroup.onEntryFocus",Hr={bubbles:!1,cancelable:!0},fe="RovingFocusGroup",[Le,Nt,Ur]=Be(fe),[Wr,Pe]=G(fe,[Ur]),[zr,Yr]=Wr(fe),jt=s.forwardRef((e,t)=>u.jsx(Le.Provider,{scope:e.__scopeRovingFocusGroup,children:u.jsx(Le.Slot,{scope:e.__scopeRovingFocusGroup,children:u.jsx(Xr,{...e,ref:t})})}));jt.displayName=fe;var Xr=s.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:o,orientation:r,loop:n=!1,dir:a,currentTabStopId:i,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:l,onEntryFocus:p,preventScrollOnEntryFocus:f=!1,...d}=e,v=s.useRef(null),m=T(t,v),h=de(a),[x,g]=re({prop:i,defaultProp:c??null,onChange:l,caller:fe}),[S,R]=s.useState(!1),w=B(p),P=Nt(o),I=s.useRef(!1),[j,D]=s.useState(0);return s.useEffect(()=>{const M=v.current;if(M)return M.addEventListener(Oe,w),()=>M.removeEventListener(Oe,w)},[w]),u.jsx(zr,{scope:o,orientation:r,dir:h,loop:n,currentTabStopId:x,onItemFocus:s.useCallback(M=>g(M),[g]),onItemShiftTab:s.useCallback(()=>R(!0),[]),onFocusableItemAdd:s.useCallback(()=>D(M=>M+1),[]),onFocusableItemRemove:s.useCallback(()=>D(M=>M-1),[]),children:u.jsx(E.div,{tabIndex:S||j===0?-1:0,"data-orientation":r,...d,ref:m,style:{outline:"none",...e.style},onMouseDown:b(e.onMouseDown,()=>{I.current=!0}),onFocus:b(e.onFocus,M=>{const _=!I.current;if(M.target===M.currentTarget&&_&&!S){const A=new CustomEvent(Oe,Hr);if(M.currentTarget.dispatchEvent(A),!A.defaultPrevented){const y=P().filter(N=>N.focusable),O=y.find(N=>N.active),U=y.find(N=>N.id===x),X=[O,U,...y].filter(Boolean).map(N=>N.ref.current);Ft(X,f)}}I.current=!1}),onBlur:b(e.onBlur,()=>R(!1))})})}),Ot="RovingFocusGroupItem",Lt=s.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:o,focusable:r=!0,active:n=!1,tabStopId:a,children:i,...c}=e,l=Ce(),p=a||l,f=Yr(Ot,o),d=f.currentTabStopId===p,v=Nt(o),{onFocusableItemAdd:m,onFocusableItemRemove:h,currentTabStopId:x}=f;return s.useEffect(()=>{if(r)return m(),()=>h()},[r,m,h]),u.jsx(Le.ItemSlot,{scope:o,id:p,focusable:r,active:n,children:u.jsx(E.span,{tabIndex:d?0:-1,"data-orientation":f.orientation,...c,ref:t,onMouseDown:b(e.onMouseDown,g=>{r?f.onItemFocus(p):g.preventDefault()}),onFocus:b(e.onFocus,()=>f.onItemFocus(p)),onKeyDown:b(e.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){f.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const S=Jr(g,f.orientation,f.dir);if(S!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let w=v().filter(P=>P.focusable).map(P=>P.ref.current);if(S==="last")w.reverse();else if(S==="prev"||S==="next"){S==="prev"&&w.reverse();const P=w.indexOf(g.currentTarget);w=f.loop?Qr(w,P+1):w.slice(P+1)}setTimeout(()=>Ft(w))}}),children:typeof i=="function"?i({isCurrentTabStop:d,hasTabStop:x!=null}):i})})});Lt.displayName=Ot;var qr={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Zr(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Jr(e,t,o){const r=Zr(e.key,o);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return qr[r]}function Ft(e,t=!1){const o=document.activeElement;for(const r of e)if(r===o||(r.focus({preventScroll:t}),document.activeElement!==o))return}function Qr(e,t){return e.map((o,r)=>e[(t+r)%e.length])}var kt=jt,$t=Lt,Re="Tabs",[en]=G(Re,[Pe]),Vt=Pe(),[tn,We]=en(Re),Bt=s.forwardRef((e,t)=>{const{__scopeTabs:o,value:r,onValueChange:n,defaultValue:a,orientation:i="horizontal",dir:c,activationMode:l="automatic",...p}=e,f=de(c),[d,v]=re({prop:r,onChange:n,defaultProp:a??"",caller:Re});return u.jsx(tn,{scope:o,baseId:Ce(),value:d,onValueChange:v,orientation:i,dir:f,activationMode:l,children:u.jsx(E.div,{dir:f,"data-orientation":i,...p,ref:t})})});Bt.displayName=Re;var Kt="TabsList",Gt=s.forwardRef((e,t)=>{const{__scopeTabs:o,loop:r=!0,...n}=e,a=We(Kt,o),i=Vt(o);return u.jsx(kt,{asChild:!0,...i,orientation:a.orientation,dir:a.dir,loop:r,children:u.jsx(E.div,{role:"tablist","aria-orientation":a.orientation,...n,ref:t})})});Gt.displayName=Kt;var Ht="TabsTrigger",Ut=s.forwardRef((e,t)=>{const{__scopeTabs:o,value:r,disabled:n=!1,...a}=e,i=We(Ht,o),c=Vt(o),l=Yt(i.baseId,r),p=Xt(i.baseId,r),f=r===i.value;return u.jsx($t,{asChild:!0,...c,focusable:!n,active:f,children:u.jsx(E.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":p,"data-state":f?"active":"inactive","data-disabled":n?"":void 0,disabled:n,id:l,...a,ref:t,onMouseDown:b(e.onMouseDown,d=>{!n&&d.button===0&&d.ctrlKey===!1?i.onValueChange(r):d.preventDefault()}),onKeyDown:b(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&i.onValueChange(r)}),onFocus:b(e.onFocus,()=>{const d=i.activationMode!=="manual";!f&&!n&&d&&i.onValueChange(r)})})})});Ut.displayName=Ht;var Wt="TabsContent",zt=s.forwardRef((e,t)=>{const{__scopeTabs:o,value:r,forceMount:n,children:a,...i}=e,c=We(Wt,o),l=Yt(c.baseId,r),p=Xt(c.baseId,r),f=r===c.value,d=s.useRef(f);return s.useEffect(()=>{const v=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(v)},[]),u.jsx($,{present:n||f,children:({present:v})=>u.jsx(E.div,{"data-state":f?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":l,hidden:!v,id:p,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:v&&a})})});zt.displayName=Wt;function Yt(e,t){return`${e}-trigger-${t}`}function Xt(e,t){return`${e}-content-${t}`}var hs=Bt,gs=Gt,Ss=Ut,bs=zt;function on(e,t){return s.useReducer((o,r)=>t[o][r]??o,e)}var ze="ScrollArea",[qt]=G(ze),[rn,V]=qt(ze),Zt=s.forwardRef((e,t)=>{const{__scopeScrollArea:o,type:r="hover",dir:n,scrollHideDelay:a=600,...i}=e,[c,l]=s.useState(null),[p,f]=s.useState(null),[d,v]=s.useState(null),[m,h]=s.useState(null),[x,g]=s.useState(null),[S,R]=s.useState(0),[w,P]=s.useState(0),[I,j]=s.useState(!1),[D,M]=s.useState(!1),_=T(t,y=>l(y)),A=de(n);return u.jsx(rn,{scope:o,type:r,dir:A,scrollHideDelay:a,scrollArea:c,viewport:p,onViewportChange:f,content:d,onContentChange:v,scrollbarX:m,onScrollbarXChange:h,scrollbarXEnabled:I,onScrollbarXEnabledChange:j,scrollbarY:x,onScrollbarYChange:g,scrollbarYEnabled:D,onScrollbarYEnabledChange:M,onCornerWidthChange:R,onCornerHeightChange:P,children:u.jsx(E.div,{dir:A,...i,ref:_,style:{position:"relative","--radix-scroll-area-corner-width":S+"px","--radix-scroll-area-corner-height":w+"px",...e.style}})})});Zt.displayName=ze;var Jt="ScrollAreaViewport",Qt=s.forwardRef((e,t)=>{const{__scopeScrollArea:o,children:r,nonce:n,...a}=e,i=V(Jt,o),c=s.useRef(null),l=T(t,c,i.onViewportChange);return u.jsxs(u.Fragment,{children:[u.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:n}),u.jsx(E.div,{"data-radix-scroll-area-viewport":"",...a,ref:l,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:u.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});Qt.displayName=Jt;var K="ScrollAreaScrollbar",nn=s.forwardRef((e,t)=>{const{forceMount:o,...r}=e,n=V(K,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:i}=n,c=e.orientation==="horizontal";return s.useEffect(()=>(c?a(!0):i(!0),()=>{c?a(!1):i(!1)}),[c,a,i]),n.type==="hover"?u.jsx(an,{...r,ref:t,forceMount:o}):n.type==="scroll"?u.jsx(sn,{...r,ref:t,forceMount:o}):n.type==="auto"?u.jsx(eo,{...r,ref:t,forceMount:o}):n.type==="always"?u.jsx(Ye,{...r,ref:t}):null});nn.displayName=K;var an=s.forwardRef((e,t)=>{const{forceMount:o,...r}=e,n=V(K,e.__scopeScrollArea),[a,i]=s.useState(!1);return s.useEffect(()=>{const c=n.scrollArea;let l=0;if(c){const p=()=>{window.clearTimeout(l),i(!0)},f=()=>{l=window.setTimeout(()=>i(!1),n.scrollHideDelay)};return c.addEventListener("pointerenter",p),c.addEventListener("pointerleave",f),()=>{window.clearTimeout(l),c.removeEventListener("pointerenter",p),c.removeEventListener("pointerleave",f)}}},[n.scrollArea,n.scrollHideDelay]),u.jsx($,{present:o||a,children:u.jsx(eo,{"data-state":a?"visible":"hidden",...r,ref:t})})}),sn=s.forwardRef((e,t)=>{const{forceMount:o,...r}=e,n=V(K,e.__scopeScrollArea),a=e.orientation==="horizontal",i=_e(()=>l("SCROLL_END"),100),[c,l]=on("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return s.useEffect(()=>{if(c==="idle"){const p=window.setTimeout(()=>l("HIDE"),n.scrollHideDelay);return()=>window.clearTimeout(p)}},[c,n.scrollHideDelay,l]),s.useEffect(()=>{const p=n.viewport,f=a?"scrollLeft":"scrollTop";if(p){let d=p[f];const v=()=>{const m=p[f];d!==m&&(l("SCROLL"),i()),d=m};return p.addEventListener("scroll",v),()=>p.removeEventListener("scroll",v)}},[n.viewport,a,l,i]),u.jsx($,{present:o||c!=="hidden",children:u.jsx(Ye,{"data-state":c==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:b(e.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:b(e.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),eo=s.forwardRef((e,t)=>{const o=V(K,e.__scopeScrollArea),{forceMount:r,...n}=e,[a,i]=s.useState(!1),c=e.orientation==="horizontal",l=_e(()=>{if(o.viewport){const p=o.viewport.offsetWidth{const{orientation:o="vertical",...r}=e,n=V(K,e.__scopeScrollArea),a=s.useRef(null),i=s.useRef(0),[c,l]=s.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),p=no(c.viewport,c.content),f={...r,sizes:c,onSizesChange:l,hasThumb:p>0&&p<1,onThumbChange:v=>a.current=v,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:v=>i.current=v};function d(v,m){return vn(v,i.current,c,m)}return o==="horizontal"?u.jsx(cn,{...f,ref:t,onThumbPositionChange:()=>{if(n.viewport&&a.current){const v=n.viewport.scrollLeft,m=vt(v,c,n.dir);a.current.style.transform=`translate3d(${m}px, 0, 0)`}},onWheelScroll:v=>{n.viewport&&(n.viewport.scrollLeft=v)},onDragScroll:v=>{n.viewport&&(n.viewport.scrollLeft=d(v,n.dir))}}):o==="vertical"?u.jsx(ln,{...f,ref:t,onThumbPositionChange:()=>{if(n.viewport&&a.current){const v=n.viewport.scrollTop,m=vt(v,c);a.current.style.transform=`translate3d(0, ${m}px, 0)`}},onWheelScroll:v=>{n.viewport&&(n.viewport.scrollTop=v)},onDragScroll:v=>{n.viewport&&(n.viewport.scrollTop=d(v))}}):null}),cn=s.forwardRef((e,t)=>{const{sizes:o,onSizesChange:r,...n}=e,a=V(K,e.__scopeScrollArea),[i,c]=s.useState(),l=s.useRef(null),p=T(t,l,a.onScrollbarXChange);return s.useEffect(()=>{l.current&&c(getComputedStyle(l.current))},[l]),u.jsx(oo,{"data-orientation":"horizontal",...n,ref:p,sizes:o,style:{bottom:0,left:a.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:a.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Ee(o)+"px",...e.style},onThumbPointerDown:f=>e.onThumbPointerDown(f.x),onDragScroll:f=>e.onDragScroll(f.x),onWheelScroll:(f,d)=>{if(a.viewport){const v=a.viewport.scrollLeft+f.deltaX;e.onWheelScroll(v),so(v,d)&&f.preventDefault()}},onResize:()=>{l.current&&a.viewport&&i&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:ge(i.paddingLeft),paddingEnd:ge(i.paddingRight)}})}})}),ln=s.forwardRef((e,t)=>{const{sizes:o,onSizesChange:r,...n}=e,a=V(K,e.__scopeScrollArea),[i,c]=s.useState(),l=s.useRef(null),p=T(t,l,a.onScrollbarYChange);return s.useEffect(()=>{l.current&&c(getComputedStyle(l.current))},[l]),u.jsx(oo,{"data-orientation":"vertical",...n,ref:p,sizes:o,style:{top:0,right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Ee(o)+"px",...e.style},onThumbPointerDown:f=>e.onThumbPointerDown(f.y),onDragScroll:f=>e.onDragScroll(f.y),onWheelScroll:(f,d)=>{if(a.viewport){const v=a.viewport.scrollTop+f.deltaY;e.onWheelScroll(v),so(v,d)&&f.preventDefault()}},onResize:()=>{l.current&&a.viewport&&i&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:ge(i.paddingTop),paddingEnd:ge(i.paddingBottom)}})}})}),[un,to]=qt(K),oo=s.forwardRef((e,t)=>{const{__scopeScrollArea:o,sizes:r,hasThumb:n,onThumbChange:a,onThumbPointerUp:i,onThumbPointerDown:c,onThumbPositionChange:l,onDragScroll:p,onWheelScroll:f,onResize:d,...v}=e,m=V(K,o),[h,x]=s.useState(null),g=T(t,_=>x(_)),S=s.useRef(null),R=s.useRef(""),w=m.viewport,P=r.content-r.viewport,I=B(f),j=B(l),D=_e(d,10);function M(_){if(S.current){const A=_.clientX-S.current.left,y=_.clientY-S.current.top;p({x:A,y})}}return s.useEffect(()=>{const _=A=>{const y=A.target;h?.contains(y)&&I(A,P)};return document.addEventListener("wheel",_,{passive:!1}),()=>document.removeEventListener("wheel",_,{passive:!1})},[w,h,P,I]),s.useEffect(j,[r,j]),te(h,D),te(m.content,D),u.jsx(un,{scope:o,scrollbar:h,hasThumb:n,onThumbChange:B(a),onThumbPointerUp:B(i),onThumbPositionChange:j,onThumbPointerDown:B(c),children:u.jsx(E.div,{...v,ref:g,style:{position:"absolute",...v.style},onPointerDown:b(e.onPointerDown,_=>{_.button===0&&(_.target.setPointerCapture(_.pointerId),S.current=h.getBoundingClientRect(),R.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",m.viewport&&(m.viewport.style.scrollBehavior="auto"),M(_))}),onPointerMove:b(e.onPointerMove,M),onPointerUp:b(e.onPointerUp,_=>{const A=_.target;A.hasPointerCapture(_.pointerId)&&A.releasePointerCapture(_.pointerId),document.body.style.webkitUserSelect=R.current,m.viewport&&(m.viewport.style.scrollBehavior=""),S.current=null})})})}),he="ScrollAreaThumb",dn=s.forwardRef((e,t)=>{const{forceMount:o,...r}=e,n=to(he,e.__scopeScrollArea);return u.jsx($,{present:o||n.hasThumb,children:u.jsx(fn,{ref:t,...r})})}),fn=s.forwardRef((e,t)=>{const{__scopeScrollArea:o,style:r,...n}=e,a=V(he,o),i=to(he,o),{onThumbPositionChange:c}=i,l=T(t,d=>i.onThumbChange(d)),p=s.useRef(void 0),f=_e(()=>{p.current&&(p.current(),p.current=void 0)},100);return s.useEffect(()=>{const d=a.viewport;if(d){const v=()=>{if(f(),!p.current){const m=mn(d,c);p.current=m,c()}};return c(),d.addEventListener("scroll",v),()=>d.removeEventListener("scroll",v)}},[a.viewport,f,c]),u.jsx(E.div,{"data-state":i.hasThumb?"visible":"hidden",...n,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:b(e.onPointerDownCapture,d=>{const m=d.target.getBoundingClientRect(),h=d.clientX-m.left,x=d.clientY-m.top;i.onThumbPointerDown({x:h,y:x})}),onPointerUp:b(e.onPointerUp,i.onThumbPointerUp)})});dn.displayName=he;var Xe="ScrollAreaCorner",ro=s.forwardRef((e,t)=>{const o=V(Xe,e.__scopeScrollArea),r=!!(o.scrollbarX&&o.scrollbarY);return o.type!=="scroll"&&r?u.jsx(pn,{...e,ref:t}):null});ro.displayName=Xe;var pn=s.forwardRef((e,t)=>{const{__scopeScrollArea:o,...r}=e,n=V(Xe,o),[a,i]=s.useState(0),[c,l]=s.useState(0),p=!!(a&&c);return te(n.scrollbarX,()=>{const f=n.scrollbarX?.offsetHeight||0;n.onCornerHeightChange(f),l(f)}),te(n.scrollbarY,()=>{const f=n.scrollbarY?.offsetWidth||0;n.onCornerWidthChange(f),i(f)}),p?u.jsx(E.div,{...r,ref:t,style:{width:a,height:c,position:"absolute",right:n.dir==="ltr"?0:void 0,left:n.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function ge(e){return e?parseInt(e,10):0}function no(e,t){const o=e/t;return isNaN(o)?0:o}function Ee(e){const t=no(e.viewport,e.content),o=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-o)*t;return Math.max(r,18)}function vn(e,t,o,r="ltr"){const n=Ee(o),a=n/2,i=t||a,c=n-i,l=o.scrollbar.paddingStart+i,p=o.scrollbar.size-o.scrollbar.paddingEnd-c,f=o.content-o.viewport,d=r==="ltr"?[0,f]:[f*-1,0];return ao([l,p],d)(e)}function vt(e,t,o="ltr"){const r=Ee(t),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-n,i=t.content-t.viewport,c=a-r,l=o==="ltr"?[0,i]:[i*-1,0],p=Ke(e,l);return ao([0,i],[0,c])(p)}function ao(e,t){return o=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(o-e[0])}}function so(e,t){return e>0&&e{})=>{let o={left:e.scrollLeft,top:e.scrollTop},r=0;return(function n(){const a={left:e.scrollLeft,top:e.scrollTop},i=o.left!==a.left,c=o.top!==a.top;(i||c)&&t(),o=a,r=window.requestAnimationFrame(n)})(),()=>window.cancelAnimationFrame(r)};function _e(e,t){const o=B(e),r=s.useRef(0);return s.useEffect(()=>()=>window.clearTimeout(r.current),[]),s.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(o,t)},[o,t])}function te(e,t){const o=B(t);ce(()=>{let r=0;if(e){const n=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(o)});return n.observe(e),()=>{window.cancelAnimationFrame(r),n.unobserve(e)}}},[e,o])}var xs=Zt,Cs=Qt,ws=ro;function hn(e,t=[]){let o=[];function r(a,i){const c=s.createContext(i);c.displayName=a+"Context";const l=o.length;o=[...o,i];const p=d=>{const{scope:v,children:m,...h}=d,x=v?.[e]?.[l]||c,g=s.useMemo(()=>h,Object.values(h));return u.jsx(x.Provider,{value:g,children:m})};p.displayName=a+"Provider";function f(d,v){const m=v?.[e]?.[l]||c,h=s.useContext(m);if(h)return h;if(i!==void 0)return i;throw new Error(`\`${d}\` must be used within \`${a}\``)}return[p,f]}const n=()=>{const a=o.map(i=>s.createContext(i));return function(c){const l=c?.[e]||a;return s.useMemo(()=>({[`__scope${e}`]:{...c,[e]:l}}),[c,l])}};return n.scopeName=e,[r,gn(n,...t)]}function gn(...e){const t=e[0];if(e.length===1)return t;const o=()=>{const r=e.map(n=>({useScope:n(),scopeName:n.scopeName}));return function(a){const i=r.reduce((c,{useScope:l,scopeName:p})=>{const d=l(a)[`__scope${p}`];return{...c,...d}},{});return s.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return o.scopeName=t.scopeName,o}var Sn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],io=Sn.reduce((e,t)=>{const o=Ge(`Primitive.${t}`),r=s.forwardRef((n,a)=>{const{asChild:i,...c}=n,l=i?o:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(l,{...c,ref:a})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),qe="Progress",Ze=100,[bn]=hn(qe),[xn,Cn]=bn(qe),co=s.forwardRef((e,t)=>{const{__scopeProgress:o,value:r=null,max:n,getValueLabel:a=wn,...i}=e;(n||n===0)&&!mt(n)&&console.error(Pn(`${n}`,"Progress"));const c=mt(n)?n:Ze;r!==null&&!ht(r,c)&&console.error(Rn(`${r}`,"Progress"));const l=ht(r,c)?r:null,p=Se(l)?a(l,c):void 0;return u.jsx(xn,{scope:o,value:l,max:c,children:u.jsx(io.div,{"aria-valuemax":c,"aria-valuemin":0,"aria-valuenow":Se(l)?l:void 0,"aria-valuetext":p,role:"progressbar","data-state":fo(l,c),"data-value":l??void 0,"data-max":c,...i,ref:t})})});co.displayName=qe;var lo="ProgressIndicator",uo=s.forwardRef((e,t)=>{const{__scopeProgress:o,...r}=e,n=Cn(lo,o);return u.jsx(io.div,{"data-state":fo(n.value,n.max),"data-value":n.value??void 0,"data-max":n.max,...r,ref:t})});uo.displayName=lo;function wn(e,t){return`${Math.round(e/t*100)}%`}function fo(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function Se(e){return typeof e=="number"}function mt(e){return Se(e)&&!isNaN(e)&&e>0}function ht(e,t){return Se(e)&&!isNaN(e)&&e<=t&&e>=0}function Pn(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Ze}\`.`}function Rn(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be: +import{r as s,j as u,d as jr}from"./router-9vIXuQkh.js";import{c as G,a as Be,u as Ce,P as E,b,d as T,e as de,f as re,g as B,h as $,i as ce,j as Ke,k as Ge,l as xt,m as Ct,n as wt,O as Or,o as Lr,W as Fr,C as kr,T as $r,D as Vr,p as Pt,R as Br,q as Kr,r as He,s as Rt,t as we,v as Et,w as _t,x as yt,F as At,y as Tt,z as Mt,A as It,B as Ue,E as Dt,G as Gr}from"./radix-core-DyJi0yyw.js";var Oe="rovingFocusGroup.onEntryFocus",Hr={bubbles:!1,cancelable:!0},fe="RovingFocusGroup",[Le,Nt,Ur]=Be(fe),[Wr,Pe]=G(fe,[Ur]),[zr,Yr]=Wr(fe),jt=s.forwardRef((e,t)=>u.jsx(Le.Provider,{scope:e.__scopeRovingFocusGroup,children:u.jsx(Le.Slot,{scope:e.__scopeRovingFocusGroup,children:u.jsx(Xr,{...e,ref:t})})}));jt.displayName=fe;var Xr=s.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:o,orientation:r,loop:n=!1,dir:a,currentTabStopId:i,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:l,onEntryFocus:p,preventScrollOnEntryFocus:f=!1,...d}=e,v=s.useRef(null),m=T(t,v),h=de(a),[x,g]=re({prop:i,defaultProp:c??null,onChange:l,caller:fe}),[S,R]=s.useState(!1),w=B(p),P=Nt(o),I=s.useRef(!1),[j,D]=s.useState(0);return s.useEffect(()=>{const M=v.current;if(M)return M.addEventListener(Oe,w),()=>M.removeEventListener(Oe,w)},[w]),u.jsx(zr,{scope:o,orientation:r,dir:h,loop:n,currentTabStopId:x,onItemFocus:s.useCallback(M=>g(M),[g]),onItemShiftTab:s.useCallback(()=>R(!0),[]),onFocusableItemAdd:s.useCallback(()=>D(M=>M+1),[]),onFocusableItemRemove:s.useCallback(()=>D(M=>M-1),[]),children:u.jsx(E.div,{tabIndex:S||j===0?-1:0,"data-orientation":r,...d,ref:m,style:{outline:"none",...e.style},onMouseDown:b(e.onMouseDown,()=>{I.current=!0}),onFocus:b(e.onFocus,M=>{const _=!I.current;if(M.target===M.currentTarget&&_&&!S){const A=new CustomEvent(Oe,Hr);if(M.currentTarget.dispatchEvent(A),!A.defaultPrevented){const y=P().filter(N=>N.focusable),O=y.find(N=>N.active),U=y.find(N=>N.id===x),X=[O,U,...y].filter(Boolean).map(N=>N.ref.current);Ft(X,f)}}I.current=!1}),onBlur:b(e.onBlur,()=>R(!1))})})}),Ot="RovingFocusGroupItem",Lt=s.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:o,focusable:r=!0,active:n=!1,tabStopId:a,children:i,...c}=e,l=Ce(),p=a||l,f=Yr(Ot,o),d=f.currentTabStopId===p,v=Nt(o),{onFocusableItemAdd:m,onFocusableItemRemove:h,currentTabStopId:x}=f;return s.useEffect(()=>{if(r)return m(),()=>h()},[r,m,h]),u.jsx(Le.ItemSlot,{scope:o,id:p,focusable:r,active:n,children:u.jsx(E.span,{tabIndex:d?0:-1,"data-orientation":f.orientation,...c,ref:t,onMouseDown:b(e.onMouseDown,g=>{r?f.onItemFocus(p):g.preventDefault()}),onFocus:b(e.onFocus,()=>f.onItemFocus(p)),onKeyDown:b(e.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){f.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const S=Jr(g,f.orientation,f.dir);if(S!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let w=v().filter(P=>P.focusable).map(P=>P.ref.current);if(S==="last")w.reverse();else if(S==="prev"||S==="next"){S==="prev"&&w.reverse();const P=w.indexOf(g.currentTarget);w=f.loop?Qr(w,P+1):w.slice(P+1)}setTimeout(()=>Ft(w))}}),children:typeof i=="function"?i({isCurrentTabStop:d,hasTabStop:x!=null}):i})})});Lt.displayName=Ot;var qr={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Zr(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Jr(e,t,o){const r=Zr(e.key,o);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return qr[r]}function Ft(e,t=!1){const o=document.activeElement;for(const r of e)if(r===o||(r.focus({preventScroll:t}),document.activeElement!==o))return}function Qr(e,t){return e.map((o,r)=>e[(t+r)%e.length])}var kt=jt,$t=Lt,Re="Tabs",[en]=G(Re,[Pe]),Vt=Pe(),[tn,We]=en(Re),Bt=s.forwardRef((e,t)=>{const{__scopeTabs:o,value:r,onValueChange:n,defaultValue:a,orientation:i="horizontal",dir:c,activationMode:l="automatic",...p}=e,f=de(c),[d,v]=re({prop:r,onChange:n,defaultProp:a??"",caller:Re});return u.jsx(tn,{scope:o,baseId:Ce(),value:d,onValueChange:v,orientation:i,dir:f,activationMode:l,children:u.jsx(E.div,{dir:f,"data-orientation":i,...p,ref:t})})});Bt.displayName=Re;var Kt="TabsList",Gt=s.forwardRef((e,t)=>{const{__scopeTabs:o,loop:r=!0,...n}=e,a=We(Kt,o),i=Vt(o);return u.jsx(kt,{asChild:!0,...i,orientation:a.orientation,dir:a.dir,loop:r,children:u.jsx(E.div,{role:"tablist","aria-orientation":a.orientation,...n,ref:t})})});Gt.displayName=Kt;var Ht="TabsTrigger",Ut=s.forwardRef((e,t)=>{const{__scopeTabs:o,value:r,disabled:n=!1,...a}=e,i=We(Ht,o),c=Vt(o),l=Yt(i.baseId,r),p=Xt(i.baseId,r),f=r===i.value;return u.jsx($t,{asChild:!0,...c,focusable:!n,active:f,children:u.jsx(E.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":p,"data-state":f?"active":"inactive","data-disabled":n?"":void 0,disabled:n,id:l,...a,ref:t,onMouseDown:b(e.onMouseDown,d=>{!n&&d.button===0&&d.ctrlKey===!1?i.onValueChange(r):d.preventDefault()}),onKeyDown:b(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&i.onValueChange(r)}),onFocus:b(e.onFocus,()=>{const d=i.activationMode!=="manual";!f&&!n&&d&&i.onValueChange(r)})})})});Ut.displayName=Ht;var Wt="TabsContent",zt=s.forwardRef((e,t)=>{const{__scopeTabs:o,value:r,forceMount:n,children:a,...i}=e,c=We(Wt,o),l=Yt(c.baseId,r),p=Xt(c.baseId,r),f=r===c.value,d=s.useRef(f);return s.useEffect(()=>{const v=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(v)},[]),u.jsx($,{present:n||f,children:({present:v})=>u.jsx(E.div,{"data-state":f?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":l,hidden:!v,id:p,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:v&&a})})});zt.displayName=Wt;function Yt(e,t){return`${e}-trigger-${t}`}function Xt(e,t){return`${e}-content-${t}`}var hs=Bt,gs=Gt,Ss=Ut,bs=zt;function on(e,t){return s.useReducer((o,r)=>t[o][r]??o,e)}var ze="ScrollArea",[qt]=G(ze),[rn,V]=qt(ze),Zt=s.forwardRef((e,t)=>{const{__scopeScrollArea:o,type:r="hover",dir:n,scrollHideDelay:a=600,...i}=e,[c,l]=s.useState(null),[p,f]=s.useState(null),[d,v]=s.useState(null),[m,h]=s.useState(null),[x,g]=s.useState(null),[S,R]=s.useState(0),[w,P]=s.useState(0),[I,j]=s.useState(!1),[D,M]=s.useState(!1),_=T(t,y=>l(y)),A=de(n);return u.jsx(rn,{scope:o,type:r,dir:A,scrollHideDelay:a,scrollArea:c,viewport:p,onViewportChange:f,content:d,onContentChange:v,scrollbarX:m,onScrollbarXChange:h,scrollbarXEnabled:I,onScrollbarXEnabledChange:j,scrollbarY:x,onScrollbarYChange:g,scrollbarYEnabled:D,onScrollbarYEnabledChange:M,onCornerWidthChange:R,onCornerHeightChange:P,children:u.jsx(E.div,{dir:A,...i,ref:_,style:{position:"relative","--radix-scroll-area-corner-width":S+"px","--radix-scroll-area-corner-height":w+"px",...e.style}})})});Zt.displayName=ze;var Jt="ScrollAreaViewport",Qt=s.forwardRef((e,t)=>{const{__scopeScrollArea:o,children:r,nonce:n,...a}=e,i=V(Jt,o),c=s.useRef(null),l=T(t,c,i.onViewportChange);return u.jsxs(u.Fragment,{children:[u.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:n}),u.jsx(E.div,{"data-radix-scroll-area-viewport":"",...a,ref:l,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:u.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});Qt.displayName=Jt;var K="ScrollAreaScrollbar",nn=s.forwardRef((e,t)=>{const{forceMount:o,...r}=e,n=V(K,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:i}=n,c=e.orientation==="horizontal";return s.useEffect(()=>(c?a(!0):i(!0),()=>{c?a(!1):i(!1)}),[c,a,i]),n.type==="hover"?u.jsx(an,{...r,ref:t,forceMount:o}):n.type==="scroll"?u.jsx(sn,{...r,ref:t,forceMount:o}):n.type==="auto"?u.jsx(eo,{...r,ref:t,forceMount:o}):n.type==="always"?u.jsx(Ye,{...r,ref:t}):null});nn.displayName=K;var an=s.forwardRef((e,t)=>{const{forceMount:o,...r}=e,n=V(K,e.__scopeScrollArea),[a,i]=s.useState(!1);return s.useEffect(()=>{const c=n.scrollArea;let l=0;if(c){const p=()=>{window.clearTimeout(l),i(!0)},f=()=>{l=window.setTimeout(()=>i(!1),n.scrollHideDelay)};return c.addEventListener("pointerenter",p),c.addEventListener("pointerleave",f),()=>{window.clearTimeout(l),c.removeEventListener("pointerenter",p),c.removeEventListener("pointerleave",f)}}},[n.scrollArea,n.scrollHideDelay]),u.jsx($,{present:o||a,children:u.jsx(eo,{"data-state":a?"visible":"hidden",...r,ref:t})})}),sn=s.forwardRef((e,t)=>{const{forceMount:o,...r}=e,n=V(K,e.__scopeScrollArea),a=e.orientation==="horizontal",i=_e(()=>l("SCROLL_END"),100),[c,l]=on("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return s.useEffect(()=>{if(c==="idle"){const p=window.setTimeout(()=>l("HIDE"),n.scrollHideDelay);return()=>window.clearTimeout(p)}},[c,n.scrollHideDelay,l]),s.useEffect(()=>{const p=n.viewport,f=a?"scrollLeft":"scrollTop";if(p){let d=p[f];const v=()=>{const m=p[f];d!==m&&(l("SCROLL"),i()),d=m};return p.addEventListener("scroll",v),()=>p.removeEventListener("scroll",v)}},[n.viewport,a,l,i]),u.jsx($,{present:o||c!=="hidden",children:u.jsx(Ye,{"data-state":c==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:b(e.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:b(e.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),eo=s.forwardRef((e,t)=>{const o=V(K,e.__scopeScrollArea),{forceMount:r,...n}=e,[a,i]=s.useState(!1),c=e.orientation==="horizontal",l=_e(()=>{if(o.viewport){const p=o.viewport.offsetWidth{const{orientation:o="vertical",...r}=e,n=V(K,e.__scopeScrollArea),a=s.useRef(null),i=s.useRef(0),[c,l]=s.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),p=no(c.viewport,c.content),f={...r,sizes:c,onSizesChange:l,hasThumb:p>0&&p<1,onThumbChange:v=>a.current=v,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:v=>i.current=v};function d(v,m){return vn(v,i.current,c,m)}return o==="horizontal"?u.jsx(cn,{...f,ref:t,onThumbPositionChange:()=>{if(n.viewport&&a.current){const v=n.viewport.scrollLeft,m=vt(v,c,n.dir);a.current.style.transform=`translate3d(${m}px, 0, 0)`}},onWheelScroll:v=>{n.viewport&&(n.viewport.scrollLeft=v)},onDragScroll:v=>{n.viewport&&(n.viewport.scrollLeft=d(v,n.dir))}}):o==="vertical"?u.jsx(ln,{...f,ref:t,onThumbPositionChange:()=>{if(n.viewport&&a.current){const v=n.viewport.scrollTop,m=vt(v,c);a.current.style.transform=`translate3d(0, ${m}px, 0)`}},onWheelScroll:v=>{n.viewport&&(n.viewport.scrollTop=v)},onDragScroll:v=>{n.viewport&&(n.viewport.scrollTop=d(v))}}):null}),cn=s.forwardRef((e,t)=>{const{sizes:o,onSizesChange:r,...n}=e,a=V(K,e.__scopeScrollArea),[i,c]=s.useState(),l=s.useRef(null),p=T(t,l,a.onScrollbarXChange);return s.useEffect(()=>{l.current&&c(getComputedStyle(l.current))},[l]),u.jsx(oo,{"data-orientation":"horizontal",...n,ref:p,sizes:o,style:{bottom:0,left:a.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:a.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Ee(o)+"px",...e.style},onThumbPointerDown:f=>e.onThumbPointerDown(f.x),onDragScroll:f=>e.onDragScroll(f.x),onWheelScroll:(f,d)=>{if(a.viewport){const v=a.viewport.scrollLeft+f.deltaX;e.onWheelScroll(v),so(v,d)&&f.preventDefault()}},onResize:()=>{l.current&&a.viewport&&i&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:ge(i.paddingLeft),paddingEnd:ge(i.paddingRight)}})}})}),ln=s.forwardRef((e,t)=>{const{sizes:o,onSizesChange:r,...n}=e,a=V(K,e.__scopeScrollArea),[i,c]=s.useState(),l=s.useRef(null),p=T(t,l,a.onScrollbarYChange);return s.useEffect(()=>{l.current&&c(getComputedStyle(l.current))},[l]),u.jsx(oo,{"data-orientation":"vertical",...n,ref:p,sizes:o,style:{top:0,right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Ee(o)+"px",...e.style},onThumbPointerDown:f=>e.onThumbPointerDown(f.y),onDragScroll:f=>e.onDragScroll(f.y),onWheelScroll:(f,d)=>{if(a.viewport){const v=a.viewport.scrollTop+f.deltaY;e.onWheelScroll(v),so(v,d)&&f.preventDefault()}},onResize:()=>{l.current&&a.viewport&&i&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:ge(i.paddingTop),paddingEnd:ge(i.paddingBottom)}})}})}),[un,to]=qt(K),oo=s.forwardRef((e,t)=>{const{__scopeScrollArea:o,sizes:r,hasThumb:n,onThumbChange:a,onThumbPointerUp:i,onThumbPointerDown:c,onThumbPositionChange:l,onDragScroll:p,onWheelScroll:f,onResize:d,...v}=e,m=V(K,o),[h,x]=s.useState(null),g=T(t,_=>x(_)),S=s.useRef(null),R=s.useRef(""),w=m.viewport,P=r.content-r.viewport,I=B(f),j=B(l),D=_e(d,10);function M(_){if(S.current){const A=_.clientX-S.current.left,y=_.clientY-S.current.top;p({x:A,y})}}return s.useEffect(()=>{const _=A=>{const y=A.target;h?.contains(y)&&I(A,P)};return document.addEventListener("wheel",_,{passive:!1}),()=>document.removeEventListener("wheel",_,{passive:!1})},[w,h,P,I]),s.useEffect(j,[r,j]),te(h,D),te(m.content,D),u.jsx(un,{scope:o,scrollbar:h,hasThumb:n,onThumbChange:B(a),onThumbPointerUp:B(i),onThumbPositionChange:j,onThumbPointerDown:B(c),children:u.jsx(E.div,{...v,ref:g,style:{position:"absolute",...v.style},onPointerDown:b(e.onPointerDown,_=>{_.button===0&&(_.target.setPointerCapture(_.pointerId),S.current=h.getBoundingClientRect(),R.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",m.viewport&&(m.viewport.style.scrollBehavior="auto"),M(_))}),onPointerMove:b(e.onPointerMove,M),onPointerUp:b(e.onPointerUp,_=>{const A=_.target;A.hasPointerCapture(_.pointerId)&&A.releasePointerCapture(_.pointerId),document.body.style.webkitUserSelect=R.current,m.viewport&&(m.viewport.style.scrollBehavior=""),S.current=null})})})}),he="ScrollAreaThumb",dn=s.forwardRef((e,t)=>{const{forceMount:o,...r}=e,n=to(he,e.__scopeScrollArea);return u.jsx($,{present:o||n.hasThumb,children:u.jsx(fn,{ref:t,...r})})}),fn=s.forwardRef((e,t)=>{const{__scopeScrollArea:o,style:r,...n}=e,a=V(he,o),i=to(he,o),{onThumbPositionChange:c}=i,l=T(t,d=>i.onThumbChange(d)),p=s.useRef(void 0),f=_e(()=>{p.current&&(p.current(),p.current=void 0)},100);return s.useEffect(()=>{const d=a.viewport;if(d){const v=()=>{if(f(),!p.current){const m=mn(d,c);p.current=m,c()}};return c(),d.addEventListener("scroll",v),()=>d.removeEventListener("scroll",v)}},[a.viewport,f,c]),u.jsx(E.div,{"data-state":i.hasThumb?"visible":"hidden",...n,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:b(e.onPointerDownCapture,d=>{const m=d.target.getBoundingClientRect(),h=d.clientX-m.left,x=d.clientY-m.top;i.onThumbPointerDown({x:h,y:x})}),onPointerUp:b(e.onPointerUp,i.onThumbPointerUp)})});dn.displayName=he;var Xe="ScrollAreaCorner",ro=s.forwardRef((e,t)=>{const o=V(Xe,e.__scopeScrollArea),r=!!(o.scrollbarX&&o.scrollbarY);return o.type!=="scroll"&&r?u.jsx(pn,{...e,ref:t}):null});ro.displayName=Xe;var pn=s.forwardRef((e,t)=>{const{__scopeScrollArea:o,...r}=e,n=V(Xe,o),[a,i]=s.useState(0),[c,l]=s.useState(0),p=!!(a&&c);return te(n.scrollbarX,()=>{const f=n.scrollbarX?.offsetHeight||0;n.onCornerHeightChange(f),l(f)}),te(n.scrollbarY,()=>{const f=n.scrollbarY?.offsetWidth||0;n.onCornerWidthChange(f),i(f)}),p?u.jsx(E.div,{...r,ref:t,style:{width:a,height:c,position:"absolute",right:n.dir==="ltr"?0:void 0,left:n.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function ge(e){return e?parseInt(e,10):0}function no(e,t){const o=e/t;return isNaN(o)?0:o}function Ee(e){const t=no(e.viewport,e.content),o=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-o)*t;return Math.max(r,18)}function vn(e,t,o,r="ltr"){const n=Ee(o),a=n/2,i=t||a,c=n-i,l=o.scrollbar.paddingStart+i,p=o.scrollbar.size-o.scrollbar.paddingEnd-c,f=o.content-o.viewport,d=r==="ltr"?[0,f]:[f*-1,0];return ao([l,p],d)(e)}function vt(e,t,o="ltr"){const r=Ee(t),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-n,i=t.content-t.viewport,c=a-r,l=o==="ltr"?[0,i]:[i*-1,0],p=Ke(e,l);return ao([0,i],[0,c])(p)}function ao(e,t){return o=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(o-e[0])}}function so(e,t){return e>0&&e{})=>{let o={left:e.scrollLeft,top:e.scrollTop},r=0;return(function n(){const a={left:e.scrollLeft,top:e.scrollTop},i=o.left!==a.left,c=o.top!==a.top;(i||c)&&t(),o=a,r=window.requestAnimationFrame(n)})(),()=>window.cancelAnimationFrame(r)};function _e(e,t){const o=B(e),r=s.useRef(0);return s.useEffect(()=>()=>window.clearTimeout(r.current),[]),s.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(o,t)},[o,t])}function te(e,t){const o=B(t);ce(()=>{let r=0;if(e){const n=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(o)});return n.observe(e),()=>{window.cancelAnimationFrame(r),n.unobserve(e)}}},[e,o])}var xs=Zt,Cs=Qt,ws=ro;function hn(e,t=[]){let o=[];function r(a,i){const c=s.createContext(i);c.displayName=a+"Context";const l=o.length;o=[...o,i];const p=d=>{const{scope:v,children:m,...h}=d,x=v?.[e]?.[l]||c,g=s.useMemo(()=>h,Object.values(h));return u.jsx(x.Provider,{value:g,children:m})};p.displayName=a+"Provider";function f(d,v){const m=v?.[e]?.[l]||c,h=s.useContext(m);if(h)return h;if(i!==void 0)return i;throw new Error(`\`${d}\` must be used within \`${a}\``)}return[p,f]}const n=()=>{const a=o.map(i=>s.createContext(i));return function(c){const l=c?.[e]||a;return s.useMemo(()=>({[`__scope${e}`]:{...c,[e]:l}}),[c,l])}};return n.scopeName=e,[r,gn(n,...t)]}function gn(...e){const t=e[0];if(e.length===1)return t;const o=()=>{const r=e.map(n=>({useScope:n(),scopeName:n.scopeName}));return function(a){const i=r.reduce((c,{useScope:l,scopeName:p})=>{const d=l(a)[`__scope${p}`];return{...c,...d}},{});return s.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return o.scopeName=t.scopeName,o}var Sn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],io=Sn.reduce((e,t)=>{const o=Ge(`Primitive.${t}`),r=s.forwardRef((n,a)=>{const{asChild:i,...c}=n,l=i?o:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(l,{...c,ref:a})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),qe="Progress",Ze=100,[bn]=hn(qe),[xn,Cn]=bn(qe),co=s.forwardRef((e,t)=>{const{__scopeProgress:o,value:r=null,max:n,getValueLabel:a=wn,...i}=e;(n||n===0)&&!mt(n)&&console.error(Pn(`${n}`,"Progress"));const c=mt(n)?n:Ze;r!==null&&!ht(r,c)&&console.error(Rn(`${r}`,"Progress"));const l=ht(r,c)?r:null,p=Se(l)?a(l,c):void 0;return u.jsx(xn,{scope:o,value:l,max:c,children:u.jsx(io.div,{"aria-valuemax":c,"aria-valuemin":0,"aria-valuenow":Se(l)?l:void 0,"aria-valuetext":p,role:"progressbar","data-state":fo(l,c),"data-value":l??void 0,"data-max":c,...i,ref:t})})});co.displayName=qe;var lo="ProgressIndicator",uo=s.forwardRef((e,t)=>{const{__scopeProgress:o,...r}=e,n=Cn(lo,o);return u.jsx(io.div,{"data-state":fo(n.value,n.max),"data-value":n.value??void 0,"data-max":n.max,...r,ref:t})});uo.displayName=lo;function wn(e,t){return`${Math.round(e/t*100)}%`}function fo(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function Se(e){return typeof e=="number"}function mt(e){return Se(e)&&!isNaN(e)&&e>0}function ht(e,t){return Se(e)&&!isNaN(e)&&e<=t&&e>=0}function Pn(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Ze}\`.`}function Rn(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be: - a positive number - less than the value passed to \`max\` (or ${Ze} if no \`max\` prop is set) - \`null\` or \`undefined\` if the progress is indeterminate. diff --git a/webui/dist/assets/uppy-wQRVMWCa.js b/webui/dist/assets/uppy-DFP_VzYR.js similarity index 99% rename from webui/dist/assets/uppy-wQRVMWCa.js rename to webui/dist/assets/uppy-DFP_VzYR.js index e377f36f..9dad4932 100644 --- a/webui/dist/assets/uppy-wQRVMWCa.js +++ b/webui/dist/assets/uppy-DFP_VzYR.js @@ -1,4 +1,4 @@ -import{g as re}from"./react-vendor-BmxF9s7Q.js";import{r as Ti,a as gs,b as ys}from"./reactflow-DtsZHOR4.js";import"./router-9vIXuQkh.js";import"./charts-simvewUa.js";import"./radix-extra-tU0cN6gS.js";const bs=/^data:([^/]+\/[^,;]+(?:[^,]*?))(;base64)?,([\s\S]*)$/;function vs(i,e,t){const s=bs.exec(i),n=e.mimeType??s?.[1]??"plain/text";let r;if(s?.[2]!=null){const a=atob(decodeURIComponent(s[3])),o=new Uint8Array(a.length);for(let d=0;d(e+=`-${_s(t)}`,"/"))+e}function Fs(i,e){let t=e||"uppy";return typeof i.name=="string"&&(t+=`-${Nt(i.name.toLowerCase())}`),i.type!==void 0&&(t+=`-${i.type}`),i.meta&&typeof i.meta.relativePath=="string"&&(t+=`-${Nt(i.meta.relativePath.toLowerCase())}`),i.data?.size!==void 0&&(t+=`-${i.data.size}`),i.data.lastModified!==void 0&&(t+=`-${i.data.lastModified}`),t}function Ss(i){return!i.isRemote||!i.remote?!1:new Set(["box","dropbox","drive","facebook","unsplash"]).has(i.remote.provider)}function Ts(i,e){if(Ss(i))return i.id;const t=ki(i);return Fs({...i,type:t},e)}const ue=Array.from;function Ps(i){const e=ue(i.files);return Promise.resolve(e)}function Ai(i,e,t,{onSuccess:s}){i.readEntries(n=>{const r=[...e,...n];n.length?queueMicrotask(()=>{Ai(i,r,t,{onSuccess:s})}):s(r)},n=>{t(n),s(e)})}function Oi(i,e){return i==null?i:{kind:i.isFile?"file":i.isDirectory?"directory":void 0,name:i.name,getFile(){return new Promise((t,s)=>i.file(t,s))},async*values(){const t=i.createReader();yield*await new Promise(n=>{Ai(t,[],e,{onSuccess:r=>n(r.map(a=>Oi(a,e)))})})},isSameEntry:void 0}}async function*Ui(i,e,t=void 0){const s=()=>`${e}/${i.name}`;if(i.kind==="file"){const n=await i.getFile();n!=null?(n.relativePath=e?s():null,yield n):t!=null&&(yield t)}else if(i.kind==="directory")for await(const n of i.values())yield*Ui(n,e?s():i.name);else t!=null&&(yield t)}async function*Cs(i,e){const t=await Promise.all(Array.from(i.items,async s=>{let n;return n??=Oi(typeof s.getAsEntry=="function"?s.getAsEntry():s.webkitGetAsEntry(),e),{fileSystemHandle:n,lastResortFile:s.getAsFile()}}));for(const{lastResortFile:s,fileSystemHandle:n}of t)if(n!=null)try{yield*Ui(n,"",s)}catch(r){s!=null?yield s:e(r)}else s!=null&&(yield s)}async function Es(i,e){const t=e?.logDropError??Function.prototype;try{const s=[];for await(const n of Cs(i,t))s.push(n);return s}catch{return Ps(i)}}function ks(i){for(;i&&!i.dir;)i=i.parentNode;return i?.dir}function Me(i){return i<10?`0${i}`:i.toString()}function Oe(){const i=new Date,e=Me(i.getHours()),t=Me(i.getMinutes()),s=Me(i.getSeconds());return`${e}:${t}:${s}`}function As(){if(typeof window>"u")return!1;const i=document.body;return!(i==null||window==null||!("draggable"in i)||!("ondragstart"in i)||!("ondrop"in i)||!("FormData"in window)||!("FileReader"in window))}function Dt(i){return i.startsWith("blob:")}function It(i){return i?/^[^/]+\/(jpe?g|gif|png|svg|svg\+xml|bmp|webp|avif)$/.test(i):!1}function Os(i){const e=Math.floor(i/3600)%24,t=Math.floor(i/60)%60,s=Math.floor(i%60);return{hours:e,minutes:t,seconds:s}}function Us(i){const e=Os(i),t=e.hours===0?"":`${e.hours}h`,s=e.minutes===0?"":`${e.hours===0?e.minutes:` ${e.minutes.toString(10).padStart(2,"0")}`}m`,n=e.hours!==0?"":`${e.minutes===0?e.seconds:` ${e.seconds.toString(10).padStart(2,"0")}`}s`;return`${t}${s}${n}`}function Ns(i,e,t){const s=[];return i.forEach(n=>typeof n!="string"?s.push(n):e[Symbol.split](n).forEach((r,a,o)=>{r!==""&&s.push(r),a{throw new Error(`missing string: ${i}`)};class Ni{locale;constructor(e,{onMissingKey:t=Ds}={}){this.locale={strings:{},pluralize(s){return s===1?0:1}},Array.isArray(e)?e.forEach(this.#t,this):this.#t(e),this.#e=t}#e;#t(e){if(!e?.strings)return;const t=this.locale;Object.assign(this.locale,{strings:{...t.strings,...e.strings},pluralize:e.pluralize||t.pluralize})}translate(e,t){return this.translateArray(e,t).join("")}translateArray(e,t){let s=this.locale.strings[e];if(s==null&&(this.#e(e),s=e),typeof s=="object"){if(t&&typeof t.smart_count<"u"){const r=this.locale.pluralize(t.smart_count);return xt(s[r],t)}throw new Error("Attempted to use a string with plural forms, but no value was given for %{smart_count}")}if(typeof s!="string")throw new Error("string was not a string");return xt(s,t)}}const Be="...";function Di(i,e){if(e===0)return"";if(i.length<=e)return i;if(e<=Be.length+1)return`${i.slice(0,e-1)}…`;const t=e-Be.length,s=Math.ceil(t/2),n=Math.floor(t/2);return i.slice(0,s)+Be+i.slice(-n)}var ye,T,Ii,Q,Mt,xi,Mi,Bi,ut,tt,it,ce={},Ri=[],Is=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,be=Array.isArray;function V(i,e){for(var t in e)i[t]=e[t];return i}function ht(i){i&&i.parentNode&&i.parentNode.removeChild(i)}function ct(i,e,t){var s,n,r,a={};for(r in e)r=="key"?s=e[r]:r=="ref"?n=e[r]:a[r]=e[r];if(arguments.length>2&&(a.children=arguments.length>3?ye.call(arguments,2):t),typeof i=="function"&&i.defaultProps!=null)for(r in i.defaultProps)a[r]===void 0&&(a[r]=i.defaultProps[r]);return he(i,a,s,n,null)}function he(i,e,t,s,n){var r={type:i,props:e,key:t,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:n??++Ii,__i:-1,__u:0};return n==null&&T.vnode!=null&&T.vnode(r),r}function xs(){return{current:null}}function G(i){return i.children}function W(i,e){this.props=i,this.context=e}function se(i,e){if(e==null)return i.__?se(i.__,i.__i+1):null;for(var t;eo&&Q.sort(Mi),i=Q.shift(),o=Q.length,i.__d&&(t=void 0,s=void 0,n=(s=(e=i).__v).__e,r=[],a=[],e.__P&&((t=V({},s)).__v=s.__v+1,T.vnode&&T.vnode(t),pt(e.__P,t,s,e.__n,e.__P.namespaceURI,32&s.__u?[n]:null,r,n??se(s),!!(32&s.__u),a),t.__v=s.__v,t.__.__k[t.__i]=t,Hi(r,t,a),s.__e=s.__=null,t.__e!=n&&Li(t)));Ne.__r=0}function zi(i,e,t,s,n,r,a,o,d,u,c){var h,p,f,m,y,v,b,g=s&&s.__k||Ri,w=e.length;for(d=Ms(t,e,g,d,w),h=0;h0?he(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):a).__=i,a.__b=i.__b+1,o=null,(u=a.__i=Bs(a,t,d,h))!=-1&&(h--,(o=t[u])&&(o.__u|=2)),o==null||o.__v==null?(u==-1&&(n>c?p--:nd?p--:p++,a.__u|=4))):i.__k[r]=null;if(h)for(r=0;r(c?1:0)){for(n=t-1,r=t+1;n>=0||r=0?n--:r++])!=null&&(2&u.__u)==0&&o==u.key&&d==u.type)return a}return-1}function Rt(i,e,t){e[0]=="-"?i.setProperty(e,t??""):i[e]=t==null?"":typeof t!="number"||Is.test(e)?t:t+"px"}function we(i,e,t,s,n){var r,a;e:if(e=="style")if(typeof t=="string")i.style.cssText=t;else{if(typeof s=="string"&&(i.style.cssText=s=""),s)for(e in s)t&&e in t||Rt(i.style,e,"");if(t)for(e in t)s&&t[e]==s[e]||Rt(i.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")r=e!=(e=e.replace(Bi,"$1")),a=e.toLowerCase(),e=a in i||e=="onFocusOut"||e=="onFocusIn"?a.slice(2):e.slice(2),i.l||(i.l={}),i.l[e+r]=t,t?s?t.u=s.u:(t.u=ut,i.addEventListener(e,r?it:tt,r)):i.removeEventListener(e,r?it:tt,r);else{if(n=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in i)try{i[e]=t??"";break e}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!="-"?i.removeAttribute(e):i.setAttribute(e,e=="popover"&&t==1?"":t))}}function Lt(i){return function(e){if(this.l){var t=this.l[e.type+i];if(e.t==null)e.t=ut++;else if(e.t0?i:be(i)?i.map(qi):V({},i)}function Rs(i,e,t,s,n,r,a,o,d){var u,c,h,p,f,m,y,v=t.props,b=e.props,g=e.type;if(g=="svg"?n="http://www.w3.org/2000/svg":g=="math"?n="http://www.w3.org/1998/Math/MathML":n||(n="http://www.w3.org/1999/xhtml"),r!=null){for(u=0;u2&&(o.children=arguments.length>3?ye.call(arguments,2):t),he(i.type,o,s||i.key,n||i.ref,null)}ye=Ri.slice,T={__e:function(i,e,t,s){for(var n,r,a;e=e.__;)if((n=e.__c)&&!n.__)try{if((r=n.constructor)&&r.getDerivedStateFromError!=null&&(n.setState(r.getDerivedStateFromError(i)),a=n.__d),n.componentDidCatch!=null&&(n.componentDidCatch(i,s||{}),a=n.__d),a)return n.__E=n}catch(o){i=o}throw i}},Ii=0,W.prototype.setState=function(i,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=V({},this.state),typeof i=="function"&&(i=i(V({},t),this.props)),i&&V(t,i),i!=null&&this.__v&&(e&&this._sb.push(e),Bt(this))},W.prototype.forceUpdate=function(i){this.__v&&(this.__e=!0,i&&this.__h.push(i),Bt(this))},W.prototype.render=G,Q=[],xi=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Mi=function(i,e){return i.__v.__b-e.__v.__b},Ne.__r=0,Bi=/(PointerCapture)$|Capture$/i,ut=0,tt=Lt(!1),it=Lt(!0);var zs=0;function l(i,e,t,s,n,r){e||(e={});var a,o,d=e;if("ref"in d)for(o in d={},e)o=="ref"?a=e[o]:d[o]=e[o];var u={type:i,props:d,key:t,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--zs,__i:-1,__u:0,__source:n,__self:r};if(typeof i=="function"&&(a=i.defaultProps))for(o in a)d[o]===void 0&&(d[o]=a[o]);return T.vnode&&T.vnode(u),u}var pe,k,Re,$t,fe=0,Wi=[],O=T,Ht=O.__b,qt=O.__r,jt=O.diffed,Vt=O.__c,Wt=O.unmount,Gt=O.__;function mt(i,e){O.__h&&O.__h(k,i,fe||e),fe=0;var t=k.__H||(k.__H={__:[],__h:[]});return i>=t.__.length&&t.__.push({}),t.__[i]}function ne(i){return fe=1,$s(Ki,i)}function $s(i,e,t){var s=mt(pe++,2);if(s.t=i,!s.__c&&(s.__=[Ki(void 0,e),function(o){var d=s.__N?s.__N[0]:s.__[0],u=s.t(d,o);d!==u&&(s.__N=[u,s.__[1]],s.__c.setState({}))}],s.__c=k,!k.__f)){var n=function(o,d,u){if(!s.__c.__H)return!0;var c=s.__c.__H.__.filter(function(p){return!!p.__c});if(c.every(function(p){return!p.__N}))return!r||r.call(this,o,d,u);var h=s.__c.props!==o;return c.forEach(function(p){if(p.__N){var f=p.__[0];p.__=p.__N,p.__N=void 0,f!==p.__[0]&&(h=!0)}}),r&&r.call(this,o,d,u)||h};k.__f=!0;var r=k.shouldComponentUpdate,a=k.componentWillUpdate;k.componentWillUpdate=function(o,d,u){if(this.__e){var c=r;r=void 0,n(o,d,u),r=c}a&&a.call(this,o,d,u)},k.shouldComponentUpdate=n}return s.__N||s.__}function De(i,e){var t=mt(pe++,3);!O.__s&&Gi(t.__H,e)&&(t.__=i,t.u=e,k.__H.__h.push(t))}function ie(i){return fe=5,gt(function(){return{current:i}},[])}function gt(i,e){var t=mt(pe++,7);return Gi(t.__H,e)&&(t.__=i(),t.__H=e,t.__h=i),t.__}function Ie(i,e){return fe=8,gt(function(){return i},e)}function Hs(){for(var i;i=Wi.shift();)if(i.__P&&i.__H)try{i.__H.__h.forEach(Ue),i.__H.__h.forEach(nt),i.__H.__h=[]}catch(e){i.__H.__h=[],O.__e(e,i.__v)}}O.__b=function(i){k=null,Ht&&Ht(i)},O.__=function(i,e){i&&e.__k&&e.__k.__m&&(i.__m=e.__k.__m),Gt&&Gt(i,e)},O.__r=function(i){qt&&qt(i),pe=0;var e=(k=i.__c).__H;e&&(Re===k?(e.__h=[],k.__h=[],e.__.forEach(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.forEach(Ue),e.__h.forEach(nt),e.__h=[],pe=0)),Re=k},O.diffed=function(i){jt&&jt(i);var e=i.__c;e&&e.__H&&(e.__H.__h.length&&(Wi.push(e)!==1&&$t===O.requestAnimationFrame||(($t=O.requestAnimationFrame)||qs)(Hs)),e.__H.__.forEach(function(t){t.u&&(t.__H=t.u),t.u=void 0})),Re=k=null},O.__c=function(i,e){e.some(function(t){try{t.__h.forEach(Ue),t.__h=t.__h.filter(function(s){return!s.__||nt(s)})}catch(s){e.some(function(n){n.__h&&(n.__h=[])}),e=[],O.__e(s,t.__v)}}),Vt&&Vt(i,e)},O.unmount=function(i){Wt&&Wt(i);var e,t=i.__c;t&&t.__H&&(t.__H.__.forEach(function(s){try{Ue(s)}catch(n){e=n}}),t.__H=void 0,e&&O.__e(e,t.__v))};var Kt=typeof requestAnimationFrame=="function";function qs(i){var e,t=function(){clearTimeout(s),Kt&&cancelAnimationFrame(e),setTimeout(i)},s=setTimeout(t,35);Kt&&(e=requestAnimationFrame(t))}function Ue(i){var e=k,t=i.__c;typeof t=="function"&&(i.__c=void 0,t()),k=e}function nt(i){var e=k;i.__c=i.__(),k=e}function Gi(i,e){return!i||i.length!==e.length||e.some(function(t,s){return t!==i[s]})}function Ki(i,e){return typeof e=="function"?e(i):e}const js={position:"relative",width:"100%",minHeight:"100%"},Vs={position:"absolute",top:0,left:0,width:"100%",overflow:"visible"};function Ws({data:i,rowHeight:e,renderRow:t,overscanCount:s=10,padding:n=4,...r}){const a=ie(null),[o,d]=ne(0),[u,c]=ne(0);De(()=>{function g(){a.current!=null&&u!==a.current.offsetHeight&&c(a.current.offsetHeight)}return g(),window.addEventListener("resize",g),()=>{window.removeEventListener("resize",g)}},[u]);const h=Ie(()=>{a.current&&d(a.current.scrollTop)},[]);let p=Math.floor(o/e),f=Math.floor(u/e);s&&(p=Math.max(0,p-p%s),f+=s);const m=p+f+n,y=i.slice(p,m),v={...js,height:i.length*e},b={...Vs,top:p*e};return l("div",{onScroll:h,ref:a,...r,children:l("div",{role:"presentation",style:v,children:l("div",{role:"presentation",style:b,children:y.map(t)})})})}class Gs{uppy;opts;id;defaultLocale;i18n;i18nArray;type;VERSION;constructor(e,t){this.uppy=e,this.opts=t??{}}getPluginState(){const{plugins:e}=this.uppy.getState();return e?.[this.id]||{}}setPluginState(e){const{plugins:t}=this.uppy.getState();this.uppy.setState({plugins:{...t,[this.id]:{...t[this.id],...e}}})}setOptions(e){this.opts={...this.opts,...e},this.setPluginState(void 0),this.i18nInit()}i18nInit(){const e=new Ni([this.defaultLocale,this.uppy.locale,this.opts.locale]);this.i18n=e.translate.bind(e),this.i18nArray=e.translateArray.bind(e),this.setPluginState(void 0)}addTarget(e){throw new Error("Extend the addTarget method to add your plugin to another plugin's target")}install(){}uninstall(){}update(e){}afterUpdate(){}}const Ks={debug:()=>{},warn:()=>{},error:(...i)=>console.error(`[Uppy] [${Oe()}]`,...i)},Xs={debug:(...i)=>console.debug(`[Uppy] [${Oe()}]`,...i),warn:(...i)=>console.warn(`[Uppy] [${Oe()}]`,...i),error:(...i)=>console.error(`[Uppy] [${Oe()}]`,...i)};var Le,Xt;function Ys(){return Xt||(Xt=1,Le=function(e){if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`Expected a number, got ${typeof e}`);const t=e<0;let s=Math.abs(e);if(t&&(s=-s),s===0)return"0 B";const n=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],r=Math.min(Math.floor(Math.log(s)/Math.log(1024)),n.length-1),a=Number(s/1024**r),o=n[r];return`${a>=10||a%1===0?Math.round(a):a.toFixed(1)} ${o}`}),Le}var Qs=Ys();const J=re(Qs);var ze,Yt;function Js(){if(Yt)return ze;Yt=1;function i(e,t){this.text=e=e||"",this.hasWild=~e.indexOf("*"),this.separator=t,this.parts=e.split(t)}return i.prototype.match=function(e){var t=!0,s=this.parts,n,r=s.length,a;if(typeof e=="string"||e instanceof String)if(!this.hasWild&&this.text!=e)t=!1;else{for(a=(e||"").split(this.separator),n=0;t&&n=2}return s?n(s.split(";")[0]):n},$e}var en=Zs();const tn=re(en),sn={maxFileSize:null,minFileSize:null,maxTotalFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,requiredMetaFields:[]};class R extends Error{isUserFacing;file;constructor(e,t){super(e),this.isUserFacing=t?.isUserFacing??!0,t?.file&&(this.file=t.file)}isRestriction=!0}class nn{getI18n;getOpts;constructor(e,t){this.getI18n=t,this.getOpts=()=>{const s=e();if(s.restrictions?.allowedFileTypes!=null&&!Array.isArray(s.restrictions.allowedFileTypes))throw new TypeError("`restrictions.allowedFileTypes` must be an array");return s}}validateAggregateRestrictions(e,t){const{maxTotalFileSize:s,maxNumberOfFiles:n}=this.getOpts().restrictions;if(n&&e.filter(a=>!a.isGhost).length+t.length>n)throw new R(`${this.getI18n()("youCanOnlyUploadX",{smart_count:n})}`);if(s){const r=[...e,...t].reduce((a,o)=>a+(o.size??0),0);if(r>s)throw new R(this.getI18n()("aggregateExceedsSize",{sizeAllowed:J(s),size:J(r)}))}}validateSingleFile(e){const{maxFileSize:t,minFileSize:s,allowedFileTypes:n}=this.getOpts().restrictions;if(n&&!n.some(a=>a.includes("/")?e.type?tn(e.type.replace(/;.*?$/,""),a):!1:a[0]==="."&&e.extension?e.extension.toLowerCase()===a.slice(1).toLowerCase():!1)){const a=n.join(", ");throw new R(this.getI18n()("youCanOnlyUploadFileTypes",{types:a}),{file:e})}if(t&&e.size!=null&&e.size>t)throw new R(this.getI18n()("exceedsSize",{size:J(t),file:e.name??this.getI18n()("unnamed")}),{file:e});if(s&&e.size!=null&&e.size{this.validateSingleFile(s)}),this.validateAggregateRestrictions(e,t)}validateMinNumberOfFiles(e){const{minNumberOfFiles:t}=this.getOpts().restrictions;if(t&&Object.keys(e).length(t=s,e||(e=Promise.resolve().then(()=>(e=null,i(...t)))),e)}class me extends Gs{#e;isTargetDOMEl;el;parent;title;getTargetPlugin(e){let t;if(typeof e?.addTarget=="function")t=e,t instanceof me||console.warn(new Error("The provided plugin is not an instance of UIPlugin. This is an indication of a bug with the way Uppy is bundled.",{cause:{targetPlugin:t,UIPlugin:me}}));else if(typeof e=="function"){const s=e;this.uppy.iteratePlugins(n=>{n instanceof s&&(t=n)})}return t}mount(e,t){const s=t.id,n=ws(e);if(n){this.isTargetDOMEl=!0;const o=document.createElement("div");return o.classList.add("uppy-Root"),this.#e=rn(d=>{this.uppy.getPlugin(this.id)&&(zt(this.render(d,o),o),this.afterUpdate())}),this.uppy.log(`Installing ${s} to a DOM element '${e}'`),this.opts.replaceTargetContent&&(n.innerHTML=""),zt(this.render(this.uppy.getState(),o),o),this.el=o,n.appendChild(o),o.dir=this.opts.direction||ks(o)||"ltr",this.onMount(),this.el}const r=this.getTargetPlugin(e);if(r)return this.uppy.log(`Installing ${s} to ${r.id}`),this.parent=r,this.el=r.addTarget(t),this.onMount(),this.el;this.uppy.log(`Not installing ${s}`);let a=`Invalid target option given to ${s}.`;throw typeof e=="function"?a+=" The given target is not a Plugin class. Please check that you're not specifying a React Component instead of a plugin. If you are using @uppy/* packages directly, make sure you have only 1 version of @uppy/core installed: run `npm ls @uppy/core` on the command line and verify that all the versions match and are deduped correctly.":a+="If you meant to target an HTML element, please make sure that the element exists. Check that the + - - + + - + - + - + - +