From 0f6ec45821798ea84215152de0e59261e081e326 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, 23 Dec 2025 00:30:38 +0800 Subject: [PATCH] WebUI ad96b502024a963fc4a90ceb13af119fd4718983 --- webui/dist/assets/index-BqgyMq4r.js | 90 ++++++++++++++++++++++++++++ webui/dist/assets/index-BsyShrYm.css | 1 + webui/dist/assets/index-Din59EIC.css | 1 - webui/dist/assets/index-ppcjeAmG.js | 90 ---------------------------- webui/dist/index.html | 4 +- 5 files changed, 93 insertions(+), 93 deletions(-) create mode 100644 webui/dist/assets/index-BqgyMq4r.js create mode 100644 webui/dist/assets/index-BsyShrYm.css delete mode 100644 webui/dist/assets/index-Din59EIC.css delete mode 100644 webui/dist/assets/index-ppcjeAmG.js diff --git a/webui/dist/assets/index-BqgyMq4r.js b/webui/dist/assets/index-BqgyMq4r.js new file mode 100644 index 00000000..389bdaf7 --- /dev/null +++ b/webui/dist/assets/index-BqgyMq4r.js @@ -0,0 +1,90 @@ +import{r as m,j as e,L as Mr,e as la,R as Ms,b as t0,f as a0,g as l0,h as n0,k as r0,l as Xs,m as i0,n as c0,O as _g,o as o0}from"./router-9vIXuQkh.js";import{a as d0,b as u0,g as m0}from"./react-vendor-BmxF9s7Q.js";import{N as x0,c as h0,O as $r,P as f0,g as dm}from"./utils-BqoaXoQ1.js";import{L as Sg,T as kg,C as Cg,R as p0,a as Tg,V as g0,b as j0,S as Eg,c as v0,d as Mg,I as N0,e as Ag,f as b0,g as zg,h as y0,i as w0,j as _0,O as Dg,P as S0,k as Og,l as Rg,D as Lg,A as Ug,m as Bg,n as k0,o as C0,p as $g,q as T0,r as Ig,s as E0,t as M0,u as Hg,v as A0,w as z0,x as Pg,y as Gg,F as Fg,z as qg,B as D0,E as O0,G as Vg,H as R0,J as L0,K as U0,M as B0,N as $0,Q as I0,U as H0,W as P0,X as G0,Y as F0,Z as q0,_ as V0,$ as K0,a0 as Q0,a1 as Y0,a2 as Kg,a3 as J0,a4 as X0}from"./radix-extra-CTMrA3du.js";import{R as Z0,T as W0,L as ew,g as sw,C as jo,X as vo,Y as Oi,h as tw,B as um,j as No,P as aw,k as lw,l as nw}from"./charts-simvewUa.js";import{S as rw,H as Qg,O as Yg,o as iw,C as Jg,p as cw,T as Xg,D as Zg,R as ow,q as dw,I as Wg,J as uw,K as ej,L as sj,M as mw,N as tj,V as xw,Q as aj,U as lj,X as hw,Y as fw,Z as nj,_ as pw,$ as gw,a0 as rj,a1 as jw,e as ij,f as Bo,c as $o,P as Hn,d as Io,b as cn,h as vw,l as Nw,m as bw,u as Tm,r as yw,a as ww,a2 as _w,a3 as cj,a4 as Sw,a5 as kw,a6 as Cw,a7 as oj,a8 as dj,a9 as uj,aa as mj,ab as xj,ac as hj,ad as Tw}from"./radix-core-BdJoVJLV.js";import{R as _t,a as qi,C as St,b as sa,L as Os,P as ec,Z as On,F as qa,c as Ew,S as dn,d as Mw,M as on,A as Aw,D as zw,e as Rr,f as kl,T as Dw,X as _a,g as Ow,h as fj,I as Kt,i as Vt,j as wt,k as Eo,E as Vi,l as ta,m as pj,H as Rw,n as ns,o as Xt,U as Ki,p as gj,q as jj,r as Kp,K as Um,s as vj,t as Lw,u as _o,v as Uw,B as Bi,w as Rn,x as Bm,y as Bw,z as $w,G as Qt,J as Ho,N as Va,O as st,Q as Sa,V as Lr,W as $m,Y as Nj,_ as sc,$ as bj,a0 as yj,a1 as Ln,a2 as Ir,a3 as ll,a4 as ha,a5 as Hr,a6 as Im,a7 as wj,a8 as ea,a9 as Tl,aa as Un,ab as Bn,ac as Po,ad as Iw,ae as Hw,af as Pw,ag as _j,ah as So,ai as $n,aj as Gw,ak as Ur,al as Fw,am as Mo,an as Em,ao as Sj,ap as qw,aq as Vw,ar as Qp,as as Kw,at as kj,au as Qw,av as an,aw as Cj,ax as mm,ay as Yp,az as Yw,aA as xm,aB as Jw,aC as Xw,aD as Zw,aE as Ww,aF as Tj,aG as Ej,aH as Ao,aI as e1,aJ as Mj,aK as Aj,aL as s1,aM as t1,aN as Jp,aO as a1,aP as l1,aQ as n1,aR as r1}from"./icons-C3pAHJin.js";import{S as i1,p as c1,j as o1,a as d1,E as Xp,R as u1,o as m1}from"./codemirror-TZqPU532.js";import{u as zj,a as zo,s as Dj,K as Oj,P as Rj,b as Lj,D as Uj,c as Bj,S as $j,v as x1,d as Ij,C as Hj,h as h1}from"./dnd-BiPfFtVp.js";import{_ as fa,c as f1,g as Pj,D as p1,z as bo}from"./misc-CDy9pI_Y.js";import{D as g1,U as j1}from"./uppy-x-2TBvZ1.js";import{M as v1,r as N1,a as b1,b as y1}from"./markdown-CKA5gBQ9.js";import{c as w1,H as Do,P as Oo,u as _1,d as S1,R as k1,B as C1,e as T1,C as E1,M as M1,f as A1}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 hm={exports:{}},Ri={},fm={exports:{}},pm={};var Zp;function z1(){return Zp||(Zp=1,(function(l){function n(z,q){var U=z.length;z.push(q);e:for(;0>>1,$=z[L];if(0>>1;L<_e;){var pe=2*(L+1)-1,Se=z[pe],Q=pe+1,ye=z[Q];if(0>u(Se,U))Q<$&&0>u(ye,Se)?(z[L]=ye,z[Q]=U,L=Q):(z[L]=Se,z[pe]=U,L=pe);else if(Q<$&&0>u(ye,U))z[L]=ye,z[Q]=U,L=Q;else break e}}return q}function u(z,q){var U=z.sortIndex-q.sortIndex;return U!==0?U:z.id-q.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,O=!1,A=!1,_=typeof setTimeout=="function"?setTimeout:null,I=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function C(z){for(var q=i(g);q!==null;){if(q.callback===null)c(g);else if(q.startTime<=z)c(g),q.sortIndex=q.expirationTime,n(p,q);else break;q=i(g)}}function M(z){if(O=!1,C(z),!b)if(i(p)!==null)b=!0,F||(F=!0,Ne());else{var q=i(g);q!==null&&be(M,q.startTime-z)}}var F=!1,D=-1,se=5,G=-1;function me(){return A?!0:!(l.unstable_now()-Gz&&me());){var L=v.callback;if(typeof L=="function"){v.callback=null,y=v.priorityLevel;var $=L(v.expirationTime<=z);if(z=l.unstable_now(),typeof $=="function"){v.callback=$,C(z),q=!0;break s}v===i(p)&&c(p),C(z)}else c(p);v=i(p)}if(v!==null)q=!0;else{var _e=i(g);_e!==null&&be(M,_e.startTime-z),q=!1}}break e}finally{v=null,y=U,w=!1}q=void 0}}finally{q?Ne():F=!1}}}var Ne;if(typeof E=="function")Ne=function(){E(ce)};else if(typeof MessageChannel<"u"){var le=new MessageChannel,ge=le.port2;le.port1.onmessage=ce,Ne=function(){ge.postMessage(null)}}else Ne=function(){_(ce,0)};function be(z,q){D=_(function(){z(l.unstable_now())},q)}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||125L?(z.sortIndex=U,n(g,z),i(p)===null&&z===i(g)&&(O?(I(D),D=-1):O=!0,be(M,U-L))):(z.sortIndex=$,n(p,z),b||w||(b=!0,F||(F=!0,Ne()))),z},l.unstable_shouldYield=me,l.unstable_wrapCallback=function(z){var q=y;return function(){var U=y;y=q;try{return z.apply(this,arguments)}finally{y=U}}}})(pm)),pm}var Wp;function D1(){return Wp||(Wp=1,fm.exports=z1()),fm.exports}var eg;function O1(){if(eg)return Ri;eg=1;var l=D1(),n=d0(),i=u0();function c(s){var t="https://react.dev/errors/"+s;if(1$||(s.current=L[$],L[$]=null,$--)}function Se(s,t){$++,L[$]=s.current,s.current=t}var Q=_e(null),ye=_e(null),X=_e(null),he=_e(null);function Ee(s,t){switch(Se(X,t),Se(ye,s),Se(Q,null),t.nodeType){case 9:case 11:s=(s=t.documentElement)&&(s=s.namespaceURI)?pp(s):0;break;default:if(s=t.tagName,t=t.namespaceURI)t=pp(t),s=gp(t,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}pe(Q),Se(Q,s)}function Y(){pe(Q),pe(ye),pe(X)}function ie(s){s.memoizedState!==null&&Se(he,s);var t=Q.current,a=gp(t,s.type);t!==a&&(Se(ye,s),Se(Q,a))}function Ie(s){ye.current===s&&(pe(Q),pe(ye)),he.current===s&&(pe(he),Mi._currentValue=U)}var V,Z;function Oe(s){if(V===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);V=t&&t[1]||"",Z=-1)":-1o||R[r]!==ae[o]){var xe=` +`+R[r].replace(" at new "," at ");return s.displayName&&xe.includes("")&&(xe=xe.replace("",s.displayName)),xe}while(1<=r&&0<=o);break}}}finally{ze=!1,Error.prepareStackTrace=a}return(a=s?s.displayName||s.name:"")?Oe(a):""}function oe(s,t){switch(s.tag){case 26:case 27:case 5:return Oe(s.type);case 16:return Oe("Lazy");case 13:return s.child!==t&&t!==null?Oe("Suspense Fallback"):Oe("Suspense");case 19:return Oe("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 Oe("Activity");default:return""}}function ke(s){try{var t="",a=null;do t+=oe(s,a),a=s,s=s.return;while(s);return t}catch(r){return` +Error generating stack: `+r.message+` +`+r.stack}}var is=Object.prototype.hasOwnProperty,Ot=l.unstable_scheduleCallback,Zt=l.unstable_cancelCallback,$a=l.unstable_shouldYield,It=l.unstable_requestPaint,dt=l.unstable_now,P=l.unstable_getCurrentPriorityLevel,Pe=l.unstable_ImmediatePriority,qe=l.unstable_UserBlockingPriority,Je=l.unstable_NormalPriority,As=l.unstable_LowPriority,ts=l.unstable_IdlePriority,Ss=l.log,Ce=l.unstable_setDisableYieldValue,vs=null,as=null;function Ze(s){if(typeof Ss=="function"&&Ce(s),as&&typeof as.setStrictMode=="function")try{as.setStrictMode(vs,s)}catch{}}var Ns=Math.clz32?Math.clz32:Ws,ft=Math.log,Rt=Math.LN2;function Ws(s){return s>>>=0,s===0?32:31-(ft(s)/Rt|0)|0}var Ts=256,kt=262144,Lt=4194304;function ka(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 Ya(s,t,a){var r=s.pendingLanes;if(r===0)return 0;var o=0,d=s.suspendedLanes,j=s.pingedLanes;s=s.warmLanes;var S=r&134217727;return S!==0?(r=S&~d,r!==0?o=ka(r):(j&=S,j!==0?o=ka(j):a||(a=S&~s,a!==0&&(o=ka(a))))):(S=r&~d,S!==0?o=ka(S):j!==0?o=ka(j):a||(a=r&~s,a!==0&&(o=ka(a)))),o===0?0:t!==0&&t!==o&&(t&d)===0&&(d=o&-o,a=t&-t,d>=a||d===32&&(a&4194048)!==0)?t:o}function nl(s,t){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&t)===0}function Fn(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 J(){var s=Lt;return Lt<<=1,(Lt&62914560)===0&&(Lt=4194304),s}function ve(s){for(var t=[],a=0;31>a;a++)t.push(s);return t}function Me(s,t){s.pendingLanes|=t,t!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function Ls(s,t,a,r,o,d){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 S=s.entanglements,R=s.expirationTimes,ae=s.hiddenUpdates;for(a=j&~a;0"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var JN=/[\n"\\]/g;function Ta(s){return s.replace(JN,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function ld(s,t,a,r,o,d,j,S){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=""+Ca(t)):s.value!==""+Ca(t)&&(s.value=""+Ca(t)):j!=="submit"&&j!=="reset"||s.removeAttribute("value"),t!=null?nd(s,j,Ca(t)):a!=null?nd(s,j,Ca(a)):r!=null&&s.removeAttribute("value"),o==null&&d!=null&&(s.defaultChecked=!!d),o!=null&&(s.checked=o&&typeof o!="function"&&typeof o!="symbol"),S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?s.name=""+Ca(S):s.removeAttribute("name")}function ox(s,t,a,r,o,d,j,S){if(d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(s.type=d),t!=null||a!=null){if(!(d!=="submit"&&d!=="reset"||t!=null)){ad(s);return}a=a!=null?""+Ca(a):"",t=t!=null?""+Ca(t):a,S||t===s.value||(s.value=t),s.defaultValue=t}r=r??o,r=typeof r!="function"&&typeof r!="symbol"&&!!r,s.checked=S?s.checked:!!r,s.defaultChecked=!!r,j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(s.name=j),ad(s)}function nd(s,t,a){t==="number"&&ic(s.ownerDocument)===s||s.defaultValue===""+a||(s.defaultValue=""+a)}function Jn(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"),dd=!1;if(cl)try{var Qr={};Object.defineProperty(Qr,"passive",{get:function(){dd=!0}}),window.addEventListener("test",Qr,Qr),window.removeEventListener("test",Qr,Qr)}catch{dd=!1}var Ol=null,ud=null,oc=null;function px(){if(oc)return oc;var s,t=ud,a=t.length,r,o="value"in Ol?Ol.value:Ol.textContent,d=o.length;for(s=0;s=Xr),yx=" ",wx=!1;function _x(s,t){switch(s){case"keyup":return _b.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Sx(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var er=!1;function kb(s,t){switch(s){case"compositionend":return Sx(t);case"keypress":return t.which!==32?null:(wx=!0,yx);case"textInput":return s=t.data,s===yx&&wx?null:s;default:return null}}function Cb(s,t){if(er)return s==="compositionend"||!pd&&_x(s,t)?(s=px(),oc=ud=Ol=null,er=!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=Dx(a)}}function Rx(s,t){return s&&t?s===t?!0:s&&s.nodeType===3?!1:t&&t.nodeType===3?Rx(s,t.parentNode):"contains"in s?s.contains(t):s.compareDocumentPosition?!!(s.compareDocumentPosition(t)&16):!1:!1}function Lx(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var t=ic(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=ic(s.document)}return t}function vd(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 Rb=cl&&"documentMode"in document&&11>=document.documentMode,sr=null,Nd=null,si=null,bd=!1;function Ux(s,t,a){var r=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;bd||sr==null||sr!==ic(r)||(r=sr,"selectionStart"in r&&vd(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}),si&&ei(si,r)||(si=r,r=to(Nd,"onSelect"),0>=j,o-=j,Ja=1<<32-Ns(t)+o|a<os?(Cs=He,He=null):Cs=He.sibling;var Ds=ne(K,He,W[os],fe);if(Ds===null){He===null&&(He=Cs);break}s&&He&&Ds.alternate===null&&t(K,He),H=d(Ds,H,os),zs===null?Ve=Ds:zs.sibling=Ds,zs=Ds,He=Cs}if(os===W.length)return a(K,He),Es&&dl(K,os),Ve;if(He===null){for(;osos?(Cs=He,He=null):Cs=He.sibling;var tn=ne(K,He,Ds.value,fe);if(tn===null){He===null&&(He=Cs);break}s&&He&&tn.alternate===null&&t(K,He),H=d(tn,H,os),zs===null?Ve=tn:zs.sibling=tn,zs=tn,He=Cs}if(Ds.done)return a(K,He),Es&&dl(K,os),Ve;if(He===null){for(;!Ds.done;os++,Ds=W.next())Ds=je(K,Ds.value,fe),Ds!==null&&(H=d(Ds,H,os),zs===null?Ve=Ds:zs.sibling=Ds,zs=Ds);return Es&&dl(K,os),Ve}for(He=r(He);!Ds.done;os++,Ds=W.next())Ds=de(He,K,os,Ds.value,fe),Ds!==null&&(s&&Ds.alternate!==null&&He.delete(Ds.key===null?os:Ds.key),H=d(Ds,H,os),zs===null?Ve=Ds:zs.sibling=Ds,zs=Ds);return s&&He.forEach(function(s0){return t(K,s0)}),Es&&dl(K,os),Ve}function Ks(K,H,W,fe){if(typeof W=="object"&&W!==null&&W.type===O&&W.key===null&&(W=W.props.children),typeof W=="object"&&W!==null){switch(W.$$typeof){case w:e:{for(var Ve=W.key;H!==null;){if(H.key===Ve){if(Ve=W.type,Ve===O){if(H.tag===7){a(K,H.sibling),fe=o(H,W.props.children),fe.return=K,K=fe;break e}}else if(H.elementType===Ve||typeof Ve=="object"&&Ve!==null&&Ve.$$typeof===se&&Sn(Ve)===H.type){a(K,H.sibling),fe=o(H,W.props),ii(fe,W),fe.return=K,K=fe;break e}a(K,H);break}else t(K,H);H=H.sibling}W.type===O?(fe=Nn(W.props.children,K.mode,fe,W.key),fe.return=K,K=fe):(fe=vc(W.type,W.key,W.props,null,K.mode,fe),ii(fe,W),fe.return=K,K=fe)}return j(K);case b:e:{for(Ve=W.key;H!==null;){if(H.key===Ve)if(H.tag===4&&H.stateNode.containerInfo===W.containerInfo&&H.stateNode.implementation===W.implementation){a(K,H.sibling),fe=o(H,W.children||[]),fe.return=K,K=fe;break e}else{a(K,H);break}else t(K,H);H=H.sibling}fe=Td(W,K.mode,fe),fe.return=K,K=fe}return j(K);case se:return W=Sn(W),Ks(K,H,W,fe)}if(be(W))return Re(K,H,W,fe);if(Ne(W)){if(Ve=Ne(W),typeof Ve!="function")throw Error(c(150));return W=Ve.call(W),Qe(K,H,W,fe)}if(typeof W.then=="function")return Ks(K,H,kc(W),fe);if(W.$$typeof===E)return Ks(K,H,yc(K,W),fe);Cc(K,W)}return typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint"?(W=""+W,H!==null&&H.tag===6?(a(K,H.sibling),fe=o(H,W),fe.return=K,K=fe):(a(K,H),fe=Cd(W,K.mode,fe),fe.return=K,K=fe),j(K)):a(K,H)}return function(K,H,W,fe){try{ri=0;var Ve=Ks(K,H,W,fe);return mr=null,Ve}catch(He){if(He===ur||He===_c)throw He;var zs=ga(29,He,null,K.mode);return zs.lanes=fe,zs.return=K,zs}finally{}}}var Cn=rh(!0),ih=rh(!1),$l=!1;function Id(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Hd(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 Il(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function Hl(s,t,a){var r=s.updateQueue;if(r===null)return null;if(r=r.shared,(Rs&2)!==0){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,t=jc(s),Fx(s,null,a),t}return gc(s,r,t,a),jc(s)}function ci(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,Yt(s,a)}}function Pd(s,t){var a=s.updateQueue,r=s.alternate;if(r!==null&&(r=r.updateQueue,a===r)){var o=null,d=null;if(a=a.firstBaseUpdate,a!==null){do{var j={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};d===null?o=d=j:d=d.next=j,a=a.next}while(a!==null);d===null?o=d=t:d=d.next=t}else o=d=t;a={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:d,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 Gd=!1;function oi(){if(Gd){var s=dr;if(s!==null)throw s}}function di(s,t,a,r){Gd=!1;var o=s.updateQueue;$l=!1;var d=o.firstBaseUpdate,j=o.lastBaseUpdate,S=o.shared.pending;if(S!==null){o.shared.pending=null;var R=S,ae=R.next;R.next=null,j===null?d=ae:j.next=ae,j=R;var xe=s.alternate;xe!==null&&(xe=xe.updateQueue,S=xe.lastBaseUpdate,S!==j&&(S===null?xe.firstBaseUpdate=ae:S.next=ae,xe.lastBaseUpdate=R))}if(d!==null){var je=o.baseState;j=0,xe=ae=R=null,S=d;do{var ne=S.lane&-536870913,de=ne!==S.lane;if(de?(ks&ne)===ne:(r&ne)===ne){ne!==0&&ne===or&&(Gd=!0),xe!==null&&(xe=xe.next={lane:0,tag:S.tag,payload:S.payload,callback:null,next:null});e:{var Re=s,Qe=S;ne=t;var Ks=a;switch(Qe.tag){case 1:if(Re=Qe.payload,typeof Re=="function"){je=Re.call(Ks,je,ne);break e}je=Re;break e;case 3:Re.flags=Re.flags&-65537|128;case 0:if(Re=Qe.payload,ne=typeof Re=="function"?Re.call(Ks,je,ne):Re,ne==null)break e;je=v({},je,ne);break e;case 2:$l=!0}}ne=S.callback,ne!==null&&(s.flags|=64,de&&(s.flags|=8192),de=o.callbacks,de===null?o.callbacks=[ne]:de.push(ne))}else de={lane:ne,tag:S.tag,payload:S.payload,callback:S.callback,next:null},xe===null?(ae=xe=de,R=je):xe=xe.next=de,j|=ne;if(S=S.next,S===null){if(S=o.shared.pending,S===null)break;de=S,S=de.next,de.next=null,o.lastBaseUpdate=de,o.shared.pending=null}}while(!0);xe===null&&(R=je),o.baseState=R,o.firstBaseUpdate=ae,o.lastBaseUpdate=xe,d===null&&(o.shared.lanes=0),Vl|=j,s.lanes=j,s.memoizedState=je}}function ch(s,t){if(typeof s!="function")throw Error(c(191,s));s.call(t)}function oh(s,t){var a=s.callbacks;if(a!==null)for(s.callbacks=null,s=0;sd?d:8;var j=z.T,S={};z.T=S,cu(s,!1,t,a);try{var R=o(),ae=z.S;if(ae!==null&&ae(S,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var xe=Fb(R,r);xi(s,t,xe,ya(s))}else xi(s,t,r,ya(s))}catch(je){xi(s,t,{then:function(){},status:"rejected",reason:je},ya())}finally{q.p=d,j!==null&&S.types!==null&&(j.types=S.types),z.T=j}}function Jb(){}function ru(s,t,a,r){if(s.tag!==5)throw Error(c(476));var o=Hh(s).queue;Ih(s,o,t,U,a===null?Jb:function(){return Ph(s),a(r)})}function Hh(s){var t=s.memoizedState;if(t!==null)return t;t={memoizedState:U,baseState:U,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:hl,lastRenderedState:U},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:hl,lastRenderedState:a},next:null},s.memoizedState=t,s=s.alternate,s!==null&&(s.memoizedState=t),t}function Ph(s){var t=Hh(s);t.next===null&&(t=s.alternate.memoizedState),xi(s,t.next.queue,{},ya())}function iu(){return Pt(Mi)}function Gh(){return yt().memoizedState}function Fh(){return yt().memoizedState}function Xb(s){for(var t=s.return;t!==null;){switch(t.tag){case 24:case 3:var a=ya();s=Il(a);var r=Hl(t,s,a);r!==null&&(ua(r,t,a),ci(r,t,a)),t={cache:Ld()},s.payload=t;return}t=t.return}}function Zb(s,t,a){var r=ya();a={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Uc(s)?Vh(t,a):(a=Sd(s,t,a,r),a!==null&&(ua(a,s,r),Kh(a,t,r)))}function qh(s,t,a){var r=ya();xi(s,t,a,r)}function xi(s,t,a,r){var o={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Uc(s))Vh(t,o);else{var d=s.alternate;if(s.lanes===0&&(d===null||d.lanes===0)&&(d=t.lastRenderedReducer,d!==null))try{var j=t.lastRenderedState,S=d(j,a);if(o.hasEagerState=!0,o.eagerState=S,pa(S,j))return gc(s,t,o,0),Qs===null&&pc(),!1}catch{}finally{}if(a=Sd(s,t,o,r),a!==null)return ua(a,s,r),Kh(a,t,r),!0}return!1}function cu(s,t,a,r){if(r={lane:2,revertLane:Iu(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Uc(s)){if(t)throw Error(c(479))}else t=Sd(s,a,r,2),t!==null&&ua(t,s,2)}function Uc(s){var t=s.alternate;return s===cs||t!==null&&t===cs}function Vh(s,t){hr=Mc=!0;var a=s.pending;a===null?t.next=t:(t.next=a.next,a.next=t),s.pending=t}function Kh(s,t,a){if((a&4194048)!==0){var r=t.lanes;r&=s.pendingLanes,a|=r,t.lanes=a,Yt(s,a)}}var hi={readContext:Pt,use:Dc,useCallback:pt,useContext:pt,useEffect:pt,useImperativeHandle:pt,useLayoutEffect:pt,useInsertionEffect:pt,useMemo:pt,useReducer:pt,useRef:pt,useState:pt,useDebugValue:pt,useDeferredValue:pt,useTransition:pt,useSyncExternalStore:pt,useId:pt,useHostTransitionStatus:pt,useFormState:pt,useActionState:pt,useOptimistic:pt,useMemoCache:pt,useCacheRefresh:pt};hi.useEffectEvent=pt;var Qh={readContext:Pt,use:Dc,useCallback:function(s,t){return Wt().memoizedState=[s,t===void 0?null:t],s},useContext:Pt,useEffect:Ah,useImperativeHandle:function(s,t,a){a=a!=null?a.concat([s]):null,Rc(4194308,4,Rh.bind(null,t,s),a)},useLayoutEffect:function(s,t){return Rc(4194308,4,s,t)},useInsertionEffect:function(s,t){Rc(4,2,s,t)},useMemo:function(s,t){var a=Wt();t=t===void 0?null:t;var r=s();if(Tn){Ze(!0);try{s()}finally{Ze(!1)}}return a.memoizedState=[r,t],r},useReducer:function(s,t,a){var r=Wt();if(a!==void 0){var o=a(t);if(Tn){Ze(!0);try{a(t)}finally{Ze(!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=Zb.bind(null,cs,s),[r.memoizedState,s]},useRef:function(s){var t=Wt();return s={current:s},t.memoizedState=s},useState:function(s){s=su(s);var t=s.queue,a=qh.bind(null,cs,t);return t.dispatch=a,[s.memoizedState,a]},useDebugValue:lu,useDeferredValue:function(s,t){var a=Wt();return nu(a,s,t)},useTransition:function(){var s=su(!1);return s=Ih.bind(null,cs,s.queue,!0,!1),Wt().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,t,a){var r=cs,o=Wt();if(Es){if(a===void 0)throw Error(c(407));a=a()}else{if(a=t(),Qs===null)throw Error(c(349));(ks&127)!==0||fh(r,t,a)}o.memoizedState=a;var d={value:a,getSnapshot:t};return o.queue=d,Ah(gh.bind(null,r,d,s),[s]),r.flags|=2048,pr(9,{destroy:void 0},ph.bind(null,r,d,a,t),null),a},useId:function(){var s=Wt(),t=Qs.identifierPrefix;if(Es){var a=Xa,r=Ja;a=(r&~(1<<32-Ns(r)-1)).toString(32)+a,t="_"+t+"R_"+a,a=Ac++,0<\/script>",d=d.removeChild(d.firstChild);break;case"select":d=typeof r.is=="string"?j.createElement("select",{is:r.is}):j.createElement("select"),r.multiple?d.multiple=!0:r.size&&(d.size=r.size);break;default:d=typeof r.is=="string"?j.createElement(o,{is:r.is}):j.createElement(o)}}d[gs]=t,d[rs]=r;e:for(j=t.child;j!==null;){if(j.tag===5||j.tag===6)d.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=d;e:switch(Ft(d,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&&pl(t)}}return nt(t),yu(t,t.type,s===null?null:s.memoizedProps,t.pendingProps,a),null;case 6:if(s&&t.stateNode!=null)s.memoizedProps!==r&&pl(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(c(166));if(s=X.current,ir(t)){if(s=t.stateNode,a=t.memoizedProps,r=null,o=Ht,o!==null)switch(o.tag){case 27:case 5:r=o.memoizedProps}s[gs]=t,s=!!(s.nodeValue===a||r!==null&&r.suppressHydrationWarning===!0||hp(s.nodeValue,a)),s||Ul(t,!0)}else s=ao(s).createTextNode(r),s[gs]=t,t.stateNode=s}return nt(t),null;case 31:if(a=t.memoizedState,s===null||s.memoizedState!==null){if(r=ir(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 bn(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;nt(t),s=!1}else a=zd(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=a),s=!0;if(!s)return t.flags&256?(va(t),t):(va(t),null);if((t.flags&128)!==0)throw Error(c(558))}return nt(t),null;case 13:if(r=t.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(o=ir(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 bn(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;nt(t),o=!1}else o=zd(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?(va(t),t):(va(t),null)}return va(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),d=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(d=r.memoizedState.cachePool.pool),d!==o&&(r.flags|=2048)),a!==s&&a&&(t.child.flags|=8192),Pc(t,t.updateQueue),nt(t),null);case 4:return Y(),s===null&&Fu(t.stateNode.containerInfo),nt(t),null;case 10:return ml(t.type),nt(t),null;case 19:if(pe(bt),r=t.memoizedState,r===null)return nt(t),null;if(o=(t.flags&128)!==0,d=r.rendering,d===null)if(o)pi(r,!1);else{if(gt!==0||s!==null&&(s.flags&128)!==0)for(s=t.child;s!==null;){if(d=Ec(s),d!==null){for(t.flags|=128,pi(r,!1),s=d.updateQueue,t.updateQueue=s,Pc(t,s),t.subtreeFlags=0,s=a,a=t.child;a!==null;)qx(a,s),a=a.sibling;return Se(bt,bt.current&1|2),Es&&dl(t,r.treeForkCount),t.child}s=s.sibling}r.tail!==null&&dt()>Kc&&(t.flags|=128,o=!0,pi(r,!1),t.lanes=4194304)}else{if(!o)if(s=Ec(d),s!==null){if(t.flags|=128,o=!0,s=s.updateQueue,t.updateQueue=s,Pc(t,s),pi(r,!0),r.tail===null&&r.tailMode==="hidden"&&!d.alternate&&!Es)return nt(t),null}else 2*dt()-r.renderingStartTime>Kc&&a!==536870912&&(t.flags|=128,o=!0,pi(r,!1),t.lanes=4194304);r.isBackwards?(d.sibling=t.child,t.child=d):(s=r.last,s!==null?s.sibling=d:t.child=d,r.last=d)}return r.tail!==null?(s=r.tail,r.rendering=s,r.tail=s.sibling,r.renderingStartTime=dt(),s.sibling=null,a=bt.current,Se(bt,o?a&1|2:a&1),Es&&dl(t,r.treeForkCount),s):(nt(t),null);case 22:case 23:return va(t),qd(),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&&(nt(t),t.subtreeFlags&6&&(t.flags|=8192)):nt(t),a=t.updateQueue,a!==null&&Pc(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(_n),null;case 24:return a=null,s!==null&&(a=s.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),ml(Tt),nt(t),null;case 25:return null;case 30:return null}throw Error(c(156,t.tag))}function ay(s,t){switch(Md(t),t.tag){case 1:return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 3:return ml(Tt),Y(),s=t.flags,(s&65536)!==0&&(s&128)===0?(t.flags=s&-65537|128,t):null;case 26:case 27:case 5:return Ie(t),null;case 31:if(t.memoizedState!==null){if(va(t),t.alternate===null)throw Error(c(340));bn()}return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 13:if(va(t),s=t.memoizedState,s!==null&&s.dehydrated!==null){if(t.alternate===null)throw Error(c(340));bn()}return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 19:return pe(bt),null;case 4:return Y(),null;case 10:return ml(t.type),null;case 22:case 23:return va(t),qd(),s!==null&&pe(_n),s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 24:return ml(Tt),null;case 25:return null;default:return null}}function vf(s,t){switch(Md(t),t.tag){case 3:ml(Tt),Y();break;case 26:case 27:case 5:Ie(t);break;case 4:Y();break;case 31:t.memoizedState!==null&&va(t);break;case 13:va(t);break;case 19:pe(bt);break;case 10:ml(t.type);break;case 22:case 23:va(t),qd(),s!==null&&pe(_n);break;case 24:ml(Tt)}}function gi(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 d=a.create,j=a.inst;r=d(),j.destroy=r}a=a.next}while(a!==o)}}catch(S){Ps(t,t.return,S)}}function Fl(s,t,a){try{var r=t.updateQueue,o=r!==null?r.lastEffect:null;if(o!==null){var d=o.next;r=d;do{if((r.tag&s)===s){var j=r.inst,S=j.destroy;if(S!==void 0){j.destroy=void 0,o=t;var R=a,ae=S;try{ae()}catch(xe){Ps(o,R,xe)}}}r=r.next}while(r!==d)}}catch(xe){Ps(t,t.return,xe)}}function Nf(s){var t=s.updateQueue;if(t!==null){var a=s.stateNode;try{oh(t,a)}catch(r){Ps(s,s.return,r)}}}function bf(s,t,a){a.props=En(s.type,s.memoizedProps),a.state=s.memoizedState;try{a.componentWillUnmount()}catch(r){Ps(s,t,r)}}function ji(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){Ps(s,t,o)}}function Za(s,t){var a=s.ref,r=s.refCleanup;if(a!==null)if(typeof r=="function")try{r()}catch(o){Ps(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){Ps(s,t,o)}else a.current=null}function yf(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){Ps(s,s.return,o)}}function wu(s,t,a){try{var r=s.stateNode;Sy(r,s.type,a,t),r[rs]=t}catch(o){Ps(s,s.return,o)}}function wf(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Xl(s.type)||s.tag===4}function _u(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||wf(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&Xl(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 Su(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=il));else if(r!==4&&(r===27&&Xl(s.type)&&(a=s.stateNode,t=null),s=s.child,s!==null))for(Su(s,t,a),s=s.sibling;s!==null;)Su(s,t,a),s=s.sibling}function Gc(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&&Xl(s.type)&&(a=s.stateNode),s=s.child,s!==null))for(Gc(s,t,a),s=s.sibling;s!==null;)Gc(s,t,a),s=s.sibling}function _f(s){var t=s.stateNode,a=s.memoizedProps;try{for(var r=s.type,o=t.attributes;o.length;)t.removeAttributeNode(o[0]);Ft(t,r,a),t[gs]=s,t[rs]=a}catch(d){Ps(s,s.return,d)}}var gl=!1,At=!1,ku=!1,Sf=typeof WeakSet=="function"?WeakSet:Set,Bt=null;function ly(s,t){if(s=s.containerInfo,Ku=uo,s=Lx(s),vd(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,d=r.focusNode;r=r.focusOffset;try{a.nodeType,d.nodeType}catch{a=null;break e}var j=0,S=-1,R=-1,ae=0,xe=0,je=s,ne=null;s:for(;;){for(var de;je!==a||o!==0&&je.nodeType!==3||(S=j+o),je!==d||r!==0&&je.nodeType!==3||(R=j+r),je.nodeType===3&&(j+=je.nodeValue.length),(de=je.firstChild)!==null;)ne=je,je=de;for(;;){if(je===s)break s;if(ne===a&&++ae===o&&(S=j),ne===d&&++xe===r&&(R=j),(de=je.nextSibling)!==null)break;je=ne,ne=je.parentNode}je=de}a=S===-1||R===-1?null:{start:S,end:R}}else a=null}a=a||{start:0,end:0}}else a=null;for(Qu={focusedElem:s,selectionRange:a},uo=!1,Bt=t;Bt!==null;)if(t=Bt,s=t.child,(t.subtreeFlags&1028)!==0&&s!==null)s.return=t,Bt=s;else for(;Bt!==null;){switch(t=Bt,d=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"))),Ft(d,r,a),d[gs]=s,Ut(d),r=d;break e;case"link":var j=Ap("link","href",o).get(r+(a.href||""));if(j){for(var S=0;SKs&&(j=Ks,Ks=Qe,Qe=j);var K=Ox(S,Qe),H=Ox(S,Ks);if(K&&H&&(de.rangeCount!==1||de.anchorNode!==K.node||de.anchorOffset!==K.offset||de.focusNode!==H.node||de.focusOffset!==H.offset)){var W=je.createRange();W.setStart(K.node,K.offset),de.removeAllRanges(),Qe>Ks?(de.addRange(W),de.extend(H.node,H.offset)):(W.setEnd(H.node,H.offset),de.addRange(W))}}}}for(je=[],de=S;de=de.parentNode;)de.nodeType===1&&je.push({element:de,left:de.scrollLeft,top:de.scrollTop});for(typeof S.focus=="function"&&S.focus(),S=0;Sa?32:a,z.T=null,a=Du,Du=null;var d=Ql,j=yl;if(Dt=0,br=Ql=null,yl=0,(Rs&6)!==0)throw Error(c(331));var S=Rs;if(Rs|=4,Lf(d.current),Df(d,d.current,j,a),Rs=S,_i(0,!1),as&&typeof as.onPostCommitFiberRoot=="function")try{as.onPostCommitFiberRoot(vs,d)}catch{}return!0}finally{q.p=o,z.T=r,ep(s,t)}}function tp(s,t,a){t=Ma(a,t),t=mu(s.stateNode,t,2),s=Hl(s,t,2),s!==null&&(Me(s,2),Wa(s))}function Ps(s,t,a){if(s.tag===3)tp(s,s,a);else for(;t!==null;){if(t.tag===3){tp(t,s,a);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Kl===null||!Kl.has(r))){s=Ma(a,s),a=tf(2),r=Hl(t,a,2),r!==null&&(af(a,r,t,s),Me(r,2),Wa(r));break}}t=t.return}}function Uu(s,t,a){var r=s.pingCache;if(r===null){r=s.pingCache=new iy;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)||(Eu=!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,Qs===s&&(ks&a)===a&&(gt===4||gt===3&&(ks&62914560)===ks&&300>dt()-Vc?(Rs&2)===0&&yr(s,0):Mu|=a,Nr===ks&&(Nr=0)),Wa(s)}function ap(s,t){t===0&&(t=J()),s=vn(s,t),s!==null&&(Me(s,t),Wa(s))}function xy(s){var t=s.memoizedState,a=0;t!==null&&(a=t.retryLane),ap(s,a)}function hy(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),ap(s,a)}function fy(s,t){return Ot(s,t)}var Wc=null,_r=null,Bu=!1,eo=!1,$u=!1,Jl=0;function Wa(s){s!==_r&&s.next===null&&(_r===null?Wc=_r=s:_r=_r.next=s),eo=!0,Bu||(Bu=!0,gy())}function _i(s,t){if(!$u&&eo){$u=!0;do for(var a=!1,r=Wc;r!==null;){if(s!==0){var o=r.pendingLanes;if(o===0)var d=0;else{var j=r.suspendedLanes,S=r.pingedLanes;d=(1<<31-Ns(42|s)+1)-1,d&=o&~(j&~S),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(a=!0,ip(r,d))}else d=ks,d=Ya(r,r===Qs?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),(d&3)===0||nl(r,d)||(a=!0,ip(r,d));r=r.next}while(a);$u=!1}}function py(){lp()}function lp(){eo=Bu=!1;var s=0;Jl!==0&&Cy()&&(s=Jl);for(var t=dt(),a=null,r=Wc;r!==null;){var o=r.next,d=np(r,t);d===0?(r.next=null,a===null?Wc=o:a.next=o,o===null&&(_r=a)):(a=r,(s!==0||(d&3)!==0)&&(eo=!0)),r=o}Dt!==0&&Dt!==5||_i(s),Jl!==0&&(Jl=0)}function np(s,t){for(var a=s.suspendedLanes,r=s.pingedLanes,o=s.expirationTimes,d=s.pendingLanes&-62914561;0S)break;var xe=R.transferSize,je=R.initiatorType;xe&&fp(je)&&(R=R.responseEnd,j+=xe*(R"u"?null:document;function Cp(s,t,a){var r=Sr;if(r&&typeof t=="string"&&t){var o=Ta(t);o='link[rel="'+s+'"][href="'+o+'"]',typeof a=="string"&&(o+='[crossorigin="'+a+'"]'),kp.has(o)||(kp.add(o),s={rel:s,crossOrigin:a,href:t},r.querySelector(o)===null&&(t=r.createElement("link"),Ft(t,"link",s),Ut(t),r.head.appendChild(t)))}}function Ly(s){wl.D(s),Cp("dns-prefetch",s,null)}function Uy(s,t){wl.C(s,t),Cp("preconnect",s,t)}function By(s,t,a){wl.L(s,t,a);var r=Sr;if(r&&s&&t){var o='link[rel="preload"][as="'+Ta(t)+'"]';t==="image"&&a&&a.imageSrcSet?(o+='[imagesrcset="'+Ta(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(o+='[imagesizes="'+Ta(a.imageSizes)+'"]')):o+='[href="'+Ta(s)+'"]';var d=o;switch(t){case"style":d=kr(s);break;case"script":d=Cr(s)}La.has(d)||(s=v({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:s,as:t},a),La.set(d,s),r.querySelector(o)!==null||t==="style"&&r.querySelector(Ti(d))||t==="script"&&r.querySelector(Ei(d))||(t=r.createElement("link"),Ft(t,"link",s),Ut(t),r.head.appendChild(t)))}}function $y(s,t){wl.m(s,t);var a=Sr;if(a&&s){var r=t&&typeof t.as=="string"?t.as:"script",o='link[rel="modulepreload"][as="'+Ta(r)+'"][href="'+Ta(s)+'"]',d=o;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":d=Cr(s)}if(!La.has(d)&&(s=v({rel:"modulepreload",href:s},t),La.set(d,s),a.querySelector(o)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Ei(d)))return}r=a.createElement("link"),Ft(r,"link",s),Ut(r),a.head.appendChild(r)}}}function Iy(s,t,a){wl.S(s,t,a);var r=Sr;if(r&&s){var o=Qn(r).hoistableStyles,d=kr(s);t=t||"default";var j=o.get(d);if(!j){var S={loading:0,preload:null};if(j=r.querySelector(Ti(d)))S.loading=5;else{s=v({rel:"stylesheet",href:s,"data-precedence":t},a),(a=La.get(d))&&sm(s,a);var R=j=r.createElement("link");Ut(R),Ft(R,"link",s),R._p=new Promise(function(ae,xe){R.onload=ae,R.onerror=xe}),R.addEventListener("load",function(){S.loading|=1}),R.addEventListener("error",function(){S.loading|=2}),S.loading|=4,no(j,t,r)}j={type:"stylesheet",instance:j,count:1,state:S},o.set(d,j)}}}function Hy(s,t){wl.X(s,t);var a=Sr;if(a&&s){var r=Qn(a).hoistableScripts,o=Cr(s),d=r.get(o);d||(d=a.querySelector(Ei(o)),d||(s=v({src:s,async:!0},t),(t=La.get(o))&&tm(s,t),d=a.createElement("script"),Ut(d),Ft(d,"link",s),a.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},r.set(o,d))}}function Py(s,t){wl.M(s,t);var a=Sr;if(a&&s){var r=Qn(a).hoistableScripts,o=Cr(s),d=r.get(o);d||(d=a.querySelector(Ei(o)),d||(s=v({src:s,async:!0,type:"module"},t),(t=La.get(o))&&tm(s,t),d=a.createElement("script"),Ut(d),Ft(d,"link",s),a.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},r.set(o,d))}}function Tp(s,t,a,r){var o=(o=X.current)?lo(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=kr(a.href),a=Qn(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=kr(a.href);var d=Qn(o).hoistableStyles,j=d.get(s);if(j||(o=o.ownerDocument||o,j={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},d.set(s,j),(d=o.querySelector(Ti(s)))&&!d._p&&(j.instance=d,j.state.loading=5),La.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},La.set(s,a),d||Gy(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=Cr(a),a=Qn(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 kr(s){return'href="'+Ta(s)+'"'}function Ti(s){return'link[rel="stylesheet"]['+s+"]"}function Ep(s){return v({},s,{"data-precedence":s.precedence,precedence:null})}function Gy(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}),Ft(t,"link",a),Ut(t),s.head.appendChild(t))}function Cr(s){return'[src="'+Ta(s)+'"]'}function Ei(s){return"script[async]"+s}function Mp(s,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var r=s.querySelector('style[data-href~="'+Ta(a.href)+'"]');if(r)return t.instance=r,Ut(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"),Ut(r),Ft(r,"style",o),no(r,a.precedence,s),t.instance=r;case"stylesheet":o=kr(a.href);var d=s.querySelector(Ti(o));if(d)return t.state.loading|=4,t.instance=d,Ut(d),d;r=Ep(a),(o=La.get(o))&&sm(r,o),d=(s.ownerDocument||s).createElement("link"),Ut(d);var j=d;return j._p=new Promise(function(S,R){j.onload=S,j.onerror=R}),Ft(d,"link",r),t.state.loading|=4,no(d,a.precedence,s),t.instance=d;case"script":return d=Cr(a.src),(o=s.querySelector(Ei(d)))?(t.instance=o,Ut(o),o):(r=a,(o=La.get(d))&&(r=v({},a),tm(r,o)),s=s.ownerDocument||s,o=s.createElement("script"),Ut(o),Ft(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,no(r,a.precedence,s));return t.instance}function no(s,t,a){for(var r=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),o=r.length?r[r.length-1]:null,d=o,j=0;j title"):null)}function Fy(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 Dp(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function qy(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=kr(r.href),d=t.querySelector(Ti(o));if(d){t=d._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(s.count++,s=io.bind(s),t.then(s,s)),a.state.loading|=4,a.instance=d,Ut(d);return}d=t.ownerDocument||t,r=Ep(r),(o=La.get(o))&&sm(r,o),d=d.createElement("link"),Ut(d);var j=d;j._p=new Promise(function(S,R){j.onload=S,j.onerror=R}),Ft(d,"link",r),a.instance=d}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(s.count++,a=io.bind(s),t.addEventListener("load",a),t.addEventListener("error",a))}}var am=0;function Vy(s,t){return s.stylesheets&&s.count===0&&oo(s,s.stylesheets),0am?50:800)+t);return s.unsuspend=a,function(){s.unsuspend=null,clearTimeout(r),clearTimeout(o)}}:null}function io(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)oo(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var co=null;function oo(s,t){s.stylesheets=null,s.unsuspend!==null&&(s.count++,co=new Map,t.forEach(Ky,s),co=null,io.call(s))}function Ky(s,t){if(!(t.state.loading&4)){var a=co.get(s);if(a)var r=a.get(null);else{a=new Map,co.set(s,a);for(var o=s.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;d"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l)}catch(n){console.error(n)}}return l(),hm.exports=O1(),hm.exports}var L1=R1();function B(...l){return x0(h0(l))}const De=m.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:B("rounded-xl border bg-card text-card-foreground shadow",l),...n}));De.displayName="Card";const Xe=m.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:B("flex flex-col space-y-1.5 p-6",l),...n}));Xe.displayName="CardHeader";const es=m.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:B("font-semibold leading-none tracking-tight",l),...n}));es.displayName="CardTitle";const Gs=m.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:B("text-sm text-muted-foreground",l),...n}));Gs.displayName="CardDescription";const Ke=m.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:B("p-6 pt-0",l),...n}));Ke.displayName="CardContent";const Go=m.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:B("flex items-center p-6 pt-0",l),...n}));Go.displayName="CardFooter";const xa=p0,aa=m.forwardRef(({className:l,...n},i)=>e.jsx(Sg,{ref:i,className:B("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",l),...n}));aa.displayName=Sg.displayName;const ls=m.forwardRef(({className:l,...n},i)=>e.jsx(kg,{ref:i,className:B("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}));ls.displayName=kg.displayName;const ws=m.forwardRef(({className:l,...n},i)=>e.jsx(Cg,{ref:i,className:B("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}));ws.displayName=Cg.displayName;const ss=m.forwardRef(({className:l,children:n,viewportRef:i,...c},u)=>e.jsxs(Tg,{ref:u,className:B("relative overflow-hidden",l),...c,children:[e.jsx(g0,{ref:i,className:"h-full w-full rounded-[inherit]",children:n}),e.jsx(Mm,{}),e.jsx(Mm,{orientation:"horizontal"}),e.jsx(j0,{})]}));ss.displayName=Tg.displayName;const Mm=m.forwardRef(({className:l,orientation:n="vertical",...i},c)=>e.jsx(Eg,{ref:c,orientation:n,className:B("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(v0,{className:"relative flex-1 rounded-full bg-border"})}));Mm.displayName=Eg.displayName;function Ys({className:l,...n}){return e.jsx("div",{className:B("animate-pulse rounded-md bg-primary/10",l),...n})}const In=m.forwardRef(({className:l,value:n,...i},c)=>e.jsx(Mg,{ref:c,className:B("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",l),...i,children:e.jsx(N0,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(n||0)}%)`}})}));In.displayName=Mg.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 Us(){return{"Content-Type":"application/json"}}async function U1(){try{await fetch("/api/webui/auth/logout",{method:"POST",credentials:"include"})}catch(l){console.error("登出请求失败:",l)}window.location.href="/auth"}async function Qi(){try{return(await(await fetch("/api/webui/auth/check",{method:"GET",credentials:"include"})).json()).authenticated===!0}catch{return!1}}const B1={light:"",dark:".dark"},Gj=m.createContext(null);function Fj(){const l=m.useContext(Gj);if(!l)throw new Error("useChart must be used within a ");return l}const Ar=m.forwardRef(({id:l,className:n,children:i,config:c,...u},x)=>{const h=m.useId(),f=`chart-${l||h.replace(/:/g,"")}`;return e.jsx(Gj.Provider,{value:{config:c},children:e.jsxs("div",{"data-chart":f,ref:x,className:B("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($1,{id:f,config:c}),e.jsx(Z0,{children:i})]})})});Ar.displayName="Chart";const $1=({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(B1).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},Li=W0,zr=m.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}=Fj(),O=m.useMemo(()=>{if(u||!n?.length)return null;const[_]=n,I=`${y||_?.dataKey||_?.name||"value"}`,E=Am(b,_,I),C=!y&&typeof h=="string"?b[h]?.label||h:E?.label;return f?e.jsx("div",{className:B("font-medium",p),children:f(C,n)}):C?e.jsx("div",{className:B("font-medium",p),children:C}):null},[h,f,n,u,p,b,y]);if(!l||!n?.length)return null;const A=n.length===1&&c!=="dot";return e.jsxs("div",{ref:w,className:B("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:O,e.jsx("div",{className:"grid gap-1.5",children:n.filter(_=>_.type!=="none").map((_,I)=>{const E=`${v||_.name||_.dataKey||"value"}`,C=Am(b,_,E),M=N||_.payload.fill||_.color;return e.jsx("div",{className:B("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&&_?.value!==void 0&&_.name?g(_.value,_.name,_,I,_.payload):e.jsxs(e.Fragment,{children:[C?.icon?e.jsx(C.icon,{}):!x&&e.jsx("div",{className:B("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":M,"--color-border":M}}),e.jsxs("div",{className:B("flex flex-1 justify-between leading-none",A?"items-end":"items-center"),children:[e.jsxs("div",{className:"grid gap-1.5",children:[A?O:null,e.jsx("span",{className:"text-muted-foreground",children:C?.label||_.name})]}),_.value&&e.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:_.value.toLocaleString()})]})]})},_.dataKey)})})]})});zr.displayName="ChartTooltip";const I1=ew,qj=m.forwardRef(({className:l,hideIcon:n=!1,payload:i,verticalAlign:c="bottom",nameKey:u},x)=>{const{config:h}=Fj();return i?.length?e.jsx("div",{ref:x,className:B("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=Am(h,f,p);return e.jsxs("div",{className:B("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});qj.displayName="ChartLegend";function Am(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 Br=$r("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"}}),k=m.forwardRef(({className:l,variant:n,size:i,asChild:c=!1,...u},x)=>{const h=c?rw:"button";return e.jsx(h,{className:B(Br({variant:n,size:i,className:l})),ref:x,...u})});k.displayName="Button";const H1=$r("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 Ae({className:l,variant:n,...i}){return e.jsx("div",{className:B(H1({variant:n}),l),...i})}async function P1(){const l=await we("/api/webui/system/restart",{method:"POST",headers:Us()});if(!l.ok){const n=await l.json();throw new Error(n.detail||"重启失败")}return await l.json()}async function G1(){const l=await we("/api/webui/system/status",{method:"GET",headers:Us()});if(!l.ok){const n=await l.json();throw new Error(n.detail||"获取状态失败")}return await l.json()}const Er={INITIAL_DELAY:3e3,CHECK_INTERVAL:2e3,CHECK_TIMEOUT:3e3,MAX_ATTEMPTS:60,PROGRESS_INTERVAL:200,SUCCESS_REDIRECT_DELAY:1500},Vj=m.createContext(null);function Pn({children:l,onRestartComplete:n,onRestartFailed:i,healthCheckUrl:c="/api/webui/system/status",maxAttempts:u=Er.MAX_ATTEMPTS}){const[x,h]=m.useState({status:"idle",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:u}),[f,p]=m.useState({}),g=m.useCallback(()=>{f.progress&&clearInterval(f.progress),f.elapsed&&clearInterval(f.elapsed),f.check&&clearTimeout(f.check),p({})},[f]),N=m.useCallback(()=>{g(),h({status:"idle",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:u})},[g,u]),v=m.useCallback(async()=>{try{const A=new AbortController,_=setTimeout(()=>A.abort(),Er.CHECK_TIMEOUT),I=await fetch(c,{method:"GET",headers:{"Content-Type":"application/json"},credentials:"include",signal:A.signal});return clearTimeout(_),I.ok}catch{return!1}},[c]),y=m.useCallback(()=>{let A=0;const _=async()=>{if(A++,h(E=>({...E,status:"checking",checkAttempts:A})),await v())g(),h(E=>({...E,status:"success",progress:100})),setTimeout(()=>{n?.(),window.location.href="/auth"},Er.SUCCESS_REDIRECT_DELAY);else if(A>=u){g();const E=`健康检查超时 (${A}/${u})`;h(C=>({...C,status:"failed",error:E})),i?.(E)}else{const E=setTimeout(_,Er.CHECK_INTERVAL);p(C=>({...C,check:E}))}};_()},[v,g,u,n,i]),w=m.useCallback(()=>{h(A=>({...A,status:"checking",checkAttempts:0,error:void 0})),y()},[y]),b=m.useCallback(async A=>{const{delay:_=0,skipApiCall:I=!1}=A??{};if(x.status!=="idle"&&x.status!=="failed")return;if(g(),h({status:"requesting",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:u}),_>0&&await new Promise(M=>setTimeout(M,_)),I)h(M=>({...M,status:"restarting"}));else try{h(M=>({...M,status:"restarting"})),await Promise.race([P1(),new Promise(M=>setTimeout(M,5e3))])}catch{}const E=setInterval(()=>{h(M=>({...M,progress:M.progress>=90?M.progress:M.progress+1}))},Er.PROGRESS_INTERVAL),C=setInterval(()=>{h(M=>({...M,elapsedTime:M.elapsedTime+1}))},1e3);p({progress:E,elapsed:C}),setTimeout(()=>{y()},Er.INITIAL_DELAY)},[x.status,g,u,y]),O={state:x,isRestarting:x.status!=="idle",triggerRestart:b,resetState:N,retryHealthCheck:w};return e.jsx(Vj.Provider,{value:O,children:l})}function un(){const l=m.useContext(Vj);if(!l)throw new Error("useRestart must be used within a RestartProvider");return l}function F1(){try{return un()}catch{return null}}const q1=(l,n,i,c,u)=>({idle:{icon:null,title:"",description:"",tip:""},requesting:{icon:e.jsx(Os,{className:"h-16 w-16 text-primary animate-spin"}),title:c??"准备重启",description:u??"正在发送重启请求...",tip:"🔄 正在准备重启麦麦..."},restarting:{icon:e.jsx(Os,{className:"h-16 w-16 text-primary animate-spin"}),title:c??"正在重启麦麦",description:u??"请稍候,麦麦正在重启中...",tip:"🔄 配置已保存,正在重启主程序..."},checking:{icon:e.jsx(Os,{className:"h-16 w-16 text-primary animate-spin"}),title:"检查服务状态",description:`等待服务恢复... (${n}/${i})`,tip:"⏳ 正在等待服务恢复,请勿关闭页面..."},success:{icon:e.jsx(sa,{className:"h-16 w-16 text-green-500"}),title:"重启成功",description:"正在跳转到登录页面...",tip:"✅ 配置已生效,服务运行正常"},failed:{icon:e.jsx(St,{className:"h-16 w-16 text-destructive"}),title:"重启超时",description:"服务未能在预期时间内恢复",tip:"⚠️ 如果长时间无响应,请尝试手动重启"}})[l];function Gn({visible:l,onComplete:n,onFailed:i,title:c,description:u,showAnimation:x=!0,className:h}){const f=F1();return(f?f.isRestarting:l)?f?e.jsx(Kj,{state:f.state,onRetry:f.retryHealthCheck,onComplete:n,onFailed:i,title:c,description:u,showAnimation:x,className:h}):e.jsx(V1,{onComplete:n,onFailed:i,title:c,description:u,showAnimation:x,className:h}):null}function Kj({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;m.useEffect(()=>{p==="success"&&i?i():p==="failed"&&c&&c()},[p,i,c]);const w=q1(p,v,y,u,x),b=O=>{const A=Math.floor(O/60),_=O%60;return`${A}:${_.toString().padStart(2,"0")}`};return e.jsxs("div",{className:B("fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center",f),children:[h&&e.jsx(K1,{}),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(In,{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(k,{onClick:()=>window.location.reload(),variant:"default",className:"flex-1",children:[e.jsx(_t,{className:"mr-2 h-4 w-4"}),"刷新页面"]}),e.jsxs(k,{onClick:n,variant:"secondary",className:"flex-1",children:[e.jsx(qi,{className:"mr-2 h-4 w-4"}),"重试检测"]})]})]})]})}function V1({onComplete:l,onFailed:n,title:i,description:c,showAnimation:u,className:x}){const[h,f]=m.useState({status:"restarting",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:60}),p=m.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 m.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(Kj,{state:h,onRetry:p,onComplete:l,onFailed:n,title:i,description:c,showAnimation:u,className:x})}function K1(){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"})]})}function Q1(){return e.jsx(Pn,{children:e.jsx(J1,{})})}const Y1=l=>{const n=[];for(let i=0;i{try{w(!0);const L=await f0.get("https://v1.hitokoto.cn/?c=a&c=b&c=c&c=d&c=h&c=i&c=k");v({hitokoto:L.data.hitokoto,from:L.data.from||L.data.from_who||"未知"})}catch(L){console.error("获取一言失败:",L),v({hitokoto:"人生就像一盒巧克力,你永远不知道下一颗是什么味道。",from:"阿甘正传"})}finally{w(!1)}},[]),E=m.useCallback(async()=>{try{const L=await we("/api/webui/system/status");if(L.ok){const $=await L.json();O($)}else O(null)}catch(L){console.error("获取机器人状态失败:",L),O(null)}},[]),C=async()=>{await A()},M=m.useCallback(async()=>{try{const L=await we(`/api/webui/statistics/dashboard?hours=${h}`);if(L.ok){const $=await L.json();n($)}c(!1),x(100)}catch(L){console.error("Failed to fetch dashboard data:",L),c(!1),x(100)}},[h]);if(m.useEffect(()=>{if(!i)return;x(0);const L=setTimeout(()=>x(15),200),$=setTimeout(()=>x(30),800),_e=setTimeout(()=>x(45),2e3),pe=setTimeout(()=>x(60),4e3),Se=setTimeout(()=>x(75),6500),Q=setTimeout(()=>x(85),9e3),ye=setTimeout(()=>x(92),11e3);return()=>{clearTimeout(L),clearTimeout($),clearTimeout(_e),clearTimeout(pe),clearTimeout(Se),clearTimeout(Q),clearTimeout(ye)}},[i]),m.useEffect(()=>{M(),I(),E()},[M,I,E]),m.useEffect(()=>{if(!p)return;const L=setInterval(()=>{M(),E()},3e4);return()=>clearInterval(L)},[p,M,E]),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(_t,{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(In,{value:u,className:"h-2"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[u,"%"]})]})]})});const{summary:F,model_stats:D=[],hourly_data:se=[],daily_data:G=[],recent_activity:me=[]}=l,ce=F??{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},Ne=L=>{const $=Math.floor(L/3600),_e=Math.floor(L%3600/60);return`${$}小时${_e}分钟`},le=L=>{const $=L.toLocaleString("zh-CN");return L>=1e9?{display:`${(L/1e9).toFixed(2)}B`,exact:$,needsExact:!0}:L>=1e6?{display:`${(L/1e6).toFixed(2)}M`,exact:$,needsExact:!0}:L>=1e4?{display:`${(L/1e3).toFixed(1)}K`,exact:$,needsExact:!0}:L>=1e3?{display:`${(L/1e3).toFixed(2)}K`,exact:$,needsExact:!0}:{display:$,exact:$,needsExact:!1}},ge=L=>{const $=`¥${L.toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2})}`;return L>=1e6?{display:`¥${(L/1e6).toFixed(2)}M`,exact:$,needsExact:!0}:L>=1e4?{display:`¥${(L/1e3).toFixed(1)}K`,exact:$,needsExact:!0}:L>=1e3?{display:`¥${(L/1e3).toFixed(2)}K`,exact:$,needsExact:!0}:{display:$,exact:$,needsExact:!1}},be=L=>new Date(L).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),z=Y1(D.length),q=D.map((L,$)=>({name:L.model_name,value:L.request_count,fill:z[$]})),U={requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"},tokens:{label:"Tokens",color:"hsl(var(--chart-3))"}};return e.jsx(ss,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"实时监控面板"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"麦麦运行状态和统计数据一览"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(xa,{value:h.toString(),onValueChange:L=>f(Number(L)),children:e.jsxs(aa,{className:"grid grid-cols-3 w-full sm:w-auto",children:[e.jsx(ls,{value:"24",children:"24小时"}),e.jsx(ls,{value:"168",children:"7天"}),e.jsx(ls,{value:"720",children:"30天"})]})}),e.jsxs(k,{variant:p?"default":"outline",size:"sm",onClick:()=>g(!p),className:"gap-2",children:[e.jsx(_t,{className:`h-4 w-4 ${p?"animate-spin":""}`}),e.jsx("span",{className:"hidden sm:inline",children:"自动刷新"})]}),e.jsx(k,{variant:"outline",size:"sm",onClick:M,children:e.jsx(_t,{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(Ys,{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(k,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:I,disabled:y,children:e.jsx(_t,{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(De,{className:"lg:col-span-1",children:[e.jsx(Xe,{className:"pb-3",children:e.jsxs(es,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(ec,{className:"h-4 w-4"}),"麦麦状态"]})}),e.jsx(Ke,{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(Ae,{variant:"outline",className:"text-green-600 border-green-300 bg-green-50",children:[e.jsx(sa,{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(Ae,{variant:"outline",className:"text-red-600 border-red-300 bg-red-50",children:[e.jsx(St,{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:["运行 ",Ne(b.uptime)]})]})]})})]}),e.jsxs(De,{children:[e.jsx(Xe,{className:"pb-3",children:e.jsxs(es,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(On,{className:"h-4 w-4"}),"快速操作"]})}),e.jsx(Ke,{children:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(k,{variant:"outline",size:"sm",onClick:C,disabled:_,className:"gap-2",children:[e.jsx(qi,{className:`h-4 w-4 ${_?"animate-spin":""}`}),_?"重启中...":"重启麦麦"]}),e.jsx(k,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Mr,{to:"/logs",children:[e.jsx(qa,{className:"h-4 w-4"}),"查看日志"]})}),e.jsx(k,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Mr,{to:"/plugins",children:[e.jsx(Ew,{className:"h-4 w-4"}),"插件管理"]})}),e.jsx(k,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Mr,{to:"/settings",children:[e.jsx(dn,{className:"h-4 w-4"}),"系统设置"]})})]})})]}),e.jsxs(De,{children:[e.jsxs(Xe,{className:"pb-3",children:[e.jsxs(es,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Mw,{className:"h-4 w-4"}),"反馈问卷"]}),e.jsx(Gs,{className:"text-xs",children:"帮助我们改进产品体验"})]}),e.jsx(Ke,{children:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(k,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Mr,{to:"/survey/webui-feedback",children:[e.jsx(qa,{className:"h-4 w-4"}),"WebUI 反馈"]})}),e.jsx(k,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Mr,{to:"/survey/maibot-feedback",children:[e.jsx(on,{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(De,{children:[e.jsxs(Xe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(es,{className:"text-sm font-medium",children:"总请求数"}),e.jsx(Aw,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ke,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[le(ce.total_requests).display,le(ce.total_requests).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",le(ce.total_requests).exact,")"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["最近",h<48?h+"小时":Math.floor(h/24)+"天"]})]})]}),e.jsxs(De,{children:[e.jsxs(Xe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(es,{className:"text-sm font-medium",children:"总花费"}),e.jsx(zw,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ke,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[ge(ce.total_cost).display,ge(ce.total_cost).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",ge(ce.total_cost).exact,")"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:ce.cost_per_hour>0?`¥${ce.cost_per_hour.toFixed(2)}/小时`:"暂无数据"})]})]}),e.jsxs(De,{children:[e.jsxs(Xe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(es,{className:"text-sm font-medium",children:"Token消耗"}),e.jsx(Rr,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ke,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[le(ce.total_tokens).display,le(ce.total_tokens).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",le(ce.total_tokens).exact,")"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:ce.tokens_per_hour>0?`${le(ce.tokens_per_hour).display}/小时`:"暂无数据"})]})]}),e.jsxs(De,{children:[e.jsxs(Xe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(es,{className:"text-sm font-medium",children:"平均响应"}),e.jsx(On,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ke,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[ce.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(De,{children:[e.jsxs(Xe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(es,{className:"text-sm font-medium",children:"在线时长"}),e.jsx(kl,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(Ke,{children:e.jsxs("div",{className:"text-xl font-bold",children:[Ne(ce.online_time),e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",ce.online_time.toLocaleString(),"秒)"]})]})})]}),e.jsxs(De,{children:[e.jsxs(Xe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(es,{className:"text-sm font-medium",children:"消息处理"}),e.jsx(on,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ke,{children:[e.jsxs("div",{className:"text-xl font-bold",children:[le(ce.total_messages).display,le(ce.total_messages).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",le(ce.total_messages).exact,")"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["回复 ",le(ce.total_replies).display,le(ce.total_replies).needsExact&&e.jsxs("span",{children:["(",le(ce.total_replies).exact,")"]})," 条"]})]})]}),e.jsxs(De,{children:[e.jsxs(Xe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(es,{className:"text-sm font-medium",children:"成本效率"}),e.jsx(Dw,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ke,{children:[e.jsx("div",{className:"text-xl font-bold",children:ce.total_messages>0?`¥${(ce.total_cost/ce.total_messages*100).toFixed(2)}`:"¥0.00"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"每100条消息"})]})]})]}),e.jsxs(xa,{defaultValue:"trends",className:"space-y-4",children:[e.jsxs(aa,{className:"grid w-full grid-cols-2 sm:grid-cols-4",children:[e.jsx(ls,{value:"trends",children:"趋势"}),e.jsx(ls,{value:"models",children:"模型"}),e.jsx(ls,{value:"activity",children:"活动"}),e.jsx(ls,{value:"daily",children:"日统计"})]}),e.jsxs(ws,{value:"trends",className:"space-y-4",children:[e.jsxs(De,{children:[e.jsxs(Xe,{children:[e.jsx(es,{children:"请求趋势"}),e.jsxs(Gs,{children:["最近",h,"小时的请求量变化"]})]}),e.jsx(Ke,{children:e.jsx(Ar,{config:U,className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:e.jsxs(sw,{data:se,children:[e.jsx(jo,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(vo,{dataKey:"timestamp",tickFormatter:L=>be(L),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Oi,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Li,{content:e.jsx(zr,{labelFormatter:L=>be(L)})}),e.jsx(tw,{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(De,{children:[e.jsxs(Xe,{children:[e.jsx(es,{children:"花费趋势"}),e.jsx(Gs,{children:"API调用成本变化"})]}),e.jsx(Ke,{children:e.jsx(Ar,{config:U,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:e.jsxs(um,{data:se,children:[e.jsx(jo,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(vo,{dataKey:"timestamp",tickFormatter:L=>be(L),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Oi,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Li,{content:e.jsx(zr,{labelFormatter:L=>be(L)})}),e.jsx(No,{dataKey:"cost",fill:"var(--color-cost)"})]})})})]}),e.jsxs(De,{children:[e.jsxs(Xe,{children:[e.jsx(es,{children:"Token消耗"}),e.jsx(Gs,{children:"Token使用量变化"})]}),e.jsx(Ke,{children:e.jsx(Ar,{config:U,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:e.jsxs(um,{data:se,children:[e.jsx(jo,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(vo,{dataKey:"timestamp",tickFormatter:L=>be(L),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Oi,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Li,{content:e.jsx(zr,{labelFormatter:L=>be(L)})}),e.jsx(No,{dataKey:"tokens",fill:"var(--color-tokens)"})]})})})]})]})]}),e.jsx(ws,{value:"models",className:"space-y-4",children:e.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[e.jsxs(De,{children:[e.jsxs(Xe,{children:[e.jsx(es,{children:"模型请求分布"}),e.jsxs(Gs,{children:["各模型使用占比 (共 ",D.length," 个模型)"]})]}),e.jsx(Ke,{children:e.jsx(Ar,{config:Object.fromEntries(D.map((L,$)=>[L.model_name,{label:L.model_name,color:z[$]}])),className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:e.jsxs(aw,{children:[e.jsx(Li,{content:e.jsx(zr,{})}),e.jsx(lw,{data:q,cx:"50%",cy:"50%",labelLine:!1,label:({name:L,percent:$})=>$&&$<.05?"":`${L} ${$?($*100).toFixed(0):0}%`,outerRadius:100,dataKey:"value",children:q.map((L,$)=>e.jsx(nw,{fill:L.fill},`cell-${$}`))})]})})})]}),e.jsxs(De,{children:[e.jsxs(Xe,{children:[e.jsx(es,{children:"模型详细统计"}),e.jsx(Gs,{children:"请求数、花费和性能"})]}),e.jsx(Ke,{children:e.jsx(ss,{className:"h-[300px] sm:h-[400px]",children:e.jsx("div",{className:"space-y-3",children:D.map((L,$)=>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:L.model_name}),e.jsx("div",{className:"w-3 h-3 rounded-full ml-2 flex-shrink-0",style:{backgroundColor:`hsl(var(--chart-${$%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:L.request_count.toLocaleString()})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"花费:"}),e.jsxs("span",{className:"ml-1 font-medium",children:["¥",L.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:[(L.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:[L.avg_response_time.toFixed(2),"s"]})]})]})]},$))})})})]})]})}),e.jsx(ws,{value:"activity",children:e.jsxs(De,{children:[e.jsxs(Xe,{children:[e.jsx(es,{children:"最近活动"}),e.jsx(Gs,{children:"最新的API调用记录"})]}),e.jsx(Ke,{children:e.jsx(ss,{className:"h-[400px] sm:h-[500px]",children:e.jsx("div",{className:"space-y-2",children:me.map((L,$)=>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:L.model}),e.jsx("div",{className:"text-xs text-muted-foreground",children:L.request_type})]}),e.jsx("div",{className:"text-xs text-muted-foreground flex-shrink-0",children:be(L.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:L.tokens})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"花费:"}),e.jsxs("span",{className:"ml-1",children:["¥",L.cost.toFixed(4)]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"耗时:"}),e.jsxs("span",{className:"ml-1",children:[L.time_cost.toFixed(2),"s"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"状态:"}),e.jsx("span",{className:`ml-1 ${L.status==="success"?"text-green-600":"text-red-600"}`,children:L.status})]})]})]},$))})})})]})}),e.jsx(ws,{value:"daily",children:e.jsxs(De,{children:[e.jsxs(Xe,{children:[e.jsx(es,{children:"每日统计"}),e.jsx(Gs,{children:"最近7天的数据汇总"})]}),e.jsx(Ke,{children:e.jsx(Ar,{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(um,{data:G,children:[e.jsx(jo,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(vo,{dataKey:"timestamp",tickFormatter:L=>{const $=new Date(L);return`${$.getMonth()+1}/${$.getDate()}`},stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Oi,{yAxisId:"left",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Oi,{yAxisId:"right",orientation:"right",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Li,{content:e.jsx(zr,{labelFormatter:L=>new Date(L).toLocaleDateString("zh-CN")})}),e.jsx(I1,{content:e.jsx(qj,{})}),e.jsx(No,{yAxisId:"left",dataKey:"requests",fill:"var(--color-requests)"}),e.jsx(No,{yAxisId:"right",dataKey:"cost",fill:"var(--color-cost)"})]})})})]})})]}),e.jsx(Gn,{})]})})}const X1={theme:"system",setTheme:()=>null},Qj=m.createContext(X1),Hm=()=>{const l=m.useContext(Qj);if(l===void 0)throw new Error("useTheme must be used within a ThemeProvider");return l},Z1=(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)"})})},Yj=m.createContext(void 0),Jj=()=>{const l=m.useContext(Yj);if(l===void 0)throw new Error("useAnimation must be used within an AnimationProvider");return l},Fe=m.forwardRef(({className:l,...n},i)=>e.jsx(Ag,{className:B("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:B("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=Ag.displayName;const W1=$r("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),T=m.forwardRef(({className:l,...n},i)=>e.jsx(Qg,{ref:i,className:B(W1(),l),...n}));T.displayName=Qg.displayName;const re=m.forwardRef(({className:l,type:n,...i},c)=>e.jsx("input",{type:n,className:B("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}));re.displayName="Input";const e2=5,s2=5e3;let gm=0;function t2(){return gm=(gm+1)%Number.MAX_SAFE_INTEGER,gm.toString()}const jm=new Map,tg=l=>{if(jm.has(l))return;const n=setTimeout(()=>{jm.delete(l),Pi({type:"REMOVE_TOAST",toastId:l})},s2);jm.set(l,n)},a2=(l,n)=>{switch(n.type){case"ADD_TOAST":return{...l,toasts:[n.toast,...l.toasts].slice(0,e2)};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?tg(i):l.toasts.forEach(c=>{tg(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)}}},ko=[];let Co={toasts:[]};function Pi(l){Co=a2(Co,l),ko.forEach(n=>{n(Co)})}function qt({...l}){const n=t2(),i=u=>Pi({type:"UPDATE_TOAST",toast:{...u,id:n}}),c=()=>Pi({type:"DISMISS_TOAST",toastId:n});return Pi({type:"ADD_TOAST",toast:{...l,id:n,open:!0,onOpenChange:u=>{u||c()}}}),{id:n,dismiss:c,update:i}}function Zs(){const[l,n]=m.useState(Co);return m.useEffect(()=>(ko.push(n),()=>{const i=ko.indexOf(n);i>-1&&ko.splice(i,1)}),[l]),{...l,toast:qt,dismiss:i=>Pi({type:"DISMISS_TOAST",toastId:i})}}const l2=[{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 n2(l){const n=l2.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 Fo="0.12.0",Pm="MaiBot Dashboard",r2=`${Pm} v${Fo}`,i2=(l="v")=>`${l}${Fo}`,ma={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"},sl={theme:"system",accentColor:"blue",enableAnimations:!0,enableWavesBackground:!0,logCacheSize:1e3,logAutoScroll:!0,logFontSize:"xs",logLineSpacing:4,dataSyncInterval:30,wsReconnectInterval:3e3,wsMaxReconnectAttempts:10};function vt(l){const n=Xj(l),i=localStorage.getItem(n);if(i===null)return sl[l];const c=sl[l];if(typeof c=="boolean")return i==="true";if(typeof c=="number"){const u=parseFloat(i);return isNaN(u)?c:u}return i}function Dr(l,n){const i=Xj(l);localStorage.setItem(i,String(n)),window.dispatchEvent(new CustomEvent("maibot-settings-change",{detail:{key:l,value:n}}))}function c2(){return{theme:vt("theme"),accentColor:vt("accentColor"),enableAnimations:vt("enableAnimations"),enableWavesBackground:vt("enableWavesBackground"),logCacheSize:vt("logCacheSize"),logAutoScroll:vt("logAutoScroll"),logFontSize:vt("logFontSize"),logLineSpacing:vt("logLineSpacing"),dataSyncInterval:vt("dataSyncInterval"),wsReconnectInterval:vt("wsReconnectInterval"),wsMaxReconnectAttempts:vt("wsMaxReconnectAttempts")}}function o2(){const l=c2(),n=localStorage.getItem(ma.COMPLETED_TOURS),i=n?JSON.parse(n):[];return{...l,completedTours:i}}function d2(l){const n=[],i=[];for(const[c,u]of Object.entries(l)){if(c==="completedTours"){Array.isArray(u)?(localStorage.setItem(ma.COMPLETED_TOURS,JSON.stringify(u)),n.push("completedTours")):i.push("completedTours");continue}if(c in sl){const x=c,h=sl[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}Dr(x,u),n.push(c)}else i.push(c)}else i.push(c)}return{success:n.length>0,imported:n,skipped:i}}function u2(){for(const l of Object.keys(sl))Dr(l,sl[l]);localStorage.removeItem(ma.COMPLETED_TOURS),window.dispatchEvent(new CustomEvent("maibot-settings-reset"))}function m2(){const l=[],n=[],i=[];for(let c=0;cc.size-i.size),{used:l,items:localStorage.length,details:n}}function x2(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 Xj(l){return{theme:ma.THEME,accentColor:ma.ACCENT_COLOR,enableAnimations:ma.ENABLE_ANIMATIONS,enableWavesBackground:ma.ENABLE_WAVES_BACKGROUND,logCacheSize:ma.LOG_CACHE_SIZE,logAutoScroll:ma.LOG_AUTO_SCROLL,logFontSize:ma.LOG_FONT_SIZE,logLineSpacing:ma.LOG_LINE_SPACING,dataSyncInterval:ma.DATA_SYNC_INTERVAL,wsReconnectInterval:ma.WS_RECONNECT_INTERVAL,wsMaxReconnectAttempts:ma.WS_MAX_RECONNECT_ATTEMPTS}[l]}const wa=m.forwardRef(({className:l,...n},i)=>e.jsxs(zg,{ref:i,className:B("relative flex w-full touch-none select-none items-center",l),...n,children:[e.jsx(y0,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:e.jsx(w0,{className:"absolute h-full bg-primary"})}),e.jsx(_0,{className:"block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"})]}));wa.displayName=zg.displayName;class h2{ws=null;reconnectTimeout=null;reconnectAttempts=0;heartbeatInterval=null;logCallbacks=new Set;connectionCallbacks=new Set;isConnected=!1;logCache=[];getMaxCacheSize(){return vt("logCacheSize")}getMaxReconnectAttempts(){return vt("wsMaxReconnectAttempts")}getReconnectInterval(){return vt("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 Qi()){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 zn=new h2;typeof window<"u"&&setTimeout(()=>{zn.connect()},100);const Fs=ow,qo=dw,f2=iw,Zj=m.forwardRef(({className:l,...n},i)=>e.jsx(Yg,{ref:i,className:B("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}));Zj.displayName=Yg.displayName;const Bs=m.forwardRef(({className:l,children:n,preventOutsideClose:i=!1,...c},u)=>e.jsxs(f2,{children:[e.jsx(Zj,{}),e.jsxs(Jg,{ref:u,className:B("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(cw,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(_a,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Bs.displayName=Jg.displayName;const $s=({className:l,...n})=>e.jsx("div",{className:B("flex flex-col space-y-1.5 text-center sm:text-left",l),...n});$s.displayName="DialogHeader";const ot=({className:l,...n})=>e.jsx("div",{className:B("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",l),...n});ot.displayName="DialogFooter";const Is=m.forwardRef(({className:l,...n},i)=>e.jsx(Xg,{ref:i,className:B("text-lg font-semibold leading-none tracking-tight",l),...n}));Is.displayName=Xg.displayName;const tt=m.forwardRef(({className:l,...n},i)=>e.jsx(Zg,{ref:i,className:B("text-sm text-muted-foreground",l),...n}));tt.displayName=Zg.displayName;const js=k0,Nt=C0,p2=S0,Wj=m.forwardRef(({className:l,...n},i)=>e.jsx(Dg,{className:B("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}));Wj.displayName=Dg.displayName;const ds=m.forwardRef(({className:l,...n},i)=>e.jsxs(p2,{children:[e.jsx(Wj,{}),e.jsx(Og,{ref:i,className:B("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=Og.displayName;const us=({className:l,...n})=>e.jsx("div",{className:B("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:B("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",l),...n});ms.displayName="AlertDialogFooter";const xs=m.forwardRef(({className:l,...n},i)=>e.jsx(Rg,{ref:i,className:B("text-lg font-semibold",l),...n}));xs.displayName=Rg.displayName;const hs=m.forwardRef(({className:l,...n},i)=>e.jsx(Lg,{ref:i,className:B("text-sm text-muted-foreground",l),...n}));hs.displayName=Lg.displayName;const fs=m.forwardRef(({className:l,variant:n,...i},c)=>e.jsx(Ug,{ref:c,className:B(Br({variant:n}),l),...i}));fs.displayName=Ug.displayName;const ps=m.forwardRef(({className:l,...n},i)=>e.jsx(Bg,{ref:i,className:B(Br({variant:"outline"}),"mt-2 sm:mt-0",l),...n}));ps.displayName=Bg.displayName;function g2(){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(xa,{defaultValue:"appearance",className:"w-full",children:[e.jsxs(aa,{className:"grid w-full grid-cols-2 sm:grid-cols-4 gap-0.5 sm:gap-1 h-auto p-1",children:[e.jsxs(ls,{value:"appearance",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(Ow,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"外观"})]}),e.jsxs(ls,{value:"security",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(fj,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"安全"})]}),e.jsxs(ls,{value:"other",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(dn,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"其他"})]}),e.jsxs(ls,{value:"about",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(Kt,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"关于"})]})]}),e.jsxs(ss,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[e.jsx(ws,{value:"appearance",className:"mt-0",children:e.jsx(j2,{})}),e.jsx(ws,{value:"security",className:"mt-0",children:e.jsx(v2,{})}),e.jsx(ws,{value:"other",className:"mt-0",children:e.jsx(N2,{})}),e.jsx(ws,{value:"about",className:"mt-0",children:e.jsx(b2,{})})]})]})]})}function lg(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");m.useEffect(()=>{const g=localStorage.getItem("accent-color")||"blue";lg(g)},[]);const p=g=>{f(g),localStorage.setItem("accent-color",g),lg(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(vm,{value:"light",current:l,onChange:n,label:"浅色",description:"始终使用浅色主题"}),e.jsx(vm,{value:"dark",current:l,onChange:n,label:"深色",description:"始终使用深色主题"}),e.jsx(vm,{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(Ua,{value:"blue",current:h,onChange:p,label:"蓝色",colorClass:"bg-blue-500"}),e.jsx(Ua,{value:"purple",current:h,onChange:p,label:"紫色",colorClass:"bg-purple-500"}),e.jsx(Ua,{value:"green",current:h,onChange:p,label:"绿色",colorClass:"bg-green-500"}),e.jsx(Ua,{value:"orange",current:h,onChange:p,label:"橙色",colorClass:"bg-orange-500"}),e.jsx(Ua,{value:"pink",current:h,onChange:p,label:"粉色",colorClass:"bg-pink-500"}),e.jsx(Ua,{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(Ua,{value:"gradient-sunset",current:h,onChange:p,label:"日落",colorClass:"bg-gradient-to-r from-orange-500 to-pink-500"}),e.jsx(Ua,{value:"gradient-ocean",current:h,onChange:p,label:"海洋",colorClass:"bg-gradient-to-r from-blue-500 to-cyan-500"}),e.jsx(Ua,{value:"gradient-forest",current:h,onChange:p,label:"森林",colorClass:"bg-gradient-to-r from-green-500 to-emerald-500"}),e.jsx(Ua,{value:"gradient-aurora",current:h,onChange:p,label:"极光",colorClass:"bg-gradient-to-r from-purple-500 to-pink-500"}),e.jsx(Ua,{value:"gradient-fire",current:h,onChange:p,label:"烈焰",colorClass:"bg-gradient-to-r from-red-500 to-orange-500"}),e.jsx(Ua,{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(re,{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(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(T,{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 v2(){const l=la(),[n,i]=m.useState(""),[c,u]=m.useState(""),[x,h]=m.useState(!1),[f,p]=m.useState(!1),[g,N]=m.useState(!1),[v,y]=m.useState(!1),[w,b]=m.useState(!1),[O,A]=m.useState(!1),[_,I]=m.useState(""),[E,C]=m.useState(!1),{toast:M}=Zs(),F=m.useMemo(()=>n2(c),[c]),D=async le=>{if(!n){M({title:"无法复制",description:"Token 存储在安全 Cookie 中,请重新生成以获取新 Token",variant:"destructive"});return}try{await navigator.clipboard.writeText(le),b(!0),M({title:"复制成功",description:"Token 已复制到剪贴板"}),setTimeout(()=>b(!1),2e3)}catch{M({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},se=async()=>{if(!c.trim()){M({title:"输入错误",description:"请输入新的 Token",variant:"destructive"});return}if(!F.isValid){const le=F.rules.filter(ge=>!ge.passed).map(ge=>ge.label).join(", ");M({title:"格式错误",description:`Token 不符合要求: ${le}`,variant:"destructive"});return}N(!0);try{const le=await fetch("/api/webui/auth/update",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({new_token:c.trim()})}),ge=await le.json();le.ok&&ge.success?(u(""),i(c.trim()),M({title:"更新成功",description:"Access Token 已更新,即将跳转到登录页"}),setTimeout(()=>{l({to:"/auth"})},1500)):M({title:"更新失败",description:ge.message||"无法更新 Token",variant:"destructive"})}catch(le){console.error("更新 Token 错误:",le),M({title:"更新失败",description:"连接服务器失败",variant:"destructive"})}finally{N(!1)}},G=async()=>{y(!0);try{const le=await fetch("/api/webui/auth/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"}),ge=await le.json();le.ok&&ge.success?(i(ge.token),I(ge.token),A(!0),C(!1),M({title:"生成成功",description:"新的 Access Token 已生成,请及时保存"})):M({title:"生成失败",description:ge.message||"无法生成新 Token",variant:"destructive"})}catch(le){console.error("生成 Token 错误:",le),M({title:"生成失败",description:"连接服务器失败",variant:"destructive"})}finally{y(!1)}},me=async()=>{try{await navigator.clipboard.writeText(_),C(!0),M({title:"复制成功",description:"Token 已复制到剪贴板"})}catch{M({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},ce=()=>{A(!1),setTimeout(()=>{I(""),C(!1)},300),setTimeout(()=>{l({to:"/auth"})},500)},Ne=le=>{le||ce()};return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsx(Fs,{open:O,onOpenChange:Ne,children:e.jsxs(Bs,{className:"sm:max-w-md",children:[e.jsxs($s,{children:[e.jsxs(Is,{className:"flex items-center gap-2",children:[e.jsx(Vt,{className:"h-5 w-5 text-yellow-500"}),"新的 Access Token"]}),e.jsx(tt,{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:_})]}),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(Vt,{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(ot,{className:"gap-2 sm:gap-0",children:[e.jsx(k,{variant:"outline",onClick:me,className:"gap-2",children:E?e.jsxs(e.Fragment,{children:[e.jsx(wt,{className:"h-4 w-4 text-green-500"}),"已复制"]}):e.jsxs(e.Fragment,{children:[e.jsx(Eo,{className:"h-4 w-4"}),"复制 Token"]})}),e.jsx(k,{onClick:ce,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(re,{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):M({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(Vi,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(ta,{className:"h-4 w-4 text-muted-foreground"})})]}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[e.jsx(k,{variant:"outline",size:"icon",onClick:()=>D(n),title:"复制到剪贴板",className:"flex-shrink-0",disabled:!n,children:w?e.jsx(wt,{className:"h-4 w-4 text-green-500"}):e.jsx(Eo,{className:"h-4 w-4"})}),e.jsxs(js,{children:[e.jsx(Nt,{asChild:!0,children:e.jsxs(k,{variant:"outline",disabled:v,className:"gap-2 flex-1 sm:flex-none",children:[e.jsx(_t,{className:B("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:G,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(re,{id:"new-token",type:f?"text":"password",value:c,onChange:le=>u(le.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(Vi,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(ta,{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(le=>e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[le.passed?e.jsx(sa,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):e.jsx(pj,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:B(le.passed?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:le.label})]},le.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(wt,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:"Token 格式正确,可以使用"})]})})]})]}),e.jsx(k,{onClick:se,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 N2(){const l=la(),{toast:n}=Zs(),[i,c]=m.useState(!1),[u,x]=m.useState(!1),[h,f]=m.useState(()=>vt("logCacheSize")),[p,g]=m.useState(()=>vt("wsReconnectInterval")),[N,v]=m.useState(()=>vt("wsMaxReconnectAttempts")),[y,w]=m.useState(()=>vt("dataSyncInterval")),[b,O]=m.useState(()=>ag()),[A,_]=m.useState(!1),[I,E]=m.useState(!1),C=m.useRef(null);if(u)throw new Error("这是一个手动触发的测试错误,用于验证错误边界组件是否正常工作。");const M=()=>{O(ag())},F=z=>{const q=z[0];f(q),Dr("logCacheSize",q)},D=z=>{const q=z[0];g(q),Dr("wsReconnectInterval",q)},se=z=>{const q=z[0];v(q),Dr("wsMaxReconnectAttempts",q)},G=z=>{const q=z[0];w(q),Dr("dataSyncInterval",q)},me=()=>{zn.clearLogs(),n({title:"日志已清除",description:"日志缓存已清空"})},ce=()=>{const z=m2();M(),n({title:"缓存已清除",description:`已清除 ${z.clearedKeys.length} 项缓存数据`})},Ne=()=>{_(!0);try{const z=o2(),q=JSON.stringify(z,null,2),U=new Blob([q],{type:"application/json"}),L=URL.createObjectURL(U),$=document.createElement("a");$.href=L,$.download=`maibot-webui-settings-${new Date().toISOString().slice(0,10)}.json`,document.body.appendChild($),$.click(),document.body.removeChild($),URL.revokeObjectURL(L),n({title:"导出成功",description:"设置已导出为 JSON 文件"})}catch(z){console.error("导出设置失败:",z),n({title:"导出失败",description:"无法导出设置",variant:"destructive"})}finally{_(!1)}},le=z=>{const q=z.target.files?.[0];if(!q)return;E(!0);const U=new FileReader;U.onload=L=>{try{const $=L.target?.result,_e=JSON.parse($),pe=d2(_e);pe.success?(f(vt("logCacheSize")),g(vt("wsReconnectInterval")),v(vt("wsMaxReconnectAttempts")),w(vt("dataSyncInterval")),M(),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($){console.error("导入设置失败:",$),n({title:"导入失败",description:"文件格式无效",variant:"destructive"})}finally{E(!1),C.current&&(C.current.value="")}},U.readAsText(q)},ge=()=>{u2(),f(sl.logCacheSize),g(sl.wsReconnectInterval),v(sl.wsMaxReconnectAttempts),w(sl.dataSyncInterval),M(),n({title:"已重置",description:"所有设置已恢复为默认值,刷新页面以应用更改"})},be=async()=>{c(!0);try{const z=await we("/api/webui/setup/reset",{method:"POST"}),q=await z.json();z.ok&&q.success?(n({title:"重置成功",description:"即将进入初次配置向导"}),setTimeout(()=>{l({to:"/setup"})},1e3)):n({title:"重置失败",description:q.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(Rr,{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(Rw,{className:"h-4 w-4"}),"本地存储使用"]}),e.jsx(k,{variant:"ghost",size:"sm",onClick:M,className:"h-7 px-2",children:e.jsx(_t,{className:"h-3 w-3"})})]}),e.jsx("div",{className:"text-2xl font-bold text-primary",children:x2(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(T,{className:"text-sm font-medium",children:"日志缓存大小"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[h," 条"]})]}),e.jsx(wa,{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(T,{className:"text-sm font-medium",children:"首页数据刷新间隔"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[y," 秒"]})]}),e.jsx(wa,{value:[y],onValueChange:G,min:10,max:120,step:5,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"控制首页统计数据的自动刷新间隔"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-sm font-medium",children:"WebSocket 重连间隔"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[p/1e3," 秒"]})]}),e.jsx(wa,{value:[p],onValueChange:D,min:1e3,max:1e4,step:500,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"日志 WebSocket 连接断开后的重连基础间隔"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-sm font-medium",children:"WebSocket 最大重连次数"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[N," 次"]})]}),e.jsx(wa,{value:[N],onValueChange:se,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(k,{variant:"outline",size:"sm",onClick:me,className:"gap-2",children:[e.jsx(ns,{className:"h-4 w-4"}),"清除日志缓存"]}),e.jsxs(js,{children:[e.jsx(Nt,{asChild:!0,children:e.jsxs(k,{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:ce,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(Xt,{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(k,{variant:"outline",onClick:Ne,disabled:A,className:"gap-2",children:[e.jsx(Xt,{className:"h-4 w-4"}),A?"导出中...":"导出设置"]}),e.jsx("input",{ref:C,type:"file",accept:".json",onChange:le,className:"hidden"}),e.jsxs(k,{variant:"outline",onClick:()=>C.current?.click(),disabled:I,className:"gap-2",children:[e.jsx(Ki,{className:"h-4 w-4"}),I?"导入中...":"导入设置"]})]}),e.jsx("div",{className:"pt-2 border-t",children:e.jsxs(js,{children:[e.jsx(Nt,{asChild:!0,children:e.jsxs(k,{variant:"outline",size:"sm",className:"gap-2 text-destructive hover:text-destructive",children:[e.jsx(qi,{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:ge,children:"确认重置"})]})]})]})})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"配置向导"}),e.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[e.jsx("div",{className:"space-y-2",children:e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"重新进行初次配置向导,可以帮助您重新设置系统的基础配置。"})}),e.jsxs(js,{children:[e.jsx(Nt,{asChild:!0,children:e.jsxs(k,{variant:"outline",disabled:i,className:"gap-2",children:[e.jsx(qi,{className:B("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:be,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(Vt,{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(js,{children:[e.jsx(Nt,{asChild:!0,children:e.jsxs(k,{variant:"destructive",className:"gap-2",children:[e.jsx(Vt,{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 b2(){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:B("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:["关于 ",Pm]}),e.jsxs("div",{className:"space-y-2 text-xs sm:text-sm text-muted-foreground",children:[e.jsxs("p",{children:["版本: ",Fo]}),e.jsx("p",{children:"麦麦(MaiBot)的现代化 Web 管理界面"})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"作者"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:"MaiBot 核心"}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Mai-with-u"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:"WebUI"}),e.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground",children:["Mai-with-u ",e.jsx("a",{href:"https://github.com/DrSmoothl",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"@MotricSeven"})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"技术栈"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 text-xs sm:text-sm text-muted-foreground",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"前端框架"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"React 19.2.0"}),e.jsx("li",{children:"TypeScript 5.7.2"}),e.jsx("li",{children:"Vite 6.0.7"}),e.jsx("li",{children:"TanStack Router 1.94.2"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"UI 组件"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"shadcn/ui"}),e.jsx("li",{children:"Radix UI"}),e.jsx("li",{children:"Tailwind CSS 3.4.17"}),e.jsx("li",{children:"Lucide Icons"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"后端"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"Python 3.12+"}),e.jsx("li",{children:"FastAPI"}),e.jsx("li",{children:"Uvicorn"}),e.jsx("li",{children:"WebSocket"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"构建工具"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"Bun / npm"}),e.jsx("li",{children:"ESLint 9.17.0"}),e.jsx("li",{children:"PostCSS"})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源库感谢"}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mb-3",children:"本项目使用了以下优秀的开源库,感谢他们的贡献:"}),e.jsx(ss,{className:"h-[300px] sm:h-[400px]",children:e.jsxs("div",{className:"space-y-4 pr-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"UI 框架与组件"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(ht,{name:"React",description:"用户界面构建库",license:"MIT"}),e.jsx(ht,{name:"shadcn/ui",description:"优雅的 React 组件库",license:"MIT"}),e.jsx(ht,{name:"Radix UI",description:"无样式的可访问组件库",license:"MIT"}),e.jsx(ht,{name:"Tailwind CSS",description:"实用优先的 CSS 框架",license:"MIT"}),e.jsx(ht,{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(ht,{name:"TanStack Router",description:"类型安全的路由库",license:"MIT"}),e.jsx(ht,{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(ht,{name:"React Hook Form",description:"高性能表单库",license:"MIT"}),e.jsx(ht,{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(ht,{name:"clsx",description:"条件 className 构建工具",license:"MIT"}),e.jsx(ht,{name:"tailwind-merge",description:"Tailwind 类名合并工具",license:"MIT"}),e.jsx(ht,{name:"class-variance-authority",description:"组件变体管理",license:"Apache-2.0"}),e.jsx(ht,{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(ht,{name:"Framer Motion",description:"React 动画库",license:"MIT"}),e.jsx(ht,{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(ht,{name:"FastAPI",description:"现代化 Python Web 框架",license:"MIT"}),e.jsx(ht,{name:"Uvicorn",description:"ASGI 服务器",license:"BSD-3-Clause"}),e.jsx(ht,{name:"Pydantic",description:"数据验证库",license:"MIT"}),e.jsx(ht,{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(ht,{name:"TypeScript",description:"JavaScript 的超集",license:"Apache-2.0"}),e.jsx(ht,{name:"Vite",description:"下一代前端构建工具",license:"MIT"}),e.jsx(ht,{name:"ESLint",description:"JavaScript 代码检查工具",license:"MIT"}),e.jsx(ht,{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 ht({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 vm({value:l,current:n,onChange:i,label:c,description:u}){const x=n===l;return e.jsxs("button",{onClick:()=>i(l),className:B("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 Ua({value:l,current:n,onChange:i,label:c,colorClass:u}){const x=n===l;return e.jsxs("button",{onClick:()=>i(l),className:B("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:B("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 y2=Date.now()%1e6;class w2{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 ng(){const l=m.useRef(null),n=m.useRef(null),i=m.useRef(void 0),[c]=m.useState(()=>new w2(y2)),u=m.useRef({mouse:{x:-10,y:0,lx:0,ly:0,sx:0,sy:0,v:0,vs:0,a:0,set:!1},lines:[],paths:[],noise:c,bounding:null});return m.useEffect(()=>{const 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:_}=f.bounding;f.lines=[],f.paths.forEach(me=>me.remove()),f.paths=[];const I=10,E=32,C=A+200,M=_+30,F=Math.ceil(C/I),D=Math.ceil(M/E),se=(A-I*F)/2,G=(_-E*D)/2;for(let me=0;me<=F;me++){const ce=[];for(let le=0;le<=D;le++){const ge={x:se+I*me,y:G+E*le,wave:{x:0,y:0},cursor:{x:0,y:0,vx:0,vy:0}};ce.push(ge)}const Ne=document.createElementNS("http://www.w3.org/2000/svg","path");h.appendChild(Ne),f.paths.push(Ne),f.lines.push(ce)}},N=A=>{const{lines:_,mouse:I,noise:E}=f;_.forEach(C=>{C.forEach(M=>{const F=E.perlin2((M.x+A*.0125)*.002,(M.y+A*.005)*.0015)*12;M.wave.x=Math.cos(F)*32,M.wave.y=Math.sin(F)*16;const D=M.x-I.sx,se=M.y-I.sy,G=Math.hypot(D,se),me=Math.max(175,I.vs);if(G{const I={x:A.x+A.wave.x+(_?A.cursor.x:0),y:A.y+A.wave.y+(_?A.cursor.y:0)};return I.x=Math.round(I.x*10)/10,I.y=Math.round(I.y*10)/10,I},y=()=>{const{lines:A,paths:_}=f;A.forEach((I,E)=>{let C=v(I[0],!1),M=`M ${C.x} ${C.y}`;I.forEach((F,D)=>{const se=D===I.length-1;C=v(F,!se),M+=`L ${C.x} ${C.y}`}),_[E].setAttribute("d",M)})},w=A=>{const{mouse:_}=f;_.sx+=(_.x-_.sx)*.1,_.sy+=(_.y-_.sy)*.1;const I=_.x-_.lx,E=_.y-_.ly,C=Math.hypot(I,E);_.v=C,_.vs+=(C-_.vs)*.1,_.vs=Math.min(100,_.vs),_.lx=_.x,_.ly=_.y,_.a=Math.atan2(E,I),x&&(x.style.setProperty("--x",`${_.sx}px`),x.style.setProperty("--y",`${_.sy}px`)),N(A),y(),i.current=requestAnimationFrame(w)},b=A=>{if(!f.bounding)return;const{mouse:_}=f;_.x=A.pageX-f.bounding.left,_.y=A.pageY-f.bounding.top+window.scrollY,_.set||(_.sx=_.x,_.sy=_.y,_.lx=_.x,_.ly=_.y,_.set=!0)},O=()=>{p(),g()};return p(),g(),window.addEventListener("resize",O),window.addEventListener("mousemove",b),i.current=requestAnimationFrame(w),()=>{window.removeEventListener("resize",O),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 _2(){const[l,n]=m.useState(""),[i,c]=m.useState(!1),[u,x]=m.useState(""),[h,f]=m.useState(!0),p=la(),{enableWavesBackground:g,setEnableWavesBackground:N}=Jj(),{theme:v,setTheme:y}=Hm();m.useEffect(()=>{(async()=>{try{await Qi()&&p({to:"/"})}catch{}finally{f(!1)}})()},[p]);const b=v==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":v,O=()=>{y(b==="dark"?"light":"dark")},A=async _=>{if(_.preventDefault(),x(""),!l.trim()){x("请输入 Access Token");return}c(!0),console.log("开始验证 token...");try{const I=await fetch("/api/webui/auth/verify",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({token:l.trim()})});console.log("Token 验证响应状态:",I.status);const E=await I.json();if(console.log("Token 验证响应数据:",E),I.ok&&E.valid){console.log("Token 验证成功,准备跳转..."),console.log("is_first_setup:",E.is_first_setup),await new Promise(M=>setTimeout(M,100));const C=await Qi();console.log("跳转前认证状态检查:",C),E.is_first_setup?(console.log("跳转到首次配置页面"),p({to:"/setup"})):(console.log("跳转到首页"),p({to:"/"}))}else console.error("Token 验证失败:",E.message),x(E.message||"Token 验证失败,请检查后重试")}catch(I){console.error("Token 验证错误:",I),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(ng,{}),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(ng,{}),e.jsxs(De,{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:O,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(gj,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"}):e.jsx(jj,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"})}),e.jsxs(Xe,{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(Kp,{className:"h-8 w-8 text-primary",strokeWidth:2,fill:"none"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(es,{className:"text-2xl font-bold",children:"欢迎使用 MaiBot"}),e.jsx(Gs,{className:"text-base",children:"请输入您的 Access Token 以继续访问系统"})]})]}),e.jsx(Ke,{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(Um,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground",strokeWidth:2,fill:"none"}),e.jsx(re,{id:"token",type:"password",placeholder:"请输入您的 Access Token",value:l,onChange:_=>n(_.target.value),className:B("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(St,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),e.jsx("span",{children:u})]}),e.jsx(k,{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(Fs,{children:[e.jsx(qo,{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(vj,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我没有 Token,我该去哪里获得 Token?"]})}),e.jsxs(Bs,{className:"sm:max-w-md",children:[e.jsxs($s,{children:[e.jsxs(Is,{className:"flex items-center gap-2",children:[e.jsx(Kp,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"如何获取 Access Token"]}),e.jsx(tt,{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(Lw,{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(qa,{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(St,{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(js,{children:[e.jsx(Nt,{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(On,{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(On,{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:r2})})]})}const et=m.forwardRef(({className:l,...n},i)=>e.jsx("textarea",{className:B("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}));et.displayName="Textarea";const Pr=m.forwardRef(({className:l,orientation:n="horizontal",decorative:i=!0,...c},u)=>e.jsx($g,{ref:u,decorative:i,orientation:n,className:B("shrink-0 bg-border",n==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",l),...c}));Pr.displayName=$g.displayName;function S2({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(re,{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(re,{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(Ae,{variant:"secondary",className:"gap-1",children:[u,e.jsx("button",{type:"button",onClick:()=>c(x),className:"ml-1 hover:text-destructive",children:e.jsx(_a,{className:"h-3 w-3"})})]},x))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(re,{id:"alias_input",placeholder:"输入别名后按回车添加",onKeyPress:u=>{u.key==="Enter"&&(i(u.target.value),u.target.value="")}}),e.jsx(k,{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 k2({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(et,{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(et,{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(et,{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(Pr,{}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"plan_style",children:"群聊说话规则 *"}),e.jsx(et,{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(et,{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 C2({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(re,{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(re,{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(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(T,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),e.jsx(re,{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(Pr,{}),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(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(T,{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(T,{htmlFor:"filtration_prompt",children:"过滤要求"}),e.jsx(re,{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 T2({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(Fe,{id:"enable_tool",checked:l.enable_tool,onCheckedChange:i=>n({...l,enable_tool:i})})]}),e.jsx(Pr,{}),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(Fe,{id:"all_global",checked:l.all_global,onCheckedChange:i=>n({...l,all_global:i})})]})]})}function E2({config:l,onChange:n}){const[i,c]=m.useState(!1);return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"rounded-lg bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"mt-0.5",children:e.jsx("svg",{className:"h-5 w-5 text-blue-600 dark:text-blue-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),e.jsxs("div",{className:"flex-1 text-sm",children:[e.jsx("p",{className:"font-medium text-blue-900 dark:text-blue-100 mb-1",children:"关于硅基流动 (SiliconFlow)"}),e.jsx("p",{className:"text-blue-700 dark:text-blue-300 mb-2",children:"硅基流动提供了完整的模型覆盖,包括 DeepSeek V3、Qwen、视觉模型、语音识别和嵌入模型。 只需一个 API Key 即可使用麦麦的所有功能!"}),e.jsxs("a",{href:"https://cloud.siliconflow.cn",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-blue-600 dark:text-blue-400 hover:underline font-medium",children:["前往硅基流动获取 API Key",e.jsx(_o,{className:"h-3 w-3"})]})]})]})}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"siliconflow_api_key",children:"SiliconFlow API Key *"}),e.jsxs("div",{className:"relative",children:[e.jsx(re,{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(k,{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(Vi,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(ta,{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 M2(){const l=await we("/api/webui/config/bot",{method:"GET",headers:Us()});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 A2(){const l=await we("/api/webui/config/bot",{method:"GET",headers:Us()});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 z2(){const l=await we("/api/webui/config/bot",{method:"GET",headers:Us()});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 we("/api/webui/config/bot",{method:"GET",headers:Us()});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 O2(){const l=await we("/api/webui/config/model",{method:"GET",headers:Us()});if(!l.ok)throw new Error("读取模型配置失败");return{api_key:((await l.json()).config.api_providers||[]).find(x=>x.name==="SiliconFlow")?.api_key||""}}async function R2(l){const n=await we("/api/webui/config/bot/section/bot",{method:"POST",headers:Us(),body:JSON.stringify(l)});if(!n.ok){const i=await n.json();throw new Error(i.detail||"保存Bot基础配置失败")}return await n.json()}async function L2(l){const n=await we("/api/webui/config/bot/section/personality",{method:"POST",headers:Us(),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=await we("/api/webui/config/bot/section/emoji",{method:"POST",headers:Us(),body:JSON.stringify(l)});if(!n.ok){const i=await n.json();throw new Error(i.detail||"保存表情包配置失败")}return await n.json()}async function B2(l){const n=[];n.push(we("/api/webui/config/bot/section/tool",{method:"POST",headers:Us(),body:JSON.stringify({enable_tool:l.enable_tool})})),n.push(we("/api/webui/config/bot/section/expression",{method:"POST",headers:Us(),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 $2(l){const n=await we("/api/webui/config/model",{method:"GET",headers:Us()});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:Us(),body:JSON.stringify(h)});if(!f.ok){const p=await f.json();throw new Error(p.detail||"保存模型配置失败")}return await f.json()}async function rg(){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 I2(){return e.jsx(Pn,{children:e.jsx(H2,{})})}function H2(){const l=la(),{toast:n}=Zs(),{triggerRestart:i}=un(),[c,u]=m.useState(0),[x,h]=m.useState(!1),[f,p]=m.useState(!1),[g,N]=m.useState(!0),[v,y]=m.useState({qq_account:0,nickname:"",alias_names:[]}),[w,b]=m.useState({personality:"是一个女大学生,现在在读大二,会刷贴吧。",reply_style:"请回复的平淡一些,简短一些,说中文,不要刻意突出自身学科背景。可以参考贴吧,知乎和微博的回复风格。",interest:"对技术相关话题,游戏和动漫相关话题感兴趣,也对日常话题感兴趣,不喜欢太过沉重严肃的话题",plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 +2.如果相同的内容已经被执行,请不要重复执行 +3.请控制你的发言频率,不要太过频繁的发言 +4.如果有人对你感到厌烦,请减少回复 +5.如果有人对你进行攻击,或者情绪激动,请你以合适的方法应对`,private_plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 +2.如果相同的内容已经被执行,请不要重复执行 +3.某句话如果已经被回复过,不要重复回复`}),[O,A]=m.useState({emoji_chance:.4,max_reg_num:40,do_replace:!0,check_interval:10,steal_emoji:!0,content_filtration:!1,filtration_prompt:"符合公序良俗"}),[_,I]=m.useState({enable_tool:!0,all_global:!0}),[E,C]=m.useState({api_key:""}),M=[{id:"bot-basic",title:"Bot基础",description:"配置机器人的基本信息",icon:Bi},{id:"personality",title:"人格配置",description:"定义机器人的性格和说话风格",icon:Rn},{id:"emoji",title:"表情包",description:"配置表情包相关设置",icon:Bm},{id:"other",title:"其他设置",description:"工具、情绪系统等配置",icon:dn},{id:"siliconflow",title:"API配置",description:"配置硅基流动API密钥",icon:Um}],F=(c+1)/M.length*100;m.useEffect(()=>{(async()=>{try{N(!0);const[ge,be,z,q,U]=await Promise.all([M2(),A2(),z2(),D2(),O2()]);y(ge),b(be),A(z),I(q),C(U)}catch(ge){n({title:"加载配置失败",description:ge instanceof Error?ge.message:"无法加载现有配置,将使用默认值",variant:"destructive"})}finally{N(!1)}})()},[n]);const D=async()=>{p(!0);try{switch(c){case 0:await R2(v);break;case 1:await L2(w);break;case 2:await U2(O);break;case 3:await B2(_);break;case 4:await $2(E);break}return n({title:"保存成功",description:`${M[c].title}配置已保存`}),!0}catch(le){return n({title:"保存失败",description:le instanceof Error?le.message:"未知错误",variant:"destructive"}),!1}finally{p(!1)}},se=async()=>{await D()&&c{c>0&&u(c-1)},me=async()=>{h(!0);try{if(!await D()){h(!1);return}await rg(),n({title:"配置完成",description:"麦麦正在重启以应用新配置..."}),await i()}catch(le){n({title:"配置失败",description:le instanceof Error?le.message:"未知错误",variant:"destructive"})}finally{h(!1)}},ce=async()=>{try{await rg(),l({to:"/"})}catch(le){n({title:"跳过失败",description:le instanceof Error?le.message:"未知错误",variant:"destructive"})}},Ne=()=>{switch(c){case 0:return e.jsx(S2,{config:v,onChange:y});case 1:return e.jsx(k2,{config:w,onChange:b});case 2:return e.jsx(C2,{config:O,onChange:A});case 3:return e.jsx(T2,{config:_,onChange:I});case 4:return e.jsx(E2,{config:E,onChange:C});default:return null}};return e.jsxs("div",{className:"relative flex min-h-screen flex-col items-center justify-center overflow-hidden bg-gradient-to-br from-primary/5 via-background to-secondary/5 p-4 md:p-6",children:[e.jsx(Gn,{}),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(Uw,{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:["让我们一起完成 ",Pm," 的初始配置"]})]}),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," / ",M.length]}),e.jsxs("span",{className:"font-medium text-primary",children:[Math.round(F),"%"]})]}),e.jsx(In,{value:F,className:"h-2"})]}),e.jsx("div",{className:"mb-6 md:mb-8 flex justify-between",children:M.map((le,ge)=>{const be=le.icon;return e.jsxs("div",{className:B("flex flex-1 flex-col items-center gap-1 md:gap-2",gel({to:"/"}),className:"gap-2 w-full sm:w-auto",children:[e.jsx(Ho,{className:"h-4 w-4"}),"返回首页"]}),e.jsxs(k,{size:"lg",variant:"outline",onClick:()=>window.history.back(),className:"gap-2 w-full sm:w-auto",children:[e.jsx(Va,{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 P2=Ms.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(T,{htmlFor:"platform",children:"平台"}),e.jsx(re,{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(re,{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(re,{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(k,{onClick:x,size:"sm",variant:"outline",children:[e.jsx(st,{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(re,{value:v,onChange:w=>f(y,w.target.value),placeholder:"wx:114514"}),e.jsxs(js,{children:[e.jsx(Nt,{asChild:!0,children:e.jsx(k,{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(y),children:"删除"})]})]})]})]},y)),c.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(k,{onClick:p,size:"sm",variant:"outline",children:[e.jsx(st,{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(re,{value:v,onChange:w=>N(y,w.target.value),placeholder:"小麦"}),e.jsxs(js,{children:[e.jsx(Nt,{asChild:!0,children:e.jsx(k,{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(y),children:"删除"})]})]})]})]},y)),u.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无别名"})]})]})]})]})})}),G2=Ms.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(et,{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.jsx(T,{htmlFor:"reply_style",children:"表达风格"}),e.jsx(et,{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:"interest",children:"兴趣"}),e.jsx(et,{id:"interest",value:n.interest,onChange:h=>i({...n,interest:h.target.value}),placeholder:"会影响麦麦对什么话题进行回复",rows:2})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"plan_style",children:"说话规则与行为风格"}),e.jsx(et,{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(et,{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(et,{id:"private_plan_style",value:n.private_plan_style,onChange:h=>i({...n,private_plan_style:h.target.value}),placeholder:"私聊的说话规则和行为风格",rows:4})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"状态列表(人格多样性)"}),e.jsxs(k,{onClick:c,size:"sm",variant:"outline",children:[e.jsx(st,{className:"h-4 w-4 mr-1"}),"添加状态"]})]}),e.jsx("div",{className:"space-y-2",children:n.states.map((h,f)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(et,{value:h,onChange:p=>x(f,p.target.value),placeholder:"描述一个人格状态",rows:2}),e.jsxs(js,{children:[e.jsx(Nt,{asChild:!0,children:e.jsx(k,{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(re,{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:"每次构建人格时替换 personality 的概率(0.0-1.0)"})]})]})]})})}),Be=pw,$e=gw,Le=m.forwardRef(({className:l,children:n,...i},c)=>e.jsxs(Wg,{ref:c,className:B("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(uw,{asChild:!0,children:e.jsx(Sa,{className:"h-4 w-4 opacity-50"})})]}));Le.displayName=Wg.displayName;const sv=m.forwardRef(({className:l,...n},i)=>e.jsx(ej,{ref:i,className:B("flex cursor-default items-center justify-center py-1",l),...n,children:e.jsx(Lr,{className:"h-4 w-4"})}));sv.displayName=ej.displayName;const tv=m.forwardRef(({className:l,...n},i)=>e.jsx(sj,{ref:i,className:B("flex cursor-default items-center justify-center py-1",l),...n,children:e.jsx(Sa,{className:"h-4 w-4"})}));tv.displayName=sj.displayName;const Ue=m.forwardRef(({className:l,children:n,position:i="popper",...c},u)=>e.jsx(mw,{children:e.jsxs(tj,{ref:u,className:B("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(sv,{}),e.jsx(xw,{className:B("p-1",i==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:n}),e.jsx(tv,{})]})}));Ue.displayName=tj.displayName;const F2=m.forwardRef(({className:l,...n},i)=>e.jsx(aj,{ref:i,className:B("px-2 py-1.5 text-sm font-semibold",l),...n}));F2.displayName=aj.displayName;const ee=m.forwardRef(({className:l,children:n,...i},c)=>e.jsxs(lj,{ref:c,className:B("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(hw,{children:e.jsx(wt,{className:"h-4 w-4"})})}),e.jsx(fw,{children:n})]}));ee.displayName=lj.displayName;const q2=m.forwardRef(({className:l,...n},i)=>e.jsx(nj,{ref:i,className:B("-mx-1 my-1 h-px bg-muted",l),...n}));q2.displayName=nj.displayName;const tl=E0,al=M0,Ka=m.forwardRef(({className:l,align:n="center",sideOffset:i=4,...c},u)=>e.jsx(T0,{children:e.jsx(Ig,{ref:u,align:n,sideOffset:i,className:B("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})}));Ka.displayName=Ig.displayName;const V2=Ms.memo(function({value:n,onChange:i}){const c=m.useMemo(()=>{const w=n.split("-");if(w.length===2){const[b,O]=w,[A,_]=b.split(":"),[I,E]=O.split(":");return{startHour:A?A.padStart(2,"0"):"00",startMinute:_?_.padStart(2,"0"):"00",endHour:I?I.padStart(2,"0"):"23",endMinute:E?E.padStart(2,"0"):"59"}}return{startHour:"00",startMinute:"00",endHour:"23",endMinute:"59"}},[n]),[u,x]=m.useState(c.startHour),[h,f]=m.useState(c.startMinute),[p,g]=m.useState(c.endHour),[N,v]=m.useState(c.endMinute);m.useEffect(()=>{x(c.startHour),f(c.startMinute),g(c.endHour),v(c.endMinute)},[c]);const y=(w,b,O,A)=>{const _=`${w}:${b}-${O}:${A}`;i(_)};return e.jsxs(tl,{children:[e.jsx(al,{asChild:!0,children:e.jsxs(k,{variant:"outline",className:"w-full justify-start font-mono text-sm",children:[e.jsx(kl,{className:"h-4 w-4 mr-2"}),n||"选择时间段"]})}),e.jsx(Ka,{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(Be,{value:u,onValueChange:w=>{x(w),y(w,h,p,N)},children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsx(Ue,{children:Array.from({length:24},(w,b)=>b).map(w=>e.jsx(ee,{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(Be,{value:h,onValueChange:w=>{f(w),y(u,w,p,N)},children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsx(Ue,{children:Array.from({length:60},(w,b)=>b).map(w=>e.jsx(ee,{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(Be,{value:p,onValueChange:w=>{g(w),y(u,h,w,N)},children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsx(Ue,{children:Array.from({length:24},(w,b)=>b).map(w=>e.jsx(ee,{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(Be,{value:N,onValueChange:w=>{v(w),y(u,h,p,w)},children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsx(Ue,{children:Array.from({length:60},(w,b)=>b).map(w=>e.jsx(ee,{value:w.toString().padStart(2,"0"),children:w.toString().padStart(2,"0")},w))})]})]})]})]})]})})]})}),K2=Ms.memo(function({rule:n}){const i=`{ target = "${n.target}", time = "${n.time}", value = ${n.value.toFixed(1)} }`;return e.jsxs(tl,{children:[e.jsx(al,{asChild:!0,children:e.jsxs(k,{variant:"outline",size:"sm",children:[e.jsx(ta,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Ka,{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 文件中的格式"})]})})]})}),Q2=Ms.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(re,{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:"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(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(re,{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(re,{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(T,{htmlFor:"enable_talk_value_rules",className:"cursor-pointer",children:"启用动态发言频率规则"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Fe,{id:"include_planner_reasoning",checked:n.include_planner_reasoning,onCheckedChange:h=>i({...n,include_planner_reasoning:h})}),e.jsx(T,{htmlFor:"include_planner_reasoning",className:"cursor-pointer",children:"将 planner 推理加入 replyer"})]})]})]}),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(k,{onClick:c,size:"sm",children:[e.jsx(st,{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(K2,{rule:h}),e.jsxs(js,{children:[e.jsx(Nt,{asChild:!0,children:e.jsx(k,{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(Be,{value:h.target===""?"global":"specific",onValueChange:p=>{p==="global"?x(f,"target",""):x(f,"target","qq::group")},children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"global",children:"全局配置"}),e.jsx(ee,{value:"specific",children:"详细配置"})]})]})]}),h.target!==""&&(()=>{const p=h.target.split(":"),g=p[0]||"qq",N=p[1]||"",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(Be,{value:g,onValueChange:y=>{x(f,"target",`${y}:${N}:${v}`)},children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"qq",children:"QQ"}),e.jsx(ee,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"群 ID"}),e.jsx(re,{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(T,{className:"text-xs font-medium",children:"类型"}),e.jsxs(Be,{value:v,onValueChange:y=>{x(f,"target",`${g}:${N}:${y}`)},children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"group",children:"群组(group)"}),e.jsx(ee,{value:"private",children:"私聊(private)"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",h.target||"(未设置)"]})]})})(),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"时间段 (Time)"}),e.jsx(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(T,{htmlFor:`rule-value-${f}`,className:"text-xs font-medium",children:"发言频率值 (Value)"}),e.jsx(re,{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(wa,{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=Ms.memo(function({config:n,onChange:i}){const c=_=>{if(!_||!_.includes(":"))return{platform:"qq",userId:""};const[I,E]=_.split(":");return{platform:I,userId:E}},{platform:u,userId:x}=c(n.dream_send),[h,f]=m.useState(u),[p,g]=m.useState(x),N=_=>{const[I,E]=_.split("-");return{startTime:I||"09:00",endTime:E||"22:00"}},v=(_,I)=>{const E=I?`${_}:${I}`:"";i({...n,dream_send:E})},y=_=>{f(_),v(_,p)},w=_=>{g(_),v(h,_)},b=()=>{i({...n,dream_time_ranges:[...n.dream_time_ranges,"09:00-22:00"]})},O=_=>{i({...n,dream_time_ranges:n.dream_time_ranges.filter((I,E)=>E!==_)})},A=(_,I,E)=>{const C=[...n.dream_time_ranges],M=N(C[_]);I==="startTime"?M.startTime=E:M.endTime=E,C[_]=`${M.startTime}-${M.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(re,{id:"interval_minutes",type:"number",min:"1",value:n.interval_minutes,onChange:_=>i({...n,interval_minutes:Number(_.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(re,{id:"max_iterations",type:"number",min:"1",value:n.max_iterations,onChange:_=>i({...n,max_iterations:Number(_.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(re,{id:"first_delay_seconds",type:"number",min:"0",value:n.first_delay_seconds,onChange:_=>i({...n,first_delay_seconds:Number(_.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(Be,{value:h,onValueChange:y,children:[e.jsx(Le,{className:"w-[120px]",children:e.jsx($e,{placeholder:"选择平台"})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"qq",children:"QQ"}),e.jsx(ee,{value:"wx",children:"微信"}),e.jsx(ee,{value:"webui",children:"WebUI"})]})]}),e.jsx(re,{type:"text",placeholder:"输入用户ID (例如: 123456)",value:p,onChange:_=>w(_.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(k,{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((_,I)=>{const{startTime:E,endTime:C}=N(_);return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(re,{type:"time",value:E,onChange:M=>A(I,"startTime",M.target.value),className:"w-[140px]"}),e.jsx("span",{className:"text-muted-foreground",children:"至"}),e.jsx(re,{type:"time",value:C,onChange:M=>A(I,"endTime",M.target.value),className:"w-[140px]"}),e.jsx(k,{type:"button",variant:"ghost",size:"icon",onClick:()=>O(I),children:e.jsx(_a,{className:"h-4 w-4"})})]},I)}),n.dream_time_ranges.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"当前配置为全天允许做梦"})]})]})]})}),J2=Ms.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(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(Be,{value:n.lpmm_mode,onValueChange:c=>i({...n,lpmm_mode:c}),children:[e.jsx(Le,{children:e.jsx($e,{placeholder:"选择 LPMM 模式"})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"classic",children:"经典模式"}),e.jsx(ee,{value:"agent",children:"Agent 模式"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"同义词搜索 TopK"}),e.jsx(re,{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(re,{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(re,{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(re,{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(re,{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(re,{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(re,{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(T,{className:"cursor-pointer",children:"启用 PPR (低配机器可关闭)"})]})]})]})]})}),X2=Ms.memo(function({config:n,onChange:i}){const[c,u]=m.useState(""),[x,h]=m.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(O=>O!==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 O={...n.library_log_levels};delete O[b],i({...n,library_log_levels:O})},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(T,{children:"日期格式"}),e.jsx(re,{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(T,{children:"日志级别样式"}),e.jsxs(Be,{value:n.log_level_style,onValueChange:b=>i({...n,log_level_style:b}),children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsx(Ue,{children:y.map(b=>e.jsx(ee,{value:b,children:b},b))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"日志文本颜色"}),e.jsxs(Be,{value:n.color_text,onValueChange:b=>i({...n,color_text:b}),children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsx(Ue,{children:w.map(b=>e.jsx(ee,{value:b,children:b},b))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"全局日志级别"}),e.jsxs(Be,{value:n.log_level,onValueChange:b=>i({...n,log_level:b}),children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsx(Ue,{children:v.map(b=>e.jsx(ee,{value:b,children:b},b))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"控制台日志级别"}),e.jsxs(Be,{value:n.console_log_level,onValueChange:b=>i({...n,console_log_level:b}),children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsx(Ue,{children:v.map(b=>e.jsx(ee,{value:b,children:b},b))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"文件日志级别"}),e.jsxs(Be,{value:n.file_log_level,onValueChange:b=>i({...n,file_log_level:b}),children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsx(Ue,{children:v.map(b=>e.jsx(ee,{value:b,children:b},b))})]})]})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"mb-2 block",children:"完全屏蔽的库"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(re,{value:c,onChange:b=>u(b.target.value),placeholder:"输入库名",className:"flex-1",onKeyDown:b=>{b.key==="Enter"&&(b.preventDefault(),f())}}),e.jsx(k,{onClick:f,size:"sm",className:"flex-shrink-0",children:e.jsx(st,{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(k,{variant:"ghost",size:"sm",className:"h-5 w-5 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(T,{className:"mb-2 block",children:"特定库的日志级别"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(re,{value:c,onChange:b=>u(b.target.value),placeholder:"输入库名",className:"flex-1"}),e.jsxs(Be,{value:x,onValueChange:h,children:[e.jsx(Le,{className:"w-32",children:e.jsx($e,{})}),e.jsx(Ue,{children:v.map(b=>e.jsx(ee,{value:b,children:b},b))})]}),e.jsx(k,{onClick:g,size:"sm",children:e.jsx(st,{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,O])=>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:O}),e.jsx(k,{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))})]})]})}),Z2=Ms.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(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(T,{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(T,{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(T,{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(T,{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(T,{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(T,{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})})]})]})]})}),W2=Ms.memo(function({config:n,onChange:i}){const[c,u]=m.useState(""),[x,h]=m.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(re,{value:c,onChange:v=>u(v.target.value),placeholder:"输入认证令牌",onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),f())}}),e.jsx(k,{onClick:f,size:"sm",children:e.jsx(st,{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(k,{variant:"ghost",size:"sm",className:"h-6 w-6 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("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(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(T,{children:"主机地址"}),e.jsx(re,{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(re,{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(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(re,{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(re,{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(re,{value:x,onChange:v=>h(v.target.value),placeholder:"输入 API Key",onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),g())}}),e.jsx(k,{onClick:g,size:"sm",children:e.jsx(st,{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(k,{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))})]})]})]})]})]})}),e_=Ms.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(Fe,{checked:n.enable,onCheckedChange:c=>i({...n,enable:c})})]})]})}),s_=Ms.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(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(Fe,{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(re,{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(re,{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(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(Fe,{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(re,{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(re,{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(re,{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(T,{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(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(Fe,{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(re,{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:"只有符合此要求的表情包才会被保存"})]})]})]})})]})}),t_=Ms.memo(function({member:n,groupIndex:i,memberIndex:c,availableChatIds:u,onUpdate:x,onRemove:h}){const f=u.includes(n)||n==="*",[p,g]=m.useState(!f);return e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:"flex-1 flex gap-2",children:p?e.jsxs(e.Fragment,{children:[e.jsx(re,{value:n,onChange:N=>x(i,c,N.target.value),placeholder:'输入 "*" 或 "qq:123456:group"',className:"flex-1"}),u.length>0&&e.jsx(k,{size:"sm",variant:"outline",onClick:()=>g(!1),title:"切换到下拉选择",children:"下拉"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(Be,{value:n,onValueChange:N=>x(i,c,N),children:[e.jsx(Le,{className:"flex-1",children:e.jsx($e,{placeholder:"选择聊天流"})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"*",children:"* (全局共享)"}),u.map((N,v)=>e.jsx(ee,{value:N,children:N},v))]})]}),e.jsx(k,{size:"sm",variant:"outline",onClick:()=>g(!0),title:"切换到手动输入",children:"输入"})]})}),e.jsxs(js,{children:[e.jsx(Nt,{asChild:!0,children:e.jsx(k,{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:"删除"})]})]})]})]})}),a_=Ms.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 O=[...n.learning_list];O[y][w]=b,i({...n,learning_list:O})},h=({rule:y})=>{const w=`["${y[0]}", "${y[1]}", "${y[2]}", "${y[3]}"]`;return e.jsxs(tl,{children:[e.jsx(al,{asChild:!0,children:e.jsxs(k,{variant:"outline",size:"sm",children:[e.jsx(ta,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Ka,{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((O,A)=>A!==w),i({...n,expression_groups:b})},v=(y,w,b)=>{const O=[...n.expression_groups];O[y][w]=b,i({...n,expression_groups:O})};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-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(k,{onClick:c,size:"sm",variant:"outline",children:[e.jsx(st,{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((C,M)=>M!==w&&C[0]===""),O=y[0]==="",A=y[0].split(":"),_=A[0]||"qq",I=A[1]||"",E=A[2]||"group";return e.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["规则 ",w+1," ",O&&"(全局配置)"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{rule:y}),e.jsxs(js,{children:[e.jsx(Nt,{asChild:!0,children:e.jsx(k,{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(Be,{value:O?"global":"specific",onValueChange:C=>{C==="global"?x(w,0,""):x(w,0,"qq::group")},disabled:b&&!O,children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"global",children:"全局配置"}),e.jsx(ee,{value:"specific",disabled:b&&!O,children:"详细配置"})]})]}),b&&!O&&e.jsx("p",{className:"text-xs text-amber-600",children:"已存在全局配置,无法创建新的全局配置"})]}),!O&&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(Be,{value:_,onValueChange:C=>{x(w,0,`${C}:${I}:${E}`)},children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"qq",children:"QQ"}),e.jsx(ee,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"群 ID"}),e.jsx(re,{value:I,onChange:C=>{x(w,0,`${_}:${C.target.value}:${E}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"类型"}),e.jsxs(Be,{value:E,onValueChange:C=>{x(w,0,`${_}:${I}:${C}`)},children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"group",children:"群组(group)"}),e.jsx(ee,{value:"private",children:"私聊(private)"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",y[0]||"(未设置)"]})]}),e.jsx("div",{className:"grid gap-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-xs font-medium",children:"使用学到的表达"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦使用从聊天中学到的表达方式"})]}),e.jsx(Fe,{checked:y[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(Fe,{checked:y[2]==="enable",onCheckedChange:C=>x(w,2,C?"enable":"disable")})]})}),e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-xs font-medium",children:"学习强度"}),e.jsx(re,{type:"number",step:"0.1",min:"0",max:"5",value:y[3],onChange:C=>{const M=parseFloat(C.target.value);isNaN(M)||x(w,3,Math.max(0,Math.min(5,M)).toFixed(1))},className:"w-20 h-8 text-xs"})]}),e.jsx(wa,{value:[parseFloat(y[3])||1],onValueChange:C=>x(w,3,C[0].toFixed(1)),min:0,max:5,step:.1,className:"w-full"}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"0 (不学习)"}),e.jsx("span",{children:"2.5"}),e.jsx("span",{children:"5.0 (快速学习)"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"影响学习频率,最短学习间隔 = 300/学习强度(秒)"})]})]})]},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",{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.jsx(Fe,{checked:n.reflect,onCheckedChange:y=>i({...n,reflect:y})})]}),n.reflect&&e.jsxs("div",{className:"space-y-4",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.reflect_operator_id||"").split(":"),b=w[0]||"qq",O=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(Be,{value:b,onValueChange:_=>{i({...n,reflect_operator_id:`${_}:${O}:${A}`})},children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"qq",children:"QQ"}),e.jsx(ee,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"用户/群 ID"}),e.jsx(re,{value:O,onChange:_=>{i({...n,reflect_operator_id:`${b}:${_.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(Be,{value:A,onValueChange:_=>{i({...n,reflect_operator_id:`${b}:${O}:${_}`})},children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"private",children:"私聊(private)"}),e.jsx(ee,{value:"group",children:"群组(group)"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前操作员 ID:",n.reflect_operator_id||"(未设置)"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦会向此操作员询问表达方式是否合适"})]})})()})]}),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(k,{onClick:()=>{i({...n,allow_reflect:[...n.allow_reflect||[],"qq::group"]})},size:"sm",variant:"outline",children:[e.jsx(st,{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(":"),O=b[0]||"qq",A=b[1]||"",_=b[2]||"group";return e.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg bg-muted/50",children:[e.jsxs(Be,{value:O,onValueChange:I=>{const E=[...n.allow_reflect];E[w]=`${I}:${A}:${_}`,i({...n,allow_reflect:E})},children:[e.jsx(Le,{className:"w-24",children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"qq",children:"QQ"}),e.jsx(ee,{value:"wx",children:"微信"})]})]}),e.jsx(re,{value:A,onChange:I=>{const E=[...n.allow_reflect];E[w]=`${O}:${I.target.value}:${_}`,i({...n,allow_reflect:E})},placeholder:"ID",className:"flex-1 font-mono text-sm"}),e.jsxs(Be,{value:_,onValueChange:I=>{const E=[...n.allow_reflect];E[w]=`${O}:${A}:${I}`,i({...n,allow_reflect:E})},children:[e.jsx(Le,{className:"w-32",children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"group",children:"群组"}),e.jsx(ee,{value:"private",children:"私聊"})]})]}),e.jsx(k,{onClick:()=>{i({...n,allow_reflect:n.allow_reflect.filter((I,E)=>E!==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(k,{onClick:f,size:"sm",variant:"outline",children:[e.jsx(st,{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(O=>O[0]).filter(O=>O!=="");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(k,{onClick:()=>g(w),size:"sm",variant:"outline",children:e.jsx(st,{className:"h-4 w-4"})}),e.jsxs(js,{children:[e.jsx(Nt,{asChild:!0,children:e.jsx(k,{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:y.map((O,A)=>e.jsx(t_,{member:O,groupIndex:w,memberIndex:A,availableChatIds:b,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:'暂无共享组,点击"添加共享组"开始配置'})]})]})}),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(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(Fe,{id:"enable_jargon_explanation",checked:n.enable_jargon_explanation??!0,onCheckedChange:y=>i({...n,enable_jargon_explanation:y})}),e.jsx(T,{htmlFor:"enable_jargon_explanation",className:"cursor-pointer",children:"启用黑话解释"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"在回复前尝试对上下文中的黑话进行解释。关闭可减少一次LLM调用,仅影响回复前的黑话匹配与解释,不影响黑话学习。"})]}),e.jsxs("div",{children:[e.jsx(T,{htmlFor:"jargon_mode",children:"黑话解释来源模式"}),e.jsxs(Be,{value:n.jargon_mode??"context",onValueChange:y=>i({...n,jargon_mode:y}),children:[e.jsx(Le,{id:"jargon_mode",className:"mt-2",children:e.jsx($e,{placeholder:"选择黑话解释来源"})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"context",children:"上下文模式(自动匹配黑话)"}),e.jsx(ee,{value:"planner",children:"Planner模式(使用unknown_words列表)"})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["上下文模式:使用上下文自动匹配黑话并解释",e.jsx("br",{}),"Planner模式:仅使用Planner在reply动作中给出的unknown_words列表进行黑话检索"]})]})]})]})});function l_({regex:l,reaction:n,onRegexChange:i,onReactionChange:c}){const[u,x]=m.useState(!1),[h,f]=m.useState(""),[p,g]=m.useState(null),[N,v]=m.useState(""),[y,w]=m.useState({}),[b,O]=m.useState(""),A=m.useRef(null),[_,I]=m.useState("build"),E=D=>D.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),C=(D,se=0)=>{const G=A.current;if(!G)return;const me=G.selectionStart||0,ce=G.selectionEnd||0,Ne=l.substring(0,me)+D+l.substring(ce);i(Ne),setTimeout(()=>{const le=me+D.length+se;G.setSelectionRange(le,le),G.focus()},0)};m.useEffect(()=>{if(!l||!h){p!==null&&g(null),Object.keys(y).length>0&&w({}),b!==n&&O(n),N!==""&&v("");return}try{const D=E(l),se=new RegExp(D,"g"),G=h.match(se);g(G),v("");const ce=new RegExp(D).exec(h);if(ce&&ce.groups){w(ce.groups);let Ne=n;Object.entries(ce.groups).forEach(([le,ge])=>{Ne=Ne.replace(new RegExp(`\\[${le}\\]`,"g"),ge||"")}),O(Ne)}else w({}),O(n)}catch(D){v(D.message),g(null),w({}),O(n)}},[l,h,n,p,y,b,N]);const M=()=>{if(!h||!p||p.length===0)return e.jsx("span",{className:"text-muted-foreground",children:h||"请输入测试文本"});try{const D=E(l),se=new RegExp(D,"g");let G=0;const me=[];let ce;for(;(ce=se.exec(h))!==null;)ce.index>G&&me.push(e.jsx("span",{children:h.substring(G,ce.index)},`text-${G}`)),me.push(e.jsx("span",{className:"bg-yellow-200 dark:bg-yellow-900 font-semibold",children:ce[0]},`match-${ce.index}`)),G=ce.index+ce[0].length;return G)",desc:"Python风格命名捕获组",moveCursor:-1},{label:"非捕获组",pattern:"(?:)",desc:"分组但不保存匹配结果",moveCursor:-1}]},{category:"字符类",items:[{label:"字符集",pattern:"[]",desc:"匹配括号内的任意字符",moveCursor:-1},{label:"排除字符",pattern:"[^]",desc:"匹配不在括号内的字符",moveCursor:-1},{label:"范围",pattern:"[a-z]",desc:"匹配a到z的字符"},{label:"中文字符",pattern:"[\\u4e00-\\u9fa5]",desc:"匹配中文汉字"}]},{category:"常用模板",items:[{label:"捕获词语",pattern:"(?P\\S+)",desc:"捕获一个词语"},{label:"捕获句子",pattern:"(?P.+)",desc:"捕获整个句子"},{label:"捕获数字",pattern:"(?P\\d+)",desc:"捕获一个或多个数字"},{label:"可选词语",pattern:"(?:词语1|词语2)",desc:"匹配多个可选项之一"}]}];return e.jsxs(Fs,{open:u,onOpenChange:x,children:[e.jsx(qo,{asChild:!0,children:e.jsxs(k,{variant:"outline",size:"sm",children:[e.jsx($m,{className:"h-4 w-4 mr-1"}),"正则编辑器"]})}),e.jsxs(Bs,{className:"max-w-[95vw] sm:max-w-[900px] max-h-[90vh]",children:[e.jsxs($s,{children:[e.jsx(Is,{children:"正则表达式编辑器"}),e.jsx(tt,{className:"text-sm",children:"使用可视化工具构建正则表达式,并实时测试效果"})]}),e.jsx(ss,{className:"max-h-[calc(90vh-120px)]",children:e.jsxs(xa,{value:_,onValueChange:D=>I(D),className:"w-full",children:[e.jsxs(aa,{className:"grid w-full grid-cols-2",children:[e.jsx(ls,{value:"build",children:"🔧 构建器"}),e.jsx(ls,{value:"test",children:"🧪 测试器"})]}),e.jsxs(ws,{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(re,{ref:A,value:l,onChange:D=>i(D.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(et,{value:n,onChange:D=>c(D.target.value),placeholder:"使用 [捕获组名] 引用捕获的内容...",rows:3,className:"text-sm"})]}),e.jsxs("div",{className:"space-y-4 border-t pt-4",children:[F.map(D=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("h5",{className:"text-xs font-semibold text-primary",children:D.category}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:D.items.map(se=>e.jsx(k,{variant:"outline",size:"sm",className:"justify-start h-auto py-2 px-3",onClick:()=>C(se.pattern,se.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:se.label}),e.jsx("code",{className:"ml-auto text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:se.pattern})]}),e.jsx("span",{className:"text-xs text-muted-foreground mt-0.5",children:se.desc})]})},se.label))})]},D.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(k,{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(k,{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(k,{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(ws,{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(et,{id:"test-text",value:h,onChange:D=>f(D.target.value),placeholder:`在此输入要测试的文本... +例如:打游戏是这样的`,className:"min-h-[100px] text-sm"})]}),N&&e.jsxs("div",{className:"rounded-md bg-destructive/10 border border-destructive/20 p-3",children:[e.jsx("p",{className:"text-sm text-destructive font-medium",children:"正则表达式错误"}),e.jsx("p",{className:"text-xs text-destructive/80 mt-1",children:N})]}),!N&&h&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"flex items-center gap-2",children:p&&p.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-green-500"}),e.jsxs("span",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:["匹配成功 (",p.length," 处)"]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-gray-400"}),e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"无匹配"})]})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"匹配高亮"}),e.jsx(ss,{className:"h-40 rounded-md bg-muted p-3",children:e.jsx("div",{className:"text-sm break-words",children:M()})})]}),Object.keys(y).length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"命名捕获组"}),e.jsx(ss,{className:"h-32 rounded-md border p-3",children:e.jsx("div",{className:"space-y-2",children:Object.entries(y).map(([D,se])=>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:["[",D,"]"]}),e.jsx("span",{className:"text-muted-foreground",children:"="}),e.jsx("span",{className:"font-mono bg-muted px-2 py-0.5 rounded",children:se})]},D))})})]}),Object.keys(y).length>0&&n&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"Reaction 替换预览"}),e.jsx(ss,{className:"h-48 rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3",children:e.jsx("div",{className:"text-sm break-words",children: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 n_=Ms.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((M,F)=>F!==C)})},v=(C,M,F)=>{const D=[...n.regex_rules];M==="regex"&&typeof F=="string"?D[C]={...D[C],regex:[F]}:M==="reaction"&&typeof F=="string"&&(D[C]={...D[C],reaction:F}),x({...n,regex_rules:D})},y=()=>{x({...n,keyword_rules:[...n.keyword_rules,{keywords:[],reaction:""}]})},w=C=>{x({...n,keyword_rules:n.keyword_rules.filter((M,F)=>F!==C)})},b=(C,M,F)=>{const D=[...n.keyword_rules];typeof F=="string"&&(D[C]={...D[C],reaction:F}),x({...n,keyword_rules:D})},O=C=>{const M=[...n.keyword_rules];M[C]={...M[C],keywords:[...M[C].keywords||[],""]},x({...n,keyword_rules:M})},A=(C,M)=>{const F=[...n.keyword_rules];F[C]={...F[C],keywords:(F[C].keywords||[]).filter((D,se)=>se!==M)},x({...n,keyword_rules:F})},_=(C,M,F)=>{const D=[...n.keyword_rules],se=[...D[C].keywords||[]];se[M]=F,D[C]={...D[C],keywords:se},x({...n,keyword_rules:D})},I=({rule:C})=>{const M=`{ regex = [${(C.regex||[]).map(F=>`"${F}"`).join(", ")}], reaction = "${C.reaction}" }`;return e.jsxs(tl,{children:[e.jsx(al,{asChild:!0,children:e.jsxs(k,{variant:"outline",size:"sm",children:[e.jsx(ta,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Ka,{className:"w-[95vw] sm:w-[500px]",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),e.jsx(ss,{className:"h-60 rounded-md bg-muted p-3",children:e.jsx("pre",{className:"font-mono text-xs break-all",children:M})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},E=({rule:C})=>{const M=`[[keyword_reaction.keyword_rules]] +keywords = [${(C.keywords||[]).map(F=>`"${F}"`).join(", ")}] +reaction = "${C.reaction}"`;return e.jsxs(tl,{children:[e.jsx(al,{asChild:!0,children:e.jsxs(k,{variant:"outline",size:"sm",children:[e.jsx(ta,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Ka,{className:"w-[95vw] sm:w-[500px]",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),e.jsx(ss,{className:"h-60 rounded-md bg-muted p-3",children:e.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-all",children:M})}),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(k,{onClick:g,size:"sm",variant:"outline",children:[e.jsx(st,{className:"h-4 w-4 mr-1"}),"添加正则规则"]})]}),e.jsxs("div",{className:"space-y-3",children:[n.regex_rules.map((C,M)=>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:["正则规则 ",M+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(l_,{regex:C.regex&&C.regex[0]||"",reaction:C.reaction,onRegexChange:F=>v(M,"regex",F),onReactionChange:F=>v(M,"reaction",F)}),e.jsx(I,{rule:C}),e.jsxs(js,{children:[e.jsx(Nt,{asChild:!0,children:e.jsx(k,{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:["确定要删除正则规则 ",M+1," 吗?此操作无法撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>N(M),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(re,{value:C.regex&&C.regex[0]||"",onChange:F=>v(M,"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(T,{className:"text-xs font-medium",children:"反应内容"}),e.jsx(et,{value:C.reaction,onChange:F=>v(M,"reaction",F.target.value),placeholder:`触发后麦麦的反应... +可以使用 [捕获组名] 来引用正则表达式中的内容`,rows:3,className:"text-sm"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"使用 [捕获组名] 引用正则表达式中的命名捕获组,例如 [n] 会被替换为捕获的内容"})]})]})]},M)),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(k,{onClick:y,size:"sm",variant:"outline",children:[e.jsx(st,{className:"h-4 w-4 mr-1"}),"添加关键词规则"]})]}),e.jsxs("div",{className:"space-y-3",children:[n.keyword_rules.map((C,M)=>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:["关键词规则 ",M+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(E,{rule:C}),e.jsxs(js,{children:[e.jsx(Nt,{asChild:!0,children:e.jsx(k,{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:["确定要删除关键词规则 ",M+1," 吗?此操作无法撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>w(M),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(k,{onClick:()=>O(M),size:"sm",variant:"ghost",children:[e.jsx(st,{className:"h-3 w-3 mr-1"}),"添加关键词"]})]}),e.jsxs("div",{className:"space-y-2",children:[(C.keywords||[]).map((F,D)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(re,{value:F,onChange:se=>_(M,D,se.target.value),placeholder:"关键词",className:"flex-1"}),e.jsx(k,{onClick:()=>A(M,D),size:"sm",variant:"ghost",children:e.jsx(ns,{className:"h-4 w-4"})})]},D)),(!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(et,{value:C.reaction,onChange:F=>b(M,"reaction",F.target.value),placeholder:"触发后麦麦的反应...",rows:3,className:"text-sm"})]})]})]},M)),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: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(Fe,{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(re,{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(re,{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(re,{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(re,{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(Fe,{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(re,{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(re,{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(Fe,{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(Fe,{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:"当句子数量超出限制时,合并后一次性返回所有内容"})]})]})})]})]})]})}),r_=Ms.memo(function({config:n,onChange:i}){const[c,u]=m.useState(""),[x,h]=m.useState(""),[f,p]=m.useState(!1),g=n.allowed_ips?n.allowed_ips.split(",").map(_=>_.trim()).filter(_=>_):[],N=n.trusted_proxies?n.trusted_proxies.split(",").map(_=>_.trim()).filter(_=>_):[],v=()=>{if(!c.trim())return;const _=[...g,c.trim()];i({...n,allowed_ips:_.join(",")}),u("")},y=_=>{const I=g.filter((E,C)=>C!==_);i({...n,allowed_ips:I.join(",")})},w=()=>{if(!x.trim())return;const _=[...N,x.trim()];i({...n,trusted_proxies:_.join(",")}),h("")},b=_=>{const I=N.filter((E,C)=>C!==_);i({...n,trusted_proxies:I.join(",")})},O=_=>{!_&&n.enabled?p(!0):i({...n,enabled:_})},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(Fe,{checked:n.enabled,onCheckedChange:O}),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(Be,{value:n.mode,onValueChange:_=>i({...n,mode:_}),children:[e.jsx(Le,{children:e.jsx($e,{placeholder:"选择运行模式"})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"development",children:"开发模式"}),e.jsx(ee,{value:"production",children:"生产模式"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"注意: WebUI 的监听地址和端口请在 .env 文件中配置 WEBUI_HOST 和 WEBUI_PORT"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"防爬虫模式"}),e.jsxs(Be,{value:n.anti_crawler_mode,onValueChange:_=>i({...n,anti_crawler_mode:_}),children:[e.jsx(Le,{children:e.jsx($e,{placeholder:"选择防爬虫模式"})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"false",children:"禁用"}),e.jsx(ee,{value:"basic",children:"基础(只记录不阻止)"}),e.jsx(ee,{value:"loose",children:"宽松"}),e.jsx(ee,{value:"strict",children:"严格"})]})]})]}),e.jsxs("div",{className:"grid gap-2 sm:col-span-2",children:[e.jsx(T,{children:"IP 白名单"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(re,{value:c,onChange:_=>u(_.target.value),onKeyDown:_=>{_.key==="Enter"&&(_.preventDefault(),v())},placeholder:"输入IP地址后按回车或点击添加"}),e.jsx(k,{type:"button",size:"sm",onClick:v,disabled:!c.trim(),children:e.jsx(st,{className:"h-4 w-4"})})]}),g.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:g.map((_,I)=>e.jsxs(Ae,{variant:"secondary",className:"flex items-center gap-1",children:[_,e.jsx("button",{type:"button",onClick:()=>y(I),className:"ml-1 hover:bg-destructive/20 rounded-full p-0.5",children:e.jsx(_a,{className:"h-3 w-3"})})]},I))}),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(re,{value:x,onChange:_=>h(_.target.value),onKeyDown:_=>{_.key==="Enter"&&(_.preventDefault(),w())},placeholder:"输入代理IP后按回车或点击添加"}),e.jsx(k,{type:"button",size:"sm",onClick:w,disabled:!x.trim(),children:e.jsx(st,{className:"h-4 w-4"})})]}),N.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:N.map((_,I)=>e.jsxs(Ae,{variant:"secondary",className:"flex items-center gap-1",children:[_,e.jsx("button",{type:"button",onClick:()=>b(I),className:"ml-1 hover:bg-destructive/20 rounded-full p-0.5",children:e.jsx(_a,{className:"h-3 w-3"})})]},I))}),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:_=>i({...n,trust_xff:_})}),e.jsx(T,{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:_=>i({...n,secure_cookie:_})}),e.jsx(T,{className:"cursor-pointer",children:"启用安全 Cookie(仅 HTTPS)"})]})]})]}),e.jsx(js,{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:"确认关闭"})]})]})})]})}),mn="/api/webui/config";async function ig(){const n=await(await we(`${mn}/bot`)).json();if(!n.success)throw new Error("获取配置数据失败");return n.config}async function ln(){const n=await(await we(`${mn}/model`)).json();if(!n.success)throw new Error("获取模型配置数据失败");return n.config}async function cg(l){const i=await(await we(`${mn}/bot`,{method:"POST",body:JSON.stringify(l)})).json();if(!i.success)throw new Error(i.message||"保存配置失败")}async function i_(){const n=await(await we(`${mn}/bot/raw`)).json();if(!n.success)throw new Error("获取配置源代码失败");return n.content}async function c_(l){const i=await(await we(`${mn}/bot/raw`,{method:"POST",body:JSON.stringify({raw_content:l})})).json();if(!i.success)throw new Error(i.message||"保存配置失败")}async function Gi(l){const i=await(await we(`${mn}/model`,{method:"POST",body:JSON.stringify(l)})).json();if(!i.success)throw new Error(i.message||"保存配置失败")}async function o_(l,n){const c=await(await we(`${mn}/bot/section/${l}`,{method:"POST",body:JSON.stringify(n)})).json();if(!c.success)throw new Error(c.message||`保存配置节 ${l} 失败`)}async function zm(l,n){const c=await(await we(`${mn}/model/section/${l}`,{method:"POST",body:JSON.stringify(n)})).json();if(!c.success)throw new Error(c.message||`保存配置节 ${l} 失败`)}async function d_(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 u_(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 m_=$r("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"}}),rt=m.forwardRef(({className:l,variant:n,...i},c)=>e.jsx("div",{ref:c,role:"alert",className:B(m_({variant:n}),l),...i}));rt.displayName="Alert";const Dn=m.forwardRef(({className:l,...n},i)=>e.jsx("h5",{ref:i,className:B("mb-1 font-medium leading-none tracking-tight",l),...n}));Dn.displayName="AlertTitle";const it=m.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:B("text-sm [&_p]:leading-relaxed",l),...n}));it.displayName="AlertDescription";const x_={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:"#"}}},h_={python:[c1()],json:[o1(),d1()],toml:[i1.define(x_)],text:[]};function av({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]=m.useState(!1);if(m.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=[...h_[i]||[],Xp.lineWrapping];return c&&y.push(Xp.editable.of(!1)),e.jsx("div",{className:`rounded-md overflow-hidden border ${g}`,children:e.jsx(u1,{value:l,height:u,minHeight:x,maxHeight:h,theme:p==="dark"?m1: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 f_({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:O}=Ij({id:l,disabled:f}),A={transform:Hj.Transform.toString(w),transition:b};return e.jsxs("div",{ref:y,style:A,className:B("flex items-start gap-2 group",O&&"opacity-50 z-50"),children:[e.jsx("button",{type:"button",className:B("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(Nj,{className:"h-4 w-4"})}),e.jsx("div",{className:"flex-1 min-w-0",children:i==="object"&&c?e.jsx(p_,{value:u,onChange:x,fields:c,disabled:f}):i==="number"?e.jsx(re,{type:"number",value:u??"",onChange:_=>x(parseFloat(_.target.value)||0),placeholder:g??`第 ${n+1} 项`,disabled:f,className:"font-mono"}):e.jsx(re,{type:"text",value:u??"",onChange:_=>x(_.target.value),placeholder:g??`第 ${n+1} 项`,disabled:f})}),e.jsx(k,{type:"button",variant:"ghost",size:"icon",onClick:h,disabled:f||!p,className:B("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 p_({value:l,onChange:n,fields:i,disabled:c}){const u=m.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(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(T,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsx("span",{className:"text-xs text-muted-foreground",children:g})]}),e.jsx(wa,{value:[g],onValueChange:N=>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(Be,{value:String(p??f.default??""),onValueChange:g=>u(h,g),disabled:c,children:[e.jsx(Le,{className:"h-8 text-sm",children:e.jsx($e,{placeholder:f.placeholder??"请选择"})}),e.jsx(Ue,{children:f.choices.map(g=>e.jsx(ee,{value:String(g),children:String(g)},String(g)))})]})]}):f.type==="number"?e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsx(re,{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(re,{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(De,{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 g_({value:l,onChange:n,itemType:i="string",itemFields:c,minItems:u,maxItems:x,disabled:h,placeholder:f}){const p=m.useMemo(()=>Array.isArray(l)?l:typeof l=="string"&&l.trim()?l.split(",").map(E=>E.trim()):[],[l]),[g]=m.useState(()=>new Map),N=m.useCallback(E=>(g.has(E)||g.set(E,`item-${Date.now()}-${E}-${Math.random().toString(36).slice(2)}`),g.get(E)),[g]),v=m.useMemo(()=>{const E=[];for(let C=0;C{const{active:C,over:M}=E;if(M&&C.id!==M.id){const F=v.indexOf(C.id),D=v.indexOf(M.id),se=Lj(p,F,D);n(se)}},[p,v,n]),b=m.useCallback(()=>{if(x!=null&&p.length>=x)return;let E;i==="object"&&c?E=Object.fromEntries(Object.entries(c).map(([C,M])=>[C,M.default??""])):i==="number"?E=0:E="",n([...p,E])},[p,x,i,c,n]),O=m.useCallback((E,C)=>{const M=[...p];M[E]=C,n(M)},[p,n]),A=m.useCallback(E=>{if(u!=null&&p.length<=u)return;const C=p.filter((M,F)=>F!==E);g.delete(E),n(C)},[p,u,g,n]),_=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(St,{className:"h-4 w-4"}),e.jsx("span",{children:"暂无数据,点击下方按钮添加"})]}):e.jsx(Uj,{sensors:y,collisionDetection:Bj,onDragEnd:w,children:e.jsx($j,{items:v,strategy:x1,children:e.jsx("div",{className:"space-y-2",children:p.map((E,C)=>e.jsx(f_,{id:v[C],index:C,itemType:i,itemFields:c,value:E,onChange:M=>O(C,M),onRemove:()=>A(C),disabled:h,canRemove:I,placeholder:f},v[C]))})})}),e.jsxs(k,{type:"button",variant:"outline",size:"sm",onClick:b,disabled:h||!_,className:"w-full",children:[e.jsx(st,{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 Gm({content:l,className:n=""}){return e.jsx("div",{className:`prose prose-sm dark:prose-invert max-w-none ${n}`,children:e.jsx(v1,{remarkPlugins:[b1,y1],rehypePlugins:[N1],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 j_(l,n,i,c={}){const{debounceMs:u=2e3,onSaveSuccess:x,onSaveError:h}=c,f=m.useRef(null),p=m.useCallback(async(y,w)=>{try{n(!0),await o_(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=m.useCallback((y,w)=>{l||(i(!0),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{p(y,w)},u))},[l,i,p,u]),N=m.useCallback(async(y,w)=>{f.current&&(clearTimeout(f.current),f.current=null),await p(y,w)},[p]),v=m.useCallback(()=>{f.current&&(clearTimeout(f.current),f.current=null)},[]);return m.useEffect(()=>()=>{f.current&&clearTimeout(f.current)},[]),{triggerAutoSave:g,saveNow:N,cancelPendingAutoSave:v}}function $t(l,n,i,c){m.useEffect(()=>{l&&!i&&c(n,l)},[l])}const v_=500;function N_(){return e.jsx(Pn,{children:e.jsx(b_,{})})}function b_(){const[l,n]=m.useState(!0),[i,c]=m.useState(!1),[u,x]=m.useState(!1),[h,f]=m.useState(!1),[p,g]=m.useState("visual"),[N,v]=m.useState(""),[y,w]=m.useState(!1),{toast:b}=Zs(),{triggerRestart:O,isRestarting:A}=un(),[_,I]=m.useState(null),[E,C]=m.useState(null),[M,F]=m.useState(null),[D,se]=m.useState(null),[G,me]=m.useState(null),[ce,Ne]=m.useState(null),[le,ge]=m.useState(null),[be,z]=m.useState(null),[q,U]=m.useState(null),[L,$]=m.useState(null),[_e,pe]=m.useState(null),[Se,Q]=m.useState(null),[ye,X]=m.useState(null),[he,Ee]=m.useState(null),[Y,ie]=m.useState(null),[Ie,V]=m.useState(null),[Z,Oe]=m.useState(null),[ze,Te]=m.useState(null),[oe,ke]=m.useState(null),is=m.useRef(!0),Ot=m.useRef({}),Zt=m.useCallback(Ce=>{Ot.current=Ce,I(Ce.bot),C(Ce.personality);const vs=Ce.chat;vs.talk_value_rules||(vs.talk_value_rules=[]),F(vs),se(Ce.expression),me(Ce.emoji),Ne(Ce.memory),ge(Ce.tool),z(Ce.voice),U(Ce.dream),$(Ce.lpmm_knowledge),pe(Ce.keyword_reaction),Q(Ce.response_post_process),X(Ce.chinese_typo),Ee(Ce.response_splitter),ie(Ce.log),V(Ce.debug),Oe(Ce.maim_message),Te(Ce.telemetry),ke(Ce.webui)},[]),$a=m.useCallback(()=>({...Ot.current,bot:_,personality:E,chat:M,expression:D,emoji:G,memory:ce,tool:le,voice:be,dream:q,lpmm_knowledge:L,keyword_reaction:_e,response_post_process:Se,chinese_typo:ye,response_splitter:he,log:Y,debug:Ie,maim_message:Z,telemetry:ze,webui:oe}),[_,E,M,D,G,ce,le,be,q,L,_e,Se,ye,he,Y,Ie,Z,ze,oe]),It=m.useCallback(async()=>{try{const vs=(await i_()).replace(/"([^"]*)"/g,(as,Ze)=>`"${Ze.replace(/\\n/g,` +`).replace(/\\t/g," ").replace(/\\r/g,"\r").replace(/\\"/g,'"').replace(/\\\\/g,"\\")}"`);v(vs),w(!1)}catch(Ce){b({variant:"destructive",title:"加载失败",description:Ce instanceof Error?Ce.message:"加载源代码失败"})}},[b]),dt=m.useCallback(async()=>{try{n(!0);const Ce=await ig();Zt(Ce),f(!1),is.current=!1,await It()}catch(Ce){console.error("加载配置失败:",Ce),b({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}finally{n(!1)}},[b,It,Zt]);m.useEffect(()=>{dt()},[dt]);const{triggerAutoSave:P,cancelPendingAutoSave:Pe}=j_(is.current,x,f);$t(_,"bot",is.current,P),$t(E,"personality",is.current,P),$t(M,"chat",is.current,P),$t(D,"expression",is.current,P),$t(G,"emoji",is.current,P),$t(ce,"memory",is.current,P),$t(le,"tool",is.current,P),$t(be,"voice",is.current,P),$t(L,"lpmm_knowledge",is.current,P),$t(_e,"keyword_reaction",is.current,P),$t(Se,"response_post_process",is.current,P),$t(ye,"chinese_typo",is.current,P),$t(he,"response_splitter",is.current,P),$t(Y,"log",is.current,P),$t(Ie,"debug",is.current,P),$t(Z,"maim_message",is.current,P),$t(ze,"telemetry",is.current,P),$t(oe,"webui",is.current,P);const qe=async()=>{try{c(!0);const Ce=N.replace(/"([^"]*)"/g,(vs,as)=>`"${as.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r")}"`);await c_(Ce),f(!1),w(!1),b({title:"保存成功",description:"配置已保存"}),await dt()}catch(Ce){w(!0),b({variant:"destructive",title:"保存失败",description:Ce instanceof Error?Ce.message:"保存配置失败"})}finally{c(!1)}},Je=async Ce=>{if(h){b({variant:"destructive",title:"切换失败",description:"请先保存当前更改"});return}if(g(Ce),Ce==="source")await It();else try{const vs=await ig();Zt(vs),f(!1)}catch(vs){console.error("加载配置失败:",vs),b({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}},As=async()=>{try{c(!0),Pe(),await cg($a()),f(!1),b({title:"保存成功",description:"麦麦主程序配置已保存"})}catch(Ce){console.error("保存配置失败:",Ce),b({title:"保存失败",description:Ce.message,variant:"destructive"})}finally{c(!1)}},ts=async()=>{await O()},Ss=async()=>{try{c(!0),Pe(),await cg($a()),f(!1),b({title:"保存成功",description:"配置已保存,即将重启麦麦..."}),await new Promise(Ce=>setTimeout(Ce,v_)),await ts()}catch(Ce){console.error("保存失败:",Ce),b({title:"保存失败",description:Ce.message,variant:"destructive"})}finally{c(!1)}};return l?e.jsx(ss,{className:"h-full",children:e.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):e.jsx(ss,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:gap-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl md:text-3xl font-bold",children:"麦麦主程序配置"}),e.jsx("p",{className:"text-muted-foreground mt-1 text-xs sm:text-sm",children:"管理麦麦的核心功能和行为设置"})]}),e.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[e.jsxs(k,{onClick:p==="visual"?As:qe,disabled:i||u||!h||A,size:"sm",variant:"outline",className:"w-20 sm:w-24",children:[e.jsx(sc,{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(js,{children:[e.jsx(Nt,{asChild:!0,children:e.jsxs(k,{disabled:i||u||A,size:"sm",className:"w-20 sm:w-28",children:[e.jsx(ec,{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?Ss:ts,children:h?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsx("div",{className:"flex",children:e.jsx(xa,{value:p,onValueChange:Ce=>Je(Ce),className:"w-full",children:e.jsxs(aa,{className:"h-8 sm:h-9 w-full grid grid-cols-2",children:[e.jsxs(ls,{value:"visual",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(ls,{value:"source",className:"text-xs sm:text-sm",children:[e.jsx(yj,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"源代码编辑"]})]})})})]}),e.jsxs(rt,{children:[e.jsx(Kt,{className:"h-4 w-4"}),e.jsxs(it,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),p==="source"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(rt,{children:[e.jsx(Kt,{className:"h-4 w-4"}),e.jsxs(it,{children:[e.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。此功能仅适用于熟悉 TOML 语法的高级用户。保存时会在后端验证格式,只有格式完全正确才能保存。",y&&e.jsx("span",{className:"text-destructive font-semibold ml-2",children:"⚠️ 上次保存失败,请检查 TOML 格式"})]})]}),e.jsx(av,{value:N,onChange:Ce=>{v(Ce),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(xa,{defaultValue:"bot",className:"w-full",children:[e.jsxs(aa,{className:"flex flex-wrap h-auto gap-1 p-1 sm:grid sm:grid-cols-5 lg:grid-cols-10",children:[e.jsx(ls,{value:"bot",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"基本信息"}),e.jsx(ls,{value:"personality",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"人格"}),e.jsx(ls,{value:"chat",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"聊天"}),e.jsx(ls,{value:"expression",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"表达"}),e.jsx(ls,{value:"features",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"功能"}),e.jsx(ls,{value:"processing",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"处理"}),e.jsx(ls,{value:"dream",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"做梦"}),e.jsx(ls,{value:"lpmm",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"知识库"}),e.jsx(ls,{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(ls,{value:"other",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"其他"})]}),e.jsx(ws,{value:"bot",className:"space-y-4",children:_&&e.jsx(P2,{config:_,onChange:I})}),e.jsx(ws,{value:"personality",className:"space-y-4",children:E&&e.jsx(G2,{config:E,onChange:C})}),e.jsx(ws,{value:"chat",className:"space-y-4",children:M&&e.jsx(Q2,{config:M,onChange:F})}),e.jsx(ws,{value:"expression",className:"space-y-4",children:D&&e.jsx(a_,{config:D,onChange:se})}),e.jsx(ws,{value:"features",className:"space-y-4",children:G&&ce&&le&&be&&e.jsx(s_,{emojiConfig:G,memoryConfig:ce,toolConfig:le,voiceConfig:be,onEmojiChange:me,onMemoryChange:Ne,onToolChange:ge,onVoiceChange:z})}),e.jsx(ws,{value:"processing",className:"space-y-4",children:_e&&Se&&ye&&he&&e.jsx(n_,{keywordReactionConfig:_e,responsePostProcessConfig:Se,chineseTypoConfig:ye,responseSplitterConfig:he,onKeywordReactionChange:pe,onResponsePostProcessChange:Q,onChineseTypoChange:X,onResponseSplitterChange:Ee})}),e.jsx(ws,{value:"dream",className:"space-y-4",children:q&&e.jsx(Y2,{config:q,onChange:U})}),e.jsx(ws,{value:"lpmm",className:"space-y-4",children:L&&e.jsx(J2,{config:L,onChange:$})}),e.jsx(ws,{value:"webui",className:"space-y-4",children:oe&&e.jsx(r_,{config:oe,onChange:ke})}),e.jsxs(ws,{value:"other",className:"space-y-4",children:[Y&&e.jsx(X2,{config:Y,onChange:ie}),Ie&&e.jsx(Z2,{config:Ie,onChange:V}),Z&&e.jsx(W2,{config:Z,onChange:Oe}),ze&&e.jsx(e_,{config:ze,onChange:Te})]})]})}),e.jsx(Gn,{})]})})}const El=m.forwardRef(({className:l,...n},i)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:i,className:B("w-full caption-bottom text-sm",l),...n})}));El.displayName="Table";const Ml=m.forwardRef(({className:l,...n},i)=>e.jsx("thead",{ref:i,className:B("[&_tr]:border-b",l),...n}));Ml.displayName="TableHeader";const Al=m.forwardRef(({className:l,...n},i)=>e.jsx("tbody",{ref:i,className:B("[&_tr:last-child]:border-0",l),...n}));Al.displayName="TableBody";const y_=m.forwardRef(({className:l,...n},i)=>e.jsx("tfoot",{ref:i,className:B("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",l),...n}));y_.displayName="TableFooter";const ct=m.forwardRef(({className:l,...n},i)=>e.jsx("tr",{ref:i,className:B("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",l),...n}));ct.displayName="TableRow";const Ye=m.forwardRef(({className:l,...n},i)=>e.jsx("th",{ref:i,className:B("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}));Ye.displayName="TableHead";const Ge=m.forwardRef(({className:l,...n},i)=>e.jsx("td",{ref:i,className:B("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",l),...n}));Ge.displayName="TableCell";const w_=m.forwardRef(({className:l,...n},i)=>e.jsx("caption",{ref:i,className:B("mt-4 text-sm text-muted-foreground",l),...n}));w_.displayName="TableCaption";const Vo=m.forwardRef(({className:l,...n},i)=>e.jsx(fa,{ref:i,className:B("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",l),...n}));Vo.displayName=fa.displayName;const Ko=m.forwardRef(({className:l,...n},i)=>e.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[e.jsx(Qt,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(fa.Input,{ref:i,className:B("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})]}));Ko.displayName=fa.Input.displayName;const Qo=m.forwardRef(({className:l,...n},i)=>e.jsx(fa.List,{ref:i,className:B("max-h-[300px] overflow-y-auto overflow-x-hidden",l),...n}));Qo.displayName=fa.List.displayName;const Yo=m.forwardRef((l,n)=>e.jsx(fa.Empty,{ref:n,className:"py-6 text-center text-sm",...l}));Yo.displayName=fa.Empty.displayName;const Yi=m.forwardRef(({className:l,...n},i)=>e.jsx(fa.Group,{ref:i,className:B("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}));Yi.displayName=fa.Group.displayName;const __=m.forwardRef(({className:l,...n},i)=>e.jsx(fa.Separator,{ref:i,className:B("-mx-1 h-px bg-border",l),...n}));__.displayName=fa.Separator.displayName;const Ji=m.forwardRef(({className:l,...n},i)=>e.jsx(fa.Item,{ref:i,className:B("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}));Ji.displayName=fa.Item.displayName;const Js=m.forwardRef(({className:l,...n},i)=>e.jsx(rj,{ref:i,className:B("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(jw,{className:B("grid place-content-center text-current"),children:e.jsx(wt,{className:"h-4 w-4"})})}));Js.displayName=rj.displayName;const lv=m.createContext(null),nv="maibot-completed-tours";function S_(){try{const l=localStorage.getItem(nv);return l?new Set(JSON.parse(l)):new Set}catch{return new Set}}function og(l){localStorage.setItem(nv,JSON.stringify([...l]))}function k_({children:l}){const[n,i]=m.useState({activeTourId:null,stepIndex:0,isRunning:!1}),[c]=m.useState(()=>new Map),[u,x]=m.useState(S_),[,h]=m.useState(0),f=m.useCallback((E,C)=>{c.set(E,C),h(M=>M+1)},[c]),p=m.useCallback(E=>{c.delete(E),i(C=>C.activeTourId===E?{...C,activeTourId:null,isRunning:!1,stepIndex:0}:C)},[c]),g=m.useCallback((E,C=0)=>{c.has(E)&&i({activeTourId:E,stepIndex:C,isRunning:!0})},[c]),N=m.useCallback(()=>{i(E=>({...E,isRunning:!1}))},[]),v=m.useCallback(E=>{i(C=>({...C,stepIndex:E}))},[]),y=m.useCallback(()=>{i(E=>({...E,stepIndex:E.stepIndex+1}))},[]),w=m.useCallback(()=>{i(E=>({...E,stepIndex:Math.max(0,E.stepIndex-1)}))},[]),b=m.useCallback(()=>n.activeTourId?c.get(n.activeTourId)||[]:[],[n.activeTourId,c]),O=m.useCallback(E=>{x(C=>{const M=new Set(C);return M.add(E),og(M),M})},[]),A=m.useCallback(E=>{const{action:C,index:M,status:F,type:D}=E,se=["finished","skipped"];if(C==="close"){i(G=>({...G,isRunning:!1,stepIndex:0}));return}se.includes(F)?i(G=>(F==="finished"&&G.activeTourId&&setTimeout(()=>O(G.activeTourId),0),{...G,isRunning:!1,stepIndex:0})):D==="step:after"&&(C==="next"?i(G=>({...G,stepIndex:M+1})):C==="prev"&&i(G=>({...G,stepIndex:M-1})))},[O]),_=m.useCallback(E=>u.has(E),[u]),I=m.useCallback(E=>{x(C=>{const M=new Set(C);return M.delete(E),og(M),M})},[]);return e.jsx(lv.Provider,{value:{state:n,tours:c,registerTour:f,unregisterTour:p,startTour:g,stopTour:N,goToStep:v,nextStep:y,prevStep:w,getCurrentSteps:b,handleJoyrideCallback:A,isTourCompleted:_,markTourCompleted:O,resetTourCompleted:I},children:l})}function Fm(){const l=m.useContext(lv);if(!l)throw new Error("useTour must be used within a TourProvider");return l}const C_={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)"}},T_={back:"上一步",close:"关闭",last:"完成",next:"下一步",nextLabelWithProgress:"下一步 ({step}/{steps})",open:"打开对话框",skip:"跳过"};function E_(){const{state:l,getCurrentSteps:n,handleJoyrideCallback:i}=Fm(),c=n(),[u,x]=m.useState(!1),h=m.useRef(l.stepIndex),f=m.useRef(null);m.useEffect(()=>{h.current!==l.stepIndex&&(x(!1),h.current=l.stepIndex)},[l.stepIndex]),m.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 I=document.querySelector(y);if(I){const E=I.getBoundingClientRect();if(E.width>0&&E.height>0)return!0}return!1};if(b()){setTimeout(()=>x(!0),100);return}const O=setInterval(()=>{b()&&(clearInterval(O),setTimeout(()=>x(!0),100))},100),A=setTimeout(()=>{clearInterval(O),x(!0)},5e3),_=()=>{clearInterval(O),clearTimeout(A)};f.current=_},150);return()=>{clearTimeout(w),f.current&&(f.current(),f.current=null)}},[l.isRunning,l.stepIndex,c]);const[p,g]=m.useState(null);if(m.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(f1,{steps:c,stepIndex:l.stepIndex,run:l.isRunning,continuous:!0,showSkipButton:!0,showProgress:!0,disableOverlayClose:!0,disableScrolling:!1,disableScrollParentFix:!1,callback:i,styles:C_,locale:T_,scrollOffset:80,scrollToFirstStep:!0,floaterProps:{styles:{floater:{zIndex:99999}},disableAnimation:!0}},`tour-step-${l.stepIndex}`);return p?t0.createPortal(N,p):N}const el="model-assignment-tour",rv=[{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}],iv={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"},$i=[{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 dg(l){return l?l.replace(/\/+$/,"").toLowerCase():""}function M_(l){if(!l)return null;const n=dg(l);return $i.find(i=>i.id!=="custom"&&dg(i.base_url)===n)||null}const yo=l=>({...l,max_retry:l.max_retry??2,timeout:l.timeout??30,retry_interval:l.retry_interval??10}),A_=l=>{const n={};return l?(l.name?.trim()||(n.name="请输入提供商名称"),l.base_url?.trim()||(n.base_url="请输入基础 URL"),l.api_key?.trim()||(n.api_key="请输入 API Key"),{isValid:Object.keys(n).length===0,errors:n}):{isValid:!1,errors:{name:"提供商数据为空"}}};function z_(){return e.jsx(Pn,{children:e.jsx(D_,{})})}function D_(){const[l,n]=m.useState([]),[i,c]=m.useState(!0),[u,x]=m.useState(!1),[h,f]=m.useState(!1),[p,g]=m.useState(!1),[N,v]=m.useState(!1),[y,w]=m.useState(null),[b,O]=m.useState(null),[A,_]=m.useState("custom"),[I,E]=m.useState(!1),[C,M]=m.useState(!1),[F,D]=m.useState(null),[se,G]=m.useState(!1),[me,ce]=m.useState(""),[Ne,le]=m.useState(new Set),[ge,be]=m.useState(!1),[z,q]=m.useState(1),[U,L]=m.useState(20),[$,_e]=m.useState(""),[pe,Se]=m.useState({isOpen:!1,providersToDelete:[],affectedModels:[],pendingProviders:[],context:"auto",oldProviders:[]}),[Q,ye]=m.useState({}),[X,he]=m.useState(new Set),[Ee,Y]=m.useState(new Map),{toast:ie}=Zs(),Ie=la(),{state:V,goToStep:Z,registerTour:Oe}=Fm(),{triggerRestart:ze,isRestarting:Te}=un(),oe=m.useRef(null),ke=m.useRef(!0);m.useEffect(()=>{Oe(el,rv)},[Oe]),m.useEffect(()=>{if(V.activeTourId===el&&V.isRunning){const J=iv[V.stepIndex];J&&!window.location.pathname.endsWith(J.replace("/config/",""))&&Ie({to:J})}},[V.stepIndex,V.activeTourId,V.isRunning,Ie]);const is=m.useRef(V.stepIndex);m.useEffect(()=>{if(V.activeTourId===el&&V.isRunning){const J=is.current,ve=V.stepIndex;J>=3&&J<=9&&ve<3&&v(!1),J>=10&&ve>=3&&ve<=9&&(ye({}),_("custom"),w({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10}),O(null),G(!1),v(!0)),is.current=ve}},[V.stepIndex,V.activeTourId,V.isRunning]),m.useEffect(()=>{if(V.activeTourId!==el||!V.isRunning)return;const J=ve=>{const Me=ve.target,Ls=V.stepIndex;Ls===2&&Me.closest('[data-tour="add-provider-button"]')?setTimeout(()=>Z(3),300):Ls===9&&Me.closest('[data-tour="provider-cancel-button"]')&&setTimeout(()=>Z(10),300)};return document.addEventListener("click",J,!0),()=>document.removeEventListener("click",J,!0)},[V,Z]),m.useEffect(()=>{Ot()},[]);const Ot=async()=>{try{c(!0);const J=await ln();n(J.api_providers||[]),g(!1),ke.current=!1}catch(J){console.error("加载配置失败:",J)}finally{c(!1)}},Zt=async()=>{await ze()},$a=async()=>{try{x(!0),oe.current&&clearTimeout(oe.current);const J=l.map(at=>({...at,max_retry:at.max_retry??2,timeout:at.timeout??30,retry_interval:at.retry_interval??10})),{shouldProceed:ve}=await It(J,"restart");if(!ve){x(!1);return}const Me=await ln(),Ls=new Set(J.map(at=>at.name)),Yt=(Me.models||[]).filter(at=>Ls.has(at.api_provider));Me.api_providers=J,Me.models=Yt,await Gi(Me),g(!1),ie({title:"保存成功",description:"正在重启麦麦..."}),await Zt()}catch(J){console.error("保存配置失败:",J),ie({title:"保存失败",description:J.message,variant:"destructive"}),x(!1)}},It=m.useCallback(async(J,ve="auto")=>{try{const Me=await ln(),Ls=new Set(l.map(ut=>ut.name)),zt=new Set(J.map(ut=>ut.name)),Yt=Array.from(Ls).filter(ut=>!zt.has(ut));if(Yt.length===0)return{shouldProceed:!0,providers:J};const Jt=(Me.models||[]).filter(ut=>Yt.includes(ut.api_provider));return Jt.length===0?{shouldProceed:!0,providers:J}:(Se({isOpen:!0,providersToDelete:Yt,affectedModels:Jt,pendingProviders:J,context:ve,oldProviders:[...l]}),{shouldProceed:!1,providers:J})}catch(Me){return console.error("检查删除影响失败:",Me),{shouldProceed:!0,providers:J}}},[l]),dt=async()=>{try{(pe.context==="auto"?f:x)(!0),Se(ut=>({...ut,isOpen:!1}));const ve=await ln(),Me=pe.pendingProviders.map(yo),Ls=new Set(Me.map(ut=>ut.name)),Yt=(ve.models||[]).filter(ut=>Ls.has(ut.api_provider)),at=new Set(pe.affectedModels.map(ut=>ut.name)),Jt=ve.model_task_config;Jt&&Object.keys(Jt).forEach(ut=>{const te=Jt[ut];te&&Array.isArray(te.model_list)&&(te.model_list=te.model_list.filter(ue=>!at.has(ue)))}),ve.api_providers=Me,ve.models=Yt,ve.model_task_config=Jt,await Gi(ve),n(pe.pendingProviders),g(!1),ie({title:"删除成功",description:`已删除 ${pe.providersToDelete.length} 个提供商和 ${pe.affectedModels.length} 个关联模型`}),Se({isOpen:!1,providersToDelete:[],affectedModels:[],pendingProviders:[],context:"auto",oldProviders:[]}),le(new Set),pe.context==="restart"&&await Zt()}catch(J){console.error("删除失败:",J),ie({title:"删除失败",description:J.message,variant:"destructive"})}finally{pe.context==="auto"?f(!1):x(!1)}},P=()=>{pe.oldProviders.length>0&&n(pe.oldProviders),Se({isOpen:!1,providersToDelete:[],affectedModels:[],pendingProviders:[],context:"auto",oldProviders:[]}),g(!1)},Pe=m.useCallback(async J=>{if(ke.current)return;const{shouldProceed:ve}=await It(J,"auto");if(!ve){g(!0);return}try{f(!0);const Me=J.map(yo);await zm("api_providers",Me),g(!1)}catch(Me){console.error("自动保存失败:",Me),ie({title:"自动保存失败",description:Me.message,variant:"destructive"}),g(!0)}finally{f(!1)}},[l,It]);m.useEffect(()=>{if(!ke.current)return g(!0),oe.current&&clearTimeout(oe.current),oe.current=setTimeout(()=>{Pe(l)},2e3),()=>{oe.current&&clearTimeout(oe.current)}},[l,Pe]);const qe=async()=>{try{x(!0),oe.current&&clearTimeout(oe.current);const J=l.map(yo),{shouldProceed:ve}=await It(J,"manual");if(!ve){x(!1);return}const Me=await ln(),Ls=new Set(J.map(at=>at.name)),zt=Me.models||[],Yt=zt.filter(at=>{const Jt=Ls.has(at.api_provider);return Jt||console.warn(`模型 "${at.name}" 引用了已删除的提供商 "${at.api_provider}",将被移除`),Jt});if(zt.length!==Yt.length){const at=zt.length-Yt.length;ie({title:"注意",description:`已自动移除 ${at} 个引用已删除提供商的模型`,variant:"default"})}console.log("发送的 providers 数据:",J),Me.api_providers=J,Me.models=Yt,console.log("完整配置数据:",Me),await Gi(Me),g(!1),ie({title:"保存成功",description:"模型提供商配置已保存"})}catch(J){console.error("保存配置失败:",J),ie({title:"保存失败",description:J.message,variant:"destructive"})}finally{x(!1)}},Je=(J,ve)=>{if(ye({}),J){const Me=$i.find(Ls=>Ls.base_url===J.base_url&&Ls.client_type===J.client_type);_(Me?.id||"custom"),w(J)}else _("custom"),w({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10});O(ve),G(!1),v(!0)},As=m.useCallback(J=>{_(J),E(!1);const ve=$i.find(Me=>Me.id===J);ve&&ve.id!=="custom"?w(Me=>({...Me,name:ve.name,base_url:ve.base_url,client_type:ve.client_type})):ve?.id==="custom"&&w(Me=>({...Me,name:"",base_url:"",client_type:"openai"}))},[]),ts=m.useMemo(()=>A!=="custom",[A]),Ss=m.useCallback(async()=>{if(y?.api_key)try{await navigator.clipboard.writeText(y.api_key),ie({title:"复制成功",description:"API Key 已复制到剪贴板"})}catch{ie({title:"复制失败",description:"无法访问剪贴板",variant:"destructive"})}},[y?.api_key,ie]),Ce=()=>{if(!y)return;const{isValid:J,errors:ve}=A_(y);if(!J){ye(ve);return}ye({});const Me=yo(y);if(b!==null){const Ls=[...l];Ls[b]=Me,n(Ls)}else n([...l,Me]);v(!1),w(null),O(null)},vs=J=>{if(!J&&y){const ve={...y,max_retry:y.max_retry??2,timeout:y.timeout??30,retry_interval:y.retry_interval??10};w(ve)}v(J)},as=J=>{D(J),M(!0)},Ze=async()=>{if(F!==null){const J=l.filter((Me,Ls)=>Ls!==F),{shouldProceed:ve}=await It(J,"manual");ve&&(n(J),ie({title:"删除成功",description:"提供商已从列表中移除"}))}M(!1),D(null)},Ns=J=>{const ve=new Set(Ne);ve.has(J)?ve.delete(J):ve.add(J),le(ve)},ft=()=>{if(Ne.size===Ts.length)le(new Set);else{const J=Ts.map((ve,Me)=>l.findIndex(Ls=>Ls===Ts[Me]));le(new Set(J))}},Rt=()=>{if(Ne.size===0){ie({title:"提示",description:"请先选择要删除的提供商",variant:"default"});return}be(!0)},Ws=async()=>{const J=l.filter((Me,Ls)=>!Ne.has(Ls)),{shouldProceed:ve}=await It(J,"manual");ve&&(n(J),le(new Set),ie({title:"批量删除成功",description:`已删除 ${Ne.size} 个提供商`})),be(!1)},Ts=m.useMemo(()=>{if(!me)return l;const J=me.toLowerCase();return l.filter(ve=>ve.name.toLowerCase().includes(J)||ve.base_url.toLowerCase().includes(J)||ve.client_type.toLowerCase().includes(J))},[l,me]),{totalPages:kt,paginatedProviders:Lt}=m.useMemo(()=>{const J=Math.ceil(Ts.length/U),ve=Ts.slice((z-1)*U,z*U);return{totalPages:J,paginatedProviders:ve}},[Ts,z,U]),ka=m.useCallback(()=>{const J=parseInt($);J>=1&&J<=kt&&(q(J),_e(""))},[$,kt]),Ya=async J=>{he(ve=>new Set(ve).add(J));try{const ve=await u_(J);Y(Me=>new Map(Me).set(J,ve)),ve.network_ok?ve.api_key_valid===!0?ie({title:"连接正常",description:`${J} 网络连接正常,API Key 有效 (${ve.latency_ms}ms)`}):ve.api_key_valid===!1?ie({title:"连接正常但 Key 无效",description:`${J} 网络连接正常,但 API Key 无效或已过期`,variant:"destructive"}):ie({title:"网络连接正常",description:`${J} 可以访问 (${ve.latency_ms}ms)`}):ie({title:"连接失败",description:ve.error||"无法连接到提供商",variant:"destructive"})}catch(ve){ie({title:"测试失败",description:ve.message,variant:"destructive"})}finally{he(ve=>{const Me=new Set(ve);return Me.delete(J),Me})}},nl=async()=>{for(const J of l)await Ya(J.name)},Fn=J=>{const ve=X.has(J),Me=Ee.get(J);return ve?e.jsxs(Ae,{variant:"secondary",className:"gap-1",children:[e.jsx(Os,{className:"h-3 w-3 animate-spin"}),"测试中"]}):Me?Me.network_ok?Me.api_key_valid===!0?e.jsxs(Ae,{className:"gap-1 bg-green-600 hover:bg-green-700",children:[e.jsx(sa,{className:"h-3 w-3"}),"正常"]}):Me.api_key_valid===!1?e.jsxs(Ae,{variant:"destructive",className:"gap-1",children:[e.jsx(St,{className:"h-3 w-3"}),"Key无效"]}):e.jsxs(Ae,{className:"gap-1 bg-blue-600 hover:bg-blue-700",children:[e.jsx(sa,{className:"h-3 w-3"}),"可访问"]}):e.jsxs(Ae,{variant:"destructive",className:"gap-1",children:[e.jsx(pj,{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:[Ne.size>0&&e.jsxs(k,{onClick:Rt,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"}),"批量删除 (",Ne.size,")"]}),e.jsxs(k,{onClick:nl,size:"sm",variant:"outline",className:"w-full sm:w-auto",disabled:l.length===0||X.size>0,children:[e.jsx(On,{className:"mr-2 h-4 w-4"}),X.size>0?`测试中 (${X.size})`:"测试全部"]}),e.jsxs(k,{onClick:()=>Je(null,null),size:"sm",className:"w-full sm:w-auto","data-tour":"add-provider-button",children:[e.jsx(st,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加提供商"]}),e.jsxs(k,{onClick:qe,disabled:u||h||!p||Te,size:"sm",variant:"outline",className:"w-full sm:w-auto sm:min-w-[120px]",children:[e.jsx(sc,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),u?"保存中...":h?"自动保存中...":p?"保存配置":"已保存"]}),e.jsxs(js,{children:[e.jsx(Nt,{asChild:!0,children:e.jsxs(k,{disabled:u||h||Te,size:"sm",className:"w-full sm:w-auto sm:min-w-[120px]",children:[e.jsx(ec,{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?$a:Zt,children:p?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsxs(rt,{children:[e.jsx(Kt,{className:"h-4 w-4"}),e.jsxs(it,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),e.jsxs(ss,{className:"h-[calc(100vh-260px)]",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 mb-4",children:[e.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[e.jsx(Qt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(re,{placeholder:"搜索提供商名称、URL 或类型...",value:me,onChange:J=>ce(J.target.value),className:"pl-9"})]}),me&&e.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",Ts.length," 个结果"]})]}),e.jsx("div",{className:"md:hidden space-y-3",children:Ts.length===0?e.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:me?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'}):Lt.map((J,ve)=>{const Me=l.findIndex(Ls=>Ls===J);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:J.name}),Fn(J.name)]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:J.base_url})]}),e.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[e.jsx(k,{variant:"outline",size:"sm",onClick:()=>Ya(J.name),disabled:X.has(J.name),title:"测试连接",children:X.has(J.name)?e.jsx(Os,{className:"h-4 w-4 animate-spin"}):e.jsx(On,{className:"h-4 w-4"})}),e.jsx(k,{variant:"default",size:"sm",onClick:()=>Je(J,Me),children:e.jsx(Ln,{className:"h-4 w-4",strokeWidth:2,fill:"none"})}),e.jsx(k,{size:"sm",onClick:()=>as(Me),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:J.client_type})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"最大重试"}),e.jsx("p",{className:"font-medium",children:J.max_retry})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"超时(秒)"}),e.jsx("p",{className:"font-medium",children:J.timeout})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"重试间隔(秒)"}),e.jsx("p",{className:"font-medium",children:J.retry_interval})]})]})]},ve)})}),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(El,{children:[e.jsx(Ml,{children:e.jsxs(ct,{children:[e.jsx(Ye,{className:"w-12",children:e.jsx(Js,{checked:Ne.size===Ts.length&&Ts.length>0,onCheckedChange:ft})}),e.jsx(Ye,{children:"状态"}),e.jsx(Ye,{children:"名称"}),e.jsx(Ye,{children:"基础URL"}),e.jsx(Ye,{children:"客户端类型"}),e.jsx(Ye,{className:"text-right",children:"最大重试"}),e.jsx(Ye,{className:"text-right",children:"超时(秒)"}),e.jsx(Ye,{className:"text-right",children:"重试间隔(秒)"}),e.jsx(Ye,{className:"text-right",children:"操作"})]})}),e.jsx(Al,{children:Lt.length===0?e.jsx(ct,{children:e.jsx(Ge,{colSpan:9,className:"text-center text-muted-foreground py-8",children:me?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'})}):Lt.map((J,ve)=>{const Me=l.findIndex(Ls=>Ls===J);return e.jsxs(ct,{children:[e.jsx(Ge,{children:e.jsx(Js,{checked:Ne.has(Me),onCheckedChange:()=>Ns(Me)})}),e.jsx(Ge,{children:Fn(J.name)||e.jsx(Ae,{variant:"outline",className:"text-muted-foreground",children:"未测试"})}),e.jsx(Ge,{className:"font-medium",children:J.name}),e.jsx(Ge,{className:"max-w-xs truncate",title:J.base_url,children:J.base_url}),e.jsx(Ge,{children:J.client_type}),e.jsx(Ge,{className:"text-right",children:J.max_retry}),e.jsx(Ge,{className:"text-right",children:J.timeout}),e.jsx(Ge,{className:"text-right",children:J.retry_interval}),e.jsx(Ge,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(k,{variant:"outline",size:"sm",onClick:()=>Ya(J.name),disabled:X.has(J.name),title:"测试连接",children:X.has(J.name)?e.jsx(Os,{className:"h-4 w-4 animate-spin"}):e.jsx(On,{className:"h-4 w-4"})}),e.jsxs(k,{variant:"default",size:"sm",onClick:()=>Je(J,Me),children:[e.jsx(Ln,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(k,{size:"sm",onClick:()=>as(Me),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"}),"删除"]})]})})]},ve)})})]})})}),Ts.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(Be,{value:U.toString(),onValueChange:J=>{L(parseInt(J)),q(1),le(new Set)},children:[e.jsx(Le,{id:"page-size-provider",className:"w-20",children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"10",children:"10"}),e.jsx(ee,{value:"20",children:"20"}),e.jsx(ee,{value:"50",children:"50"}),e.jsx(ee,{value:"100",children:"100"})]})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(z-1)*U+1," 到"," ",Math.min(z*U,Ts.length)," 条,共 ",Ts.length," 条"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(k,{variant:"outline",size:"sm",onClick:()=>q(1),disabled:z===1,className:"hidden sm:flex",children:e.jsx(Ir,{className:"h-4 w-4"})}),e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>q(J=>Math.max(1,J-1)),disabled:z===1,children:[e.jsx(ll,{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(re,{type:"number",value:$,onChange:J=>_e(J.target.value),onKeyDown:J=>J.key==="Enter"&&ka(),placeholder:z.toString(),className:"w-16 h-8 text-center",min:1,max:kt}),e.jsx(k,{variant:"outline",size:"sm",onClick:ka,disabled:!$,className:"h-8",children:"跳转"})]}),e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>q(J=>J+1),disabled:z>=kt,children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(ha,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(k,{variant:"outline",size:"sm",onClick:()=>q(kt),disabled:z>=kt,className:"hidden sm:flex",children:e.jsx(Hr,{className:"h-4 w-4"})})]})]})]}),e.jsx(Fs,{open:N,onOpenChange:vs,children:e.jsxs(Bs,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto","data-tour":"provider-dialog",preventOutsideClose:V.isRunning,children:[e.jsxs($s,{children:[e.jsx(Is,{children:b!==null?"编辑提供商":"添加提供商"}),e.jsx(tt,{children:"配置 API 提供商的连接信息和参数"})]}),e.jsxs("form",{onSubmit:J=>{J.preventDefault(),Ce()},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(tl,{open:I,onOpenChange:E,children:[e.jsx(al,{asChild:!0,children:e.jsxs(k,{variant:"outline",role:"combobox","aria-expanded":I,className:"w-full justify-between",children:[A?$i.find(J=>J.id===A)?.display_name:"选择提供商模板...",e.jsx(Im,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(Ka,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:e.jsxs(Vo,{children:[e.jsx(Ko,{placeholder:"搜索提供商模板..."}),e.jsx(ss,{className:"h-[300px]",children:e.jsxs(Qo,{className:"max-h-none overflow-visible",children:[e.jsx(Yo,{children:"未找到匹配的模板"}),e.jsx(Yi,{children:$i.map(J=>e.jsxs(Ji,{value:J.display_name,onSelect:()=>As(J.id),children:[e.jsx(wt,{className:`mr-2 h-4 w-4 ${A===J.id?"opacity-100":"opacity-0"}`}),J.display_name]},J.id))})]})})]})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"选择预设模板可自动填充 URL 和客户端类型,支持搜索"})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-name-input",children:[e.jsx(T,{htmlFor:"name",className:Q.name?"text-destructive":"",children:"名称 *"}),e.jsx(re,{id:"name",value:y?.name||"",onChange:J=>{w(ve=>ve?{...ve,name:J.target.value}:null),Q.name&&ye(ve=>({...ve,name:void 0}))},placeholder:"例如: DeepSeek, SiliconFlow",className:Q.name?"border-destructive focus-visible:ring-destructive":""}),Q.name&&e.jsx("p",{className:"text-xs text-destructive",children:Q.name})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-url-input",children:[e.jsx(T,{htmlFor:"base_url",className:Q.base_url?"text-destructive":"",children:"基础 URL *"}),e.jsx(re,{id:"base_url",value:y?.base_url||"",onChange:J=>{w(ve=>ve?{...ve,base_url:J.target.value}:null),Q.base_url&&ye(ve=>({...ve,base_url:void 0}))},placeholder:"https://api.example.com/v1",disabled:ts,className:`${ts?"bg-muted cursor-not-allowed":""} ${Q.base_url?"border-destructive focus-visible:ring-destructive":""}`}),Q.base_url&&e.jsx("p",{className:"text-xs text-destructive",children:Q.base_url}),ts&&!Q.base_url&&e.jsx("p",{className:"text-xs text-muted-foreground",children:'使用模板时 URL 不可编辑,切换到"自定义"以手动配置'})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-apikey-input",children:[e.jsx(T,{htmlFor:"api_key",className:Q.api_key?"text-destructive":"",children:"API Key *"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(re,{id:"api_key",type:se?"text":"password",value:y?.api_key||"",onChange:J=>{w(ve=>ve?{...ve,api_key:J.target.value}:null),Q.api_key&&ye(ve=>({...ve,api_key:void 0}))},placeholder:"sk-...",className:`flex-1 ${Q.api_key?"border-destructive focus-visible:ring-destructive":""}`}),e.jsx(k,{type:"button",variant:"outline",size:"icon",onClick:()=>G(!se),title:se?"隐藏密钥":"显示密钥",children:se?e.jsx(Vi,{className:"h-4 w-4"}):e.jsx(ta,{className:"h-4 w-4"})}),e.jsx(k,{type:"button",variant:"outline",size:"icon",onClick:Ss,title:"复制密钥",children:e.jsx(Eo,{className:"h-4 w-4"})})]}),Q.api_key&&e.jsx("p",{className:"text-xs text-destructive",children:Q.api_key})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"client_type",children:"客户端类型"}),e.jsxs(Be,{value:y?.client_type||"openai",onValueChange:J=>w(ve=>ve?{...ve,client_type:J}:null),disabled:ts,children:[e.jsx(Le,{id:"client_type",className:ts?"bg-muted cursor-not-allowed":"",children:e.jsx($e,{placeholder:"选择客户端类型"})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"openai",children:"OpenAI"}),e.jsx(ee,{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(T,{htmlFor:"max_retry",children:"最大重试"}),e.jsx(re,{id:"max_retry",type:"number",min:"0",value:y?.max_retry??"",onChange:J=>{const ve=J.target.value===""?null:parseInt(J.target.value);w(Me=>Me?{...Me,max_retry:ve}:null)},placeholder:"默认: 2"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"timeout",children:"超时(秒)"}),e.jsx(re,{id:"timeout",type:"number",min:"1",value:y?.timeout??"",onChange:J=>{const ve=J.target.value===""?null:parseInt(J.target.value);w(Me=>Me?{...Me,timeout:ve}:null)},placeholder:"默认: 30"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"retry_interval",children:"重试间隔(秒)"}),e.jsx(re,{id:"retry_interval",type:"number",min:"1",value:y?.retry_interval??"",onChange:J=>{const ve=J.target.value===""?null:parseInt(J.target.value);w(Me=>Me?{...Me,retry_interval:ve}:null)},placeholder:"默认: 10"})]})]})]}),e.jsxs(ot,{children:[e.jsx(k,{type:"button",variant:"outline",onClick:()=>v(!1),"data-tour":"provider-cancel-button",children:"取消"}),e.jsx(k,{type:"submit","data-tour":"provider-save-button",children:"保存"})]})]})]})}),e.jsx(js,{open:C,onOpenChange:M,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:Ze,children:"删除"})]})]})}),e.jsx(js,{open:ge,onOpenChange:be,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认批量删除"}),e.jsxs(hs,{children:["确定要删除选中的 ",Ne.size," 个提供商吗? 此操作无法撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:Ws,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),e.jsx(js,{open:pe.isOpen,onOpenChange:J=>Se(ve=>({...ve,isOpen:J})),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(ss,{className:"h-32 w-full rounded border p-3",children:e.jsx("div",{className:"space-y-1",children:pe.affectedModels.map((J,ve)=>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:J.name}),e.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(",J.model_identifier,")"]})]},ve))})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"这些模型将从模型列表和所有任务分配中移除。此操作无法撤销。"})]})})]}),e.jsxs(ms,{children:[e.jsx(ps,{onClick:P,children:"取消"}),e.jsx(fs,{onClick:dt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})}),e.jsx(Gn,{})]})}function Fi(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).substring(2,11)}`}function Nm(l){return l===null?"null":Array.isArray(l)?"array":typeof l=="object"?"object":typeof l=="boolean"?"boolean":typeof l=="number"?"number":"string"}function Dm(l){return Object.entries(l).map(([n,i])=>{const c=Nm(i),u={id:Fi(),key:n,value:i,type:c,expanded:!0};return c==="object"&&i&&typeof i=="object"?u.children=Dm(i):c==="array"&&Array.isArray(i)&&(u.children=i.map((x,h)=>{const f=Nm(x),p={id:Fi(),key:String(h),value:x,type:f,expanded:!0};return f==="object"&&x&&typeof x=="object"?p.children=Dm(x):f==="array"&&Array.isArray(x)&&(p.children=x.map((g,N)=>({id:Fi(),key:String(N),value:g,type:Nm(g),expanded:!0}))),p})),u})}function Om(l){const n={};for(const i of l)i.key.trim()&&(i.type==="object"&&i.children?n[i.key]=Om(i.children):i.type==="array"&&i.children?n[i.key]=i.children.map(c=>c.type==="object"&&c.children?Om(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 ug(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(k,{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(Sa,{className:"h-4 w-4"}):e.jsx(ha,{className:"h-4 w-4"}):e.jsx("span",{className:"w-4"})}),e.jsx(re,{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(re,{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(Be,{value:l.type,onValueChange:p=>i(l.id,"type",p),children:[e.jsx(Le,{className:"h-8 text-xs",children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"string",children:"字符串"}),e.jsx(ee,{value:"number",children:"数字"}),e.jsx(ee,{value:"boolean",children:"布尔"}),e.jsx(ee,{value:"null",children:"Null"}),e.jsx(ee,{value:"object",children:"对象"}),e.jsx(ee,{value:"array",children:"数组"})]})]}),e.jsxs("div",{className:"flex gap-1 justify-end",children:[h&&e.jsx(k,{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(st,{className:"h-4 w-4"})}),e.jsx(k,{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 O_({value:l,onChange:n,placeholder:i="添加参数..."}){const[c,u]=m.useState(()=>Dm(l||{})),x=m.useCallback(v=>{u(v),n(Om(v))},[n]),h=m.useCallback(()=>{const v={id:Fi(),key:"",value:"",type:"string",expanded:!1};x([...c,v])},[c,x]),f=m.useCallback((v,y,w)=>{const b=O=>O.map(A=>{if(A.id===v)if(y==="type"){const _=w;if(_==="object")return{...A,type:_,value:{},children:[]};if(_==="array")return{...A,type:_,value:[],children:[]};if(_==="null")return{...A,type:_,value:null};{const I=ug(String(A.value),_);return{...A,type:_,value:I,children:void 0}}}else if(y==="value"){const _=ug(String(w),A.type);return{...A,value:_}}else return{...A,[y]:String(w)};return A.children?{...A,children:b(A.children)}:A});x(b(c))},[c,x]),p=m.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=m.useCallback(v=>{const y=w=>w.map(b=>{if(b.id===v){const O={id:Fi(),key:b.type==="array"?String(b.children?.length||0):"",value:"",type:"string",expanded:!0};return{...b,children:[...b.children||[],O]}}return b.children?{...b,children:y(b.children)}:b});x(y(c))},[c,x]),N=m.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(k,{type:"button",size:"sm",variant:"outline",onClick:h,className:"h-7 text-xs",children:[e.jsx(st,{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 mg(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 R_({value:l,onChange:n,className:i,placeholder:c="添加额外参数..."}){const[u,x]=m.useState("list"),h=m.useMemo(()=>Object.keys(l||{}).length>0?JSON.stringify(l,null,2):"",[l]),[f,p]=m.useState(h),[g,N]=m.useState(null);m.useEffect(()=>{p(h)},[h]);const v=m.useMemo(()=>{const b=mg(f);return b.valid&&b.parsed?{success:!0,data:b.parsed}:{success:!1,data:{}}},[f]),y=m.useCallback(b=>{const O=b;O==="json"&&u==="list"&&(p(Object.keys(l).length>0?JSON.stringify(l,null,2):""),N(null)),x(O)},[u,l]),w=m.useCallback(b=>{p(b);const O=mg(b);O.valid&&O.parsed?(N(null),n(O.parsed)):N(O.error||"JSON 格式错误")},[n]);return e.jsx("div",{className:B("h-full flex flex-col",i),children:e.jsxs(xa,{value:u,onValueChange:y,className:"w-full flex-1 flex flex-col",children:[e.jsxs(aa,{className:"h-8 p-0.5 bg-muted/60 w-fit",children:[e.jsx(ls,{value:"list",className:"h-7 px-3 text-xs data-[state=active]:bg-background data-[state=active]:shadow-sm",children:"可视化编辑"}),e.jsx(ls,{value:"json",className:"h-7 px-3 text-xs data-[state=active]:bg-background data-[state=active]:shadow-sm",children:"JSON 编辑"})]}),e.jsx(ws,{value:"list",className:"mt-2 flex-1 flex flex-col overflow-hidden data-[state=inactive]:hidden data-[state=inactive]:h-0",children:e.jsx(O_,{value:l,onChange:n,placeholder:c})}),e.jsx(ws,{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(St,{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(wt,{className:"h-3 w-3"}),e.jsx("span",{children:"有效"})]})]}),e.jsx(et,{value:f,onChange:b=>w(b.target.value),placeholder:`{ + "key": "value" +}`,className:B("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 L_({open:l,onOpenChange:n,value:i,onChange:c}){const[u,x]=m.useState(i),h=g=>{g&&x(i),n(g)},f=()=>{c(u),n(!1)},p=()=>{x(i),n(!1)};return e.jsx(Fs,{open:l,onOpenChange:h,children:e.jsxs(Bs,{className:"max-w-3xl h-[70vh] flex flex-col",children:[e.jsxs($s,{children:[e.jsx(Is,{children:"编辑额外参数"}),e.jsx(tt,{children:"配置模型调用时的额外参数,支持嵌套对象和数组"})]}),e.jsx("div",{className:"flex-1 overflow-hidden min-h-0",children:e.jsx(R_,{value:u,onChange:x,placeholder:"添加额外参数(如 thinking、top_p 等)..."})}),e.jsxs(ot,{children:[e.jsx(k,{variant:"outline",onClick:p,children:"取消"}),e.jsx(k,{onClick:f,children:"保存"})]})]})})}const Gr="https://maibot-plugin-stats.maibot-webui.workers.dev";async function U_(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(`${Gr}/pack?${n.toString()}`);if(!i.ok)throw new Error(`获取 Pack 列表失败: ${i.status}`);return i.json()}async function B_(l){const n=await fetch(`${Gr}/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 $_(l){const i=await(await fetch(`${Gr}/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 I_(l,n){await fetch(`${Gr}/pack/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pack_id:l,user_id:n})})}async function ov(l,n){const c=await(await fetch(`${Gr}/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 dv(l,n){return(await(await fetch(`${Gr}/pack/like/check?pack_id=${l}&user_id=${n}`)).json()).liked||!1}async function H_(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: ${bm(f.base_url)}`);const p=x.filter(g=>{const N=bm(g.base_url),v=bm(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 P_(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 O=[...new Set([...b.model_list,...y])];h.model_task_config[g]={...b,model_list:O}}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 G_(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 bm(l){try{const n=new URL(l);return`${n.protocol}//${n.host}${n.pathname}`.replace(/\/$/,"").toLowerCase()}catch{return l.toLowerCase().replace(/\/$/,"")}}function uv(){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 F_={utils:"通用工具",utils_small:"轻量工具",tool_use:"工具调用",replyer:"回复生成",planner:"规划推理",vlm:"视觉模型",voice:"语音处理",embedding:"向量嵌入",lpmm_entity_extract:"实体提取",lpmm_rdf_build:"RDF构建",lpmm_qa:"问答模型"},q_=["官方推荐","性价比","高性能","免费模型","国内可用","海外模型","OpenAI","Claude","Gemini","国产模型","多模态","轻量级"];function V_({trigger:l}){const[n,i]=m.useState(!1),[c,u]=m.useState(1),[x,h]=m.useState(!1),[f,p]=m.useState(!1),[g,N]=m.useState([]),[v,y]=m.useState([]),[w,b]=m.useState({}),[O,A]=m.useState(new Set),[_,I]=m.useState(new Set),[E,C]=m.useState(new Set),[M,F]=m.useState(""),[D,se]=m.useState(""),[G,me]=m.useState(""),[ce,Ne]=m.useState([]);m.useEffect(()=>{n&&c===1&&le()},[n,c]);const le=async()=>{h(!0);try{const Q=await G_({name:"",description:"",author:""});N(Q.providers),y(Q.models),b(Q.task_config),A(new Set(Q.providers.map(ye=>ye.name))),I(new Set(Q.models.map(ye=>ye.name))),C(new Set(Object.keys(Q.task_config)))}catch(Q){console.error("加载配置失败:",Q),qt({title:"加载当前配置失败",variant:"destructive"})}finally{h(!1)}},ge=Q=>{const ye=new Set(O),X=new Set(_),he=new Set(E);ye.has(Q)?(ye.delete(Q),v.filter(Y=>Y.api_provider===Q).forEach(Y=>X.delete(Y.name)),Object.entries(w).forEach(([Y,ie])=>{ie.model_list&&(ie.model_list.some(V=>X.has(V))||he.delete(Y))})):(ye.add(Q),v.filter(Y=>Y.api_provider===Q).forEach(Y=>X.add(Y.name)),Object.entries(w).forEach(([Y,ie])=>{ie.model_list&&ie.model_list.some(V=>{const Z=v.find(Oe=>Oe.name===V);return Z&&Z.api_provider===Q})&&he.add(Y)})),A(ye),I(X),C(he)},be=Q=>{const ye=new Set(_),X=new Set(E);ye.has(Q)?(ye.delete(Q),Object.entries(w).forEach(([he,Ee])=>{Ee.model_list&&(Ee.model_list.some(ie=>ye.has(ie))||X.delete(he))})):(ye.add(Q),Object.entries(w).forEach(([he,Ee])=>{Ee.model_list&&Ee.model_list.includes(Q)&&X.add(he)})),I(ye),C(X)},z=Q=>{const ye=new Set(E);ye.has(Q)?ye.delete(Q):ye.add(Q),C(ye)},q=Q=>{ce.includes(Q)?Ne(ce.filter(ye=>ye!==Q)):ce.length<5?Ne([...ce,Q]):qt({title:"最多选择 5 个标签",variant:"destructive"})},U=()=>{O.size===g.length?A(new Set):A(new Set(g.map(Q=>Q.name)))},L=()=>{_.size===v.length?I(new Set):I(new Set(v.map(Q=>Q.name)))},$=()=>{const Q=Object.keys(w);E.size===Q.length?C(new Set):C(new Set(Q))},_e=async()=>{if(!M.trim()){qt({title:"请输入模板名称",variant:"destructive"});return}if(!D.trim()){qt({title:"请输入模板描述",variant:"destructive"});return}if(!G.trim()){qt({title:"请输入作者名称",variant:"destructive"});return}if(O.size===0&&_.size===0&&E.size===0){qt({title:"请至少选择一项配置",variant:"destructive"});return}p(!0);try{const Q=g.filter(he=>O.has(he.name)),ye=v.filter(he=>_.has(he.name)),X={};for(const[he,Ee]of Object.entries(w))E.has(he)&&(X[he]=Ee);await $_({name:M.trim(),description:D.trim(),author:G.trim(),tags:ce,providers:Q,models:ye,task_config:X}),qt({title:"模板已提交审核,审核通过后将显示在市场中"}),i(!1),pe()}catch(Q){console.error("提交失败:",Q),qt({title:Q instanceof Error?Q.message:"提交失败",variant:"destructive"})}finally{p(!1)}},pe=()=>{u(1),F(""),se(""),me(""),Ne([]),A(new Set),I(new Set),C(new Set)},Se=2;return e.jsxs(Fs,{open:n,onOpenChange:i,children:[e.jsx(qo,{asChild:!0,children:l||e.jsxs(k,{variant:"outline",children:[e.jsx(wj,{className:"w-4 h-4 mr-2"}),"分享配置"]})}),e.jsxs(Bs,{className:"max-w-2xl max-h-[85vh] flex flex-col",children:[e.jsxs($s,{children:[e.jsxs(Is,{className:"flex items-center gap-2",children:[e.jsx(ea,{className:"w-5 h-5"}),"分享配置模板"]}),e.jsxs(tt,{children:["步骤 ",c," / ",Se,":",c===1&&"选择要分享的配置",c===2&&"填写模板信息"]})]}),e.jsx(ss,{className:"h-[calc(85vh-220px)] pr-4",children:x?e.jsxs("div",{className:"py-8 text-center",children:[e.jsx(Os,{className:"w-8 h-8 mx-auto animate-spin text-primary"}),e.jsx("p",{className:"mt-4 text-muted-foreground",children:"正在加载当前配置..."})]}):e.jsxs(e.Fragment,{children:[c===1&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(rt,{children:[e.jsx(Kt,{className:"h-4 w-4"}),e.jsx(Dn,{children:"安全提示"}),e.jsxs(it,{children:["分享的配置将",e.jsx("strong",{children:"不包含"})," API Key,其他用户需要自行配置。"]})]}),e.jsxs(xa,{defaultValue:"providers",className:"w-full",children:[e.jsxs(aa,{className:"grid w-full grid-cols-3",children:[e.jsxs(ls,{value:"providers",children:[e.jsx(Tl,{className:"w-4 h-4 mr-2"}),"API 提供商",e.jsxs(Ae,{variant:"secondary",className:"ml-2",children:[O.size,"/",g.length]})]}),e.jsxs(ls,{value:"models",children:[e.jsx(Un,{className:"w-4 h-4 mr-2"}),"模型配置",e.jsxs(Ae,{variant:"secondary",className:"ml-2",children:[_.size,"/",v.length]})]}),e.jsxs(ls,{value:"tasks",children:[e.jsx(Bn,{className:"w-4 h-4 mr-2"}),"任务配置",e.jsxs(Ae,{variant:"secondary",className:"ml-2",children:[E.size,"/",Object.keys(w).length]})]})]}),e.jsx(ws,{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(k,{variant:"ghost",size:"sm",onClick:U,children:O.size===g.length?"取消全选":"全选"})}),g.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-2",children:"暂无提供商配置"}):g.map(Q=>e.jsxs("div",{className:"flex items-center space-x-2 p-2 rounded hover:bg-muted",children:[e.jsx(Js,{id:`provider-${Q.name}`,checked:O.has(Q.name),onCheckedChange:()=>ge(Q.name)}),e.jsxs(T,{htmlFor:`provider-${Q.name}`,className:"flex-1 cursor-pointer",children:[e.jsx("span",{className:"font-medium",children:Q.name}),e.jsx("span",{className:"text-xs text-muted-foreground ml-2",children:Q.base_url})]}),e.jsx(Ae,{variant:"outline",className:"text-xs",children:Q.client_type})]},Q.name))]})}),e.jsx(ws,{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(k,{variant:"ghost",size:"sm",onClick:L,children:_.size===v.length?"取消全选":"全选"})}),v.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-2",children:"暂无模型配置"}):v.map(Q=>e.jsxs("div",{className:"flex items-center space-x-2 p-2 rounded hover:bg-muted",children:[e.jsx(Js,{id:`model-${Q.name}`,checked:_.has(Q.name),onCheckedChange:()=>be(Q.name)}),e.jsxs(T,{htmlFor:`model-${Q.name}`,className:"flex-1 cursor-pointer",children:[e.jsx("span",{className:"font-medium",children:Q.name}),e.jsx("span",{className:"text-xs text-muted-foreground ml-2",children:Q.model_identifier})]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:Q.api_provider})]},Q.name))]})}),e.jsx(ws,{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(k,{variant:"ghost",size:"sm",onClick:$,children:E.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(([Q,ye])=>e.jsxs("div",{className:"space-y-2 p-2 rounded hover:bg-muted",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Js,{id:`task-${Q}`,checked:E.has(Q),onCheckedChange:()=>z(Q)}),e.jsx(T,{htmlFor:`task-${Q}`,className:"flex-1 cursor-pointer",children:e.jsx("span",{className:"font-medium",children:F_[Q]||Q})}),e.jsxs(Ae,{variant:"outline",className:"text-xs",children:[ye.model_list.length," 个模型"]})]}),ye.model_list&&ye.model_list.length>0&&e.jsx("div",{className:"ml-6 flex flex-wrap gap-1",children:ye.model_list.map(X=>{const he=v.find(Y=>Y.name===X),Ee=_.has(X);return e.jsxs(Ae,{variant:Ee?"default":"outline",className:"text-xs cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>be(X),children:[X,he&&e.jsxs("span",{className:"ml-1 opacity-70",children:["(",he.api_provider,")"]})]},X)})})]},Q))]})})]})]}),c===2&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-4 text-sm p-3 bg-muted rounded-lg",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Tl,{className:"w-4 h-4"}),O.size," 个提供商"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Un,{className:"w-4 h-4"}),_.size," 个模型"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Bn,{className:"w-4 h-4"}),E.size," 个任务"]})]}),e.jsx(Pr,{}),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(re,{id:"pack-name",placeholder:"例如:高性价比国产模型配置",value:M,onChange:Q=>F(Q.target.value),maxLength:50}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[M.length,"/50"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"pack-description",children:"模板描述 *"}),e.jsx(et,{id:"pack-description",placeholder:"详细描述这个配置模板的特点、适用场景等...",value:D,onChange:Q=>se(Q.target.value),rows:4,maxLength:500}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[D.length,"/500"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"pack-author",children:"作者名称 *"}),e.jsx(re,{id:"pack-author",placeholder:"你的昵称或 ID",value:G,onChange:Q=>me(Q.target.value),maxLength:30})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"标签(可选,最多 5 个)"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:q_.map(Q=>e.jsxs(Ae,{variant:ce.includes(Q)?"default":"outline",className:"cursor-pointer transition-colors",onClick:()=>q(Q),children:[ce.includes(Q)&&e.jsx(wt,{className:"w-3 h-3 mr-1"}),e.jsx(Po,{className:"w-3 h-3 mr-1"}),Q]},Q))})]})]}),e.jsxs(rt,{children:[e.jsx(Kt,{className:"h-4 w-4"}),e.jsx(Dn,{children:"审核说明"}),e.jsx(it,{children:"提交后需要经过审核才能在市场中展示。审核通常在 1-3 个工作日内完成。"})]})]})]})}),e.jsxs(ot,{className:"flex justify-between pt-4 border-t",children:[e.jsx("div",{children:c>1&&e.jsx(k,{variant:"outline",onClick:()=>u(c-1),disabled:f,children:"上一步"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(k,{variant:"outline",onClick:()=>{i(!1),pe()},disabled:f,children:"取消"}),cu(c+1),disabled:x||O.size===0&&_.size===0&&E.size===0,children:"下一步"}):e.jsxs(k,{onClick:_e,disabled:f,children:[f&&e.jsx(Os,{className:"w-4 h-4 mr-2 animate-spin"}),"提交审核"]})]})]})]})]})}function K_({value:l,label:n,onRemove:i}){const{attributes:c,listeners:u,setNodeRef:x,transform:h,transition:f,isDragging:p}=Ij({id:l}),g={transform:Hj.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:B("inline-flex items-center gap-1",p&&"shadow-lg"),children:e.jsxs(Ae,{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(Nj,{className:"h-3 w-3 text-muted-foreground"})}),e.jsx("span",{children:n}),e.jsx("button",{type:"button",className:"ml-1 rounded-sm hover:bg-destructive/20 focus:outline-none focus:ring-1 focus:ring-destructive",onClick:N,onPointerDown:v,onMouseDown:y=>y.stopPropagation(),children:e.jsx(_a,{className:"h-3 w-3 cursor-pointer hover:text-destructive",strokeWidth:2,fill:"none"})})]})})}function Q_({options:l,selected:n,onChange:i,placeholder:c="选择选项...",emptyText:u="未找到选项",className:x}){const[h,f]=m.useState(!1),p=zj(zo(Rj,{activationConstraint:{distance:8}}),zo(Oj,{coordinateGetter:Dj})),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 O=n.indexOf(w.id),A=n.indexOf(b.id);i(Lj(n,O,A))}};return e.jsxs(tl,{open:h,onOpenChange:f,children:[e.jsx(al,{asChild:!0,children:e.jsxs(k,{variant:"outline",role:"combobox","aria-expanded":h,className:B("w-full justify-between min-h-10 h-auto",x),children:[e.jsx(Uj,{sensors:p,collisionDetection:Bj,onDragEnd:v,children:e.jsx($j,{items:n,strategy:h1,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(K_,{value:y,label:w?.label||y,onRemove:N},y)})})})}),e.jsx(Im,{className:"ml-2 h-4 w-4 shrink-0 opacity-50",strokeWidth:2,fill:"none"})]})}),e.jsx(Ka,{className:"w-full p-0",align:"start",children:e.jsxs(Vo,{children:[e.jsx(Ko,{placeholder:"搜索...",className:"h-9"}),e.jsxs(Qo,{children:[e.jsx(Yo,{children:u}),e.jsx(Yi,{children:l.map(y=>{const w=n.includes(y.value);return e.jsxs(Ji,{value:y.value,onSelect:()=>g(y.value),children:[e.jsx("div",{className:B("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(wt,{className:"h-3 w-3",strokeWidth:2,fill:"none"})}),e.jsx("span",{children:y.label})]},y.value)})})]})]})})]})}const Fa=Ms.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(Q_,{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(re,{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(wa,{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(re,{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(re,{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:"模型响应时间超过此阈值将输出警告日志"})]})]})]})}),Y_=Ms.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(Ae,{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(k,{variant:"default",size:"sm",onClick:()=>c(f,g),children:[e.jsx(Ln,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(k,{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)})})}),J_=Ms.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(El,{children:[e.jsx(Ml,{children:e.jsxs(ct,{children:[e.jsx(Ye,{className:"w-12",children:e.jsx(Js,{checked:u.size===c.length&&c.length>0,onCheckedChange:p})}),e.jsx(Ye,{className:"w-24",children:"使用状态"}),e.jsx(Ye,{children:"模型名称"}),e.jsx(Ye,{children:"模型标识符"}),e.jsx(Ye,{children:"提供商"}),e.jsx(Ye,{className:"text-center",children:"温度"}),e.jsx(Ye,{className:"text-right",children:"输入价格"}),e.jsx(Ye,{className:"text-right",children:"输出价格"}),e.jsx(Ye,{className:"text-right",children:"操作"})]})}),e.jsx(Al,{children:n.length===0?e.jsx(ct,{children:e.jsx(Ge,{colSpan:9,className:"text-center text-muted-foreground py-8",children:N?"未找到匹配的模型":"暂无模型配置"})}):n.map((v,y)=>{const w=i.findIndex(O=>O===v),b=g(v.name);return e.jsxs(ct,{children:[e.jsx(Ge,{children:e.jsx(Js,{checked:u.has(w),onCheckedChange:()=>f(w)})}),e.jsx(Ge,{children:e.jsx(Ae,{variant:b?"default":"secondary",className:b?"bg-green-600 hover:bg-green-700":"",children:b?"已使用":"未使用"})}),e.jsx(Ge,{className:"font-medium",children:v.name}),e.jsx(Ge,{className:"max-w-xs truncate",title:v.model_identifier,children:v.model_identifier}),e.jsx(Ge,{children:v.api_provider}),e.jsx(Ge,{className:"text-center",children:v.temperature!=null?v.temperature:e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsxs(Ge,{className:"text-right",children:["¥",v.price_in,"/M"]}),e.jsxs(Ge,{className:"text-right",children:["¥",v.price_out,"/M"]}),e.jsx(Ge,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(k,{variant:"default",size:"sm",onClick:()=>x(v,w),children:[e.jsx(Ln,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(k,{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"}),"删除"]})]})})]},y)})})]})})})}),X_=300*1e3,xg=new Map,Z_=[10,20,50,100],W_=Ms.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(T,{htmlFor:"page-size-model",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Be,{value:i.toString(),onValueChange:v,children:[e.jsx(Le,{id:"page-size-model",className:"w-20",children:e.jsx($e,{})}),e.jsx(Ue,{children:Z_.map(w=>e.jsx(ee,{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(k,{variant:"outline",size:"sm",onClick:()=>x(1),disabled:n===1,className:"hidden sm:flex",children:e.jsx(Ir,{className:"h-4 w-4"})}),e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>x(Math.max(1,n-1)),disabled:n===1,children:[e.jsx(ll,{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(re,{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(k,{variant:"outline",size:"sm",onClick:p,disabled:!u,className:"h-8",children:"跳转"})]}),e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>x(n+1),disabled:n>=N,children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(ha,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(k,{variant:"outline",size:"sm",onClick:()=>x(N),disabled:n>=N,className:"hidden sm:flex",children:e.jsx(Hr,{className:"h-4 w-4"})})]})]})});function eS(l){const{models:n,taskConfig:i,debounceMs:c=2e3,onSavingChange:u,onUnsavedChange:x}=l,h=m.useRef(null),f=m.useRef(null),p=m.useRef(!0),g=m.useCallback(()=>{h.current&&(clearTimeout(h.current),h.current=null),f.current&&(clearTimeout(f.current),f.current=null)},[]),N=m.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=m.useCallback(async w=>{try{u?.(!0);const b=w.map(N);await zm("models",b),x?.(!1)}catch(b){console.error("自动保存模型列表失败:",b),x?.(!0)}finally{u?.(!1)}},[u,x,N]),y=m.useCallback(async w=>{try{u?.(!0),await zm("model_task_config",w),x?.(!1)}catch(b){console.error("自动保存任务配置失败:",b),x?.(!0)}finally{u?.(!1)}},[u,x]);return m.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]),m.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]),m.useEffect(()=>()=>{g()},[g]),{clearTimers:g,initialLoadRef:p}}function sS(l={}){const{onCloseEditDialog:n}=l,i=la(),{registerTour:c,startTour:u,state:x,goToStep:h}=Fm(),f=m.useRef(x.stepIndex);return m.useEffect(()=>{c(el,rv)},[c]),m.useEffect(()=>{if(x.activeTourId===el&&x.isRunning){const g=iv[x.stepIndex];g&&!window.location.pathname.endsWith(g.replace("/config/",""))&&i({to:g})}},[x.stepIndex,x.activeTourId,x.isRunning,i]),m.useEffect(()=>{if(x.activeTourId===el&&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]),m.useEffect(()=>{if(x.activeTourId!==el||!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:m.useCallback(()=>{u(el)},[u]),isRunning:x.isRunning&&x.activeTourId===el,stepIndex:x.stepIndex}}function tS(l){const{getProviderConfig:n}=l,[i,c]=m.useState([]),[u,x]=m.useState(!1),[h,f]=m.useState(null),[p,g]=m.useState(null),N=m.useCallback(()=>{c([]),f(null),g(null)},[]),v=m.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 O=M_(b.base_url);if(g(O),!O?.modelFetcher){c([]),f(null);return}const A=`${y}:${b.base_url}`,_=xg.get(A);if(!w&&_&&Date.now()-_.timestampE(!1)}),{clearTimers:It,initialLoadRef:dt}=eS({models:l,taskConfig:p,onSavingChange:O,onUnsavedChange:_}),P=m.useCallback((te,ue)=>{if(!te)return;const We=new Set(ue.map(Ia=>Ia.name)),gs=[],rs=[],Ct=[{key:"utils",label:"工具模型"},{key:"utils_small",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关系构建"},{key:"lpmm_qa",label:"LPMM问答"}];for(const{key:Ia,label:Dl}of Ct){const qn=te[Ia];if(!qn)continue;if(!qn.model_list||qn.model_list.length===0){rs.push(Dl);continue}const qr=qn.model_list.filter(hn=>!We.has(hn));qr.length>0&&gs.push({taskName:Dl,invalidModels:qr})}Z(gs),ze(rs)},[]),Pe=m.useCallback(async()=>{try{v(!0);const te=await ln(),ue=te.models||[];n(ue),f(ue.map(Ct=>Ct.name));const We=te.api_providers||[];c(We.map(Ct=>Ct.name)),x(We);const gs=te.model_task_config||null;g(gs),P(gs,ue);const rs=gs?.embedding?.model_list||[];ie.current=[...rs],_(!1),dt.current=!1}catch(te){console.error("加载配置失败:",te)}finally{v(!1)}},[dt,P]);m.useEffect(()=>{Pe()},[Pe]);const qe=m.useCallback(te=>u.find(ue=>ue.name===te),[u]),{availableModels:Je,fetchingModels:As,modelFetchError:ts,matchedTemplate:Ss,fetchModelsForProvider:Ce,clearModels:vs}=tS({getProviderConfig:qe});m.useEffect(()=>{I&&C?.api_provider&&Ce(C.api_provider)},[I,C?.api_provider,Ce]);const as=async()=>{await is()},Ze=m.useCallback(()=>{if(!p)return;const te=new Set(l.map(gs=>gs.name)),ue={...p},We=Object.keys(ue);for(const gs of We){const rs=ue[gs];rs&&rs.model_list&&(rs.model_list=rs.model_list.filter(Ct=>te.has(Ct)))}g(ue),Z([]),ke({title:"清理完成",description:"已删除所有无效的模型引用"})},[p,l,ke]),Ns=te=>{const ue={model_identifier:te.model_identifier,name:te.name,api_provider:te.api_provider,price_in:te.price_in??0,price_out:te.price_out??0,force_stream_mode:te.force_stream_mode??!1,extra_params:te.extra_params??{}};return te.temperature!=null&&(ue.temperature=te.temperature),te.max_tokens!=null&&(ue.max_tokens=te.max_tokens),ue},ft=async()=>{try{w(!0),It();const te=await ln();te.models=l.map(Ns),te.model_task_config=p,await Gi(te),_(!1),ke({title:"保存成功",description:"正在重启麦麦..."}),await as()}catch(te){console.error("保存配置失败:",te),ke({title:"保存失败",description:te.message,variant:"destructive"}),w(!1)}},Rt=async()=>{try{w(!0),It();const te=await ln();te.models=l.map(Ns),te.model_task_config=p,await Gi(te),_(!1),ke({title:"保存成功",description:"模型配置已保存"}),await Pe()}catch(te){console.error("保存配置失败:",te),ke({title:"保存失败",description:te.message,variant:"destructive"})}finally{w(!1)}},Ws=(te,ue)=>{oe({}),M(te||{model_identifier:"",name:"",api_provider:i[0]||"",price_in:0,price_out:0,temperature:null,max_tokens:null,force_stream_mode:!1,extra_params:{}}),D(ue),E(!0)},Ts=()=>{if(!C)return;const te={};if(C.name?.trim()||(te.name="请输入模型名称"),C.api_provider?.trim()||(te.api_provider="请选择 API 提供商"),C.model_identifier?.trim()||(te.model_identifier="请输入模型标识符"),Object.keys(te).length>0){oe(te);return}oe({});const ue={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&&(ue.temperature=C.temperature),C.max_tokens!=null&&(ue.max_tokens=C.max_tokens);let We,gs=null;if(F!==null?(gs=l[F].name,We=[...l],We[F]=ue):We=[...l,ue],n(We),f(We.map(rs=>rs.name)),gs&&gs!==ue.name&&p){const rs=Ct=>Ct.map(Ia=>Ia===gs?ue.name:Ia);g({...p,utils:{...p.utils,model_list:rs(p.utils?.model_list||[])},utils_small:{...p.utils_small,model_list:rs(p.utils_small?.model_list||[])},tool_use:{...p.tool_use,model_list:rs(p.tool_use?.model_list||[])},replyer:{...p.replyer,model_list:rs(p.replyer?.model_list||[])},planner:{...p.planner,model_list:rs(p.planner?.model_list||[])},vlm:{...p.vlm,model_list:rs(p.vlm?.model_list||[])},voice:{...p.voice,model_list:rs(p.voice?.model_list||[])},embedding:{...p.embedding,model_list:rs(p.embedding?.model_list||[])},lpmm_entity_extract:{...p.lpmm_entity_extract,model_list:rs(p.lpmm_entity_extract?.model_list||[])},lpmm_rdf_build:{...p.lpmm_rdf_build,model_list:rs(p.lpmm_rdf_build?.model_list||[])},lpmm_qa:{...p.lpmm_qa,model_list:rs(p.lpmm_qa?.model_list||[])}})}E(!1),M(null),D(null),ke({title:F!==null?"模型已更新":"模型已添加",description:'配置将在 2 秒后自动保存,或点击右上角"保存配置"按钮立即保存'})},kt=te=>{if(!te&&C){const ue={...C,price_in:C.price_in??0,price_out:C.price_out??0};M(ue)}E(te)},Lt=te=>{le(te),ce(!0)},ka=()=>{if(Ne!==null){const te=l.filter((ue,We)=>We!==Ne);n(te),f(te.map(ue=>ue.name)),P(p,te),ke({title:"删除成功",description:'配置将在 2 秒后自动保存,或点击右上角"保存配置"按钮立即保存'})}ce(!1),le(null)},Ya=te=>{const ue=new Set(z);ue.has(te)?ue.delete(te):ue.add(te),q(ue)},nl=()=>{if(z.size===zt.length)q(new Set);else{const te=zt.map((ue,We)=>l.findIndex(gs=>gs===zt[We]));q(new Set(te))}},Fn=()=>{if(z.size===0){ke({title:"提示",description:"请先选择要删除的模型",variant:"default"});return}L(!0)},J=()=>{const te=z.size,ue=l.filter((We,gs)=>!z.has(gs));n(ue),f(ue.map(We=>We.name)),P(p,ue),q(new Set),L(!1),ke({title:"批量删除成功",description:`已删除 ${te} 个模型,配置将在 2 秒后自动保存`})},ve=(te,ue,We)=>{if(!p)return;if(te==="embedding"&&ue==="model_list"&&Array.isArray(We)){const rs=ie.current,Ct=We;if((rs.length!==Ct.length||rs.some(Dl=>!Ct.includes(Dl))||Ct.some(Dl=>!rs.includes(Dl)))&&rs.length>0){Ie.current={field:ue,value:We},Y(!0);return}}const gs={...p,[te]:{...p[te],[ue]:We}};g(gs),P(gs,l),te==="embedding"&&ue==="model_list"&&Array.isArray(We)&&(ie.current=[...We])},Me=()=>{if(!p||!Ie.current)return;const{field:te,value:ue}=Ie.current,We={...p,embedding:{...p.embedding,[te]:ue}};g(We),P(We,l),te==="model_list"&&Array.isArray(ue)&&(ie.current=[...ue]),Ie.current=null,Y(!1),ke({title:"嵌入模型已更新",description:"建议重新生成知识库向量以确保最佳匹配精度"})},Ls=()=>{Ie.current=null,Y(!1)},zt=l.filter(te=>{if(!ge)return!0;const ue=ge.toLowerCase();return te.name.toLowerCase().includes(ue)||te.model_identifier.toLowerCase().includes(ue)||te.api_provider.toLowerCase().includes(ue)}),Yt=Math.ceil(zt.length/pe),at=zt.slice(($-1)*pe,$*pe),Jt=()=>{const te=parseInt(Q);te>=1&&te<=Yt&&(_e(te),ye(""))},ut=te=>p?[p.utils?.model_list||[],p.utils_small?.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||[],p.lpmm_qa?.model_list||[]].some(We=>We.includes(te)):!1;return N?e.jsx(ss,{className:"h-full",children:e.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):e.jsx(ss,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型管理与分配"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"添加模型并为模型分配功能"})]}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[e.jsx(V_,{trigger:e.jsxs(k,{variant:"outline",size:"sm",className:"flex-1 sm:flex-none",children:[e.jsx(wj,{className:"mr-2 h-4 w-4"}),"分享配置"]})}),e.jsxs(k,{onClick:Rt,disabled:y||b||!A||Ot,size:"sm",variant:"outline",className:"flex-1 sm:flex-none sm:min-w-[120px]",children:[e.jsx(sc,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),y?"保存中...":b?"自动保存中...":A?"保存配置":"已保存"]}),e.jsxs(js,{children:[e.jsx(Nt,{asChild:!0,children:e.jsxs(k,{disabled:y||b||Ot,size:"sm",className:"flex-1 sm:flex-none sm:min-w-[120px]",children:[e.jsx(ec,{className:"mr-2 h-4 w-4"}),Ot?"重启中...":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?ft:as,children:A?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsxs(rt,{children:[e.jsx(Kt,{className:"h-4 w-4"}),e.jsxs(it,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),V.length>0&&e.jsxs(rt,{variant:"destructive",children:[e.jsx(Vt,{className:"h-4 w-4"}),e.jsxs(it,{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:V.map(({taskName:te,invalidModels:ue})=>e.jsxs("div",{className:"text-sm",children:[e.jsx("strong",{children:te})," 引用了不存在的模型: ",ue.join(", ")]},te))})]}),e.jsx(k,{variant:"outline",size:"sm",className:"shrink-0 bg-background hover:bg-accent",onClick:Ze,children:"一键清理"})]})]}),Oe.length>0&&e.jsxs(rt,{variant:"default",className:"border-yellow-500/50 bg-yellow-500/10",children:[e.jsx(Vt,{className:"h-4 w-4 text-yellow-600"}),e.jsxs(it,{children:[e.jsx("strong",{className:"text-yellow-600",children:"以下任务未配置模型"}),e.jsxs("div",{className:"mt-2 text-sm",children:[Oe.join("、")," 还未分配模型,这些功能将无法正常工作。"]})]})]}),e.jsxs(rt,{className:"hidden lg:flex border-primary/30 bg-primary/5 cursor-pointer hover:bg-primary/10 transition-colors",onClick:Zt,children:[e.jsx(Iw,{className:"h-4 w-4 text-primary"}),e.jsxs(it,{className:"flex items-center justify-between",children:[e.jsxs("span",{children:[e.jsx("strong",{className:"text-primary",children:"新手引导:"}),"不知道如何配置模型?点击这里开始学习如何为麦麦的组件分配模型。"]}),e.jsx(k,{variant:"outline",size:"sm",className:"ml-4 shrink-0",children:"开始引导"})]})]}),e.jsxs(xa,{defaultValue:"models",className:"w-full",children:[e.jsxs(aa,{className:"grid w-full max-w-full sm:max-w-md grid-cols-2",children:[e.jsx(ls,{value:"models",children:"添加模型"}),e.jsx(ls,{value:"tasks","data-tour":"tasks-tab-trigger",children:"为模型分配功能"})]}),e.jsxs(ws,{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(k,{onClick:Fn,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"}),"批量删除 (",z.size,")"]}),e.jsxs(k,{onClick:()=>Ws(null,null),size:"sm",variant:"outline",className:"w-full sm:w-auto","data-tour":"add-model-button",children:[e.jsx(st,{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(Qt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(re,{placeholder:"搜索模型名称、标识符或提供商...",value:ge,onChange:te=>be(te.target.value),className:"pl-9"})]}),ge&&e.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",zt.length," 个结果"]})]}),e.jsx(Y_,{paginatedModels:at,allModels:l,onEdit:Ws,onDelete:Lt,isModelUsed:ut,searchQuery:ge}),e.jsx(J_,{paginatedModels:at,allModels:l,filteredModels:zt,selectedModels:z,onEdit:Ws,onDelete:Lt,onToggleSelection:Ya,onToggleSelectAll:nl,isModelUsed:ut,searchQuery:ge}),e.jsx(W_,{page:$,pageSize:pe,totalItems:zt.length,jumpToPage:Q,onPageChange:_e,onPageSizeChange:Se,onJumpToPageChange:ye,onJumpToPage:Jt,onSelectionClear:()=>q(new Set)})]}),e.jsxs(ws,{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(Fa,{title:"组件模型 (utils)",description:"用于表情包、取名、关系、情绪变化等组件",taskConfig:p.utils,modelNames:h,onChange:(te,ue)=>ve("utils",te,ue),dataTour:"task-model-select"}),e.jsx(Fa,{title:"组件小模型 (utils_small)",description:"消耗量较大的组件,建议使用速度较快的小模型",taskConfig:p.utils_small,modelNames:h,onChange:(te,ue)=>ve("utils_small",te,ue)}),e.jsx(Fa,{title:"工具调用模型 (tool_use)",description:"需要使用支持工具调用的模型",taskConfig:p.tool_use,modelNames:h,onChange:(te,ue)=>ve("tool_use",te,ue)}),e.jsx(Fa,{title:"首要回复模型 (replyer)",description:"用于表达器和表达方式学习",taskConfig:p.replyer,modelNames:h,onChange:(te,ue)=>ve("replyer",te,ue)}),e.jsx(Fa,{title:"决策模型 (planner)",description:"负责决定麦麦该什么时候回复",taskConfig:p.planner,modelNames:h,onChange:(te,ue)=>ve("planner",te,ue)}),e.jsx(Fa,{title:"图像识别模型 (vlm)",description:"视觉语言模型",taskConfig:p.vlm,modelNames:h,onChange:(te,ue)=>ve("vlm",te,ue),hideTemperature:!0}),e.jsx(Fa,{title:"语音识别模型 (voice)",description:"语音转文字",taskConfig:p.voice,modelNames:h,onChange:(te,ue)=>ve("voice",te,ue),hideTemperature:!0,hideMaxTokens:!0}),e.jsx(Fa,{title:"嵌入模型 (embedding)",description:"用于向量化",taskConfig:p.embedding,modelNames:h,onChange:(te,ue)=>ve("embedding",te,ue),hideTemperature:!0,hideMaxTokens:!0}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库模型"}),e.jsx(Fa,{title:"实体提取模型 (lpmm_entity_extract)",description:"从文本中提取实体",taskConfig:p.lpmm_entity_extract,modelNames:h,onChange:(te,ue)=>ve("lpmm_entity_extract",te,ue)}),e.jsx(Fa,{title:"RDF 构建模型 (lpmm_rdf_build)",description:"构建知识图谱",taskConfig:p.lpmm_rdf_build,modelNames:h,onChange:(te,ue)=>ve("lpmm_rdf_build",te,ue)}),e.jsx(Fa,{title:"问答模型 (lpmm_qa)",description:"知识库问答",taskConfig:p.lpmm_qa,modelNames:h,onChange:(te,ue)=>ve("lpmm_qa",te,ue)})]})]})]})]}),e.jsx(Fs,{open:I,onOpenChange:kt,children:e.jsxs(Bs,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto","data-tour":"model-dialog",preventOutsideClose:$a,children:[e.jsxs($s,{children:[e.jsx(Is,{children:F!==null?"编辑模型":"添加模型"}),e.jsx(tt,{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:Te.name?"text-destructive":"",children:"模型名称 *"}),e.jsx(re,{id:"model_name",value:C?.name||"",onChange:te=>{M(ue=>ue?{...ue,name:te.target.value}:null),Te.name&&oe(ue=>({...ue,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(T,{htmlFor:"api_provider",className:Te.api_provider?"text-destructive":"",children:"API 提供商 *"}),e.jsxs(Be,{value:C?.api_provider||"",onValueChange:te=>{M(ue=>ue?{...ue,api_provider:te}:null),vs(),Te.api_provider&&oe(ue=>({...ue,api_provider:void 0}))},children:[e.jsx(Le,{id:"api_provider",className:Te.api_provider?"border-destructive focus-visible:ring-destructive":"",children:e.jsx($e,{placeholder:"选择提供商"})}),e.jsx(Ue,{children:i.map(te=>e.jsx(ee,{value:te,children:te},te))})]}),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(T,{htmlFor:"model_identifier",className:Te.model_identifier?"text-destructive":"",children:"模型标识符 *"}),Ss?.modelFetcher&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ae,{variant:"secondary",className:"text-xs",children:Ss.display_name}),e.jsx(k,{variant:"ghost",size:"sm",className:"h-6 px-2",onClick:()=>C?.api_provider&&Ce(C.api_provider,!0),disabled:As,children:As?e.jsx(Os,{className:"h-3 w-3 animate-spin"}):e.jsx(_t,{className:"h-3 w-3"})})]})]}),Ss?.modelFetcher?e.jsxs(tl,{open:X,onOpenChange:he,children:[e.jsx(al,{asChild:!0,children:e.jsxs(k,{variant:"outline",role:"combobox","aria-expanded":X,className:"w-full justify-between font-normal",disabled:As||!!ts,children:[As?e.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(Os,{className:"h-4 w-4 animate-spin"}),"正在获取模型列表..."]}):ts?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(Im,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(Ka,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:e.jsxs(Vo,{children:[e.jsx(Ko,{placeholder:"搜索模型..."}),e.jsx(ss,{className:"h-[300px]",children:e.jsxs(Qo,{className:"max-h-none overflow-visible",children:[e.jsx(Yo,{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(k,{variant:"link",size:"sm",onClick:()=>C?.api_provider&&Ce(C.api_provider,!0),children:"重试"})]}):"未找到匹配的模型"}),e.jsx(Yi,{heading:"可用模型",children:Je.map(te=>e.jsxs(Ji,{value:te.id,onSelect:()=>{M(ue=>ue?{...ue,model_identifier:te.id}:null),he(!1)},children:[e.jsx(wt,{className:`mr-2 h-4 w-4 ${C?.model_identifier===te.id?"opacity-100":"opacity-0"}`}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{children:te.id}),te.name!==te.id&&e.jsx("span",{className:"text-xs text-muted-foreground",children:te.name})]})]},te.id))}),e.jsx(Yi,{heading:"手动输入",children:e.jsxs(Ji,{value:"__manual_input__",onSelect:()=>{he(!1)},children:[e.jsx(Ln,{className:"mr-2 h-4 w-4"}),"手动输入模型标识符..."]})})]})})]})})]}):e.jsx(re,{id:"model_identifier",value:C?.model_identifier||"",onChange:te=>{M(ue=>ue?{...ue,model_identifier:te.target.value}:null),Te.model_identifier&&oe(ue=>({...ue,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&&Ss?.modelFetcher&&!Te.model_identifier&&e.jsxs(rt,{variant:"destructive",className:"mt-2 py-2",children:[e.jsx(Kt,{className:"h-4 w-4"}),e.jsx(it,{className:"text-xs",children:ts})]}),Ss?.modelFetcher&&e.jsx(re,{value:C?.model_identifier||"",onChange:te=>{M(ue=>ue?{...ue,model_identifier:te.target.value}:null),Te.model_identifier&&oe(ue=>({...ue,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':Ss?.modelFetcher?`已识别为 ${Ss.display_name},支持自动获取模型列表`:"API 提供商提供的模型 ID"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"price_in",children:"输入价格 (¥/M token)"}),e.jsx(re,{id:"price_in",type:"number",step:"0.1",min:"0",value:C?.price_in??"",onChange:te=>{const ue=te.target.value===""?null:parseFloat(te.target.value);M(We=>We?{...We,price_in:ue}:null)},placeholder:"默认: 0"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"price_out",children:"输出价格 (¥/M token)"}),e.jsx(re,{id:"price_out",type:"number",step:"0.1",min:"0",value:C?.price_out??"",onChange:te=>{const ue=te.target.value===""?null:parseFloat(te.target.value);M(We=>We?{...We,price_out:ue}: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(Fe,{id:"enable_model_temperature",checked:C?.temperature!=null,onCheckedChange:te=>{M(te?ue=>ue?{...ue,temperature:.5}:null:ue=>ue?{...ue,temperature:null}:null)}})]}),C?.temperature!=null&&e.jsxs("div",{className:"space-y-2 pt-2 border-t",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-sm",children:"温度值"}),e.jsx("span",{className:"text-sm font-medium tabular-nums",children:C.temperature.toFixed(1)})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"0"}),e.jsx(wa,{value:[C.temperature],onValueChange:te=>M(ue=>ue?{...ue,temperature:te[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(Fe,{id:"enable_model_max_tokens",checked:C?.max_tokens!=null,onCheckedChange:te=>{M(te?ue=>ue?{...ue,max_tokens:2048}:null:ue=>ue?{...ue,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(re,{type:"number",min:"1",max:"128000",value:C.max_tokens,onChange:te=>{const ue=parseInt(te.target.value);!isNaN(ue)&&ue>=1&&M(We=>We?{...We,max_tokens:ue}: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:C?.force_stream_mode||!1,onCheckedChange:te=>M(ue=>ue?{...ue,force_stream_mode:te}: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(k,{type:"button",variant:"outline",size:"sm",className:"flex-1 justify-start h-9",onClick:()=>G(!0),children:[e.jsx(dn,{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(te=>e.jsx("span",{className:"inline-block mr-2",children:e.jsx("code",{className:"px-1.5 py-0.5 bg-muted rounded",children:te})},te)),Object.keys(C?.extra_params||{}).length>3&&e.jsx("span",{children:"..."})]})]})]}),e.jsxs(ot,{children:[e.jsx(k,{variant:"outline",onClick:()=>E(!1),"data-tour":"model-cancel-button",children:"取消"}),e.jsx(k,{onClick:Ts,"data-tour":"model-save-button",children:"保存"})]})]})}),e.jsx(js,{open:me,onOpenChange:ce,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:['确定要删除模型 "',Ne!==null?l[Ne]?.name:"",'" 吗? 此操作无法撤销。']})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:ka,children:"删除"})]})]})}),e.jsx(js,{open:U,onOpenChange:L,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:J,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),e.jsx(js,{open:Ee,onOpenChange:Y,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsxs(xs,{className:"flex items-center gap-2",children:[e.jsx(Vt,{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:Ls,children:"取消"}),e.jsx(fs,{onClick:Me,className:"bg-amber-600 hover:bg-amber-700",children:"确认更换"})]})]})}),e.jsx(L_,{open:se,onOpenChange:G,value:C?.extra_params||{},onChange:te=>M(ue=>ue?{...ue,extra_params:te}:null)}),e.jsx(Gn,{})]})})}const Xi=Hg,Zi=A0,Wi=z0,Jo="/api/webui/config";async function nS(){const n=await(await we(`${Jo}/adapter-config/path`)).json();return!n.success||!n.path?null:{path:n.path,lastModified:n.lastModified}}async function hg(l){const i=await(await we(`${Jo}/adapter-config/path`,{method:"POST",headers:Us(),body:JSON.stringify({path:l})})).json();if(!i.success)throw new Error(i.message||"保存路径失败")}async function fg(l){const i=await(await we(`${Jo}/adapter-config?path=${encodeURIComponent(l)}`)).json();if(!i.success)throw new Error("读取配置文件失败");return i.content}async function pg(l,n){const c=await(await we(`${Jo}/adapter-config`,{method:"POST",headers:Us(),body:JSON.stringify({path:l,content:n})})).json();if(!c.success)throw new Error(c.message||"保存配置失败")}const jt={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"}},ym={oneclick:{name:"一键包",description:"使用一键包部署的适配器配置",path:"../MaiBot-Napcat-Adapter/config.toml",icon:ea},docker:{name:"Docker",description:"Docker Compose 部署的适配器配置",path:"/MaiMBot/adapters-config/config.toml",icon:Hw}};function rS(l,n){let i=l.slice(0,n).split(/\r\n|\n|\r/g);return[i.length,i.pop().length+1]}function iS(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 _s extends Error{line;column;codeblock;constructor(n,i){const[c,u]=rS(i.toml,i.ptr),x=iS(i.toml,c,u);super(`Invalid TOML document: ${n} + +${x}`,i),this.line=c,this.column=u,this.codeblock=x}}function cS(l,n){let i=0;for(;l[n-++i]==="\\";);return--i&&i%2}function Ro(l,n=0,i=l.length){let c=l.indexOf(` +`,n);return l[c-1]==="\r"&&c--,c<=i?c:-1}function qm(l,n){for(let i=n;i-1&&i!=="'"&&cS(l,n));return n>-1&&(n+=c.length,c.length>1&&(l[n]===i&&n++,l[n]===i&&n++)),n}let oS=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}:\d{2}(?:\.\d+)?)?(Z|[-+]\d{2}:\d{2})?$/i;class Or 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(oS);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 Or(n);return c.#e=i,c}static wrapAsLocalDateTime(n){let i=new Or(n);return i.#e=null,i}static wrapAsLocalDate(n){let i=new Or(n);return i.#t=!1,i.#e=null,i}static wrapAsLocalTime(n){let i=new Or(n);return i.#s=!1,i.#e=null,i}}let dS=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,uS=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,mS=/^[+-]?0[0-9_]/,xS=/^[0-9a-f]{4,8}$/i,jg={b:"\b",t:" ",n:` +`,f:"\f",r:"\r",'"':'"',"\\":"\\"};function xv(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&&(qm(l,x),u=u.slice(0,x));let h=u.trimEnd();if(!c){let f=u.indexOf(` +`,h.length);if(f>-1)throw new _s("newlines are not allowed in inline tables",{toml:l,ptr:n+f})}return[h,x]}function Vm(l,n,i,c,u){if(c===0)throw new _s("document contains excessively nested structures. aborting.",{toml:l,ptr:n});let x=l[n];if(x==="["||x==="{"){let[p,g]=x==="["?jS(l,n,c,u):gS(l,n,c,u),N=i?gg(l,g,",",i):g;if(g-N&&i==="}"){let v=Ro(l,g,N);if(v>-1)throw new _s("newlines are not allowed in inline tables",{toml:l,ptr:v})}return[p,N]}let h;if(x==='"'||x==="'"){h=mv(l,n);let p=xv(l,n,h);if(i){if(h=Cl(l,h,i!=="]"),l[h]&&l[h]!==","&&l[h]!==i&&l[h]!==` +`&&l[h]!=="\r")throw new _s("unexpected character encountered",{toml:l,ptr:h});h+=+(l[h]===",")}return[p,h]}h=gg(l,n,",",i);let f=fS(l,n,h-+(l[h-1]===","),i==="]");if(!f[0])throw new _s("incomplete key-value declaration: no value specified",{toml:l,ptr:n});return i&&f[1]>-1&&(h=Cl(l,n+f[1]),h+=+(l[h]===",")),[hS(f[0],l,n,u),h]}let pS=/^[a-zA-Z0-9-_]+[ \t]*$/;function Rm(l,n,i="="){let c=n-1,u=[],x=l.indexOf(i,n);if(x<0)throw new _s("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 _s("multiline strings are not allowed in keys",{toml:l,ptr:n});let f=mv(l,n);if(f<0)throw new _s("unfinished string encountered",{toml:l,ptr:n});c=l.indexOf(".",f);let p=l.slice(f,c<0||c>x?x:c),g=Ro(p);if(g>-1)throw new _s("newlines are not allowed in keys",{toml:l,ptr:n+c+g});if(p.trimStart())throw new _s("found extra tokens after the string part",{toml:l,ptr:f});if(xx?x:c);if(!pS.test(f))throw new _s("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,jt.inner.version)},nickname:{nickname:n(l.nickname.nickname,jt.nickname.nickname)},napcat_server:{host:n(l.napcat_server.host,jt.napcat_server.host),port:n(l.napcat_server.port||0,jt.napcat_server.port),token:n(l.napcat_server.token,jt.napcat_server.token),heartbeat_interval:n(l.napcat_server.heartbeat_interval||0,jt.napcat_server.heartbeat_interval)},maibot_server:{host:n(l.maibot_server.host,jt.maibot_server.host),port:n(l.maibot_server.port||0,jt.maibot_server.port)},chat:{group_list_type:n(l.chat.group_list_type,jt.chat.group_list_type),group_list:l.chat.group_list||[],private_list_type:n(l.chat.private_list_type,jt.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??jt.chat.ban_qq_bot,enable_poke:l.chat.enable_poke??jt.chat.enable_poke},voice:{use_tts:l.voice.use_tts??jt.voice.use_tts},debug:{level:n(l.debug.level,jt.debug.level)}};let c=wS(i);return c=_S(c),c}catch(n){throw console.error("TOML 生成失败:",n),new Error(`无法生成 TOML 文件: ${n instanceof Error?n.message:"未知错误"}`)}}function _S(l){const n=l.split(` +`),i=[];for(let c=0;c"|?*\x00-\x1F]/.test(l)?{valid:!1,error:"路径包含非法字符"}:{valid:!0,error:""}}function SS(){const[l,n]=m.useState("upload"),[i,c]=m.useState(null),[u,x]=m.useState(""),[h,f]=m.useState(""),[p,g]=m.useState("oneclick"),[N,v]=m.useState(""),[y,w]=m.useState(!1),[b,O]=m.useState(!1),[A,_]=m.useState(!1),[I,E]=m.useState(!1),[C,M]=m.useState(null),[F,D]=m.useState(!1),se=m.useRef(null),{toast:G}=Zs(),me=m.useRef(null),ce=X=>{if(f(X),X.trim()){const he=Sm(X);v(he.error)}else v("")},Ne=m.useCallback(async X=>{const he=ym[X];O(!0);try{const Ee=await fg(he.path),Y=wm(Ee);c(Y),g(X),f(he.path),await hg(he.path),G({title:"加载成功",description:`已从${he.name}预设加载配置`})}catch(Ee){console.error("加载预设配置失败:",Ee),G({title:"加载失败",description:Ee instanceof Error?Ee.message:"无法读取预设配置文件",variant:"destructive"})}finally{O(!1)}},[G]),le=m.useCallback(async X=>{const he=Sm(X);if(!he.valid){v(he.error),G({title:"路径无效",description:he.error,variant:"destructive"});return}v(""),O(!0);try{const Ee=await fg(X),Y=wm(Ee);c(Y),f(X),await hg(X),G({title:"加载成功",description:"已从配置文件加载"})}catch(Ee){console.error("加载配置失败:",Ee),G({title:"加载失败",description:Ee instanceof Error?Ee.message:"无法读取配置文件",variant:"destructive"})}finally{O(!1)}},[G]);m.useEffect(()=>{(async()=>{try{const he=await nS();if(he&&he.path){f(he.path);const Ee=Object.entries(ym).find(([,Y])=>Y.path===he.path);Ee?(n("preset"),g(Ee[0]),await Ne(Ee[0])):(n("path"),await le(he.path))}}catch(he){console.error("加载保存的路径失败:",he)}})()},[le,Ne]);const ge=m.useCallback(X=>{l!=="path"&&l!=="preset"||!h||(me.current&&clearTimeout(me.current),me.current=setTimeout(async()=>{w(!0);try{const he=_m(X);await pg(h,he),G({title:"自动保存成功",description:"配置已保存到文件"})}catch(he){console.error("自动保存失败:",he),G({title:"自动保存失败",description:he instanceof Error?he.message:"保存配置失败",variant:"destructive"})}finally{w(!1)}},1e3))},[l,h,G]),be=async()=>{if(!i||!h)return;const X=Sm(h);if(!X.valid){G({title:"保存失败",description:X.error,variant:"destructive"});return}w(!0);try{const he=_m(i);await pg(h,he),G({title:"保存成功",description:"配置已保存到文件"})}catch(he){console.error("保存失败:",he),G({title:"保存失败",description:he instanceof Error?he.message:"保存配置失败",variant:"destructive"})}finally{w(!1)}},z=async()=>{h&&await le(h)},q=X=>{if(X!==l){if(i){M(X),_(!0);return}U(X)}},U=X=>{c(null),x(""),v(""),n(X),X==="preset"&&Ne("oneclick"),G({title:"已切换模式",description:{upload:"现在可以上传配置文件",path:"现在可以指定配置文件路径",preset:"现在可以使用预设配置"}[X]})},L=()=>{C&&(U(C),M(null)),_(!1)},$=()=>{if(i){E(!0);return}_e()},_e=()=>{f(""),c(null),v(""),G({title:"已清空",description:"路径和配置已清空"})},pe=()=>{_e(),E(!1)},Se=X=>{const he=X.target.files?.[0];if(!he)return;const Ee=new FileReader;Ee.onload=Y=>{try{const ie=Y.target?.result,Ie=wm(ie);c(Ie),x(he.name),G({title:"上传成功",description:`已加载配置文件:${he.name}`})}catch(ie){console.error("解析配置文件失败:",ie),G({title:"解析失败",description:"配置文件格式错误,请检查文件内容",variant:"destructive"})}},Ee.readAsText(he)},Q=()=>{if(!i)return;const X=_m(i),he=new Blob([X],{type:"text/plain;charset=utf-8"}),Ee=URL.createObjectURL(he),Y=document.createElement("a");Y.href=Ee,Y.download=u||"config.toml",document.body.appendChild(Y),Y.click(),document.body.removeChild(Y),URL.revokeObjectURL(Ee),G({title:"下载成功",description:"配置文件已下载,请手动覆盖并重启适配器"})},ye=()=>{c(JSON.parse(JSON.stringify(jt))),x("config.toml"),G({title:"已加载默认配置",description:"可以开始编辑配置"})};return e.jsx(ss,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦适配器配置"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的 QQ 适配器的配置文件"})]})}),e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg border border-amber-500/50 bg-amber-500/10 text-amber-700 dark:text-amber-400",children:[e.jsx(St,{className:"h-4 w-4 mt-0.5 flex-shrink-0"}),e.jsx("p",{className:"text-sm",children:"适配器配置保存之后使用 WebUI 的重启功能适配器并不会重启,需要手动重启适配器。"})]}),e.jsx(Xi,{open:F,onOpenChange:D,children:e.jsxs(De,{children:[e.jsx(Xe,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(es,{children:"工作模式"}),e.jsx(Gs,{children:"选择配置文件的管理方式"})]}),e.jsx(Zi,{asChild:!0,children:e.jsxs(k,{variant:"ghost",size:"sm",className:"w-9 p-0",children:[e.jsx(Sa,{className:`h-4 w-4 transition-transform duration-200 ${F?"transform rotate-180":""}`}),e.jsx("span",{className:"sr-only",children:"切换"})]})})]})}),e.jsx(Wi,{children:e.jsxs(Ke,{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:()=>q("preset"),children:e.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[e.jsx(ea,{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:()=>q("upload"),children:e.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[e.jsx(Ki,{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:()=>q("path"),children:e.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[e.jsx(Pw,{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(ym).map(([X,he])=>{const Ee=he.icon,Y=p===X;return e.jsx("div",{className:`border-2 rounded-lg p-3 cursor-pointer transition-all ${Y?"border-primary bg-primary/5":"border-muted hover:border-primary/50"}`,onClick:()=>{g(X),Ne(X)},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:he.name}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:he.description}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 font-mono break-all",children:he.path})]})]})},X)})})]}),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(re,{id:"config-path",value:h,onChange:X=>ce(X.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(k,{onClick:()=>le(h),disabled:b||!h||!!N,className:"w-full sm:w-auto",children:b?e.jsxs(e.Fragment,{children:[e.jsx(_t,{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(rt,{children:[e.jsx(Kt,{className:"h-4 w-4"}),e.jsx(it,{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:se,type:"file",accept:".toml",className:"hidden",onChange:Se}),e.jsxs(k,{onClick:()=>se.current?.click(),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(Ki,{className:"mr-2 h-4 w-4"}),"上传配置"]}),e.jsxs(k,{onClick:ye,size:"sm",className:"w-full sm:w-auto",children:[e.jsx(qa,{className:"mr-2 h-4 w-4"}),"使用默认配置"]})]}),l==="upload"&&i&&e.jsx("div",{className:"flex gap-2",children:e.jsxs(k,{onClick:Q,size:"sm",className:"w-full sm:w-auto",children:[e.jsx(Xt,{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(k,{onClick:be,size:"sm",disabled:y||!!N,className:"w-full sm:w-auto",children:[e.jsx(sc,{className:"mr-2 h-4 w-4"}),y?"保存中...":"立即保存"]}),e.jsxs(k,{onClick:z,size:"sm",variant:"outline",disabled:b,className:"w-full sm:w-auto",children:[e.jsx(_t,{className:`mr-2 h-4 w-4 ${b?"animate-spin":""}`}),"刷新"]}),l==="path"&&e.jsxs(k,{onClick:$,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(ns,{className:"mr-2 h-4 w-4"}),"清空路径"]})]}),i?e.jsxs(xa,{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(aa,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5",children:[e.jsxs(ls,{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(ls,{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(ls,{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(ls,{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(ls,{value:"debug",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:"调试"})]})}),e.jsx(ws,{value:"napcat",className:"space-y-4",children:e.jsx(kS,{config:i,onChange:X=>{c(X),ge(X)}})}),e.jsx(ws,{value:"maibot",className:"space-y-4",children:e.jsx(CS,{config:i,onChange:X=>{c(X),ge(X)}})}),e.jsx(ws,{value:"chat",className:"space-y-4",children:e.jsx(TS,{config:i,onChange:X=>{c(X),ge(X)}})}),e.jsx(ws,{value:"voice",className:"space-y-4",children:e.jsx(ES,{config:i,onChange:X=>{c(X),ge(X)}})}),e.jsx(ws,{value:"debug",className:"space-y-4",children:e.jsx(MS,{config:i,onChange:X=>{c(X),ge(X)}})})]}):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(qa,{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(js,{open:A,onOpenChange:_,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:()=>{_(!1),M(null)},children:"取消"}),e.jsx(fs,{onClick:L,children:"确认切换"})]})]})}),e.jsx(js,{open:I,onOpenChange:E,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:()=>E(!1),children:"取消"}),e.jsx(fs,{onClick:pe,className:"bg-destructive hover:bg-destructive/90",children:"确认清空"})]})]})})]})})}function kS({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(re,{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(re,{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(re,{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(re,{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 CS({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(re,{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(re,{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 TS({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(Be,{value:l.chat.group_list_type,onValueChange:x=>n({...l,chat:{...l.chat,group_list_type:x}}),children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),e.jsx(ee,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[e.jsx(T,{className:"text-sm md:text-base",children:"群组列表"}),e.jsxs(k,{onClick:()=>i("group"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(qa,{className:"mr-1 h-4 w-4"}),"添加群号"]})]}),l.chat.group_list.map((x,h)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(re,{type:"number",value:x,onChange:f=>u("group",h,parseInt(f.target.value)||0),placeholder:"输入群号",className:"text-sm md:text-base"}),e.jsxs(js,{children:[e.jsx(Nt,{asChild:!0,children:e.jsx(k,{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(Be,{value:l.chat.private_list_type,onValueChange:x=>n({...l,chat:{...l.chat,private_list_type:x}}),children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),e.jsx(ee,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[e.jsx(T,{className:"text-sm md:text-base",children:"私聊列表"}),e.jsxs(k,{onClick:()=>i("private"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(qa,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),l.chat.private_list.map((x,h)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(re,{type:"number",value:x,onChange:f=>u("private",h,parseInt(f.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),e.jsxs(js,{children:[e.jsx(Nt,{asChild:!0,children:e.jsx(k,{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(k,{onClick:()=>i("ban"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(qa,{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(re,{type:"number",value:x,onChange:f=>u("ban",h,parseInt(f.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),e.jsxs(js,{children:[e.jsx(Nt,{asChild:!0,children:e.jsx(k,{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(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(T,{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 ES({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(Fe,{checked:l.voice.use_tts,onCheckedChange:i=>n({...l,voice:{use_tts:i}})})]})]})})}function MS({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(Be,{value:l.debug.level,onValueChange:i=>n({...l,debug:{level:i}}),children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"DEBUG",children:"DEBUG(调试)"}),e.jsx(ee,{value:"INFO",children:"INFO(信息)"}),e.jsx(ee,{value:"WARNING",children:"WARNING(警告)"}),e.jsx(ee,{value:"ERROR",children:"ERROR(错误)"}),e.jsx(ee,{value:"CRITICAL",children:"CRITICAL(严重)"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"设置适配器的日志输出等级"})]})})]})})}const AS=["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"],zS=/^(aria-|data-)/,pv=l=>Object.fromEntries(Object.entries(l).filter(([n])=>zS.test(n)||AS.includes(n)));function DS(l,n){const i=pv(l);return Object.keys(l).some(c=>!Object.hasOwn(i,c)&&l[c]!==n[c])}class OS extends m.Component{container;plugin;componentDidMount(){this.installPlugin()}componentDidUpdate(n){if(n.uppy!==this.props.uppy)this.uninstallPlugin(n),this.installPlugin();else if(DS(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(g1,i),this.plugin=n.getPlugin(i.id)}uninstallPlugin(n=this.props){const{uppy:i}=n;i.removePlugin(this.plugin)}render(){return m.createElement("div",{className:"uppy-Container",ref:n=>{this.container=n},...pv(this.props)})}}function RS({src:l,alt:n="表情包",className:i,maxRetries:c=5,retryInterval:u=1500}){const[x,h]=m.useState("loading"),[f,p]=m.useState(0),[g,N]=m.useState(null),[v,y]=m.useState(l);l!==v&&(h("loading"),p(0),N(null),y(l));const w=m.useCallback(async()=>{try{const b=await fetch(l,{credentials:"include"});if(b.status===202){h("generating"),f{p(_=>_+1)},u):h("error");return}if(!b.ok){h("error");return}const O=await b.blob(),A=URL.createObjectURL(O);N(A),h("loaded")}catch(b){console.error("加载缩略图失败:",b),h("error")}},[l,f,c,u]);return m.useEffect(()=>{w()},[w]),m.useEffect(()=>()=>{g&&URL.revokeObjectURL(g)},[g]),x==="loading"||x==="generating"?e.jsx(Ys,{className:B("w-full h-full",i)}):x==="error"||!g?e.jsx("div",{className:B("w-full h-full flex items-center justify-center bg-muted",i),children:e.jsx(_j,{className:"h-8 w-8 text-muted-foreground"})}):e.jsx("img",{src:g,alt:n,className:B("w-full h-full object-contain",i)})}function LS({children:l,className:n}){return e.jsx(Gm,{content:l,className:n})}const Ba="/api/webui/emoji";async function US(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(`${Ba}/list?${n}`,{});if(!i.ok)throw new Error(`获取表情包列表失败: ${i.statusText}`);return i.json()}async function BS(l){const n=await we(`${Ba}/${l}`,{});if(!n.ok)throw new Error(`获取表情包详情失败: ${n.statusText}`);return n.json()}async function $S(l,n){const i=await we(`${Ba}/${l}`,{method:"PATCH",body:JSON.stringify(n)});if(!i.ok)throw new Error(`更新表情包失败: ${i.statusText}`);return i.json()}async function IS(l){const n=await we(`${Ba}/${l}`,{method:"DELETE"});if(!n.ok)throw new Error(`删除表情包失败: ${n.statusText}`);return n.json()}async function HS(){const l=await we(`${Ba}/stats/summary`,{});if(!l.ok)throw new Error(`获取统计数据失败: ${l.statusText}`);return l.json()}async function PS(l){const n=await we(`${Ba}/${l}/register`,{method:"POST"});if(!n.ok)throw new Error(`注册表情包失败: ${n.statusText}`);return n.json()}async function GS(l){const n=await we(`${Ba}/${l}/ban`,{method:"POST"});if(!n.ok)throw new Error(`封禁表情包失败: ${n.statusText}`);return n.json()}function FS(l,n=!1){return n?`${Ba}/${l}/thumbnail?original=true`:`${Ba}/${l}/thumbnail`}function qS(l){return`${Ba}/${l}/thumbnail?original=true`}async function VS(l){const n=await we(`${Ba}/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 KS(){return`${Ba}/upload`}function QS(){const[l,n]=m.useState([]),[i,c]=m.useState(null),[u,x]=m.useState(!1),[h,f]=m.useState(1),[p,g]=m.useState(0),[N,v]=m.useState(20),[y,w]=m.useState("all"),[b,O]=m.useState("all"),[A,_]=m.useState("all"),[I,E]=m.useState("usage_count"),[C,M]=m.useState("desc"),[F,D]=m.useState(null),[se,G]=m.useState(!1),[me,ce]=m.useState(!1),[Ne,le]=m.useState(!1),[ge,be]=m.useState(new Set),[z,q]=m.useState(!1),[U,L]=m.useState(""),[$,_e]=m.useState("medium"),[pe,Se]=m.useState(!1),{toast:Q}=Zs(),ye=m.useCallback(async()=>{try{x(!0);const oe=await US({page:h,page_size:N,is_registered:y==="all"?void 0:y==="registered",is_banned:b==="all"?void 0:b==="banned",format:A==="all"?void 0:A,sort_by:I,sort_order:C});n(oe.data),g(oe.total)}catch(oe){const ke=oe instanceof Error?oe.message:"加载表情包列表失败";Q({title:"错误",description:ke,variant:"destructive"})}finally{x(!1)}},[h,N,y,b,A,I,C,Q]),X=async()=>{try{const oe=await HS();c(oe.data)}catch(oe){console.error("加载统计数据失败:",oe)}};m.useEffect(()=>{ye()},[ye]),m.useEffect(()=>{X()},[]);const he=async oe=>{try{const ke=await BS(oe.id);D(ke.data),G(!0)}catch(ke){const is=ke instanceof Error?ke.message:"加载详情失败";Q({title:"错误",description:is,variant:"destructive"})}},Ee=oe=>{D(oe),ce(!0)},Y=oe=>{D(oe),le(!0)},ie=async()=>{if(F)try{await IS(F.id),Q({title:"成功",description:"表情包已删除"}),le(!1),D(null),ye(),X()}catch(oe){const ke=oe instanceof Error?oe.message:"删除失败";Q({title:"错误",description:ke,variant:"destructive"})}},Ie=async oe=>{try{await PS(oe.id),Q({title:"成功",description:"表情包已注册"}),ye(),X()}catch(ke){const is=ke instanceof Error?ke.message:"注册失败";Q({title:"错误",description:is,variant:"destructive"})}},V=async oe=>{try{await GS(oe.id),Q({title:"成功",description:"表情包已封禁"}),ye(),X()}catch(ke){const is=ke instanceof Error?ke.message:"封禁失败";Q({title:"错误",description:is,variant:"destructive"})}},Z=oe=>{const ke=new Set(ge);ke.has(oe)?ke.delete(oe):ke.add(oe),be(ke)},Oe=async()=>{try{const oe=await VS(Array.from(ge));Q({title:"批量删除完成",description:oe.message}),be(new Set),q(!1),ye(),X()}catch(oe){Q({title:"批量删除失败",description:oe instanceof Error?oe.message:"批量删除失败",variant:"destructive"})}},ze=()=>{const oe=parseInt(U),ke=Math.ceil(p/N);oe>=1&&oe<=ke?(f(oe),L("")):Q({title:"无效的页码",description:`请输入1-${ke}之间的页码`,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(k,{onClick:()=>Se(!0),className:"gap-2",children:[e.jsx(Ki,{className:"h-4 w-4"}),"上传表情包"]})]}),e.jsx(ss,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[i&&e.jsxs("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[e.jsx(De,{children:e.jsxs(Xe,{className:"pb-2",children:[e.jsx(Gs,{children:"总数"}),e.jsx(es,{className:"text-2xl",children:i.total})]})}),e.jsx(De,{children:e.jsxs(Xe,{className:"pb-2",children:[e.jsx(Gs,{children:"已注册"}),e.jsx(es,{className:"text-2xl text-green-600",children:i.registered})]})}),e.jsx(De,{children:e.jsxs(Xe,{className:"pb-2",children:[e.jsx(Gs,{children:"已封禁"}),e.jsx(es,{className:"text-2xl text-red-600",children:i.banned})]})}),e.jsx(De,{children:e.jsxs(Xe,{className:"pb-2",children:[e.jsx(Gs,{children:"未注册"}),e.jsx(es,{className:"text-2xl text-gray-600",children:i.unregistered})]})})]}),e.jsxs(De,{children:[e.jsx(Xe,{children:e.jsxs(es,{className:"flex items-center gap-2",children:[e.jsx(So,{className:"h-5 w-5"}),"筛选和排序"]})}),e.jsxs(Ke,{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(Be,{value:`${I}-${C}`,onValueChange:oe=>{const[ke,is]=oe.split("-");E(ke),M(is),f(1)},children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"usage_count-desc",children:"使用次数 (多→少)"}),e.jsx(ee,{value:"usage_count-asc",children:"使用次数 (少→多)"}),e.jsx(ee,{value:"register_time-desc",children:"注册时间 (新→旧)"}),e.jsx(ee,{value:"register_time-asc",children:"注册时间 (旧→新)"}),e.jsx(ee,{value:"record_time-desc",children:"记录时间 (新→旧)"}),e.jsx(ee,{value:"record_time-asc",children:"记录时间 (旧→新)"}),e.jsx(ee,{value:"last_used_time-desc",children:"最后使用 (新→旧)"}),e.jsx(ee,{value:"last_used_time-asc",children:"最后使用 (旧→新)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"注册状态"}),e.jsxs(Be,{value:y,onValueChange:oe=>{w(oe),f(1)},children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"all",children:"全部"}),e.jsx(ee,{value:"registered",children:"已注册"}),e.jsx(ee,{value:"unregistered",children:"未注册"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"封禁状态"}),e.jsxs(Be,{value:b,onValueChange:oe=>{O(oe),f(1)},children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"all",children:"全部"}),e.jsx(ee,{value:"banned",children:"已封禁"}),e.jsx(ee,{value:"unbanned",children:"未封禁"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"格式"}),e.jsxs(Be,{value:A,onValueChange:oe=>{_(oe),f(1)},children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"all",children:"全部"}),Te.map(oe=>e.jsxs(ee,{value:oe,children:[oe.toUpperCase()," (",i?.formats[oe],")"]},oe))]})]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 pt-4 border-t",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[ge.size>0&&e.jsxs("span",{className:"text-sm text-muted-foreground",children:["已选择 ",ge.size," 个表情包"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{className:"text-sm whitespace-nowrap",children:"卡片大小"}),e.jsxs(Be,{value:$,onValueChange:oe=>_e(oe),children:[e.jsx(Le,{className:"w-24",children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"small",children:"小"}),e.jsx(ee,{value:"medium",children:"中"}),e.jsx(ee,{value:"large",children:"大"})]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{htmlFor:"emoji-page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Be,{value:N.toString(),onValueChange:oe=>{v(parseInt(oe)),f(1),be(new Set)},children:[e.jsx(Le,{id:"emoji-page-size",className:"w-20",children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"20",children:"20"}),e.jsx(ee,{value:"40",children:"40"}),e.jsx(ee,{value:"60",children:"60"}),e.jsx(ee,{value:"100",children:"100"})]})]}),ge.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(k,{variant:"outline",size:"sm",onClick:()=>be(new Set),children:"取消选择"}),e.jsxs(k,{variant:"destructive",size:"sm",onClick:()=>q(!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(k,{variant:"outline",size:"sm",onClick:ye,disabled:u,children:[e.jsx(_t,{className:`h-4 w-4 mr-2 ${u?"animate-spin":""}`}),"刷新"]})})]})]}),e.jsxs(De,{children:[e.jsxs(Xe,{children:[e.jsx(es,{children:"表情包列表"}),e.jsxs(Gs,{children:["共 ",p," 个表情包,当前第 ",h," 页"]})]}),e.jsxs(Ke,{children:[l.length===0?e.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"暂无数据"}):e.jsx("div",{className:`grid gap-3 ${$==="small"?"grid-cols-3 sm:grid-cols-4 md:grid-cols-6 lg:grid-cols-8 xl:grid-cols-10":$==="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(oe=>e.jsxs("div",{className:`group relative rounded-lg border bg-card overflow-hidden hover:ring-2 hover:ring-primary transition-all cursor-pointer ${ge.has(oe.id)?"ring-2 ring-primary bg-primary/5":""}`,onClick:()=>Z(oe.id),children:[e.jsx("div",{className:`absolute top-1 left-1 z-10 transition-opacity ${ge.has(oe.id)?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:e.jsx("div",{className:`w-5 h-5 rounded-full border-2 flex items-center justify-center ${ge.has(oe.id)?"bg-primary border-primary text-primary-foreground":"bg-background/80 border-muted-foreground/50"}`,children:ge.has(oe.id)&&e.jsx(sa,{className:"h-3 w-3"})})}),e.jsxs("div",{className:"absolute top-1 right-1 z-10 flex flex-col gap-0.5",children:[oe.is_registered&&e.jsx(Ae,{variant:"default",className:"bg-green-600 text-[10px] px-1 py-0",children:"已注册"}),oe.is_banned&&e.jsx(Ae,{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 ${$==="small"?"p-1":$==="medium"?"p-2":"p-3"}`,children:e.jsx(RS,{src:FS(oe.id),alt:"表情包"})}),e.jsxs("div",{className:`border-t bg-card ${$==="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(Ae,{variant:"outline",className:"text-[10px] px-1 py-0",children:oe.format.toUpperCase()}),e.jsxs("span",{className:"font-mono",children:[oe.usage_count,"次"]})]}),e.jsxs("div",{className:`flex gap-1 justify-center opacity-0 group-hover:opacity-100 transition-opacity ${$==="small"?"flex-wrap":""}`,children:[e.jsx(k,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:ke=>{ke.stopPropagation(),Ee(oe)},title:"编辑",children:e.jsx($n,{className:"h-3 w-3"})}),e.jsx(k,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:ke=>{ke.stopPropagation(),he(oe)},title:"详情",children:e.jsx(Kt,{className:"h-3 w-3"})}),!oe.is_registered&&e.jsx(k,{variant:"ghost",size:"icon",className:"h-6 w-6 text-green-600 hover:text-green-700",onClick:ke=>{ke.stopPropagation(),Ie(oe)},title:"注册",children:e.jsx(sa,{className:"h-3 w-3"})}),!oe.is_banned&&e.jsx(k,{variant:"ghost",size:"icon",className:"h-6 w-6 text-orange-600 hover:text-orange-700",onClick:ke=>{ke.stopPropagation(),V(oe)},title:"封禁",children:e.jsx(Gw,{className:"h-3 w-3"})}),e.jsx(k,{variant:"ghost",size:"icon",className:"h-6 w-6 text-red-600 hover:text-red-700",onClick:ke=>{ke.stopPropagation(),Y(oe)},title:"删除",children:e.jsx(ns,{className:"h-3 w-3"})})]})]})]},oe.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(k,{variant:"outline",size:"sm",onClick:()=>f(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(Ir,{className:"h-4 w-4"})}),e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>f(oe=>Math.max(1,oe-1)),disabled:h===1,children:[e.jsx(ll,{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(re,{type:"number",value:U,onChange:oe=>L(oe.target.value),onKeyDown:oe=>oe.key==="Enter"&&ze(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(p/N)}),e.jsx(k,{variant:"outline",size:"sm",onClick:ze,disabled:!U,className:"h-8",children:"跳转"})]}),e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>f(oe=>oe+1),disabled:h>=Math.ceil(p/N),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(ha,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(k,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(p/N)),disabled:h>=Math.ceil(p/N),className:"hidden sm:flex",children:e.jsx(Hr,{className:"h-4 w-4"})})]})]})]})]}),e.jsx(YS,{emoji:F,open:se,onOpenChange:G}),e.jsx(JS,{emoji:F,open:me,onOpenChange:ce,onSuccess:()=>{ye(),X()}}),e.jsx(XS,{open:pe,onOpenChange:Se,onSuccess:()=>{ye(),X()}})]})}),e.jsx(js,{open:z,onOpenChange:q,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认批量删除"}),e.jsxs(hs,{children:["你确定要删除选中的 ",ge.size," 个表情包吗?此操作不可撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:Oe,children:"确认删除"})]})]})}),e.jsx(Fs,{open:Ne,onOpenChange:le,children:e.jsxs(Bs,{children:[e.jsxs($s,{children:[e.jsx(Is,{children:"确认删除"}),e.jsx(tt,{children:"确定要删除这个表情包吗?此操作无法撤销。"})]}),e.jsxs(ot,{children:[e.jsx(k,{variant:"outline",onClick:()=>le(!1),children:"取消"}),e.jsx(k,{variant:"destructive",onClick:ie,children:"删除"})]})]})})]})}function YS({emoji:l,open:n,onOpenChange:i}){if(!l)return null;const c=u=>u?new Date(u*1e3).toLocaleString("zh-CN"):"-";return e.jsx(Fs,{open:n,onOpenChange:i,children:e.jsxs(Bs,{className:"max-w-2xl max-h-[90vh]",children:[e.jsx($s,{children:e.jsx(Is,{children:"表情包详情"})}),e.jsx(ss,{className:"max-h-[calc(90vh-8rem)] pr-4",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("div",{className:"w-32 h-32 bg-muted rounded-lg flex items-center justify-center overflow-hidden",children:e.jsx("img",{src:qS(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(Ae,{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(LS,{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(Ae,{variant:"default",className:"bg-green-600",children:"已注册"}),l.is_banned&&e.jsx(Ae,{variant:"destructive",children:"已封禁"}),!l.is_registered&&!l.is_banned&&e.jsx(Ae,{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 JS({emoji:l,open:n,onOpenChange:i,onSuccess:c}){const[u,x]=m.useState(""),[h,f]=m.useState(!1),[p,g]=m.useState(!1),[N,v]=m.useState(!1),{toast:y}=Zs();m.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(O=>O.trim()).filter(Boolean).join(",");await $S(l.id,{emotion:b||void 0,is_registered:h,is_banned:p}),y({title:"成功",description:"表情包信息已更新"}),i(!1),c()}catch(b){const O=b instanceof Error?b.message:"保存失败";y({title:"错误",description:O,variant:"destructive"})}finally{v(!1)}};return l?e.jsx(Fs,{open:n,onOpenChange:i,children:e.jsxs(Bs,{className:"max-w-2xl",children:[e.jsxs($s,{children:[e.jsx(Is,{children:"编辑表情包"}),e.jsx(tt,{children:"修改表情包的情绪和状态信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(T,{children:"情绪"}),e.jsx(et,{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(Js,{id:"is_registered",checked:h,onCheckedChange:b=>{b===!0?(f(!0),g(!1)):f(!1)}}),e.jsx(T,{htmlFor:"is_registered",className:"cursor-pointer",children:"已注册"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Js,{id:"is_banned",checked:p,onCheckedChange:b=>{b===!0?(g(!0),f(!1)):g(!1)}}),e.jsx(T,{htmlFor:"is_banned",className:"cursor-pointer",children:"已封禁"})]})]})]}),e.jsxs(ot,{children:[e.jsx(k,{variant:"outline",onClick:()=>i(!1),children:"取消"}),e.jsx(k,{onClick:w,disabled:N,children:N?"保存中...":"保存"})]})]})}):null}function XS({open:l,onOpenChange:n,onSuccess:i}){const[c,u]=m.useState("select"),[x,h]=m.useState([]),[f,p]=m.useState(null),[g,N]=m.useState(!1),{toast:v}=Zs(),y=m.useMemo(()=>new j1({id:"emoji-uploader",autoProceed:!1,restrictions:{maxFileSize:10485760,allowedFileTypes:["image/jpeg","image/png","image/gif","image/webp"],maxNumberOfFiles:20},locale:{pluralize:()=>0,strings:{addMoreFiles:"添加更多文件",addingMoreFiles:"正在添加更多文件",allowedFileTypes:"允许的文件类型:%{types}",cancel:"取消",closeModal:"关闭",complete:"完成",connectedToInternet:"已连接到互联网",copyLink:"复制链接",copyLinkToClipboardFallback:"复制下方链接",copyLinkToClipboardSuccess:"链接已复制到剪贴板",dashboardTitle:"选择文件",dashboardWindowTitle:"文件选择窗口(按 ESC 关闭)",done:"完成",dropHereOr:"拖放文件到这里或 %{browse}",dropHint:"将文件拖放到此处",dropPasteFiles:"将文件拖放到这里或 %{browseFiles}",dropPasteFolders:"将文件拖放到这里或 %{browseFolders}",dropPasteBoth:"将文件拖放到这里,%{browseFiles} 或 %{browseFolders}",dropPasteImportFiles:"将文件拖放到这里,%{browseFiles} 或从以下位置导入:",dropPasteImportFolders:"将文件拖放到这里,%{browseFolders} 或从以下位置导入:",dropPasteImportBoth:"将文件拖放到这里,%{browseFiles},%{browseFolders} 或从以下位置导入:",editFile:"编辑文件",editing:"正在编辑 %{file}",emptyFolderAdded:"未从空文件夹添加文件",exceedsSize:"%{file} 超过了最大允许大小 %{size}",failedToUpload:"上传 %{file} 失败",fileSource:"文件来源:%{name}",filesUploadedOfTotal:{0:"已上传 %{complete} / %{smart_count} 个文件",1:"已上传 %{complete} / %{smart_count} 个文件"},filter:"筛选",finishEditingFile:"完成编辑文件",folderAdded:{0:"已从 %{folder} 添加 %{smart_count} 个文件",1:"已从 %{folder} 添加 %{smart_count} 个文件"},generatingThumbnails:"正在生成缩略图...",import:"导入",importFiles:"从以下位置导入文件:",importFrom:"从 %{name} 导入",loading:"加载中...",logOut:"登出",myDevice:"我的设备",noFilesFound:"这里没有文件或文件夹",noInternetConnection:"无网络连接",openFolderNamed:"打开文件夹 %{name}",pause:"暂停",pauseUpload:"暂停上传",paused:"已暂停",poweredBy:"技术支持:%{uppy}",processingXFiles:{0:"正在处理 %{smart_count} 个文件",1:"正在处理 %{smart_count} 个文件"},recording:"录制中",removeFile:"移除文件",resetFilter:"重置筛选",resume:"继续",resumeUpload:"继续上传",retry:"重试",retryUpload:"重试上传",save:"保存",saveChanges:"保存更改",selectFileNamed:"选择文件 %{name}",selectX:{0:"选择 %{smart_count}",1:"选择 %{smart_count}"},smile:"笑一个!",startRecording:"开始录制视频",stopRecording:"停止录制视频",takePicture:"拍照",timedOut:"上传已停滞 %{seconds} 秒,正在中止。",upload:"下一步",uploadComplete:"上传完成",uploadFailed:"上传失败",uploadPaused:"上传已暂停",uploadXFiles:{0:"下一步(%{smart_count} 个文件)",1:"下一步(%{smart_count} 个文件)"},uploadXNewFiles:{0:"下一步(+%{smart_count} 个文件)",1:"下一步(+%{smart_count} 个文件)"},uploading:"正在上传",uploadingXFiles:{0:"正在上传 %{smart_count} 个文件",1:"正在上传 %{smart_count} 个文件"},xFilesSelected:{0:"已选择 %{smart_count} 个文件",1:"已选择 %{smart_count} 个文件"},xMoreFilesAdded:{0:"又添加了 %{smart_count} 个文件",1:"又添加了 %{smart_count} 个文件"},xTimeLeft:"剩余 %{time}",youCanOnlyUploadFileTypes:"您只能上传:%{types}",youCanOnlyUploadX:{0:"您只能上传 %{smart_count} 个文件",1:"您只能上传 %{smart_count} 个文件"},youHaveToAtLeastSelectX:{0:"您至少需要选择 %{smart_count} 个文件",1:"您至少需要选择 %{smart_count} 个文件"},browseFiles:"浏览文件",browseFolders:"浏览文件夹",cancelUpload:"取消上传",addMore:"添加更多",back:"返回",editFileWithFilename:"编辑文件 %{file}"}}}),[]);m.useEffect(()=>{const F=()=>{const D=y.getFiles();if(D.length===0)return;const se=D.map(G=>({id:G.id,name:G.name,previewUrl:G.preview||URL.createObjectURL(G.data),emotion:"",description:"",isRegistered:!0,file:G.data}));h(se),D.length===1?(p(se[0].id),u("edit-single")):u("edit-multiple")};return y.on("upload",F),()=>{y.off("upload",F)}},[y]),m.useEffect(()=>{l||(y.cancelAll(),u("select"),h([]),p(null),N(!1))},[l,y]);const w=m.useCallback((F,D)=>{h(se=>se.map(G=>G.id===F?{...G,...D}:G))},[]),b=m.useCallback(F=>F.emotion.trim().length>0,[]),O=m.useMemo(()=>x.length>0&&x.every(b),[x,b]),A=m.useMemo(()=>x.find(F=>F.id===f)||null,[x,f]),_=m.useCallback(()=>{(c==="edit-single"||c==="edit-multiple")&&(u("select"),h([]),p(null))},[c]),I=m.useCallback(async()=>{if(!O){v({title:"请填写必填项",description:"每个表情包的情感标签都是必填的",variant:"destructive"});return}N(!0);let F=0,D=0;try{for(const se of x){const G=new FormData;G.append("file",se.file),G.append("emotion",se.emotion),G.append("description",se.description),G.append("is_registered",se.isRegistered.toString());try{(await we(KS(),{method:"POST",body:G})).ok?F++:D++}catch{D++}}D===0?(v({title:"上传成功",description:`成功上传 ${F} 个表情包`}),n(!1),i()):(v({title:"部分上传失败",description:`成功 ${F} 个,失败 ${D} 个`,variant:"destructive"}),i())}finally{N(!1)}},[O,x,v,n,i]),E=()=>e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"border rounded-lg overflow-hidden w-full",children:e.jsx(OS,{uppy:y,proudlyDisplayPoweredByUppy:!1,hideProgressDetails:!0,height:350,width:"100%",theme:"auto",note:"支持 JPG、PNG、GIF、WebP 格式,最多 20 个文件"})})}),C=()=>{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(k,{variant:"ghost",size:"sm",onClick:_,children:[e.jsx(Va,{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(T,{htmlFor:"single-emotion",children:["情感标签 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(re,{id:"single-emotion",value:F.emotion,onChange:D=>w(F.id,{emotion:D.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(T,{htmlFor:"single-description",children:"描述"}),e.jsx(re,{id:"single-description",value:F.description,onChange:D=>w(F.id,{description:D.target.value}),placeholder:"输入表情包描述..."})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Js,{id:"single-is-registered",checked:F.isRegistered,onCheckedChange:D=>w(F.id,{isRegistered:D===!0})}),e.jsx(T,{htmlFor:"single-is-registered",className:"cursor-pointer",children:"上传后立即注册(可被麦麦使用)"})]})]})]}),e.jsx(ot,{children:e.jsx(k,{onClick:I,disabled:!O||g,children:g?"上传中...":"上传"})})]}):null},M=()=>{const F=x.filter(b).length,D=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(k,{variant:"ghost",size:"sm",onClick:_,children:[e.jsx(Va,{className:"h-4 w-4 mr-1"}),"返回"]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["编辑表情包信息(",F,"/",D," 已完成)"]})]}),e.jsx(Ae,{variant:O?"default":"secondary",children:O?e.jsxs(e.Fragment,{children:[e.jsx(wt,{className:"h-3 w-3 mr-1"}),"全部完成"]}):e.jsxs(e.Fragment,{children:[e.jsx(_a,{className:"h-3 w-3 mr-1"}),"未完成"]})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(ss,{className:"h-[350px] pr-2",children:e.jsx("div",{className:"space-y-2",children:x.map(se=>{const G=b(se),me=f===se.id;return e.jsxs("div",{onClick:()=>p(se.id),className:` + flex items-center gap-3 p-3 rounded-lg border-2 cursor-pointer transition-all + ${me?"ring-2 ring-primary":""} + ${G?"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:se.previewUrl,alt:se.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:se.name}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:se.emotion||"未填写情感标签"})]}),G?e.jsx(sa,{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"})]},se.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}),b(A)&&e.jsxs(Ae,{variant:"outline",className:"text-green-600 border-green-600",children:[e.jsx(wt,{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(re,{id:"multi-emotion",value:A.emotion,onChange:se=>w(A.id,{emotion:se.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(re,{id:"multi-description",value:A.description,onChange:se=>w(A.id,{description:se.target.value}),placeholder:"输入表情包描述..."})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Js,{id:"multi-is-registered",checked:A.isRegistered,onCheckedChange:se=>w(A.id,{isRegistered:se===!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(_j,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"点击左侧卡片编辑"})]})})})]}),e.jsx(ot,{children:e.jsx(k,{onClick:I,disabled:!O||g,children:g?"上传中...":`上传全部 (${D})`})})]})};return e.jsx(Fs,{open:l,onOpenChange:n,children:e.jsxs(Bs,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[e.jsxs($s,{children:[e.jsxs(Is,{className:"flex items-center gap-2",children:[e.jsx(Ki,{className:"h-5 w-5"}),c==="select"&&"上传表情包 - 选择文件",c==="edit-single"&&"上传表情包 - 填写信息",c==="edit-multiple"&&"上传表情包 - 批量编辑"]}),e.jsxs(tt,{children:[c==="select"&&"支持 JPG、PNG、GIF、WebP 格式,单个文件最大 10MB,可同时上传多个文件",c==="edit-single"&&"请填写表情包的情感标签(必填)和描述",c==="edit-multiple"&&"点击左侧卡片编辑每个表情包的信息,情感标签为必填项"]})]}),e.jsxs("div",{className:"overflow-y-auto pr-1",children:[c==="select"&&E(),c==="edit-single"&&C(),c==="edit-multiple"&&M()]})]})})}const xn="/api/webui/expression";async function ZS(){const l=await we(`${xn}/chats`,{});if(!l.ok){const n=await l.json();throw new Error(n.detail||"获取聊天列表失败")}return l.json()}async function WS(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(`${xn}/list?${n}`,{});if(!i.ok){const c=await i.json();throw new Error(c.detail||"获取表达方式列表失败")}return i.json()}async function e4(l){const n=await we(`${xn}/${l}`,{});if(!n.ok){const i=await n.json();throw new Error(i.detail||"获取表达方式详情失败")}return n.json()}async function s4(l){const n=await we(`${xn}/`,{method:"POST",body:JSON.stringify(l)});if(!n.ok){const i=await n.json();throw new Error(i.detail||"创建表达方式失败")}return n.json()}async function t4(l,n){const i=await we(`${xn}/${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 a4(l){const n=await we(`${xn}/${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(`${xn}/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 n4(){const l=await we(`${xn}/stats/summary`,{});if(!l.ok){const n=await l.json();throw new Error(n.detail||"获取统计数据失败")}return l.json()}function r4(){const[l,n]=m.useState([]),[i,c]=m.useState(!0),[u,x]=m.useState(0),[h,f]=m.useState(1),[p,g]=m.useState(20),[N,v]=m.useState(""),[y,w]=m.useState(null),[b,O]=m.useState(!1),[A,_]=m.useState(!1),[I,E]=m.useState(!1),[C,M]=m.useState(null),[F,D]=m.useState(new Set),[se,G]=m.useState(!1),[me,ce]=m.useState(""),[Ne,le]=m.useState({total:0,recent_7days:0,chat_count:0,top_chats:{}}),[ge,be]=m.useState([]),[z,q]=m.useState(new Map),{toast:U}=Zs(),L=async()=>{try{c(!0);const ie=await WS({page:h,page_size:p,search:N||void 0});n(ie.data),x(ie.total)}catch(ie){U({title:"加载失败",description:ie instanceof Error?ie.message:"无法加载表达方式",variant:"destructive"})}finally{c(!1)}},$=async()=>{try{const ie=await n4();ie?.data&&le(ie.data)}catch(ie){console.error("加载统计数据失败:",ie)}},_e=async()=>{try{const ie=await ZS();if(ie?.data){be(ie.data);const Ie=new Map;ie.data.forEach(V=>{Ie.set(V.chat_id,V.chat_name)}),q(Ie)}}catch(ie){console.error("加载聊天列表失败:",ie)}},pe=ie=>z.get(ie)||ie;m.useEffect(()=>{L(),$(),_e()},[h,p,N]);const Se=async ie=>{try{const Ie=await e4(ie.id);w(Ie.data),O(!0)}catch(Ie){U({title:"加载详情失败",description:Ie instanceof Error?Ie.message:"无法加载表达方式详情",variant:"destructive"})}},Q=ie=>{w(ie),_(!0)},ye=async ie=>{try{await a4(ie.id),U({title:"删除成功",description:`已删除表达方式: ${ie.situation}`}),M(null),L(),$()}catch(Ie){U({title:"删除失败",description:Ie instanceof Error?Ie.message:"无法删除表达方式",variant:"destructive"})}},X=ie=>{const Ie=new Set(F);Ie.has(ie)?Ie.delete(ie):Ie.add(ie),D(Ie)},he=()=>{F.size===l.length&&l.length>0?D(new Set):D(new Set(l.map(ie=>ie.id)))},Ee=async()=>{try{await l4(Array.from(F)),U({title:"批量删除成功",description:`已删除 ${F.size} 个表达方式`}),D(new Set),G(!1),L(),$()}catch(ie){U({title:"批量删除失败",description:ie instanceof Error?ie.message:"无法批量删除表达方式",variant:"destructive"})}},Y=()=>{const ie=parseInt(me),Ie=Math.ceil(u/p);ie>=1&&ie<=Ie?(f(ie),ce("")):U({title:"无效的页码",description:`请输入1-${Ie}之间的页码`,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(on,{className:"h-8 w-8",strokeWidth:2}),"表达方式管理"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦的表达方式和话术模板"})]}),e.jsxs(k,{onClick:()=>E(!0),className:"gap-2",children:[e.jsx(st,{className:"h-4 w-4"}),"新增表达方式"]})]})}),e.jsx(ss,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"总数量"}),e.jsx("div",{className:"text-2xl font-bold mt-1",children:Ne.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:Ne.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:Ne.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(Qt,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(re,{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(T,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Be,{value:p.toString(),onValueChange:ie=>{g(parseInt(ie)),f(1),D(new Set)},children:[e.jsx(Le,{id:"page-size",className:"w-20",children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"10",children:"10"}),e.jsx(ee,{value:"20",children:"20"}),e.jsx(ee,{value:"50",children:"50"}),e.jsx(ee,{value:"100",children:"100"})]})]}),F.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(k,{variant:"outline",size:"sm",onClick:()=>D(new Set),children:"取消选择"}),e.jsxs(k,{variant:"destructive",size:"sm",onClick:()=>G(!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(El,{children:[e.jsx(Ml,{children:e.jsxs(ct,{children:[e.jsx(Ye,{className:"w-12",children:e.jsx(Js,{checked:F.size===l.length&&l.length>0,onCheckedChange:he})}),e.jsx(Ye,{children:"情境"}),e.jsx(Ye,{children:"风格"}),e.jsx(Ye,{children:"聊天"}),e.jsx(Ye,{className:"text-right",children:"操作"})]})}),e.jsx(Al,{children:i?e.jsx(ct,{children:e.jsx(Ge,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):l.length===0?e.jsx(ct,{children:e.jsx(Ge,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):l.map(ie=>e.jsxs(ct,{children:[e.jsx(Ge,{children:e.jsx(Js,{checked:F.has(ie.id),onCheckedChange:()=>X(ie.id)})}),e.jsx(Ge,{className:"font-medium max-w-xs truncate",children:ie.situation}),e.jsx(Ge,{className:"max-w-xs truncate",children:ie.style}),e.jsx(Ge,{className:"max-w-[200px] truncate",title:pe(ie.chat_id),style:{wordBreak:"keep-all"},children:e.jsx("span",{className:"whitespace-nowrap overflow-hidden text-ellipsis block",children:pe(ie.chat_id)})}),e.jsx(Ge,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(k,{variant:"default",size:"sm",onClick:()=>Q(ie),children:[e.jsx($n,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(k,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>Se(ie),title:"查看详情",children:e.jsx(ta,{className:"h-4 w-4"})}),e.jsxs(k,{size:"sm",onClick:()=>M(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(Js,{checked:F.has(ie.id),onCheckedChange:()=>X(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:pe(ie.chat_id),style:{wordBreak:"keep-all"},children:pe(ie.chat_id)})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>Q(ie),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx($n,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(k,{variant:"outline",size:"sm",onClick:()=>Se(ie),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:e.jsx(ta,{className:"h-3 w-3"})}),e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>M(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(k,{variant:"outline",size:"sm",onClick:()=>f(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(Ir,{className:"h-4 w-4"})}),e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>f(h-1),disabled:h===1,children:[e.jsx(ll,{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(re,{type:"number",value:me,onChange:ie=>ce(ie.target.value),onKeyDown:ie=>ie.key==="Enter"&&Y(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(u/p)}),e.jsx(k,{variant:"outline",size:"sm",onClick:Y,disabled:!me,className:"h-8",children:"跳转"})]}),e.jsxs(k,{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(ha,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(k,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(u/p)),disabled:h>=Math.ceil(u/p),className:"hidden sm:flex",children:e.jsx(Hr,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(i4,{expression:y,open:b,onOpenChange:O,chatNameMap:z}),e.jsx(c4,{open:I,onOpenChange:E,chatList:ge,onSuccess:()=>{L(),$(),E(!1)}}),e.jsx(o4,{expression:y,open:A,onOpenChange:_,chatList:ge,onSuccess:()=>{L(),$(),_(!1)}}),e.jsx(js,{open:!!C,onOpenChange:()=>M(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&&ye(C),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(d4,{open:se,onOpenChange:G,onConfirm:Ee,count:F.size})]})}function i4({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(Fs,{open:n,onOpenChange:i,children:e.jsxs(Bs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs($s,{children:[e.jsx(Is,{children:"表达方式详情"}),e.jsx(tt,{children:"查看表达方式的完整信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Ui,{label:"情境",value:l.situation}),e.jsx(Ui,{label:"风格",value:l.style}),e.jsx(Ui,{label:"聊天",value:x(l.chat_id)}),e.jsx(Ui,{icon:Ur,label:"记录ID",value:l.id.toString(),mono:!0})]}),e.jsx("div",{className:"grid grid-cols-2 gap-4",children:e.jsx(Ui,{icon:kl,label:"创建时间",value:u(l.create_date)})})]}),e.jsx(ot,{children:e.jsx(k,{onClick:()=>i(!1),children:"关闭"})})]})})}function Ui({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:B("text-sm",c&&"font-mono",!i&&"text-muted-foreground"),children:i||"-"})]})}function c4({open:l,onOpenChange:n,chatList:i,onSuccess:c}){const[u,x]=m.useState({situation:"",style:"",chat_id:""}),[h,f]=m.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 s4(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(Fs,{open:l,onOpenChange:n,children:e.jsxs(Bs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs($s,{children:[e.jsx(Is,{children:"新增表达方式"}),e.jsx(tt,{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(re,{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(re,{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(Be,{value:u.chat_id,onValueChange:N=>x({...u,chat_id:N}),children:[e.jsx(Le,{children:e.jsx($e,{placeholder:"选择关联的聊天"})}),e.jsx(Ue,{children:i.map(N=>e.jsx(ee,{value:N.chat_id,children:e.jsxs("span",{className:"truncate",style:{wordBreak:"keep-all"},children:[N.chat_name,N.is_group&&e.jsx("span",{className:"text-muted-foreground ml-1",children:"(群聊)"})]})},N.chat_id))})]})]})]}),e.jsxs(ot,{children:[e.jsx(k,{variant:"outline",onClick:()=>n(!1),children:"取消"}),e.jsx(k,{onClick:g,disabled:h,children:h?"创建中...":"创建"})]})]})})}function o4({expression:l,open:n,onOpenChange:i,chatList:c,onSuccess:u}){const[x,h]=m.useState({}),[f,p]=m.useState(!1),{toast:g}=Zs();m.useEffect(()=>{l&&h({situation:l.situation,style:l.style,chat_id:l.chat_id})},[l]);const N=async()=>{if(l)try{p(!0),await t4(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(Fs,{open:n,onOpenChange:i,children:e.jsxs(Bs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs($s,{children:[e.jsx(Is,{children:"编辑表达方式"}),e.jsx(tt,{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(re,{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(re,{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(Be,{value:x.chat_id||"",onValueChange:v=>h({...x,chat_id:v}),children:[e.jsx(Le,{children:e.jsx($e,{placeholder:"选择关联的聊天"})}),e.jsx(Ue,{children:c.map(v=>e.jsx(ee,{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(ot,{children:[e.jsx(k,{variant:"outline",onClick:()=>i(!1),children:"取消"}),e.jsx(k,{onClick:N,disabled:f,children:f?"保存中...":"保存"})]})]})}):null}function d4({open:l,onOpenChange:n,onConfirm:i,count:c}){return e.jsx(js,{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 zl="/api/webui/jargon";async function u4(){const l=await we(`${zl}/chats`,{});if(!l.ok){const n=await l.json();throw new Error(n.detail||"获取聊天列表失败")}return l.json()}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.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(`${zl}/list?${n}`,{});if(!i.ok){const c=await i.json();throw new Error(c.detail||"获取黑话列表失败")}return i.json()}async function x4(l){const n=await we(`${zl}/${l}`,{});if(!n.ok){const i=await n.json();throw new Error(i.detail||"获取黑话详情失败")}return n.json()}async function h4(l){const n=await we(`${zl}/`,{method:"POST",body:JSON.stringify(l)});if(!n.ok){const i=await n.json();throw new Error(i.detail||"创建黑话失败")}return n.json()}async function f4(l,n){const i=await we(`${zl}/${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 p4(l){const n=await we(`${zl}/${l}`,{method:"DELETE"});if(!n.ok){const i=await n.json();throw new Error(i.detail||"删除黑话失败")}return n.json()}async function g4(l){const n=await we(`${zl}/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 j4(){const l=await we(`${zl}/stats/summary`,{});if(!l.ok){const n=await l.json();throw new Error(n.detail||"获取黑话统计失败")}return l.json()}async function v4(l,n){const i=new URLSearchParams;l.forEach(u=>i.append("ids",u.toString())),i.append("is_jargon",n.toString());const c=await we(`${zl}/batch/set-jargon?${i}`,{method:"POST"});if(!c.ok){const u=await c.json();throw new Error(u.detail||"批量设置黑话状态失败")}return c.json()}function N4(){const[l,n]=m.useState([]),[i,c]=m.useState(!0),[u,x]=m.useState(0),[h,f]=m.useState(1),[p,g]=m.useState(20),[N,v]=m.useState(""),[y,w]=m.useState("all"),[b,O]=m.useState("all"),[A,_]=m.useState(null),[I,E]=m.useState(!1),[C,M]=m.useState(!1),[F,D]=m.useState(!1),[se,G]=m.useState(null),[me,ce]=m.useState(new Set),[Ne,le]=m.useState(!1),[ge,be]=m.useState(""),[z,q]=m.useState({total:0,confirmed_jargon:0,confirmed_not_jargon:0,pending:0,global_count:0,complete_count:0,chat_count:0,top_chats:{}}),[U,L]=m.useState([]),{toast:$}=Zs(),_e=async()=>{try{c(!0);const Z=await m4({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(Z.data),x(Z.total)}catch(Z){$({title:"加载失败",description:Z instanceof Error?Z.message:"无法加载黑话列表",variant:"destructive"})}finally{c(!1)}},pe=async()=>{try{const Z=await j4();Z?.data&&q(Z.data)}catch(Z){console.error("加载统计数据失败:",Z)}},Se=async()=>{try{const Z=await u4();Z?.data&&L(Z.data)}catch(Z){console.error("加载聊天列表失败:",Z)}};m.useEffect(()=>{_e(),pe(),Se()},[h,p,N,y,b]);const Q=async Z=>{try{const Oe=await x4(Z.id);_(Oe.data),E(!0)}catch(Oe){$({title:"加载详情失败",description:Oe instanceof Error?Oe.message:"无法加载黑话详情",variant:"destructive"})}},ye=Z=>{_(Z),M(!0)},X=async Z=>{try{await p4(Z.id),$({title:"删除成功",description:`已删除黑话: ${Z.content}`}),G(null),_e(),pe()}catch(Oe){$({title:"删除失败",description:Oe instanceof Error?Oe.message:"无法删除黑话",variant:"destructive"})}},he=Z=>{const Oe=new Set(me);Oe.has(Z)?Oe.delete(Z):Oe.add(Z),ce(Oe)},Ee=()=>{me.size===l.length&&l.length>0?ce(new Set):ce(new Set(l.map(Z=>Z.id)))},Y=async()=>{try{await g4(Array.from(me)),$({title:"批量删除成功",description:`已删除 ${me.size} 个黑话`}),ce(new Set),le(!1),_e(),pe()}catch(Z){$({title:"批量删除失败",description:Z instanceof Error?Z.message:"无法批量删除黑话",variant:"destructive"})}},ie=async Z=>{try{await v4(Array.from(me),Z),$({title:"操作成功",description:`已将 ${me.size} 个词条设为${Z?"黑话":"非黑话"}`}),ce(new Set),_e(),pe()}catch(Oe){$({title:"操作失败",description:Oe instanceof Error?Oe.message:"批量设置失败",variant:"destructive"})}},Ie=()=>{const Z=parseInt(ge),Oe=Math.ceil(u/p);Z>=1&&Z<=Oe?(f(Z),be("")):$({title:"无效的页码",description:`请输入1-${Oe}之间的页码`,variant:"destructive"})},V=Z=>Z===!0?e.jsxs(Ae,{variant:"default",className:"bg-green-600 hover:bg-green-700",children:[e.jsx(wt,{className:"h-3 w-3 mr-1"}),"是黑话"]}):Z===!1?e.jsxs(Ae,{variant:"secondary",children:[e.jsx(_a,{className:"h-3 w-3 mr-1"}),"非黑话"]}):e.jsxs(Ae,{variant:"outline",children:[e.jsx(vj,{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(Fw,{className:"h-8 w-8",strokeWidth:2}),"黑话管理"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦学习到的黑话和俚语"})]}),e.jsxs(k,{onClick:()=>D(!0),className:"gap-2",children:[e.jsx(st,{className:"h-4 w-4"}),"新增黑话"]})]})}),e.jsx(ss,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 lg:grid-cols-7 gap-3",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"总数量"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1",children: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(T,{htmlFor:"search",children:"搜索"}),e.jsxs("div",{className:"relative",children:[e.jsx(Qt,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(re,{id:"search",placeholder:"搜索内容、含义...",value:N,onChange:Z=>v(Z.target.value),className:"pl-9"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(T,{children:"聊天筛选"}),e.jsxs(Be,{value:y,onValueChange:w,children:[e.jsx(Le,{children:e.jsx($e,{placeholder:"全部聊天"})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"all",children:"全部聊天"}),U.map(Z=>e.jsx(ee,{value:Z.chat_id,children:Z.chat_name},Z.chat_id))]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(T,{children:"状态筛选"}),e.jsxs(Be,{value:b,onValueChange:O,children:[e.jsx(Le,{children:e.jsx($e,{placeholder:"全部状态"})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"all",children:"全部状态"}),e.jsx(ee,{value:"true",children:"是黑话"}),e.jsx(ee,{value:"false",children:"非黑话"})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(T,{htmlFor:"page-size",children:"每页显示"}),e.jsxs(Be,{value:p.toString(),onValueChange:Z=>{g(parseInt(Z)),f(1),ce(new Set)},children:[e.jsx(Le,{id:"page-size",children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"10",children:"10"}),e.jsx(ee,{value:"20",children:"20"}),e.jsx(ee,{value:"50",children:"50"}),e.jsx(ee,{value:"100",children:"100"})]})]})]})]}),me.size>0&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mt-4 pt-4 border-t",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:["已选择 ",me.size," 个"]}),e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>ie(!0),children:[e.jsx(wt,{className:"h-4 w-4 mr-1"}),"标记为黑话"]}),e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>ie(!1),children:[e.jsx(_a,{className:"h-4 w-4 mr-1"}),"标记为非黑话"]}),e.jsx(k,{variant:"outline",size:"sm",onClick:()=>ce(new Set),children:"取消选择"}),e.jsxs(k,{variant:"destructive",size:"sm",onClick:()=>le(!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(El,{children:[e.jsx(Ml,{children:e.jsxs(ct,{children:[e.jsx(Ye,{className:"w-12",children:e.jsx(Js,{checked:me.size===l.length&&l.length>0,onCheckedChange:Ee})}),e.jsx(Ye,{children:"内容"}),e.jsx(Ye,{children:"含义"}),e.jsx(Ye,{children:"聊天"}),e.jsx(Ye,{children:"状态"}),e.jsx(Ye,{className:"text-center",children:"次数"}),e.jsx(Ye,{className:"text-right",children:"操作"})]})}),e.jsx(Al,{children:i?e.jsx(ct,{children:e.jsx(Ge,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):l.length===0?e.jsx(ct,{children:e.jsx(Ge,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):l.map(Z=>e.jsxs(ct,{children:[e.jsx(Ge,{children:e.jsx(Js,{checked:me.has(Z.id),onCheckedChange:()=>he(Z.id)})}),e.jsx(Ge,{className:"font-medium max-w-[200px]",children:e.jsxs("div",{className:"flex items-center gap-2",children:[Z.is_global&&e.jsx("span",{title:"全局黑话",children:e.jsx(Mo,{className:"h-4 w-4 text-blue-500 flex-shrink-0"})}),e.jsx("span",{className:"truncate",title:Z.content,children:Z.content})]})}),e.jsx(Ge,{className:"max-w-[200px] truncate",title:Z.meaning||"",children:Z.meaning||e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx(Ge,{className:"max-w-[150px] truncate",title:Z.chat_name||Z.chat_id,children:Z.chat_name||Z.chat_id}),e.jsx(Ge,{children:V(Z.is_jargon)}),e.jsx(Ge,{className:"text-center",children:Z.count}),e.jsx(Ge,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(k,{variant:"default",size:"sm",onClick:()=>ye(Z),children:[e.jsx($n,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(k,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>Q(Z),title:"查看详情",children:e.jsx(ta,{className:"h-4 w-4"})}),e.jsxs(k,{size:"sm",onClick:()=>G(Z),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(ns,{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",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Js,{checked:me.has(Z.id),onCheckedChange:()=>he(Z.id),className:"mt-1"}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[Z.is_global&&e.jsx(Mo,{className:"h-4 w-4 text-blue-500 flex-shrink-0"}),e.jsx("h3",{className:"font-semibold text-sm break-all",children:Z.content})]}),Z.meaning&&e.jsx("p",{className:"text-sm text-muted-foreground break-all",children:Z.meaning}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[V(Z.is_jargon),e.jsxs("span",{className:"text-muted-foreground",children:["次数: ",Z.count]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground truncate",children:["聊天: ",Z.chat_name||Z.chat_id]})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t",children:[e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>ye(Z),className:"text-xs px-2 py-1 h-auto",children:[e.jsx($n,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(k,{variant:"outline",size:"sm",onClick:()=>Q(Z),className:"text-xs px-2 py-1 h-auto",children:e.jsx(ta,{className:"h-3 w-3"})}),e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>G(Z),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"}),"删除"]})]})]},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(k,{variant:"outline",size:"sm",onClick:()=>f(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(Ir,{className:"h-4 w-4"})}),e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>f(h-1),disabled:h===1,children:[e.jsx(ll,{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(re,{type:"number",value:ge,onChange:Z=>be(Z.target.value),onKeyDown:Z=>Z.key==="Enter"&&Ie(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(u/p)}),e.jsx(k,{variant:"outline",size:"sm",onClick:Ie,disabled:!ge,className:"h-8",children:"跳转"})]}),e.jsxs(k,{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(ha,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(k,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(u/p)),disabled:h>=Math.ceil(u/p),className:"hidden sm:flex",children:e.jsx(Hr,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(b4,{jargon:A,open:I,onOpenChange:E}),e.jsx(y4,{open:F,onOpenChange:D,chatList:U,onSuccess:()=>{_e(),pe(),D(!1)}}),e.jsx(w4,{jargon:A,open:C,onOpenChange:M,chatList:U,onSuccess:()=>{_e(),pe(),M(!1)}}),e.jsx(js,{open:!!se,onOpenChange:()=>G(null),children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认删除"}),e.jsxs(hs,{children:['确定要删除黑话 "',se?.content,'" 吗?此操作不可撤销。']})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:()=>se&&X(se),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(js,{open:Ne,onOpenChange:le,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认批量删除"}),e.jsxs(hs,{children:["您即将删除 ",me.size," 个黑话,此操作无法撤销。确定要继续吗?"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:Y,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})]})}function b4({jargon:l,open:n,onOpenChange:i}){return l?e.jsx(Fs,{open:n,onOpenChange:i,children:e.jsxs(Bs,{className:"max-w-2xl max-h-[80vh] grid grid-rows-[auto_1fr_auto] overflow-hidden",children:[e.jsxs($s,{children:[e.jsx(Is,{children:"黑话详情"}),e.jsx(tt,{children:"查看黑话的完整信息"})]}),e.jsx(ss,{className:"h-full pr-4",children:e.jsxs("div",{className:"space-y-4 pb-2",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(km,{icon:Ur,label:"记录ID",value:l.id.toString(),mono:!0}),e.jsx(km,{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(Gm,{content:l.meaning}):"-"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(km,{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(Ae,{variant:"default",className:"bg-green-600",children:"是黑话"}),l.is_jargon===!1&&e.jsx(Ae,{variant:"secondary",children:"非黑话"}),l.is_jargon===null&&e.jsx(Ae,{variant:"outline",children:"未判定"}),l.is_global&&e.jsx(Ae,{variant:"outline",className:"border-blue-500 text-blue-500",children:"全局"}),l.is_complete&&e.jsx(Ae,{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(ot,{className:"flex-shrink-0",children:e.jsx(k,{onClick:()=>i(!1),children:"关闭"})})]})}):null}function km({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:B("text-sm",c&&"font-mono",!i&&"text-muted-foreground"),children:i||"-"})]})}function y4({open:l,onOpenChange:n,chatList:i,onSuccess:c}){const[u,x]=m.useState({content:"",meaning:"",chat_id:"",is_global:!1}),[h,f]=m.useState(!1),{toast:p}=Zs(),g=async()=>{if(!u.content||!u.chat_id){p({title:"验证失败",description:"请填写必填字段:内容和聊天",variant:"destructive"});return}try{f(!0),await h4(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(Fs,{open:l,onOpenChange:n,children:e.jsxs(Bs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs($s,{children:[e.jsx(Is,{children:"新增黑话"}),e.jsx(tt,{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(re,{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(et,{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(Be,{value:u.chat_id,onValueChange:N=>x({...u,chat_id:N}),children:[e.jsx(Le,{children:e.jsx($e,{placeholder:"选择关联的聊天"})}),e.jsx(Ue,{children:i.map(N=>e.jsx(ee,{value:N.chat_id,children:N.chat_name},N.chat_id))})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Fe,{id:"is_global",checked:u.is_global,onCheckedChange:N=>x({...u,is_global:N})}),e.jsx(T,{htmlFor:"is_global",children:"设为全局黑话"})]})]}),e.jsxs(ot,{children:[e.jsx(k,{variant:"outline",onClick:()=>n(!1),children:"取消"}),e.jsx(k,{onClick:g,disabled:h,children:h?"创建中...":"创建"})]})]})})}function w4({jargon:l,open:n,onOpenChange:i,chatList:c,onSuccess:u}){const[x,h]=m.useState({}),[f,p]=m.useState(!1),{toast:g}=Zs();m.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 f4(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(Fs,{open:n,onOpenChange:i,children:e.jsxs(Bs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs($s,{children:[e.jsx(Is,{children:"编辑黑话"}),e.jsx(tt,{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(re,{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(et,{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(Be,{value:x.chat_id||"",onValueChange:v=>h({...x,chat_id:v}),children:[e.jsx(Le,{children:e.jsx($e,{placeholder:"选择关联的聊天"})}),e.jsx(Ue,{children:c.map(v=>e.jsx(ee,{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(Be,{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(Le,{children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"null",children:"未判定"}),e.jsx(ee,{value:"true",children:"是黑话"}),e.jsx(ee,{value:"false",children:"非黑话"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Fe,{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(ot,{children:[e.jsx(k,{variant:"outline",onClick:()=>i(!1),children:"取消"}),e.jsx(k,{onClick:N,disabled:f,children:f?"保存中...":"保存"})]})]})}):null}const Fr="/api/webui/person";async function _4(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(`${Fr}/list?${n}`,{headers:Us()});if(!i.ok){const c=await i.json();throw new Error(c.detail||"获取人物列表失败")}return i.json()}async function S4(l){const n=await we(`${Fr}/${l}`,{headers:Us()});if(!n.ok){const i=await n.json();throw new Error(i.detail||"获取人物详情失败")}return n.json()}async function k4(l,n){const i=await we(`${Fr}/${l}`,{method:"PATCH",headers:Us(),body:JSON.stringify(n)});if(!i.ok){const c=await i.json();throw new Error(c.detail||"更新人物信息失败")}return i.json()}async function C4(l){const n=await we(`${Fr}/${l}`,{method:"DELETE",headers:Us()});if(!n.ok){const i=await n.json();throw new Error(i.detail||"删除人物信息失败")}return n.json()}async function T4(){const l=await we(`${Fr}/stats/summary`,{headers:Us()});if(!l.ok){const n=await l.json();throw new Error(n.detail||"获取统计数据失败")}return l.json()}async function E4(l){const n=await we(`${Fr}/batch/delete`,{method:"POST",headers:Us(),body:JSON.stringify({person_ids:l})});if(!n.ok){const i=await n.json();throw new Error(i.detail||"批量删除失败")}return n.json()}function M4(){const[l,n]=m.useState([]),[i,c]=m.useState(!0),[u,x]=m.useState(0),[h,f]=m.useState(1),[p,g]=m.useState(20),[N,v]=m.useState(""),[y,w]=m.useState(void 0),[b,O]=m.useState(void 0),[A,_]=m.useState(null),[I,E]=m.useState(!1),[C,M]=m.useState(!1),[F,D]=m.useState(null),[se,G]=m.useState({total:0,known:0,unknown:0,platforms:{}}),[me,ce]=m.useState(new Set),[Ne,le]=m.useState(!1),[ge,be]=m.useState(""),{toast:z}=Zs(),q=async()=>{try{c(!0);const Y=await _4({page:h,page_size:p,search:N||void 0,is_known:y,platform:b});n(Y.data),x(Y.total)}catch(Y){z({title:"加载失败",description:Y instanceof Error?Y.message:"无法加载人物信息",variant:"destructive"})}finally{c(!1)}},U=async()=>{try{const Y=await T4();Y?.data&&G(Y.data)}catch(Y){console.error("加载统计数据失败:",Y)}};m.useEffect(()=>{q(),U()},[h,p,N,y,b]);const L=async Y=>{try{const ie=await S4(Y.person_id);_(ie.data),E(!0)}catch(ie){z({title:"加载详情失败",description:ie instanceof Error?ie.message:"无法加载人物详情",variant:"destructive"})}},$=Y=>{_(Y),M(!0)},_e=async Y=>{try{await C4(Y.person_id),z({title:"删除成功",description:`已删除人物信息: ${Y.person_name||Y.nickname||Y.user_id}`}),D(null),q(),U()}catch(ie){z({title:"删除失败",description:ie instanceof Error?ie.message:"无法删除人物信息",variant:"destructive"})}},pe=m.useMemo(()=>Object.keys(se.platforms),[se.platforms]),Se=Y=>{const ie=new Set(me);ie.has(Y)?ie.delete(Y):ie.add(Y),ce(ie)},Q=()=>{me.size===l.length&&l.length>0?ce(new Set):ce(new Set(l.map(Y=>Y.person_id)))},ye=()=>{if(me.size===0){z({title:"未选择任何人物",description:"请先选择要删除的人物",variant:"destructive"});return}le(!0)},X=async()=>{try{const Y=await E4(Array.from(me));z({title:"批量删除完成",description:Y.message}),ce(new Set),le(!1),q(),U()}catch(Y){z({title:"批量删除失败",description:Y instanceof Error?Y.message:"批量删除失败",variant:"destructive"})}},he=()=>{const Y=parseInt(ge),ie=Math.ceil(u/p);Y>=1&&Y<=ie?(f(Y),be("")):z({title:"无效的页码",description:`请输入1-${ie}之间的页码`,variant:"destructive"})},Ee=Y=>Y?new Date(Y*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(Em,{className:"h-8 w-8",strokeWidth:2}),"人物信息管理"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦认识的所有人物信息"})]})})}),e.jsx(ss,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"总人数"}),e.jsx("div",{className:"text-2xl font-bold mt-1",children:se.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:se.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:se.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(Qt,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(re,{id:"search",placeholder:"搜索名称、昵称或用户ID...",value:N,onChange:Y=>v(Y.target.value),className:"pl-9"})]})]}),e.jsxs("div",{children:[e.jsx(T,{htmlFor:"filter-known",children:"认识状态"}),e.jsxs(Be,{value:y===void 0?"all":y.toString(),onValueChange:Y=>{w(Y==="all"?void 0:Y==="true"),f(1)},children:[e.jsx(Le,{id:"filter-known",className:"mt-1.5",children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"all",children:"全部"}),e.jsx(ee,{value:"true",children:"已认识"}),e.jsx(ee,{value:"false",children:"未认识"})]})]})]}),e.jsxs("div",{children:[e.jsx(T,{htmlFor:"filter-platform",children:"平台"}),e.jsxs(Be,{value:b||"all",onValueChange:Y=>{O(Y==="all"?void 0:Y),f(1)},children:[e.jsx(Le,{id:"filter-platform",className:"mt-1.5",children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"all",children:"全部平台"}),pe.map(Y=>e.jsxs(ee,{value:Y,children:[Y," (",se.platforms[Y],")"]},Y))]})]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[e.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:me.size>0&&e.jsxs("span",{children:["已选择 ",me.size," 个人物"]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Be,{value:p.toString(),onValueChange:Y=>{g(parseInt(Y)),f(1),ce(new Set)},children:[e.jsx(Le,{id:"page-size",className:"w-20",children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"10",children:"10"}),e.jsx(ee,{value:"20",children:"20"}),e.jsx(ee,{value:"50",children:"50"}),e.jsx(ee,{value:"100",children:"100"})]})]}),me.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(k,{variant:"outline",size:"sm",onClick:()=>ce(new Set),children:"取消选择"}),e.jsxs(k,{variant:"destructive",size:"sm",onClick:ye,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(El,{children:[e.jsx(Ml,{children:e.jsxs(ct,{children:[e.jsx(Ye,{className:"w-12",children:e.jsx(Js,{checked:l.length>0&&me.size===l.length,onCheckedChange:Q,"aria-label":"全选"})}),e.jsx(Ye,{children:"状态"}),e.jsx(Ye,{children:"名称"}),e.jsx(Ye,{children:"昵称"}),e.jsx(Ye,{children:"平台"}),e.jsx(Ye,{children:"用户ID"}),e.jsx(Ye,{children:"最后更新"}),e.jsx(Ye,{className:"text-right",children:"操作"})]})}),e.jsx(Al,{children:i?e.jsx(ct,{children:e.jsx(Ge,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):l.length===0?e.jsx(ct,{children:e.jsx(Ge,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):l.map(Y=>e.jsxs(ct,{children:[e.jsx(Ge,{children:e.jsx(Js,{checked:me.has(Y.person_id),onCheckedChange:()=>Se(Y.person_id),"aria-label":`选择 ${Y.person_name||Y.nickname||Y.user_id}`})}),e.jsx(Ge,{children:e.jsx("div",{className:B("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",Y.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:Y.is_known?"已认识":"未认识"})}),e.jsx(Ge,{className:"font-medium",children:Y.person_name||e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx(Ge,{children:Y.nickname||"-"}),e.jsx(Ge,{children:Y.platform}),e.jsx(Ge,{className:"font-mono text-sm",children:Y.user_id}),e.jsx(Ge,{className:"text-sm text-muted-foreground",children:Ee(Y.last_know)}),e.jsx(Ge,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(k,{variant:"default",size:"sm",onClick:()=>L(Y),children:[e.jsx(ta,{className:"h-4 w-4 mr-1"}),"详情"]}),e.jsxs(k,{variant:"default",size:"sm",onClick:()=>$(Y),children:[e.jsx($n,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsxs(k,{size:"sm",onClick:()=>D(Y),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(ns,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},Y.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(Y=>e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Js,{checked:me.has(Y.person_id),onCheckedChange:()=>Se(Y.person_id),className:"mt-1"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:B("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium mb-2",Y.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:Y.is_known?"已认识":"未认识"}),e.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",children:Y.person_name||e.jsx("span",{className:"text-muted-foreground",children:"未命名"})}),Y.nickname&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-1 w-full break-all",children:["昵称: ",Y.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:Y.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:Y.user_id,children:Y.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(Y.last_know)})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>L(Y),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(ta,{className:"h-3 w-3 mr-1"}),"查看"]}),e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>$(Y),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx($n,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>D(Y),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"}),"删除"]})]})]},Y.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(k,{variant:"outline",size:"sm",onClick:()=>f(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(Ir,{className:"h-4 w-4"})}),e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>f(h-1),disabled:h===1,children:[e.jsx(ll,{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(re,{type:"number",value:ge,onChange:Y=>be(Y.target.value),onKeyDown:Y=>Y.key==="Enter"&&he(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(u/p)}),e.jsx(k,{variant:"outline",size:"sm",onClick:he,disabled:!ge,className:"h-8",children:"跳转"})]}),e.jsxs(k,{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(ha,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(k,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(u/p)),disabled:h>=Math.ceil(u/p),className:"hidden sm:flex",children:e.jsx(Hr,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(A4,{person:A,open:I,onOpenChange:E}),e.jsx(z4,{person:A,open:C,onOpenChange:M,onSuccess:()=>{q(),U(),M(!1)}}),e.jsx(js,{open:!!F,onOpenChange:()=>D(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(js,{open:Ne,onOpenChange:le,children:e.jsxs(ds,{children:[e.jsxs(us,{children:[e.jsx(xs,{children:"确认批量删除"}),e.jsxs(hs,{children:["确定要删除选中的 ",me.size," 个人物信息吗? 此操作不可撤销。"]})]}),e.jsxs(ms,{children:[e.jsx(ps,{children:"取消"}),e.jsx(fs,{onClick:X,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})})]})}function A4({person:l,open:n,onOpenChange:i}){if(!l)return null;const c=u=>u?new Date(u*1e3).toLocaleString("zh-CN"):"-";return e.jsx(Fs,{open:n,onOpenChange:i,children:e.jsxs(Bs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs($s,{children:[e.jsx(Is,{children:"人物详情"}),e.jsxs(tt,{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(_l,{icon:Rn,label:"人物名称",value:l.person_name}),e.jsx(_l,{icon:on,label:"昵称",value:l.nickname}),e.jsx(_l,{icon:Ur,label:"用户ID",value:l.user_id,mono:!0}),e.jsx(_l,{icon:Ur,label:"人物ID",value:l.person_id,mono:!0}),e.jsx(_l,{label:"平台",value:l.platform}),e.jsx(_l,{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(_l,{icon:kl,label:"认识时间",value:c(l.know_times)}),e.jsx(_l,{icon:kl,label:"首次记录",value:c(l.know_since)}),e.jsx(_l,{icon:kl,label:"最后更新",value:c(l.last_know)})]})]}),e.jsx(ot,{children:e.jsx(k,{onClick:()=>i(!1),children:"关闭"})})]})})}function _l({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:B("text-sm",c&&"font-mono",!i&&"text-muted-foreground"),children:i||"-"})]})}function z4({person:l,open:n,onOpenChange:i,onSuccess:c}){const[u,x]=m.useState({}),[h,f]=m.useState(!1),{toast:p}=Zs();m.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(Fs,{open:n,onOpenChange:i,children:e.jsxs(Bs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs($s,{children:[e.jsx(Is,{children:"编辑人物信息"}),e.jsxs(tt,{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(re,{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(re,{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(et,{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(Fe,{id:"is_known",checked:u.is_known,onCheckedChange:N=>x({...u,is_known:N})})]})]}),e.jsxs(ot,{children:[e.jsx(k,{variant:"outline",onClick:()=>i(!1),children:"取消"}),e.jsx(k,{onClick:g,disabled:h,children:h?"保存中...":"保存"})]})]})}):null}var D4=w1();const Ng=m0(D4),Jm="/api/webui";async function O4(l=100,n="all"){const i=`${Jm}/knowledge/graph?limit=${l}&node_type=${n}`,c=await fetch(i);if(!c.ok)throw new Error(`获取知识图谱失败: ${c.status}`);return c.json()}async function R4(){const l=await fetch(`${Jm}/knowledge/stats`);if(!l.ok)throw new Error("获取知识图谱统计信息失败");return l.json()}async function L4(l){const n=await fetch(`${Jm}/knowledge/search?query=${encodeURIComponent(l)}`);if(!n.ok)throw new Error("搜索知识节点失败");return n.json()}const gv=m.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(Do,{type:"target",position:Oo.Top}),e.jsx("div",{className:"font-semibold text-white text-sm truncate max-w-[200px]",title:l.content,children:l.label}),e.jsx(Do,{type:"source",position:Oo.Bottom})]}));gv.displayName="EntityNode";const jv=m.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(Do,{type:"target",position:Oo.Top}),e.jsx("div",{className:"font-medium text-white text-xs truncate max-w-[150px]",title:l.content,children:l.label}),e.jsx(Do,{type:"source",position:Oo.Bottom})]}));jv.displayName="ParagraphNode";const U4={entity:gv,paragraph:jv};function B4(l,n){const i=new Ng.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)}),Ng.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 $4(){const l=la(),[n,i]=m.useState(!1),[c,u]=m.useState(null),[x,h]=m.useState(""),[f,p]=m.useState("all"),[g,N]=m.useState(50),[v,y]=m.useState("50"),[w,b]=m.useState(!1),[O,A]=m.useState(!0),[_,I]=m.useState(!1),[E,C]=m.useState(!1),[M,F,D]=_1([]),[se,G,me]=S1([]),[ce,Ne]=m.useState(0),[le,ge]=m.useState(null),[be,z]=m.useState(null),{toast:q}=Zs(),U=m.useCallback(X=>X.type==="entity"?"#6366f1":X.type==="paragraph"?"#10b981":"#6b7280",[]),L=m.useCallback(async(X=!1)=>{try{if(!X&&g>200){C(!0);return}i(!0);const[he,Ee]=await Promise.all([O4(g,f),R4()]);if(u(Ee),he.nodes.length===0){q({title:"提示",description:"知识库为空,请先导入知识数据"}),F([]),G([]);return}const{nodes:Y,edges:ie}=B4(he.nodes,he.edges);F(Y),G(ie),Ne(Y.length),Ee&&Ee.total_nodes>g&&q({title:"提示",description:`知识图谱包含 ${Ee.total_nodes} 个节点,当前显示 ${Y.length} 个`}),q({title:"加载成功",description:`已加载 ${Y.length} 个节点,${ie.length} 条边`})}catch(he){console.error("加载知识图谱失败:",he),q({title:"加载失败",description:he instanceof Error?he.message:"未知错误",variant:"destructive"})}finally{i(!1)}},[g,f,q]),$=m.useCallback(async()=>{if(!x.trim()){q({title:"提示",description:"请输入搜索关键词"});return}try{const X=await L4(x);if(X.length===0){q({title:"未找到",description:"没有找到匹配的节点"});return}const he=new Set(X.map(Ee=>Ee.id));F(Ee=>Ee.map(Y=>({...Y,style:{...Y.style,opacity:he.has(Y.id)?1:.3,filter:he.has(Y.id)?"brightness(1.2)":"brightness(0.8)"}}))),q({title:"搜索完成",description:`找到 ${X.length} 个匹配节点`})}catch(X){console.error("搜索失败:",X),q({title:"搜索失败",description:X instanceof Error?X.message:"未知错误",variant:"destructive"})}},[x,q]),_e=m.useCallback(()=>{F(X=>X.map(he=>({...he,style:{...he.style,opacity:1,filter:"brightness(1)"}})))},[]),pe=m.useCallback(()=>{A(!1),I(!0),L()},[L]),Se=m.useCallback(()=>{C(!1),setTimeout(()=>{L(!0)},0)},[L]),Q=m.useCallback((X,he)=>{M.find(Y=>Y.id===he.id)&&ge({id:he.id,type:he.type,content:he.data.content})},[M]);m.useEffect(()=>{O||_&&L()},[g,f,O,_]);const ye=m.useCallback((X,he)=>{const Ee=M.find(Ie=>Ie.id===he.source),Y=M.find(Ie=>Ie.id===he.target),ie=se.find(Ie=>Ie.id===he.id);Ee&&Y&&ie&&z({source:{id:Ee.id,type:Ee.type,content:Ee.data.content},target:{id:Y.id,type:Y.type,content:Y.data.content},edge:{source:he.source,target:he.target,weight:parseFloat(he.label||"0")}})},[M,se]);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(Ae,{variant:"outline",className:"gap-1",children:[e.jsx(Rr,{className:"h-3 w-3"}),"节点: ",c.total_nodes]}),e.jsxs(Ae,{variant:"outline",className:"gap-1",children:[e.jsx(Sj,{className:"h-3 w-3"}),"边: ",c.total_edges]}),e.jsxs(Ae,{variant:"outline",className:"gap-1",children:[e.jsx(Kt,{className:"h-3 w-3"}),"实体: ",c.entity_nodes]}),e.jsxs(Ae,{variant:"outline",className:"gap-1",children:[e.jsx(qa,{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(re,{placeholder:"搜索节点内容...",value:x,onChange:X=>h(X.target.value),onKeyDown:X=>X.key==="Enter"&&$(),className:"flex-1"}),e.jsx(k,{onClick:$,size:"sm",children:e.jsx(Qt,{className:"h-4 w-4"})}),e.jsx(k,{onClick:_e,variant:"outline",size:"sm",children:"重置"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(Be,{value:f,onValueChange:X=>p(X),children:[e.jsx(Le,{className:"w-[120px]",children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"all",children:"全部节点"}),e.jsx(ee,{value:"entity",children:"仅实体"}),e.jsx(ee,{value:"paragraph",children:"仅段落"})]})]}),e.jsxs(Be,{value:g===1e4?"all":w?"custom":g.toString(),onValueChange:X=>{X==="custom"?(b(!0),y(g.toString())):X==="all"?(b(!1),N(1e4)):(b(!1),N(Number(X)))},children:[e.jsx(Le,{className:"w-[120px]",children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"50",children:"50 节点"}),e.jsx(ee,{value:"100",children:"100 节点"}),e.jsx(ee,{value:"200",children:"200 节点"}),e.jsx(ee,{value:"500",children:"500 节点"}),e.jsx(ee,{value:"1000",children:"1000 节点"}),e.jsx(ee,{value:"all",children:"全部 (最多10000)"}),e.jsx(ee,{value:"custom",children:"自定义..."})]})]}),w&&e.jsx(re,{type:"number",min:"50",value:v,onChange:X=>y(X.target.value),onBlur:()=>{const X=parseInt(v);!isNaN(X)&&X>=50?N(X):(y("50"),N(50))},onKeyDown:X=>{if(X.key==="Enter"){const he=parseInt(v);!isNaN(he)&&he>=50?N(he):(y("50"),N(50))}},placeholder:"最少50个",className:"w-[120px]"}),e.jsx(k,{onClick:()=>L(),variant:"outline",size:"sm",disabled:n,children:e.jsx(_t,{className:B("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(_t,{className:"h-8 w-8 animate-spin mx-auto mb-2 text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground",children:"加载知识图谱中..."})]})}):M.length===0?e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(Rr,{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:M,edges:se,onNodesChange:D,onEdgesChange:me,onNodeClick:Q,onEdgeClick:ye,nodeTypes:U4,fitView:!0,minZoom:.05,maxZoom:1.5,defaultViewport:{x:0,y:0,zoom:.5},elevateNodesOnSelect:ce<=500,nodesDraggable:ce<=1e3,attributionPosition:"bottom-left",children:[e.jsx(C1,{variant:T1.Dots,gap:12,size:1}),e.jsx(E1,{}),ce<=500&&e.jsx(M1,{nodeColor:U,nodeBorderRadius:8,pannable:!0,zoomable:!0}),e.jsxs(A1,{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:"段落节点"})]}),ce>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:"已禁用动画"}),ce>500&&e.jsx("div",{children:"已禁用缩略图"})]})]})]})]})}),e.jsx(Fs,{open:!!le,onOpenChange:X=>!X&&ge(null),children:e.jsxs(Bs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsx($s,{children:e.jsx(Is,{children:"节点详情"})}),le&&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(Ae,{variant:le.type==="entity"?"default":"secondary",children:le.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:le.id})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"内容"}),e.jsx(ss,{className:"mt-1 h-40 p-3 bg-muted rounded",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:le.content})})]})]})]})}),e.jsx(Fs,{open:!!be,onOpenChange:X=>!X&&z(null),children:e.jsxs(Bs,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[e.jsx($s,{children:e.jsx(Is,{children:"边详情"})}),be&&e.jsx(ss,{className:"flex-1 pr-4",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0 p-3 bg-blue-50 dark:bg-blue-950 rounded border-2 border-blue-200 dark:border-blue-800",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"源节点"}),e.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:be.source.content}),e.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[be.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:be.target.content}),e.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[be.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(Ae,{variant:"outline",className:"text-base font-mono",children:be.edge.weight.toFixed(4)})})]})]})})]})}),e.jsx(js,{open:O,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(js,{open:E,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),b(!1))},children:"取消"}),e.jsx(fs,{onClick:Se,className:"bg-orange-600 hover:bg-orange-700",children:"我了解风险,继续加载"})]})]})})]})}function I4(){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(De,{children:[e.jsxs(Xe,{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(Rr,{className:"h-10 w-10 text-primary"})}),e.jsx(es,{className:"text-2xl",children:"麦麦知识库管理"}),e.jsx(Gs,{className:"text-base",children:"功能开发中,敬请期待"})]}),e.jsx(Ke,{className:"text-center text-sm text-muted-foreground",children:e.jsx("p",{children:"此功能将提供知识库的创建、编辑、导入和管理能力"})})]})})})]})}function bg({className:l,classNames:n,showOutsideDays:i=!0,captionLayout:c="label",buttonVariant:u="ghost",formatters:x,components:h,...f}){const p=Pj();return e.jsx(p1,{showOutsideDays:i,className:B("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:B("w-fit",p.root),months:B("relative flex flex-col gap-4 md:flex-row",p.months),month:B("flex w-full flex-col gap-4",p.month),nav:B("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",p.nav),button_previous:B(Br({variant:u}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",p.button_previous),button_next:B(Br({variant:u}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",p.button_next),month_caption:B("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",p.month_caption),dropdowns:B("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",p.dropdowns),dropdown_root:B("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:B("bg-popover absolute inset-0 opacity-0",p.dropdown),caption_label:B("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:B("flex",p.weekdays),weekday:B("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",p.weekday),week:B("mt-2 flex w-full",p.week),week_number_header:B("w-[--cell-size] select-none",p.week_number_header),week_number:B("text-muted-foreground select-none text-[0.8rem]",p.week_number),day:B("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:B("bg-accent rounded-l-md",p.range_start),range_middle:B("rounded-none",p.range_middle),range_end:B("bg-accent rounded-r-md",p.range_end),today:B("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",p.today),outside:B("text-muted-foreground aria-selected:text-muted-foreground",p.outside),disabled:B("text-muted-foreground opacity-50",p.disabled),hidden:B("invisible",p.hidden),...n},components:{Root:({className:g,rootRef:N,...v})=>e.jsx("div",{"data-slot":"calendar",ref:N,className:B(g),...v}),Chevron:({className:g,orientation:N,...v})=>N==="left"?e.jsx(ll,{className:B("size-4",g),...v}):N==="right"?e.jsx(ha,{className:B("size-4",g),...v}):e.jsx(Sa,{className:B("size-4",g),...v}),DayButton:H4,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 H4({className:l,day:n,modifiers:i,...c}){const u=Pj(),x=m.useRef(null);return m.useEffect(()=>{i.focused&&x.current?.focus()},[i.focused]),e.jsx(k,{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:B("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 wo={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 P4(){const[l,n]=m.useState([]),[i,c]=m.useState(""),[u,x]=m.useState("all"),[h,f]=m.useState("all"),[p,g]=m.useState(void 0),[N,v]=m.useState(void 0),[y,w]=m.useState(!0),[b,O]=m.useState(!1),[A,_]=m.useState("xs"),[I,E]=m.useState(4),[C,M]=m.useState(!1),F=m.useRef(null);m.useEffect(()=>{const $=zn.getAllLogs();n($);const _e=zn.onLog(()=>{n(zn.getAllLogs())}),pe=zn.onConnectionChange(Se=>{O(Se)});return()=>{_e(),pe()}},[]);const D=m.useMemo(()=>{const $=new Set(l.map(_e=>_e.module).filter(_e=>_e&&_e.trim()!==""));return Array.from($).sort()},[l]),se=$=>{switch($){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"}},G=$=>{switch($){case"DEBUG":return"bg-gray-800/30 dark:bg-gray-800/50";case"INFO":return"bg-blue-900/20 dark:bg-blue-500/20";case"WARNING":return"bg-yellow-900/20 dark:bg-yellow-500/20";case"ERROR":return"bg-red-900/20 dark:bg-red-500/20";case"CRITICAL":return"bg-red-900/30 dark:bg-red-600/30";default:return"bg-gray-800/20 dark:bg-gray-800/30"}},me=()=>{window.location.reload()},ce=()=>{zn.clearLogs(),n([])},Ne=()=>{const $=be.map(Q=>`${Q.timestamp} [${Q.level.padEnd(8)}] [${Q.module}] ${Q.message}`).join(` +`),_e=new Blob([$],{type:"text/plain;charset=utf-8"}),pe=URL.createObjectURL(_e),Se=document.createElement("a");Se.href=pe,Se.download=`logs-${dm(new Date,"yyyy-MM-dd-HHmmss")}.txt`,Se.click(),URL.revokeObjectURL(pe)},le=()=>{w(!y)},ge=()=>{g(void 0),v(void 0)},be=m.useMemo(()=>l.filter($=>{const _e=i===""||$.message.toLowerCase().includes(i.toLowerCase())||$.module.toLowerCase().includes(i.toLowerCase()),pe=u==="all"||$.level===u,Se=h==="all"||$.module===h;let Q=!0;if(p||N){const ye=new Date($.timestamp);if(p){const X=new Date(p);X.setHours(0,0,0,0),Q=Q&&ye>=X}if(N){const X=new Date(N);X.setHours(23,59,59,999),Q=Q&&ye<=X}}return _e&&pe&&Se&&Q}),[l,i,u,h,p,N]),z=wo[A].rowHeight+I,q=a0({count:be.length,getScrollElement:()=>F.current,estimateSize:()=>z,overscan:50}),U=m.useRef(!1),L=m.useRef(be.length);return m.useEffect(()=>{const $=F.current;if(!$)return;const _e=()=>{if(U.current)return;const{scrollTop:pe,scrollHeight:Se,clientHeight:Q}=$,ye=Se-pe-Q;ye>100&&y?w(!1):ye<50&&!y&&w(!0)};return $.addEventListener("scroll",_e,{passive:!0}),()=>$.removeEventListener("scroll",_e)},[y]),m.useEffect(()=>{const $=be.length>L.current;L.current=be.length,y&&be.length>0&&$&&(U.current=!0,q.scrollToIndex(be.length-1,{align:"end",behavior:"auto"}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{U.current=!1})}))},[be.length,y,q]),e.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex-shrink-0 space-y-2 sm:space-y-3 p-2 sm:p-3 lg:p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg sm:text-xl lg:text-2xl font-bold",children:"日志查看器"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 hidden sm:block",children:"实时查看和分析麦麦运行日志"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:B("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(De,{className:"p-2 sm:p-3",children:e.jsx(Xi,{open:C,onOpenChange:M,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(Qt,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),e.jsx(re,{placeholder:"搜索日志...",value:i,onChange:$=>c($.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(k,{variant:y?"default":"outline",size:"sm",onClick:le,className:"h-8 px-2",title:y?"自动滚动":"已暂停",children:[y?e.jsx(qw,{className:"h-3.5 w-3.5"}):e.jsx(Vw,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"ml-1 text-xs hidden sm:inline",children:y?"滚动":"暂停"})]}),e.jsxs(k,{variant:"outline",size:"sm",onClick:ce,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(k,{variant:"outline",size:"sm",onClick:Ne,className:"h-8 px-2 hidden sm:flex",title:"导出日志",children:[e.jsx(Xt,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"ml-1 text-xs hidden lg:inline",children:"导出"})]}),e.jsx(Zi,{asChild:!0,children:e.jsxs(k,{variant:"outline",size:"sm",className:"h-8 px-2",title:C?"收起筛选":"展开筛选",children:[e.jsx(So,{className:"h-3.5 w-3.5"}),C?e.jsx(Lr,{className:"h-3.5 w-3.5 ml-1"}):e.jsx(Sa,{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:[be.length," / ",l.length]}),e.jsx("span",{className:"ml-1",children:"条日志"})]}),e.jsxs(Wi,{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-2",children:[e.jsxs(Be,{value:u,onValueChange:x,children:[e.jsxs(Le,{className:"w-full sm:flex-1 h-8 text-xs",children:[e.jsx(So,{className:"h-3.5 w-3.5 mr-1.5"}),e.jsx($e,{placeholder:"级别"})]}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"all",children:"全部级别"}),e.jsx(ee,{value:"DEBUG",children:"DEBUG"}),e.jsx(ee,{value:"INFO",children:"INFO"}),e.jsx(ee,{value:"WARNING",children:"WARNING"}),e.jsx(ee,{value:"ERROR",children:"ERROR"}),e.jsx(ee,{value:"CRITICAL",children:"CRITICAL"})]})]}),e.jsxs(Be,{value:h,onValueChange:f,children:[e.jsxs(Le,{className:"w-full sm:flex-1 h-8 text-xs",children:[e.jsx(So,{className:"h-3.5 w-3.5 mr-1.5"}),e.jsx($e,{placeholder:"模块"})]}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"all",children:"全部模块"}),D.map($=>e.jsx(ee,{value:$,children:$},$))]})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-2",children:[e.jsxs(tl,{children:[e.jsx(al,{asChild:!0,children:e.jsxs(k,{variant:"outline",size:"sm",className:B("w-full sm:flex-1 justify-start text-left font-normal h-8",!p&&"text-muted-foreground"),children:[e.jsx(Qp,{className:"mr-1.5 h-3.5 w-3.5"}),e.jsx("span",{className:"text-xs",children:p?dm(p,"PP",{locale:bo}):"开始日期"})]})}),e.jsx(Ka,{className:"w-auto p-0",align:"start",children:e.jsx(bg,{mode:"single",selected:p,onSelect:g,initialFocus:!0,locale:bo})})]}),e.jsxs(tl,{children:[e.jsx(al,{asChild:!0,children:e.jsxs(k,{variant:"outline",size:"sm",className:B("w-full sm:flex-1 justify-start text-left font-normal h-8",!N&&"text-muted-foreground"),children:[e.jsx(Qp,{className:"mr-1.5 h-3.5 w-3.5"}),e.jsx("span",{className:"text-xs",children:N?dm(N,"PP",{locale:bo}):"结束日期"})]})}),e.jsx(Ka,{className:"w-auto p-0",align:"start",children:e.jsx(bg,{mode:"single",selected:N,onSelect:v,initialFocus:!0,locale:bo})})]}),(p||N)&&e.jsxs(k,{variant:"outline",size:"sm",onClick:ge,className:"w-full sm:w-auto h-8",children:[e.jsx(_a,{className:"h-3.5 w-3.5 sm:mr-1"}),e.jsx("span",{className:"text-xs",children:"清除"})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3 pt-2 border-t border-border/50",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(Kw,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"字号"})]}),e.jsx("div",{className:"flex gap-1",children:Object.keys(wo).map($=>e.jsx(k,{variant:A===$?"default":"outline",size:"sm",onClick:()=>_($),className:"h-6 px-2 text-xs",children:wo[$].label},$))})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-1 max-w-[200px]",children:[e.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:"行距"}),e.jsx(wa,{value:[I],onValueChange:([$])=>E($),min:0,max:12,step:2,className:"flex-1"}),e.jsxs("span",{className:"text-xs text-muted-foreground w-7",children:[I,"px"]})]}),e.jsxs("div",{className:"flex gap-2 sm:hidden",children:[e.jsxs(k,{variant:"outline",size:"sm",onClick:me,className:"flex-1 h-8",children:[e.jsx(_t,{className:"h-3.5 w-3.5 mr-1"}),e.jsx("span",{className:"text-xs",children:"刷新"})]}),e.jsxs(k,{variant:"outline",size:"sm",onClick:Ne,className:"flex-1 h-8",children:[e.jsx(Xt,{className:"h-3.5 w-3.5 mr-1"}),e.jsx("span",{className:"text-xs",children:"导出"})]})]})]})]})]})})})]}),e.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(De,{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:B("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:B("p-2 sm:p-3 font-mono relative",wo[A].class),style:{height:`${q.getTotalSize()}px`},children:be.length===0?e.jsx("div",{className:"text-gray-500 dark:text-gray-600 text-center py-8 text-xs sm:text-sm",children:"暂无日志数据"}):q.getVirtualItems().map($=>{const _e=be[$.index];return e.jsxs("div",{"data-index":$.index,ref:q.measureElement,className:B("absolute top-0 left-0 w-full px-2 sm:px-3 rounded hover:bg-white/5 transition-colors",G(_e.level)),style:{transform:`translateY(${$.start}px)`,paddingTop:`${I/2}px`,paddingBottom:`${I/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:B("font-semibold text-[10px]",se(_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:B("flex-shrink-0 w-[65px] lg:w-[75px] font-semibold",se(_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})]})]},$.key)})})})})})]})}const G4="Mai-with-u",F4="plugin-repo",q4="main",V4="plugin_details.json";async function K4(){try{const l=await we("/api/webui/plugins/fetch-raw",{method:"POST",body:JSON.stringify({owner:G4,repo:F4,branch:q4,file_path:V4})});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 vv(){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 Nv(){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 bv(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 Q4(){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 Y4(l,n){const i=await Q4();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 Sl(){try{const l=await we("/api/webui/plugins/installed",{headers:Us()});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 nn(l,n){return n.some(i=>i.id===l)}function rn(l,n){const i=n.find(c=>c.id===l);if(i)return i.manifest?.version||i.version}async function yv(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 wv(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 _v(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 J4(l){const n=await we(`/api/webui/plugins/config/${l}/schema`,{headers:Us()});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 X4(l){const n=await we(`/api/webui/plugins/config/${l}`,{headers:Us()});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 Z4(l){const n=await we(`/api/webui/plugins/config/${l}/raw`,{headers:Us()});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 W4(l,n){const i=await we(`/api/webui/plugins/config/${l}`,{method:"PUT",headers:Us(),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,n){const i=await we(`/api/webui/plugins/config/${l}/raw`,{method:"PUT",headers:Us(),body:JSON.stringify({config:n})});if(!i.ok){const c=await i.json();throw new Error(c.detail||"保存配置失败")}return await i.json()}async function sk(l){const n=await we(`/api/webui/plugins/config/${l}/reset`,{method:"POST",headers:Us()});if(!n.ok){const i=await n.json();throw new Error(i.detail||"重置配置失败")}return await n.json()}async function tk(l){const n=await we(`/api/webui/plugins/config/${l}/toggle`,{method:"POST",headers:Us()});if(!n.ok){const i=await n.json();throw new Error(i.detail||"切换状态失败")}return await n.json()}const ac="https://maibot-plugin-stats.maibot-webui.workers.dev";async function Sv(l){try{const n=await fetch(`${ac}/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 ak(l,n){try{const i=n||Xm(),c=await fetch(`${ac}/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 lk(l,n){try{const i=n||Xm(),c=await fetch(`${ac}/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 nk(l,n,i,c){if(n<1||n>5)return{success:!1,error:"评分必须在 1-5 之间"};try{const u=c||Xm(),x=await fetch(`${ac}/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 kv(l){try{const n=await fetch(`${ac}/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 rk(){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 Z=V.map(async Te=>{try{const oe=await Sv(Te.id);return{id:Te.id,stats:oe}}catch(oe){return console.warn(`Failed to load stats for ${Te.id}:`,oe),{id:Te.id,stats:null}}}),Oe=await Promise.all(Z),ze={};Oe.forEach(({id:Te,stats:oe})=>{oe&&(ze[Te]=oe)}),G(ze)};m.useEffect(()=>{let V=null,Z=!1;return(async()=>{if(V=await Y4(ze=>{Z||(C(ze),ze.stage==="success"?setTimeout(()=>{Z||C(null)},2e3):ze.stage==="error"&&(b(!1),A(ze.error||"加载失败")))},ze=>{console.error("WebSocket error:",ze),Z||pe({title:"WebSocket 连接失败",description:"无法实时显示加载进度",variant:"destructive"})}),await new Promise(ze=>{if(!V){ze();return}const Te=()=>{V&&V.readyState===WebSocket.OPEN?(console.log("WebSocket connected, starting to load plugins"),ze()):V&&V.readyState===WebSocket.CLOSED?(console.warn("WebSocket closed before loading plugins"),ze()):setTimeout(Te,100)};Te()}),!Z){const ze=await vv();I(ze),ze.installed||pe({title:"Git 未安装",description:ze.error||"请先安装 Git 才能使用插件安装功能",variant:"destructive"})}if(!Z){const ze=await Nv();F(ze)}if(!Z)try{b(!0),A(null);const ze=await K4();if(!Z){const Te=await Sl();D(Te);const oe=ze.map(ke=>{const is=nn(ke.id,Te),Ot=rn(ke.id,Te);return{...ke,installed:is,installed_version:Ot}});for(const ke of Te)!oe.some(Ot=>Ot.id===ke.id)&&ke.manifest&&oe.push({id:ke.id,manifest:{manifest_version:ke.manifest.manifest_version||1,name:ke.manifest.name,version:ke.manifest.version,description:ke.manifest.description||"",author:ke.manifest.author,license:ke.manifest.license||"Unknown",host_application:ke.manifest.host_application,homepage_url:ke.manifest.homepage_url,repository_url:ke.manifest.repository_url,keywords:ke.manifest.keywords||[],categories:ke.manifest.categories||[],default_locale:ke.manifest.default_locale||"zh-CN",locales_path:ke.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!0,installed_version:ke.manifest.version,published_at:new Date().toISOString(),updated_at:new Date().toISOString()});y(oe),Se(oe)}}catch(ze){if(!Z){const Te=ze instanceof Error?ze.message:"加载插件列表失败";A(Te),pe({title:"加载失败",description:Te,variant:"destructive"})}}finally{Z||b(!1)}})(),()=>{Z=!0,V&&V.close()}},[pe]);const Q=V=>{if(!V.installed&&M&&!ye(V))return e.jsxs(Ae,{variant:"destructive",className:"gap-1",children:[e.jsx(St,{className:"h-3 w-3"}),"不兼容"]});if(V.installed){const Z=V.installed_version?.trim(),Oe=V.manifest.version?.trim();if(Z!==Oe){const ze=Z?.split(".").map(Number)||[0,0,0],Te=Oe?.split(".").map(Number)||[0,0,0];for(let oe=0;oe<3;oe++){if((Te[oe]||0)>(ze[oe]||0))return e.jsxs(Ae,{variant:"outline",className:"gap-1 text-orange-600 border-orange-600",children:[e.jsx(St,{className:"h-3 w-3"}),"可更新"]});if((Te[oe]||0)<(ze[oe]||0))break}}return e.jsxs(Ae,{variant:"default",className:"gap-1",children:[e.jsx(sa,{className:"h-3 w-3"}),"已安装"]})}return null},ye=V=>!M||!V.manifest?.host_application?!0:bv(V.manifest.host_application.min_version,V.manifest.host_application.max_version,M),X=V=>{if(!V.installed||!V.installed_version||!V.manifest?.version)return!1;const Z=V.installed_version.trim(),Oe=V.manifest.version.trim();if(Z===Oe)return!1;const ze=Z.split(".").map(Number),Te=Oe.split(".").map(Number);for(let oe=0;oe<3;oe++){if((Te[oe]||0)>(ze[oe]||0))return!0;if((Te[oe]||0)<(ze[oe]||0))return!1}return!1},he=v.filter(V=>{if(!V.manifest)return console.warn("[过滤] 跳过无 manifest 的插件:",V.id),!1;const Z=c===""||V.manifest.name?.toLowerCase().includes(c.toLowerCase())||V.manifest.description?.toLowerCase().includes(c.toLowerCase())||V.manifest.keywords&&V.manifest.keywords.some(oe=>oe.toLowerCase().includes(c.toLowerCase())),Oe=x==="all"||V.manifest.categories&&V.manifest.categories.includes(x);let ze=!0;f==="installed"?ze=V.installed===!0:f==="updates"&&(ze=V.installed===!0&&X(V));const Te=!g||!M||ye(V);return Z&&Oe&&ze&&Te}),Ee=V=>{if(!_?.installed){pe({title:"无法安装",description:"Git 未安装",variant:"destructive"});return}if(M&&!ye(V)){pe({title:"无法安装",description:"插件与当前麦麦版本不兼容",variant:"destructive"});return}le(V),be("main"),q(""),L("preset"),_e(!1),ce(!0)},Y=async()=>{if(!Ne)return;const V=U==="custom"?z:ge;if(!V||V.trim()===""){pe({title:"分支名称不能为空",variant:"destructive"});return}try{ce(!1),await yv(Ne.id,Ne.manifest.repository_url||"",V),kv(Ne.id).catch(Oe=>{console.warn("Failed to record download:",Oe)}),pe({title:"安装成功",description:`${Ne.manifest.name} 已成功安装`});const Z=await Sl();D(Z),y(Oe=>Oe.map(ze=>{if(ze.id===Ne.id){const Te=nn(ze.id,Z),oe=rn(ze.id,Z);return{...ze,installed:Te,installed_version:oe}}return ze}))}catch(Z){pe({title:"安装失败",description:Z instanceof Error?Z.message:"未知错误",variant:"destructive"})}finally{le(null)}},ie=async V=>{try{await wv(V.id),pe({title:"卸载成功",description:`${V.manifest.name} 已成功卸载`});const Z=await Sl();D(Z),y(Oe=>Oe.map(ze=>{if(ze.id===V.id){const Te=nn(ze.id,Z),oe=rn(ze.id,Z);return{...ze,installed:Te,installed_version:oe}}return ze}))}catch(Z){pe({title:"卸载失败",description:Z instanceof Error?Z.message:"未知错误",variant:"destructive"})}},Ie=async V=>{if(!_?.installed){pe({title:"无法更新",description:"Git 未安装",variant:"destructive"});return}try{const Z=await _v(V.id,V.manifest.repository_url||"","main");pe({title:"更新成功",description:`${V.manifest.name} 已从 ${Z.old_version} 更新到 ${Z.new_version}`});const Oe=await Sl();D(Oe),y(ze=>ze.map(Te=>{if(Te.id===V.id){const oe=nn(Te.id,Oe),ke=rn(Te.id,Oe);return{...Te,installed:oe,installed_version:ke}}return Te}))}catch(Z){pe({title:"更新失败",description:Z instanceof Error?Z.message:"未知错误",variant:"destructive"})}};return e.jsx(ss,{className:"h-full",children:e.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件市场"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"浏览和管理麦麦的插件"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(k,{variant:"outline",onClick:()=>n(),disabled:i,children:[e.jsx(kj,{className:`h-4 w-4 mr-2 ${i?"animate-spin":""}`}),"重启麦麦"]}),e.jsxs(k,{onClick:()=>l({to:"/plugin-mirrors"}),children:[e.jsx(Qw,{className:"h-4 w-4 mr-2"}),"配置镜像源"]})]})]}),e.jsx(De,{className:"border-blue-200 bg-blue-50 dark:bg-blue-950/20 dark:border-blue-900",children:e.jsx(Ke,{className:"py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Kt,{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:"重启麦麦"}),"才能使更改生效"]})]})})}),_&&!_.installed&&e.jsxs(De,{className:"border-orange-600 bg-orange-50 dark:bg-orange-950/20",children:[e.jsx(Xe,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Vt,{className:"h-5 w-5 text-orange-600"}),e.jsxs("div",{children:[e.jsx(es,{className:"text-lg text-orange-900 dark:text-orange-100",children:"Git 未安装"}),e.jsx(Gs,{className:"text-orange-800 dark:text-orange-200",children:_.error||"请先安装 Git 才能使用插件安装功能"})]})]})}),e.jsx(Ke,{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(De,{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(Qt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(re,{placeholder:"搜索插件...",value:c,onChange:V=>u(V.target.value),className:"pl-9"})]}),e.jsxs(Be,{value:x,onValueChange:h,children:[e.jsx(Le,{className:"w-full sm:w-[200px]",children:e.jsx($e,{placeholder:"选择分类"})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"all",children:"全部分类"}),e.jsx(ee,{value:"Group Management",children:"群组管理"}),e.jsx(ee,{value:"Entertainment & Interaction",children:"娱乐互动"}),e.jsx(ee,{value:"Utility Tools",children:"实用工具"}),e.jsx(ee,{value:"Content Generation",children:"内容生成"}),e.jsx(ee,{value:"Multimedia",children:"多媒体"}),e.jsx(ee,{value:"External Integration",children:"外部集成"}),e.jsx(ee,{value:"Data Analysis & Insights",children:"数据分析与洞察"}),e.jsx(ee,{value:"Other",children:"其他"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Js,{id:"compatible-only",checked:g,onCheckedChange:V=>N(V===!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(xa,{value:f,onValueChange:p,className:"w-full",children:e.jsxs(aa,{className:"grid w-full grid-cols-3",children:[e.jsxs(ls,{value:"all",children:["全部插件 (",v.filter(V=>{if(!V.manifest)return!1;const Z=c===""||V.manifest.name?.toLowerCase().includes(c.toLowerCase())||V.manifest.description?.toLowerCase().includes(c.toLowerCase())||V.manifest.keywords&&V.manifest.keywords.some(Te=>Te.toLowerCase().includes(c.toLowerCase())),Oe=x==="all"||V.manifest.categories&&V.manifest.categories.includes(x),ze=!g||!M||ye(V);return Z&&Oe&&ze}).length,")"]}),e.jsxs(ls,{value:"installed",children:["已安装 (",v.filter(V=>{if(!V.manifest)return!1;const Z=c===""||V.manifest.name?.toLowerCase().includes(c.toLowerCase())||V.manifest.description?.toLowerCase().includes(c.toLowerCase())||V.manifest.keywords&&V.manifest.keywords.some(Te=>Te.toLowerCase().includes(c.toLowerCase())),Oe=x==="all"||V.manifest.categories&&V.manifest.categories.includes(x),ze=!g||!M||ye(V);return V.installed&&Z&&Oe&&ze}).length,")"]}),e.jsxs(ls,{value:"updates",children:["可更新 (",v.filter(V=>{if(!V.manifest)return!1;const Z=c===""||V.manifest.name?.toLowerCase().includes(c.toLowerCase())||V.manifest.description?.toLowerCase().includes(c.toLowerCase())||V.manifest.keywords&&V.manifest.keywords.some(Te=>Te.toLowerCase().includes(c.toLowerCase())),Oe=x==="all"||V.manifest.categories&&V.manifest.categories.includes(x),ze=!g||!M||ye(V);return V.installed&&X(V)&&Z&&Oe&&ze}).length,")"]})]})}),E&&E.stage==="loading"&&E.operation==="fetch"&&e.jsx(De,{className:"p-4",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Os,{className:"h-4 w-4 animate-spin"}),e.jsx("span",{className:"text-sm font-medium",children:"加载插件列表"})]}),e.jsxs("span",{className:"text-sm font-medium",children:[E.progress,"%"]})]}),e.jsx(In,{value:E.progress,className:"h-2"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:E.message}),E.total_plugins>0&&e.jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["已加载 ",E.loaded_plugins," / ",E.total_plugins," 个插件"]})]})}),E&&E.stage==="error"&&E.error&&e.jsx(De,{className:"border-destructive bg-destructive/10",children:e.jsx(Xe,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Vt,{className:"h-5 w-5 text-destructive"}),e.jsxs("div",{children:[e.jsx(es,{className:"text-lg text-destructive",children:"加载失败"}),e.jsx(Gs,{className:"text-destructive/80",children:E.error})]})]})})}),w?e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(Os,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件列表中..."})]}):O?e.jsx(De,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Vt,{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:O}),e.jsx(k,{onClick:()=>window.location.reload(),children:"重新加载"})]})}):he.length===0?e.jsx(De,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Qt,{className:"h-12 w-12 text-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:he.map(V=>e.jsxs(De,{className:"flex flex-col hover:shadow-lg transition-shadow h-full",children:[e.jsxs(Xe,{children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx(es,{className:"text-xl",children:V.manifest?.name||V.id}),e.jsxs("div",{className:"flex flex-col gap-1",children:[V.manifest?.categories&&V.manifest.categories[0]&&e.jsx(Ae,{variant:"secondary",className:"text-xs whitespace-nowrap",children:ik[V.manifest.categories[0]]||V.manifest.categories[0]}),Q(V)]})]}),e.jsx(Gs,{className:"line-clamp-2",children:V.manifest?.description||"无描述"})]}),e.jsx(Ke,{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(Xt,{className:"h-4 w-4"}),e.jsx("span",{children:(se[V.id]?.downloads??V.downloads??0).toLocaleString()})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(an,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),e.jsx("span",{children:(se[V.id]?.rating??V.rating??0).toFixed(1)})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[V.manifest?.keywords&&V.manifest.keywords.slice(0,3).map(Z=>e.jsx(Ae,{variant:"outline",className:"text-xs",children:Z},Z)),V.manifest?.keywords&&V.manifest.keywords.length>3&&e.jsxs(Ae,{variant:"outline",className:"text-xs",children:["+",V.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",V.manifest?.version||"unknown"," · ",V.manifest?.author?.name||"Unknown"]}),V.manifest?.host_application&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{children:"支持:"}),e.jsxs("span",{className:"font-medium",children:[V.manifest.host_application.min_version,V.manifest.host_application.max_version?` - ${V.manifest.host_application.max_version}`:" - 最新版本"]})]})]})]})}),e.jsx(Go,{className:"pt-4",children:e.jsxs("div",{className:"flex items-center justify-end gap-2 w-full",children:[e.jsx(k,{variant:"outline",size:"sm",onClick:()=>l({to:"/plugin-detail",search:{pluginId:V.id}}),children:"查看详情"}),V.installed?X(V)?e.jsxs(k,{size:"sm",disabled:!_?.installed,title:_?.installed?void 0:"Git 未安装",onClick:()=>Ie(V),children:[e.jsx(_t,{className:"h-4 w-4 mr-1"}),"更新"]}):e.jsxs(k,{variant:"destructive",size:"sm",disabled:!_?.installed,title:_?.installed?void 0:"Git 未安装",onClick:()=>ie(V),children:[e.jsx(ns,{className:"h-4 w-4 mr-1"}),"卸载"]}):e.jsxs(k,{size:"sm",disabled:!_?.installed||E?.operation==="install"||M!==null&&!ye(V),title:_?.installed?M!==null&&!ye(V)?`不兼容当前版本 (需要 ${V.manifest?.host_application?.min_version||"未知"}${V.manifest?.host_application?.max_version?` - ${V.manifest.host_application.max_version}`:"+"},当前 ${M?.version})`:void 0:"Git 未安装",onClick:()=>Ee(V),children:[e.jsx(Xt,{className:"h-4 w-4 mr-1"}),E?.operation==="install"&&E?.plugin_id===V.id?"安装中...":"安装"]})]})}),E&&(E.stage==="loading"||E.stage==="success"||E.stage==="error")&&E.operation!=="fetch"&&E.plugin_id===V.id&&e.jsx("div",{className:"px-6 pb-4 -mt-2",children:e.jsxs("div",{className:`space-y-2 p-3 rounded-lg border ${E.stage==="success"?"bg-green-50 dark:bg-green-950/20 border-green-200 dark:border-green-900":E.stage==="error"?"bg-red-50 dark:bg-red-950/20 border-red-200 dark:border-red-900":"bg-muted/50"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[E.stage==="loading"?e.jsx(Os,{className:"h-3 w-3 animate-spin"}):E.stage==="success"?e.jsx(sa,{className:"h-3 w-3 text-green-600"}):e.jsx(St,{className:"h-3 w-3 text-red-600"}),e.jsx("span",{className:`text-xs font-medium ${E.stage==="success"?"text-green-700 dark:text-green-300":E.stage==="error"?"text-red-700 dark:text-red-300":""}`,children:E.stage==="loading"?e.jsxs(e.Fragment,{children:[E.operation==="install"&&"正在安装",E.operation==="uninstall"&&"正在卸载",E.operation==="update"&&"正在更新"]}):E.stage==="success"?e.jsxs(e.Fragment,{children:[E.operation==="install"&&"安装完成",E.operation==="uninstall"&&"卸载完成",E.operation==="update"&&"更新完成"]}):e.jsxs(e.Fragment,{children:[E.operation==="install"&&"安装失败",E.operation==="uninstall"&&"卸载失败",E.operation==="update"&&"更新失败"]})})]}),E.stage!=="error"&&e.jsxs("span",{className:`text-xs font-medium ${E.stage==="success"?"text-green-700 dark:text-green-300":""}`,children:[E.progress,"%"]})]}),E.stage!=="error"&&e.jsx(In,{value:E.progress,className:`h-1.5 ${E.stage==="success"?"[&>div]:bg-green-500":""}`}),e.jsx("div",{className:`text-xs ${E.stage==="success"?"text-green-600 dark:text-green-400 truncate":E.stage==="error"?"text-red-600 dark:text-red-400":"text-muted-foreground truncate"}`,children:E.stage==="error"?E.error||E.message||"操作失败":E.message})]})})]},V.id))}),e.jsx(Fs,{open:me,onOpenChange:ce,children:e.jsxs(Bs,{children:[e.jsxs($s,{children:[e.jsx(Is,{children:"安装插件"}),e.jsxs(tt,{children:["安装 ",Ne?.manifest.name]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["版本: ",Ne?.manifest.version]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["作者: ",typeof Ne?.manifest.author=="string"?Ne.manifest.author:Ne?.manifest.author?.name]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Js,{id:"advanced-options",checked:$,onCheckedChange:V=>_e(V)}),e.jsx("label",{htmlFor:"advanced-options",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"高级选项"})]}),$&&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(xa,{value:U,onValueChange:V=>L(V),children:[e.jsxs(aa,{className:"grid w-full grid-cols-2",children:[e.jsx(ls,{value:"preset",className:"text-xs",children:"预设分支"}),e.jsx(ls,{value:"custom",className:"text-xs",children:"自定义分支"})]}),U==="preset"&&e.jsx("div",{className:"mt-3",children:e.jsxs(Be,{value:ge,onValueChange:be,children:[e.jsx(Le,{children:e.jsx($e,{placeholder:"选择分支"})}),e.jsxs(Ue,{children:[e.jsx(ee,{value:"main",children:"main (默认)"}),e.jsx(ee,{value:"master",children:"master"}),e.jsx(ee,{value:"dev",children:"dev (开发版)"}),e.jsx(ee,{value:"develop",children:"develop"}),e.jsx(ee,{value:"beta",children:"beta (测试版)"}),e.jsx(ee,{value:"stable",children:"stable (稳定版)"})]})]})}),U==="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:V=>q(V.target.value)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"输入 Git 分支名称、标签或提交哈希"})]})]})]})}),!$&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"将从默认分支 (main) 安装插件"})]}),e.jsxs(ot,{children:[e.jsx(k,{variant:"outline",onClick:()=>ce(!1),children:"取消"}),e.jsxs(k,{onClick:Y,children:[e.jsx(Xt,{className:"h-4 w-4 mr-2"}),"安装"]})]})]})}),e.jsx(Gn,{})]})})}function dk(){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(Cj,{className:"h-8 w-8",strokeWidth:2}),"模型分配预设市场"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"浏览和下载社区共享的模型分配预设配置"})]})})}),e.jsx(ss,{className:"flex-1",children:e.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-12rem)]",children:e.jsxs(De,{className:"max-w-2xl w-full border-dashed",children:[e.jsxs(Xe,{className:"text-center",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx(ea,{className:"h-16 w-16 text-muted-foreground"})}),e.jsx(es,{className:"text-2xl",children:"功能开发中"}),e.jsx(Gs,{className:"text-base",children:"模型分配预设市场功能正在开发中,敬请期待!"})]}),e.jsx(Ke,{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 uk({field:l,value:n,onChange:i}){const[c,u]=m.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(Fe,{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(re,{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(wa,{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(Be,{value:String(n??l.default),onValueChange:i,disabled:l.disabled,children:[e.jsx(Le,{children:e.jsx($e,{placeholder:l.placeholder??"请选择"})}),e.jsx(Ue,{children:l.choices?.map(x=>e.jsx(ee,{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(et,{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(re,{type:c?"text":"password",value:n??"",onChange:x=>i(x.target.value),placeholder:l.placeholder,disabled:l.disabled,className:"pr-10"}),e.jsx(k,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3",onClick:()=>u(!c),children:c?e.jsx(Vi,{className:"h-4 w-4"}):e.jsx(ta,{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(g_,{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(re,{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 yg({section:l,config:n,onChange:i}){const[c,u]=m.useState(!l.collapsed),x=Object.entries(l.fields).filter(([,h])=>!h.hidden).sort(([,h],[,f])=>h.order-f.order);return e.jsx(Xi,{open:c,onOpenChange:u,children:e.jsxs(De,{children:[e.jsx(Zi,{asChild:!0,children:e.jsxs(Xe,{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(Sa,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(ha,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(es,{className:"text-lg",children:l.title})]}),e.jsxs(Ae,{variant:"secondary",className:"text-xs",children:[x.length," 项"]})]}),l.description&&e.jsx(Gs,{className:"ml-6",children:l.description})]})}),e.jsx(Wi,{children:e.jsx(Ke,{className:"space-y-4 pt-0",children:x.map(([h,f])=>e.jsx(uk,{field:f,value:n[l.name]?.[h],onChange:p=>i(l.name,h,p),sectionName:l.name},h))})})]})})}function mk({plugin:l,onBack:n}){const{toast:i}=Zs(),{triggerRestart:c,isRestarting:u}=un(),[x,h]=m.useState("visual"),[f,p]=m.useState(null),[g,N]=m.useState({}),[v,y]=m.useState({}),[w,b]=m.useState(""),[O,A]=m.useState(""),[_,I]=m.useState(!0),[E,C]=m.useState(!1),[M,F]=m.useState(!1),[D,se]=m.useState(!1),[G,me]=m.useState(!1),ce=m.useCallback(async()=>{I(!0);try{const[U,L,$]=await Promise.all([J4(l.id),X4(l.id),Z4(l.id)]);p(U),N(L),y(JSON.parse(JSON.stringify(L))),b($),A($)}catch(U){i({title:"加载配置失败",description:U instanceof Error?U.message:"未知错误",variant:"destructive"})}finally{I(!1)}},[l.id,i]);m.useEffect(()=>{ce()},[ce]),m.useEffect(()=>{F(x==="visual"?JSON.stringify(g)!==JSON.stringify(v):w!==O)},[g,v,w,O,x]);const Ne=(U,L,$)=>{N(_e=>({..._e,[U]:{..._e[U]||{},[L]:$}}))},le=async()=>{C(!0);try{if(x==="source"){try{hv(w)}catch(U){se(!0),i({title:"TOML 格式错误",description:U instanceof Error?U.message:"无法解析 TOML 配置,请检查语法",variant:"destructive"}),C(!1);return}await ek(l.id,w),A(w),se(!1)}else await W4(l.id,g),y(JSON.parse(JSON.stringify(g)));i({title:"配置已保存",description:"更改将在插件重新加载后生效"})}catch(U){i({title:"保存失败",description:U instanceof Error?U.message:"未知错误",variant:"destructive"})}finally{C(!1)}},ge=async()=>{try{await sk(l.id),i({title:"配置已重置",description:"下次加载插件时将使用默认配置"}),me(!1),ce()}catch(U){i({title:"重置失败",description:U instanceof Error?U.message:"未知错误",variant:"destructive"})}},be=async()=>{try{const U=await tk(l.id);i({title:U.message,description:U.note}),ce()}catch(U){i({title:"切换状态失败",description:U instanceof Error?U.message:"未知错误",variant:"destructive"})}};if(_)return e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx(Os,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(!f)return e.jsxs("div",{className:"flex flex-col items-center justify-center h-64 space-y-4",children:[e.jsx(St,{className:"h-12 w-12 text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground",children:"无法加载配置"}),e.jsxs(k,{onClick:n,variant:"outline",children:[e.jsx(Va,{className:"h-4 w-4 mr-2"}),"返回"]})]});const z=Object.values(f.sections).sort((U,L)=>U.order-L.order),q=g.plugin?.enabled!==!1;return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(k,{variant:"ghost",size:"icon",onClick:n,children:e.jsx(Va,{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(Ae,{variant:q?"default":"secondary",children:q?"已启用":"已禁用"}),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(k,{variant:"outline",size:"sm",onClick:()=>h(x==="visual"?"source":"visual"),children:x==="visual"?e.jsxs(e.Fragment,{children:[e.jsx(yj,{className:"h-4 w-4 mr-2"}),"源代码"]}):e.jsxs(e.Fragment,{children:[e.jsx(bj,{className:"h-4 w-4 mr-2"}),"可视化"]})}),e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>c(),disabled:u,children:[e.jsx(kj,{className:`h-4 w-4 mr-2 ${u?"animate-spin":""}`}),"重启麦麦"]}),e.jsxs(k,{variant:"outline",size:"sm",onClick:be,children:[e.jsx(ec,{className:"h-4 w-4 mr-2"}),q?"禁用":"启用"]}),e.jsxs(k,{variant:"outline",size:"sm",onClick:()=>me(!0),children:[e.jsx(qi,{className:"h-4 w-4 mr-2"}),"重置"]}),e.jsxs(k,{size:"sm",onClick:le,disabled:!M||E,children:[E?e.jsx(Os,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(sc,{className:"h-4 w-4 mr-2"}),"保存"]})]})]}),M&&e.jsx(De,{className:"border-orange-200 bg-orange-50 dark:bg-orange-950/20 dark:border-orange-900",children:e.jsx(Ke,{className:"py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Kt,{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(rt,{children:[e.jsx(St,{className:"h-4 w-4"}),e.jsxs(it,{children:[e.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。保存时会验证格式,只有格式正确才能保存。",D&&e.jsx("span",{className:"text-destructive font-semibold ml-2",children:"⚠️ 上次保存失败,请检查 TOML 格式"})]})]}),e.jsx(av,{value:w,onChange:U=>{b(U),D&&se(!1)},language:"toml",theme:"dark",height:"calc(100vh - 350px)",minHeight:"500px",placeholder:"TOML 配置内容"})]}),x==="visual"&&e.jsxs(e.Fragment,{children:[e.jsxs(rt,{children:[e.jsx(Kt,{className:"h-4 w-4"}),e.jsxs(it,{children:[e.jsx("strong",{children:"提示:"}),"如果插件当前未加载或未启用,WebUI 适配器的高级插件可视化编辑功能可能会不可用。 请确保插件已启用并成功加载后,再进行配置编辑。"]})]}),f.layout.type==="tabs"&&f.layout.tabs.length>0?e.jsxs(xa,{defaultValue:f.layout.tabs[0]?.id,children:[e.jsx(aa,{children:f.layout.tabs.map(U=>e.jsxs(ls,{value:U.id,children:[U.title,U.badge&&e.jsx(Ae,{variant:"secondary",className:"ml-2 text-xs",children:U.badge})]},U.id))}),f.layout.tabs.map(U=>e.jsx(ws,{value:U.id,className:"space-y-4 mt-4",children:U.sections.map(L=>{const $=f.sections[L];return $?e.jsx(yg,{section:$,config:g,onChange:Ne},L):null})},U.id))]}):e.jsx("div",{className:"space-y-4",children:z.map(U=>e.jsx(yg,{section:U,config:g,onChange:Ne},U.name))})]}),e.jsx(Fs,{open:G,onOpenChange:me,children:e.jsxs(Bs,{children:[e.jsxs($s,{children:[e.jsx(Is,{children:"确认重置配置"}),e.jsx(tt,{children:"这将删除当前配置文件,下次加载插件时将使用默认配置。此操作不可撤销。"})]}),e.jsxs(ot,{children:[e.jsx(k,{variant:"outline",onClick:()=>me(!1),children:"取消"}),e.jsx(k,{variant:"destructive",onClick:ge,children:"确认重置"})]})]})})]})}function xk(){return e.jsx(Pn,{children:e.jsx(hk,{})})}function hk(){const{toast:l}=Zs(),[n,i]=m.useState([]),[c,u]=m.useState(!0),[x,h]=m.useState(""),[f,p]=m.useState(null),g=async()=>{u(!0);try{const b=await Sl();i(b)}catch(b){l({title:"加载插件列表失败",description:b instanceof Error?b.message:"未知错误",variant:"destructive"})}finally{u(!1)}};m.useEffect(()=>{g()},[]);const v=n.filter(b=>{const O=x.toLowerCase();return b.id.toLowerCase().includes(O)||b.manifest.name.toLowerCase().includes(O)||b.manifest.description?.toLowerCase().includes(O)}).filter((b,O,A)=>O===A.findIndex(_=>_.id===b.id)),y=n.length,w=0;return f?e.jsxs(e.Fragment,{children:[e.jsx(ss,{className:"h-full",children:e.jsx("div",{className:"p-4 sm:p-6",children:e.jsx(mk,{plugin:f,onBack:()=>p(null)})})}),e.jsx(Gn,{})]}):e.jsx(ss,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件配置"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理和配置已安装的插件"})]}),e.jsxs(k,{variant:"outline",size:"sm",onClick:g,children:[e.jsx(_t,{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(De,{children:[e.jsxs(Xe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(es,{className:"text-sm font-medium",children:"已安装插件"}),e.jsx(ea,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Ke,{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(De,{children:[e.jsxs(Xe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(es,{className:"text-sm font-medium",children:"已启用"}),e.jsx(sa,{className:"h-4 w-4 text-green-600"})]}),e.jsxs(Ke,{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(De,{children:[e.jsxs(Xe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(es,{className:"text-sm font-medium",children:"已禁用"}),e.jsx(St,{className:"h-4 w-4 text-orange-600"})]}),e.jsxs(Ke,{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(Qt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(re,{placeholder:"搜索插件...",value:x,onChange:b=>h(b.target.value),className:"pl-9"})]}),e.jsxs(De,{children:[e.jsxs(Xe,{children:[e.jsx(es,{children:"已安装的插件"}),e.jsx(Gs,{children:"点击插件查看和编辑配置"})]}),e.jsx(Ke,{children:c?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(Os,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):v.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-4",children:[e.jsx(ea,{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(ea,{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(Ae,{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(k,{variant:"ghost",size:"sm",children:e.jsx(dn,{className:"h-4 w-4"})}),e.jsx(ha,{className:"h-4 w-4 text-muted-foreground"})]})]},b.id))})})]})]})})}function fk(){const l=la(),{toast:n}=Zs(),[i,c]=m.useState([]),[u,x]=m.useState(!0),[h,f]=m.useState(null),[p,g]=m.useState(null),[N,v]=m.useState(!1),[y,w]=m.useState(!1),[b,O]=m.useState({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),A=m.useCallback(async()=>{try{x(!0),f(null);const D=await we("/api/webui/plugins/mirrors");if(!D.ok)throw new Error("获取镜像源列表失败");const se=await D.json();c(se.mirrors||[])}catch(D){const se=D instanceof Error?D.message:"加载镜像源失败";f(se),n({title:"加载失败",description:se,variant:"destructive"})}finally{x(!1)}},[n]);m.useEffect(()=>{A()},[A]);const _=async()=>{try{const D=await we("/api/webui/plugins/mirrors",{method:"POST",body:JSON.stringify(b)});if(!D.ok){const se=await D.json();throw new Error(se.detail||"添加镜像源失败")}n({title:"添加成功",description:"镜像源已添加"}),v(!1),O({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),A()}catch(D){n({title:"添加失败",description:D instanceof Error?D.message:"未知错误",variant:"destructive"})}},I=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),A()}catch(D){n({title:"更新失败",description:D instanceof Error?D.message:"未知错误",variant:"destructive"})}},E=async D=>{if(confirm("确定要删除这个镜像源吗?"))try{if(!(await we(`/api/webui/plugins/mirrors/${D}`,{method:"DELETE"})).ok)throw new Error("删除镜像源失败");n({title:"删除成功",description:"镜像源已删除"}),A()}catch(se){n({title:"删除失败",description:se instanceof Error?se.message:"未知错误",variant:"destructive"})}},C=async D=>{try{if(!(await we(`/api/webui/plugins/mirrors/${D.id}`,{method:"PUT",body:JSON.stringify({enabled:!D.enabled})})).ok)throw new Error("更新状态失败");A()}catch(se){n({title:"更新失败",description:se instanceof Error?se.message:"未知错误",variant:"destructive"})}},M=D=>{g(D),O({id:D.id,name:D.name,raw_prefix:D.raw_prefix,clone_prefix:D.clone_prefix,enabled:D.enabled,priority:D.priority}),w(!0)},F=async(D,se)=>{const G=se==="up"?D.priority-1:D.priority+1;if(!(G<1))try{if(!(await we(`/api/webui/plugins/mirrors/${D.id}`,{method:"PUT",body:JSON.stringify({priority:G})})).ok)throw new Error("更新优先级失败");A()}catch(me){n({title:"更新失败",description:me instanceof Error?me.message:"未知错误",variant:"destructive"})}};return e.jsx(ss,{className:"h-full",children:e.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(k,{variant:"ghost",size:"icon",onClick:()=>l({to:"/plugins"}),children:e.jsx(Va,{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(k,{onClick:()=>v(!0),children:[e.jsx(st,{className:"h-4 w-4 mr-2"}),"添加镜像源"]})]}),u?e.jsx(De,{className:"p-6",children:e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Os,{className:"h-8 w-8 animate-spin text-primary"})})}):h?e.jsx(De,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Vt,{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(k,{onClick:A,children:"重新加载"})]})}):e.jsxs(De,{children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs(El,{children:[e.jsx(Ml,{children:e.jsxs(ct,{children:[e.jsx(Ye,{children:"状态"}),e.jsx(Ye,{children:"名称"}),e.jsx(Ye,{children:"ID"}),e.jsx(Ye,{children:"优先级"}),e.jsx(Ye,{className:"text-right",children:"操作"})]})}),e.jsx(Al,{children:i.map(D=>e.jsxs(ct,{children:[e.jsx(Ge,{children:e.jsx(Fe,{checked:D.enabled,onCheckedChange:()=>C(D)})}),e.jsx(Ge,{children:e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:D.name}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Raw: ",D.raw_prefix]})]})}),e.jsx(Ge,{children:e.jsx(Ae,{variant:"outline",children:D.id})}),e.jsx(Ge,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-mono",children:D.priority}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(k,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>F(D,"up"),disabled:D.priority===1,children:e.jsx(Lr,{className:"h-3 w-3"})}),e.jsx(k,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>F(D,"down"),children:e.jsx(Sa,{className:"h-3 w-3"})})]})]})}),e.jsx(Ge,{className:"text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(k,{variant:"ghost",size:"icon",onClick:()=>M(D),children:e.jsx(Ln,{className:"h-4 w-4"})}),e.jsx(k,{variant:"ghost",size:"icon",onClick:()=>E(D.id),children:e.jsx(ns,{className:"h-4 w-4 text-destructive"})})]})})]},D.id))})]})}),e.jsx("div",{className:"md:hidden p-4 space-y-4",children:i.map(D=>e.jsx(De,{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:D.name}),D.enabled&&e.jsx(Ae,{variant:"default",className:"text-xs",children:"启用"})]}),e.jsx(Ae,{variant:"outline",className:"mt-1 text-xs",children:D.id})]}),e.jsx(Fe,{checked:D.enabled,onCheckedChange:()=>C(D)})]}),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:D.raw_prefix})]}),e.jsxs("div",{className:"text-muted-foreground",children:[e.jsx("span",{className:"font-medium",children:"优先级: "}),e.jsx("span",{className:"font-mono",children:D.priority})]})]}),e.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t",children:[e.jsxs(k,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>M(D),children:[e.jsx(Ln,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(k,{variant:"outline",size:"sm",onClick:()=>F(D,"up"),disabled:D.priority===1,children:e.jsx(Lr,{className:"h-4 w-4"})}),e.jsx(k,{variant:"outline",size:"sm",onClick:()=>F(D,"down"),children:e.jsx(Sa,{className:"h-4 w-4"})}),e.jsx(k,{variant:"destructive",size:"sm",onClick:()=>E(D.id),children:e.jsx(ns,{className:"h-4 w-4"})})]})]})},D.id))})]}),e.jsx(Fs,{open:N,onOpenChange:v,children:e.jsxs(Bs,{className:"max-w-lg",children:[e.jsxs($s,{children:[e.jsx(Is,{children:"添加镜像源"}),e.jsx(tt,{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(re,{id:"add-id",placeholder:"例如: my-mirror",value:b.id,onChange:D=>O({...b,id:D.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"add-name",children:"名称 *"}),e.jsx(re,{id:"add-name",placeholder:"例如: 我的镜像源",value:b.name,onChange:D=>O({...b,name:D.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"add-raw",children:"Raw 文件前缀 *"}),e.jsx(re,{id:"add-raw",placeholder:"https://example.com/raw",value:b.raw_prefix,onChange:D=>O({...b,raw_prefix:D.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"add-clone",children:"克隆前缀 *"}),e.jsx(re,{id:"add-clone",placeholder:"https://example.com/clone",value:b.clone_prefix,onChange:D=>O({...b,clone_prefix:D.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"add-priority",children:"优先级"}),e.jsx(re,{id:"add-priority",type:"number",min:"1",value:b.priority,onChange:D=>O({...b,priority:parseInt(D.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:D=>O({...b,enabled:D})}),e.jsx(T,{htmlFor:"add-enabled",children:"启用此镜像源"})]})]}),e.jsxs(ot,{children:[e.jsx(k,{variant:"outline",onClick:()=>v(!1),children:"取消"}),e.jsx(k,{onClick:_,children:"添加"})]})]})}),e.jsx(Fs,{open:y,onOpenChange:w,children:e.jsxs(Bs,{className:"max-w-lg",children:[e.jsxs($s,{children:[e.jsx(Is,{children:"编辑镜像源"}),e.jsx(tt,{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(re,{value:b.id,disabled:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit-name",children:"名称 *"}),e.jsx(re,{id:"edit-name",value:b.name,onChange:D=>O({...b,name:D.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit-raw",children:"Raw 文件前缀 *"}),e.jsx(re,{id:"edit-raw",value:b.raw_prefix,onChange:D=>O({...b,raw_prefix:D.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit-clone",children:"克隆前缀 *"}),e.jsx(re,{id:"edit-clone",value:b.clone_prefix,onChange:D=>O({...b,clone_prefix:D.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit-priority",children:"优先级"}),e.jsx(re,{id:"edit-priority",type:"number",min:"1",value:b.priority,onChange:D=>O({...b,priority:parseInt(D.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:D=>O({...b,enabled:D})}),e.jsx(T,{htmlFor:"edit-enabled",children:"启用此镜像源"})]})]}),e.jsxs(ot,{children:[e.jsx(k,{variant:"outline",onClick:()=>w(!1),children:"取消"}),e.jsx(k,{onClick:I,children:"保存"})]})]})})]})})}function pk({pluginId:l,compact:n=!1}){const[i,c]=m.useState(null),[u,x]=m.useState(!0),[h,f]=m.useState(0),[p,g]=m.useState(""),[N,v]=m.useState(!1),{toast:y}=Zs(),w=async()=>{x(!0);const _=await Sv(l);_&&c(_),x(!1)};m.useEffect(()=>{w()},[l]);const b=async()=>{const _=await ak(l);_.success?(y({title:"已点赞",description:"感谢你的支持!"}),w()):y({title:"点赞失败",description:_.error||"未知错误",variant:"destructive"})},O=async()=>{const _=await lk(l);_.success?(y({title:"已反馈",description:"感谢你的反馈!"}),w()):y({title:"操作失败",description:_.error||"未知错误",variant:"destructive"})},A=async()=>{if(h===0){y({title:"请选择评分",description:"至少选择 1 颗星",variant:"destructive"});return}const _=await nk(l,h,p||void 0);_.success?(y({title:"评分成功",description:"感谢你的评价!"}),v(!1),f(0),g(""),w()):y({title:"评分失败",description:_.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(Xt,{className:"h-4 w-4"}),e.jsx("span",{children:"-"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(an,{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(Xt,{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(an,{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(mm,{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(Xt,{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(an,{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(mm,{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(Yp,{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(k,{variant:"outline",size:"sm",onClick:b,children:[e.jsx(mm,{className:"h-4 w-4 mr-1"}),"点赞"]}),e.jsxs(k,{variant:"outline",size:"sm",onClick:O,children:[e.jsx(Yp,{className:"h-4 w-4 mr-1"}),"点踩"]}),e.jsxs(Fs,{open:N,onOpenChange:v,children:[e.jsx(qo,{asChild:!0,children:e.jsxs(k,{variant:"default",size:"sm",children:[e.jsx(an,{className:"h-4 w-4 mr-1"}),"评分"]})}),e.jsxs(Bs,{children:[e.jsxs($s,{children:[e.jsx(Is,{children:"为插件评分"}),e.jsx(tt,{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(_=>e.jsx("button",{onClick:()=>f(_),className:"focus:outline-none",children:e.jsx(an,{className:`h-8 w-8 transition-colors ${_<=h?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-300"}`})},_))}),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(et,{value:p,onChange:_=>g(_.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(ot,{children:[e.jsx(k,{variant:"outline",onClick:()=>v(!1),children:"取消"}),e.jsx(k,{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((_,I)=>e.jsxs("div",{className:"p-3 rounded-lg border bg-muted/50",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(E=>e.jsx(an,{className:`h-3 w-3 ${E<=_.rating?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},E))}),e.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(_.created_at).toLocaleDateString()})]}),_.comment&&e.jsx("p",{className:"text-sm text-muted-foreground",children:_.comment})]},I))})]})]}):null}const gk={"Group Management":"群组管理","Entertainment & Interaction":"娱乐互动","Utility Tools":"实用工具","Content Generation":"内容生成",Multimedia:"多媒体","External Integration":"外部集成","Data Analysis & Insights":"数据分析与洞察",Other:"其他"};function jk(){const l=la(),n=l0({strict:!1}),{toast:i}=Zs(),[c,u]=m.useState(null),[x,h]=m.useState(""),[f,p]=m.useState(!0),[g,N]=m.useState(!0),[v,y]=m.useState(null),[w,b]=m.useState(null),[O,A]=m.useState(null),[_,I]=m.useState(!1),[E,C]=m.useState(),[M,F]=m.useState(!1);m.useEffect(()=>{(async()=>{if(!n.pluginId){y("缺少插件 ID"),p(!1);return}try{p(!0),y(null);const ge=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(!ge.ok)throw new Error("获取插件列表失败");const be=await ge.json();if(!be.success||!be.data)throw new Error(be.error||"获取插件列表失败");const q=JSON.parse(be.data).find(pe=>pe.id===n.pluginId);if(!q)throw new Error("未找到该插件");const U={id:q.id,manifest:q.manifest,downloads:0,rating:0,review_count:0,installed:!1,published_at:new Date().toISOString(),updated_at:new Date().toISOString()};u(U);const[L,$,_e]=await Promise.all([vv(),Nv(),Sl()]);b(L),A($),I(nn(n.pluginId,_e)),C(rn(n.pluginId,_e))}catch(ge){y(ge instanceof Error?ge.message:"加载失败")}finally{p(!1)}})()},[n.pluginId]),m.useEffect(()=>{(async()=>{if(!c?.manifest?.repository_url){N(!1);return}try{N(!0);const ge=c.manifest.repository_url.match(/github\.com\/([^/]+)\/([^/\s]+)/);if(!ge){h("无法解析仓库地址");return}const[,be,z]=ge,q=z.replace(/\.git$/,""),U=await we("/api/webui/plugins/fetch-raw",{method:"POST",body:JSON.stringify({owner:be,repo:q,branch:"main",file_path:"README.md"})});if(!U.ok)throw new Error("获取 README 失败");const L=await U.json();L.success&&L.data?h(L.data):h("该插件暂无 README 文档")}catch(ge){console.error("加载 README 失败:",ge),h("加载 README 失败")}finally{N(!1)}})()},[c]);const D=()=>!c||!_||!E?!1:E!==c.manifest.version,se=()=>!c||!O?!0:bv(c.manifest.host_application.min_version,c.manifest.host_application.max_version,O),G=async()=>{if(!(!c||!w?.installed))try{F(!0),await yv(c.id,c.manifest.repository_url||"","main"),kv(c.id).catch(ge=>{console.warn("Failed to record download:",ge)}),i({title:"安装成功",description:`${c.manifest.name} 已成功安装`});const le=await Sl();I(nn(c.id,le)),C(rn(c.id,le))}catch(le){i({title:"安装失败",description:le instanceof Error?le.message:"未知错误",variant:"destructive"})}finally{F(!1)}},me=async()=>{if(c)try{F(!0),await wv(c.id),i({title:"卸载成功",description:`${c.manifest.name} 已成功卸载`});const le=await Sl();I(nn(c.id,le)),C(rn(c.id,le))}catch(le){i({title:"卸载失败",description:le instanceof Error?le.message:"未知错误",variant:"destructive"})}finally{F(!1)}},ce=async()=>{if(!(!c||!w?.installed))try{F(!0);const le=await _v(c.id,c.manifest.repository_url||"","main");i({title:"更新成功",description:`${c.manifest.name} 已从 ${le.old_version} 更新到 ${le.new_version}`});const ge=await Sl();I(nn(c.id,ge)),C(rn(c.id,ge))}catch(le){i({title:"更新失败",description:le instanceof Error?le.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(k,{variant:"ghost",size:"icon",onClick:()=>l({to:"/plugins"}),children:e.jsx(Va,{className:"h-5 w-5"})}),e.jsx("div",{children:e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件详情"})})]}),e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(Os,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件信息中..."})]})]});if(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(k,{variant:"ghost",size:"icon",onClick:()=>l({to:"/plugins"}),children:e.jsx(Va,{className:"h-5 w-5"})}),e.jsx("div",{children:e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件详情"})})]}),e.jsx(De,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(St,{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(k,{onClick:()=>l({to:"/plugins"}),children:"返回插件列表"})]})})]});const Ne=se();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(k,{variant:"ghost",size:"icon",onClick:()=>l({to:"/plugins"}),className:"shrink-0",children:e.jsx(Va,{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:_?e.jsxs(e.Fragment,{children:[D()?e.jsx(k,{disabled:!w?.installed||M,onClick:ce,title:w?.installed?void 0:"Git 未安装",children:M?e.jsxs(e.Fragment,{children:[e.jsx(Os,{className:"h-4 w-4 mr-2 animate-spin"}),"更新中..."]}):e.jsxs(e.Fragment,{children:[e.jsx(_t,{className:"h-4 w-4 mr-2"}),"更新"]})}):null,e.jsx(k,{variant:"destructive",disabled:!w?.installed||M,onClick:me,title:w?.installed?void 0:"Git 未安装",children:M?e.jsxs(e.Fragment,{children:[e.jsx(Os,{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(k,{disabled:!w?.installed||!Ne||M,onClick:G,title:w?.installed?Ne?void 0:`不兼容当前版本 (需要 ${c.manifest.host_application.min_version}${c.manifest.host_application.max_version?` - ${c.manifest.host_application.max_version}`:"+"},当前 ${O?.version})`:"Git 未安装",children:M?e.jsxs(e.Fragment,{children:[e.jsx(Os,{className:"h-4 w-4 mr-2 animate-spin"}),"安装中..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Xt,{className:"h-4 w-4 mr-2"}),"安装"]})})})]}),e.jsx(ss,{className:"h-[calc(100vh-200px)] sm:h-[calc(100vh-220px)]",children:e.jsxs("div",{className:"space-y-6 pr-4",children:[e.jsx(De,{children:e.jsx(Xe,{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(es,{className:"text-2xl",children:c.manifest.name}),e.jsxs(Ae,{variant:"secondary",className:"text-sm",children:["v",c.manifest.version]}),_&&e.jsxs(Ae,{variant:"default",className:"text-sm",children:[e.jsx(sa,{className:"h-3 w-3 mr-1"}),"已安装 ",E&&`(v${E})`]}),D()&&e.jsxs(Ae,{variant:"outline",className:"text-sm border-orange-500 text-orange-500",children:[e.jsx(_t,{className:"h-3 w-3 mr-1"}),"可更新"]}),!Ne&&e.jsxs(Ae,{variant:"destructive",className:"text-sm",children:[e.jsx(St,{className:"h-3 w-3 mr-1"}),"不兼容"]})]}),e.jsx(Gs,{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(De,{children:[e.jsx(Xe,{children:e.jsx(es,{className:"text-lg",children:"统计信息"})}),e.jsx(Ke,{children:e.jsx(pk,{pluginId:c.id})})]}),e.jsxs(De,{children:[e.jsx(Xe,{children:e.jsx(es,{className:"text-lg",children:"基本信息"})}),e.jsx(Ke,{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(Rn,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"作者:"}),e.jsx("span",{className:"font-medium",children:c.manifest.author?.name||"Unknown"}),c.manifest.author?.url&&e.jsx("a",{href:c.manifest.author.url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:e.jsx(_o,{className:"h-3 w-3"})})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(ea,{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(fj,{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(Mo,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"主页:"}),e.jsxs("a",{href:c.manifest.homepage_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline flex items-center gap-1",children:["访问",e.jsx(_o,{className:"h-3 w-3"})]})]}),c.manifest.repository_url&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Yw,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"仓库:"}),e.jsxs("a",{href:c.manifest.repository_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline flex items-center gap-1",children:["GitHub",e.jsx(_o,{className:"h-3 w-3"})]})]}),e.jsxs("div",{className:"pt-2 border-t",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm mb-2",children:[e.jsx(Kt,{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(De,{children:[e.jsx(Xe,{children:e.jsx(es,{className:"text-lg",children:"分类与标签"})}),e.jsxs(Ke,{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(le=>e.jsx(Ae,{variant:"secondary",children:gk[le]||le},le))})]}),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(le=>e.jsxs(Ae,{variant:"outline",className:"text-xs",children:[e.jsx(Po,{className:"h-3 w-3 mr-1"}),le]},le))})]})]})]})]}),e.jsxs(De,{className:"lg:col-span-2",children:[e.jsx(Xe,{children:e.jsx(es,{className:"text-lg",children:"插件说明"})}),e.jsx(Ke,{children:e.jsx(ss,{className:"h-[600px] pr-4",children:g?e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(Os,{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(Gm,{content:x}):e.jsx("div",{className:"text-center text-muted-foreground py-12",children:"暂无说明文档"})})})]})]})]})})]})}const Ii=m.forwardRef(({className:l,...n},i)=>e.jsx(Pg,{ref:i,className:B("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",l),...n}));Ii.displayName=Pg.displayName;const vk=m.forwardRef(({className:l,...n},i)=>e.jsx(Gg,{ref:i,className:B("aspect-square h-full w-full",l),...n}));vk.displayName=Gg.displayName;const Hi=m.forwardRef(({className:l,...n},i)=>e.jsx(Fg,{ref:i,className:B("flex h-full w-full items-center justify-center rounded-full bg-muted",l),...n}));Hi.displayName=Fg.displayName;function Nk(){return"webui_"+Math.random().toString(36).substr(2,9)+"_"+Date.now().toString(36)}function bk(){const l="maibot_webui_user_id";let n=localStorage.getItem(l);return n||(n=Nk(),localStorage.setItem(l,n)),n}function yk(){return localStorage.getItem("maibot_webui_user_name")||"WebUI用户"}function wk(l){localStorage.setItem("maibot_webui_user_name",l)}const Cv="maibot_webui_virtual_tabs";function _k(){try{const l=localStorage.getItem(Cv);if(l)return JSON.parse(l)}catch(l){console.error("[Chat] 加载虚拟标签页失败:",l)}return[]}function wg(l){try{localStorage.setItem(Cv,JSON.stringify(l))}catch(n){console.error("[Chat] 保存虚拟标签页失败:",n)}}function Sk({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:B("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 kk({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(Sk,{segment:i},c))}):e.jsx("span",{className:"whitespace-pre-wrap",children:l.content})}function Ck(){const l={id:"webui-default",type:"webui",label:"WebUI",messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}},n=()=>{const Pe=_k().map(qe=>{const Je=qe.virtualConfig;return!Je.groupId&&Je.platform&&Je.userId&&(Je.groupId=`webui_virtual_group_${Je.platform}_${Je.userId}`),{id:qe.id,type:"virtual",label:qe.label,virtualConfig:Je,messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}}});return[l,...Pe]},[i,c]=m.useState(n),[u,x]=m.useState("webui-default"),h=i.find(P=>P.id===u)||i[0],[f,p]=m.useState(""),[g,N]=m.useState(!1),[v,y]=m.useState(!0),[w,b]=m.useState(yk()),[O,A]=m.useState(!1),[_,I]=m.useState(""),[E,C]=m.useState(!1),[M,F]=m.useState([]),[D,se]=m.useState([]),[G,me]=m.useState(!1),[ce,Ne]=m.useState(!1),[le,ge]=m.useState(""),[be,z]=m.useState({platform:"",personId:"",userId:"",userName:"",groupName:"",groupId:""}),q=m.useRef(bk()),U=m.useRef(new Map),L=m.useRef(null),$=m.useRef(new Map),_e=m.useRef(0),pe=m.useRef(new Map),{toast:Se}=Zs(),Q=P=>(_e.current+=1,`${P}-${Date.now()}-${_e.current}-${Math.random().toString(36).substr(2,9)}`),ye=m.useCallback((P,Pe)=>{c(qe=>qe.map(Je=>Je.id===P?{...Je,...Pe}:Je))},[]),X=m.useCallback((P,Pe)=>{c(qe=>qe.map(Je=>Je.id===P?{...Je,messages:[...Je.messages,Pe]}:Je))},[]),he=m.useCallback(()=>{L.current?.scrollIntoView({behavior:"smooth"})},[]);m.useEffect(()=>{he()},[h?.messages,he]);const Ee=m.useCallback(async()=>{me(!0);try{const P=await we("/api/chat/platforms");if(console.log("[Chat] 平台列表响应:",P.status,P.headers.get("content-type")),P.ok){const Pe=P.headers.get("content-type");if(Pe&&Pe.includes("application/json")){const qe=await P.json();console.log("[Chat] 平台列表数据:",qe),F(qe.platforms||[])}else{const qe=await P.text();console.error("[Chat] 获取平台列表失败: 非 JSON 响应:",qe.substring(0,200)),Se({title:"连接失败",description:"无法连接到后端服务,请确保 MaiBot 已启动",variant:"destructive"})}}else console.error("[Chat] 获取平台列表失败: HTTP",P.status),Se({title:"获取平台失败",description:`服务器返回错误: ${P.status}`,variant:"destructive"})}catch(P){console.error("[Chat] 获取平台列表失败:",P),Se({title:"网络错误",description:"无法连接到后端服务",variant:"destructive"})}finally{me(!1)}},[Se]),Y=m.useCallback(async(P,Pe)=>{Ne(!0);try{const qe=new URLSearchParams;P&&qe.append("platform",P),Pe&&qe.append("search",Pe),qe.append("limit","50");const Je=await we(`/api/chat/persons?${qe.toString()}`);if(Je.ok){const As=Je.headers.get("content-type");if(As&&As.includes("application/json")){const ts=await Je.json();se(ts.persons||[])}else console.error("[Chat] 获取用户列表失败: 后端返回非 JSON 响应")}}catch(qe){console.error("[Chat] 获取用户列表失败:",qe)}finally{Ne(!1)}},[]);m.useEffect(()=>{be.platform&&Y(be.platform,le)},[be.platform,le,Y]);const ie=m.useCallback(async(P,Pe)=>{y(!0);try{const qe=new URLSearchParams;qe.append("user_id",q.current),qe.append("limit","50"),Pe&&qe.append("group_id",Pe);const Je=`/api/chat/history?${qe.toString()}`;console.log("[Chat] 正在加载历史消息:",Je);const As=await we(Je);if(As.ok){const ts=await As.text();try{const Ss=JSON.parse(ts);if(Ss.messages&&Ss.messages.length>0){const Ce=Ss.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}}));ye(P,{messages:Ce});const vs=pe.current.get(P)||new Set;Ce.forEach(as=>{if(as.type==="bot"){const Ze=`bot-${as.content}-${Math.floor(as.timestamp*1e3)}`;vs.add(Ze)}}),pe.current.set(P,vs)}}catch(Ss){console.error("[Chat] JSON 解析失败:",Ss)}}}catch(qe){console.error("[Chat] 加载历史消息失败:",qe)}finally{y(!1)}},[ye]),Ie=m.useCallback(async(P,Pe,qe)=>{const Je=U.current.get(P);if(Je?.readyState===WebSocket.OPEN||Je?.readyState===WebSocket.CONNECTING){console.log(`[Tab ${P}] WebSocket 已存在,跳过连接`);return}N(!0);let As=null;try{const vs=await we("/api/webui/ws-token");if(vs.ok){const as=await vs.json();if(as.success&&as.token)As=as.token;else{console.warn(`[Tab ${P}] 获取 WebSocket token 失败: ${as.message||"未登录"}`),N(!1);return}}}catch(vs){console.error(`[Tab ${P}] 获取 WebSocket token 失败:`,vs),N(!1);return}if(!As){N(!1);return}const ts=window.location.protocol==="https:"?"wss:":"ws:",Ss=new URLSearchParams;Ss.append("token",As),Pe==="virtual"&&qe?(Ss.append("user_id",qe.userId),Ss.append("user_name",qe.userName),Ss.append("platform",qe.platform),Ss.append("person_id",qe.personId),Ss.append("group_name",qe.groupName||"WebUI虚拟群聊"),qe.groupId&&Ss.append("group_id",qe.groupId)):(Ss.append("user_id",q.current),Ss.append("user_name",w));const Ce=`${ts}//${window.location.host}/api/chat/ws?${Ss.toString()}`;console.log(`[Tab ${P}] 正在连接 WebSocket:`,Ce);try{const vs=new WebSocket(Ce);U.current.set(P,vs),vs.onopen=()=>{ye(P,{isConnected:!0}),N(!1),console.log(`[Tab ${P}] WebSocket 已连接`)},vs.onmessage=as=>{try{const Ze=JSON.parse(as.data);switch(Ze.type){case"session_info":ye(P,{sessionInfo:{session_id:Ze.session_id,user_id:Ze.user_id,user_name:Ze.user_name,bot_name:Ze.bot_name}});break;case"system":X(P,{id:Q("sys"),type:"system",content:Ze.content||"",timestamp:Ze.timestamp||Date.now()/1e3});break;case"user_message":{const Ns=Ze.sender?.user_id,ft=Pe==="virtual"&&qe?qe.userId:q.current;console.log(`[Tab ${P}] 收到 user_message, sender: ${Ns}, current: ${ft}`);const Rt=Ns?Ns.replace(/^webui_user_/,""):"",Ws=ft?ft.replace(/^webui_user_/,""):"";if(Rt&&Ws&&Rt===Ws){console.log(`[Tab ${P}] 跳过自己的消息(user_id 匹配)`);break}const Ts=pe.current.get(P)||new Set,kt=`user-${Ze.content}-${Math.floor((Ze.timestamp||0)*1e3)}`;if(Ts.has(kt)){console.log(`[Tab ${P}] 跳过自己的消息(内容去重)`);break}if(Ts.add(kt),pe.current.set(P,Ts),Ts.size>100){const Lt=Ts.values().next().value;Lt&&Ts.delete(Lt)}X(P,{id:Ze.message_id||Q("user"),type:"user",content:Ze.content||"",timestamp:Ze.timestamp||Date.now()/1e3,sender:Ze.sender});break}case"bot_message":{ye(P,{isTyping:!1});const Ns=pe.current.get(P)||new Set,ft=`bot-${Ze.content}-${Math.floor((Ze.timestamp||0)*1e3)}`;if(Ns.has(ft))break;if(Ns.add(ft),pe.current.set(P,Ns),Ns.size>100){const Rt=Ns.values().next().value;Rt&&Ns.delete(Rt)}c(Rt=>Rt.map(Ws=>{if(Ws.id!==P)return Ws;const Ts=Ws.messages.filter(Lt=>Lt.type!=="thinking"),kt={id:Q("bot"),type:"bot",content:Ze.content||"",message_type:Ze.message_type==="rich"?"rich":"text",segments:Ze.segments,timestamp:Ze.timestamp||Date.now()/1e3,sender:Ze.sender};return{...Ws,messages:[...Ts,kt]}}));break}case"typing":ye(P,{isTyping:Ze.is_typing||!1});break;case"error":c(Ns=>Ns.map(ft=>{if(ft.id!==P)return ft;const Rt=ft.messages.filter(Ws=>Ws.type!=="thinking");return{...ft,messages:[...Rt,{id:Q("error"),type:"error",content:Ze.content||"发生错误",timestamp:Ze.timestamp||Date.now()/1e3}]}})),Se({title:"错误",description:Ze.content,variant:"destructive"});break;case"pong":break;case"history":{const Ns=Ze.messages||[];if(Ns.length>0){const ft=pe.current.get(P)||new Set,Rt=Ns.map(Ws=>{const Ts=Ws.is_bot||!1,kt=Ws.id||Q(Ts?"bot":"user"),Lt=`${Ts?"bot":"user"}-${Ws.content}-${Math.floor(Ws.timestamp*1e3)}`;return ft.add(Lt),{id:kt,type:Ts?"bot":"user",content:Ws.content,timestamp:Ws.timestamp,sender:{name:Ws.sender_name||(Ts?"麦麦":"用户"),user_id:Ws.sender_id,is_bot:Ts}}});pe.current.set(P,ft),ye(P,{messages:Rt}),console.log(`[Tab ${P}] 已加载 ${Rt.length} 条历史消息`)}break}default:console.log("未知消息类型:",Ze.type)}}catch(Ze){console.error("解析消息失败:",Ze)}},vs.onclose=()=>{ye(P,{isConnected:!1}),N(!1),U.current.delete(P),console.log(`[Tab ${P}] WebSocket 已断开`);const as=$.current.get(P);as&&clearTimeout(as);const Ze=window.setTimeout(()=>{if(!V.current){const Ns=i.find(ft=>ft.id===P);Ns&&Ie(P,Ns.type,Ns.virtualConfig)}},5e3);$.current.set(P,Ze)},vs.onerror=as=>{console.error(`[Tab ${P}] WebSocket 错误:`,as),N(!1)}}catch(vs){console.error(`[Tab ${P}] 创建 WebSocket 失败:`,vs),N(!1)}},[w,ye,X,Se,i]),V=m.useRef(!1);m.useEffect(()=>{V.current=!1;const P=U.current,Pe=$.current,qe=pe.current;ie("webui-default");const Je=setTimeout(()=>{V.current||(Ie("webui-default","webui"),i.forEach(ts=>{ts.type==="virtual"&&ts.virtualConfig&&(qe.set(ts.id,new Set),setTimeout(()=>{V.current||Ie(ts.id,"virtual",ts.virtualConfig)},200))}))},100),As=setInterval(()=>{P.forEach(ts=>{ts.readyState===WebSocket.OPEN&&ts.send(JSON.stringify({type:"ping"}))})},3e4);return()=>{V.current=!0,clearTimeout(Je),clearInterval(As),Pe.forEach(ts=>{clearTimeout(ts)}),Pe.clear(),P.forEach(ts=>{ts.close()}),P.clear()}},[]);const Z=m.useCallback(()=>{const P=U.current.get(u);if(!f.trim()||!P||P.readyState!==WebSocket.OPEN)return;const Pe=h?.type==="virtual"&&h.virtualConfig?.userName||w,qe=f.trim(),Je=Date.now()/1e3;P.send(JSON.stringify({type:"message",content:qe,user_name:Pe}));const As=pe.current.get(u)||new Set,ts=`user-${qe}-${Math.floor(Je*1e3)}`;if(As.add(ts),pe.current.set(u,As),As.size>100){const vs=As.values().next().value;vs&&As.delete(vs)}const Ss={id:Q("user"),type:"user",content:qe,timestamp:Je,sender:{name:Pe,is_bot:!1}};X(u,Ss);const Ce={id:Q("thinking"),type:"thinking",content:"",timestamp:Je+.001,sender:{name:h?.sessionInfo.bot_name||"麦麦",is_bot:!0}};X(u,Ce),p("")},[f,w,u,h,X]),Oe=P=>{P.key==="Enter"&&!P.shiftKey&&(P.preventDefault(),Z())},ze=()=>{I(w),A(!0)},Te=()=>{const P=_.trim()||"WebUI用户";b(P),wk(P),A(!1);const Pe=U.current.get(u);Pe?.readyState===WebSocket.OPEN&&Pe.send(JSON.stringify({type:"update_nickname",user_name:P}))},oe=()=>{I(""),A(!1)},ke=P=>new Date(P*1e3).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}),is=()=>{const P=U.current.get(u);P&&(P.close(),U.current.delete(u)),Ie(u,h?.type||"webui",h?.virtualConfig)},Ot=()=>{z({platform:"",personId:"",userId:"",userName:"",groupName:"",groupId:""}),ge(""),Ee(),C(!0)},Zt=()=>{if(!be.platform||!be.personId){Se({title:"配置不完整",description:"请选择平台和用户",variant:"destructive"});return}const P=`webui_virtual_group_${be.platform}_${be.userId}`,Pe=`virtual-${be.platform}-${be.userId}-${Date.now()}`,qe=be.userName||be.userId,Je={id:Pe,type:"virtual",label:qe,virtualConfig:{...be,groupId:P},messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}};c(As=>{const ts=[...As,Je],Ss=ts.filter(Ce=>Ce.type==="virtual"&&Ce.virtualConfig).map(Ce=>({id:Ce.id,label:Ce.label,virtualConfig:Ce.virtualConfig,createdAt:Date.now()}));return wg(Ss),ts}),x(Pe),C(!1),pe.current.set(Pe,new Set),setTimeout(()=>{Ie(Pe,"virtual",be)},100),Se({title:"虚拟身份标签页",description:`已创建 ${qe} 的对话`})},$a=(P,Pe)=>{if(Pe?.stopPropagation(),P==="webui-default")return;const qe=U.current.get(P);qe&&(qe.close(),U.current.delete(P));const Je=$.current.get(P);Je&&(clearTimeout(Je),$.current.delete(P)),pe.current.delete(P),c(As=>{const ts=As.filter(Ce=>Ce.id!==P),Ss=ts.filter(Ce=>Ce.type==="virtual"&&Ce.virtualConfig).map(Ce=>({id:Ce.id,label:Ce.label,virtualConfig:Ce.virtualConfig,createdAt:Date.now()}));return wg(Ss),ts}),u===P&&x("webui-default")},It=P=>{x(P)},dt=P=>{z(Pe=>({...Pe,personId:P.person_id,userId:P.user_id,userName:P.nickname||P.person_name}))};return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(Fs,{open:E,onOpenChange:C,children:e.jsxs(Bs,{className:"sm:max-w-[500px] max-h-[85vh] overflow-hidden flex flex-col",children:[e.jsxs($s,{children:[e.jsxs(Is,{className:"flex items-center gap-2",children:[e.jsx(xm,{className:"h-5 w-5"}),"新建虚拟身份对话"]}),e.jsx(tt,{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(Mo,{className:"h-4 w-4"}),"选择平台"]}),e.jsxs(Be,{value:be.platform,onValueChange:P=>{z(Pe=>({...Pe,platform:P,personId:"",userId:"",userName:""})),se([])},children:[e.jsx(Le,{disabled:G,children:e.jsx($e,{placeholder:G?"加载中...":"选择平台"})}),e.jsx(Ue,{children:M.map(P=>e.jsxs(ee,{value:P.platform,children:[P.platform," (",P.count," 人)"]},P.platform))})]})]}),be.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(Em,{className:"h-4 w-4"}),"选择用户"]}),e.jsxs("div",{className:"relative",children:[e.jsx(Qt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(re,{placeholder:"搜索用户名...",value:le,onChange:P=>ge(P.target.value),className:"pl-9"})]}),e.jsx(ss,{className:"h-[250px] border rounded-md",children:e.jsx("div",{className:"p-2",children:ce?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Os,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):D.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground",children:[e.jsx(Em,{className:"h-8 w-8 mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"没有找到用户"})]}):e.jsx("div",{className:"space-y-1",children:D.map(P=>e.jsxs("button",{onClick:()=>dt(P),className:B("w-full flex items-center gap-3 p-2 rounded-md text-left transition-colors",be.personId===P.person_id?"bg-primary text-primary-foreground":"hover:bg-muted"),children:[e.jsx(Ii,{className:"h-8 w-8 shrink-0",children:e.jsx(Hi,{className:B("text-xs",be.personId===P.person_id?"bg-primary-foreground/20":"bg-muted"),children:(P.nickname||P.person_name||"?").charAt(0)})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-medium truncate",children:P.nickname||P.person_name}),e.jsxs("div",{className:B("text-xs truncate",be.personId===P.person_id?"text-primary-foreground/70":"text-muted-foreground"),children:["ID: ",P.user_id,P.is_known&&" · 已认识"]})]})]},P.person_id))})})})]}),be.personId&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"虚拟群名(可选)"}),e.jsx(re,{placeholder:"WebUI虚拟群聊",value:be.groupName,onChange:P=>z(Pe=>({...Pe,groupName:P.target.value}))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦会认为这是一个名为此名称的群聊"})]})]}),e.jsxs(ot,{className:"gap-2 sm:gap-0",children:[e.jsx(k,{variant:"outline",onClick:()=>C(!1),children:"取消"}),e.jsx(k,{onClick:Zt,disabled:!be.platform||!be.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(P=>e.jsxs("div",{className:B("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===P.id?"bg-background shadow-sm border":"text-muted-foreground"),onClick:()=>It(P.id),children:[P.type==="webui"?e.jsx(on,{className:"h-3.5 w-3.5"}):e.jsx(xm,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"max-w-[100px] truncate",children:P.label}),e.jsx("span",{className:B("w-1.5 h-1.5 rounded-full",P.isConnected?"bg-green-500":"bg-muted-foreground/50")}),P.id!=="webui-default"&&e.jsx("span",{onClick:Pe=>$a(P.id,Pe),className:"ml-0.5 p-0.5 rounded hover:bg-muted-foreground/20 cursor-pointer",role:"button",tabIndex:0,onKeyDown:Pe=>{(Pe.key==="Enter"||Pe.key===" ")&&(Pe.preventDefault(),$a(P.id,Pe))},children:e.jsx(_a,{className:"h-3 w-3"})})]},P.id)),e.jsx("button",{onClick:Ot,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(st,{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(Ii,{className:"h-8 w-8 sm:h-10 sm:w-10 shrink-0",children:e.jsx(Hi,{className:"bg-primary/10 text-primary",children:e.jsx(Bi,{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(Jw,{className:"h-3 w-3 text-green-500"}),e.jsx("span",{className:"text-green-600 dark:text-green-400",children:"已连接"})]}):g?e.jsxs(e.Fragment,{children:[e.jsx(Os,{className:"h-3 w-3 animate-spin"}),e.jsx("span",{children:"连接中..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(Xw,{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(Os,{className:"h-4 w-4 animate-spin text-muted-foreground"}),e.jsx(k,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:is,disabled:g,title:"重新连接",children:e.jsx(_t,{className:B("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(xm,{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(Rn,{className:"h-3 w-3"}),e.jsx("span",{children:"当前身份:"}),O?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(re,{value:_,onChange:P=>I(P.target.value),onKeyDown:P=>{P.key==="Enter"&&Te(),P.key==="Escape"&&oe()},className:"h-7 w-32",placeholder:"输入昵称",autoFocus:!0}),e.jsx(k,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:Te,children:"保存"}),e.jsx(k,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:oe,children:"取消"})]}):e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"font-medium text-foreground",children:w}),e.jsx(k,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:ze,title:"修改昵称",children:e.jsx(Zw,{className:"h-3 w-3"})})]})]})})]})}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(ss,{className:"h-full",children:e.jsxs("div",{className:"p-3 sm:p-4 max-w-4xl mx-auto space-y-3 sm:space-y-4",children:[h?.messages.length===0&&!v&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[e.jsx(Bi,{className:"h-12 w-12 mb-4 opacity-50"}),e.jsxs("p",{className:"text-sm",children:["开始与 ",h?.sessionInfo.bot_name||"麦麦"," 对话吧!"]})]}),h?.messages.map(P=>e.jsxs("div",{className:B("flex gap-2 sm:gap-3",P.type==="user"&&"flex-row-reverse",P.type==="system"&&"justify-center",P.type==="error"&&"justify-center"),children:[P.type==="system"&&e.jsx("div",{className:"text-xs text-muted-foreground bg-muted/50 px-3 py-1 rounded-full max-w-[90%]",children:P.content}),P.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:P.content}),P.type==="thinking"&&e.jsxs(e.Fragment,{children:[e.jsx(Ii,{className:"h-7 w-7 sm:h-8 sm:w-8 shrink-0",children:e.jsx(Hi,{className:"bg-primary/10 text-primary",children:e.jsx(Bi,{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:P.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:"思考中..."})]})})]})]}),(P.type==="user"||P.type==="bot")&&e.jsxs(e.Fragment,{children:[e.jsx(Ii,{className:"h-7 w-7 sm:h-8 sm:w-8 shrink-0",children:e.jsx(Hi,{className:B("text-xs",P.type==="bot"?"bg-primary/10 text-primary":"bg-secondary text-secondary-foreground"),children:P.type==="bot"?e.jsx(Bi,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"}):e.jsx(Rn,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"})})}),e.jsxs("div",{className:B("flex flex-col gap-1 max-w-[75%] sm:max-w-[70%]",P.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:P.sender?.name||(P.type==="bot"?h?.sessionInfo.bot_name:w)}),e.jsx("span",{children:ke(P.timestamp)})]}),e.jsx("div",{className:B("rounded-2xl px-3 py-2 text-sm break-words",P.type==="bot"?"bg-muted rounded-tl-sm":"bg-primary text-primary-foreground rounded-tr-sm"),children:e.jsx(kk,{message:P,isBot:P.type==="bot"})})]})]})]},P.id)),e.jsx("div",{ref:L})]})})}),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(re,{value:f,onChange:P=>p(P.target.value),onKeyDown:Oe,placeholder:h?.isConnected?"输入消息...":"等待连接...",disabled:!h?.isConnected,className:"flex-1 h-10 sm:h-10"}),e.jsx(k,{onClick:Z,disabled:!h?.isConnected||!f.trim(),size:"icon",className:"h-10 w-10 shrink-0",children:e.jsx(Ww,{className:"h-4 w-4"})})]})})})]})}var Zm="Radio",[Tk,Tv]=$o(Zm),[Ek,Mk]=Tk(Zm),Ev=m.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]=m.useState(null),w=Io(n,A=>y(A)),b=m.useRef(!1),O=v?g||!!v.closest("form"):!0;return e.jsxs(Ek,{scope:i,checked:u,disabled:h,children:[e.jsx(Hn.button,{type:"button",role:"radio","aria-checked":u,"data-state":Dv(u),"data-disabled":h?"":void 0,disabled:h,value:f,...N,ref:w,onClick:cn(l.onClick,A=>{u||p?.(),O&&(b.current=A.isPropagationStopped(),b.current||A.stopPropagation())})}),O&&e.jsx(zv,{control:v,bubbles:!b.current,name:c,value:f,checked:u,required:x,disabled:h,form:g,style:{transform:"translateX(-100%)"}})]})});Ev.displayName=Zm;var Mv="RadioIndicator",Av=m.forwardRef((l,n)=>{const{__scopeRadio:i,forceMount:c,...u}=l,x=Mk(Mv,i);return e.jsx(vw,{present:c||x.checked,children:e.jsx(Hn.span,{"data-state":Dv(x.checked),"data-disabled":x.disabled?"":void 0,...u,ref:n})})});Av.displayName=Mv;var Ak="RadioBubbleInput",zv=m.forwardRef(({__scopeRadio:l,control:n,checked:i,bubbles:c=!0,...u},x)=>{const h=m.useRef(null),f=Io(h,x),p=Nw(i),g=bw(n);return m.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(Hn.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}})});zv.displayName=Ak;function Dv(l){return l?"checked":"unchecked"}var zk=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Xo="RadioGroup",[Dk]=$o(Xo,[qg,Tv]),Ov=qg(),Rv=Tv(),[Ok,Rk]=Dk(Xo),Lv=m.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=Ov(i),b=ij(g),[O,A]=Bo({prop:x,defaultProp:u??null,onChange:v,caller:Xo});return e.jsx(Ok,{scope:i,name:c,required:h,disabled:f,value:O,onValueChange:A,children:e.jsx(D0,{asChild:!0,...w,orientation:p,dir:b,loop:N,children:e.jsx(Hn.div,{role:"radiogroup","aria-required":h,"aria-orientation":p,"data-disabled":f?"":void 0,dir:b,...y,ref:n})})})});Lv.displayName=Xo;var Uv="RadioGroupItem",Bv=m.forwardRef((l,n)=>{const{__scopeRadioGroup:i,disabled:c,...u}=l,x=Rk(Uv,i),h=x.disabled||c,f=Ov(i),p=Rv(i),g=m.useRef(null),N=Io(n,g),v=x.value===u.value,y=m.useRef(!1);return m.useEffect(()=>{const w=O=>{zk.includes(O.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(O0,{asChild:!0,...f,focusable:!h,active:v,children:e.jsx(Ev,{disabled:h,required:x.required,checked:v,...p,...u,name:x.name,ref:N,onCheck:()=>x.onValueChange(u.value),onKeyDown:cn(w=>{w.key==="Enter"&&w.preventDefault()}),onFocus:cn(u.onFocus,()=>{y.current&&g.current?.click()})})})});Bv.displayName=Uv;var Lk="RadioGroupIndicator",$v=m.forwardRef((l,n)=>{const{__scopeRadioGroup:i,...c}=l,u=Rv(i);return e.jsx(Av,{...u,...c,ref:n})});$v.displayName=Lk;var Iv=Lv,Hv=Bv,Uk=$v;const Wm=m.forwardRef(({className:l,...n},i)=>e.jsx(Iv,{className:B("grid gap-2",l),...n,ref:i}));Wm.displayName=Iv.displayName;const Lo=m.forwardRef(({className:l,...n},i)=>e.jsx(Hv,{ref:i,className:B("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(Uk,{className:"flex items-center justify-center",children:e.jsx(Tj,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Lo.displayName=Hv.displayName;function Bk({question:l,value:n,onChange:i,error:c,disabled:u=!1}){const[x,h]=m.useState(null),f=u||l.readOnly,p=()=>{switch(l.type){case"single":return e.jsx(Wm,{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(Lo,{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(Js,{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(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(re,{value:n||"",onChange:g=>i(g.target.value),placeholder:l.placeholder||"请输入...",disabled:f,readOnly:l.readOnly,maxLength:l.maxLength,className:B(l.readOnly&&"bg-muted cursor-not-allowed")});case"textarea":return e.jsxs("div",{className:"space-y-1",children:[e.jsx(et,{value:n||"",onChange:g=>i(g.target.value),placeholder:l.placeholder||"请输入...",disabled:f,readOnly:l.readOnly,maxLength:l.maxLength,rows:4,className:B(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:B("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(an,{className:B("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(wa,{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(Be,{value:n||"",onValueChange:i,disabled:f,children:[e.jsx(Le,{children:e.jsx($e,{placeholder:l.placeholder||"请选择..."})}),e.jsx(Ue,{children:l.options?.map(g=>e.jsx(ee,{value:g.value,children:g.label},g.id))})]});default:return e.jsx("div",{className:"text-muted-foreground",children:"不支持的问题类型"})}};return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(T,{className:"text-base font-medium",children:[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 Pv="https://maibot-plugin-stats.maibot-webui.workers.dev";function Gv(){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 $k(l,n,i,c){try{const u=c?.userId||Gv(),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(`${Pv}/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 Ik(l,n){try{const i=n||Gv(),c=new URLSearchParams({user_id:i,survey_id:l}),u=await fetch(`${Pv}/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 Fv({config:l,initialAnswers:n,onSubmitSuccess:i,onSubmitError:c,showProgress:u=!0,paginateQuestions:x=!1,className:h}){const f=m.useCallback(()=>!n||n.length===0?{}:n.reduce((U,L)=>(U[L.questionId]=L.value,U),{}),[n]),[p,g]=m.useState(()=>f()),[N,v]=m.useState({}),[y,w]=m.useState(0),[b,O]=m.useState(!1),[A,_]=m.useState(!1),[I,E]=m.useState(null),[C,M]=m.useState(null),[F,D]=m.useState(!1),[se,G]=m.useState(!0);m.useEffect(()=>{n&&n.length>0&&g(U=>({...U,...f()}))},[n,f]),m.useEffect(()=>{(async()=>{if(!l.settings?.allowMultiple){const L=await Ik(l.id);L.success&&L.hasSubmitted&&D(!0)}G(!1)})()},[l.id,l.settings?.allowMultiple]);const me=m.useCallback(()=>{const U=new Date;return!(l.settings?.startTime&&new Date(l.settings.startTime)>U||l.settings?.endTime&&new Date(l.settings.endTime){const L=p[U.id];return L==null?!1:Array.isArray(L)?L.length>0:typeof L=="string"?L.trim()!=="":!0}).length,Ne=ce/l.questions.length*100,le=m.useCallback((U,L)=>{g($=>({...$,[U]:L})),v($=>{const _e={...$};return delete _e[U],_e})},[]),ge=m.useCallback(()=>{const U={};for(const L of l.questions){if(L.required){const $=p[L.id];if($==null){U[L.id]="此题为必填项";continue}if(Array.isArray($)&&$.length===0){U[L.id]="请至少选择一项";continue}if(typeof $=="string"&&$.trim()===""){U[L.id]="此题为必填项";continue}}L.minLength&&typeof p[L.id]=="string"&&p[L.id].length{if(!ge()){if(x){const U=l.questions.findIndex(L=>N[L.id]);U>=0&&w(U)}return}O(!0),E(null);try{const U=l.questions.filter($=>p[$.id]!==void 0).map($=>({questionId:$.id,value:p[$.id]})),L=await $k(l.id,l.version,U,{allowMultiple:l.settings?.allowMultiple});if(L.success&&L.submissionId)_(!0),M(L.submissionId),i?.(L.submissionId);else{const $=L.error||"提交失败";E($),c?.($)}}catch(U){const L=U instanceof Error?U.message:"提交失败";E(L),c?.(L)}finally{O(!1)}},[ge,x,l,p,N,i,c]),z=m.useCallback(U=>{U>=0&&Ue.jsxs("div",{className:B("p-4 rounded-lg border bg-card",N[U.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:[L+1,"."]}),e.jsx(Bk,{question:U,value:p[U.id],onChange:$=>le(U.id,$),error:N[U.id],disabled:b})]},U.id)),I&&e.jsxs(rt,{variant:"destructive",children:[e.jsx(St,{className:"h-4 w-4"}),e.jsx(it,{children:I})]}),e.jsx("div",{className:"flex justify-between items-center py-4",children:x?e.jsxs(e.Fragment,{children:[e.jsxs(k,{variant:"outline",onClick:()=>z(y-1),disabled:y===0||b,children:[e.jsx(ll,{className:"h-4 w-4 mr-1"}),"上一题"]}),y===l.questions.length-1?e.jsxs(k,{onClick:be,disabled:b,children:[b&&e.jsx(Os,{className:"h-4 w-4 mr-2 animate-spin"}),"提交问卷"]}):e.jsxs(k,{onClick:()=>z(y+1),disabled:b,children:["下一题",e.jsx(ha,{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(k,{onClick:be,disabled:b,size:"lg",children:[b&&e.jsx(Os,{className:"h-4 w-4 mr-2 animate-spin"}),"提交问卷"]})]})})]})})]})}const Hk={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:"感谢你的反馈!你的意见对我们非常重要,我们会认真考虑每一条建议。"}},Pk={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 Gk(){const[l,n]=m.useState(!0),i=m.useMemo(()=>JSON.parse(JSON.stringify(Hk)),[]);m.useEffect(()=>{n(!1)},[]);const c=m.useMemo(()=>[{questionId:"webui_version",value:`v${Fo}`}],[]),u=m.useCallback(h=>{console.log("WebUI Survey submitted:",h)},[]),x=m.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(Os,{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(Ej,{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(Fv,{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(rt,{variant:"destructive",className:"max-w-md",children:[e.jsx(St,{className:"h-4 w-4"}),e.jsx(it,{children:"无法加载问卷配置"})]}),e.jsx(k,{variant:"outline",onClick:()=>window.location.reload(),children:"重试"})]})}function Fk(){const[l,n]=m.useState(null),[i,c]=m.useState(!0),[u,x]=m.useState("未知版本");m.useEffect(()=>{(async()=>{try{const v=await G1();x(v.version||"未知版本")}catch(v){console.error("Failed to get MaiBot version:",v),x("获取失败")}const N=JSON.parse(JSON.stringify(Pk));n(N),c(!1)})()},[]);const h=m.useMemo(()=>[{questionId:"maibot_version",value:u}],[u]),f=m.useCallback(g=>{console.log("MaiBot Survey submitted:",g)},[]),p=m.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(Os,{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(Ej,{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(Fv,{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(rt,{variant:"destructive",className:"max-w-md",children:[e.jsx(St,{className:"h-4 w-4"}),e.jsx(it,{children:"无法加载问卷配置"})]}),e.jsx(k,{variant:"outline",onClick:()=>window.location.reload(),children:"重试"})]})}var Zo="DropdownMenu",[qk]=$o(Zo,[Vg]),na=Vg(),[Vk,qv]=qk(Zo),Vv=l=>{const{__scopeDropdownMenu:n,children:i,dir:c,open:u,defaultOpen:x,onOpenChange:h,modal:f=!0}=l,p=na(n),g=m.useRef(null),[N,v]=Bo({prop:u,defaultProp:x??!1,onChange:h,caller:Zo});return e.jsx(Vk,{scope:n,triggerId:Tm(),triggerRef:g,contentId:Tm(),open:N,onOpenChange:v,onOpenToggle:m.useCallback(()=>v(y=>!y),[v]),modal:f,children:e.jsx(q0,{...p,open:N,onOpenChange:v,dir:c,modal:f,children:i})})};Vv.displayName=Zo;var Kv="DropdownMenuTrigger",Qv=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,disabled:c=!1,...u}=l,x=qv(Kv,i),h=na(i);return e.jsx(V0,{asChild:!0,...h,children:e.jsx(Hn.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:yw(n,x.triggerRef),onPointerDown:cn(l.onPointerDown,f=>{!c&&f.button===0&&f.ctrlKey===!1&&(x.onOpenToggle(),x.open||f.preventDefault())}),onKeyDown:cn(l.onKeyDown,f=>{c||(["Enter"," "].includes(f.key)&&x.onOpenToggle(),f.key==="ArrowDown"&&x.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(f.key)&&f.preventDefault())})})})});Qv.displayName=Kv;var Kk="DropdownMenuPortal",Yv=l=>{const{__scopeDropdownMenu:n,...i}=l,c=na(n);return e.jsx(U0,{...c,...i})};Yv.displayName=Kk;var Jv="DropdownMenuContent",Xv=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=qv(Jv,i),x=na(i),h=m.useRef(!1);return e.jsx(B0,{id:u.contentId,"aria-labelledby":u.triggerId,...x,...c,ref:n,onCloseAutoFocus:cn(l.onCloseAutoFocus,f=>{h.current||u.triggerRef.current?.focus(),h.current=!1,f.preventDefault()}),onInteractOutside:cn(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)"}})});Xv.displayName=Jv;var Qk="DropdownMenuGroup",Yk=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=na(i);return e.jsx(K0,{...u,...c,ref:n})});Yk.displayName=Qk;var Jk="DropdownMenuLabel",Zv=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=na(i);return e.jsx(G0,{...u,...c,ref:n})});Zv.displayName=Jk;var Xk="DropdownMenuItem",Wv=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=na(i);return e.jsx($0,{...u,...c,ref:n})});Wv.displayName=Xk;var Zk="DropdownMenuCheckboxItem",eN=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=na(i);return e.jsx(I0,{...u,...c,ref:n})});eN.displayName=Zk;var Wk="DropdownMenuRadioGroup",eC=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=na(i);return e.jsx(Q0,{...u,...c,ref:n})});eC.displayName=Wk;var sC="DropdownMenuRadioItem",sN=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=na(i);return e.jsx(P0,{...u,...c,ref:n})});sN.displayName=sC;var tC="DropdownMenuItemIndicator",tN=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=na(i);return e.jsx(H0,{...u,...c,ref:n})});tN.displayName=tC;var aC="DropdownMenuSeparator",aN=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=na(i);return e.jsx(F0,{...u,...c,ref:n})});aN.displayName=aC;var lC="DropdownMenuArrow",nC=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=na(i);return e.jsx(Y0,{...u,...c,ref:n})});nC.displayName=lC;var rC="DropdownMenuSubTrigger",lN=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=na(i);return e.jsx(R0,{...u,...c,ref:n})});lN.displayName=rC;var iC="DropdownMenuSubContent",nN=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=na(i);return e.jsx(L0,{...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)"}})});nN.displayName=iC;var cC=Vv,oC=Qv,dC=Yv,rN=Xv,iN=Zv,cN=Wv,oN=eN,dN=sN,uN=tN,mN=aN,xN=lN,hN=nN;const uC=cC,mC=oC,xC=m.forwardRef(({className:l,inset:n,children:i,...c},u)=>e.jsxs(xN,{ref:u,className:B("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(ha,{className:"ml-auto h-4 w-4"})]}));xC.displayName=xN.displayName;const hC=m.forwardRef(({className:l,...n},i)=>e.jsx(hN,{ref:i,className:B("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}));hC.displayName=hN.displayName;const fN=m.forwardRef(({className:l,sideOffset:n=4,...i},c)=>e.jsx(dC,{children:e.jsx(rN,{ref:c,sideOffset:n,className:B("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})}));fN.displayName=rN.displayName;const pN=m.forwardRef(({className:l,inset:n,...i},c)=>e.jsx(cN,{ref:c,className:B("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}));pN.displayName=cN.displayName;const fC=m.forwardRef(({className:l,children:n,checked:i,...c},u)=>e.jsxs(oN,{ref:u,className:B("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(uN,{children:e.jsx(wt,{className:"h-4 w-4"})})}),n]}));fC.displayName=oN.displayName;const pC=m.forwardRef(({className:l,children:n,...i},c)=>e.jsxs(dN,{ref:c,className:B("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(uN,{children:e.jsx(Tj,{className:"h-2 w-2 fill-current"})})}),n]}));pC.displayName=dN.displayName;const gC=m.forwardRef(({className:l,inset:n,...i},c)=>e.jsx(iN,{ref:c,className:B("px-2 py-1.5 text-sm font-semibold",n&&"pl-8",l),...i}));gC.displayName=iN.displayName;const jC=m.forwardRef(({className:l,...n},i)=>e.jsx(mN,{ref:i,className:B("-mx-1 my-1 h-px bg-muted",l),...n}));jC.displayName=mN.displayName;const gN=({className:l,...n})=>e.jsx("nav",{role:"navigation","aria-label":"pagination",className:B("mx-auto flex w-full justify-center",l),...n});gN.displayName="Pagination";const jN=m.forwardRef(({className:l,...n},i)=>e.jsx("ul",{ref:i,className:B("flex flex-row items-center gap-1",l),...n}));jN.displayName="PaginationContent";const To=m.forwardRef(({className:l,...n},i)=>e.jsx("li",{ref:i,className:B("",l),...n}));To.displayName="PaginationItem";const Wo=({className:l,isActive:n,size:i="icon",...c})=>e.jsx("a",{"aria-current":n?"page":void 0,className:B(Br({variant:n?"outline":"ghost",size:i}),l),...c});Wo.displayName="PaginationLink";const vN=({className:l,...n})=>e.jsxs(Wo,{"aria-label":"Go to previous page",size:"default",className:B("gap-1 pl-2.5",l),...n,children:[e.jsx(ll,{className:"h-4 w-4"}),e.jsx("span",{children:"上一页"})]});vN.displayName="PaginationPrevious";const NN=({className:l,...n})=>e.jsxs(Wo,{"aria-label":"Go to next page",size:"default",className:B("gap-1 pr-2.5",l),...n,children:[e.jsx("span",{children:"下一页"}),e.jsx(ha,{className:"h-4 w-4"})]});NN.displayName="PaginationNext";const Cm=[{value:"created_at",label:"最新发布",icon:kl},{value:"downloads",label:"下载最多",icon:Xt},{value:"likes",label:"最受欢迎",icon:Ao}];function vC(){const l=la(),[n,i]=m.useState([]),[c,u]=m.useState(!0),[x,h]=m.useState(""),[f,p]=m.useState("downloads"),[g,N]=m.useState(1),[v,y]=m.useState(1),[w,b]=m.useState(0),[O,A]=m.useState(new Set),[_,I]=m.useState(new Set),E=uv(),C=m.useCallback(async()=>{u(!0);try{const G=await U_({status:"approved",page:g,page_size:12,search:x||void 0,sort_by:f,sort_order:"desc"});i(G.packs),y(G.total_pages),b(G.total);const me=new Set;for(const ce of G.packs)await dv(ce.id,E)&&me.add(ce.id);A(me)}catch(G){console.error("加载 Pack 列表失败:",G),qt({title:"加载 Pack 列表失败",variant:"destructive"})}finally{u(!1)}},[g,x,f,E]);m.useEffect(()=>{C()},[C]);const M=G=>{G.preventDefault(),N(1),C()},F=async G=>{if(!_.has(G)){I(me=>new Set(me).add(G));try{const me=await ov(G,E);A(ce=>{const Ne=new Set(ce);return me.liked?Ne.add(G):Ne.delete(G),Ne}),i(ce=>ce.map(Ne=>Ne.id===G?{...Ne,likes:me.likes}:Ne))}catch(me){console.error("点赞失败:",me),qt({title:"点赞失败",variant:"destructive"})}finally{I(me=>{const ce=new Set(me);return ce.delete(G),ce})}}},D=G=>{l({to:"/config/pack-market/$packId",params:{packId:G}})},se=Cm.find(G=>G.value===f)||Cm[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(ea,{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(k,{variant:"outline",onClick:C,disabled:c,className:"gap-2",children:[e.jsx(_t,{className:`h-4 w-4 ${c?"animate-spin":""}`}),"刷新"]})]})}),e.jsx(ss,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-4 flex-wrap",children:[e.jsx("form",{onSubmit:M,className:"flex-1 min-w-[200px] max-w-md",children:e.jsxs("div",{className:"relative",children:[e.jsx(Qt,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(re,{placeholder:"搜索模板名称、描述...",value:x,onChange:G=>h(G.target.value),className:"pl-10"})]})}),e.jsxs(uC,{children:[e.jsx(mC,{asChild:!0,children:e.jsxs(k,{variant:"outline",className:"min-w-[140px] gap-2",children:[e.jsx(e1,{className:"w-4 h-4"}),se.label,e.jsx(Sa,{className:"w-4 h-4 ml-auto"})]})}),e.jsx(fN,{align:"end",children:Cm.map(G=>e.jsxs(pN,{onClick:()=>{p(G.value),N(1)},children:[e.jsx(G.icon,{className:"w-4 h-4 mr-2"}),G.label]},G.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((G,me)=>e.jsxs(De,{children:[e.jsxs(Xe,{children:[e.jsx(Ys,{className:"h-6 w-3/4"}),e.jsx(Ys,{className:"h-4 w-full mt-2"})]}),e.jsx(Ke,{children:e.jsx(Ys,{className:"h-20 w-full"})}),e.jsx(Go,{children:e.jsx(Ys,{className:"h-9 w-full"})})]},me))}):n.length===0?e.jsx(De,{className:"py-12",children:e.jsxs(Ke,{className:"text-center text-muted-foreground",children:[e.jsx(ea,{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(G=>e.jsx(NC,{pack:G,liked:O.has(G.id),liking:_.has(G.id),onLike:()=>F(G.id),onView:()=>D(G.id)},G.id))}),v>1&&e.jsx(gN,{children:e.jsxs(jN,{children:[e.jsx(To,{children:e.jsx(vN,{onClick:()=>N(G=>Math.max(1,G-1)),className:g===1?"pointer-events-none opacity-50":"cursor-pointer"})}),Array.from({length:v},(G,me)=>me+1).filter(G=>G===1||G===v||Math.abs(G-g)<=1).map((G,me,ce)=>{const Ne=me>0&&G-ce[me-1]>1;return e.jsxs(To,{children:[Ne&&e.jsx("span",{className:"px-2",children:"..."}),e.jsx(Wo,{onClick:()=>N(G),isActive:G===g,className:"cursor-pointer",children:G})]},G)}),e.jsx(To,{children:e.jsx(NN,{onClick:()=>N(G=>Math.min(v,G+1)),className:g===v?"pointer-events-none opacity-50":"cursor-pointer"})})]})})]})})]})}function NC({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(De,{className:"flex flex-col hover:shadow-md transition-shadow",children:[e.jsxs(Xe,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx(es,{className:"text-lg line-clamp-1",children:l.name}),e.jsxs(Ae,{variant:"secondary",className:"text-xs",children:["v",l.version]})]}),e.jsx(Gs,{className:"line-clamp-2 min-h-[40px]",children:l.description})]}),e.jsxs(Ke,{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(Rn,{className:"w-3.5 h-3.5"}),l.author]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(kl,{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(Tl,{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(Un,{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(Bn,{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(Ae,{variant:"outline",className:"text-xs",children:[e.jsx(Po,{className:"w-2.5 h-2.5 mr-1"}),h]},h)),l.tags.length>3&&e.jsxs(Ae,{variant:"outline",className:"text-xs",children:["+",l.tags.length-3]})]})]}),e.jsx(Go,{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(Xt,{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(Ao,{className:`w-4 h-4 ${n?"fill-current":""}`}),l.likes]})]}),e.jsx(k,{size:"sm",onClick:u,children:"查看详情"})]})})]})}var Qa="Accordion",bC=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[ex,yC,wC]=ww(Qa),[ed]=$o(Qa,[wC,Kg]),sx=Kg(),bN=Ms.forwardRef((l,n)=>{const{type:i,...c}=l,u=c,x=c;return e.jsx(ex.Provider,{scope:l.__scopeAccordion,children:i==="multiple"?e.jsx(CC,{...x,ref:n}):e.jsx(kC,{...u,ref:n})})});bN.displayName=Qa;var[yN,_C]=ed(Qa),[wN,SC]=ed(Qa,{collapsible:!1}),kC=Ms.forwardRef((l,n)=>{const{value:i,defaultValue:c,onValueChange:u=()=>{},collapsible:x=!1,...h}=l,[f,p]=Bo({prop:i,defaultProp:c??"",onChange:u,caller:Qa});return e.jsx(yN,{scope:l.__scopeAccordion,value:Ms.useMemo(()=>f?[f]:[],[f]),onItemOpen:p,onItemClose:Ms.useCallback(()=>x&&p(""),[x,p]),children:e.jsx(wN,{scope:l.__scopeAccordion,collapsible:x,children:e.jsx(_N,{...h,ref:n})})})}),CC=Ms.forwardRef((l,n)=>{const{value:i,defaultValue:c,onValueChange:u=()=>{},...x}=l,[h,f]=Bo({prop:i,defaultProp:c??[],onChange:u,caller:Qa}),p=Ms.useCallback(N=>f((v=[])=>[...v,N]),[f]),g=Ms.useCallback(N=>f((v=[])=>v.filter(y=>y!==N)),[f]);return e.jsx(yN,{scope:l.__scopeAccordion,value:h,onItemOpen:p,onItemClose:g,children:e.jsx(wN,{scope:l.__scopeAccordion,collapsible:!0,children:e.jsx(_N,{...x,ref:n})})})}),[TC,sd]=ed(Qa),_N=Ms.forwardRef((l,n)=>{const{__scopeAccordion:i,disabled:c,dir:u,orientation:x="vertical",...h}=l,f=Ms.useRef(null),p=Io(f,n),g=yC(i),v=ij(u)==="ltr",y=cn(l.onKeyDown,w=>{if(!bC.includes(w.key))return;const b=w.target,O=g().filter(se=>!se.ref.current?.disabled),A=O.findIndex(se=>se.ref.current===b),_=O.length;if(A===-1)return;w.preventDefault();let I=A;const E=0,C=_-1,M=()=>{I=A+1,I>C&&(I=E)},F=()=>{I=A-1,I{const{__scopeAccordion:i,value:c,...u}=l,x=sd(Uo,i),h=_C(Uo,i),f=sx(i),p=Tm(),g=c&&h.value.includes(c)||!1,N=x.disabled||l.disabled;return e.jsx(EC,{scope:i,open:g,disabled:N,triggerId:p,children:e.jsx(Hg,{"data-orientation":x.orientation,"data-state":AN(g),...f,...u,ref:n,disabled:N,open:g,onOpenChange:v=>{v?h.onItemOpen(c):h.onItemClose(c)}})})});SN.displayName=Uo;var kN="AccordionHeader",CN=Ms.forwardRef((l,n)=>{const{__scopeAccordion:i,...c}=l,u=sd(Qa,i),x=tx(kN,i);return e.jsx(Hn.h3,{"data-orientation":u.orientation,"data-state":AN(x.open),"data-disabled":x.disabled?"":void 0,...c,ref:n})});CN.displayName=kN;var Lm="AccordionTrigger",TN=Ms.forwardRef((l,n)=>{const{__scopeAccordion:i,...c}=l,u=sd(Qa,i),x=tx(Lm,i),h=SC(Lm,i),f=sx(i);return e.jsx(ex.ItemSlot,{scope:i,children:e.jsx(J0,{"aria-disabled":x.open&&!h.collapsible||void 0,"data-orientation":u.orientation,id:x.triggerId,...f,...c,ref:n})})});TN.displayName=Lm;var EN="AccordionContent",MN=Ms.forwardRef((l,n)=>{const{__scopeAccordion:i,...c}=l,u=sd(Qa,i),x=tx(EN,i),h=sx(i);return e.jsx(X0,{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}})});MN.displayName=EN;function AN(l){return l?"open":"closed"}var MC=bN,AC=SN,zC=CN,zN=TN,DN=MN;const DC=MC,ON=m.forwardRef(({className:l,...n},i)=>e.jsx(AC,{ref:i,className:B("border-b",l),...n}));ON.displayName="AccordionItem";const RN=m.forwardRef(({className:l,children:n,...i},c)=>e.jsx(zC,{className:"flex",children:e.jsxs(zN,{ref:c,className:B("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(Sa,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));RN.displayName=zN.displayName;const LN=m.forwardRef(({className:l,children:n,...i},c)=>e.jsx(DN,{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:B("pb-4 pt-0",l),children:n})}));LN.displayName=DN.displayName;const OC={utils:"通用工具",utils_small:"轻量工具",tool_use:"工具调用",replyer:"回复生成",planner:"规划推理",vlm:"视觉模型",voice:"语音处理",embedding:"向量嵌入",lpmm_entity_extract:"实体提取",lpmm_rdf_build:"RDF构建",lpmm_qa:"问答模型"};function RC(){const{packId:l}=HN.useParams(),n=la(),[i,c]=m.useState(null),[u,x]=m.useState(!0),[h,f]=m.useState(!1),[p,g]=m.useState(!1),[N,v]=m.useState(!1),[y,w]=m.useState(1),[b,O]=m.useState(null),[A,_]=m.useState(!1),[I,E]=m.useState(!1),[C,M]=m.useState({apply_providers:!0,apply_models:!0,apply_task_config:!0,task_mode:"append",selected_providers:void 0,selected_models:void 0,selected_tasks:void 0}),[F,D]=m.useState({}),[se,G]=m.useState({}),me=uv(),ce=m.useCallback(async()=>{if(l){x(!0);try{const z=await B_(l);c(z);const q=await dv(l,me);f(q)}catch(z){console.error("加载 Pack 失败:",z),qt({title:"加载模板失败",variant:"destructive"})}finally{x(!1)}}},[l,me]);m.useEffect(()=>{ce()},[ce]);const Ne=async()=>{if(!(!l||p)){g(!0);try{const z=await ov(l,me);f(z.liked),i&&c({...i,likes:z.likes})}catch(z){console.error("点赞失败:",z),qt({title:"点赞失败",variant:"destructive"})}finally{g(!1)}}},le=async()=>{if(i){v(!0),w(1),_(!0);try{const z=await H_(i);O(z);const q={};for(const L of z.existing_providers)q[L.pack_provider.name]=L.local_providers[0].name;D(q);const U={};for(const L of z.new_providers)U[L.name]="";G(U)}catch(z){console.error("检测冲突失败:",z),qt({title:"检测配置冲突失败",variant:"destructive"}),v(!1)}finally{_(!1)}}},ge=async()=>{if(i){if(C.apply_providers&&b){for(const z of b.new_providers)if(!se[z.name]){qt({title:`请填写提供商 "${z.name}" 的 API Key`,variant:"destructive"});return}}E(!0);try{await P_(i,C,F,se),await I_(i.id,me),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{E(!1)}}},be=z=>new Date(z).toLocaleDateString("zh-CN",{year:"numeric",month:"long",day:"numeric"});return u?e.jsx(UC,{}):i?e.jsx("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:e.jsx(ss,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsxs(k,{variant:"ghost",size:"sm",onClick:()=>n({to:"/config/pack-market"}),className:"gap-2",children:[e.jsx(Va,{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(ea,{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(Ae,{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(Rn,{className:"w-4 h-4"}),i.author]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(kl,{className:"w-4 h-4"}),be(i.created_at)]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Xt,{className:"w-4 h-4"}),i.downloads," 次下载"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Ao,{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(Ae,{variant:"outline",children:[e.jsx(Po,{className:"w-3 h-3 mr-1"}),z]},z))})]}),e.jsxs("div",{className:"flex flex-col gap-2 min-w-[160px]",children:[e.jsxs(k,{size:"lg",onClick:le,children:[e.jsx(Xt,{className:"w-4 h-4 mr-2"}),"应用模板"]}),e.jsxs(k,{variant:"outline",onClick:Ne,disabled:p,className:h?"text-red-500 border-red-200":"",children:[e.jsx(Ao,{className:`w-4 h-4 mr-2 ${h?"fill-current":""}`}),h?"已点赞":"点赞"]})]})]}),e.jsx(Pr,{}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx(De,{children:e.jsxs(Ke,{className:"flex items-center gap-3 py-4",children:[e.jsx(Tl,{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(De,{children:e.jsxs(Ke,{className:"flex items-center gap-3 py-4",children:[e.jsx(Un,{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(De,{children:e.jsxs(Ke,{className:"flex items-center gap-3 py-4",children:[e.jsx(Bn,{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(xa,{defaultValue:"providers",className:"space-y-4",children:[e.jsxs(aa,{children:[e.jsxs(ls,{value:"providers",children:[e.jsx(Tl,{className:"w-4 h-4 mr-2"}),"提供商 (",i.providers.length,")"]}),e.jsxs(ls,{value:"models",children:[e.jsx(Un,{className:"w-4 h-4 mr-2"}),"模型 (",i.models.length,")"]}),e.jsxs(ls,{value:"tasks",children:[e.jsx(Bn,{className:"w-4 h-4 mr-2"}),"任务配置 (",Object.keys(i.task_config).length,")"]})]}),e.jsx(ws,{value:"providers",children:e.jsxs(De,{children:[e.jsxs(Xe,{children:[e.jsx(es,{children:"API 提供商"}),e.jsx(Gs,{children:"模板中包含的 API 提供商配置(不含 API Key)"})]}),e.jsx(Ke,{children:e.jsxs(El,{children:[e.jsx(Ml,{children:e.jsxs(ct,{children:[e.jsx(Ye,{children:"名称"}),e.jsx(Ye,{children:"Base URL"}),e.jsx(Ye,{children:"类型"})]})}),e.jsx(Al,{children:i.providers.map(z=>e.jsxs(ct,{children:[e.jsx(Ge,{className:"font-medium",children:z.name}),e.jsx(Ge,{className:"text-muted-foreground font-mono text-sm",children:z.base_url}),e.jsx(Ge,{children:e.jsx(Ae,{variant:"outline",children:z.client_type})})]},z.name))})]})})]})}),e.jsx(ws,{value:"models",children:e.jsxs(De,{children:[e.jsxs(Xe,{children:[e.jsx(es,{children:"模型配置"}),e.jsx(Gs,{children:"模板中包含的模型配置"})]}),e.jsx(Ke,{children:e.jsxs(El,{children:[e.jsx(Ml,{children:e.jsxs(ct,{children:[e.jsx(Ye,{children:"模型名称"}),e.jsx(Ye,{children:"标识符"}),e.jsx(Ye,{children:"提供商"}),e.jsx(Ye,{className:"text-right",children:"价格 (入/出)"})]})}),e.jsx(Al,{children:i.models.map(z=>e.jsxs(ct,{children:[e.jsx(Ge,{className:"font-medium",children:z.name}),e.jsx(Ge,{className:"text-muted-foreground font-mono text-sm",children:z.model_identifier}),e.jsx(Ge,{children:z.api_provider}),e.jsxs(Ge,{className:"text-right text-muted-foreground",children:["¥",z.price_in," / ¥",z.price_out]})]},z.name))})]})})]})}),e.jsx(ws,{value:"tasks",children:e.jsxs(De,{children:[e.jsxs(Xe,{children:[e.jsx(es,{children:"任务配置"}),e.jsx(Gs,{children:"模板中各任务类型的模型分配"})]}),e.jsx(Ke,{children:e.jsx(DC,{type:"multiple",className:"w-full",children:Object.entries(i.task_config).map(([z,q])=>e.jsxs(ON,{value:z,children:[e.jsx(RN,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(dn,{className:"w-4 h-4"}),OC[z]||z,e.jsxs(Ae,{variant:"secondary",className:"ml-2",children:[q.model_list.length," 个模型"]})]})}),e.jsx(LN,{children:e.jsxs("div",{className:"space-y-2 pl-6",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"分配的模型:"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:q.model_list.map(U=>e.jsx(Ae,{variant:"outline",children:U},U))}),q.temperature!==void 0&&e.jsxs("div",{className:"text-sm",children:["Temperature: ",e.jsx("span",{className:"font-mono",children:q.temperature})]}),q.max_tokens!==void 0&&e.jsxs("div",{className:"text-sm",children:["Max Tokens: ",e.jsx("span",{className:"font-mono",children:q.max_tokens})]})]})})]},z))})})]})})]}),e.jsx(LC,{open:N,onOpenChange:v,pack:i,step:y,setStep:w,conflicts:b,detectingConflicts:A,applying:I,options:C,setOptions:M,_providerMapping:F,_setProviderMapping:D,newProviderApiKeys:se,setNewProviderApiKeys:G,onApply:ge})]})})}):e.jsxs("div",{className:"text-center py-12",children:[e.jsx(ea,{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(k,{className:"mt-4",onClick:()=>n({to:"/config/pack-market"}),children:[e.jsx(Va,{className:"w-4 h-4 mr-2"}),"返回市场"]})]})}function LC({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(Fs,{open:l,onOpenChange:n,children:e.jsxs(Bs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs($s,{children:[e.jsxs(Is,{className:"flex items-center gap-2",children:[e.jsx(ea,{className:"w-5 h-5"}),"应用配置模板"]}),e.jsxs(tt,{children:["步骤 ",c," / ",3,":",c===1&&"选择要应用的内容",c===2&&"配置提供商映射",c===3&&"确认并应用"]})]}),h?e.jsxs("div",{className:"py-8 text-center",children:[e.jsx(Os,{className:"w-8 h-8 mx-auto animate-spin text-primary"}),e.jsx("p",{className:"mt-4 text-muted-foreground",children:"正在检测配置冲突..."})]}):e.jsxs(e.Fragment,{children:[c===1&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Js,{id:"apply_providers",checked:p.apply_providers,onCheckedChange:A=>g({...p,apply_providers:A})}),e.jsxs(T,{htmlFor:"apply_providers",className:"flex items-center gap-2",children:[e.jsx(Tl,{className:"w-4 h-4"}),"应用提供商配置 (",i.providers.length," 个)"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Js,{id:"apply_models",checked:p.apply_models,onCheckedChange:A=>g({...p,apply_models:A})}),e.jsxs(T,{htmlFor:"apply_models",className:"flex items-center gap-2",children:[e.jsx(Un,{className:"w-4 h-4"}),"应用模型配置 (",i.models.length," 个)"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Js,{id:"apply_task_config",checked:p.apply_task_config,onCheckedChange:A=>g({...p,apply_task_config:A})}),e.jsxs(T,{htmlFor:"apply_task_config",className:"flex items-center gap-2",children:[e.jsx(Bn,{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(Wm,{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(Lo,{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(Lo,{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(rt,{children:[e.jsx(Kt,{className:"h-4 w-4"}),e.jsx(Dn,{children:"发现已有的提供商"}),e.jsx(it,{children:"以下提供商的 URL 与您本地配置中的提供商匹配,将自动使用本地提供商:"})]}),e.jsx("div",{className:"space-y-2",children:x.existing_providers.map(({pack_provider:A,local_providers:_})=>e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-lg",children:[e.jsx(wt,{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(ha,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),_.length===1?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-muted-foreground",children:_[0].name}),e.jsx(Ae,{variant:"outline",className:"ml-auto",children:"URL 匹配"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(Be,{value:N[A.name]||_[0].name,onValueChange:I=>v({...N,[A.name]:I}),children:[e.jsx(Le,{className:"w-[200px]",children:e.jsx($e,{})}),e.jsx(Ue,{children:_.map(I=>e.jsx(ee,{value:I.name,children:I.name},I.name))})]}),e.jsxs(Ae,{variant:"outline",className:"ml-auto",children:[_.length," 个匹配"]})]})]},A.name))})]}),p.apply_providers&&x.new_providers.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs(rt,{variant:"destructive",children:[e.jsx(Vt,{className:"h-4 w-4"}),e.jsx(Dn,{children:"需要配置 API Key"}),e.jsx(it,{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(Um,{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(re,{type:"password",placeholder:`输入 ${A.name} 的 API Key`,value:y[A.name]||"",onChange:_=>w({...y,[A.name]:_.target.value})})]},A.name))})]}),(!p.apply_providers||x.existing_providers.length===0&&x.new_providers.length===0)&&e.jsxs(rt,{children:[e.jsx(wt,{className:"h-4 w-4"}),e.jsx(Dn,{children:"无需配置"}),e.jsx(it,{children:"模板中没有提供商配置,或您选择不应用提供商。"})]})]}),c===3&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(rt,{children:[e.jsx(Kt,{className:"h-4 w-4"}),e.jsx(Dn,{children:"确认应用"}),e.jsx(it,{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(wt,{className:"w-4 h-4 text-green-500"}),e.jsx(Tl,{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(wt,{className:"w-4 h-4 text-green-500"}),e.jsx(Un,{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(wt,{className:"w-4 h-4 text-green-500"}),e.jsx(Bn,{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(rt,{variant:"destructive",children:[e.jsx(Vt,{className:"h-4 w-4"}),e.jsxs(it,{children:["将添加 ",x.new_providers.length," 个新提供商,请确保已填写正确的 API Key。"]})]})]})]}),e.jsxs(ot,{className:"flex justify-between",children:[e.jsx("div",{children:c>1&&!h&&e.jsx(k,{variant:"outline",onClick:()=>u(c-1),disabled:f,children:"上一步"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(k,{variant:"outline",onClick:()=>n(!1),disabled:f,children:"取消"}),c<3?e.jsx(k,{onClick:()=>u(c+1),disabled:h,children:"下一步"}):e.jsxs(k,{onClick:b,disabled:f,children:[f&&e.jsx(Os,{className:"w-4 h-4 mr-2 animate-spin"}),"应用模板"]})]})]})]})})}function UC(){return e.jsx("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:e.jsx(ss,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsx(Ys,{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(Ys,{className:"w-10 h-10"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(Ys,{className:"h-8 w-2/3"}),e.jsx(Ys,{className:"h-4 w-full"})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-4",children:[e.jsx(Ys,{className:"h-4 w-24"}),e.jsx(Ys,{className:"h-4 w-32"}),e.jsx(Ys,{className:"h-4 w-28"}),e.jsx(Ys,{className:"h-4 w-20"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(Ys,{className:"h-6 w-20"}),e.jsx(Ys,{className:"h-6 w-24"}),e.jsx(Ys,{className:"h-6 w-16"})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 min-w-[160px]",children:[e.jsx(Ys,{className:"h-10 w-full"}),e.jsx(Ys,{className:"h-10 w-full"})]})]}),e.jsx(Ys,{className:"h-px w-full"}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx(Ys,{className:"h-24"}),e.jsx(Ys,{className:"h-24"}),e.jsx(Ys,{className:"h-24"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Ys,{className:"h-10 w-32"}),e.jsx(Ys,{className:"h-10 w-32"}),e.jsx(Ys,{className:"h-10 w-32"})]}),e.jsx(Ys,{className:"h-96 w-full"})]})]})})})}function BC(){const l=la(),[n,i]=m.useState(!0);return m.useEffect(()=>{let c=!1;return(async()=>{try{const x=await Qi();!c&&!x&&l({to:"/auth"})}catch{c||l({to:"/auth"})}finally{c||i(!1)}})(),()=>{c=!0}},[l]),{checking:n}}async function $C(){return await Qi()}const IC=$r("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"}}),UN=m.forwardRef(({className:l,size:n,abbrTitle:i,children:c,...u},x)=>e.jsx("kbd",{className:B(IC({size:n,className:l})),ref:x,...u,children:i?e.jsx("abbr",{title:i,children:c}):c}));UN.displayName="Kbd";const HC=[{icon:Ho,title:"首页",description:"查看仪表板概览",path:"/",category:"概览"},{icon:qa,title:"麦麦主程序配置",description:"配置麦麦的核心设置",path:"/config/bot",category:"配置"},{icon:Tl,title:"麦麦模型提供商配置",description:"配置模型提供商",path:"/config/modelProvider",category:"配置"},{icon:Mj,title:"麦麦模型配置",description:"配置模型参数",path:"/config/model",category:"配置"},{icon:Bm,title:"表情包管理",description:"管理麦麦的表情包",path:"/resource/emoji",category:"资源"},{icon:on,title:"表达方式管理",description:"管理麦麦的表达方式",path:"/resource/expression",category:"资源"},{icon:Aj,title:"人物信息管理",description:"管理人物信息",path:"/resource/person",category:"资源"},{icon:Ur,title:"黑话管理",description:"管理麦麦学习到的黑话和俚语",path:"/resource/jargon",category:"资源"},{icon:s1,title:"统计信息",description:"查看使用统计",path:"/statistics",category:"监控"},{icon:ea,title:"插件市场",description:"浏览和安装插件",path:"/plugins",category:"扩展"},{icon:$m,title:"日志查看器",description:"查看系统日志",path:"/logs",category:"监控"},{icon:dn,title:"系统设置",description:"配置系统参数",path:"/settings",category:"系统"}];function PC({open:l,onOpenChange:n}){const[i,c]=m.useState(""),[u,x]=m.useState(0),h=la(),f=HC.filter(N=>N.title.toLowerCase().includes(i.toLowerCase())||N.description.toLowerCase().includes(i.toLowerCase())||N.category.toLowerCase().includes(i.toLowerCase())),p=m.useCallback(N=>{h({to:N}),n(!1),c(""),x(0)},[h,n]),g=m.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(Fs,{open:l,onOpenChange:n,children:e.jsxs(Bs,{className:"max-w-2xl p-0 gap-0",children:[e.jsxs($s,{className:"px-4 pt-4 pb-0",children:[e.jsx(Is,{className:"sr-only",children:"搜索"}),e.jsxs("div",{className:"relative",children:[e.jsx(Qt,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground"}),e.jsx(re,{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(ss,{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:B("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(Qt,{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 GC(){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]=m.useState(l&&!i&&!c),[h,f]=m.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(Vt,{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(k,{variant:"ghost",size:"icon",onClick:p,className:"h-8 w-8 text-amber-700 hover:text-amber-900 dark:text-amber-400 dark:hover:text-amber-200 flex-shrink-0","aria-label":"关闭警告",children:e.jsx(_a,{className:"h-4 w-4"})})]})})})}function FC(){const[l,n]=m.useState(0),[i,c]=m.useState(!1),u=m.useRef(null);m.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:B("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(k,{variant:"outline",size:"icon",className:B("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(t1,{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 qC=Sw,VC=kw,KC=Cw,BN=m.forwardRef(({className:l,sideOffset:n=4,...i},c)=>e.jsx(_w,{children:e.jsx(cj,{ref:c,sideOffset:n,className:B("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})}));BN.displayName=cj.displayName;function QC({children:l}){const{checking:n}=BC(),[i,c]=m.useState(!0),[u,x]=m.useState(!1),[h,f]=m.useState(!1),{theme:p,setTheme:g}=Hm(),N=n0();if(m.useEffect(()=>{const O=A=>{(A.metaKey||A.ctrlKey)&&A.key==="k"&&(A.preventDefault(),f(!0))};return window.addEventListener("keydown",O),()=>window.removeEventListener("keydown",O)},[]),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:Ho,label:"首页",path:"/"}]},{title:"麦麦配置编辑",items:[{icon:qa,label:"麦麦主程序配置",path:"/config/bot"},{icon:Tl,label:"AI模型厂商配置",path:"/config/modelProvider",tourId:"sidebar-model-provider"},{icon:Mj,label:"模型管理与分配",path:"/config/model",tourId:"sidebar-model-management"},{icon:Jp,label:"麦麦适配器配置",path:"/config/adapter"}]},{title:"麦麦资源管理",items:[{icon:Bm,label:"表情包管理",path:"/resource/emoji"},{icon:on,label:"表达方式管理",path:"/resource/expression"},{icon:Ur,label:"黑话管理",path:"/resource/jargon"},{icon:Aj,label:"人物信息管理",path:"/resource/person"},{icon:Sj,label:"知识库图谱可视化",path:"/resource/knowledge-graph"},{icon:Rr,label:"麦麦知识库管理",path:"/resource/knowledge-base"}]},{title:"扩展与监控",items:[{icon:ea,label:"插件市场",path:"/plugins"},{icon:Cj,label:"配置模板市场",path:"/config/pack-market"},{icon:Jp,label:"插件配置",path:"/plugin-config"},{icon:$m,label:"日志查看器",path:"/logs"},{icon:on,label:"本地聊天室",path:"/chat"}]},{title:"系统",items:[{icon:dn,label:"系统设置",path:"/settings"}]}],w=p==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":p,b=async()=>{await U1()};return e.jsx(qC,{delayDuration:300,children:e.jsxs("div",{className:"flex h-screen overflow-hidden",children:[e.jsxs("aside",{className:B("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:B("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:B("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:i2()})]}),!i&&e.jsx("span",{className:"hidden lg:block font-bold text-primary-gradient text-2xl",children:"M"})]})}),e.jsx(ss,{className:B("flex-1 overflow-x-hidden",!i&&"lg:w-16"),children:e.jsx("nav",{className:B("p-4",!i&&"lg:p-2 lg:w-16"),children:e.jsx("ul",{className:B("space-y-6",!i&&"lg:space-y-3 lg:w-full"),children:v.map((O,A)=>e.jsxs("li",{children:[e.jsx("div",{className:B("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:O.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:O.items.map(_=>{const I=N({to:_.path}),E=_.icon,C=e.jsxs(e.Fragment,{children:[I&&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:B("flex items-center transition-all duration-300",i?"gap-3":"gap-3 lg:gap-0"),children:[e.jsx(E,{className:B("h-5 w-5 flex-shrink-0",I&&"text-primary"),strokeWidth:2,fill:"none"}),e.jsx("span",{className:B("text-sm font-medium whitespace-nowrap transition-all duration-300",I&&"font-semibold",i?"opacity-100 max-w-[200px]":"opacity-100 max-w-[200px] lg:opacity-0 lg:max-w-0 lg:overflow-hidden"),children:_.label})]})]});return e.jsx("li",{className:"relative",children:e.jsxs(VC,{children:[e.jsx(KC,{asChild:!0,children:e.jsx(Mr,{to:_.path,"data-tour":_.tourId,className:B("relative flex items-center rounded-lg py-2 transition-all duration-300","hover:bg-accent hover:text-accent-foreground",I?"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(BN,{side:"right",className:"hidden lg:block",children:e.jsx("p",{children:_.label})})]})},_.path)})})]},O.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(GC,{}),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(a1,{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(ll,{className:B("h-5 w-5 transition-transform",!i&&"rotate-180")})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[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(Qt,{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(UN,{size:"sm",className:"absolute right-2 top-1/2 -translate-y-1/2",children:[e.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),e.jsx(PC,{open:h,onOpenChange:f}),e.jsxs(k,{variant:"ghost",size:"sm",onClick:()=>window.open("https://docs.mai-mai.org","_blank"),className:"gap-2",title:"查看麦麦文档",children:[e.jsx(l1,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"麦麦文档"})]}),e.jsx("button",{onClick:O=>{Z1(w==="dark"?"light":"dark",g,O)},className:"rounded-lg p-2 hover:bg-accent",title:w==="dark"?"切换到浅色模式":"切换到深色模式",children:w==="dark"?e.jsx(gj,{className:"h-5 w-5"}):e.jsx(jj,{className:"h-5 w-5"})}),e.jsx("div",{className:"h-6 w-px bg-border"}),e.jsxs(k,{variant:"ghost",size:"sm",onClick:b,className:"gap-2",title:"登出系统",children:[e.jsx(n1,{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(FC,{})]})]})})}function YC(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 JC({error:l,errorInfo:n}){const[i,c]=m.useState(!0),[u,x]=m.useState(!1),[h,f]=m.useState(!1),p=l.stack?YC(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(rt,{variant:"destructive",className:"border-red-500/50 bg-red-500/10",children:[e.jsx(Vt,{className:"h-4 w-4"}),e.jsxs(it,{className:"font-mono text-sm",children:[e.jsxs("span",{className:"font-semibold",children:[l.name,":"]})," ",l.message]})]}),p.length>0&&e.jsxs(Xi,{open:i,onOpenChange:c,children:[e.jsx(Zi,{asChild:!0,children:e.jsxs(k,{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(r1,{className:"h-4 w-4"}),"Stack Trace (",p.length," frames)"]}),i?e.jsx(Lr,{className:"h-4 w-4"}):e.jsx(Sa,{className:"h-4 w-4"})]})}),e.jsx(Wi,{children:e.jsx(ss,{className:"h-[280px] rounded-md border bg-muted/30",children:e.jsx("div",{className:"p-3 space-y-1",children:p.map((N,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(Xi,{open:u,onOpenChange:x,children:[e.jsx(Zi,{asChild:!0,children:e.jsxs(k,{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(Vt,{className:"h-4 w-4"}),"Component Stack"]}),u?e.jsx(Lr,{className:"h-4 w-4"}):e.jsx(Sa,{className:"h-4 w-4"})]})}),e.jsx(Wi,{children:e.jsx(ss,{className:"h-[200px] rounded-md border bg-muted/30",children:e.jsx("pre",{className:"p-3 font-mono text-xs whitespace-pre-wrap text-muted-foreground",children:n.componentStack})})})]}),e.jsx(k,{variant:"outline",size:"sm",onClick:g,className:"w-full",children:h?e.jsxs(e.Fragment,{children:[e.jsx(wt,{className:"mr-2 h-4 w-4 text-green-500"}),"已复制到剪贴板"]}):e.jsxs(e.Fragment,{children:[e.jsx(Eo,{className:"mr-2 h-4 w-4"}),"复制错误信息"]})})]})}function $N({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(De,{className:"w-full max-w-2xl shadow-lg",children:[e.jsxs(Xe,{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(Vt,{className:"h-8 w-8 text-red-600 dark:text-red-400"})}),e.jsx(es,{className:"text-2xl font-bold",children:"页面出现了问题"}),e.jsx(Gs,{className:"text-base mt-2",children:"应用程序遇到了意外错误。您可以尝试刷新页面或返回首页。"})]}),e.jsxs(Ke,{className:"space-y-4",children:[e.jsx(JC,{error:l,errorInfo:n}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 pt-2",children:[e.jsxs(k,{onClick:c,className:"flex-1",children:[e.jsx(_t,{className:"mr-2 h-4 w-4"}),"刷新页面"]}),e.jsxs(k,{onClick:i,variant:"outline",className:"flex-1",children:[e.jsx(Ho,{className:"mr-2 h-4 w-4"}),"返回首页"]})]}),e.jsx("p",{className:"text-xs text-center text-muted-foreground pt-2",children:"如果问题持续存在,请将错误信息复制并反馈给开发者"})]})]})})}class XC extends m.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($N,{error:this.state.error,errorInfo:this.state.errorInfo}):this.props.children}}function IN({error:l}){return e.jsx($N,{error:l,errorInfo:null})}const lc=r0({component:()=>e.jsxs(e.Fragment,{children:[e.jsx(_g,{}),!1]}),beforeLoad:()=>{if(window.location.pathname==="/"&&!$C())throw c0({to:"/auth"})}}),ZC=Xs({getParentRoute:()=>lc,path:"/auth",component:_2}),WC=Xs({getParentRoute:()=>lc,path:"/setup",component:I2}),xt=Xs({getParentRoute:()=>lc,id:"protected",component:()=>e.jsx(QC,{children:e.jsx(_g,{})}),errorComponent:({error:l})=>e.jsx(IN,{error:l})}),e3=Xs({getParentRoute:()=>xt,path:"/",component:Q1}),s3=Xs({getParentRoute:()=>xt,path:"/config/bot",component:N_}),t3=Xs({getParentRoute:()=>xt,path:"/config/modelProvider",component:z_}),a3=Xs({getParentRoute:()=>xt,path:"/config/model",component:aS}),l3=Xs({getParentRoute:()=>xt,path:"/config/adapter",component:SS}),n3=Xs({getParentRoute:()=>xt,path:"/resource/emoji",component:QS}),r3=Xs({getParentRoute:()=>xt,path:"/resource/expression",component:r4}),i3=Xs({getParentRoute:()=>xt,path:"/resource/person",component:M4}),c3=Xs({getParentRoute:()=>xt,path:"/resource/jargon",component:N4}),o3=Xs({getParentRoute:()=>xt,path:"/resource/knowledge-graph",component:$4}),d3=Xs({getParentRoute:()=>xt,path:"/resource/knowledge-base",component:I4}),u3=Xs({getParentRoute:()=>xt,path:"/logs",component:P4}),m3=Xs({getParentRoute:()=>xt,path:"/chat",component:Ck}),x3=Xs({getParentRoute:()=>xt,path:"/plugins",component:ck}),h3=Xs({getParentRoute:()=>xt,path:"/plugin-detail",component:jk}),f3=Xs({getParentRoute:()=>xt,path:"/model-presets",component:dk}),p3=Xs({getParentRoute:()=>xt,path:"/plugin-config",component:xk}),g3=Xs({getParentRoute:()=>xt,path:"/plugin-mirrors",component:fk}),j3=Xs({getParentRoute:()=>xt,path:"/settings",component:g2}),v3=Xs({getParentRoute:()=>xt,path:"/config/pack-market",component:vC}),HN=Xs({getParentRoute:()=>xt,path:"/config/pack-market/$packId",component:RC}),N3=Xs({getParentRoute:()=>xt,path:"/survey/webui-feedback",component:Gk}),b3=Xs({getParentRoute:()=>xt,path:"/survey/maibot-feedback",component:Fk}),y3=Xs({getParentRoute:()=>lc,path:"*",component:ev}),w3=lc.addChildren([ZC,WC,xt.addChildren([e3,s3,t3,a3,l3,n3,r3,c3,i3,o3,d3,x3,h3,f3,p3,g3,u3,m3,j3,v3,HN,N3,b3]),y3]),_3=i0({routeTree:w3,defaultNotFoundComponent:ev,defaultErrorComponent:({error:l})=>e.jsx(IN,{error:l})});function S3({children:l,defaultTheme:n="system",storageKey:i="ui-theme",...c}){const[u,x]=m.useState(()=>localStorage.getItem(i)||n);m.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]),m.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(Qj.Provider,{...c,value:h,children:l})}function k3({children:l,defaultEnabled:n=!0,defaultWavesEnabled:i=!0,storageKey:c="enable-animations",wavesStorageKey:u="enable-waves-background"}){const[x,h]=m.useState(()=>{const N=localStorage.getItem(c);return N!==null?N==="true":n}),[f,p]=m.useState(()=>{const N=localStorage.getItem(u);return N!==null?N==="true":i});m.useEffect(()=>{const N=document.documentElement;x?N.classList.remove("no-animations"):N.classList.add("no-animations"),localStorage.setItem(c,String(x))},[x,c]),m.useEffect(()=>{localStorage.setItem(u,String(f))},[f,u]);const g={enableAnimations:x,setEnableAnimations:h,enableWavesBackground:f,setEnableWavesBackground:p};return e.jsx(Yj.Provider,{value:g,children:l})}const C3=Tw,PN=m.forwardRef(({className:l,...n},i)=>e.jsx(oj,{ref:i,className:B("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}));PN.displayName=oj.displayName;const T3=$r("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"}}),GN=m.forwardRef(({className:l,variant:n,...i},c)=>e.jsx(dj,{ref:c,className:B(T3({variant:n}),l),...i}));GN.displayName=dj.displayName;const E3=m.forwardRef(({className:l,...n},i)=>e.jsx(uj,{ref:i,className:B("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}));E3.displayName=uj.displayName;const FN=m.forwardRef(({className:l,...n},i)=>e.jsx(mj,{ref:i,className:B("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(_a,{className:"h-4 w-4"})}));FN.displayName=mj.displayName;const qN=m.forwardRef(({className:l,...n},i)=>e.jsx(xj,{ref:i,className:B("text-sm font-semibold [&+div]:text-xs",l),...n}));qN.displayName=xj.displayName;const VN=m.forwardRef(({className:l,...n},i)=>e.jsx(hj,{ref:i,className:B("text-sm opacity-90",l),...n}));VN.displayName=hj.displayName;function M3(){const{toasts:l}=Zs();return e.jsxs(C3,{children:[l.map(function({id:n,title:i,description:c,action:u,...x}){return e.jsxs(GN,{...x,children:[e.jsxs("div",{className:"grid gap-1",children:[i&&e.jsx(qN,{children:i}),c&&e.jsx(VN,{children:c})]}),u,e.jsx(FN,{})]},n)}),e.jsx(PN,{})]})}L1.createRoot(document.getElementById("root")).render(e.jsx(m.StrictMode,{children:e.jsx(XC,{children:e.jsx(S3,{defaultTheme:"system",children:e.jsx(k3,{children:e.jsxs(k_,{children:[e.jsx(o0,{router:_3}),e.jsx(E_,{}),e.jsx(M3,{})]})})})})})); diff --git a/webui/dist/assets/index-BsyShrYm.css b/webui/dist/assets/index-BsyShrYm.css new file mode 100644 index 00000000..358829bb --- /dev/null +++ b/webui/dist/assets/index-BsyShrYm.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-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-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-\[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-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-\[100px\]{max-width:100px}.max-w-\[150px\]{max-width:150px}.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}.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-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-\[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-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-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\/10{background-color:#eab3081a}.bg-yellow-500\/5{background-color:#eab3080d}.bg-yellow-900\/20{background-color:#713f1233}.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-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-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-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-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-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-500{--tw-gradient-to: #a855f7 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)}.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-\[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-\[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-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-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-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-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-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-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-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-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-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\: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\: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-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-\[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\: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))}}.\[\&\+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-Din59EIC.css b/webui/dist/assets/index-Din59EIC.css deleted file mode 100644 index 57c924d8..00000000 --- a/webui/dist/assets/index-Din59EIC.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-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-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{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-\[140px\]{height:140px}.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-\[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-\[140px\]{min-height:140px}.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-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-\[100px\]{max-width:100px}.max-w-\[150px\]{max-width:150px}.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-y{resize:vertical}.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}.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-\[1fr_1fr_90px_32px\]{grid-template-columns:1fr 1fr 90px 32px}.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-\[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-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-100{--tw-bg-opacity: 1;background-color:rgb(243 232 255 / var(--tw-bg-opacity, 1))}.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-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\/10{background-color:#eab3081a}.bg-yellow-500\/5{background-color:#eab3080d}.bg-yellow-900\/20{background-color:#713f1233}.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-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-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-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-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-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-500{--tw-gradient-to: #a855f7 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)}.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-\[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-\[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-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-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-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-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-purple-700{--tw-text-opacity: 1;color:rgb(126 34 206 / 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-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-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-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-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-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\: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\/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-\[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-900\/30:is(.dark *){background-color:#1e3a8a4d}.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-purple-900\/30:is(.dark *){background-color:#581c874d}.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\: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-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-purple-400:is(.dark *){--tw-text-opacity: 1;color:rgb(192 132 252 / 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-\[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\: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))}}.\[\&\+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-ppcjeAmG.js b/webui/dist/assets/index-ppcjeAmG.js deleted file mode 100644 index f5a4dcd5..00000000 --- a/webui/dist/assets/index-ppcjeAmG.js +++ /dev/null @@ -1,90 +0,0 @@ -import{r as m,j as e,L as Cr,e as aa,R as Es,b as e0,f as s0,g as t0,h as a0,k as l0,l as Zs,m as n0,n as r0,O as bg,o as i0}from"./router-9vIXuQkh.js";import{a as c0,b as o0,g as d0}from"./react-vendor-BmxF9s7Q.js";import{N as u0,c as m0,O as Lr,P as x0,g as cm}from"./utils-BqoaXoQ1.js";import{L as yg,T as wg,C as _g,R as h0,a as Sg,V as f0,b as p0,S as kg,c as g0,d as Cg,I as j0,e as Tg,f as v0,g as Eg,h as N0,i as b0,j as y0,O as Mg,P as w0,k as Ag,l as zg,D as Dg,A as Og,m as Rg,n as _0,o as S0,p as Lg,q as k0,r as Ug,s as C0,t as T0,u as Bg,v as E0,w as M0,x as $g,y as Ig,F as Pg,z as Hg,B as A0,E as z0,G as Gg,H as D0,J as O0,K as R0,M as L0,N as U0,Q as B0,U as $0,W as I0,X as P0,Y as H0,Z as G0,_ as F0,$ as q0,a0 as V0,a1 as K0,a2 as Fg,a3 as Q0,a4 as Y0}from"./radix-extra-CTMrA3du.js";import{R as J0,T as X0,L as Z0,g as W0,C as fo,X as po,Y as Ai,h as ew,B as om,j as go,P as sw,k as tw,l as aw}from"./charts-simvewUa.js";import{S as lw,H as qg,O as Vg,o as nw,C as Kg,p as rw,T as Qg,D as Yg,R as iw,q as cw,I as Jg,J as ow,K as Xg,L as Zg,M as dw,N as Wg,V as uw,Q as ej,U as sj,X as mw,Y as xw,Z as tj,_ as hw,$ as fw,a0 as aj,a1 as pw,e as lj,f as Ro,c as Lo,P as $n,d as Uo,b as cn,h as gw,l as jw,m as vw,u as Cm,r as Nw,a as bw,a2 as yw,a3 as nj,a4 as ww,a5 as _w,a6 as Sw,a7 as rj,a8 as ij,a9 as cj,aa as oj,ab as dj,ac as uj,ad as kw}from"./radix-core-BdJoVJLV.js";import{R as kt,a as Pi,C as Ct,b as ea,L as zs,P as Ji,Z as zn,F as qa,c as Cw,S as In,d as Tw,M as on,A as Ew,D as Mw,e as zr,f as kl,T as Aw,X as _a,g as zw,h as mj,I as qt,i as Ft,j as St,k as ko,E as Hi,l as sa,m as xj,H as Dw,n as ls,o as Xt,U as Gi,p as hj,q as fj,r as qp,K as Om,s as pj,t as Ow,u as bo,v as Rw,B as Ri,w as Dn,x as Rm,y as Lw,z as Uw,G as Vt,J as Bo,N as Va,O as it,Q as $a,V as Dr,W as Lm,Y as gj,_ as Xi,$ as jj,a0 as vj,a1 as On,a2 as Ur,a3 as ll,a4 as Sa,a5 as Br,a6 as Um,a7 as Nj,a8 as Wt,a9 as Tl,aa as Rn,ab as Ln,ac as $o,ad as Bw,ae as $w,af as Iw,ag as bj,ah as yo,ai as Un,aj as Pw,ak as Or,al as Hw,am as Co,an as Tm,ao as yj,ap as Gw,aq as Fw,ar as Vp,as as qw,at as wj,au as Vw,av as an,aw as _j,ax as dm,ay as Kp,az as Kw,aA as um,aB as Qw,aC as Yw,aD as Jw,aE as Xw,aF as Sj,aG as kj,aH as To,aI as Zw,aJ as Cj,aK as Tj,aL as Ww,aM as e1,aN as Qp,aO as s1,aP as t1,aQ as a1,aR as l1}from"./icons-C3pAHJin.js";import{S as n1,p as r1,j as i1,a as c1,E as Yp,R as o1,o as d1}from"./codemirror-TZqPU532.js";import{u as Ej,a as Eo,s as Mj,K as Aj,P as zj,b as Dj,D as Oj,c as Rj,S as Lj,v as u1,d as Uj,C as Bj,h as m1}from"./dnd-BiPfFtVp.js";import{_ as xa,c as x1,g as $j,D as h1,z as jo}from"./misc-CDy9pI_Y.js";import{D as f1,U as p1}from"./uppy-x-2TBvZ1.js";import{M as g1,r as j1,a as v1,b as N1}from"./markdown-CKA5gBQ9.js";import{c as b1,H as Mo,P as Ao,u as y1,d as w1,R as _1,B as S1,e as k1,C as C1,M as T1,f as E1}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 mm={exports:{}},zi={},xm={exports:{}},hm={};var Jp;function M1(){return Jp||(Jp=1,(function(l){function n(z,V){var U=z.length;z.push(V);e:for(;0>>1,P=z[L];if(0>>1;L<_e;){var je=2*(L+1)-1,Se=z[je],Y=je+1,be=z[Y];if(0>u(Se,U))Yu(be,Se)?(z[L]=be,z[Y]=U,L=Y):(z[L]=Se,z[je]=U,L=je);else if(Yu(be,U))z[L]=be,z[Y]=U,L=Y;else break e}}return V}function u(z,V){var U=z.sortIndex-V.sortIndex;return U!==0?U: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,b=3,w=!1,y=!1,R=!1,D=!1,k=typeof setTimeout=="function"?setTimeout:null,I=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;function S(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 T(z){if(R=!1,S(z),!y)if(i(p)!==null)y=!0,$||($=!0,ve());else{var V=i(g);V!==null&&ge(T,V.startTime-z)}}var $=!1,A=-1,Q=5,G=-1;function de(){return D?!0:!(l.unstable_now()-Gz&&de());){var L=v.callback;if(typeof L=="function"){v.callback=null,b=v.priorityLevel;var P=L(v.expirationTime<=z);if(z=l.unstable_now(),typeof P=="function"){v.callback=P,S(z),V=!0;break s}v===i(p)&&c(p),S(z)}else c(p);v=i(p)}if(v!==null)V=!0;else{var _e=i(g);_e!==null&&ge(T,_e.startTime-z),V=!1}}break e}finally{v=null,b=U,w=!1}V=void 0}}finally{V?ve():$=!1}}}var ve;if(typeof M=="function")ve=function(){M(oe)};else if(typeof MessageChannel<"u"){var le=new MessageChannel,fe=le.port2;le.port1.onmessage=oe,ve=function(){fe.postMessage(null)}}else ve=function(){k(oe,0)};function ge(z,V){A=k(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||125L?(z.sortIndex=U,n(g,z),i(p)===null&&z===i(g)&&(R?(I(A),A=-1):R=!0,ge(T,U-L))):(z.sortIndex=P,n(p,z),y||w||(y=!0,$||($=!0,ve()))),z},l.unstable_shouldYield=de,l.unstable_wrapCallback=function(z){var V=b;return function(){var U=b;b=V;try{return z.apply(this,arguments)}finally{b=U}}}})(hm)),hm}var Xp;function A1(){return Xp||(Xp=1,xm.exports=M1()),xm.exports}var Zp;function z1(){if(Zp)return zi;Zp=1;var l=A1(),n=c0(),i=o0();function c(s){var t="https://react.dev/errors/"+s;if(1P||(s.current=L[P],L[P]=null,P--)}function Se(s,t){P++,L[P]=s.current,s.current=t}var Y=_e(null),be=_e(null),Z=_e(null),xe=_e(null);function Me(s,t){switch(Se(Z,t),Se(be,s),Se(Y,null),t.nodeType){case 9:case 11:s=(s=t.documentElement)&&(s=s.namespaceURI)?hp(s):0;break;default:if(s=t.tagName,t=t.namespaceURI)t=hp(t),s=fp(t,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}je(Y),Se(Y,s)}function J(){je(Y),je(be),je(Z)}function ce(s){s.memoizedState!==null&&Se(xe,s);var t=Y.current,a=fp(t,s.type);t!==a&&(Se(be,s),Se(Y,a))}function Fe(s){be.current===s&&(je(Y),je(be)),xe.current===s&&(je(xe),Ci._currentValue=U)}var q,ee;function ke(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||O[r]!==te[o]){var he=` -`+O[r].replace(" at new "," at ");return s.displayName&&he.includes("")&&(he=he.replace("",s.displayName)),he}while(1<=r&&0<=o);break}}}finally{Te=!1,Error.prepareStackTrace=a}return(a=s?s.displayName||s.name:"")?ke(a):""}function me(s,t){switch(s.tag){case 26:case 27:case 5:return ke(s.type);case 16:return ke("Lazy");case 13:return s.child!==t&&t!==null?ke("Suspense Fallback"):ke("Suspense");case 19:return ke("SuspenseList");case 0:case 15:return Oe(s.type,!1);case 11:return Oe(s.type.render,!1);case 1:return Oe(s.type,!0);case 31:return ke("Activity");default:return""}}function ze(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,Kt=l.unstable_scheduleCallback,Qt=l.unstable_cancelCallback,ka=l.unstable_shouldYield,yt=l.unstable_requestPaint,st=l.unstable_now,F=l.unstable_getCurrentPriorityLevel,qe=l.unstable_ImmediatePriority,Ie=l.unstable_UserBlockingPriority,Ve=l.unstable_NormalPriority,Cs=l.unstable_LowPriority,ns=l.unstable_IdlePriority,Rs=l.log,Ee=l.unstable_setDisableYieldValue,gs=null,ts=null;function Ze(s){if(typeof Rs=="function"&&Ee(s),ts&&typeof ts.setStrictMode=="function")try{ts.setStrictMode(gs,s)}catch{}}var js=Math.clz32?Math.clz32:ut,dt=Math.log,Ot=Math.LN2;function ut(s){return s>>>=0,s===0?32:31-(dt(s)/Ot|0)|0}var _s=256,Tt=262144,Bt=4194304;function Ca(s){var t=s&42;if(t!==0)return t;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function Ya(s,t,a){var r=s.pendingLanes;if(r===0)return 0;var o=0,d=s.suspendedLanes,j=s.pingedLanes;s=s.warmLanes;var _=r&134217727;return _!==0?(r=_&~d,r!==0?o=Ca(r):(j&=_,j!==0?o=Ca(j):a||(a=_&~s,a!==0&&(o=Ca(a))))):(_=r&~d,_!==0?o=Ca(_):j!==0?o=Ca(j):a||(a=r&~s,a!==0&&(o=Ca(a)))),o===0?0:t!==0&&t!==o&&(t&d)===0&&(d=o&-o,a=t&-t,d>=a||d===32&&(a&4194048)!==0)?t:o}function nl(s,t){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&t)===0}function Yt(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 X(){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 Ce(s,t){s.pendingLanes|=t,t!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function Ls(s,t,a,r,o,d){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 _=s.entanglements,O=s.expirationTimes,te=s.hiddenUpdates;for(a=j&~a;0"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var QN=/[\n"\\]/g;function Ea(s){return s.replace(QN,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function td(s,t,a,r,o,d,j,_){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=""+Ta(t)):s.value!==""+Ta(t)&&(s.value=""+Ta(t)):j!=="submit"&&j!=="reset"||s.removeAttribute("value"),t!=null?ad(s,j,Ta(t)):a!=null?ad(s,j,Ta(a)):r!=null&&s.removeAttribute("value"),o==null&&d!=null&&(s.defaultChecked=!!d),o!=null&&(s.checked=o&&typeof o!="function"&&typeof o!="symbol"),_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?s.name=""+Ta(_):s.removeAttribute("name")}function ix(s,t,a,r,o,d,j,_){if(d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(s.type=d),t!=null||a!=null){if(!(d!=="submit"&&d!=="reset"||t!=null)){sd(s);return}a=a!=null?""+Ta(a):"",t=t!=null?""+Ta(t):a,_||t===s.value||(s.value=t),s.defaultValue=t}r=r??o,r=typeof r!="function"&&typeof r!="symbol"&&!!r,s.checked=_?s.checked:!!r,s.defaultChecked=!!r,j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(s.name=j),sd(s)}function ad(s,t,a){t==="number"&&lc(s.ownerDocument)===s||s.defaultValue===""+a||(s.defaultValue=""+a)}function Kn(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"),cd=!1;if(cl)try{var qr={};Object.defineProperty(qr,"passive",{get:function(){cd=!0}}),window.addEventListener("test",qr,qr),window.removeEventListener("test",qr,qr)}catch{cd=!1}var Ol=null,od=null,rc=null;function hx(){if(rc)return rc;var s,t=od,a=t.length,r,o="value"in Ol?Ol.value:Ol.textContent,d=o.length;for(s=0;s=Qr),Nx=" ",bx=!1;function yx(s,t){switch(s){case"keyup":return yb.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function wx(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Xn=!1;function _b(s,t){switch(s){case"compositionend":return wx(t);case"keypress":return t.which!==32?null:(bx=!0,Nx);case"textInput":return s=t.data,s===Nx&&bx?null:s;default:return null}}function Sb(s,t){if(Xn)return s==="compositionend"||!hd&&yx(s,t)?(s=hx(),rc=od=Ol=null,Xn=!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=Ax(a)}}function Dx(s,t){return s&&t?s===t?!0:s&&s.nodeType===3?!1:t&&t.nodeType===3?Dx(s,t.parentNode):"contains"in s?s.contains(t):s.compareDocumentPosition?!!(s.compareDocumentPosition(t)&16):!1:!1}function Ox(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var t=lc(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=lc(s.document)}return t}function gd(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 Db=cl&&"documentMode"in document&&11>=document.documentMode,Zn=null,jd=null,Zr=null,vd=!1;function Rx(s,t,a){var r=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;vd||Zn==null||Zn!==lc(r)||(r=Zn,"selectionStart"in r&&gd(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}),Zr&&Xr(Zr,r)||(Zr=r,r=Wc(jd,"onSelect"),0>=j,o-=j,Ja=1<<32-js(t)+o|a<cs?(ks=Pe,Pe=null):ks=Pe.sibling;var As=ne(K,Pe,se[cs],pe);if(As===null){Pe===null&&(Pe=ks);break}s&&Pe&&As.alternate===null&&t(K,Pe),H=d(As,H,cs),Ms===null?Ke=As:Ms.sibling=As,Ms=As,Pe=ks}if(cs===se.length)return a(K,Pe),Ts&&dl(K,cs),Ke;if(Pe===null){for(;cscs?(ks=Pe,Pe=null):ks=Pe.sibling;var tn=ne(K,Pe,As.value,pe);if(tn===null){Pe===null&&(Pe=ks);break}s&&Pe&&tn.alternate===null&&t(K,Pe),H=d(tn,H,cs),Ms===null?Ke=tn:Ms.sibling=tn,Ms=tn,Pe=ks}if(As.done)return a(K,Pe),Ts&&dl(K,cs),Ke;if(Pe===null){for(;!As.done;cs++,As=se.next())As=Ne(K,As.value,pe),As!==null&&(H=d(As,H,cs),Ms===null?Ke=As:Ms.sibling=As,Ms=As);return Ts&&dl(K,cs),Ke}for(Pe=r(Pe);!As.done;cs++,As=se.next())As=ue(Pe,K,cs,As.value,pe),As!==null&&(s&&As.alternate!==null&&Pe.delete(As.key===null?cs:As.key),H=d(As,H,cs),Ms===null?Ke=As:Ms.sibling=As,Ms=As);return s&&Pe.forEach(function(Wy){return t(K,Wy)}),Ts&&dl(K,cs),Ke}function Vs(K,H,se,pe){if(typeof se=="object"&&se!==null&&se.type===R&&se.key===null&&(se=se.props.children),typeof se=="object"&&se!==null){switch(se.$$typeof){case w:e:{for(var Ke=se.key;H!==null;){if(H.key===Ke){if(Ke=se.type,Ke===R){if(H.tag===7){a(K,H.sibling),pe=o(H,se.props.children),pe.return=K,K=pe;break e}}else if(H.elementType===Ke||typeof Ke=="object"&&Ke!==null&&Ke.$$typeof===Q&&wn(Ke)===H.type){a(K,H.sibling),pe=o(H,se.props),li(pe,se),pe.return=K,K=pe;break e}a(K,H);break}else t(K,H);H=H.sibling}se.type===R?(pe=jn(se.props.children,K.mode,pe,se.key),pe.return=K,K=pe):(pe=pc(se.type,se.key,se.props,null,K.mode,pe),li(pe,se),pe.return=K,K=pe)}return j(K);case y:e:{for(Ke=se.key;H!==null;){if(H.key===Ke)if(H.tag===4&&H.stateNode.containerInfo===se.containerInfo&&H.stateNode.implementation===se.implementation){a(K,H.sibling),pe=o(H,se.children||[]),pe.return=K,K=pe;break e}else{a(K,H);break}else t(K,H);H=H.sibling}pe=kd(se,K.mode,pe),pe.return=K,K=pe}return j(K);case Q:return se=wn(se),Vs(K,H,se,pe)}if(ge(se))return Re(K,H,se,pe);if(ve(se)){if(Ke=ve(se),typeof Ke!="function")throw Error(c(150));return se=Ke.call(se),Ye(K,H,se,pe)}if(typeof se.then=="function")return Vs(K,H,wc(se),pe);if(se.$$typeof===M)return Vs(K,H,vc(K,se),pe);_c(K,se)}return typeof se=="string"&&se!==""||typeof se=="number"||typeof se=="bigint"?(se=""+se,H!==null&&H.tag===6?(a(K,H.sibling),pe=o(H,se),pe.return=K,K=pe):(a(K,H),pe=Sd(se,K.mode,pe),pe.return=K,K=pe),j(K)):a(K,H)}return function(K,H,se,pe){try{ai=0;var Ke=Vs(K,H,se,pe);return or=null,Ke}catch(Pe){if(Pe===cr||Pe===bc)throw Pe;var Ms=ga(29,Pe,null,K.mode);return Ms.lanes=pe,Ms.return=K,Ms}finally{}}}var Sn=lh(!0),nh=lh(!1),$l=!1;function Bd(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function $d(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 Il(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function Pl(s,t,a){var r=s.updateQueue;if(r===null)return null;if(r=r.shared,(Os&2)!==0){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,t=fc(s),Hx(s,null,a),t}return hc(s,r,t,a),fc(s)}function ni(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,Jt(s,a)}}function Id(s,t){var a=s.updateQueue,r=s.alternate;if(r!==null&&(r=r.updateQueue,a===r)){var o=null,d=null;if(a=a.firstBaseUpdate,a!==null){do{var j={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};d===null?o=d=j:d=d.next=j,a=a.next}while(a!==null);d===null?o=d=t:d=d.next=t}else o=d=t;a={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:d,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 Pd=!1;function ri(){if(Pd){var s=ir;if(s!==null)throw s}}function ii(s,t,a,r){Pd=!1;var o=s.updateQueue;$l=!1;var d=o.firstBaseUpdate,j=o.lastBaseUpdate,_=o.shared.pending;if(_!==null){o.shared.pending=null;var O=_,te=O.next;O.next=null,j===null?d=te:j.next=te,j=O;var he=s.alternate;he!==null&&(he=he.updateQueue,_=he.lastBaseUpdate,_!==j&&(_===null?he.firstBaseUpdate=te:_.next=te,he.lastBaseUpdate=O))}if(d!==null){var Ne=o.baseState;j=0,he=te=O=null,_=d;do{var ne=_.lane&-536870913,ue=ne!==_.lane;if(ue?(Ss&ne)===ne:(r&ne)===ne){ne!==0&&ne===rr&&(Pd=!0),he!==null&&(he=he.next={lane:0,tag:_.tag,payload:_.payload,callback:null,next:null});e:{var Re=s,Ye=_;ne=t;var Vs=a;switch(Ye.tag){case 1:if(Re=Ye.payload,typeof Re=="function"){Ne=Re.call(Vs,Ne,ne);break e}Ne=Re;break e;case 3:Re.flags=Re.flags&-65537|128;case 0:if(Re=Ye.payload,ne=typeof Re=="function"?Re.call(Vs,Ne,ne):Re,ne==null)break e;Ne=v({},Ne,ne);break e;case 2:$l=!0}}ne=_.callback,ne!==null&&(s.flags|=64,ue&&(s.flags|=8192),ue=o.callbacks,ue===null?o.callbacks=[ne]:ue.push(ne))}else ue={lane:ne,tag:_.tag,payload:_.payload,callback:_.callback,next:null},he===null?(te=he=ue,O=Ne):he=he.next=ue,j|=ne;if(_=_.next,_===null){if(_=o.shared.pending,_===null)break;ue=_,_=ue.next,ue.next=null,o.lastBaseUpdate=ue,o.shared.pending=null}}while(!0);he===null&&(O=Ne),o.baseState=O,o.firstBaseUpdate=te,o.lastBaseUpdate=he,d===null&&(o.shared.lanes=0),Vl|=j,s.lanes=j,s.memoizedState=Ne}}function rh(s,t){if(typeof s!="function")throw Error(c(191,s));s.call(t)}function ih(s,t){var a=s.callbacks;if(a!==null)for(s.callbacks=null,s=0;sd?d:8;var j=z.T,_={};z.T=_,ru(s,!1,t,a);try{var O=o(),te=z.S;if(te!==null&&te(_,O),O!==null&&typeof O=="object"&&typeof O.then=="function"){var he=Hb(O,r);di(s,t,he,ya(s))}else di(s,t,r,ya(s))}catch(Ne){di(s,t,{then:function(){},status:"rejected",reason:Ne},ya())}finally{V.p=d,j!==null&&_.types!==null&&(j.types=_.types),z.T=j}}function Qb(){}function lu(s,t,a,r){if(s.tag!==5)throw Error(c(476));var o=$h(s).queue;Bh(s,o,t,U,a===null?Qb:function(){return Ih(s),a(r)})}function $h(s){var t=s.memoizedState;if(t!==null)return t;t={memoizedState:U,baseState:U,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:hl,lastRenderedState:U},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:hl,lastRenderedState:a},next:null},s.memoizedState=t,s=s.alternate,s!==null&&(s.memoizedState=t),t}function Ih(s){var t=$h(s);t.next===null&&(t=s.alternate.memoizedState),di(s,t.next.queue,{},ya())}function nu(){return It(Ci)}function Ph(){return _t().memoizedState}function Hh(){return _t().memoizedState}function Yb(s){for(var t=s.return;t!==null;){switch(t.tag){case 24:case 3:var a=ya();s=Il(a);var r=Pl(t,s,a);r!==null&&(da(r,t,a),ni(r,t,a)),t={cache:Od()},s.payload=t;return}t=t.return}}function Jb(s,t,a){var r=ya();a={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Oc(s)?Fh(t,a):(a=wd(s,t,a,r),a!==null&&(da(a,s,r),qh(a,t,r)))}function Gh(s,t,a){var r=ya();di(s,t,a,r)}function di(s,t,a,r){var o={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Oc(s))Fh(t,o);else{var d=s.alternate;if(s.lanes===0&&(d===null||d.lanes===0)&&(d=t.lastRenderedReducer,d!==null))try{var j=t.lastRenderedState,_=d(j,a);if(o.hasEagerState=!0,o.eagerState=_,pa(_,j))return hc(s,t,o,0),Ys===null&&xc(),!1}catch{}finally{}if(a=wd(s,t,o,r),a!==null)return da(a,s,r),qh(a,t,r),!0}return!1}function ru(s,t,a,r){if(r={lane:2,revertLane:Bu(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Oc(s)){if(t)throw Error(c(479))}else t=wd(s,a,r,2),t!==null&&da(t,s,2)}function Oc(s){var t=s.alternate;return s===is||t!==null&&t===is}function Fh(s,t){ur=Cc=!0;var a=s.pending;a===null?t.next=t:(t.next=a.next,a.next=t),s.pending=t}function qh(s,t,a){if((a&4194048)!==0){var r=t.lanes;r&=s.pendingLanes,a|=r,t.lanes=a,Jt(s,a)}}var ui={readContext:It,use:Mc,useCallback:gt,useContext:gt,useEffect:gt,useImperativeHandle:gt,useLayoutEffect:gt,useInsertionEffect:gt,useMemo:gt,useReducer:gt,useRef:gt,useState:gt,useDebugValue:gt,useDeferredValue:gt,useTransition:gt,useSyncExternalStore:gt,useId:gt,useHostTransitionStatus:gt,useFormState:gt,useActionState:gt,useOptimistic:gt,useMemoCache:gt,useCacheRefresh:gt};ui.useEffectEvent=gt;var Vh={readContext:It,use:Mc,useCallback:function(s,t){return Zt().memoizedState=[s,t===void 0?null:t],s},useContext:It,useEffect:Eh,useImperativeHandle:function(s,t,a){a=a!=null?a.concat([s]):null,zc(4194308,4,Dh.bind(null,t,s),a)},useLayoutEffect:function(s,t){return zc(4194308,4,s,t)},useInsertionEffect:function(s,t){zc(4,2,s,t)},useMemo:function(s,t){var a=Zt();t=t===void 0?null:t;var r=s();if(kn){Ze(!0);try{s()}finally{Ze(!1)}}return a.memoizedState=[r,t],r},useReducer:function(s,t,a){var r=Zt();if(a!==void 0){var o=a(t);if(kn){Ze(!0);try{a(t)}finally{Ze(!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=Jb.bind(null,is,s),[r.memoizedState,s]},useRef:function(s){var t=Zt();return s={current:s},t.memoizedState=s},useState:function(s){s=Wd(s);var t=s.queue,a=Gh.bind(null,is,t);return t.dispatch=a,[s.memoizedState,a]},useDebugValue:tu,useDeferredValue:function(s,t){var a=Zt();return au(a,s,t)},useTransition:function(){var s=Wd(!1);return s=Bh.bind(null,is,s.queue,!0,!1),Zt().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,t,a){var r=is,o=Zt();if(Ts){if(a===void 0)throw Error(c(407));a=a()}else{if(a=t(),Ys===null)throw Error(c(349));(Ss&127)!==0||xh(r,t,a)}o.memoizedState=a;var d={value:a,getSnapshot:t};return o.queue=d,Eh(fh.bind(null,r,d,s),[s]),r.flags|=2048,xr(9,{destroy:void 0},hh.bind(null,r,d,a,t),null),a},useId:function(){var s=Zt(),t=Ys.identifierPrefix;if(Ts){var a=Xa,r=Ja;a=(r&~(1<<32-js(r)-1)).toString(32)+a,t="_"+t+"R_"+a,a=Tc++,0<\/script>",d=d.removeChild(d.firstChild);break;case"select":d=typeof r.is=="string"?j.createElement("select",{is:r.is}):j.createElement("select"),r.multiple?d.multiple=!0:r.size&&(d.size=r.size);break;default:d=typeof r.is=="string"?j.createElement(o,{is:r.is}):j.createElement(o)}}d[Ds]=t,d[pt]=r;e:for(j=t.child;j!==null;){if(j.tag===5||j.tag===6)d.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=d;e:switch(Ht(d,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&&pl(t)}}return lt(t),Nu(t,t.type,s===null?null:s.memoizedProps,t.pendingProps,a),null;case 6:if(s&&t.stateNode!=null)s.memoizedProps!==r&&pl(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(c(166));if(s=Z.current,lr(t)){if(s=t.stateNode,a=t.memoizedProps,r=null,o=$t,o!==null)switch(o.tag){case 27:case 5:r=o.memoizedProps}s[Ds]=t,s=!!(s.nodeValue===a||r!==null&&r.suppressHydrationWarning===!0||mp(s.nodeValue,a)),s||Ul(t,!0)}else s=eo(s).createTextNode(r),s[Ds]=t,t.stateNode=s}return lt(t),null;case 31:if(a=t.memoizedState,s===null||s.memoizedState!==null){if(r=lr(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[Ds]=t}else vn(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;lt(t),s=!1}else a=Md(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=a),s=!0;if(!s)return t.flags&256?(va(t),t):(va(t),null);if((t.flags&128)!==0)throw Error(c(558))}return lt(t),null;case 13:if(r=t.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(o=lr(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[Ds]=t}else vn(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;lt(t),o=!1}else o=Md(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?(va(t),t):(va(t),null)}return va(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),d=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(d=r.memoizedState.cachePool.pool),d!==o&&(r.flags|=2048)),a!==s&&a&&(t.child.flags|=8192),$c(t,t.updateQueue),lt(t),null);case 4:return J(),s===null&&Hu(t.stateNode.containerInfo),lt(t),null;case 10:return ml(t.type),lt(t),null;case 19:if(je(wt),r=t.memoizedState,r===null)return lt(t),null;if(o=(t.flags&128)!==0,d=r.rendering,d===null)if(o)xi(r,!1);else{if(jt!==0||s!==null&&(s.flags&128)!==0)for(s=t.child;s!==null;){if(d=kc(s),d!==null){for(t.flags|=128,xi(r,!1),s=d.updateQueue,t.updateQueue=s,$c(t,s),t.subtreeFlags=0,s=a,a=t.child;a!==null;)Gx(a,s),a=a.sibling;return Se(wt,wt.current&1|2),Ts&&dl(t,r.treeForkCount),t.child}s=s.sibling}r.tail!==null&&st()>Fc&&(t.flags|=128,o=!0,xi(r,!1),t.lanes=4194304)}else{if(!o)if(s=kc(d),s!==null){if(t.flags|=128,o=!0,s=s.updateQueue,t.updateQueue=s,$c(t,s),xi(r,!0),r.tail===null&&r.tailMode==="hidden"&&!d.alternate&&!Ts)return lt(t),null}else 2*st()-r.renderingStartTime>Fc&&a!==536870912&&(t.flags|=128,o=!0,xi(r,!1),t.lanes=4194304);r.isBackwards?(d.sibling=t.child,t.child=d):(s=r.last,s!==null?s.sibling=d:t.child=d,r.last=d)}return r.tail!==null?(s=r.tail,r.rendering=s,r.tail=s.sibling,r.renderingStartTime=st(),s.sibling=null,a=wt.current,Se(wt,o?a&1|2:a&1),Ts&&dl(t,r.treeForkCount),s):(lt(t),null);case 22:case 23:return va(t),Gd(),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&&(lt(t),t.subtreeFlags&6&&(t.flags|=8192)):lt(t),a=t.updateQueue,a!==null&&$c(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&&je(yn),null;case 24:return a=null,s!==null&&(a=s.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),ml(Et),lt(t),null;case 25:return null;case 30:return null}throw Error(c(156,t.tag))}function sy(s,t){switch(Td(t),t.tag){case 1:return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 3:return ml(Et),J(),s=t.flags,(s&65536)!==0&&(s&128)===0?(t.flags=s&-65537|128,t):null;case 26:case 27:case 5:return Fe(t),null;case 31:if(t.memoizedState!==null){if(va(t),t.alternate===null)throw Error(c(340));vn()}return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 13:if(va(t),s=t.memoizedState,s!==null&&s.dehydrated!==null){if(t.alternate===null)throw Error(c(340));vn()}return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 19:return je(wt),null;case 4:return J(),null;case 10:return ml(t.type),null;case 22:case 23:return va(t),Gd(),s!==null&&je(yn),s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 24:return ml(Et),null;case 25:return null;default:return null}}function gf(s,t){switch(Td(t),t.tag){case 3:ml(Et),J();break;case 26:case 27:case 5:Fe(t);break;case 4:J();break;case 31:t.memoizedState!==null&&va(t);break;case 13:va(t);break;case 19:je(wt);break;case 10:ml(t.type);break;case 22:case 23:va(t),Gd(),s!==null&&je(yn);break;case 24:ml(Et)}}function hi(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 d=a.create,j=a.inst;r=d(),j.destroy=r}a=a.next}while(a!==o)}}catch(_){$s(t,t.return,_)}}function Fl(s,t,a){try{var r=t.updateQueue,o=r!==null?r.lastEffect:null;if(o!==null){var d=o.next;r=d;do{if((r.tag&s)===s){var j=r.inst,_=j.destroy;if(_!==void 0){j.destroy=void 0,o=t;var O=a,te=_;try{te()}catch(he){$s(o,O,he)}}}r=r.next}while(r!==d)}}catch(he){$s(t,t.return,he)}}function jf(s){var t=s.updateQueue;if(t!==null){var a=s.stateNode;try{ih(t,a)}catch(r){$s(s,s.return,r)}}}function vf(s,t,a){a.props=Cn(s.type,s.memoizedProps),a.state=s.memoizedState;try{a.componentWillUnmount()}catch(r){$s(s,t,r)}}function fi(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){$s(s,t,o)}}function Za(s,t){var a=s.ref,r=s.refCleanup;if(a!==null)if(typeof r=="function")try{r()}catch(o){$s(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){$s(s,t,o)}else a.current=null}function Nf(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){$s(s,s.return,o)}}function bu(s,t,a){try{var r=s.stateNode;wy(r,s.type,a,t),r[pt]=t}catch(o){$s(s,s.return,o)}}function bf(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Xl(s.type)||s.tag===4}function yu(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||bf(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&&Xl(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 wu(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=il));else if(r!==4&&(r===27&&Xl(s.type)&&(a=s.stateNode,t=null),s=s.child,s!==null))for(wu(s,t,a),s=s.sibling;s!==null;)wu(s,t,a),s=s.sibling}function Ic(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&&Xl(s.type)&&(a=s.stateNode),s=s.child,s!==null))for(Ic(s,t,a),s=s.sibling;s!==null;)Ic(s,t,a),s=s.sibling}function yf(s){var t=s.stateNode,a=s.memoizedProps;try{for(var r=s.type,o=t.attributes;o.length;)t.removeAttributeNode(o[0]);Ht(t,r,a),t[Ds]=s,t[pt]=a}catch(d){$s(s,s.return,d)}}var gl=!1,zt=!1,_u=!1,wf=typeof WeakSet=="function"?WeakSet:Set,Lt=null;function ty(s,t){if(s=s.containerInfo,qu=io,s=Ox(s),gd(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,d=r.focusNode;r=r.focusOffset;try{a.nodeType,d.nodeType}catch{a=null;break e}var j=0,_=-1,O=-1,te=0,he=0,Ne=s,ne=null;s:for(;;){for(var ue;Ne!==a||o!==0&&Ne.nodeType!==3||(_=j+o),Ne!==d||r!==0&&Ne.nodeType!==3||(O=j+r),Ne.nodeType===3&&(j+=Ne.nodeValue.length),(ue=Ne.firstChild)!==null;)ne=Ne,Ne=ue;for(;;){if(Ne===s)break s;if(ne===a&&++te===o&&(_=j),ne===d&&++he===r&&(O=j),(ue=Ne.nextSibling)!==null)break;Ne=ne,ne=Ne.parentNode}Ne=ue}a=_===-1||O===-1?null:{start:_,end:O}}else a=null}a=a||{start:0,end:0}}else a=null;for(Vu={focusedElem:s,selectionRange:a},io=!1,Lt=t;Lt!==null;)if(t=Lt,s=t.child,(t.subtreeFlags&1028)!==0&&s!==null)s.return=t,Lt=s;else for(;Lt!==null;){switch(t=Lt,d=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"))),Ht(d,r,a),d[Ds]=s,Rt(d),r=d;break e;case"link":var j=Ep("link","href",o).get(r+(a.href||""));if(j){for(var _=0;_Vs&&(j=Vs,Vs=Ye,Ye=j);var K=zx(_,Ye),H=zx(_,Vs);if(K&&H&&(ue.rangeCount!==1||ue.anchorNode!==K.node||ue.anchorOffset!==K.offset||ue.focusNode!==H.node||ue.focusOffset!==H.offset)){var se=Ne.createRange();se.setStart(K.node,K.offset),ue.removeAllRanges(),Ye>Vs?(ue.addRange(se),ue.extend(H.node,H.offset)):(se.setEnd(H.node,H.offset),ue.addRange(se))}}}}for(Ne=[],ue=_;ue=ue.parentNode;)ue.nodeType===1&&Ne.push({element:ue,left:ue.scrollLeft,top:ue.scrollTop});for(typeof _.focus=="function"&&_.focus(),_=0;_a?32:a,z.T=null,a=Au,Au=null;var d=Ql,j=yl;if(Dt=0,jr=Ql=null,yl=0,(Os&6)!==0)throw Error(c(331));var _=Os;if(Os|=4,Of(d.current),Af(d,d.current,j,a),Os=_,bi(0,!1),ts&&typeof ts.onPostCommitFiberRoot=="function")try{ts.onPostCommitFiberRoot(gs,d)}catch{}return!0}finally{V.p=o,z.T=r,Zf(s,t)}}function ep(s,t,a){t=Aa(a,t),t=du(s.stateNode,t,2),s=Pl(s,t,2),s!==null&&(Ce(s,2),Wa(s))}function $s(s,t,a){if(s.tag===3)ep(s,s,a);else for(;t!==null;){if(t.tag===3){ep(t,s,a);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Kl===null||!Kl.has(r))){s=Aa(a,s),a=ef(2),r=Pl(t,a,2),r!==null&&(sf(a,r,t,s),Ce(r,2),Wa(r));break}}t=t.return}}function Ru(s,t,a){var r=s.pingCache;if(r===null){r=s.pingCache=new ny;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)||(Cu=!0,o.add(a),s=dy.bind(null,s,t,a),t.then(s,s))}function dy(s,t,a){var r=s.pingCache;r!==null&&r.delete(t),s.pingedLanes|=s.suspendedLanes&a,s.warmLanes&=~a,Ys===s&&(Ss&a)===a&&(jt===4||jt===3&&(Ss&62914560)===Ss&&300>st()-Gc?(Os&2)===0&&vr(s,0):Tu|=a,gr===Ss&&(gr=0)),Wa(s)}function sp(s,t){t===0&&(t=X()),s=gn(s,t),s!==null&&(Ce(s,t),Wa(s))}function uy(s){var t=s.memoizedState,a=0;t!==null&&(a=t.retryLane),sp(s,a)}function my(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),sp(s,a)}function xy(s,t){return Kt(s,t)}var Jc=null,br=null,Lu=!1,Xc=!1,Uu=!1,Jl=0;function Wa(s){s!==br&&s.next===null&&(br===null?Jc=br=s:br=br.next=s),Xc=!0,Lu||(Lu=!0,fy())}function bi(s,t){if(!Uu&&Xc){Uu=!0;do for(var a=!1,r=Jc;r!==null;){if(s!==0){var o=r.pendingLanes;if(o===0)var d=0;else{var j=r.suspendedLanes,_=r.pingedLanes;d=(1<<31-js(42|s)+1)-1,d&=o&~(j&~_),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(a=!0,np(r,d))}else d=Ss,d=Ya(r,r===Ys?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),(d&3)===0||nl(r,d)||(a=!0,np(r,d));r=r.next}while(a);Uu=!1}}function hy(){tp()}function tp(){Xc=Lu=!1;var s=0;Jl!==0&&Sy()&&(s=Jl);for(var t=st(),a=null,r=Jc;r!==null;){var o=r.next,d=ap(r,t);d===0?(r.next=null,a===null?Jc=o:a.next=o,o===null&&(br=a)):(a=r,(s!==0||(d&3)!==0)&&(Xc=!0)),r=o}Dt!==0&&Dt!==5||bi(s),Jl!==0&&(Jl=0)}function ap(s,t){for(var a=s.suspendedLanes,r=s.pingedLanes,o=s.expirationTimes,d=s.pendingLanes&-62914561;0_)break;var he=O.transferSize,Ne=O.initiatorType;he&&xp(Ne)&&(O=O.responseEnd,j+=he*(O<_?1:(_-te)/(O-te)))}if(--r,t+=8*(d+j)/(o.duration/1e3),s++,10"u"?null:document;function Sp(s,t,a){var r=yr;if(r&&typeof t=="string"&&t){var o=Ea(t);o='link[rel="'+s+'"][href="'+o+'"]',typeof a=="string"&&(o+='[crossorigin="'+a+'"]'),_p.has(o)||(_p.add(o),s={rel:s,crossOrigin:a,href:t},r.querySelector(o)===null&&(t=r.createElement("link"),Ht(t,"link",s),Rt(t),r.head.appendChild(t)))}}function Oy(s){wl.D(s),Sp("dns-prefetch",s,null)}function Ry(s,t){wl.C(s,t),Sp("preconnect",s,t)}function Ly(s,t,a){wl.L(s,t,a);var r=yr;if(r&&s&&t){var o='link[rel="preload"][as="'+Ea(t)+'"]';t==="image"&&a&&a.imageSrcSet?(o+='[imagesrcset="'+Ea(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(o+='[imagesizes="'+Ea(a.imageSizes)+'"]')):o+='[href="'+Ea(s)+'"]';var d=o;switch(t){case"style":d=wr(s);break;case"script":d=_r(s)}Ua.has(d)||(s=v({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:s,as:t},a),Ua.set(d,s),r.querySelector(o)!==null||t==="style"&&r.querySelector(Si(d))||t==="script"&&r.querySelector(ki(d))||(t=r.createElement("link"),Ht(t,"link",s),Rt(t),r.head.appendChild(t)))}}function Uy(s,t){wl.m(s,t);var a=yr;if(a&&s){var r=t&&typeof t.as=="string"?t.as:"script",o='link[rel="modulepreload"][as="'+Ea(r)+'"][href="'+Ea(s)+'"]',d=o;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":d=_r(s)}if(!Ua.has(d)&&(s=v({rel:"modulepreload",href:s},t),Ua.set(d,s),a.querySelector(o)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(ki(d)))return}r=a.createElement("link"),Ht(r,"link",s),Rt(r),a.head.appendChild(r)}}}function By(s,t,a){wl.S(s,t,a);var r=yr;if(r&&s){var o=qn(r).hoistableStyles,d=wr(s);t=t||"default";var j=o.get(d);if(!j){var _={loading:0,preload:null};if(j=r.querySelector(Si(d)))_.loading=5;else{s=v({rel:"stylesheet",href:s,"data-precedence":t},a),(a=Ua.get(d))&&Wu(s,a);var O=j=r.createElement("link");Rt(O),Ht(O,"link",s),O._p=new Promise(function(te,he){O.onload=te,O.onerror=he}),O.addEventListener("load",function(){_.loading|=1}),O.addEventListener("error",function(){_.loading|=2}),_.loading|=4,to(j,t,r)}j={type:"stylesheet",instance:j,count:1,state:_},o.set(d,j)}}}function $y(s,t){wl.X(s,t);var a=yr;if(a&&s){var r=qn(a).hoistableScripts,o=_r(s),d=r.get(o);d||(d=a.querySelector(ki(o)),d||(s=v({src:s,async:!0},t),(t=Ua.get(o))&&em(s,t),d=a.createElement("script"),Rt(d),Ht(d,"link",s),a.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},r.set(o,d))}}function Iy(s,t){wl.M(s,t);var a=yr;if(a&&s){var r=qn(a).hoistableScripts,o=_r(s),d=r.get(o);d||(d=a.querySelector(ki(o)),d||(s=v({src:s,async:!0,type:"module"},t),(t=Ua.get(o))&&em(s,t),d=a.createElement("script"),Rt(d),Ht(d,"link",s),a.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},r.set(o,d))}}function kp(s,t,a,r){var o=(o=Z.current)?so(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=wr(a.href),a=qn(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=wr(a.href);var d=qn(o).hoistableStyles,j=d.get(s);if(j||(o=o.ownerDocument||o,j={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},d.set(s,j),(d=o.querySelector(Si(s)))&&!d._p&&(j.instance=d,j.state.loading=5),Ua.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},Ua.set(s,a),d||Py(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=_r(a),a=qn(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 wr(s){return'href="'+Ea(s)+'"'}function Si(s){return'link[rel="stylesheet"]['+s+"]"}function Cp(s){return v({},s,{"data-precedence":s.precedence,precedence:null})}function Py(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}),Ht(t,"link",a),Rt(t),s.head.appendChild(t))}function _r(s){return'[src="'+Ea(s)+'"]'}function ki(s){return"script[async]"+s}function Tp(s,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var r=s.querySelector('style[data-href~="'+Ea(a.href)+'"]');if(r)return t.instance=r,Rt(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"),Rt(r),Ht(r,"style",o),to(r,a.precedence,s),t.instance=r;case"stylesheet":o=wr(a.href);var d=s.querySelector(Si(o));if(d)return t.state.loading|=4,t.instance=d,Rt(d),d;r=Cp(a),(o=Ua.get(o))&&Wu(r,o),d=(s.ownerDocument||s).createElement("link"),Rt(d);var j=d;return j._p=new Promise(function(_,O){j.onload=_,j.onerror=O}),Ht(d,"link",r),t.state.loading|=4,to(d,a.precedence,s),t.instance=d;case"script":return d=_r(a.src),(o=s.querySelector(ki(d)))?(t.instance=o,Rt(o),o):(r=a,(o=Ua.get(d))&&(r=v({},a),em(r,o)),s=s.ownerDocument||s,o=s.createElement("script"),Rt(o),Ht(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,to(r,a.precedence,s));return t.instance}function to(s,t,a){for(var r=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),o=r.length?r[r.length-1]:null,d=o,j=0;j title"):null)}function Hy(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 Ap(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function Gy(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=wr(r.href),d=t.querySelector(Si(o));if(d){t=d._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(s.count++,s=lo.bind(s),t.then(s,s)),a.state.loading|=4,a.instance=d,Rt(d);return}d=t.ownerDocument||t,r=Cp(r),(o=Ua.get(o))&&Wu(r,o),d=d.createElement("link"),Rt(d);var j=d;j._p=new Promise(function(_,O){j.onload=_,j.onerror=O}),Ht(d,"link",r),a.instance=d}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(s.count++,a=lo.bind(s),t.addEventListener("load",a),t.addEventListener("error",a))}}var sm=0;function Fy(s,t){return s.stylesheets&&s.count===0&&ro(s,s.stylesheets),0sm?50:800)+t);return s.unsuspend=a,function(){s.unsuspend=null,clearTimeout(r),clearTimeout(o)}}:null}function lo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ro(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var no=null;function ro(s,t){s.stylesheets=null,s.unsuspend!==null&&(s.count++,no=new Map,t.forEach(qy,s),no=null,lo.call(s))}function qy(s,t){if(!(t.state.loading&4)){var a=no.get(s);if(a)var r=a.get(null);else{a=new Map,no.set(s,a);for(var o=s.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;d"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l)}catch(n){console.error(n)}}return l(),mm.exports=z1(),mm.exports}var O1=D1();function B(...l){return u0(m0(l))}const De=m.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:B("rounded-xl border bg-card text-card-foreground shadow",l),...n}));De.displayName="Card";const Xe=m.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:B("flex flex-col space-y-1.5 p-6",l),...n}));Xe.displayName="CardHeader";const We=m.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:B("font-semibold leading-none tracking-tight",l),...n}));We.displayName="CardTitle";const Is=m.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:B("text-sm text-muted-foreground",l),...n}));Is.displayName="CardDescription";const Qe=m.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:B("p-6 pt-0",l),...n}));Qe.displayName="CardContent";const Io=m.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:B("flex items-center p-6 pt-0",l),...n}));Io.displayName="CardFooter";const ma=h0,ta=m.forwardRef(({className:l,...n},i)=>e.jsx(yg,{ref:i,className:B("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",l),...n}));ta.displayName=yg.displayName;const as=m.forwardRef(({className:l,...n},i)=>e.jsx(wg,{ref:i,className:B("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}));as.displayName=wg.displayName;const ys=m.forwardRef(({className:l,...n},i)=>e.jsx(_g,{ref:i,className:B("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=_g.displayName;const es=m.forwardRef(({className:l,children:n,viewportRef:i,...c},u)=>e.jsxs(Sg,{ref:u,className:B("relative overflow-hidden",l),...c,children:[e.jsx(f0,{ref:i,className:"h-full w-full rounded-[inherit]",children:n}),e.jsx(Em,{}),e.jsx(Em,{orientation:"horizontal"}),e.jsx(p0,{})]}));es.displayName=Sg.displayName;const Em=m.forwardRef(({className:l,orientation:n="vertical",...i},c)=>e.jsx(kg,{ref:c,orientation:n,className:B("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(g0,{className:"relative flex-1 rounded-full bg-border"})}));Em.displayName=kg.displayName;function Js({className:l,...n}){return e.jsx("div",{className:B("animate-pulse rounded-md bg-primary/10",l),...n})}const Bn=m.forwardRef(({className:l,value:n,...i},c)=>e.jsx(Cg,{ref:c,className:B("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",l),...i,children:e.jsx(j0,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(n||0)}%)`}})}));Bn.displayName=Cg.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 Us(){return{"Content-Type":"application/json"}}async function R1(){try{await fetch("/api/webui/auth/logout",{method:"POST",credentials:"include"})}catch(l){console.error("登出请求失败:",l)}window.location.href="/auth"}async function Fi(){try{return(await(await fetch("/api/webui/auth/check",{method:"GET",credentials:"include"})).json()).authenticated===!0}catch{return!1}}const L1={light:"",dark:".dark"},Ij=m.createContext(null);function Pj(){const l=m.useContext(Ij);if(!l)throw new Error("useChart must be used within a ");return l}const Tr=m.forwardRef(({id:l,className:n,children:i,config:c,...u},x)=>{const h=m.useId(),f=`chart-${l||h.replace(/:/g,"")}`;return e.jsx(Ij.Provider,{value:{config:c},children:e.jsxs("div",{"data-chart":f,ref:x,className:B("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(U1,{id:f,config:c}),e.jsx(J0,{children:i})]})})});Tr.displayName="Chart";const U1=({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(L1).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},Di=X0,Er=m.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}=Pj(),R=m.useMemo(()=>{if(u||!n?.length)return null;const[k]=n,I=`${b||k?.dataKey||k?.name||"value"}`,M=Mm(y,k,I),S=!b&&typeof h=="string"?y[h]?.label||h:M?.label;return f?e.jsx("div",{className:B("font-medium",p),children:f(S,n)}):S?e.jsx("div",{className:B("font-medium",p),children:S}):null},[h,f,n,u,p,y,b]);if(!l||!n?.length)return null;const D=n.length===1&&c!=="dot";return e.jsxs("div",{ref:w,className:B("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(k=>k.type!=="none").map((k,I)=>{const M=`${v||k.name||k.dataKey||"value"}`,S=Mm(y,k,M),T=N||k.payload.fill||k.color;return e.jsx("div",{className:B("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&&k?.value!==void 0&&k.name?g(k.value,k.name,k,I,k.payload):e.jsxs(e.Fragment,{children:[S?.icon?e.jsx(S.icon,{}):!x&&e.jsx("div",{className:B("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":T,"--color-border":T}}),e.jsxs("div",{className:B("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:S?.label||k.name})]}),k.value&&e.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:k.value.toLocaleString()})]})]})},k.dataKey)})})]})});Er.displayName="ChartTooltip";const B1=Z0,Hj=m.forwardRef(({className:l,hideIcon:n=!1,payload:i,verticalAlign:c="bottom",nameKey:u},x)=>{const{config:h}=Pj();return i?.length?e.jsx("div",{ref:x,className:B("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=Mm(h,f,p);return e.jsxs("div",{className:B("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});Hj.displayName="ChartLegend";function Mm(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 Rr=Lr("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"}}),C=m.forwardRef(({className:l,variant:n,size:i,asChild:c=!1,...u},x)=>{const h=c?lw:"button";return e.jsx(h,{className:B(Rr({variant:n,size:i,className:l})),ref:x,...u})});C.displayName="Button";const $1=Lr("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 Ae({className:l,variant:n,...i}){return e.jsx("div",{className:B($1({variant:n}),l),...i})}async function I1(){const l=await we("/api/webui/system/restart",{method:"POST",headers:Us()});if(!l.ok){const n=await l.json();throw new Error(n.detail||"重启失败")}return await l.json()}async function P1(){const l=await we("/api/webui/system/status",{method:"GET",headers:Us()});if(!l.ok){const n=await l.json();throw new Error(n.detail||"获取状态失败")}return await l.json()}const kr={INITIAL_DELAY:3e3,CHECK_INTERVAL:2e3,CHECK_TIMEOUT:3e3,MAX_ATTEMPTS:60,PROGRESS_INTERVAL:200,SUCCESS_REDIRECT_DELAY:1500},Gj=m.createContext(null);function Pn({children:l,onRestartComplete:n,onRestartFailed:i,healthCheckUrl:c="/api/webui/system/status",maxAttempts:u=kr.MAX_ATTEMPTS}){const[x,h]=m.useState({status:"idle",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:u}),[f,p]=m.useState({}),g=m.useCallback(()=>{f.progress&&clearInterval(f.progress),f.elapsed&&clearInterval(f.elapsed),f.check&&clearTimeout(f.check),p({})},[f]),N=m.useCallback(()=>{g(),h({status:"idle",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:u})},[g,u]),v=m.useCallback(async()=>{try{const D=new AbortController,k=setTimeout(()=>D.abort(),kr.CHECK_TIMEOUT),I=await fetch(c,{method:"GET",headers:{"Content-Type":"application/json"},credentials:"include",signal:D.signal});return clearTimeout(k),I.ok}catch{return!1}},[c]),b=m.useCallback(()=>{let D=0;const k=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"},kr.SUCCESS_REDIRECT_DELAY);else if(D>=u){g();const M=`健康检查超时 (${D}/${u})`;h(S=>({...S,status:"failed",error:M})),i?.(M)}else{const M=setTimeout(k,kr.CHECK_INTERVAL);p(S=>({...S,check:M}))}};k()},[v,g,u,n,i]),w=m.useCallback(()=>{h(D=>({...D,status:"checking",checkAttempts:0,error:void 0})),b()},[b]),y=m.useCallback(async D=>{const{delay:k=0,skipApiCall:I=!1}=D??{};if(x.status!=="idle"&&x.status!=="failed")return;if(g(),h({status:"requesting",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:u}),k>0&&await new Promise(T=>setTimeout(T,k)),I)h(T=>({...T,status:"restarting"}));else try{h(T=>({...T,status:"restarting"})),await Promise.race([I1(),new Promise(T=>setTimeout(T,5e3))])}catch{}const M=setInterval(()=>{h(T=>({...T,progress:T.progress>=90?T.progress:T.progress+1}))},kr.PROGRESS_INTERVAL),S=setInterval(()=>{h(T=>({...T,elapsedTime:T.elapsedTime+1}))},1e3);p({progress:M,elapsed:S}),setTimeout(()=>{b()},kr.INITIAL_DELAY)},[x.status,g,u,b]),R={state:x,isRestarting:x.status!=="idle",triggerRestart:y,resetState:N,retryHealthCheck:w};return e.jsx(Gj.Provider,{value:R,children:l})}function dn(){const l=m.useContext(Gj);if(!l)throw new Error("useRestart must be used within a RestartProvider");return l}function H1(){try{return dn()}catch{return null}}const G1=(l,n,i,c,u)=>({idle:{icon:null,title:"",description:"",tip:""},requesting:{icon:e.jsx(zs,{className:"h-16 w-16 text-primary animate-spin"}),title:c??"准备重启",description:u??"正在发送重启请求...",tip:"🔄 正在准备重启麦麦..."},restarting:{icon:e.jsx(zs,{className:"h-16 w-16 text-primary animate-spin"}),title:c??"正在重启麦麦",description:u??"请稍候,麦麦正在重启中...",tip:"🔄 配置已保存,正在重启主程序..."},checking:{icon:e.jsx(zs,{className:"h-16 w-16 text-primary animate-spin"}),title:"检查服务状态",description:`等待服务恢复... (${n}/${i})`,tip:"⏳ 正在等待服务恢复,请勿关闭页面..."},success:{icon:e.jsx(ea,{className:"h-16 w-16 text-green-500"}),title:"重启成功",description:"正在跳转到登录页面...",tip:"✅ 配置已生效,服务运行正常"},failed:{icon:e.jsx(Ct,{className:"h-16 w-16 text-destructive"}),title:"重启超时",description:"服务未能在预期时间内恢复",tip:"⚠️ 如果长时间无响应,请尝试手动重启"}})[l];function Hn({visible:l,onComplete:n,onFailed:i,title:c,description:u,showAnimation:x=!0,className:h}){const f=H1();return(f?f.isRestarting:l)?f?e.jsx(Fj,{state:f.state,onRetry:f.retryHealthCheck,onComplete:n,onFailed:i,title:c,description:u,showAnimation:x,className:h}):e.jsx(F1,{onComplete:n,onFailed:i,title:c,description:u,showAnimation:x,className:h}):null}function Fj({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;m.useEffect(()=>{p==="success"&&i?i():p==="failed"&&c&&c()},[p,i,c]);const w=G1(p,v,b,u,x),y=R=>{const D=Math.floor(R/60),k=R%60;return`${D}:${k.toString().padStart(2,"0")}`};return e.jsxs("div",{className:B("fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center",f),children:[h&&e.jsx(q1,{}),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(Bn,{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(C,{onClick:()=>window.location.reload(),variant:"default",className:"flex-1",children:[e.jsx(kt,{className:"mr-2 h-4 w-4"}),"刷新页面"]}),e.jsxs(C,{onClick:n,variant:"secondary",className:"flex-1",children:[e.jsx(Pi,{className:"mr-2 h-4 w-4"}),"重试检测"]})]})]})]})}function F1({onComplete:l,onFailed:n,title:i,description:c,showAnimation:u,className:x}){const[h,f]=m.useState({status:"restarting",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:60}),p=m.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 m.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(Fj,{state:h,onRetry:p,onComplete:l,onFailed:n,title:i,description:c,showAnimation:u,className:x})}function q1(){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"})]})}function V1(){return e.jsx(Pn,{children:e.jsx(Q1,{})})}const K1=l=>{const n=[];for(let i=0;i{try{w(!0);const L=await x0.get("https://v1.hitokoto.cn/?c=a&c=b&c=c&c=d&c=h&c=i&c=k");v({hitokoto:L.data.hitokoto,from:L.data.from||L.data.from_who||"未知"})}catch(L){console.error("获取一言失败:",L),v({hitokoto:"人生就像一盒巧克力,你永远不知道下一颗是什么味道。",from:"阿甘正传"})}finally{w(!1)}},[]),M=m.useCallback(async()=>{try{const L=await we("/api/webui/system/status");if(L.ok){const P=await L.json();R(P)}else R(null)}catch(L){console.error("获取机器人状态失败:",L),R(null)}},[]),S=async()=>{await D()},T=m.useCallback(async()=>{try{const L=await we(`/api/webui/statistics/dashboard?hours=${h}`);if(L.ok){const P=await L.json();n(P)}c(!1),x(100)}catch(L){console.error("Failed to fetch dashboard data:",L),c(!1),x(100)}},[h]);if(m.useEffect(()=>{if(!i)return;x(0);const L=setTimeout(()=>x(15),200),P=setTimeout(()=>x(30),800),_e=setTimeout(()=>x(45),2e3),je=setTimeout(()=>x(60),4e3),Se=setTimeout(()=>x(75),6500),Y=setTimeout(()=>x(85),9e3),be=setTimeout(()=>x(92),11e3);return()=>{clearTimeout(L),clearTimeout(P),clearTimeout(_e),clearTimeout(je),clearTimeout(Se),clearTimeout(Y),clearTimeout(be)}},[i]),m.useEffect(()=>{T(),I(),M()},[T,I,M]),m.useEffect(()=>{if(!p)return;const L=setInterval(()=>{T(),M()},3e4);return()=>clearInterval(L)},[p,T,M]),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(kt,{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(Bn,{value:u,className:"h-2"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[u,"%"]})]})]})});const{summary:$,model_stats:A=[],hourly_data:Q=[],daily_data:G=[],recent_activity:de=[]}=l,oe=$??{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},ve=L=>{const P=Math.floor(L/3600),_e=Math.floor(L%3600/60);return`${P}小时${_e}分钟`},le=L=>{const P=L.toLocaleString("zh-CN");return L>=1e9?{display:`${(L/1e9).toFixed(2)}B`,exact:P,needsExact:!0}:L>=1e6?{display:`${(L/1e6).toFixed(2)}M`,exact:P,needsExact:!0}:L>=1e4?{display:`${(L/1e3).toFixed(1)}K`,exact:P,needsExact:!0}:L>=1e3?{display:`${(L/1e3).toFixed(2)}K`,exact:P,needsExact:!0}:{display:P,exact:P,needsExact:!1}},fe=L=>{const P=`¥${L.toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2})}`;return L>=1e6?{display:`¥${(L/1e6).toFixed(2)}M`,exact:P,needsExact:!0}:L>=1e4?{display:`¥${(L/1e3).toFixed(1)}K`,exact:P,needsExact:!0}:L>=1e3?{display:`¥${(L/1e3).toFixed(2)}K`,exact:P,needsExact:!0}:{display:P,exact:P,needsExact:!1}},ge=L=>new Date(L).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),z=K1(A.length),V=A.map((L,P)=>({name:L.model_name,value:L.request_count,fill:z[P]})),U={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(es,{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(ma,{value:h.toString(),onValueChange:L=>f(Number(L)),children:e.jsxs(ta,{className:"grid grid-cols-3 w-full sm:w-auto",children:[e.jsx(as,{value:"24",children:"24小时"}),e.jsx(as,{value:"168",children:"7天"}),e.jsx(as,{value:"720",children:"30天"})]})}),e.jsxs(C,{variant:p?"default":"outline",size:"sm",onClick:()=>g(!p),className:"gap-2",children:[e.jsx(kt,{className:`h-4 w-4 ${p?"animate-spin":""}`}),e.jsx("span",{className:"hidden sm:inline",children:"自动刷新"})]}),e.jsx(C,{variant:"outline",size:"sm",onClick:T,children:e.jsx(kt,{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(C,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:I,disabled:b,children:e.jsx(kt,{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(De,{className:"lg:col-span-1",children:[e.jsx(Xe,{className:"pb-3",children:e.jsxs(We,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Ji,{className:"h-4 w-4"}),"麦麦状态"]})}),e.jsx(Qe,{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(Ae,{variant:"outline",className:"text-green-600 border-green-300 bg-green-50",children:[e.jsx(ea,{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(Ae,{variant:"outline",className:"text-red-600 border-red-300 bg-red-50",children:[e.jsx(Ct,{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:["运行 ",ve(y.uptime)]})]})]})})]}),e.jsxs(De,{children:[e.jsx(Xe,{className:"pb-3",children:e.jsxs(We,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(zn,{className:"h-4 w-4"}),"快速操作"]})}),e.jsx(Qe,{children:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(C,{variant:"outline",size:"sm",onClick:S,disabled:k,className:"gap-2",children:[e.jsx(Pi,{className:`h-4 w-4 ${k?"animate-spin":""}`}),k?"重启中...":"重启麦麦"]}),e.jsx(C,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Cr,{to:"/logs",children:[e.jsx(qa,{className:"h-4 w-4"}),"查看日志"]})}),e.jsx(C,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Cr,{to:"/plugins",children:[e.jsx(Cw,{className:"h-4 w-4"}),"插件管理"]})}),e.jsx(C,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Cr,{to:"/settings",children:[e.jsx(In,{className:"h-4 w-4"}),"系统设置"]})})]})})]}),e.jsxs(De,{children:[e.jsxs(Xe,{className:"pb-3",children:[e.jsxs(We,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Tw,{className:"h-4 w-4"}),"反馈问卷"]}),e.jsx(Is,{className:"text-xs",children:"帮助我们改进产品体验"})]}),e.jsx(Qe,{children:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(C,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Cr,{to:"/survey/webui-feedback",children:[e.jsx(qa,{className:"h-4 w-4"}),"WebUI 反馈"]})}),e.jsx(C,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Cr,{to:"/survey/maibot-feedback",children:[e.jsx(on,{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(De,{children:[e.jsxs(Xe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(We,{className:"text-sm font-medium",children:"总请求数"}),e.jsx(Ew,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Qe,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[le(oe.total_requests).display,le(oe.total_requests).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",le(oe.total_requests).exact,")"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["最近",h<48?h+"小时":Math.floor(h/24)+"天"]})]})]}),e.jsxs(De,{children:[e.jsxs(Xe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(We,{className:"text-sm font-medium",children:"总花费"}),e.jsx(Mw,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Qe,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[fe(oe.total_cost).display,fe(oe.total_cost).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",fe(oe.total_cost).exact,")"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:oe.cost_per_hour>0?`¥${oe.cost_per_hour.toFixed(2)}/小时`:"暂无数据"})]})]}),e.jsxs(De,{children:[e.jsxs(Xe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(We,{className:"text-sm font-medium",children:"Token消耗"}),e.jsx(zr,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Qe,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[le(oe.total_tokens).display,le(oe.total_tokens).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",le(oe.total_tokens).exact,")"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:oe.tokens_per_hour>0?`${le(oe.tokens_per_hour).display}/小时`:"暂无数据"})]})]}),e.jsxs(De,{children:[e.jsxs(Xe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(We,{className:"text-sm font-medium",children:"平均响应"}),e.jsx(zn,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Qe,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[oe.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(De,{children:[e.jsxs(Xe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(We,{className:"text-sm font-medium",children:"在线时长"}),e.jsx(kl,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(Qe,{children:e.jsxs("div",{className:"text-xl font-bold",children:[ve(oe.online_time),e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",oe.online_time.toLocaleString(),"秒)"]})]})})]}),e.jsxs(De,{children:[e.jsxs(Xe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(We,{className:"text-sm font-medium",children:"消息处理"}),e.jsx(on,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Qe,{children:[e.jsxs("div",{className:"text-xl font-bold",children:[le(oe.total_messages).display,le(oe.total_messages).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",le(oe.total_messages).exact,")"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["回复 ",le(oe.total_replies).display,le(oe.total_replies).needsExact&&e.jsxs("span",{children:["(",le(oe.total_replies).exact,")"]})," 条"]})]})]}),e.jsxs(De,{children:[e.jsxs(Xe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(We,{className:"text-sm font-medium",children:"成本效率"}),e.jsx(Aw,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Qe,{children:[e.jsx("div",{className:"text-xl font-bold",children:oe.total_messages>0?`¥${(oe.total_cost/oe.total_messages*100).toFixed(2)}`:"¥0.00"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"每100条消息"})]})]})]}),e.jsxs(ma,{defaultValue:"trends",className:"space-y-4",children:[e.jsxs(ta,{className:"grid w-full grid-cols-2 sm:grid-cols-4",children:[e.jsx(as,{value:"trends",children:"趋势"}),e.jsx(as,{value:"models",children:"模型"}),e.jsx(as,{value:"activity",children:"活动"}),e.jsx(as,{value:"daily",children:"日统计"})]}),e.jsxs(ys,{value:"trends",className:"space-y-4",children:[e.jsxs(De,{children:[e.jsxs(Xe,{children:[e.jsx(We,{children:"请求趋势"}),e.jsxs(Is,{children:["最近",h,"小时的请求量变化"]})]}),e.jsx(Qe,{children:e.jsx(Tr,{config:U,className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:e.jsxs(W0,{data:Q,children:[e.jsx(fo,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(po,{dataKey:"timestamp",tickFormatter:L=>ge(L),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Ai,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Di,{content:e.jsx(Er,{labelFormatter:L=>ge(L)})}),e.jsx(ew,{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(De,{children:[e.jsxs(Xe,{children:[e.jsx(We,{children:"花费趋势"}),e.jsx(Is,{children:"API调用成本变化"})]}),e.jsx(Qe,{children:e.jsx(Tr,{config:U,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:e.jsxs(om,{data:Q,children:[e.jsx(fo,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(po,{dataKey:"timestamp",tickFormatter:L=>ge(L),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Ai,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Di,{content:e.jsx(Er,{labelFormatter:L=>ge(L)})}),e.jsx(go,{dataKey:"cost",fill:"var(--color-cost)"})]})})})]}),e.jsxs(De,{children:[e.jsxs(Xe,{children:[e.jsx(We,{children:"Token消耗"}),e.jsx(Is,{children:"Token使用量变化"})]}),e.jsx(Qe,{children:e.jsx(Tr,{config:U,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:e.jsxs(om,{data:Q,children:[e.jsx(fo,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(po,{dataKey:"timestamp",tickFormatter:L=>ge(L),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Ai,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Di,{content:e.jsx(Er,{labelFormatter:L=>ge(L)})}),e.jsx(go,{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(De,{children:[e.jsxs(Xe,{children:[e.jsx(We,{children:"模型请求分布"}),e.jsxs(Is,{children:["各模型使用占比 (共 ",A.length," 个模型)"]})]}),e.jsx(Qe,{children:e.jsx(Tr,{config:Object.fromEntries(A.map((L,P)=>[L.model_name,{label:L.model_name,color:z[P]}])),className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:e.jsxs(sw,{children:[e.jsx(Di,{content:e.jsx(Er,{})}),e.jsx(tw,{data:V,cx:"50%",cy:"50%",labelLine:!1,label:({name:L,percent:P})=>P&&P<.05?"":`${L} ${P?(P*100).toFixed(0):0}%`,outerRadius:100,dataKey:"value",children:V.map((L,P)=>e.jsx(aw,{fill:L.fill},`cell-${P}`))})]})})})]}),e.jsxs(De,{children:[e.jsxs(Xe,{children:[e.jsx(We,{children:"模型详细统计"}),e.jsx(Is,{children:"请求数、花费和性能"})]}),e.jsx(Qe,{children:e.jsx(es,{className:"h-[300px] sm:h-[400px]",children:e.jsx("div",{className:"space-y-3",children:A.map((L,P)=>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:L.model_name}),e.jsx("div",{className:"w-3 h-3 rounded-full ml-2 flex-shrink-0",style:{backgroundColor:`hsl(var(--chart-${P%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:L.request_count.toLocaleString()})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"花费:"}),e.jsxs("span",{className:"ml-1 font-medium",children:["¥",L.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:[(L.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:[L.avg_response_time.toFixed(2),"s"]})]})]})]},P))})})})]})]})}),e.jsx(ys,{value:"activity",children:e.jsxs(De,{children:[e.jsxs(Xe,{children:[e.jsx(We,{children:"最近活动"}),e.jsx(Is,{children:"最新的API调用记录"})]}),e.jsx(Qe,{children:e.jsx(es,{className:"h-[400px] sm:h-[500px]",children:e.jsx("div",{className:"space-y-2",children:de.map((L,P)=>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:L.model}),e.jsx("div",{className:"text-xs text-muted-foreground",children:L.request_type})]}),e.jsx("div",{className:"text-xs text-muted-foreground flex-shrink-0",children:ge(L.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:L.tokens})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"花费:"}),e.jsxs("span",{className:"ml-1",children:["¥",L.cost.toFixed(4)]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"耗时:"}),e.jsxs("span",{className:"ml-1",children:[L.time_cost.toFixed(2),"s"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"状态:"}),e.jsx("span",{className:`ml-1 ${L.status==="success"?"text-green-600":"text-red-600"}`,children:L.status})]})]})]},P))})})})]})}),e.jsx(ys,{value:"daily",children:e.jsxs(De,{children:[e.jsxs(Xe,{children:[e.jsx(We,{children:"每日统计"}),e.jsx(Is,{children:"最近7天的数据汇总"})]}),e.jsx(Qe,{children:e.jsx(Tr,{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(om,{data:G,children:[e.jsx(fo,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(po,{dataKey:"timestamp",tickFormatter:L=>{const P=new Date(L);return`${P.getMonth()+1}/${P.getDate()}`},stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Ai,{yAxisId:"left",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Ai,{yAxisId:"right",orientation:"right",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Di,{content:e.jsx(Er,{labelFormatter:L=>new Date(L).toLocaleDateString("zh-CN")})}),e.jsx(B1,{content:e.jsx(Hj,{})}),e.jsx(go,{yAxisId:"left",dataKey:"requests",fill:"var(--color-requests)"}),e.jsx(go,{yAxisId:"right",dataKey:"cost",fill:"var(--color-cost)"})]})})})]})})]}),e.jsx(Hn,{})]})})}const Y1={theme:"system",setTheme:()=>null},qj=m.createContext(Y1),Bm=()=>{const l=m.useContext(qj);if(l===void 0)throw new Error("useTheme must be used within a ThemeProvider");return l},J1=(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)"})})},Vj=m.createContext(void 0),Kj=()=>{const l=m.useContext(Vj);if(l===void 0)throw new Error("useAnimation must be used within an AnimationProvider");return l},Ge=m.forwardRef(({className:l,...n},i)=>e.jsx(Tg,{className:B("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(v0,{className:B("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=Tg.displayName;const X1=Lr("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),E=m.forwardRef(({className:l,...n},i)=>e.jsx(qg,{ref:i,className:B(X1(),l),...n}));E.displayName=qg.displayName;const ie=m.forwardRef(({className:l,type:n,...i},c)=>e.jsx("input",{type:n,className:B("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}));ie.displayName="Input";const Z1=5,W1=5e3;let fm=0;function e2(){return fm=(fm+1)%Number.MAX_SAFE_INTEGER,fm.toString()}const pm=new Map,eg=l=>{if(pm.has(l))return;const n=setTimeout(()=>{pm.delete(l),$i({type:"REMOVE_TOAST",toastId:l})},W1);pm.set(l,n)},s2=(l,n)=>{switch(n.type){case"ADD_TOAST":return{...l,toasts:[n.toast,...l.toasts].slice(0,Z1)};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?eg(i):l.toasts.forEach(c=>{eg(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)}}},wo=[];let _o={toasts:[]};function $i(l){_o=s2(_o,l),wo.forEach(n=>{n(_o)})}function Gt({...l}){const n=e2(),i=u=>$i({type:"UPDATE_TOAST",toast:{...u,id:n}}),c=()=>$i({type:"DISMISS_TOAST",toastId:n});return $i({type:"ADD_TOAST",toast:{...l,id:n,open:!0,onOpenChange:u=>{u||c()}}}),{id:n,dismiss:c,update:i}}function Ws(){const[l,n]=m.useState(_o);return m.useEffect(()=>(wo.push(n),()=>{const i=wo.indexOf(n);i>-1&&wo.splice(i,1)}),[l]),{...l,toast:Gt,dismiss:i=>$i({type:"DISMISS_TOAST",toastId:i})}}const t2=[{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 a2(l){const n=t2.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 Po="0.12.0",$m="MaiBot Dashboard",l2=`${$m} v${Po}`,n2=(l="v")=>`${l}${Po}`,ua={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"},sl={theme:"system",accentColor:"blue",enableAnimations:!0,enableWavesBackground:!0,logCacheSize:1e3,logAutoScroll:!0,logFontSize:"xs",logLineSpacing:4,dataSyncInterval:30,wsReconnectInterval:3e3,wsMaxReconnectAttempts:10};function Nt(l){const n=Qj(l),i=localStorage.getItem(n);if(i===null)return sl[l];const c=sl[l];if(typeof c=="boolean")return i==="true";if(typeof c=="number"){const u=parseFloat(i);return isNaN(u)?c:u}return i}function Mr(l,n){const i=Qj(l);localStorage.setItem(i,String(n)),window.dispatchEvent(new CustomEvent("maibot-settings-change",{detail:{key:l,value:n}}))}function r2(){return{theme:Nt("theme"),accentColor:Nt("accentColor"),enableAnimations:Nt("enableAnimations"),enableWavesBackground:Nt("enableWavesBackground"),logCacheSize:Nt("logCacheSize"),logAutoScroll:Nt("logAutoScroll"),logFontSize:Nt("logFontSize"),logLineSpacing:Nt("logLineSpacing"),dataSyncInterval:Nt("dataSyncInterval"),wsReconnectInterval:Nt("wsReconnectInterval"),wsMaxReconnectAttempts:Nt("wsMaxReconnectAttempts")}}function i2(){const l=r2(),n=localStorage.getItem(ua.COMPLETED_TOURS),i=n?JSON.parse(n):[];return{...l,completedTours:i}}function c2(l){const n=[],i=[];for(const[c,u]of Object.entries(l)){if(c==="completedTours"){Array.isArray(u)?(localStorage.setItem(ua.COMPLETED_TOURS,JSON.stringify(u)),n.push("completedTours")):i.push("completedTours");continue}if(c in sl){const x=c,h=sl[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}Mr(x,u),n.push(c)}else i.push(c)}else i.push(c)}return{success:n.length>0,imported:n,skipped:i}}function o2(){for(const l of Object.keys(sl))Mr(l,sl[l]);localStorage.removeItem(ua.COMPLETED_TOURS),window.dispatchEvent(new CustomEvent("maibot-settings-reset"))}function d2(){const l=[],n=[],i=[];for(let c=0;cc.size-i.size),{used:l,items:localStorage.length,details:n}}function u2(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 Qj(l){return{theme:ua.THEME,accentColor:ua.ACCENT_COLOR,enableAnimations:ua.ENABLE_ANIMATIONS,enableWavesBackground:ua.ENABLE_WAVES_BACKGROUND,logCacheSize:ua.LOG_CACHE_SIZE,logAutoScroll:ua.LOG_AUTO_SCROLL,logFontSize:ua.LOG_FONT_SIZE,logLineSpacing:ua.LOG_LINE_SPACING,dataSyncInterval:ua.DATA_SYNC_INTERVAL,wsReconnectInterval:ua.WS_RECONNECT_INTERVAL,wsMaxReconnectAttempts:ua.WS_MAX_RECONNECT_ATTEMPTS}[l]}const wa=m.forwardRef(({className:l,...n},i)=>e.jsxs(Eg,{ref:i,className:B("relative flex w-full touch-none select-none items-center",l),...n,children:[e.jsx(N0,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:e.jsx(b0,{className:"absolute h-full bg-primary"})}),e.jsx(y0,{className:"block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"})]}));wa.displayName=Eg.displayName;class m2{ws=null;reconnectTimeout=null;reconnectAttempts=0;heartbeatInterval=null;logCallbacks=new Set;connectionCallbacks=new Set;isConnected=!1;logCache=[];getMaxCacheSize(){return Nt("logCacheSize")}getMaxReconnectAttempts(){return Nt("wsMaxReconnectAttempts")}getReconnectInterval(){return Nt("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 Fi()){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 Mn=new m2;typeof window<"u"&&setTimeout(()=>{Mn.connect()},100);const Ks=iw,Ho=cw,x2=nw,Yj=m.forwardRef(({className:l,...n},i)=>e.jsx(Vg,{ref:i,className:B("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}));Yj.displayName=Vg.displayName;const Ps=m.forwardRef(({className:l,children:n,preventOutsideClose:i=!1,...c},u)=>e.jsxs(x2,{children:[e.jsx(Yj,{}),e.jsxs(Kg,{ref:u,className:B("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(rw,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(_a,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ps.displayName=Kg.displayName;const Hs=({className:l,...n})=>e.jsx("div",{className:B("flex flex-col space-y-1.5 text-center sm:text-left",l),...n});Hs.displayName="DialogHeader";const xt=({className:l,...n})=>e.jsx("div",{className:B("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",l),...n});xt.displayName="DialogFooter";const Gs=m.forwardRef(({className:l,...n},i)=>e.jsx(Qg,{ref:i,className:B("text-lg font-semibold leading-none tracking-tight",l),...n}));Gs.displayName=Qg.displayName;const ot=m.forwardRef(({className:l,...n},i)=>e.jsx(Yg,{ref:i,className:B("text-sm text-muted-foreground",l),...n}));ot.displayName=Yg.displayName;const ps=_0,bt=S0,h2=w0,Jj=m.forwardRef(({className:l,...n},i)=>e.jsx(Mg,{className:B("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}));Jj.displayName=Mg.displayName;const os=m.forwardRef(({className:l,...n},i)=>e.jsxs(h2,{children:[e.jsx(Jj,{}),e.jsx(Ag,{ref:i,className:B("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})]}));os.displayName=Ag.displayName;const ds=({className:l,...n})=>e.jsx("div",{className:B("flex flex-col space-y-2 text-center sm:text-left",l),...n});ds.displayName="AlertDialogHeader";const us=({className:l,...n})=>e.jsx("div",{className:B("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",l),...n});us.displayName="AlertDialogFooter";const ms=m.forwardRef(({className:l,...n},i)=>e.jsx(zg,{ref:i,className:B("text-lg font-semibold",l),...n}));ms.displayName=zg.displayName;const xs=m.forwardRef(({className:l,...n},i)=>e.jsx(Dg,{ref:i,className:B("text-sm text-muted-foreground",l),...n}));xs.displayName=Dg.displayName;const hs=m.forwardRef(({className:l,variant:n,...i},c)=>e.jsx(Og,{ref:c,className:B(Rr({variant:n}),l),...i}));hs.displayName=Og.displayName;const fs=m.forwardRef(({className:l,...n},i)=>e.jsx(Rg,{ref:i,className:B(Rr({variant:"outline"}),"mt-2 sm:mt-0",l),...n}));fs.displayName=Rg.displayName;function f2(){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(ma,{defaultValue:"appearance",className:"w-full",children:[e.jsxs(ta,{className:"grid w-full grid-cols-2 sm:grid-cols-4 gap-0.5 sm:gap-1 h-auto p-1",children:[e.jsxs(as,{value:"appearance",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(zw,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"外观"})]}),e.jsxs(as,{value:"security",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(mj,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"安全"})]}),e.jsxs(as,{value:"other",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(In,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"其他"})]}),e.jsxs(as,{value:"about",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(qt,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"关于"})]})]}),e.jsxs(es,{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(p2,{})}),e.jsx(ys,{value:"security",className:"mt-0",children:e.jsx(g2,{})}),e.jsx(ys,{value:"other",className:"mt-0",children:e.jsx(j2,{})}),e.jsx(ys,{value:"about",className:"mt-0",children:e.jsx(v2,{})})]})]})]})}function tg(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");m.useEffect(()=>{const g=localStorage.getItem("accent-color")||"blue";tg(g)},[]);const p=g=>{f(g),localStorage.setItem("accent-color",g),tg(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(gm,{value:"light",current:l,onChange:n,label:"浅色",description:"始终使用浅色主题"}),e.jsx(gm,{value:"dark",current:l,onChange:n,label:"深色",description:"始终使用深色主题"}),e.jsx(gm,{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(Ba,{value:"blue",current:h,onChange:p,label:"蓝色",colorClass:"bg-blue-500"}),e.jsx(Ba,{value:"purple",current:h,onChange:p,label:"紫色",colorClass:"bg-purple-500"}),e.jsx(Ba,{value:"green",current:h,onChange:p,label:"绿色",colorClass:"bg-green-500"}),e.jsx(Ba,{value:"orange",current:h,onChange:p,label:"橙色",colorClass:"bg-orange-500"}),e.jsx(Ba,{value:"pink",current:h,onChange:p,label:"粉色",colorClass:"bg-pink-500"}),e.jsx(Ba,{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(Ba,{value:"gradient-sunset",current:h,onChange:p,label:"日落",colorClass:"bg-gradient-to-r from-orange-500 to-pink-500"}),e.jsx(Ba,{value:"gradient-ocean",current:h,onChange:p,label:"海洋",colorClass:"bg-gradient-to-r from-blue-500 to-cyan-500"}),e.jsx(Ba,{value:"gradient-forest",current:h,onChange:p,label:"森林",colorClass:"bg-gradient-to-r from-green-500 to-emerald-500"}),e.jsx(Ba,{value:"gradient-aurora",current:h,onChange:p,label:"极光",colorClass:"bg-gradient-to-r from-purple-500 to-pink-500"}),e.jsx(Ba,{value:"gradient-fire",current:h,onChange:p,label:"烈焰",colorClass:"bg-gradient-to-r from-red-500 to-orange-500"}),e.jsx(Ba,{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(ie,{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(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(E,{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 g2(){const l=aa(),[n,i]=m.useState(""),[c,u]=m.useState(""),[x,h]=m.useState(!1),[f,p]=m.useState(!1),[g,N]=m.useState(!1),[v,b]=m.useState(!1),[w,y]=m.useState(!1),[R,D]=m.useState(!1),[k,I]=m.useState(""),[M,S]=m.useState(!1),{toast:T}=Ws(),$=m.useMemo(()=>a2(c),[c]),A=async le=>{if(!n){T({title:"无法复制",description:"Token 存储在安全 Cookie 中,请重新生成以获取新 Token",variant:"destructive"});return}try{await navigator.clipboard.writeText(le),y(!0),T({title:"复制成功",description:"Token 已复制到剪贴板"}),setTimeout(()=>y(!1),2e3)}catch{T({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},Q=async()=>{if(!c.trim()){T({title:"输入错误",description:"请输入新的 Token",variant:"destructive"});return}if(!$.isValid){const le=$.rules.filter(fe=>!fe.passed).map(fe=>fe.label).join(", ");T({title:"格式错误",description:`Token 不符合要求: ${le}`,variant:"destructive"});return}N(!0);try{const le=await fetch("/api/webui/auth/update",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({new_token:c.trim()})}),fe=await le.json();le.ok&&fe.success?(u(""),i(c.trim()),T({title:"更新成功",description:"Access Token 已更新,即将跳转到登录页"}),setTimeout(()=>{l({to:"/auth"})},1500)):T({title:"更新失败",description:fe.message||"无法更新 Token",variant:"destructive"})}catch(le){console.error("更新 Token 错误:",le),T({title:"更新失败",description:"连接服务器失败",variant:"destructive"})}finally{N(!1)}},G=async()=>{b(!0);try{const le=await fetch("/api/webui/auth/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"}),fe=await le.json();le.ok&&fe.success?(i(fe.token),I(fe.token),D(!0),S(!1),T({title:"生成成功",description:"新的 Access Token 已生成,请及时保存"})):T({title:"生成失败",description:fe.message||"无法生成新 Token",variant:"destructive"})}catch(le){console.error("生成 Token 错误:",le),T({title:"生成失败",description:"连接服务器失败",variant:"destructive"})}finally{b(!1)}},de=async()=>{try{await navigator.clipboard.writeText(k),S(!0),T({title:"复制成功",description:"Token 已复制到剪贴板"})}catch{T({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},oe=()=>{D(!1),setTimeout(()=>{I(""),S(!1)},300),setTimeout(()=>{l({to:"/auth"})},500)},ve=le=>{le||oe()};return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsx(Ks,{open:R,onOpenChange:ve,children:e.jsxs(Ps,{className:"sm:max-w-md",children:[e.jsxs(Hs,{children:[e.jsxs(Gs,{className:"flex items-center gap-2",children:[e.jsx(Ft,{className:"h-5 w-5 text-yellow-500"}),"新的 Access Token"]}),e.jsx(ot,{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:k})]}),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(Ft,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[e.jsx("p",{className:"font-semibold",children:"重要提示"}),e.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[e.jsx("li",{children:"此 Token 仅显示一次,关闭后无法再查看"}),e.jsx("li",{children:"请立即复制并保存到安全的位置"}),e.jsx("li",{children:"关闭窗口后将自动跳转到登录页面"}),e.jsx("li",{children:"请使用新 Token 重新登录系统"})]})]})]})})]}),e.jsxs(xt,{className:"gap-2 sm:gap-0",children:[e.jsx(C,{variant:"outline",onClick:de,className:"gap-2",children:M?e.jsxs(e.Fragment,{children:[e.jsx(St,{className:"h-4 w-4 text-green-500"}),"已复制"]}):e.jsxs(e.Fragment,{children:[e.jsx(ko,{className:"h-4 w-4"}),"复制 Token"]})}),e.jsx(C,{onClick:oe,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(ie,{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):T({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(Hi,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(sa,{className:"h-4 w-4 text-muted-foreground"})})]}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[e.jsx(C,{variant:"outline",size:"icon",onClick:()=>A(n),title:"复制到剪贴板",className:"flex-shrink-0",disabled:!n,children:w?e.jsx(St,{className:"h-4 w-4 text-green-500"}):e.jsx(ko,{className:"h-4 w-4"})}),e.jsxs(ps,{children:[e.jsx(bt,{asChild:!0,children:e.jsxs(C,{variant:"outline",disabled:v,className:"gap-2 flex-1 sm:flex-none",children:[e.jsx(kt,{className:B("h-4 w-4",v&&"animate-spin")}),e.jsx("span",{className:"hidden sm:inline",children:"重新生成"}),e.jsx("span",{className:"sm:hidden",children:"生成"})]})}),e.jsxs(os,{children:[e.jsxs(ds,{children:[e.jsx(ms,{children:"确认重新生成 Token"}),e.jsx(xs,{children:"这将生成一个新的 64 位安全令牌,并使当前 Token 立即失效。 您需要使用新 Token 重新登录系统。此操作不可撤销,确定要继续吗?"})]}),e.jsxs(us,{children:[e.jsx(fs,{children:"取消"}),e.jsx(hs,{onClick:G,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(ie,{id:"new-token",type:f?"text":"password",value:c,onChange:le=>u(le.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(Hi,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(sa,{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:$.rules.map(le=>e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[le.passed?e.jsx(ea,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):e.jsx(xj,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:B(le.passed?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:le.label})]},le.id))}),$.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(St,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:"Token 格式正确,可以使用"})]})})]})]}),e.jsx(C,{onClick:Q,disabled:g||!$.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 j2(){const l=aa(),{toast:n}=Ws(),[i,c]=m.useState(!1),[u,x]=m.useState(!1),[h,f]=m.useState(()=>Nt("logCacheSize")),[p,g]=m.useState(()=>Nt("wsReconnectInterval")),[N,v]=m.useState(()=>Nt("wsMaxReconnectAttempts")),[b,w]=m.useState(()=>Nt("dataSyncInterval")),[y,R]=m.useState(()=>sg()),[D,k]=m.useState(!1),[I,M]=m.useState(!1),S=m.useRef(null);if(u)throw new Error("这是一个手动触发的测试错误,用于验证错误边界组件是否正常工作。");const T=()=>{R(sg())},$=z=>{const V=z[0];f(V),Mr("logCacheSize",V)},A=z=>{const V=z[0];g(V),Mr("wsReconnectInterval",V)},Q=z=>{const V=z[0];v(V),Mr("wsMaxReconnectAttempts",V)},G=z=>{const V=z[0];w(V),Mr("dataSyncInterval",V)},de=()=>{Mn.clearLogs(),n({title:"日志已清除",description:"日志缓存已清空"})},oe=()=>{const z=d2();T(),n({title:"缓存已清除",description:`已清除 ${z.clearedKeys.length} 项缓存数据`})},ve=()=>{k(!0);try{const z=i2(),V=JSON.stringify(z,null,2),U=new Blob([V],{type:"application/json"}),L=URL.createObjectURL(U),P=document.createElement("a");P.href=L,P.download=`maibot-webui-settings-${new Date().toISOString().slice(0,10)}.json`,document.body.appendChild(P),P.click(),document.body.removeChild(P),URL.revokeObjectURL(L),n({title:"导出成功",description:"设置已导出为 JSON 文件"})}catch(z){console.error("导出设置失败:",z),n({title:"导出失败",description:"无法导出设置",variant:"destructive"})}finally{k(!1)}},le=z=>{const V=z.target.files?.[0];if(!V)return;M(!0);const U=new FileReader;U.onload=L=>{try{const P=L.target?.result,_e=JSON.parse(P),je=c2(_e);je.success?(f(Nt("logCacheSize")),g(Nt("wsReconnectInterval")),v(Nt("wsMaxReconnectAttempts")),w(Nt("dataSyncInterval")),T(),n({title:"导入成功",description:`成功导入 ${je.imported.length} 项设置${je.skipped.length>0?`,跳过 ${je.skipped.length} 项`:""}`}),(je.imported.includes("theme")||je.imported.includes("accentColor"))&&n({title:"提示",description:"部分设置需要刷新页面才能完全生效"})):n({title:"导入失败",description:"没有有效的设置项可导入",variant:"destructive"})}catch(P){console.error("导入设置失败:",P),n({title:"导入失败",description:"文件格式无效",variant:"destructive"})}finally{M(!1),S.current&&(S.current.value="")}},U.readAsText(V)},fe=()=>{o2(),f(sl.logCacheSize),g(sl.wsReconnectInterval),v(sl.wsMaxReconnectAttempts),w(sl.dataSyncInterval),T(),n({title:"已重置",description:"所有设置已恢复为默认值,刷新页面以应用更改"})},ge=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(zr,{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(Dw,{className:"h-4 w-4"}),"本地存储使用"]}),e.jsx(C,{variant:"ghost",size:"sm",onClick:T,className:"h-7 px-2",children:e.jsx(kt,{className:"h-3 w-3"})})]}),e.jsx("div",{className:"text-2xl font-bold text-primary",children:u2(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(E,{className:"text-sm font-medium",children:"日志缓存大小"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[h," 条"]})]}),e.jsx(wa,{value:[h],onValueChange:$,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:[b," 秒"]})]}),e.jsx(wa,{value:[b],onValueChange:G,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(wa,{value:[p],onValueChange:A,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(wa,{value:[N],onValueChange:Q,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(C,{variant:"outline",size:"sm",onClick:de,className:"gap-2",children:[e.jsx(ls,{className:"h-4 w-4"}),"清除日志缓存"]}),e.jsxs(ps,{children:[e.jsx(bt,{asChild:!0,children:e.jsxs(C,{variant:"outline",size:"sm",className:"gap-2",children:[e.jsx(ls,{className:"h-4 w-4"}),"清除本地缓存"]})}),e.jsxs(os,{children:[e.jsxs(ds,{children:[e.jsx(ms,{children:"确认清除本地缓存"}),e.jsx(xs,{children:"这将清除所有本地缓存的设置和数据(不包括登录凭证)。 您可能需要重新配置部分偏好设置。确定要继续吗?"})]}),e.jsxs(us,{children:[e.jsx(fs,{children:"取消"}),e.jsx(hs,{onClick:oe,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(Xt,{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(C,{variant:"outline",onClick:ve,disabled:D,className:"gap-2",children:[e.jsx(Xt,{className:"h-4 w-4"}),D?"导出中...":"导出设置"]}),e.jsx("input",{ref:S,type:"file",accept:".json",onChange:le,className:"hidden"}),e.jsxs(C,{variant:"outline",onClick:()=>S.current?.click(),disabled:I,className:"gap-2",children:[e.jsx(Gi,{className:"h-4 w-4"}),I?"导入中...":"导入设置"]})]}),e.jsx("div",{className:"pt-2 border-t",children:e.jsxs(ps,{children:[e.jsx(bt,{asChild:!0,children:e.jsxs(C,{variant:"outline",size:"sm",className:"gap-2 text-destructive hover:text-destructive",children:[e.jsx(Pi,{className:"h-4 w-4"}),"重置所有设置为默认值"]})}),e.jsxs(os,{children:[e.jsxs(ds,{children:[e.jsx(ms,{children:"确认重置所有设置"}),e.jsx(xs,{children:"这将把所有界面设置恢复为默认值,包括主题、颜色、动画等偏好设置。 此操作不会影响您的登录状态。确定要继续吗?"})]}),e.jsxs(us,{children:[e.jsx(fs,{children:"取消"}),e.jsx(hs,{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(ps,{children:[e.jsx(bt,{asChild:!0,children:e.jsxs(C,{variant:"outline",disabled:i,className:"gap-2",children:[e.jsx(Pi,{className:B("h-4 w-4",i&&"animate-spin")}),"重新进行初次配置"]})}),e.jsxs(os,{children:[e.jsxs(ds,{children:[e.jsx(ms,{children:"确认重新配置"}),e.jsx(xs,{children:"这将带您重新进入初次配置向导。您可以重新设置系统的基础配置项。确定要继续吗?"})]}),e.jsxs(us,{children:[e.jsx(fs,{children:"取消"}),e.jsx(hs,{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(Ft,{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(ps,{children:[e.jsx(bt,{asChild:!0,children:e.jsxs(C,{variant:"destructive",className:"gap-2",children:[e.jsx(Ft,{className:"h-4 w-4"}),"触发测试错误"]})}),e.jsxs(os,{children:[e.jsxs(ds,{children:[e.jsx(ms,{children:"确认触发错误"}),e.jsx(xs,{children:"这将手动触发一个 React 错误,用于测试错误边界组件的显示效果。 页面将显示错误界面,您可以通过刷新页面或点击返回首页来恢复。"})]}),e.jsxs(us,{children:[e.jsx(fs,{children:"取消"}),e.jsx(hs,{onClick:()=>x(!0),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认触发"})]})]})]})]})]})]})}function v2(){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:B("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:["关于 ",$m]}),e.jsxs("div",{className:"space-y-2 text-xs sm:text-sm text-muted-foreground",children:[e.jsxs("p",{children:["版本: ",Po]}),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(es,{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 gm({value:l,current:n,onChange:i,label:c,description:u}){const x=n===l;return e.jsxs("button",{onClick:()=>i(l),className:B("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 Ba({value:l,current:n,onChange:i,label:c,colorClass:u}){const x=n===l;return e.jsxs("button",{onClick:()=>i(l),className:B("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:B("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 N2=Date.now()%1e6;class b2{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 ag(){const l=m.useRef(null),n=m.useRef(null),i=m.useRef(void 0),[c]=m.useState(()=>new b2(N2)),u=m.useRef({mouse:{x:-10,y:0,lx:0,ly:0,sx:0,sy:0,v:0,vs:0,a:0,set:!1},lines:[],paths:[],noise:c,bounding:null});return m.useEffect(()=>{const 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:k}=f.bounding;f.lines=[],f.paths.forEach(de=>de.remove()),f.paths=[];const I=10,M=32,S=D+200,T=k+30,$=Math.ceil(S/I),A=Math.ceil(T/M),Q=(D-I*$)/2,G=(k-M*A)/2;for(let de=0;de<=$;de++){const oe=[];for(let le=0;le<=A;le++){const fe={x:Q+I*de,y:G+M*le,wave:{x:0,y:0},cursor:{x:0,y:0,vx:0,vy:0}};oe.push(fe)}const ve=document.createElementNS("http://www.w3.org/2000/svg","path");h.appendChild(ve),f.paths.push(ve),f.lines.push(oe)}},N=D=>{const{lines:k,mouse:I,noise:M}=f;k.forEach(S=>{S.forEach(T=>{const $=M.perlin2((T.x+D*.0125)*.002,(T.y+D*.005)*.0015)*12;T.wave.x=Math.cos($)*32,T.wave.y=Math.sin($)*16;const A=T.x-I.sx,Q=T.y-I.sy,G=Math.hypot(A,Q),de=Math.max(175,I.vs);if(G{const I={x:D.x+D.wave.x+(k?D.cursor.x:0),y:D.y+D.wave.y+(k?D.cursor.y:0)};return I.x=Math.round(I.x*10)/10,I.y=Math.round(I.y*10)/10,I},b=()=>{const{lines:D,paths:k}=f;D.forEach((I,M)=>{let S=v(I[0],!1),T=`M ${S.x} ${S.y}`;I.forEach(($,A)=>{const Q=A===I.length-1;S=v($,!Q),T+=`L ${S.x} ${S.y}`}),k[M].setAttribute("d",T)})},w=D=>{const{mouse:k}=f;k.sx+=(k.x-k.sx)*.1,k.sy+=(k.y-k.sy)*.1;const I=k.x-k.lx,M=k.y-k.ly,S=Math.hypot(I,M);k.v=S,k.vs+=(S-k.vs)*.1,k.vs=Math.min(100,k.vs),k.lx=k.x,k.ly=k.y,k.a=Math.atan2(M,I),x&&(x.style.setProperty("--x",`${k.sx}px`),x.style.setProperty("--y",`${k.sy}px`)),N(D),b(),i.current=requestAnimationFrame(w)},y=D=>{if(!f.bounding)return;const{mouse:k}=f;k.x=D.pageX-f.bounding.left,k.y=D.pageY-f.bounding.top+window.scrollY,k.set||(k.sx=k.x,k.sy=k.y,k.lx=k.x,k.ly=k.y,k.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 y2(){const[l,n]=m.useState(""),[i,c]=m.useState(!1),[u,x]=m.useState(""),[h,f]=m.useState(!0),p=aa(),{enableWavesBackground:g,setEnableWavesBackground:N}=Kj(),{theme:v,setTheme:b}=Bm();m.useEffect(()=>{(async()=>{try{await Fi()&&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")},D=async k=>{if(k.preventDefault(),x(""),!l.trim()){x("请输入 Access Token");return}c(!0),console.log("开始验证 token...");try{const I=await fetch("/api/webui/auth/verify",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({token:l.trim()})});console.log("Token 验证响应状态:",I.status);const M=await I.json();if(console.log("Token 验证响应数据:",M),I.ok&&M.valid){console.log("Token 验证成功,准备跳转..."),console.log("is_first_setup:",M.is_first_setup),await new Promise(T=>setTimeout(T,100));const S=await Fi();console.log("跳转前认证状态检查:",S),M.is_first_setup?(console.log("跳转到首次配置页面"),p({to:"/setup"})):(console.log("跳转到首页"),p({to:"/"}))}else console.error("Token 验证失败:",M.message),x(M.message||"Token 验证失败,请检查后重试")}catch(I){console.error("Token 验证错误:",I),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(ag,{}),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(ag,{}),e.jsxs(De,{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(hj,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"}):e.jsx(fj,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"})}),e.jsxs(Xe,{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(qp,{className:"h-8 w-8 text-primary",strokeWidth:2,fill:"none"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(We,{className:"text-2xl font-bold",children:"欢迎使用 MaiBot"}),e.jsx(Is,{className:"text-base",children:"请输入您的 Access Token 以继续访问系统"})]})]}),e.jsx(Qe,{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(Om,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground",strokeWidth:2,fill:"none"}),e.jsx(ie,{id:"token",type:"password",placeholder:"请输入您的 Access Token",value:l,onChange:k=>n(k.target.value),className:B("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(Ct,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),e.jsx("span",{children:u})]}),e.jsx(C,{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(Ks,{children:[e.jsx(Ho,{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(pj,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我没有 Token,我该去哪里获得 Token?"]})}),e.jsxs(Ps,{className:"sm:max-w-md",children:[e.jsxs(Hs,{children:[e.jsxs(Gs,{className:"flex items-center gap-2",children:[e.jsx(qp,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"如何获取 Access Token"]}),e.jsx(ot,{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(Ow,{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(qa,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx("h4",{className:"font-semibold text-sm",children:"方式二:查看配置文件"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Token 保存在项目根目录的配置文件中:"}),e.jsx("div",{className:"rounded bg-background p-2 font-mono text-xs break-all",children:e.jsx("code",{className:"text-primary",children:"data/webui.json"})}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["打开此文件,复制 ",e.jsx("code",{className:"px-1 py-0.5 bg-background rounded",children:"access_token"})," 字段的值"]})]})]})}),e.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Ct,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),e.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[e.jsx("p",{className:"font-semibold",children:"安全提示"}),e.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[e.jsx("li",{children:"请妥善保管您的 Token,不要泄露给他人"}),e.jsx("li",{children:"如需重置 Token,请在登录后前往系统设置"})]})]})]})})]})]})]}),e.jsxs(ps,{children:[e.jsx(bt,{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(zn,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我觉得这个界面很卡怎么办?"]})}),e.jsxs(os,{children:[e.jsxs(ds,{children:[e.jsxs(ms,{className:"flex items-center gap-2",children:[e.jsx(zn,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"关闭背景动画"]}),e.jsx(xs,{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(us,{children:[e.jsx(fs,{children:"取消"}),e.jsx(hs,{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:l2})})]})}const et=m.forwardRef(({className:l,...n},i)=>e.jsx("textarea",{className:B("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}));et.displayName="Textarea";const $r=m.forwardRef(({className:l,orientation:n="horizontal",decorative:i=!0,...c},u)=>e.jsx(Lg,{ref:u,decorative:i,orientation:n,className:B("shrink-0 bg-border",n==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",l),...c}));$r.displayName=Lg.displayName;function w2({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(ie,{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(ie,{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(Ae,{variant:"secondary",className:"gap-1",children:[u,e.jsx("button",{type:"button",onClick:()=>c(x),className:"ml-1 hover:text-destructive",children:e.jsx(_a,{className:"h-3 w-3"})})]},x))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ie,{id:"alias_input",placeholder:"输入别名后按回车添加",onKeyPress:u=>{u.key==="Enter"&&(i(u.target.value),u.target.value="")}}),e.jsx(C,{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 _2({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(et,{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(et,{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(et,{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($r,{}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(E,{htmlFor:"plan_style",children:"群聊说话规则 *"}),e.jsx(et,{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(et,{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 S2({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(ie,{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(ie,{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(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(E,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),e.jsx(ie,{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($r,{}),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(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(E,{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(E,{htmlFor:"filtration_prompt",children:"过滤要求"}),e.jsx(ie,{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 k2({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(Ge,{id:"enable_tool",checked:l.enable_tool,onCheckedChange:i=>n({...l,enable_tool:i})})]}),e.jsx($r,{}),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(Ge,{id:"all_global",checked:l.all_global,onCheckedChange:i=>n({...l,all_global:i})})]})]})}function C2({config:l,onChange:n}){const[i,c]=m.useState(!1);return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"rounded-lg bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"mt-0.5",children:e.jsx("svg",{className:"h-5 w-5 text-blue-600 dark:text-blue-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),e.jsxs("div",{className:"flex-1 text-sm",children:[e.jsx("p",{className:"font-medium text-blue-900 dark:text-blue-100 mb-1",children:"关于硅基流动 (SiliconFlow)"}),e.jsx("p",{className:"text-blue-700 dark:text-blue-300 mb-2",children:"硅基流动提供了完整的模型覆盖,包括 DeepSeek V3、Qwen、视觉模型、语音识别和嵌入模型。 只需一个 API Key 即可使用麦麦的所有功能!"}),e.jsxs("a",{href:"https://cloud.siliconflow.cn",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-blue-600 dark:text-blue-400 hover:underline font-medium",children:["前往硅基流动获取 API Key",e.jsx(bo,{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(ie,{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(C,{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(Hi,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(sa,{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 T2(){const l=await we("/api/webui/config/bot",{method:"GET",headers:Us()});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 E2(){const l=await we("/api/webui/config/bot",{method:"GET",headers:Us()});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 M2(){const l=await we("/api/webui/config/bot",{method:"GET",headers:Us()});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 A2(){const l=await we("/api/webui/config/bot",{method:"GET",headers:Us()});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 z2(){const l=await we("/api/webui/config/model",{method:"GET",headers:Us()});if(!l.ok)throw new Error("读取模型配置失败");return{api_key:((await l.json()).config.api_providers||[]).find(x=>x.name==="SiliconFlow")?.api_key||""}}async function D2(l){const n=await we("/api/webui/config/bot/section/bot",{method:"POST",headers:Us(),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:Us(),body:JSON.stringify(l)});if(!n.ok){const i=await n.json();throw new Error(i.detail||"保存人格配置失败")}return await n.json()}async function R2(l){const n=await we("/api/webui/config/bot/section/emoji",{method:"POST",headers:Us(),body:JSON.stringify(l)});if(!n.ok){const i=await n.json();throw new Error(i.detail||"保存表情包配置失败")}return await n.json()}async function L2(l){const n=[];n.push(we("/api/webui/config/bot/section/tool",{method:"POST",headers:Us(),body:JSON.stringify({enable_tool:l.enable_tool})})),n.push(we("/api/webui/config/bot/section/expression",{method:"POST",headers:Us(),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 U2(l){const n=await we("/api/webui/config/model",{method:"GET",headers:Us()});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:Us(),body:JSON.stringify(h)});if(!f.ok){const p=await f.json();throw new Error(p.detail||"保存模型配置失败")}return await f.json()}async function lg(){const 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 B2(){return e.jsx(Pn,{children:e.jsx($2,{})})}function $2(){const l=aa(),{toast:n}=Ws(),{triggerRestart:i}=dn(),[c,u]=m.useState(0),[x,h]=m.useState(!1),[f,p]=m.useState(!1),[g,N]=m.useState(!0),[v,b]=m.useState({qq_account:0,nickname:"",alias_names:[]}),[w,y]=m.useState({personality:"是一个女大学生,现在在读大二,会刷贴吧。",reply_style:"请回复的平淡一些,简短一些,说中文,不要刻意突出自身学科背景。可以参考贴吧,知乎和微博的回复风格。",interest:"对技术相关话题,游戏和动漫相关话题感兴趣,也对日常话题感兴趣,不喜欢太过沉重严肃的话题",plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 -2.如果相同的内容已经被执行,请不要重复执行 -3.请控制你的发言频率,不要太过频繁的发言 -4.如果有人对你感到厌烦,请减少回复 -5.如果有人对你进行攻击,或者情绪激动,请你以合适的方法应对`,private_plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 -2.如果相同的内容已经被执行,请不要重复执行 -3.某句话如果已经被回复过,不要重复回复`}),[R,D]=m.useState({emoji_chance:.4,max_reg_num:40,do_replace:!0,check_interval:10,steal_emoji:!0,content_filtration:!1,filtration_prompt:"符合公序良俗"}),[k,I]=m.useState({enable_tool:!0,all_global:!0}),[M,S]=m.useState({api_key:""}),T=[{id:"bot-basic",title:"Bot基础",description:"配置机器人的基本信息",icon:Ri},{id:"personality",title:"人格配置",description:"定义机器人的性格和说话风格",icon:Dn},{id:"emoji",title:"表情包",description:"配置表情包相关设置",icon:Rm},{id:"other",title:"其他设置",description:"工具、情绪系统等配置",icon:In},{id:"siliconflow",title:"API配置",description:"配置硅基流动API密钥",icon:Om}],$=(c+1)/T.length*100;m.useEffect(()=>{(async()=>{try{N(!0);const[fe,ge,z,V,U]=await Promise.all([T2(),E2(),M2(),A2(),z2()]);b(fe),y(ge),D(z),I(V),S(U)}catch(fe){n({title:"加载配置失败",description:fe instanceof Error?fe.message:"无法加载现有配置,将使用默认值",variant:"destructive"})}finally{N(!1)}})()},[n]);const A=async()=>{p(!0);try{switch(c){case 0:await D2(v);break;case 1:await O2(w);break;case 2:await R2(R);break;case 3:await L2(k);break;case 4:await U2(M);break}return n({title:"保存成功",description:`${T[c].title}配置已保存`}),!0}catch(le){return n({title:"保存失败",description:le instanceof Error?le.message:"未知错误",variant:"destructive"}),!1}finally{p(!1)}},Q=async()=>{await A()&&c{c>0&&u(c-1)},de=async()=>{h(!0);try{if(!await A()){h(!1);return}await lg(),n({title:"配置完成",description:"麦麦正在重启以应用新配置..."}),await i()}catch(le){n({title:"配置失败",description:le instanceof Error?le.message:"未知错误",variant:"destructive"})}finally{h(!1)}},oe=async()=>{try{await lg(),l({to:"/"})}catch(le){n({title:"跳过失败",description:le instanceof Error?le.message:"未知错误",variant:"destructive"})}},ve=()=>{switch(c){case 0:return e.jsx(w2,{config:v,onChange:b});case 1:return e.jsx(_2,{config:w,onChange:y});case 2:return e.jsx(S2,{config:R,onChange:D});case 3:return e.jsx(k2,{config:k,onChange:I});case 4:return e.jsx(C2,{config:M,onChange:S});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(Hn,{}),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(Rw,{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:["让我们一起完成 ",$m," 的初始配置"]})]}),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," / ",T.length]}),e.jsxs("span",{className:"font-medium text-primary",children:[Math.round($),"%"]})]}),e.jsx(Bn,{value:$,className:"h-2"})]}),e.jsx("div",{className:"mb-6 md:mb-8 flex justify-between",children:T.map((le,fe)=>{const ge=le.icon;return e.jsxs("div",{className:B("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(Bo,{className:"h-4 w-4"}),"返回首页"]}),e.jsxs(C,{size:"lg",variant:"outline",onClick:()=>window.history.back(),className:"gap-2 w-full sm:w-auto",children:[e.jsx(Va,{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 I2=Es.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(E,{htmlFor:"platform",children:"平台"}),e.jsx(ie,{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(ie,{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(ie,{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(C,{onClick:x,size:"sm",variant:"outline",children:[e.jsx(it,{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(ie,{value:v,onChange:w=>f(b,w.target.value),placeholder:"wx:114514"}),e.jsxs(ps,{children:[e.jsx(bt,{asChild:!0,children:e.jsx(C,{size:"icon",variant:"outline",children:e.jsx(ls,{className:"h-4 w-4"})})}),e.jsxs(os,{children:[e.jsxs(ds,{children:[e.jsx(ms,{children:"确认删除"}),e.jsxs(xs,{children:['确定要删除平台账号 "',v||"(空)",'" 吗?此操作无法撤销。']})]}),e.jsxs(us,{children:[e.jsx(fs,{children:"取消"}),e.jsx(hs,{onClick:()=>h(b),children:"删除"})]})]})]})]},b)),c.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(C,{onClick:p,size:"sm",variant:"outline",children:[e.jsx(it,{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(ie,{value:v,onChange:w=>N(b,w.target.value),placeholder:"小麦"}),e.jsxs(ps,{children:[e.jsx(bt,{asChild:!0,children:e.jsx(C,{size:"icon",variant:"outline",children:e.jsx(ls,{className:"h-4 w-4"})})}),e.jsxs(os,{children:[e.jsxs(ds,{children:[e.jsx(ms,{children:"确认删除"}),e.jsxs(xs,{children:['确定要删除别名 "',v||"(空)",'" 吗?此操作无法撤销。']})]}),e.jsxs(us,{children:[e.jsx(fs,{children:"取消"}),e.jsx(hs,{onClick:()=>g(b),children:"删除"})]})]})]})]},b)),u.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无别名"})]})]})]})]})})}),P2=Es.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(et,{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.jsx(E,{htmlFor:"reply_style",children:"表达风格"}),e.jsx(et,{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:"interest",children:"兴趣"}),e.jsx(et,{id:"interest",value:n.interest,onChange:h=>i({...n,interest:h.target.value}),placeholder:"会影响麦麦对什么话题进行回复",rows:2})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"plan_style",children:"说话规则与行为风格"}),e.jsx(et,{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(et,{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(et,{id:"private_plan_style",value:n.private_plan_style,onChange:h=>i({...n,private_plan_style:h.target.value}),placeholder:"私聊的说话规则和行为风格",rows:4})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(E,{children:"状态列表(人格多样性)"}),e.jsxs(C,{onClick:c,size:"sm",variant:"outline",children:[e.jsx(it,{className:"h-4 w-4 mr-1"}),"添加状态"]})]}),e.jsx("div",{className:"space-y-2",children:n.states.map((h,f)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(et,{value:h,onChange:p=>x(f,p.target.value),placeholder:"描述一个人格状态",rows:2}),e.jsxs(ps,{children:[e.jsx(bt,{asChild:!0,children:e.jsx(C,{size:"icon",variant:"outline",children:e.jsx(ls,{className:"h-4 w-4"})})}),e.jsxs(os,{children:[e.jsxs(ds,{children:[e.jsx(ms,{children:"确认删除"}),e.jsx(xs,{children:"确定要删除这个人格状态吗?此操作无法撤销。"})]}),e.jsxs(us,{children:[e.jsx(fs,{children:"取消"}),e.jsx(hs,{onClick:()=>u(f),children:"删除"})]})]})]})]},f))})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"state_probability",children:"状态替换概率"}),e.jsx(ie,{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:"每次构建人格时替换 personality 的概率(0.0-1.0)"})]})]})]})})}),Be=hw,$e=fw,Le=m.forwardRef(({className:l,children:n,...i},c)=>e.jsxs(Jg,{ref:c,className:B("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(ow,{asChild:!0,children:e.jsx($a,{className:"h-4 w-4 opacity-50"})})]}));Le.displayName=Jg.displayName;const Zj=m.forwardRef(({className:l,...n},i)=>e.jsx(Xg,{ref:i,className:B("flex cursor-default items-center justify-center py-1",l),...n,children:e.jsx(Dr,{className:"h-4 w-4"})}));Zj.displayName=Xg.displayName;const Wj=m.forwardRef(({className:l,...n},i)=>e.jsx(Zg,{ref:i,className:B("flex cursor-default items-center justify-center py-1",l),...n,children:e.jsx($a,{className:"h-4 w-4"})}));Wj.displayName=Zg.displayName;const Ue=m.forwardRef(({className:l,children:n,position:i="popper",...c},u)=>e.jsx(dw,{children:e.jsxs(Wg,{ref:u,className:B("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(Zj,{}),e.jsx(uw,{className:B("p-1",i==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:n}),e.jsx(Wj,{})]})}));Ue.displayName=Wg.displayName;const H2=m.forwardRef(({className:l,...n},i)=>e.jsx(ej,{ref:i,className:B("px-2 py-1.5 text-sm font-semibold",l),...n}));H2.displayName=ej.displayName;const ae=m.forwardRef(({className:l,children:n,...i},c)=>e.jsxs(sj,{ref:c,className:B("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(St,{className:"h-4 w-4"})})}),e.jsx(xw,{children:n})]}));ae.displayName=sj.displayName;const G2=m.forwardRef(({className:l,...n},i)=>e.jsx(tj,{ref:i,className:B("-mx-1 my-1 h-px bg-muted",l),...n}));G2.displayName=tj.displayName;const tl=C0,al=T0,Ka=m.forwardRef(({className:l,align:n="center",sideOffset:i=4,...c},u)=>e.jsx(k0,{children:e.jsx(Ug,{ref:u,align:n,sideOffset:i,className:B("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})}));Ka.displayName=Ug.displayName;const F2=Es.memo(function({value:n,onChange:i}){const c=m.useMemo(()=>{const w=n.split("-");if(w.length===2){const[y,R]=w,[D,k]=y.split(":"),[I,M]=R.split(":");return{startHour:D?D.padStart(2,"0"):"00",startMinute:k?k.padStart(2,"0"):"00",endHour:I?I.padStart(2,"0"):"23",endMinute:M?M.padStart(2,"0"):"59"}}return{startHour:"00",startMinute:"00",endHour:"23",endMinute:"59"}},[n]),[u,x]=m.useState(c.startHour),[h,f]=m.useState(c.startMinute),[p,g]=m.useState(c.endHour),[N,v]=m.useState(c.endMinute);m.useEffect(()=>{x(c.startHour),f(c.startMinute),g(c.endHour),v(c.endMinute)},[c]);const b=(w,y,R,D)=>{const k=`${w}:${y}-${R}:${D}`;i(k)};return e.jsxs(tl,{children:[e.jsx(al,{asChild:!0,children:e.jsxs(C,{variant:"outline",className:"w-full justify-start font-mono text-sm",children:[e.jsx(kl,{className:"h-4 w-4 mr-2"}),n||"选择时间段"]})}),e.jsx(Ka,{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(Be,{value:u,onValueChange:w=>{x(w),b(w,h,p,N)},children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsx(Ue,{children:Array.from({length:24},(w,y)=>y).map(w=>e.jsx(ae,{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(Be,{value:h,onValueChange:w=>{f(w),b(u,w,p,N)},children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsx(Ue,{children:Array.from({length:60},(w,y)=>y).map(w=>e.jsx(ae,{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(Be,{value:p,onValueChange:w=>{g(w),b(u,h,w,N)},children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsx(Ue,{children:Array.from({length:24},(w,y)=>y).map(w=>e.jsx(ae,{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(Be,{value:N,onValueChange:w=>{v(w),b(u,h,p,w)},children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsx(Ue,{children:Array.from({length:60},(w,y)=>y).map(w=>e.jsx(ae,{value:w.toString().padStart(2,"0"),children:w.toString().padStart(2,"0")},w))})]})]})]})]})]})})]})}),q2=Es.memo(function({rule:n}){const i=`{ target = "${n.target}", time = "${n.time}", value = ${n.value.toFixed(1)} }`;return e.jsxs(tl,{children:[e.jsx(al,{asChild:!0,children:e.jsxs(C,{variant:"outline",size:"sm",children:[e.jsx(sa,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Ka,{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 文件中的格式"})]})})]})}),V2=Es.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(ie,{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:"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(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(ie,{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(ie,{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(E,{htmlFor:"enable_talk_value_rules",className:"cursor-pointer",children:"启用动态发言频率规则"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"include_planner_reasoning",checked:n.include_planner_reasoning,onCheckedChange:h=>i({...n,include_planner_reasoning:h})}),e.jsx(E,{htmlFor:"include_planner_reasoning",className:"cursor-pointer",children:"将 planner 推理加入 replyer"})]})]})]}),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(C,{onClick:c,size:"sm",children:[e.jsx(it,{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(q2,{rule:h}),e.jsxs(ps,{children:[e.jsx(bt,{asChild:!0,children:e.jsx(C,{variant:"ghost",size:"sm",children:e.jsx(ls,{className:"h-4 w-4 text-destructive"})})}),e.jsxs(os,{children:[e.jsxs(ds,{children:[e.jsx(ms,{children:"确认删除"}),e.jsxs(xs,{children:["确定要删除规则 #",f+1," 吗?此操作无法撤销。"]})]}),e.jsxs(us,{children:[e.jsx(fs,{children:"取消"}),e.jsx(hs,{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(Be,{value:h.target===""?"global":"specific",onValueChange:p=>{p==="global"?x(f,"target",""):x(f,"target","qq::group")},children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"global",children:"全局配置"}),e.jsx(ae,{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(Be,{value:g,onValueChange:b=>{x(f,"target",`${b}:${N}:${v}`)},children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"qq",children:"QQ"}),e.jsx(ae,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{className:"text-xs font-medium",children:"群 ID"}),e.jsx(ie,{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(E,{className:"text-xs font-medium",children:"类型"}),e.jsxs(Be,{value:v,onValueChange:b=>{x(f,"target",`${g}:${N}:${b}`)},children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"group",children:"群组(group)"}),e.jsx(ae,{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(F2,{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(ie,{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(wa,{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 表示正常发言"]})]})]})]})]})}),K2=Es.memo(function({config:n,onChange:i}){const c=k=>{if(!k||!k.includes(":"))return{platform:"qq",userId:""};const[I,M]=k.split(":");return{platform:I,userId:M}},{platform:u,userId:x}=c(n.dream_send),[h,f]=m.useState(u),[p,g]=m.useState(x),N=k=>{const[I,M]=k.split("-");return{startTime:I||"09:00",endTime:M||"22:00"}},v=(k,I)=>{const M=I?`${k}:${I}`:"";i({...n,dream_send:M})},b=k=>{f(k),v(k,p)},w=k=>{g(k),v(h,k)},y=()=>{i({...n,dream_time_ranges:[...n.dream_time_ranges,"09:00-22:00"]})},R=k=>{i({...n,dream_time_ranges:n.dream_time_ranges.filter((I,M)=>M!==k)})},D=(k,I,M)=>{const S=[...n.dream_time_ranges],T=N(S[k]);I==="startTime"?T.startTime=M:T.endTime=M,S[k]=`${T.startTime}-${T.endTime}`,i({...n,dream_time_ranges:S})};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(ie,{id:"interval_minutes",type:"number",min:"1",value:n.interval_minutes,onChange:k=>i({...n,interval_minutes:Number(k.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(ie,{id:"max_iterations",type:"number",min:"1",value:n.max_iterations,onChange:k=>i({...n,max_iterations:Number(k.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(ie,{id:"first_delay_seconds",type:"number",min:"0",value:n.first_delay_seconds,onChange:k=>i({...n,first_delay_seconds:Number(k.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(Be,{value:h,onValueChange:b,children:[e.jsx(Le,{className:"w-[120px]",children:e.jsx($e,{placeholder:"选择平台"})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"qq",children:"QQ"}),e.jsx(ae,{value:"wx",children:"微信"}),e.jsx(ae,{value:"webui",children:"WebUI"})]})]}),e.jsx(ie,{type:"text",placeholder:"输入用户ID (例如: 123456)",value:p,onChange:k=>w(k.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(C,{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((k,I)=>{const{startTime:M,endTime:S}=N(k);return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ie,{type:"time",value:M,onChange:T=>D(I,"startTime",T.target.value),className:"w-[140px]"}),e.jsx("span",{className:"text-muted-foreground",children:"至"}),e.jsx(ie,{type:"time",value:S,onChange:T=>D(I,"endTime",T.target.value),className:"w-[140px]"}),e.jsx(C,{type:"button",variant:"ghost",size:"icon",onClick:()=>R(I),children:e.jsx(_a,{className:"h-4 w-4"})})]},I)}),n.dream_time_ranges.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"当前配置为全天允许做梦"})]})]})]})}),Q2=Es.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(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(Be,{value:n.lpmm_mode,onValueChange:c=>i({...n,lpmm_mode:c}),children:[e.jsx(Le,{children:e.jsx($e,{placeholder:"选择 LPMM 模式"})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"classic",children:"经典模式"}),e.jsx(ae,{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(ie,{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(ie,{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(ie,{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(ie,{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(ie,{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(ie,{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(ie,{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(E,{className:"cursor-pointer",children:"启用 PPR (低配机器可关闭)"})]})]})]})]})}),Y2=Es.memo(function({config:n,onChange:i}){const[c,u]=m.useState(""),[x,h]=m.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(E,{children:"日期格式"}),e.jsx(ie,{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(E,{children:"日志级别样式"}),e.jsxs(Be,{value:n.log_level_style,onValueChange:y=>i({...n,log_level_style:y}),children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsx(Ue,{children:b.map(y=>e.jsx(ae,{value:y,children:y},y))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"日志文本颜色"}),e.jsxs(Be,{value:n.color_text,onValueChange:y=>i({...n,color_text:y}),children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsx(Ue,{children:w.map(y=>e.jsx(ae,{value:y,children:y},y))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"全局日志级别"}),e.jsxs(Be,{value:n.log_level,onValueChange:y=>i({...n,log_level:y}),children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsx(Ue,{children:v.map(y=>e.jsx(ae,{value:y,children:y},y))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"控制台日志级别"}),e.jsxs(Be,{value:n.console_log_level,onValueChange:y=>i({...n,console_log_level:y}),children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsx(Ue,{children:v.map(y=>e.jsx(ae,{value:y,children:y},y))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{children:"文件日志级别"}),e.jsxs(Be,{value:n.file_log_level,onValueChange:y=>i({...n,file_log_level:y}),children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsx(Ue,{children:v.map(y=>e.jsx(ae,{value:y,children:y},y))})]})]})]})]}),e.jsxs("div",{children:[e.jsx(E,{className:"mb-2 block",children:"完全屏蔽的库"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(ie,{value:c,onChange:y=>u(y.target.value),placeholder:"输入库名",className:"flex-1",onKeyDown:y=>{y.key==="Enter"&&(y.preventDefault(),f())}}),e.jsx(C,{onClick:f,size:"sm",className:"flex-shrink-0",children:e.jsx(it,{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(C,{variant:"ghost",size:"sm",className:"h-5 w-5 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(E,{className:"mb-2 block",children:"特定库的日志级别"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(ie,{value:c,onChange:y=>u(y.target.value),placeholder:"输入库名",className:"flex-1"}),e.jsxs(Be,{value:x,onValueChange:h,children:[e.jsx(Le,{className:"w-32",children:e.jsx($e,{})}),e.jsx(Ue,{children:v.map(y=>e.jsx(ae,{value:y,children:y},y))})]}),e.jsx(C,{onClick:g,size:"sm",children:e.jsx(it,{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(C,{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))})]})]})}),J2=Es.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(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(E,{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(E,{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(E,{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(E,{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(E,{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(E,{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})})]})]})]})}),X2=Es.memo(function({config:n,onChange:i}){const[c,u]=m.useState(""),[x,h]=m.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(ie,{value:c,onChange:v=>u(v.target.value),placeholder:"输入认证令牌",onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),f())}}),e.jsx(C,{onClick:f,size:"sm",children:e.jsx(it,{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(C,{variant:"ghost",size:"sm",className:"h-6 w-6 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("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(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(E,{children:"主机地址"}),e.jsx(ie,{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(ie,{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(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(ie,{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(ie,{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(ie,{value:x,onChange:v=>h(v.target.value),placeholder:"输入 API Key",onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),g())}}),e.jsx(C,{onClick:g,size:"sm",children:e.jsx(it,{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(C,{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))})]})]})]})]})]})}),Z2=Es.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(Ge,{checked:n.enable,onCheckedChange:c=>i({...n,enable:c})})]})]})}),W2=Es.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(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(Ge,{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(ie,{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(ie,{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(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(Ge,{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(ie,{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(ie,{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(ie,{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(E,{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(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(Ge,{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(ie,{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:"只有符合此要求的表情包才会被保存"})]})]})]})})]})}),e_=Es.memo(function({member:n,groupIndex:i,memberIndex:c,availableChatIds:u,onUpdate:x,onRemove:h}){const f=u.includes(n)||n==="*",[p,g]=m.useState(!f);return e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:"flex-1 flex gap-2",children:p?e.jsxs(e.Fragment,{children:[e.jsx(ie,{value:n,onChange:N=>x(i,c,N.target.value),placeholder:'输入 "*" 或 "qq:123456:group"',className:"flex-1"}),u.length>0&&e.jsx(C,{size:"sm",variant:"outline",onClick:()=>g(!1),title:"切换到下拉选择",children:"下拉"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(Be,{value:n,onValueChange:N=>x(i,c,N),children:[e.jsx(Le,{className:"flex-1",children:e.jsx($e,{placeholder:"选择聊天流"})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"*",children:"* (全局共享)"}),u.map((N,v)=>e.jsx(ae,{value:N,children:N},v))]})]}),e.jsx(C,{size:"sm",variant:"outline",onClick:()=>g(!0),title:"切换到手动输入",children:"输入"})]})}),e.jsxs(ps,{children:[e.jsx(bt,{asChild:!0,children:e.jsx(C,{size:"icon",variant:"outline",children:e.jsx(ls,{className:"h-4 w-4"})})}),e.jsxs(os,{children:[e.jsxs(ds,{children:[e.jsx(ms,{children:"确认删除"}),e.jsxs(xs,{children:['确定要删除组成员 "',n||"(空)",'" 吗?此操作无法撤销。']})]}),e.jsxs(us,{children:[e.jsx(fs,{children:"取消"}),e.jsx(hs,{onClick:()=>h(i,c),children:"删除"})]})]})]})]})}),s_=Es.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(tl,{children:[e.jsx(al,{asChild:!0,children:e.jsxs(C,{variant:"outline",size:"sm",children:[e.jsx(sa,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Ka,{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,D)=>D!==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.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(C,{onClick:c,size:"sm",variant:"outline",children:[e.jsx(it,{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((S,T)=>T!==w&&S[0]===""),R=b[0]==="",D=b[0].split(":"),k=D[0]||"qq",I=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:b}),e.jsxs(ps,{children:[e.jsx(bt,{asChild:!0,children:e.jsx(C,{size:"sm",variant:"ghost",children:e.jsx(ls,{className:"h-4 w-4"})})}),e.jsxs(os,{children:[e.jsxs(ds,{children:[e.jsx(ms,{children:"确认删除"}),e.jsxs(xs,{children:["确定要删除学习规则 ",w+1," 吗?此操作无法撤销。"]})]}),e.jsxs(us,{children:[e.jsx(fs,{children:"取消"}),e.jsx(hs,{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(Be,{value:R?"global":"specific",onValueChange:S=>{S==="global"?x(w,0,""):x(w,0,"qq::group")},disabled:y&&!R,children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"global",children:"全局配置"}),e.jsx(ae,{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(E,{className:"text-xs font-medium",children:"平台"}),e.jsxs(Be,{value:k,onValueChange:S=>{x(w,0,`${S}:${I}:${M}`)},children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"qq",children:"QQ"}),e.jsx(ae,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{className:"text-xs font-medium",children:"群 ID"}),e.jsx(ie,{value:I,onChange:S=>{x(w,0,`${k}:${S.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(Be,{value:M,onValueChange:S=>{x(w,0,`${k}:${I}:${S}`)},children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"group",children:"群组(group)"}),e.jsx(ae,{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(E,{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:S=>x(w,1,S?"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(Ge,{checked:b[2]==="enable",onCheckedChange:S=>x(w,2,S?"enable":"disable")})]})}),e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(E,{className:"text-xs font-medium",children:"学习强度"}),e.jsx(ie,{type:"number",step:"0.1",min:"0",max:"5",value:b[3],onChange:S=>{const T=parseFloat(S.target.value);isNaN(T)||x(w,3,Math.max(0,Math.min(5,T)).toFixed(1))},className:"w-20 h-8 text-xs"})]}),e.jsx(wa,{value:[parseFloat(b[3])||1],onValueChange:S=>x(w,3,S[0].toFixed(1)),min:0,max:5,step:.1,className:"w-full"}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"0 (不学习)"}),e.jsx("span",{children:"2.5"}),e.jsx("span",{children:"5.0 (快速学习)"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"影响学习频率,最短学习间隔 = 300/学习强度(秒)"})]})]})]},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",{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.jsx(Ge,{checked:n.reflect,onCheckedChange:b=>i({...n,reflect:b})})]}),n.reflect&&e.jsxs("div",{className:"space-y-4",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.reflect_operator_id||"").split(":"),y=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(Be,{value:y,onValueChange:k=>{i({...n,reflect_operator_id:`${k}:${R}:${D}`})},children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"qq",children:"QQ"}),e.jsx(ae,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{className:"text-xs font-medium",children:"用户/群 ID"}),e.jsx(ie,{value:R,onChange:k=>{i({...n,reflect_operator_id:`${y}:${k.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(Be,{value:D,onValueChange:k=>{i({...n,reflect_operator_id:`${y}:${R}:${k}`})},children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"private",children:"私聊(private)"}),e.jsx(ae,{value:"group",children:"群组(group)"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前操作员 ID:",n.reflect_operator_id||"(未设置)"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦会向此操作员询问表达方式是否合适"})]})})()})]}),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(C,{onClick:()=>{i({...n,allow_reflect:[...n.allow_reflect||[],"qq::group"]})},size:"sm",variant:"outline",children:[e.jsx(it,{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",D=y[1]||"",k=y[2]||"group";return e.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg bg-muted/50",children:[e.jsxs(Be,{value:R,onValueChange:I=>{const M=[...n.allow_reflect];M[w]=`${I}:${D}:${k}`,i({...n,allow_reflect:M})},children:[e.jsx(Le,{className:"w-24",children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"qq",children:"QQ"}),e.jsx(ae,{value:"wx",children:"微信"})]})]}),e.jsx(ie,{value:D,onChange:I=>{const M=[...n.allow_reflect];M[w]=`${R}:${I.target.value}:${k}`,i({...n,allow_reflect:M})},placeholder:"ID",className:"flex-1 font-mono text-sm"}),e.jsxs(Be,{value:k,onValueChange:I=>{const M=[...n.allow_reflect];M[w]=`${R}:${D}:${I}`,i({...n,allow_reflect:M})},children:[e.jsx(Le,{className:"w-32",children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"group",children:"群组"}),e.jsx(ae,{value:"private",children:"私聊"})]})]}),e.jsx(C,{onClick:()=>{i({...n,allow_reflect:n.allow_reflect.filter((I,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(C,{onClick:f,size:"sm",variant:"outline",children:[e.jsx(it,{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(C,{onClick:()=>g(w),size:"sm",variant:"outline",children:e.jsx(it,{className:"h-4 w-4"})}),e.jsxs(ps,{children:[e.jsx(bt,{asChild:!0,children:e.jsx(C,{size:"sm",variant:"ghost",children:e.jsx(ls,{className:"h-4 w-4"})})}),e.jsxs(os,{children:[e.jsxs(ds,{children:[e.jsx(ms,{children:"确认删除"}),e.jsxs(xs,{children:["确定要删除共享组 ",w+1," 吗?此操作无法撤销。"]})]}),e.jsxs(us,{children:[e.jsx(fs,{children:"取消"}),e.jsx(hs,{onClick:()=>p(w),children:"删除"})]})]})]})]})]}),e.jsx("div",{className:"space-y-2",children:b.map((R,D)=>e.jsx(e_,{member:R,groupIndex:w,memberIndex:D,availableChatIds:y,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:'暂无共享组,点击"添加共享组"开始配置'})]})]})}),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(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(Ge,{id:"enable_jargon_explanation",checked:n.enable_jargon_explanation??!0,onCheckedChange:b=>i({...n,enable_jargon_explanation:b})}),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(Be,{value:n.jargon_mode??"context",onValueChange:b=>i({...n,jargon_mode:b}),children:[e.jsx(Le,{id:"jargon_mode",className:"mt-2",children:e.jsx($e,{placeholder:"选择黑话解释来源"})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"context",children:"上下文模式(自动匹配黑话)"}),e.jsx(ae,{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列表进行黑话检索"]})]})]})]})});function t_({regex:l,reaction:n,onRegexChange:i,onReactionChange:c}){const[u,x]=m.useState(!1),[h,f]=m.useState(""),[p,g]=m.useState(null),[N,v]=m.useState(""),[b,w]=m.useState({}),[y,R]=m.useState(""),D=m.useRef(null),[k,I]=m.useState("build"),M=A=>A.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),S=(A,Q=0)=>{const G=D.current;if(!G)return;const de=G.selectionStart||0,oe=G.selectionEnd||0,ve=l.substring(0,de)+A+l.substring(oe);i(ve),setTimeout(()=>{const le=de+A.length+Q;G.setSelectionRange(le,le),G.focus()},0)};m.useEffect(()=>{if(!l||!h){p!==null&&g(null),Object.keys(b).length>0&&w({}),y!==n&&R(n),N!==""&&v("");return}try{const A=M(l),Q=new RegExp(A,"g"),G=h.match(Q);g(G),v("");const oe=new RegExp(A).exec(h);if(oe&&oe.groups){w(oe.groups);let ve=n;Object.entries(oe.groups).forEach(([le,fe])=>{ve=ve.replace(new RegExp(`\\[${le}\\]`,"g"),fe||"")}),R(ve)}else w({}),R(n)}catch(A){v(A.message),g(null),w({}),R(n)}},[l,h,n,p,b,y,N]);const T=()=>{if(!h||!p||p.length===0)return e.jsx("span",{className:"text-muted-foreground",children:h||"请输入测试文本"});try{const A=M(l),Q=new RegExp(A,"g");let G=0;const de=[];let oe;for(;(oe=Q.exec(h))!==null;)oe.index>G&&de.push(e.jsx("span",{children:h.substring(G,oe.index)},`text-${G}`)),de.push(e.jsx("span",{className:"bg-yellow-200 dark:bg-yellow-900 font-semibold",children:oe[0]},`match-${oe.index}`)),G=oe.index+oe[0].length;return G)",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(Ks,{open:u,onOpenChange:x,children:[e.jsx(Ho,{asChild:!0,children:e.jsxs(C,{variant:"outline",size:"sm",children:[e.jsx(Lm,{className:"h-4 w-4 mr-1"}),"正则编辑器"]})}),e.jsxs(Ps,{className:"max-w-[95vw] sm:max-w-[900px] max-h-[90vh]",children:[e.jsxs(Hs,{children:[e.jsx(Gs,{children:"正则表达式编辑器"}),e.jsx(ot,{className:"text-sm",children:"使用可视化工具构建正则表达式,并实时测试效果"})]}),e.jsx(es,{className:"max-h-[calc(90vh-120px)]",children:e.jsxs(ma,{value:k,onValueChange:A=>I(A),className:"w-full",children:[e.jsxs(ta,{className:"grid w-full grid-cols-2",children:[e.jsx(as,{value:"build",children:"🔧 构建器"}),e.jsx(as,{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(ie,{ref:D,value:l,onChange:A=>i(A.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(et,{value:n,onChange:A=>c(A.target.value),placeholder:"使用 [捕获组名] 引用捕获的内容...",rows:3,className:"text-sm"})]}),e.jsxs("div",{className:"space-y-4 border-t pt-4",children:[$.map(A=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("h5",{className:"text-xs font-semibold text-primary",children:A.category}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:A.items.map(Q=>e.jsx(C,{variant:"outline",size:"sm",className:"justify-start h-auto py-2 px-3",onClick:()=>S(Q.pattern,Q.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:Q.label}),e.jsx("code",{className:"ml-auto text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:Q.pattern})]}),e.jsx("span",{className:"text-xs text-muted-foreground mt-0.5",children:Q.desc})]})},Q.label))})]},A.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(C,{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(C,{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(C,{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(et,{id:"test-text",value:h,onChange:A=>f(A.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(es,{className:"h-40 rounded-md bg-muted p-3",children:e.jsx("div",{className:"text-sm break-words",children:T()})})]}),Object.keys(b).length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{className:"text-sm font-medium",children:"命名捕获组"}),e.jsx(es,{className:"h-32 rounded-md border p-3",children:e.jsx("div",{className:"space-y-2",children:Object.entries(b).map(([A,Q])=>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:["[",A,"]"]}),e.jsx("span",{className:"text-muted-foreground",children:"="}),e.jsx("span",{className:"font-mono bg-muted px-2 py-0.5 rounded",children:Q})]},A))})})]}),Object.keys(b).length>0&&n&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{className:"text-sm font-medium",children:"Reaction 替换预览"}),e.jsx(es,{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 a_=Es.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=S=>{x({...n,regex_rules:n.regex_rules.filter((T,$)=>$!==S)})},v=(S,T,$)=>{const A=[...n.regex_rules];T==="regex"&&typeof $=="string"?A[S]={...A[S],regex:[$]}:T==="reaction"&&typeof $=="string"&&(A[S]={...A[S],reaction:$}),x({...n,regex_rules:A})},b=()=>{x({...n,keyword_rules:[...n.keyword_rules,{keywords:[],reaction:""}]})},w=S=>{x({...n,keyword_rules:n.keyword_rules.filter((T,$)=>$!==S)})},y=(S,T,$)=>{const A=[...n.keyword_rules];typeof $=="string"&&(A[S]={...A[S],reaction:$}),x({...n,keyword_rules:A})},R=S=>{const T=[...n.keyword_rules];T[S]={...T[S],keywords:[...T[S].keywords||[],""]},x({...n,keyword_rules:T})},D=(S,T)=>{const $=[...n.keyword_rules];$[S]={...$[S],keywords:($[S].keywords||[]).filter((A,Q)=>Q!==T)},x({...n,keyword_rules:$})},k=(S,T,$)=>{const A=[...n.keyword_rules],Q=[...A[S].keywords||[]];Q[T]=$,A[S]={...A[S],keywords:Q},x({...n,keyword_rules:A})},I=({rule:S})=>{const T=`{ regex = [${(S.regex||[]).map($=>`"${$}"`).join(", ")}], reaction = "${S.reaction}" }`;return e.jsxs(tl,{children:[e.jsx(al,{asChild:!0,children:e.jsxs(C,{variant:"outline",size:"sm",children:[e.jsx(sa,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Ka,{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(es,{className:"h-60 rounded-md bg-muted p-3",children:e.jsx("pre",{className:"font-mono text-xs break-all",children:T})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},M=({rule:S})=>{const T=`[[keyword_reaction.keyword_rules]] -keywords = [${(S.keywords||[]).map($=>`"${$}"`).join(", ")}] -reaction = "${S.reaction}"`;return e.jsxs(tl,{children:[e.jsx(al,{asChild:!0,children:e.jsxs(C,{variant:"outline",size:"sm",children:[e.jsx(sa,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Ka,{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(es,{className:"h-60 rounded-md bg-muted p-3",children:e.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-all",children:T})}),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(C,{onClick:g,size:"sm",variant:"outline",children:[e.jsx(it,{className:"h-4 w-4 mr-1"}),"添加正则规则"]})]}),e.jsxs("div",{className:"space-y-3",children:[n.regex_rules.map((S,T)=>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:["正则规则 ",T+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(t_,{regex:S.regex&&S.regex[0]||"",reaction:S.reaction,onRegexChange:$=>v(T,"regex",$),onReactionChange:$=>v(T,"reaction",$)}),e.jsx(I,{rule:S}),e.jsxs(ps,{children:[e.jsx(bt,{asChild:!0,children:e.jsx(C,{size:"sm",variant:"ghost",children:e.jsx(ls,{className:"h-4 w-4"})})}),e.jsxs(os,{children:[e.jsxs(ds,{children:[e.jsx(ms,{children:"确认删除"}),e.jsxs(xs,{children:["确定要删除正则规则 ",T+1," 吗?此操作无法撤销。"]})]}),e.jsxs(us,{children:[e.jsx(fs,{children:"取消"}),e.jsx(hs,{onClick:()=>N(T),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(ie,{value:S.regex&&S.regex[0]||"",onChange:$=>v(T,"regex",$.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(et,{value:S.reaction,onChange:$=>v(T,"reaction",$.target.value),placeholder:`触发后麦麦的反应... -可以使用 [捕获组名] 来引用正则表达式中的内容`,rows:3,className:"text-sm"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"使用 [捕获组名] 引用正则表达式中的命名捕获组,例如 [n] 会被替换为捕获的内容"})]})]})]},T)),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(C,{onClick:b,size:"sm",variant:"outline",children:[e.jsx(it,{className:"h-4 w-4 mr-1"}),"添加关键词规则"]})]}),e.jsxs("div",{className:"space-y-3",children:[n.keyword_rules.map((S,T)=>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:["关键词规则 ",T+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(M,{rule:S}),e.jsxs(ps,{children:[e.jsx(bt,{asChild:!0,children:e.jsx(C,{size:"sm",variant:"ghost",children:e.jsx(ls,{className:"h-4 w-4"})})}),e.jsxs(os,{children:[e.jsxs(ds,{children:[e.jsx(ms,{children:"确认删除"}),e.jsxs(xs,{children:["确定要删除关键词规则 ",T+1," 吗?此操作无法撤销。"]})]}),e.jsxs(us,{children:[e.jsx(fs,{children:"取消"}),e.jsx(hs,{onClick:()=>w(T),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(C,{onClick:()=>R(T),size:"sm",variant:"ghost",children:[e.jsx(it,{className:"h-3 w-3 mr-1"}),"添加关键词"]})]}),e.jsxs("div",{className:"space-y-2",children:[(S.keywords||[]).map(($,A)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ie,{value:$,onChange:Q=>k(T,A,Q.target.value),placeholder:"关键词",className:"flex-1"}),e.jsx(C,{onClick:()=>D(T,A),size:"sm",variant:"ghost",children:e.jsx(ls,{className:"h-4 w-4"})})]},A)),(!S.keywords||S.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(et,{value:S.reaction,onChange:$=>y(T,"reaction",$.target.value),placeholder:"触发后麦麦的反应...",rows:3,className:"text-sm"})]})]})]},T)),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:S=>h({...i,enable_response_post_process:S})}),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(Ge,{id:"enable_chinese_typo",checked:c.enable,onCheckedChange:S=>f({...c,enable:S})}),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(ie,{id:"error_rate",type:"number",step:"0.001",min:"0",max:"1",value:c.error_rate,onChange:S=>f({...c,error_rate:parseFloat(S.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"min_freq",className:"text-xs font-medium",children:"最小字频阈值"}),e.jsx(ie,{id:"min_freq",type:"number",min:"0",value:c.min_freq,onChange:S=>f({...c,min_freq:parseInt(S.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(ie,{id:"tone_error_rate",type:"number",step:"0.01",min:"0",max:"1",value:c.tone_error_rate,onChange:S=>f({...c,tone_error_rate:parseFloat(S.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(ie,{id:"word_replace_rate",type:"number",step:"0.001",min:"0",max:"1",value:c.word_replace_rate,onChange:S=>f({...c,word_replace_rate:parseFloat(S.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:S=>p({...u,enable:S})}),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(ie,{id:"max_length",type:"number",min:"1",value:u.max_length,onChange:S=>p({...u,max_length:parseInt(S.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(ie,{id:"max_sentence_num",type:"number",min:"1",value:u.max_sentence_num,onChange:S=>p({...u,max_sentence_num:parseInt(S.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:S=>p({...u,enable_kaomoji_protection:S})}),e.jsx(E,{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:S=>p({...u,enable_overflow_return_all:S})}),e.jsx(E,{htmlFor:"enable_overflow_return_all",className:"cursor-pointer",children:"超出时一次性返回全部"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"当句子数量超出限制时,合并后一次性返回所有内容"})]})]})})]})]})]})}),l_=Es.memo(function({config:n,onChange:i}){const[c,u]=m.useState(""),[x,h]=m.useState(""),[f,p]=m.useState(!1),g=n.allowed_ips?n.allowed_ips.split(",").map(k=>k.trim()).filter(k=>k):[],N=n.trusted_proxies?n.trusted_proxies.split(",").map(k=>k.trim()).filter(k=>k):[],v=()=>{if(!c.trim())return;const k=[...g,c.trim()];i({...n,allowed_ips:k.join(",")}),u("")},b=k=>{const I=g.filter((M,S)=>S!==k);i({...n,allowed_ips:I.join(",")})},w=()=>{if(!x.trim())return;const k=[...N,x.trim()];i({...n,trusted_proxies:k.join(",")}),h("")},y=k=>{const I=N.filter((M,S)=>S!==k);i({...n,trusted_proxies:I.join(",")})},R=k=>{!k&&n.enabled?p(!0):i({...n,enabled:k})},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(Ge,{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(Be,{value:n.mode,onValueChange:k=>i({...n,mode:k}),children:[e.jsx(Le,{children:e.jsx($e,{placeholder:"选择运行模式"})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"development",children:"开发模式"}),e.jsx(ae,{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(Be,{value:n.anti_crawler_mode,onValueChange:k=>i({...n,anti_crawler_mode:k}),children:[e.jsx(Le,{children:e.jsx($e,{placeholder:"选择防爬虫模式"})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"false",children:"禁用"}),e.jsx(ae,{value:"basic",children:"基础(只记录不阻止)"}),e.jsx(ae,{value:"loose",children:"宽松"}),e.jsx(ae,{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(ie,{value:c,onChange:k=>u(k.target.value),onKeyDown:k=>{k.key==="Enter"&&(k.preventDefault(),v())},placeholder:"输入IP地址后按回车或点击添加"}),e.jsx(C,{type:"button",size:"sm",onClick:v,disabled:!c.trim(),children:e.jsx(it,{className:"h-4 w-4"})})]}),g.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:g.map((k,I)=>e.jsxs(Ae,{variant:"secondary",className:"flex items-center gap-1",children:[k,e.jsx("button",{type:"button",onClick:()=>b(I),className:"ml-1 hover:bg-destructive/20 rounded-full p-0.5",children:e.jsx(_a,{className:"h-3 w-3"})})]},I))}),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(ie,{value:x,onChange:k=>h(k.target.value),onKeyDown:k=>{k.key==="Enter"&&(k.preventDefault(),w())},placeholder:"输入代理IP后按回车或点击添加"}),e.jsx(C,{type:"button",size:"sm",onClick:w,disabled:!x.trim(),children:e.jsx(it,{className:"h-4 w-4"})})]}),N.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:N.map((k,I)=>e.jsxs(Ae,{variant:"secondary",className:"flex items-center gap-1",children:[k,e.jsx("button",{type:"button",onClick:()=>y(I),className:"ml-1 hover:bg-destructive/20 rounded-full p-0.5",children:e.jsx(_a,{className:"h-3 w-3"})})]},I))}),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:k=>i({...n,trust_xff:k})}),e.jsx(E,{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:k=>i({...n,secure_cookie:k})}),e.jsx(E,{className:"cursor-pointer",children:"启用安全 Cookie(仅 HTTPS)"})]})]})]}),e.jsx(ps,{open:f,onOpenChange:p,children:e.jsxs(os,{children:[e.jsxs(ds,{children:[e.jsx(ms,{children:"警告:即将关闭 WebUI"}),e.jsxs(xs,{children:["关闭 WebUI 后,在您下次重启麦麦之前,WebUI 界面将无法访问。",e.jsx("br",{}),e.jsx("br",{}),"您需要通过修改配置文件或命令行重新启用 WebUI 才能再次访问此界面。",e.jsx("br",{}),e.jsx("br",{}),"确定要关闭 WebUI 吗?"]})]}),e.jsxs(us,{children:[e.jsx(fs,{children:"取消"}),e.jsx(hs,{variant:"destructive",onClick:D,children:"确认关闭"})]})]})})]})}),un="/api/webui/config";async function ng(){const n=await(await we(`${un}/bot`)).json();if(!n.success)throw new Error("获取配置数据失败");return n.config}async function ln(){const n=await(await we(`${un}/model`)).json();if(!n.success)throw new Error("获取模型配置数据失败");return n.config}async function rg(l){const i=await(await we(`${un}/bot`,{method:"POST",body:JSON.stringify(l)})).json();if(!i.success)throw new Error(i.message||"保存配置失败")}async function n_(){const n=await(await we(`${un}/bot/raw`)).json();if(!n.success)throw new Error("获取配置源代码失败");return n.content}async function r_(l){const i=await(await we(`${un}/bot/raw`,{method:"POST",body:JSON.stringify({raw_content:l})})).json();if(!i.success)throw new Error(i.message||"保存配置失败")}async function Ii(l){const i=await(await we(`${un}/model`,{method:"POST",body:JSON.stringify(l)})).json();if(!i.success)throw new Error(i.message||"保存配置失败")}async function i_(l,n){const c=await(await we(`${un}/bot/section/${l}`,{method:"POST",body:JSON.stringify(n)})).json();if(!c.success)throw new Error(c.message||`保存配置节 ${l} 失败`)}async function Am(l,n){const c=await(await we(`${un}/model/section/${l}`,{method:"POST",body:JSON.stringify(n)})).json();if(!c.success)throw new Error(c.message||`保存配置节 ${l} 失败`)}async function c_(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 o_(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 d_=Lr("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"}}),nt=m.forwardRef(({className:l,variant:n,...i},c)=>e.jsx("div",{ref:c,role:"alert",className:B(d_({variant:n}),l),...i}));nt.displayName="Alert";const An=m.forwardRef(({className:l,...n},i)=>e.jsx("h5",{ref:i,className:B("mb-1 font-medium leading-none tracking-tight",l),...n}));An.displayName="AlertTitle";const rt=m.forwardRef(({className:l,...n},i)=>e.jsx("div",{ref:i,className:B("text-sm [&_p]:leading-relaxed",l),...n}));rt.displayName="AlertDescription";const u_={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:"#"}}},m_={python:[r1()],json:[i1(),c1()],toml:[n1.define(u_)],text:[]};function ev({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]=m.useState(!1);if(m.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=[...m_[i]||[],Yp.lineWrapping];return c&&b.push(Yp.editable.of(!1)),e.jsx("div",{className:`rounded-md overflow-hidden border ${g}`,children:e.jsx(o1,{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 x_({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}=Uj({id:l,disabled:f}),D={transform:Bj.Transform.toString(w),transition:y};return e.jsxs("div",{ref:b,style:D,className:B("flex items-start gap-2 group",R&&"opacity-50 z-50"),children:[e.jsx("button",{type:"button",className:B("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(gj,{className:"h-4 w-4"})}),e.jsx("div",{className:"flex-1 min-w-0",children:i==="object"&&c?e.jsx(h_,{value:u,onChange:x,fields:c,disabled:f}):i==="number"?e.jsx(ie,{type:"number",value:u??"",onChange:k=>x(parseFloat(k.target.value)||0),placeholder:g??`第 ${n+1} 项`,disabled:f,className:"font-mono"}):e.jsx(ie,{type:"text",value:u??"",onChange:k=>x(k.target.value),placeholder:g??`第 ${n+1} 项`,disabled:f})}),e.jsx(C,{type:"button",variant:"ghost",size:"icon",onClick:h,disabled:f||!p,className:B("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 h_({value:l,onChange:n,fields:i,disabled:c}){const u=m.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(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(E,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsx("span",{className:"text-xs text-muted-foreground",children:g})]}),e.jsx(wa,{value:[g],onValueChange:N=>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(Be,{value:String(p??f.default??""),onValueChange:g=>u(h,g),disabled:c,children:[e.jsx(Le,{className:"h-8 text-sm",children:e.jsx($e,{placeholder:f.placeholder??"请选择"})}),e.jsx(Ue,{children:f.choices.map(g=>e.jsx(ae,{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(ie,{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(ie,{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(De,{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 f_({value:l,onChange:n,itemType:i="string",itemFields:c,minItems:u,maxItems:x,disabled:h,placeholder:f}){const p=m.useMemo(()=>Array.isArray(l)?l:typeof l=="string"&&l.trim()?l.split(",").map(M=>M.trim()):[],[l]),[g]=m.useState(()=>new Map),N=m.useCallback(M=>(g.has(M)||g.set(M,`item-${Date.now()}-${M}-${Math.random().toString(36).slice(2)}`),g.get(M)),[g]),v=m.useMemo(()=>{const M=[];for(let S=0;S{const{active:S,over:T}=M;if(T&&S.id!==T.id){const $=v.indexOf(S.id),A=v.indexOf(T.id),Q=Dj(p,$,A);n(Q)}},[p,v,n]),y=m.useCallback(()=>{if(x!=null&&p.length>=x)return;let M;i==="object"&&c?M=Object.fromEntries(Object.entries(c).map(([S,T])=>[S,T.default??""])):i==="number"?M=0:M="",n([...p,M])},[p,x,i,c,n]),R=m.useCallback((M,S)=>{const T=[...p];T[M]=S,n(T)},[p,n]),D=m.useCallback(M=>{if(u!=null&&p.length<=u)return;const S=p.filter((T,$)=>$!==M);g.delete(M),n(S)},[p,u,g,n]),k=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(Ct,{className:"h-4 w-4"}),e.jsx("span",{children:"暂无数据,点击下方按钮添加"})]}):e.jsx(Oj,{sensors:b,collisionDetection:Rj,onDragEnd:w,children:e.jsx(Lj,{items:v,strategy:u1,children:e.jsx("div",{className:"space-y-2",children:p.map((M,S)=>e.jsx(x_,{id:v[S],index:S,itemType:i,itemFields:c,value:M,onChange:T=>R(S,T),onRemove:()=>D(S),disabled:h,canRemove:I,placeholder:f},v[S]))})})}),e.jsxs(C,{type:"button",variant:"outline",size:"sm",onClick:y,disabled:h||!k,className:"w-full",children:[e.jsx(it,{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 Im({content:l,className:n=""}){return e.jsx("div",{className:`prose prose-sm dark:prose-invert max-w-none ${n}`,children:e.jsx(g1,{remarkPlugins:[v1,N1],rehypePlugins:[j1],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 p_(l,n,i,c={}){const{debounceMs:u=2e3,onSaveSuccess:x,onSaveError:h}=c,f=m.useRef(null),p=m.useCallback(async(b,w)=>{try{n(!0),await i_(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=m.useCallback((b,w)=>{l||(i(!0),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{p(b,w)},u))},[l,i,p,u]),N=m.useCallback(async(b,w)=>{f.current&&(clearTimeout(f.current),f.current=null),await p(b,w)},[p]),v=m.useCallback(()=>{f.current&&(clearTimeout(f.current),f.current=null)},[]);return m.useEffect(()=>()=>{f.current&&clearTimeout(f.current)},[]),{triggerAutoSave:g,saveNow:N,cancelPendingAutoSave:v}}function Ut(l,n,i,c){m.useEffect(()=>{l&&!i&&c(n,l)},[l])}const g_=500;function j_(){return e.jsx(Pn,{children:e.jsx(v_,{})})}function v_(){const[l,n]=m.useState(!0),[i,c]=m.useState(!1),[u,x]=m.useState(!1),[h,f]=m.useState(!1),[p,g]=m.useState("visual"),[N,v]=m.useState(""),[b,w]=m.useState(!1),{toast:y}=Ws(),{triggerRestart:R,isRestarting:D}=dn(),[k,I]=m.useState(null),[M,S]=m.useState(null),[T,$]=m.useState(null),[A,Q]=m.useState(null),[G,de]=m.useState(null),[oe,ve]=m.useState(null),[le,fe]=m.useState(null),[ge,z]=m.useState(null),[V,U]=m.useState(null),[L,P]=m.useState(null),[_e,je]=m.useState(null),[Se,Y]=m.useState(null),[be,Z]=m.useState(null),[xe,Me]=m.useState(null),[J,ce]=m.useState(null),[Fe,q]=m.useState(null),[ee,ke]=m.useState(null),[Te,Oe]=m.useState(null),[me,ze]=m.useState(null),rs=m.useRef(!0),Kt=m.useRef({}),Qt=m.useCallback(Ee=>{Kt.current=Ee,I(Ee.bot),S(Ee.personality);const gs=Ee.chat;gs.talk_value_rules||(gs.talk_value_rules=[]),$(gs),Q(Ee.expression),de(Ee.emoji),ve(Ee.memory),fe(Ee.tool),z(Ee.voice),U(Ee.dream),P(Ee.lpmm_knowledge),je(Ee.keyword_reaction),Y(Ee.response_post_process),Z(Ee.chinese_typo),Me(Ee.response_splitter),ce(Ee.log),q(Ee.debug),ke(Ee.maim_message),Oe(Ee.telemetry),ze(Ee.webui)},[]),ka=m.useCallback(()=>({...Kt.current,bot:k,personality:M,chat:T,expression:A,emoji:G,memory:oe,tool:le,voice:ge,dream:V,lpmm_knowledge:L,keyword_reaction:_e,response_post_process:Se,chinese_typo:be,response_splitter:xe,log:J,debug:Fe,maim_message:ee,telemetry:Te,webui:me}),[k,M,T,A,G,oe,le,ge,V,L,_e,Se,be,xe,J,Fe,ee,Te,me]),yt=m.useCallback(async()=>{try{const gs=(await n_()).replace(/"([^"]*)"/g,(ts,Ze)=>`"${Ze.replace(/\\n/g,` -`).replace(/\\t/g," ").replace(/\\r/g,"\r").replace(/\\"/g,'"').replace(/\\\\/g,"\\")}"`);v(gs),w(!1)}catch(Ee){y({variant:"destructive",title:"加载失败",description:Ee instanceof Error?Ee.message:"加载源代码失败"})}},[y]),st=m.useCallback(async()=>{try{n(!0);const Ee=await ng();Qt(Ee),f(!1),rs.current=!1,await yt()}catch(Ee){console.error("加载配置失败:",Ee),y({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}finally{n(!1)}},[y,yt,Qt]);m.useEffect(()=>{st()},[st]);const{triggerAutoSave:F,cancelPendingAutoSave:qe}=p_(rs.current,x,f);Ut(k,"bot",rs.current,F),Ut(M,"personality",rs.current,F),Ut(T,"chat",rs.current,F),Ut(A,"expression",rs.current,F),Ut(G,"emoji",rs.current,F),Ut(oe,"memory",rs.current,F),Ut(le,"tool",rs.current,F),Ut(ge,"voice",rs.current,F),Ut(L,"lpmm_knowledge",rs.current,F),Ut(_e,"keyword_reaction",rs.current,F),Ut(Se,"response_post_process",rs.current,F),Ut(be,"chinese_typo",rs.current,F),Ut(xe,"response_splitter",rs.current,F),Ut(J,"log",rs.current,F),Ut(Fe,"debug",rs.current,F),Ut(ee,"maim_message",rs.current,F),Ut(Te,"telemetry",rs.current,F),Ut(me,"webui",rs.current,F);const Ie=async()=>{try{c(!0);const Ee=N.replace(/"([^"]*)"/g,(gs,ts)=>`"${ts.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r")}"`);await r_(Ee),f(!1),w(!1),y({title:"保存成功",description:"配置已保存"}),await st()}catch(Ee){w(!0),y({variant:"destructive",title:"保存失败",description:Ee instanceof Error?Ee.message:"保存配置失败"})}finally{c(!1)}},Ve=async Ee=>{if(h){y({variant:"destructive",title:"切换失败",description:"请先保存当前更改"});return}if(g(Ee),Ee==="source")await yt();else try{const gs=await ng();Qt(gs),f(!1)}catch(gs){console.error("加载配置失败:",gs),y({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}},Cs=async()=>{try{c(!0),qe(),await rg(ka()),f(!1),y({title:"保存成功",description:"麦麦主程序配置已保存"})}catch(Ee){console.error("保存配置失败:",Ee),y({title:"保存失败",description:Ee.message,variant:"destructive"})}finally{c(!1)}},ns=async()=>{await R()},Rs=async()=>{try{c(!0),qe(),await rg(ka()),f(!1),y({title:"保存成功",description:"配置已保存,即将重启麦麦..."}),await new Promise(Ee=>setTimeout(Ee,g_)),await ns()}catch(Ee){console.error("保存失败:",Ee),y({title:"保存失败",description:Ee.message,variant:"destructive"})}finally{c(!1)}};return l?e.jsx(es,{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(es,{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(C,{onClick:p==="visual"?Cs:Ie,disabled:i||u||!h||D,size:"sm",variant:"outline",className:"w-20 sm:w-24",children:[e.jsx(Xi,{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(ps,{children:[e.jsx(bt,{asChild:!0,children:e.jsxs(C,{disabled:i||u||D,size:"sm",className:"w-20 sm:w-28",children:[e.jsx(Ji,{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(os,{children:[e.jsxs(ds,{children:[e.jsx(ms,{children:"确认重启麦麦?"}),e.jsx(xs,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:h?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})})})]}),e.jsxs(us,{children:[e.jsx(fs,{children:"取消"}),e.jsx(hs,{onClick:h?Rs:ns,children:h?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsx("div",{className:"flex",children:e.jsx(ma,{value:p,onValueChange:Ee=>Ve(Ee),className:"w-full",children:e.jsxs(ta,{className:"h-8 sm:h-9 w-full grid grid-cols-2",children:[e.jsxs(as,{value:"visual",className:"text-xs sm:text-sm",children:[e.jsx(jj,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"可视化编辑"]}),e.jsxs(as,{value:"source",className:"text-xs sm:text-sm",children:[e.jsx(vj,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"源代码编辑"]})]})})})]}),e.jsxs(nt,{children:[e.jsx(qt,{className:"h-4 w-4"}),e.jsxs(rt,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),p==="source"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(nt,{children:[e.jsx(qt,{className:"h-4 w-4"}),e.jsxs(rt,{children:[e.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。此功能仅适用于熟悉 TOML 语法的高级用户。保存时会在后端验证格式,只有格式完全正确才能保存。",b&&e.jsx("span",{className:"text-destructive font-semibold ml-2",children:"⚠️ 上次保存失败,请检查 TOML 格式"})]})]}),e.jsx(ev,{value:N,onChange:Ee=>{v(Ee),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(ma,{defaultValue:"bot",className:"w-full",children:[e.jsxs(ta,{className:"flex flex-wrap h-auto gap-1 p-1 sm:grid sm:grid-cols-5 lg:grid-cols-10",children:[e.jsx(as,{value:"bot",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"基本信息"}),e.jsx(as,{value:"personality",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"人格"}),e.jsx(as,{value:"chat",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"聊天"}),e.jsx(as,{value:"expression",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"表达"}),e.jsx(as,{value:"features",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"功能"}),e.jsx(as,{value:"processing",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"处理"}),e.jsx(as,{value:"dream",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"做梦"}),e.jsx(as,{value:"lpmm",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"知识库"}),e.jsx(as,{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(as,{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:k&&e.jsx(I2,{config:k,onChange:I})}),e.jsx(ys,{value:"personality",className:"space-y-4",children:M&&e.jsx(P2,{config:M,onChange:S})}),e.jsx(ys,{value:"chat",className:"space-y-4",children:T&&e.jsx(V2,{config:T,onChange:$})}),e.jsx(ys,{value:"expression",className:"space-y-4",children:A&&e.jsx(s_,{config:A,onChange:Q})}),e.jsx(ys,{value:"features",className:"space-y-4",children:G&&oe&&le&&ge&&e.jsx(W2,{emojiConfig:G,memoryConfig:oe,toolConfig:le,voiceConfig:ge,onEmojiChange:de,onMemoryChange:ve,onToolChange:fe,onVoiceChange:z})}),e.jsx(ys,{value:"processing",className:"space-y-4",children:_e&&Se&&be&&xe&&e.jsx(a_,{keywordReactionConfig:_e,responsePostProcessConfig:Se,chineseTypoConfig:be,responseSplitterConfig:xe,onKeywordReactionChange:je,onResponsePostProcessChange:Y,onChineseTypoChange:Z,onResponseSplitterChange:Me})}),e.jsx(ys,{value:"dream",className:"space-y-4",children:V&&e.jsx(K2,{config:V,onChange:U})}),e.jsx(ys,{value:"lpmm",className:"space-y-4",children:L&&e.jsx(Q2,{config:L,onChange:P})}),e.jsx(ys,{value:"webui",className:"space-y-4",children:me&&e.jsx(l_,{config:me,onChange:ze})}),e.jsxs(ys,{value:"other",className:"space-y-4",children:[J&&e.jsx(Y2,{config:J,onChange:ce}),Fe&&e.jsx(J2,{config:Fe,onChange:q}),ee&&e.jsx(X2,{config:ee,onChange:ke}),Te&&e.jsx(Z2,{config:Te,onChange:Oe})]})]})}),e.jsx(Hn,{})]})})}const El=m.forwardRef(({className:l,...n},i)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:i,className:B("w-full caption-bottom text-sm",l),...n})}));El.displayName="Table";const Ml=m.forwardRef(({className:l,...n},i)=>e.jsx("thead",{ref:i,className:B("[&_tr]:border-b",l),...n}));Ml.displayName="TableHeader";const Al=m.forwardRef(({className:l,...n},i)=>e.jsx("tbody",{ref:i,className:B("[&_tr:last-child]:border-0",l),...n}));Al.displayName="TableBody";const N_=m.forwardRef(({className:l,...n},i)=>e.jsx("tfoot",{ref:i,className:B("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",l),...n}));N_.displayName="TableFooter";const ct=m.forwardRef(({className:l,...n},i)=>e.jsx("tr",{ref:i,className:B("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",l),...n}));ct.displayName="TableRow";const Je=m.forwardRef(({className:l,...n},i)=>e.jsx("th",{ref:i,className:B("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}));Je.displayName="TableHead";const He=m.forwardRef(({className:l,...n},i)=>e.jsx("td",{ref:i,className:B("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",l),...n}));He.displayName="TableCell";const b_=m.forwardRef(({className:l,...n},i)=>e.jsx("caption",{ref:i,className:B("mt-4 text-sm text-muted-foreground",l),...n}));b_.displayName="TableCaption";const Go=m.forwardRef(({className:l,...n},i)=>e.jsx(xa,{ref:i,className:B("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",l),...n}));Go.displayName=xa.displayName;const Fo=m.forwardRef(({className:l,...n},i)=>e.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[e.jsx(Vt,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(xa.Input,{ref:i,className:B("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})]}));Fo.displayName=xa.Input.displayName;const qo=m.forwardRef(({className:l,...n},i)=>e.jsx(xa.List,{ref:i,className:B("max-h-[300px] overflow-y-auto overflow-x-hidden",l),...n}));qo.displayName=xa.List.displayName;const Vo=m.forwardRef((l,n)=>e.jsx(xa.Empty,{ref:n,className:"py-6 text-center text-sm",...l}));Vo.displayName=xa.Empty.displayName;const qi=m.forwardRef(({className:l,...n},i)=>e.jsx(xa.Group,{ref:i,className:B("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}));qi.displayName=xa.Group.displayName;const y_=m.forwardRef(({className:l,...n},i)=>e.jsx(xa.Separator,{ref:i,className:B("-mx-1 h-px bg-border",l),...n}));y_.displayName=xa.Separator.displayName;const Vi=m.forwardRef(({className:l,...n},i)=>e.jsx(xa.Item,{ref:i,className:B("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}));Vi.displayName=xa.Item.displayName;const Xs=m.forwardRef(({className:l,...n},i)=>e.jsx(aj,{ref:i,className:B("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(pw,{className:B("grid place-content-center text-current"),children:e.jsx(St,{className:"h-4 w-4"})})}));Xs.displayName=aj.displayName;const sv=m.createContext(null),tv="maibot-completed-tours";function w_(){try{const l=localStorage.getItem(tv);return l?new Set(JSON.parse(l)):new Set}catch{return new Set}}function ig(l){localStorage.setItem(tv,JSON.stringify([...l]))}function __({children:l}){const[n,i]=m.useState({activeTourId:null,stepIndex:0,isRunning:!1}),[c]=m.useState(()=>new Map),[u,x]=m.useState(w_),[,h]=m.useState(0),f=m.useCallback((M,S)=>{c.set(M,S),h(T=>T+1)},[c]),p=m.useCallback(M=>{c.delete(M),i(S=>S.activeTourId===M?{...S,activeTourId:null,isRunning:!1,stepIndex:0}:S)},[c]),g=m.useCallback((M,S=0)=>{c.has(M)&&i({activeTourId:M,stepIndex:S,isRunning:!0})},[c]),N=m.useCallback(()=>{i(M=>({...M,isRunning:!1}))},[]),v=m.useCallback(M=>{i(S=>({...S,stepIndex:M}))},[]),b=m.useCallback(()=>{i(M=>({...M,stepIndex:M.stepIndex+1}))},[]),w=m.useCallback(()=>{i(M=>({...M,stepIndex:Math.max(0,M.stepIndex-1)}))},[]),y=m.useCallback(()=>n.activeTourId?c.get(n.activeTourId)||[]:[],[n.activeTourId,c]),R=m.useCallback(M=>{x(S=>{const T=new Set(S);return T.add(M),ig(T),T})},[]),D=m.useCallback(M=>{const{action:S,index:T,status:$,type:A}=M,Q=["finished","skipped"];if(S==="close"){i(G=>({...G,isRunning:!1,stepIndex:0}));return}Q.includes($)?i(G=>($==="finished"&&G.activeTourId&&setTimeout(()=>R(G.activeTourId),0),{...G,isRunning:!1,stepIndex:0})):A==="step:after"&&(S==="next"?i(G=>({...G,stepIndex:T+1})):S==="prev"&&i(G=>({...G,stepIndex:T-1})))},[R]),k=m.useCallback(M=>u.has(M),[u]),I=m.useCallback(M=>{x(S=>{const T=new Set(S);return T.delete(M),ig(T),T})},[]);return e.jsx(sv.Provider,{value:{state:n,tours:c,registerTour:f,unregisterTour:p,startTour:g,stopTour:N,goToStep:v,nextStep:b,prevStep:w,getCurrentSteps:y,handleJoyrideCallback:D,isTourCompleted:k,markTourCompleted:R,resetTourCompleted:I},children:l})}function Pm(){const l=m.useContext(sv);if(!l)throw new Error("useTour must be used within a TourProvider");return l}const S_={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)"}},k_={back:"上一步",close:"关闭",last:"完成",next:"下一步",nextLabelWithProgress:"下一步 ({step}/{steps})",open:"打开对话框",skip:"跳过"};function C_(){const{state:l,getCurrentSteps:n,handleJoyrideCallback:i}=Pm(),c=n(),[u,x]=m.useState(!1),h=m.useRef(l.stepIndex),f=m.useRef(null);m.useEffect(()=>{h.current!==l.stepIndex&&(x(!1),h.current=l.stepIndex)},[l.stepIndex]),m.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 I=document.querySelector(b);if(I){const M=I.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),D=setTimeout(()=>{clearInterval(R),x(!0)},5e3),k=()=>{clearInterval(R),clearTimeout(D)};f.current=k},150);return()=>{clearTimeout(w),f.current&&(f.current(),f.current=null)}},[l.isRunning,l.stepIndex,c]);const[p,g]=m.useState(null);if(m.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(x1,{steps:c,stepIndex:l.stepIndex,run:l.isRunning,continuous:!0,showSkipButton:!0,showProgress:!0,disableOverlayClose:!0,disableScrolling:!1,disableScrollParentFix:!1,callback:i,styles:S_,locale:k_,scrollOffset:80,scrollToFirstStep:!0,floaterProps:{styles:{floater:{zIndex:99999}},disableAnimation:!0}},`tour-step-${l.stepIndex}`);return p?e0.createPortal(N,p):N}const el="model-assignment-tour",av=[{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}],lv={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"},Li=[{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 cg(l){return l?l.replace(/\/+$/,"").toLowerCase():""}function T_(l){if(!l)return null;const n=cg(l);return Li.find(i=>i.id!=="custom"&&cg(i.base_url)===n)||null}const vo=l=>({...l,max_retry:l.max_retry??2,timeout:l.timeout??30,retry_interval:l.retry_interval??10}),E_=l=>{const n={};return l?(l.name?.trim()||(n.name="请输入提供商名称"),l.base_url?.trim()||(n.base_url="请输入基础 URL"),l.api_key?.trim()||(n.api_key="请输入 API Key"),{isValid:Object.keys(n).length===0,errors:n}):{isValid:!1,errors:{name:"提供商数据为空"}}};function M_(){return e.jsx(Pn,{children:e.jsx(A_,{})})}function A_(){const[l,n]=m.useState([]),[i,c]=m.useState(!0),[u,x]=m.useState(!1),[h,f]=m.useState(!1),[p,g]=m.useState(!1),[N,v]=m.useState(!1),[b,w]=m.useState(null),[y,R]=m.useState(null),[D,k]=m.useState("custom"),[I,M]=m.useState(!1),[S,T]=m.useState(!1),[$,A]=m.useState(null),[Q,G]=m.useState(!1),[de,oe]=m.useState(""),[ve,le]=m.useState(new Set),[fe,ge]=m.useState(!1),[z,V]=m.useState(1),[U,L]=m.useState(20),[P,_e]=m.useState(""),[je,Se]=m.useState({isOpen:!1,providersToDelete:[],affectedModels:[],pendingProviders:[],context:"auto",oldProviders:[]}),[Y,be]=m.useState({}),[Z,xe]=m.useState(new Set),[Me,J]=m.useState(new Map),{toast:ce}=Ws(),Fe=aa(),{state:q,goToStep:ee,registerTour:ke}=Pm(),{triggerRestart:Te,isRestarting:Oe}=dn(),me=m.useRef(null),ze=m.useRef(!0);m.useEffect(()=>{ke(el,av)},[ke]),m.useEffect(()=>{if(q.activeTourId===el&&q.isRunning){const X=lv[q.stepIndex];X&&!window.location.pathname.endsWith(X.replace("/config/",""))&&Fe({to:X})}},[q.stepIndex,q.activeTourId,q.isRunning,Fe]);const rs=m.useRef(q.stepIndex);m.useEffect(()=>{if(q.activeTourId===el&&q.isRunning){const X=rs.current,ye=q.stepIndex;X>=3&&X<=9&&ye<3&&v(!1),X>=10&&ye>=3&&ye<=9&&(be({}),k("custom"),w({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10}),R(null),G(!1),v(!0)),rs.current=ye}},[q.stepIndex,q.activeTourId,q.isRunning]),m.useEffect(()=>{if(q.activeTourId!==el||!q.isRunning)return;const X=ye=>{const Ce=ye.target,Ls=q.stepIndex;Ls===2&&Ce.closest('[data-tour="add-provider-button"]')?setTimeout(()=>ee(3),300):Ls===9&&Ce.closest('[data-tour="provider-cancel-button"]')&&setTimeout(()=>ee(10),300)};return document.addEventListener("click",X,!0),()=>document.removeEventListener("click",X,!0)},[q,ee]),m.useEffect(()=>{Kt()},[]);const Kt=async()=>{try{c(!0);const X=await ln();n(X.api_providers||[]),g(!1),ze.current=!1}catch(X){console.error("加载配置失败:",X)}finally{c(!1)}},Qt=async()=>{await Te()},ka=async()=>{try{x(!0),me.current&&clearTimeout(me.current);const X=l.map(tt=>({...tt,max_retry:tt.max_retry??2,timeout:tt.timeout??30,retry_interval:tt.retry_interval??10})),{shouldProceed:ye}=await yt(X,"restart");if(!ye){x(!1);return}const Ce=await ln(),Ls=new Set(X.map(tt=>tt.name)),Jt=(Ce.models||[]).filter(tt=>Ls.has(tt.api_provider));Ce.api_providers=X,Ce.models=Jt,await Ii(Ce),g(!1),ce({title:"保存成功",description:"正在重启麦麦..."}),await Qt()}catch(X){console.error("保存配置失败:",X),ce({title:"保存失败",description:X.message,variant:"destructive"}),x(!1)}},yt=m.useCallback(async(X,ye="auto")=>{try{const Ce=await ln(),Ls=new Set(l.map(re=>re.name)),ha=new Set(X.map(re=>re.name)),Jt=Array.from(Ls).filter(re=>!ha.has(re));if(Jt.length===0)return{shouldProceed:!0,providers:X};const W=(Ce.models||[]).filter(re=>Jt.includes(re.api_provider));return W.length===0?{shouldProceed:!0,providers:X}:(Se({isOpen:!0,providersToDelete:Jt,affectedModels:W,pendingProviders:X,context:ye,oldProviders:[...l]}),{shouldProceed:!1,providers:X})}catch(Ce){return console.error("检查删除影响失败:",Ce),{shouldProceed:!0,providers:X}}},[l]),st=async()=>{try{(je.context==="auto"?f:x)(!0),Se(re=>({...re,isOpen:!1}));const ye=await ln(),Ce=je.pendingProviders.map(vo),Ls=new Set(Ce.map(re=>re.name)),Jt=(ye.models||[]).filter(re=>Ls.has(re.api_provider)),tt=new Set(je.affectedModels.map(re=>re.name)),W=ye.model_task_config;W&&Object.keys(W).forEach(re=>{const ss=W[re];ss&&Array.isArray(ss.model_list)&&(ss.model_list=ss.model_list.filter(Qs=>!tt.has(Qs)))}),ye.api_providers=Ce,ye.models=Jt,ye.model_task_config=W,await Ii(ye),n(je.pendingProviders),g(!1),ce({title:"删除成功",description:`已删除 ${je.providersToDelete.length} 个提供商和 ${je.affectedModels.length} 个关联模型`}),Se({isOpen:!1,providersToDelete:[],affectedModels:[],pendingProviders:[],context:"auto",oldProviders:[]}),le(new Set),je.context==="restart"&&await Qt()}catch(X){console.error("删除失败:",X),ce({title:"删除失败",description:X.message,variant:"destructive"})}finally{je.context==="auto"?f(!1):x(!1)}},F=()=>{je.oldProviders.length>0&&n(je.oldProviders),Se({isOpen:!1,providersToDelete:[],affectedModels:[],pendingProviders:[],context:"auto",oldProviders:[]}),g(!1)},qe=m.useCallback(async X=>{if(ze.current)return;const{shouldProceed:ye}=await yt(X,"auto");if(!ye){g(!0);return}try{f(!0);const Ce=X.map(vo);await Am("api_providers",Ce),g(!1)}catch(Ce){console.error("自动保存失败:",Ce),ce({title:"自动保存失败",description:Ce.message,variant:"destructive"}),g(!0)}finally{f(!1)}},[l,yt]);m.useEffect(()=>{if(!ze.current)return g(!0),me.current&&clearTimeout(me.current),me.current=setTimeout(()=>{qe(l)},2e3),()=>{me.current&&clearTimeout(me.current)}},[l,qe]);const Ie=async()=>{try{x(!0),me.current&&clearTimeout(me.current);const X=l.map(vo),{shouldProceed:ye}=await yt(X,"manual");if(!ye){x(!1);return}const Ce=await ln(),Ls=new Set(X.map(tt=>tt.name)),ha=Ce.models||[],Jt=ha.filter(tt=>{const W=Ls.has(tt.api_provider);return W||console.warn(`模型 "${tt.name}" 引用了已删除的提供商 "${tt.api_provider}",将被移除`),W});if(ha.length!==Jt.length){const tt=ha.length-Jt.length;ce({title:"注意",description:`已自动移除 ${tt} 个引用已删除提供商的模型`,variant:"default"})}console.log("发送的 providers 数据:",X),Ce.api_providers=X,Ce.models=Jt,console.log("完整配置数据:",Ce),await Ii(Ce),g(!1),ce({title:"保存成功",description:"模型提供商配置已保存"})}catch(X){console.error("保存配置失败:",X),ce({title:"保存失败",description:X.message,variant:"destructive"})}finally{x(!1)}},Ve=(X,ye)=>{if(be({}),X){const Ce=Li.find(Ls=>Ls.base_url===X.base_url&&Ls.client_type===X.client_type);k(Ce?.id||"custom"),w(X)}else k("custom"),w({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10});R(ye),G(!1),v(!0)},Cs=m.useCallback(X=>{k(X),M(!1);const ye=Li.find(Ce=>Ce.id===X);ye&&ye.id!=="custom"?w(Ce=>({...Ce,name:ye.name,base_url:ye.base_url,client_type:ye.client_type})):ye?.id==="custom"&&w(Ce=>({...Ce,name:"",base_url:"",client_type:"openai"}))},[]),ns=m.useMemo(()=>D!=="custom",[D]),Rs=m.useCallback(async()=>{if(b?.api_key)try{await navigator.clipboard.writeText(b.api_key),ce({title:"复制成功",description:"API Key 已复制到剪贴板"})}catch{ce({title:"复制失败",description:"无法访问剪贴板",variant:"destructive"})}},[b?.api_key,ce]),Ee=()=>{if(!b)return;const{isValid:X,errors:ye}=E_(b);if(!X){be(ye);return}be({});const Ce=vo(b);if(y!==null){const Ls=[...l];Ls[y]=Ce,n(Ls)}else n([...l,Ce]);v(!1),w(null),R(null)},gs=X=>{if(!X&&b){const ye={...b,max_retry:b.max_retry??2,timeout:b.timeout??30,retry_interval:b.retry_interval??10};w(ye)}v(X)},ts=X=>{A(X),T(!0)},Ze=async()=>{if($!==null){const X=l.filter((Ce,Ls)=>Ls!==$),{shouldProceed:ye}=await yt(X,"manual");ye&&(n(X),ce({title:"删除成功",description:"提供商已从列表中移除"}))}T(!1),A(null)},js=X=>{const ye=new Set(ve);ye.has(X)?ye.delete(X):ye.add(X),le(ye)},dt=()=>{if(ve.size===_s.length)le(new Set);else{const X=_s.map((ye,Ce)=>l.findIndex(Ls=>Ls===_s[Ce]));le(new Set(X))}},Ot=()=>{if(ve.size===0){ce({title:"提示",description:"请先选择要删除的提供商",variant:"default"});return}ge(!0)},ut=async()=>{const X=l.filter((Ce,Ls)=>!ve.has(Ls)),{shouldProceed:ye}=await yt(X,"manual");ye&&(n(X),le(new Set),ce({title:"批量删除成功",description:`已删除 ${ve.size} 个提供商`})),ge(!1)},_s=m.useMemo(()=>{if(!de)return l;const X=de.toLowerCase();return l.filter(ye=>ye.name.toLowerCase().includes(X)||ye.base_url.toLowerCase().includes(X)||ye.client_type.toLowerCase().includes(X))},[l,de]),{totalPages:Tt,paginatedProviders:Bt}=m.useMemo(()=>{const X=Math.ceil(_s.length/U),ye=_s.slice((z-1)*U,z*U);return{totalPages:X,paginatedProviders:ye}},[_s,z,U]),Ca=m.useCallback(()=>{const X=parseInt(P);X>=1&&X<=Tt&&(V(X),_e(""))},[P,Tt]),Ya=async X=>{xe(ye=>new Set(ye).add(X));try{const ye=await o_(X);J(Ce=>new Map(Ce).set(X,ye)),ye.network_ok?ye.api_key_valid===!0?ce({title:"连接正常",description:`${X} 网络连接正常,API Key 有效 (${ye.latency_ms}ms)`}):ye.api_key_valid===!1?ce({title:"连接正常但 Key 无效",description:`${X} 网络连接正常,但 API Key 无效或已过期`,variant:"destructive"}):ce({title:"网络连接正常",description:`${X} 可以访问 (${ye.latency_ms}ms)`}):ce({title:"连接失败",description:ye.error||"无法连接到提供商",variant:"destructive"})}catch(ye){ce({title:"测试失败",description:ye.message,variant:"destructive"})}finally{xe(ye=>{const Ce=new Set(ye);return Ce.delete(X),Ce})}},nl=async()=>{for(const X of l)await Ya(X.name)},Yt=X=>{const ye=Z.has(X),Ce=Me.get(X);return ye?e.jsxs(Ae,{variant:"secondary",className:"gap-1",children:[e.jsx(zs,{className:"h-3 w-3 animate-spin"}),"测试中"]}):Ce?Ce.network_ok?Ce.api_key_valid===!0?e.jsxs(Ae,{className:"gap-1 bg-green-600 hover:bg-green-700",children:[e.jsx(ea,{className:"h-3 w-3"}),"正常"]}):Ce.api_key_valid===!1?e.jsxs(Ae,{variant:"destructive",className:"gap-1",children:[e.jsx(Ct,{className:"h-3 w-3"}),"Key无效"]}):e.jsxs(Ae,{className:"gap-1 bg-blue-600 hover:bg-blue-700",children:[e.jsx(ea,{className:"h-3 w-3"}),"可访问"]}):e.jsxs(Ae,{variant:"destructive",className:"gap-1",children:[e.jsx(xj,{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:[ve.size>0&&e.jsxs(C,{onClick:Ot,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"}),"批量删除 (",ve.size,")"]}),e.jsxs(C,{onClick:nl,size:"sm",variant:"outline",className:"w-full sm:w-auto",disabled:l.length===0||Z.size>0,children:[e.jsx(zn,{className:"mr-2 h-4 w-4"}),Z.size>0?`测试中 (${Z.size})`:"测试全部"]}),e.jsxs(C,{onClick:()=>Ve(null,null),size:"sm",className:"w-full sm:w-auto","data-tour":"add-provider-button",children:[e.jsx(it,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加提供商"]}),e.jsxs(C,{onClick:Ie,disabled:u||h||!p||Oe,size:"sm",variant:"outline",className:"w-full sm:w-auto sm:min-w-[120px]",children:[e.jsx(Xi,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),u?"保存中...":h?"自动保存中...":p?"保存配置":"已保存"]}),e.jsxs(ps,{children:[e.jsx(bt,{asChild:!0,children:e.jsxs(C,{disabled:u||h||Oe,size:"sm",className:"w-full sm:w-auto sm:min-w-[120px]",children:[e.jsx(Ji,{className:"mr-2 h-4 w-4"}),Oe?"重启中...":p?"保存并重启":"重启麦麦"]})}),e.jsxs(os,{children:[e.jsxs(ds,{children:[e.jsx(ms,{children:"确认重启麦麦?"}),e.jsx(xs,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:p?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})})})]}),e.jsxs(us,{children:[e.jsx(fs,{children:"取消"}),e.jsx(hs,{onClick:p?ka:Qt,children:p?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsxs(nt,{children:[e.jsx(qt,{className:"h-4 w-4"}),e.jsxs(rt,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),e.jsxs(es,{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(Vt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ie,{placeholder:"搜索提供商名称、URL 或类型...",value:de,onChange:X=>oe(X.target.value),className:"pl-9"})]}),de&&e.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",_s.length," 个结果"]})]}),e.jsx("div",{className:"md:hidden space-y-3",children:_s.length===0?e.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:de?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'}):Bt.map((X,ye)=>{const Ce=l.findIndex(Ls=>Ls===X);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:X.name}),Yt(X.name)]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:X.base_url})]}),e.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[e.jsx(C,{variant:"outline",size:"sm",onClick:()=>Ya(X.name),disabled:Z.has(X.name),title:"测试连接",children:Z.has(X.name)?e.jsx(zs,{className:"h-4 w-4 animate-spin"}):e.jsx(zn,{className:"h-4 w-4"})}),e.jsx(C,{variant:"default",size:"sm",onClick:()=>Ve(X,Ce),children:e.jsx(On,{className:"h-4 w-4",strokeWidth:2,fill:"none"})}),e.jsx(C,{size:"sm",onClick:()=>ts(Ce),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:X.client_type})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"最大重试"}),e.jsx("p",{className:"font-medium",children:X.max_retry})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"超时(秒)"}),e.jsx("p",{className:"font-medium",children:X.timeout})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"重试间隔(秒)"}),e.jsx("p",{className:"font-medium",children:X.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(El,{children:[e.jsx(Ml,{children:e.jsxs(ct,{children:[e.jsx(Je,{className:"w-12",children:e.jsx(Xs,{checked:ve.size===_s.length&&_s.length>0,onCheckedChange:dt})}),e.jsx(Je,{children:"状态"}),e.jsx(Je,{children:"名称"}),e.jsx(Je,{children:"基础URL"}),e.jsx(Je,{children:"客户端类型"}),e.jsx(Je,{className:"text-right",children:"最大重试"}),e.jsx(Je,{className:"text-right",children:"超时(秒)"}),e.jsx(Je,{className:"text-right",children:"重试间隔(秒)"}),e.jsx(Je,{className:"text-right",children:"操作"})]})}),e.jsx(Al,{children:Bt.length===0?e.jsx(ct,{children:e.jsx(He,{colSpan:9,className:"text-center text-muted-foreground py-8",children:de?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'})}):Bt.map((X,ye)=>{const Ce=l.findIndex(Ls=>Ls===X);return e.jsxs(ct,{children:[e.jsx(He,{children:e.jsx(Xs,{checked:ve.has(Ce),onCheckedChange:()=>js(Ce)})}),e.jsx(He,{children:Yt(X.name)||e.jsx(Ae,{variant:"outline",className:"text-muted-foreground",children:"未测试"})}),e.jsx(He,{className:"font-medium",children:X.name}),e.jsx(He,{className:"max-w-xs truncate",title:X.base_url,children:X.base_url}),e.jsx(He,{children:X.client_type}),e.jsx(He,{className:"text-right",children:X.max_retry}),e.jsx(He,{className:"text-right",children:X.timeout}),e.jsx(He,{className:"text-right",children:X.retry_interval}),e.jsx(He,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(C,{variant:"outline",size:"sm",onClick:()=>Ya(X.name),disabled:Z.has(X.name),title:"测试连接",children:Z.has(X.name)?e.jsx(zs,{className:"h-4 w-4 animate-spin"}):e.jsx(zn,{className:"h-4 w-4"})}),e.jsxs(C,{variant:"default",size:"sm",onClick:()=>Ve(X,Ce),children:[e.jsx(On,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(C,{size:"sm",onClick:()=>ts(Ce),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)})})]})})}),_s.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(Be,{value:U.toString(),onValueChange:X=>{L(parseInt(X)),V(1),le(new Set)},children:[e.jsx(Le,{id:"page-size-provider",className:"w-20",children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"10",children:"10"}),e.jsx(ae,{value:"20",children:"20"}),e.jsx(ae,{value:"50",children:"50"}),e.jsx(ae,{value:"100",children:"100"})]})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(z-1)*U+1," 到"," ",Math.min(z*U,_s.length)," 条,共 ",_s.length," 条"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{variant:"outline",size:"sm",onClick:()=>V(1),disabled:z===1,className:"hidden sm:flex",children:e.jsx(Ur,{className:"h-4 w-4"})}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>V(X=>Math.max(1,X-1)),disabled:z===1,children:[e.jsx(ll,{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(ie,{type:"number",value:P,onChange:X=>_e(X.target.value),onKeyDown:X=>X.key==="Enter"&&Ca(),placeholder:z.toString(),className:"w-16 h-8 text-center",min:1,max:Tt}),e.jsx(C,{variant:"outline",size:"sm",onClick:Ca,disabled:!P,className:"h-8",children:"跳转"})]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>V(X=>X+1),disabled:z>=Tt,children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Sa,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(C,{variant:"outline",size:"sm",onClick:()=>V(Tt),disabled:z>=Tt,className:"hidden sm:flex",children:e.jsx(Br,{className:"h-4 w-4"})})]})]})]}),e.jsx(Ks,{open:N,onOpenChange:gs,children:e.jsxs(Ps,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto","data-tour":"provider-dialog",preventOutsideClose:q.isRunning,children:[e.jsxs(Hs,{children:[e.jsx(Gs,{children:y!==null?"编辑提供商":"添加提供商"}),e.jsx(ot,{children:"配置 API 提供商的连接信息和参数"})]}),e.jsxs("form",{onSubmit:X=>{X.preventDefault(),Ee()},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(tl,{open:I,onOpenChange:M,children:[e.jsx(al,{asChild:!0,children:e.jsxs(C,{variant:"outline",role:"combobox","aria-expanded":I,className:"w-full justify-between",children:[D?Li.find(X=>X.id===D)?.display_name:"选择提供商模板...",e.jsx(Um,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(Ka,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:e.jsxs(Go,{children:[e.jsx(Fo,{placeholder:"搜索提供商模板..."}),e.jsx(es,{className:"h-[300px]",children:e.jsxs(qo,{className:"max-h-none overflow-visible",children:[e.jsx(Vo,{children:"未找到匹配的模板"}),e.jsx(qi,{children:Li.map(X=>e.jsxs(Vi,{value:X.display_name,onSelect:()=>Cs(X.id),children:[e.jsx(St,{className:`mr-2 h-4 w-4 ${D===X.id?"opacity-100":"opacity-0"}`}),X.display_name]},X.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:Y.name?"text-destructive":"",children:"名称 *"}),e.jsx(ie,{id:"name",value:b?.name||"",onChange:X=>{w(ye=>ye?{...ye,name:X.target.value}:null),Y.name&&be(ye=>({...ye,name:void 0}))},placeholder:"例如: DeepSeek, SiliconFlow",className:Y.name?"border-destructive focus-visible:ring-destructive":""}),Y.name&&e.jsx("p",{className:"text-xs text-destructive",children:Y.name})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-url-input",children:[e.jsx(E,{htmlFor:"base_url",className:Y.base_url?"text-destructive":"",children:"基础 URL *"}),e.jsx(ie,{id:"base_url",value:b?.base_url||"",onChange:X=>{w(ye=>ye?{...ye,base_url:X.target.value}:null),Y.base_url&&be(ye=>({...ye,base_url:void 0}))},placeholder:"https://api.example.com/v1",disabled:ns,className:`${ns?"bg-muted cursor-not-allowed":""} ${Y.base_url?"border-destructive focus-visible:ring-destructive":""}`}),Y.base_url&&e.jsx("p",{className:"text-xs text-destructive",children:Y.base_url}),ns&&!Y.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:Y.api_key?"text-destructive":"",children:"API Key *"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ie,{id:"api_key",type:Q?"text":"password",value:b?.api_key||"",onChange:X=>{w(ye=>ye?{...ye,api_key:X.target.value}:null),Y.api_key&&be(ye=>({...ye,api_key:void 0}))},placeholder:"sk-...",className:`flex-1 ${Y.api_key?"border-destructive focus-visible:ring-destructive":""}`}),e.jsx(C,{type:"button",variant:"outline",size:"icon",onClick:()=>G(!Q),title:Q?"隐藏密钥":"显示密钥",children:Q?e.jsx(Hi,{className:"h-4 w-4"}):e.jsx(sa,{className:"h-4 w-4"})}),e.jsx(C,{type:"button",variant:"outline",size:"icon",onClick:Rs,title:"复制密钥",children:e.jsx(ko,{className:"h-4 w-4"})})]}),Y.api_key&&e.jsx("p",{className:"text-xs text-destructive",children:Y.api_key})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"client_type",children:"客户端类型"}),e.jsxs(Be,{value:b?.client_type||"openai",onValueChange:X=>w(ye=>ye?{...ye,client_type:X}:null),disabled:ns,children:[e.jsx(Le,{id:"client_type",className:ns?"bg-muted cursor-not-allowed":"",children:e.jsx($e,{placeholder:"选择客户端类型"})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"openai",children:"OpenAI"}),e.jsx(ae,{value:"gemini",children:"Gemini"})]})]}),ns&&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(ie,{id:"max_retry",type:"number",min:"0",value:b?.max_retry??"",onChange:X=>{const ye=X.target.value===""?null:parseInt(X.target.value);w(Ce=>Ce?{...Ce,max_retry:ye}:null)},placeholder:"默认: 2"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"timeout",children:"超时(秒)"}),e.jsx(ie,{id:"timeout",type:"number",min:"1",value:b?.timeout??"",onChange:X=>{const ye=X.target.value===""?null:parseInt(X.target.value);w(Ce=>Ce?{...Ce,timeout:ye}:null)},placeholder:"默认: 30"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"retry_interval",children:"重试间隔(秒)"}),e.jsx(ie,{id:"retry_interval",type:"number",min:"1",value:b?.retry_interval??"",onChange:X=>{const ye=X.target.value===""?null:parseInt(X.target.value);w(Ce=>Ce?{...Ce,retry_interval:ye}:null)},placeholder:"默认: 10"})]})]})]}),e.jsxs(xt,{children:[e.jsx(C,{type:"button",variant:"outline",onClick:()=>v(!1),"data-tour":"provider-cancel-button",children:"取消"}),e.jsx(C,{type:"submit","data-tour":"provider-save-button",children:"保存"})]})]})]})}),e.jsx(ps,{open:S,onOpenChange:T,children:e.jsxs(os,{children:[e.jsxs(ds,{children:[e.jsx(ms,{children:"确认删除"}),e.jsxs(xs,{children:['确定要删除提供商 "',$!==null?l[$]?.name:"",'" 吗? 此操作无法撤销。']})]}),e.jsxs(us,{children:[e.jsx(fs,{children:"取消"}),e.jsx(hs,{onClick:Ze,children:"删除"})]})]})}),e.jsx(ps,{open:fe,onOpenChange:ge,children:e.jsxs(os,{children:[e.jsxs(ds,{children:[e.jsx(ms,{children:"确认批量删除"}),e.jsxs(xs,{children:["确定要删除选中的 ",ve.size," 个提供商吗? 此操作无法撤销。"]})]}),e.jsxs(us,{children:[e.jsx(fs,{children:"取消"}),e.jsx(hs,{onClick:ut,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),e.jsx(ps,{open:je.isOpen,onOpenChange:X=>Se(ye=>({...ye,isOpen:X})),children:e.jsxs(os,{className:"max-w-2xl",children:[e.jsxs(ds,{children:[e.jsx(ms,{children:"确认删除提供商"}),e.jsx(xs,{asChild:!0,children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:["您即将删除以下提供商:",e.jsx("strong",{className:"text-foreground ml-1",children:je.providersToDelete.join(", ")})]}),e.jsxs("p",{className:"text-yellow-600 dark:text-yellow-500 font-medium",children:["⚠️ 此操作将同时删除 ",je.affectedModels.length," 个关联的模型:"]}),e.jsx(es,{className:"h-32 w-full rounded border p-3",children:e.jsx("div",{className:"space-y-1",children:je.affectedModels.map((X,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:X.name}),e.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(",X.model_identifier,")"]})]},ye))})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"这些模型将从模型列表和所有任务分配中移除。此操作无法撤销。"})]})})]}),e.jsxs(us,{children:[e.jsx(fs,{onClick:F,children:"取消"}),e.jsx(hs,{onClick:st,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})}),e.jsx(Hn,{})]})}function nv(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).substring(2,11)}`}function rv(l){return typeof l=="boolean"?"boolean":typeof l=="number"?"number":"string"}function z_(l,n){switch(n){case"boolean":return l==="true";case"number":{const i=parseFloat(l);return isNaN(i)?0:i}default:return l}}function og(l){return Object.entries(l).map(([n,i])=>({id:nv(),key:n,value:i,type:rv(i)}))}function jm(l){const n={};for(const i of l)i.key.trim()&&(n[i.key.trim()]=i.value);return n}function vm(l){if(!l.trim())return{valid:!0,parsed:{}};try{const n=JSON.parse(l);if(typeof n!="object"||n===null||Array.isArray(n))return{valid:!1,error:"必须是一个 JSON 对象 {}"};for(const[i,c]of Object.entries(n))if(c!==null&&!["string","number","boolean"].includes(typeof c))return{valid:!1,error:`键 "${i}" 的值类型不支持(仅支持 string/number/boolean)`};return{valid:!0,parsed:n}}catch{return{valid:!1,error:"JSON 格式错误"}}}function D_(l){switch(l){case"boolean":return"布尔";case"number":return"数字";default:return"字符串"}}function O_(l){switch(l){case"boolean":return"bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-400";case"number":return"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400";default:return"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400"}}function R_({value:l,onChange:n,className:i,placeholder:c="添加额外参数..."}){const[u,x]=m.useState("list"),h=m.useMemo(()=>og(l||{}),[l]),f=m.useMemo(()=>Object.keys(l||{}).length>0?JSON.stringify(l,null,2):"",[l]),[p,g]=m.useState(h),[N,v]=m.useState(f),[b,w]=m.useState(null);m.useEffect(()=>{g(h),v(f)},[h,f]);const y=m.useMemo(()=>{const S=vm(N);return S.valid&&S.parsed?{success:!0,data:S.parsed}:{success:!1,data:{}}},[N]),R=m.useCallback(S=>{const T=S;if(T==="json"&&u==="list"){const $=jm(p);v(Object.keys($).length>0?JSON.stringify($,null,2):""),w(null)}else if(T==="list"&&u==="json"){const $=vm(N);$.valid&&$.parsed&&(g(og($.parsed)),w(null))}x(T)},[u,p,N]),D=m.useCallback(()=>{const S={id:nv(),key:"",value:"",type:"string"},T=[...p,S];g(T)},[p]),k=m.useCallback(S=>{const T=p.filter($=>$.id!==S);g(T),n(jm(T))},[p,n]),I=m.useCallback((S,T,$)=>{const A=p.map(Q=>{if(Q.id!==S)return Q;if(T==="type"){const G=$;let de;return G==="boolean"?de=Q.value==="true"||Q.value===!0:G==="number"?de=typeof Q.value=="number"?Q.value:parseFloat(String(Q.value))||0:de=String(Q.value),{...Q,type:G,value:de}}else return T==="value"?{...Q,value:z_($,Q.type)}:{...Q,[T]:$}});g(A),n(jm(A))},[p,n]),M=m.useCallback(S=>{v(S);const T=vm(S);T.valid&&T.parsed?(w(null),n(T.parsed)):w(T.error||"JSON 格式错误")},[n]);return e.jsxs("div",{className:B("space-y-3",i),children:[e.jsx(E,{className:"text-sm font-medium",children:"额外参数"}),e.jsxs(ma,{value:u,onValueChange:R,className:"w-full",children:[e.jsxs(ta,{className:"h-8 p-0.5 bg-muted/60",children:[e.jsx(as,{value:"list",className:"h-7 px-3 text-xs data-[state=active]:bg-background data-[state=active]:shadow-sm",children:"键值对"}),e.jsx(as,{value:"json",className:"h-7 px-3 text-xs data-[state=active]:bg-background data-[state=active]:shadow-sm",children:"JSON"})]}),e.jsxs(ys,{value:"list",className:"mt-3 space-y-2",children:[p.length===0?e.jsx("div",{className:"text-sm text-muted-foreground text-center py-4 border border-dashed rounded-md",children:c}):e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"grid grid-cols-[1fr_1fr_90px_32px] gap-2 text-xs text-muted-foreground px-1",children:[e.jsx("span",{children:"键名"}),e.jsx("span",{children:"值"}),e.jsx("span",{children:"类型"}),e.jsx("span",{})]}),p.map(S=>e.jsxs("div",{className:"grid grid-cols-[1fr_1fr_90px_32px] gap-2 items-center",children:[e.jsx(ie,{value:S.key,onChange:T=>I(S.id,"key",T.target.value),placeholder:"key",className:"h-8 text-sm"}),S.type==="boolean"?e.jsxs("div",{className:"flex items-center h-8 px-3 border rounded-md bg-background",children:[e.jsx(Ge,{checked:S.value===!0,onCheckedChange:T=>I(S.id,"value",String(T))}),e.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:S.value?"true":"false"})]}):e.jsx(ie,{type:S.type==="number"?"number":"text",value:S.value,onChange:T=>I(S.id,"value",T.target.value),placeholder:"value",className:"h-8 text-sm",step:S.type==="number"?"any":void 0}),e.jsxs(Be,{value:S.type,onValueChange:T=>I(S.id,"type",T),children:[e.jsx(Le,{className:"h-8 text-xs",children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"string",children:"字符串"}),e.jsx(ae,{value:"number",children:"数字"}),e.jsx(ae,{value:"boolean",children:"布尔"})]})]}),e.jsx(C,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",onClick:()=>k(S.id),children:e.jsx(ls,{className:"h-4 w-4"})})]},S.id))]}),e.jsxs(C,{type:"button",variant:"outline",size:"sm",className:"w-full h-8",onClick:D,children:[e.jsx(it,{className:"h-4 w-4 mr-1"}),"添加参数"]})]}),e.jsx(ys,{value:"json",className:"mt-3",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"编辑"}),b?e.jsxs("div",{className:"flex items-center gap-1 text-xs text-destructive",children:[e.jsx(Ct,{className:"h-3 w-3"}),e.jsx("span",{className:"truncate max-w-[150px]",children:b})]}):N.trim()&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600 dark:text-green-400",children:[e.jsx(St,{className:"h-3 w-3"}),e.jsx("span",{children:"有效"})]})]}),e.jsx(et,{value:N,onChange:S=>M(S.target.value),placeholder:`{ - "key": "value" -}`,className:B("font-mono text-sm min-h-[140px] h-[140px] resize-y flex-1",b&&"border-destructive focus-visible:ring-destructive")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"支持 string、number、boolean 类型"})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"预览"}),e.jsx("div",{className:"min-h-[140px] h-[140px] flex-1 rounded-md border bg-muted/30 p-3 overflow-auto",children:y.success&&Object.keys(y.data).length>0?e.jsx("div",{className:"space-y-2",children:Object.entries(y.data).map(([S,T])=>{const $=rv(T);return e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("code",{className:"px-1.5 py-0.5 bg-background rounded text-xs font-medium",children:S}),e.jsx("span",{className:"text-muted-foreground",children:"="}),e.jsx("span",{className:B("font-mono",$==="boolean"&&(T?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"),$==="number"&&"text-blue-600 dark:text-blue-400",$==="string"&&"text-amber-600 dark:text-amber-400"),children:$==="string"?`"${T}"`:String(T)}),e.jsx(Ae,{variant:"secondary",className:B("h-5 text-[10px] px-1.5",O_($)),children:D_($)})]},S)})}):y.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:"实时预览解析结果"})]})]})})]})]})}const Ir="https://maibot-plugin-stats.maibot-webui.workers.dev";async function L_(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(`${Ir}/pack?${n.toString()}`);if(!i.ok)throw new Error(`获取 Pack 列表失败: ${i.status}`);return i.json()}async function U_(l){const n=await fetch(`${Ir}/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 B_(l){const i=await(await fetch(`${Ir}/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 $_(l,n){await fetch(`${Ir}/pack/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pack_id:l,user_id:n})})}async function iv(l,n){const c=await(await fetch(`${Ir}/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 cv(l,n){return(await(await fetch(`${Ir}/pack/like/check?pack_id=${l}&user_id=${n}`)).json()).liked||!1}async function I_(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: ${Nm(f.base_url)}`);const p=x.filter(g=>{const N=Nm(g.base_url),v=Nm(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 P_(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},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 we("/api/webui/config/model",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(h)})).ok)throw new Error("保存配置失败")}async function H_(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 Nm(l){try{const n=new URL(l);return`${n.protocol}//${n.host}${n.pathname}`.replace(/\/$/,"").toLowerCase()}catch{return l.toLowerCase().replace(/\/$/,"")}}function ov(){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 G_={utils:"通用工具",utils_small:"轻量工具",tool_use:"工具调用",replyer:"回复生成",planner:"规划推理",vlm:"视觉模型",voice:"语音处理",embedding:"向量嵌入",lpmm_entity_extract:"实体提取",lpmm_rdf_build:"RDF构建",lpmm_qa:"问答模型"},F_=["官方推荐","性价比","高性能","免费模型","国内可用","海外模型","OpenAI","Claude","Gemini","国产模型","多模态","轻量级"];function q_({trigger:l}){const[n,i]=m.useState(!1),[c,u]=m.useState(1),[x,h]=m.useState(!1),[f,p]=m.useState(!1),[g,N]=m.useState([]),[v,b]=m.useState([]),[w,y]=m.useState({}),[R,D]=m.useState(new Set),[k,I]=m.useState(new Set),[M,S]=m.useState(new Set),[T,$]=m.useState(""),[A,Q]=m.useState(""),[G,de]=m.useState(""),[oe,ve]=m.useState([]);m.useEffect(()=>{n&&c===1&&le()},[n,c]);const le=async()=>{h(!0);try{const Y=await H_({name:"",description:"",author:""});N(Y.providers),b(Y.models),y(Y.task_config),D(new Set(Y.providers.map(be=>be.name))),I(new Set(Y.models.map(be=>be.name))),S(new Set(Object.keys(Y.task_config)))}catch(Y){console.error("加载配置失败:",Y),Gt({title:"加载当前配置失败",variant:"destructive"})}finally{h(!1)}},fe=Y=>{const be=new Set(R),Z=new Set(k),xe=new Set(M);be.has(Y)?(be.delete(Y),v.filter(J=>J.api_provider===Y).forEach(J=>Z.delete(J.name)),Object.entries(w).forEach(([J,ce])=>{ce.model_list&&(ce.model_list.some(q=>Z.has(q))||xe.delete(J))})):(be.add(Y),v.filter(J=>J.api_provider===Y).forEach(J=>Z.add(J.name)),Object.entries(w).forEach(([J,ce])=>{ce.model_list&&ce.model_list.some(q=>{const ee=v.find(ke=>ke.name===q);return ee&&ee.api_provider===Y})&&xe.add(J)})),D(be),I(Z),S(xe)},ge=Y=>{const be=new Set(k),Z=new Set(M);be.has(Y)?(be.delete(Y),Object.entries(w).forEach(([xe,Me])=>{Me.model_list&&(Me.model_list.some(ce=>be.has(ce))||Z.delete(xe))})):(be.add(Y),Object.entries(w).forEach(([xe,Me])=>{Me.model_list&&Me.model_list.includes(Y)&&Z.add(xe)})),I(be),S(Z)},z=Y=>{const be=new Set(M);be.has(Y)?be.delete(Y):be.add(Y),S(be)},V=Y=>{oe.includes(Y)?ve(oe.filter(be=>be!==Y)):oe.length<5?ve([...oe,Y]):Gt({title:"最多选择 5 个标签",variant:"destructive"})},U=()=>{R.size===g.length?D(new Set):D(new Set(g.map(Y=>Y.name)))},L=()=>{k.size===v.length?I(new Set):I(new Set(v.map(Y=>Y.name)))},P=()=>{const Y=Object.keys(w);M.size===Y.length?S(new Set):S(new Set(Y))},_e=async()=>{if(!T.trim()){Gt({title:"请输入模板名称",variant:"destructive"});return}if(!A.trim()){Gt({title:"请输入模板描述",variant:"destructive"});return}if(!G.trim()){Gt({title:"请输入作者名称",variant:"destructive"});return}if(R.size===0&&k.size===0&&M.size===0){Gt({title:"请至少选择一项配置",variant:"destructive"});return}p(!0);try{const Y=g.filter(xe=>R.has(xe.name)),be=v.filter(xe=>k.has(xe.name)),Z={};for(const[xe,Me]of Object.entries(w))M.has(xe)&&(Z[xe]=Me);await B_({name:T.trim(),description:A.trim(),author:G.trim(),tags:oe,providers:Y,models:be,task_config:Z}),Gt({title:"模板已提交审核,审核通过后将显示在市场中"}),i(!1),je()}catch(Y){console.error("提交失败:",Y),Gt({title:Y instanceof Error?Y.message:"提交失败",variant:"destructive"})}finally{p(!1)}},je=()=>{u(1),$(""),Q(""),de(""),ve([]),D(new Set),I(new Set),S(new Set)},Se=2;return e.jsxs(Ks,{open:n,onOpenChange:i,children:[e.jsx(Ho,{asChild:!0,children:l||e.jsxs(C,{variant:"outline",children:[e.jsx(Nj,{className:"w-4 h-4 mr-2"}),"分享配置"]})}),e.jsxs(Ps,{className:"max-w-2xl max-h-[85vh] flex flex-col",children:[e.jsxs(Hs,{children:[e.jsxs(Gs,{className:"flex items-center gap-2",children:[e.jsx(Wt,{className:"w-5 h-5"}),"分享配置模板"]}),e.jsxs(ot,{children:["步骤 ",c," / ",Se,":",c===1&&"选择要分享的配置",c===2&&"填写模板信息"]})]}),e.jsx(es,{className:"h-[calc(85vh-220px)] pr-4",children:x?e.jsxs("div",{className:"py-8 text-center",children:[e.jsx(zs,{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(nt,{children:[e.jsx(qt,{className:"h-4 w-4"}),e.jsx(An,{children:"安全提示"}),e.jsxs(rt,{children:["分享的配置将",e.jsx("strong",{children:"不包含"})," API Key,其他用户需要自行配置。"]})]}),e.jsxs(ma,{defaultValue:"providers",className:"w-full",children:[e.jsxs(ta,{className:"grid w-full grid-cols-3",children:[e.jsxs(as,{value:"providers",children:[e.jsx(Tl,{className:"w-4 h-4 mr-2"}),"API 提供商",e.jsxs(Ae,{variant:"secondary",className:"ml-2",children:[R.size,"/",g.length]})]}),e.jsxs(as,{value:"models",children:[e.jsx(Rn,{className:"w-4 h-4 mr-2"}),"模型配置",e.jsxs(Ae,{variant:"secondary",className:"ml-2",children:[k.size,"/",v.length]})]}),e.jsxs(as,{value:"tasks",children:[e.jsx(Ln,{className:"w-4 h-4 mr-2"}),"任务配置",e.jsxs(Ae,{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(C,{variant:"ghost",size:"sm",onClick:U,children:R.size===g.length?"取消全选":"全选"})}),g.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-2",children:"暂无提供商配置"}):g.map(Y=>e.jsxs("div",{className:"flex items-center space-x-2 p-2 rounded hover:bg-muted",children:[e.jsx(Xs,{id:`provider-${Y.name}`,checked:R.has(Y.name),onCheckedChange:()=>fe(Y.name)}),e.jsxs(E,{htmlFor:`provider-${Y.name}`,className:"flex-1 cursor-pointer",children:[e.jsx("span",{className:"font-medium",children:Y.name}),e.jsx("span",{className:"text-xs text-muted-foreground ml-2",children:Y.base_url})]}),e.jsx(Ae,{variant:"outline",className:"text-xs",children:Y.client_type})]},Y.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(C,{variant:"ghost",size:"sm",onClick:L,children:k.size===v.length?"取消全选":"全选"})}),v.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-2",children:"暂无模型配置"}):v.map(Y=>e.jsxs("div",{className:"flex items-center space-x-2 p-2 rounded hover:bg-muted",children:[e.jsx(Xs,{id:`model-${Y.name}`,checked:k.has(Y.name),onCheckedChange:()=>ge(Y.name)}),e.jsxs(E,{htmlFor:`model-${Y.name}`,className:"flex-1 cursor-pointer",children:[e.jsx("span",{className:"font-medium",children:Y.name}),e.jsx("span",{className:"text-xs text-muted-foreground ml-2",children:Y.model_identifier})]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:Y.api_provider})]},Y.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(C,{variant:"ghost",size:"sm",onClick:P,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(([Y,be])=>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(Xs,{id:`task-${Y}`,checked:M.has(Y),onCheckedChange:()=>z(Y)}),e.jsx(E,{htmlFor:`task-${Y}`,className:"flex-1 cursor-pointer",children:e.jsx("span",{className:"font-medium",children:G_[Y]||Y})}),e.jsxs(Ae,{variant:"outline",className:"text-xs",children:[be.model_list.length," 个模型"]})]}),be.model_list&&be.model_list.length>0&&e.jsx("div",{className:"ml-6 flex flex-wrap gap-1",children:be.model_list.map(Z=>{const xe=v.find(J=>J.name===Z),Me=k.has(Z);return e.jsxs(Ae,{variant:Me?"default":"outline",className:"text-xs cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>ge(Z),children:[Z,xe&&e.jsxs("span",{className:"ml-1 opacity-70",children:["(",xe.api_provider,")"]})]},Z)})})]},Y))]})})]})]}),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(Tl,{className:"w-4 h-4"}),R.size," 个提供商"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Rn,{className:"w-4 h-4"}),k.size," 个模型"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Ln,{className:"w-4 h-4"}),M.size," 个任务"]})]}),e.jsx($r,{}),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(ie,{id:"pack-name",placeholder:"例如:高性价比国产模型配置",value:T,onChange:Y=>$(Y.target.value),maxLength:50}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[T.length,"/50"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"pack-description",children:"模板描述 *"}),e.jsx(et,{id:"pack-description",placeholder:"详细描述这个配置模板的特点、适用场景等...",value:A,onChange:Y=>Q(Y.target.value),rows:4,maxLength:500}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[A.length,"/500"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"pack-author",children:"作者名称 *"}),e.jsx(ie,{id:"pack-author",placeholder:"你的昵称或 ID",value:G,onChange:Y=>de(Y.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:F_.map(Y=>e.jsxs(Ae,{variant:oe.includes(Y)?"default":"outline",className:"cursor-pointer transition-colors",onClick:()=>V(Y),children:[oe.includes(Y)&&e.jsx(St,{className:"w-3 h-3 mr-1"}),e.jsx($o,{className:"w-3 h-3 mr-1"}),Y]},Y))})]})]}),e.jsxs(nt,{children:[e.jsx(qt,{className:"h-4 w-4"}),e.jsx(An,{children:"审核说明"}),e.jsx(rt,{children:"提交后需要经过审核才能在市场中展示。审核通常在 1-3 个工作日内完成。"})]})]})]})}),e.jsxs(xt,{className:"flex justify-between pt-4 border-t",children:[e.jsx("div",{children:c>1&&e.jsx(C,{variant:"outline",onClick:()=>u(c-1),disabled:f,children:"上一步"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(C,{variant:"outline",onClick:()=>{i(!1),je()},disabled:f,children:"取消"}),cu(c+1),disabled:x||R.size===0&&k.size===0&&M.size===0,children:"下一步"}):e.jsxs(C,{onClick:_e,disabled:f,children:[f&&e.jsx(zs,{className:"w-4 h-4 mr-2 animate-spin"}),"提交审核"]})]})]})]})]})}function V_({value:l,label:n,onRemove:i}){const{attributes:c,listeners:u,setNodeRef:x,transform:h,transition:f,isDragging:p}=Uj({id:l}),g={transform:Bj.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:B("inline-flex items-center gap-1",p&&"shadow-lg"),children:e.jsxs(Ae,{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(gj,{className:"h-3 w-3 text-muted-foreground"})}),e.jsx("span",{children:n}),e.jsx("button",{type:"button",className:"ml-1 rounded-sm hover:bg-destructive/20 focus:outline-none focus:ring-1 focus:ring-destructive",onClick:N,onPointerDown:v,onMouseDown:b=>b.stopPropagation(),children:e.jsx(_a,{className:"h-3 w-3 cursor-pointer hover:text-destructive",strokeWidth:2,fill:"none"})})]})})}function K_({options:l,selected:n,onChange:i,placeholder:c="选择选项...",emptyText:u="未找到选项",className:x}){const[h,f]=m.useState(!1),p=Ej(Eo(zj,{activationConstraint:{distance:8}}),Eo(Aj,{coordinateGetter:Mj})),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),D=n.indexOf(y.id);i(Dj(n,R,D))}};return e.jsxs(tl,{open:h,onOpenChange:f,children:[e.jsx(al,{asChild:!0,children:e.jsxs(C,{variant:"outline",role:"combobox","aria-expanded":h,className:B("w-full justify-between min-h-10 h-auto",x),children:[e.jsx(Oj,{sensors:p,collisionDetection:Rj,onDragEnd:v,children:e.jsx(Lj,{items:n,strategy:m1,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(V_,{value:b,label:w?.label||b,onRemove:N},b)})})})}),e.jsx(Um,{className:"ml-2 h-4 w-4 shrink-0 opacity-50",strokeWidth:2,fill:"none"})]})}),e.jsx(Ka,{className:"w-full p-0",align:"start",children:e.jsxs(Go,{children:[e.jsx(Fo,{placeholder:"搜索...",className:"h-9"}),e.jsxs(qo,{children:[e.jsx(Vo,{children:u}),e.jsx(qi,{children:l.map(b=>{const w=n.includes(b.value);return e.jsxs(Vi,{value:b.value,onSelect:()=>g(b.value),children:[e.jsx("div",{className:B("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(St,{className:"h-3 w-3",strokeWidth:2,fill:"none"})}),e.jsx("span",{children:b.label})]},b.value)})})]})]})})]})}const Fa=Es.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(K_,{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(ie,{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(wa,{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(ie,{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(ie,{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:"模型响应时间超过此阈值将输出警告日志"})]})]})]})}),Q_=Es.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(Ae,{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(C,{variant:"default",size:"sm",onClick:()=>c(f,g),children:[e.jsx(On,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(C,{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)})})}),Y_=Es.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(El,{children:[e.jsx(Ml,{children:e.jsxs(ct,{children:[e.jsx(Je,{className:"w-12",children:e.jsx(Xs,{checked:u.size===c.length&&c.length>0,onCheckedChange:p})}),e.jsx(Je,{className:"w-24",children:"使用状态"}),e.jsx(Je,{children:"模型名称"}),e.jsx(Je,{children:"模型标识符"}),e.jsx(Je,{children:"提供商"}),e.jsx(Je,{className:"text-center",children:"温度"}),e.jsx(Je,{className:"text-right",children:"输入价格"}),e.jsx(Je,{className:"text-right",children:"输出价格"}),e.jsx(Je,{className:"text-right",children:"操作"})]})}),e.jsx(Al,{children:n.length===0?e.jsx(ct,{children:e.jsx(He,{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(ct,{children:[e.jsx(He,{children:e.jsx(Xs,{checked:u.has(w),onCheckedChange:()=>f(w)})}),e.jsx(He,{children:e.jsx(Ae,{variant:y?"default":"secondary",className:y?"bg-green-600 hover:bg-green-700":"",children:y?"已使用":"未使用"})}),e.jsx(He,{className:"font-medium",children:v.name}),e.jsx(He,{className:"max-w-xs truncate",title:v.model_identifier,children:v.model_identifier}),e.jsx(He,{children:v.api_provider}),e.jsx(He,{className:"text-center",children:v.temperature!=null?v.temperature:e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsxs(He,{className:"text-right",children:["¥",v.price_in,"/M"]}),e.jsxs(He,{className:"text-right",children:["¥",v.price_out,"/M"]}),e.jsx(He,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(C,{variant:"default",size:"sm",onClick:()=>x(v,w),children:[e.jsx(On,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(C,{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"}),"删除"]})]})})]},b)})})]})})})}),J_=300*1e3,dg=new Map,X_=[10,20,50,100],Z_=Es.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(E,{htmlFor:"page-size-model",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Be,{value:i.toString(),onValueChange:v,children:[e.jsx(Le,{id:"page-size-model",className:"w-20",children:e.jsx($e,{})}),e.jsx(Ue,{children:X_.map(w=>e.jsx(ae,{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(C,{variant:"outline",size:"sm",onClick:()=>x(1),disabled:n===1,className:"hidden sm:flex",children:e.jsx(Ur,{className:"h-4 w-4"})}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>x(Math.max(1,n-1)),disabled:n===1,children:[e.jsx(ll,{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(ie,{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(C,{variant:"outline",size:"sm",onClick:p,disabled:!u,className:"h-8",children:"跳转"})]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>x(n+1),disabled:n>=N,children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Sa,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(C,{variant:"outline",size:"sm",onClick:()=>x(N),disabled:n>=N,className:"hidden sm:flex",children:e.jsx(Br,{className:"h-4 w-4"})})]})]})});function W_(l){const{models:n,taskConfig:i,debounceMs:c=2e3,onSavingChange:u,onUnsavedChange:x}=l,h=m.useRef(null),f=m.useRef(null),p=m.useRef(!0),g=m.useCallback(()=>{h.current&&(clearTimeout(h.current),h.current=null),f.current&&(clearTimeout(f.current),f.current=null)},[]),N=m.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=m.useCallback(async w=>{try{u?.(!0);const y=w.map(N);await Am("models",y),x?.(!1)}catch(y){console.error("自动保存模型列表失败:",y),x?.(!0)}finally{u?.(!1)}},[u,x,N]),b=m.useCallback(async w=>{try{u?.(!0),await Am("model_task_config",w),x?.(!1)}catch(y){console.error("自动保存任务配置失败:",y),x?.(!0)}finally{u?.(!1)}},[u,x]);return m.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]),m.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]),m.useEffect(()=>()=>{g()},[g]),{clearTimers:g,initialLoadRef:p}}function eS(l={}){const{onCloseEditDialog:n}=l,i=aa(),{registerTour:c,startTour:u,state:x,goToStep:h}=Pm(),f=m.useRef(x.stepIndex);return m.useEffect(()=>{c(el,av)},[c]),m.useEffect(()=>{if(x.activeTourId===el&&x.isRunning){const g=lv[x.stepIndex];g&&!window.location.pathname.endsWith(g.replace("/config/",""))&&i({to:g})}},[x.stepIndex,x.activeTourId,x.isRunning,i]),m.useEffect(()=>{if(x.activeTourId===el&&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]),m.useEffect(()=>{if(x.activeTourId!==el||!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:m.useCallback(()=>{u(el)},[u]),isRunning:x.isRunning&&x.activeTourId===el,stepIndex:x.stepIndex}}function sS(l){const{getProviderConfig:n}=l,[i,c]=m.useState([]),[u,x]=m.useState(!1),[h,f]=m.useState(null),[p,g]=m.useState(null),N=m.useCallback(()=>{c([]),f(null),g(null)},[]),v=m.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=T_(y.base_url);if(g(R),!R?.modelFetcher){c([]),f(null);return}const D=`${b}:${y.base_url}`,k=dg.get(D);if(!w&&k&&Date.now()-k.timestampM(!1)}),{clearTimers:Qt,initialLoadRef:ka}=W_({models:l,taskConfig:p,onSavingChange:R,onUnsavedChange:k}),yt=m.useCallback((W,re)=>{if(!W)return;const ss=new Set(re.map(pt=>pt.name)),Qs=[],vs=[],Ds=[{key:"utils",label:"工具模型"},{key:"utils_small",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关系构建"},{key:"lpmm_qa",label:"LPMM问答"}];for(const{key:pt,label:fa}of Ds){const Dl=W[pt];if(!Dl)continue;if(!Dl.model_list||Dl.model_list.length===0){vs.push(fa);continue}const sc=Dl.model_list.filter(Wo=>!ss.has(Wo));sc.length>0&&Qs.push({taskName:fa,invalidModels:sc})}Fe(Qs),ee(vs)},[]),st=m.useCallback(async()=>{try{v(!0);const W=await ln(),re=W.models||[];n(re),f(re.map(Ds=>Ds.name));const ss=W.api_providers||[];c(ss.map(Ds=>Ds.name)),x(ss);const Qs=W.model_task_config||null;g(Qs),yt(Qs,re);const vs=Qs?.embedding?.model_list||[];Me.current=[...vs],k(!1),ka.current=!1}catch(W){console.error("加载配置失败:",W)}finally{v(!1)}},[ka,yt]);m.useEffect(()=>{st()},[st]);const F=m.useCallback(W=>u.find(re=>re.name===W),[u]),{availableModels:qe,fetchingModels:Ie,modelFetchError:Ve,matchedTemplate:Cs,fetchModelsForProvider:ns,clearModels:Rs}=sS({getProviderConfig:F});m.useEffect(()=>{I&&S?.api_provider&&ns(S.api_provider)},[I,S?.api_provider,ns]);const Ee=async()=>{await me()},gs=m.useCallback(()=>{if(!p)return;const W=new Set(l.map(Qs=>Qs.name)),re={...p},ss=Object.keys(re);for(const Qs of ss){const vs=re[Qs];vs&&vs.model_list&&(vs.model_list=vs.model_list.filter(Ds=>W.has(Ds)))}g(re),Fe([]),Oe({title:"清理完成",description:"已删除所有无效的模型引用"})},[p,l,Oe]),ts=W=>{const re={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&&(re.temperature=W.temperature),W.max_tokens!=null&&(re.max_tokens=W.max_tokens),re},Ze=async()=>{try{w(!0),Qt();const W=await ln();W.models=l.map(ts),W.model_task_config=p,await Ii(W),k(!1),Oe({title:"保存成功",description:"正在重启麦麦..."}),await Ee()}catch(W){console.error("保存配置失败:",W),Oe({title:"保存失败",description:W.message,variant:"destructive"}),w(!1)}},js=async()=>{try{w(!0),Qt();const W=await ln();W.models=l.map(ts),W.model_task_config=p,await Ii(W),k(!1),Oe({title:"保存成功",description:"模型配置已保存"}),await st()}catch(W){console.error("保存配置失败:",W),Oe({title:"保存失败",description:W.message,variant:"destructive"})}finally{w(!1)}},dt=(W,re)=>{Te({}),T(W||{model_identifier:"",name:"",api_provider:i[0]||"",price_in:0,price_out:0,temperature:null,max_tokens:null,force_stream_mode:!1,extra_params:{}}),A(re),M(!0)},Ot=()=>{if(!S)return;const W={};if(S.name?.trim()||(W.name="请输入模型名称"),S.api_provider?.trim()||(W.api_provider="请选择 API 提供商"),S.model_identifier?.trim()||(W.model_identifier="请输入模型标识符"),Object.keys(W).length>0){Te(W);return}Te({});const re={model_identifier:S.model_identifier,name:S.name,api_provider:S.api_provider,price_in:S.price_in??0,price_out:S.price_out??0,force_stream_mode:S.force_stream_mode??!1,extra_params:S.extra_params??{}};S.temperature!=null&&(re.temperature=S.temperature),S.max_tokens!=null&&(re.max_tokens=S.max_tokens);let ss,Qs=null;if($!==null?(Qs=l[$].name,ss=[...l],ss[$]=re):ss=[...l,re],n(ss),f(ss.map(vs=>vs.name)),Qs&&Qs!==re.name&&p){const vs=Ds=>Ds.map(pt=>pt===Qs?re.name:pt);g({...p,utils:{...p.utils,model_list:vs(p.utils?.model_list||[])},utils_small:{...p.utils_small,model_list:vs(p.utils_small?.model_list||[])},tool_use:{...p.tool_use,model_list:vs(p.tool_use?.model_list||[])},replyer:{...p.replyer,model_list:vs(p.replyer?.model_list||[])},planner:{...p.planner,model_list:vs(p.planner?.model_list||[])},vlm:{...p.vlm,model_list:vs(p.vlm?.model_list||[])},voice:{...p.voice,model_list:vs(p.voice?.model_list||[])},embedding:{...p.embedding,model_list:vs(p.embedding?.model_list||[])},lpmm_entity_extract:{...p.lpmm_entity_extract,model_list:vs(p.lpmm_entity_extract?.model_list||[])},lpmm_rdf_build:{...p.lpmm_rdf_build,model_list:vs(p.lpmm_rdf_build?.model_list||[])},lpmm_qa:{...p.lpmm_qa,model_list:vs(p.lpmm_qa?.model_list||[])}})}M(!1),T(null),A(null),Oe({title:$!==null?"模型已更新":"模型已添加",description:'配置将在 2 秒后自动保存,或点击右上角"保存配置"按钮立即保存'})},ut=W=>{if(!W&&S){const re={...S,price_in:S.price_in??0,price_out:S.price_out??0};T(re)}M(W)},_s=W=>{oe(W),G(!0)},Tt=()=>{if(de!==null){const W=l.filter((re,ss)=>ss!==de);n(W),f(W.map(re=>re.name)),yt(p,W),Oe({title:"删除成功",description:'配置将在 2 秒后自动保存,或点击右上角"保存配置"按钮立即保存'})}G(!1),oe(null)},Bt=W=>{const re=new Set(fe);re.has(W)?re.delete(W):re.add(W),ge(re)},Ca=()=>{if(fe.size===Ce.length)ge(new Set);else{const W=Ce.map((re,ss)=>l.findIndex(Qs=>Qs===Ce[ss]));ge(new Set(W))}},Ya=()=>{if(fe.size===0){Oe({title:"提示",description:"请先选择要删除的模型",variant:"default"});return}V(!0)},nl=()=>{const W=fe.size,re=l.filter((ss,Qs)=>!fe.has(Qs));n(re),f(re.map(ss=>ss.name)),yt(p,re),ge(new Set),V(!1),Oe({title:"批量删除成功",description:`已删除 ${W} 个模型,配置将在 2 秒后自动保存`})},Yt=(W,re,ss)=>{if(!p)return;if(W==="embedding"&&re==="model_list"&&Array.isArray(ss)){const vs=Me.current,Ds=ss;if((vs.length!==Ds.length||vs.some(fa=>!Ds.includes(fa))||Ds.some(fa=>!vs.includes(fa)))&&vs.length>0){J.current={field:re,value:ss},xe(!0);return}}const Qs={...p,[W]:{...p[W],[re]:ss}};g(Qs),yt(Qs,l),W==="embedding"&&re==="model_list"&&Array.isArray(ss)&&(Me.current=[...ss])},X=()=>{if(!p||!J.current)return;const{field:W,value:re}=J.current,ss={...p,embedding:{...p.embedding,[W]:re}};g(ss),yt(ss,l),W==="model_list"&&Array.isArray(re)&&(Me.current=[...re]),J.current=null,xe(!1),Oe({title:"嵌入模型已更新",description:"建议重新生成知识库向量以确保最佳匹配精度"})},ye=()=>{J.current=null,xe(!1)},Ce=l.filter(W=>{if(!ve)return!0;const re=ve.toLowerCase();return W.name.toLowerCase().includes(re)||W.model_identifier.toLowerCase().includes(re)||W.api_provider.toLowerCase().includes(re)}),Ls=Math.ceil(Ce.length/P),ha=Ce.slice((U-1)*P,U*P),Jt=()=>{const W=parseInt(je);W>=1&&W<=Ls&&(L(W),Se(""))},tt=W=>p?[p.utils?.model_list||[],p.utils_small?.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||[],p.lpmm_qa?.model_list||[]].some(ss=>ss.includes(W)):!1;return N?e.jsx(es,{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(es,{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(q_,{trigger:e.jsxs(C,{variant:"outline",size:"sm",className:"flex-1 sm:flex-none",children:[e.jsx(Nj,{className:"mr-2 h-4 w-4"}),"分享配置"]})}),e.jsxs(C,{onClick:js,disabled:b||y||!D||ze,size:"sm",variant:"outline",className:"flex-1 sm:flex-none sm:min-w-[120px]",children:[e.jsx(Xi,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),b?"保存中...":y?"自动保存中...":D?"保存配置":"已保存"]}),e.jsxs(ps,{children:[e.jsx(bt,{asChild:!0,children:e.jsxs(C,{disabled:b||y||ze,size:"sm",className:"flex-1 sm:flex-none sm:min-w-[120px]",children:[e.jsx(Ji,{className:"mr-2 h-4 w-4"}),ze?"重启中...":D?"保存并重启":"重启麦麦"]})}),e.jsxs(os,{children:[e.jsxs(ds,{children:[e.jsx(ms,{children:"确认重启麦麦?"}),e.jsx(xs,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:D?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})})})]}),e.jsxs(us,{children:[e.jsx(fs,{children:"取消"}),e.jsx(hs,{onClick:D?Ze:Ee,children:D?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsxs(nt,{children:[e.jsx(qt,{className:"h-4 w-4"}),e.jsxs(rt,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),ce.length>0&&e.jsxs(nt,{variant:"destructive",children:[e.jsx(Ft,{className:"h-4 w-4"}),e.jsxs(rt,{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:ce.map(({taskName:W,invalidModels:re})=>e.jsxs("div",{className:"text-sm",children:[e.jsx("strong",{children:W})," 引用了不存在的模型: ",re.join(", ")]},W))})]}),e.jsx(C,{variant:"outline",size:"sm",className:"shrink-0 bg-background hover:bg-accent",onClick:gs,children:"一键清理"})]})]}),q.length>0&&e.jsxs(nt,{variant:"default",className:"border-yellow-500/50 bg-yellow-500/10",children:[e.jsx(Ft,{className:"h-4 w-4 text-yellow-600"}),e.jsxs(rt,{children:[e.jsx("strong",{className:"text-yellow-600",children:"以下任务未配置模型"}),e.jsxs("div",{className:"mt-2 text-sm",children:[q.join("、")," 还未分配模型,这些功能将无法正常工作。"]})]})]}),e.jsxs(nt,{className:"hidden lg:flex border-primary/30 bg-primary/5 cursor-pointer hover:bg-primary/10 transition-colors",onClick:rs,children:[e.jsx(Bw,{className:"h-4 w-4 text-primary"}),e.jsxs(rt,{className:"flex items-center justify-between",children:[e.jsxs("span",{children:[e.jsx("strong",{className:"text-primary",children:"新手引导:"}),"不知道如何配置模型?点击这里开始学习如何为麦麦的组件分配模型。"]}),e.jsx(C,{variant:"outline",size:"sm",className:"ml-4 shrink-0",children:"开始引导"})]})]}),e.jsxs(ma,{defaultValue:"models",className:"w-full",children:[e.jsxs(ta,{className:"grid w-full max-w-full sm:max-w-md grid-cols-2",children:[e.jsx(as,{value:"models",children:"添加模型"}),e.jsx(as,{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:[fe.size>0&&e.jsxs(C,{onClick:Ya,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"}),"批量删除 (",fe.size,")"]}),e.jsxs(C,{onClick:()=>dt(null,null),size:"sm",variant:"outline",className:"w-full sm:w-auto","data-tour":"add-model-button",children:[e.jsx(it,{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(Vt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ie,{placeholder:"搜索模型名称、标识符或提供商...",value:ve,onChange:W=>le(W.target.value),className:"pl-9"})]}),ve&&e.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",Ce.length," 个结果"]})]}),e.jsx(Q_,{paginatedModels:ha,allModels:l,onEdit:dt,onDelete:_s,isModelUsed:tt,searchQuery:ve}),e.jsx(Y_,{paginatedModels:ha,allModels:l,filteredModels:Ce,selectedModels:fe,onEdit:dt,onDelete:_s,onToggleSelection:Bt,onToggleSelectAll:Ca,isModelUsed:tt,searchQuery:ve}),e.jsx(Z_,{page:U,pageSize:P,totalItems:Ce.length,jumpToPage:je,onPageChange:L,onPageSizeChange:_e,onJumpToPageChange:Se,onJumpToPage:Jt,onSelectionClear:()=>ge(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(Fa,{title:"组件模型 (utils)",description:"用于表情包、取名、关系、情绪变化等组件",taskConfig:p.utils,modelNames:h,onChange:(W,re)=>Yt("utils",W,re),dataTour:"task-model-select"}),e.jsx(Fa,{title:"组件小模型 (utils_small)",description:"消耗量较大的组件,建议使用速度较快的小模型",taskConfig:p.utils_small,modelNames:h,onChange:(W,re)=>Yt("utils_small",W,re)}),e.jsx(Fa,{title:"工具调用模型 (tool_use)",description:"需要使用支持工具调用的模型",taskConfig:p.tool_use,modelNames:h,onChange:(W,re)=>Yt("tool_use",W,re)}),e.jsx(Fa,{title:"首要回复模型 (replyer)",description:"用于表达器和表达方式学习",taskConfig:p.replyer,modelNames:h,onChange:(W,re)=>Yt("replyer",W,re)}),e.jsx(Fa,{title:"决策模型 (planner)",description:"负责决定麦麦该什么时候回复",taskConfig:p.planner,modelNames:h,onChange:(W,re)=>Yt("planner",W,re)}),e.jsx(Fa,{title:"图像识别模型 (vlm)",description:"视觉语言模型",taskConfig:p.vlm,modelNames:h,onChange:(W,re)=>Yt("vlm",W,re),hideTemperature:!0}),e.jsx(Fa,{title:"语音识别模型 (voice)",description:"语音转文字",taskConfig:p.voice,modelNames:h,onChange:(W,re)=>Yt("voice",W,re),hideTemperature:!0,hideMaxTokens:!0}),e.jsx(Fa,{title:"嵌入模型 (embedding)",description:"用于向量化",taskConfig:p.embedding,modelNames:h,onChange:(W,re)=>Yt("embedding",W,re),hideTemperature:!0,hideMaxTokens:!0}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库模型"}),e.jsx(Fa,{title:"实体提取模型 (lpmm_entity_extract)",description:"从文本中提取实体",taskConfig:p.lpmm_entity_extract,modelNames:h,onChange:(W,re)=>Yt("lpmm_entity_extract",W,re)}),e.jsx(Fa,{title:"RDF 构建模型 (lpmm_rdf_build)",description:"构建知识图谱",taskConfig:p.lpmm_rdf_build,modelNames:h,onChange:(W,re)=>Yt("lpmm_rdf_build",W,re)}),e.jsx(Fa,{title:"问答模型 (lpmm_qa)",description:"知识库问答",taskConfig:p.lpmm_qa,modelNames:h,onChange:(W,re)=>Yt("lpmm_qa",W,re)})]})]})]})]}),e.jsx(Ks,{open:I,onOpenChange:ut,children:e.jsxs(Ps,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto","data-tour":"model-dialog",preventOutsideClose:Kt,children:[e.jsxs(Hs,{children:[e.jsx(Gs,{children:$!==null?"编辑模型":"添加模型"}),e.jsx(ot,{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:ke.name?"text-destructive":"",children:"模型名称 *"}),e.jsx(ie,{id:"model_name",value:S?.name||"",onChange:W=>{T(re=>re?{...re,name:W.target.value}:null),ke.name&&Te(re=>({...re,name:void 0}))},placeholder:"例如: qwen3-30b",className:ke.name?"border-destructive focus-visible:ring-destructive":""}),ke.name?e.jsx("p",{className:"text-xs text-destructive",children:ke.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:ke.api_provider?"text-destructive":"",children:"API 提供商 *"}),e.jsxs(Be,{value:S?.api_provider||"",onValueChange:W=>{T(re=>re?{...re,api_provider:W}:null),Rs(),ke.api_provider&&Te(re=>({...re,api_provider:void 0}))},children:[e.jsx(Le,{id:"api_provider",className:ke.api_provider?"border-destructive focus-visible:ring-destructive":"",children:e.jsx($e,{placeholder:"选择提供商"})}),e.jsx(Ue,{children:i.map(W=>e.jsx(ae,{value:W,children:W},W))})]}),ke.api_provider&&e.jsx("p",{className:"text-xs text-destructive",children:ke.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:ke.model_identifier?"text-destructive":"",children:"模型标识符 *"}),Cs?.modelFetcher&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ae,{variant:"secondary",className:"text-xs",children:Cs.display_name}),e.jsx(C,{variant:"ghost",size:"sm",className:"h-6 px-2",onClick:()=>S?.api_provider&&ns(S.api_provider,!0),disabled:Ie,children:Ie?e.jsx(zs,{className:"h-3 w-3 animate-spin"}):e.jsx(kt,{className:"h-3 w-3"})})]})]}),Cs?.modelFetcher?e.jsxs(tl,{open:Y,onOpenChange:be,children:[e.jsx(al,{asChild:!0,children:e.jsxs(C,{variant:"outline",role:"combobox","aria-expanded":Y,className:"w-full justify-between font-normal",disabled:Ie||!!Ve,children:[Ie?e.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(zs,{className:"h-4 w-4 animate-spin"}),"正在获取模型列表..."]}):Ve?e.jsx("span",{className:"text-muted-foreground text-sm",children:"点击下方输入框手动填写"}):S?.model_identifier?e.jsx("span",{className:"truncate",children:S.model_identifier}):e.jsx("span",{className:"text-muted-foreground",children:"搜索或选择模型..."}),e.jsx(Um,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(Ka,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:e.jsxs(Go,{children:[e.jsx(Fo,{placeholder:"搜索模型..."}),e.jsx(es,{className:"h-[300px]",children:e.jsxs(qo,{className:"max-h-none overflow-visible",children:[e.jsx(Vo,{children:Ve?e.jsxs("div",{className:"py-4 px-2 text-center space-y-2",children:[e.jsx("p",{className:"text-sm text-destructive",children:Ve}),!Ve.includes("API Key")&&e.jsx(C,{variant:"link",size:"sm",onClick:()=>S?.api_provider&&ns(S.api_provider,!0),children:"重试"})]}):"未找到匹配的模型"}),e.jsx(qi,{heading:"可用模型",children:qe.map(W=>e.jsxs(Vi,{value:W.id,onSelect:()=>{T(re=>re?{...re,model_identifier:W.id}:null),be(!1)},children:[e.jsx(St,{className:`mr-2 h-4 w-4 ${S?.model_identifier===W.id?"opacity-100":"opacity-0"}`}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{children:W.id}),W.name!==W.id&&e.jsx("span",{className:"text-xs text-muted-foreground",children:W.name})]})]},W.id))}),e.jsx(qi,{heading:"手动输入",children:e.jsxs(Vi,{value:"__manual_input__",onSelect:()=>{be(!1)},children:[e.jsx(On,{className:"mr-2 h-4 w-4"}),"手动输入模型标识符..."]})})]})})]})})]}):e.jsx(ie,{id:"model_identifier",value:S?.model_identifier||"",onChange:W=>{T(re=>re?{...re,model_identifier:W.target.value}:null),ke.model_identifier&&Te(re=>({...re,model_identifier:void 0}))},placeholder:"Qwen/Qwen3-30B-A3B-Instruct-2507",className:ke.model_identifier?"border-destructive focus-visible:ring-destructive":""}),ke.model_identifier&&e.jsx("p",{className:"text-xs text-destructive",children:ke.model_identifier}),Ve&&Cs?.modelFetcher&&!ke.model_identifier&&e.jsxs(nt,{variant:"destructive",className:"mt-2 py-2",children:[e.jsx(qt,{className:"h-4 w-4"}),e.jsx(rt,{className:"text-xs",children:Ve})]}),Cs?.modelFetcher&&e.jsx(ie,{value:S?.model_identifier||"",onChange:W=>{T(re=>re?{...re,model_identifier:W.target.value}:null),ke.model_identifier&&Te(re=>({...re,model_identifier:void 0}))},placeholder:"或手动输入模型标识符",className:`mt-2 ${ke.model_identifier?"border-destructive focus-visible:ring-destructive":""}`}),!ke.model_identifier&&e.jsx("p",{className:"text-xs text-muted-foreground",children:Ve?'请手动输入模型标识符,或前往"模型提供商配置"检查 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(ie,{id:"price_in",type:"number",step:"0.1",min:"0",value:S?.price_in??"",onChange:W=>{const re=W.target.value===""?null:parseFloat(W.target.value);T(ss=>ss?{...ss,price_in:re}:null)},placeholder:"默认: 0"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(E,{htmlFor:"price_out",children:"输出价格 (¥/M token)"}),e.jsx(ie,{id:"price_out",type:"number",step:"0.1",min:"0",value:S?.price_out??"",onChange:W=>{const re=W.target.value===""?null:parseFloat(W.target.value);T(ss=>ss?{...ss,price_out:re}: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(Ge,{id:"enable_model_temperature",checked:S?.temperature!=null,onCheckedChange:W=>{T(W?re=>re?{...re,temperature:.5}:null:re=>re?{...re,temperature:null}:null)}})]}),S?.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:S.temperature.toFixed(1)})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"0"}),e.jsx(wa,{value:[S.temperature],onValueChange:W=>T(re=>re?{...re,temperature:W[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(Ge,{id:"enable_model_max_tokens",checked:S?.max_tokens!=null,onCheckedChange:W=>{T(W?re=>re?{...re,max_tokens:2048}:null:re=>re?{...re,max_tokens:null}:null)}})]}),S?.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(ie,{type:"number",min:"1",max:"128000",value:S.max_tokens,onChange:W=>{const re=parseInt(W.target.value);!isNaN(re)&&re>=1&&T(ss=>ss?{...ss,max_tokens:re}: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:S?.force_stream_mode||!1,onCheckedChange:W=>T(re=>re?{...re,force_stream_mode:W}:null)}),e.jsx(E,{htmlFor:"force_stream_mode",className:"cursor-pointer",children:"强制流式输出模式"})]}),e.jsx(R_,{value:S?.extra_params||{},onChange:W=>T(re=>re?{...re,extra_params:W}:null),placeholder:"添加额外参数(如 enable_thinking、top_p 等)..."})]}),e.jsxs(xt,{children:[e.jsx(C,{variant:"outline",onClick:()=>M(!1),"data-tour":"model-cancel-button",children:"取消"}),e.jsx(C,{onClick:Ot,"data-tour":"model-save-button",children:"保存"})]})]})}),e.jsx(ps,{open:Q,onOpenChange:G,children:e.jsxs(os,{children:[e.jsxs(ds,{children:[e.jsx(ms,{children:"确认删除"}),e.jsxs(xs,{children:['确定要删除模型 "',de!==null?l[de]?.name:"",'" 吗? 此操作无法撤销。']})]}),e.jsxs(us,{children:[e.jsx(fs,{children:"取消"}),e.jsx(hs,{onClick:Tt,children:"删除"})]})]})}),e.jsx(ps,{open:z,onOpenChange:V,children:e.jsxs(os,{children:[e.jsxs(ds,{children:[e.jsx(ms,{children:"确认批量删除"}),e.jsxs(xs,{children:["确定要删除选中的 ",fe.size," 个模型吗? 此操作无法撤销。"]})]}),e.jsxs(us,{children:[e.jsx(fs,{children:"取消"}),e.jsx(hs,{onClick:nl,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),e.jsx(ps,{open:Z,onOpenChange:xe,children:e.jsxs(os,{children:[e.jsxs(ds,{children:[e.jsxs(ms,{className:"flex items-center gap-2",children:[e.jsx(Ft,{className:"h-5 w-5 text-amber-500"}),"更换嵌入模型警告"]}),e.jsx(xs,{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(us,{children:[e.jsx(fs,{onClick:ye,children:"取消"}),e.jsx(hs,{onClick:X,className:"bg-amber-600 hover:bg-amber-700",children:"确认更换"})]})]})}),e.jsx(Hn,{})]})})}const Ki=Bg,Qi=E0,Yi=M0,Ko="/api/webui/config";async function lS(){const n=await(await we(`${Ko}/adapter-config/path`)).json();return!n.success||!n.path?null:{path:n.path,lastModified:n.lastModified}}async function ug(l){const i=await(await we(`${Ko}/adapter-config/path`,{method:"POST",headers:Us(),body:JSON.stringify({path:l})})).json();if(!i.success)throw new Error(i.message||"保存路径失败")}async function mg(l){const i=await(await we(`${Ko}/adapter-config?path=${encodeURIComponent(l)}`)).json();if(!i.success)throw new Error("读取配置文件失败");return i.content}async function xg(l,n){const c=await(await we(`${Ko}/adapter-config`,{method:"POST",headers:Us(),body:JSON.stringify({path:l,content:n})})).json();if(!c.success)throw new Error(c.message||"保存配置失败")}const vt={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"}},bm={oneclick:{name:"一键包",description:"使用一键包部署的适配器配置",path:"../MaiBot-Napcat-Adapter/config.toml",icon:Wt},docker:{name:"Docker",description:"Docker Compose 部署的适配器配置",path:"/MaiMBot/adapters-config/config.toml",icon:$w}};function nS(l,n){let i=l.slice(0,n).split(/\r\n|\n|\r/g);return[i.length,i.pop().length+1]}function rS(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 ws extends Error{line;column;codeblock;constructor(n,i){const[c,u]=nS(i.toml,i.ptr),x=rS(i.toml,c,u);super(`Invalid TOML document: ${n} - -${x}`,i),this.line=c,this.column=u,this.codeblock=x}}function iS(l,n){let i=0;for(;l[n-++i]==="\\";);return--i&&i%2}function zo(l,n=0,i=l.length){let c=l.indexOf(` -`,n);return l[c-1]==="\r"&&c--,c<=i?c:-1}function Hm(l,n){for(let i=n;i-1&&i!=="'"&&iS(l,n));return n>-1&&(n+=c.length,c.length>1&&(l[n]===i&&n++,l[n]===i&&n++)),n}let cS=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}:\d{2}(?:\.\d+)?)?(Z|[-+]\d{2}:\d{2})?$/i;class Ar 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(cS);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 Ar(n);return c.#e=i,c}static wrapAsLocalDateTime(n){let i=new Ar(n);return i.#e=null,i}static wrapAsLocalDate(n){let i=new Ar(n);return i.#t=!1,i.#e=null,i}static wrapAsLocalTime(n){let i=new Ar(n);return i.#s=!1,i.#e=null,i}}let oS=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,dS=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,uS=/^[+-]?0[0-9_]/,mS=/^[0-9a-f]{4,8}$/i,fg={b:"\b",t:" ",n:` -`,f:"\f",r:"\r",'"':'"',"\\":"\\"};function uv(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&&(Hm(l,x),u=u.slice(0,x));let h=u.trimEnd();if(!c){let f=u.indexOf(` -`,h.length);if(f>-1)throw new ws("newlines are not allowed in inline tables",{toml:l,ptr:n+f})}return[h,x]}function Gm(l,n,i,c,u){if(c===0)throw new ws("document contains excessively nested structures. aborting.",{toml:l,ptr:n});let x=l[n];if(x==="["||x==="{"){let[p,g]=x==="["?gS(l,n,c,u):pS(l,n,c,u),N=i?hg(l,g,",",i):g;if(g-N&&i==="}"){let v=zo(l,g,N);if(v>-1)throw new ws("newlines are not allowed in inline tables",{toml:l,ptr:v})}return[p,N]}let h;if(x==='"'||x==="'"){h=dv(l,n);let p=uv(l,n,h);if(i){if(h=Cl(l,h,i!=="]"),l[h]&&l[h]!==","&&l[h]!==i&&l[h]!==` -`&&l[h]!=="\r")throw new ws("unexpected character encountered",{toml:l,ptr:h});h+=+(l[h]===",")}return[p,h]}h=hg(l,n,",",i);let f=hS(l,n,h-+(l[h-1]===","),i==="]");if(!f[0])throw new ws("incomplete key-value declaration: no value specified",{toml:l,ptr:n});return i&&f[1]>-1&&(h=Cl(l,n+f[1]),h+=+(l[h]===",")),[xS(f[0],l,n,u),h]}let fS=/^[a-zA-Z0-9-_]+[ \t]*$/;function zm(l,n,i="="){let c=n-1,u=[],x=l.indexOf(i,n);if(x<0)throw new ws("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 ws("multiline strings are not allowed in keys",{toml:l,ptr:n});let f=dv(l,n);if(f<0)throw new ws("unfinished string encountered",{toml:l,ptr:n});c=l.indexOf(".",f);let p=l.slice(f,c<0||c>x?x:c),g=zo(p);if(g>-1)throw new ws("newlines are not allowed in keys",{toml:l,ptr:n+c+g});if(p.trimStart())throw new ws("found extra tokens after the string part",{toml:l,ptr:f});if(xx?x:c);if(!fS.test(f))throw new ws("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,vt.inner.version)},nickname:{nickname:n(l.nickname.nickname,vt.nickname.nickname)},napcat_server:{host:n(l.napcat_server.host,vt.napcat_server.host),port:n(l.napcat_server.port||0,vt.napcat_server.port),token:n(l.napcat_server.token,vt.napcat_server.token),heartbeat_interval:n(l.napcat_server.heartbeat_interval||0,vt.napcat_server.heartbeat_interval)},maibot_server:{host:n(l.maibot_server.host,vt.maibot_server.host),port:n(l.maibot_server.port||0,vt.maibot_server.port)},chat:{group_list_type:n(l.chat.group_list_type,vt.chat.group_list_type),group_list:l.chat.group_list||[],private_list_type:n(l.chat.private_list_type,vt.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??vt.chat.ban_qq_bot,enable_poke:l.chat.enable_poke??vt.chat.enable_poke},voice:{use_tts:l.voice.use_tts??vt.voice.use_tts},debug:{level:n(l.debug.level,vt.debug.level)}};let c=yS(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 _S(){const[l,n]=m.useState("upload"),[i,c]=m.useState(null),[u,x]=m.useState(""),[h,f]=m.useState(""),[p,g]=m.useState("oneclick"),[N,v]=m.useState(""),[b,w]=m.useState(!1),[y,R]=m.useState(!1),[D,k]=m.useState(!1),[I,M]=m.useState(!1),[S,T]=m.useState(null),[$,A]=m.useState(!1),Q=m.useRef(null),{toast:G}=Ws(),de=m.useRef(null),oe=Z=>{if(f(Z),Z.trim()){const xe=_m(Z);v(xe.error)}else v("")},ve=m.useCallback(async Z=>{const xe=bm[Z];R(!0);try{const Me=await mg(xe.path),J=ym(Me);c(J),g(Z),f(xe.path),await ug(xe.path),G({title:"加载成功",description:`已从${xe.name}预设加载配置`})}catch(Me){console.error("加载预设配置失败:",Me),G({title:"加载失败",description:Me instanceof Error?Me.message:"无法读取预设配置文件",variant:"destructive"})}finally{R(!1)}},[G]),le=m.useCallback(async Z=>{const xe=_m(Z);if(!xe.valid){v(xe.error),G({title:"路径无效",description:xe.error,variant:"destructive"});return}v(""),R(!0);try{const Me=await mg(Z),J=ym(Me);c(J),f(Z),await ug(Z),G({title:"加载成功",description:"已从配置文件加载"})}catch(Me){console.error("加载配置失败:",Me),G({title:"加载失败",description:Me instanceof Error?Me.message:"无法读取配置文件",variant:"destructive"})}finally{R(!1)}},[G]);m.useEffect(()=>{(async()=>{try{const xe=await lS();if(xe&&xe.path){f(xe.path);const Me=Object.entries(bm).find(([,J])=>J.path===xe.path);Me?(n("preset"),g(Me[0]),await ve(Me[0])):(n("path"),await le(xe.path))}}catch(xe){console.error("加载保存的路径失败:",xe)}})()},[le,ve]);const fe=m.useCallback(Z=>{l!=="path"&&l!=="preset"||!h||(de.current&&clearTimeout(de.current),de.current=setTimeout(async()=>{w(!0);try{const xe=wm(Z);await xg(h,xe),G({title:"自动保存成功",description:"配置已保存到文件"})}catch(xe){console.error("自动保存失败:",xe),G({title:"自动保存失败",description:xe instanceof Error?xe.message:"保存配置失败",variant:"destructive"})}finally{w(!1)}},1e3))},[l,h,G]),ge=async()=>{if(!i||!h)return;const Z=_m(h);if(!Z.valid){G({title:"保存失败",description:Z.error,variant:"destructive"});return}w(!0);try{const xe=wm(i);await xg(h,xe),G({title:"保存成功",description:"配置已保存到文件"})}catch(xe){console.error("保存失败:",xe),G({title:"保存失败",description:xe instanceof Error?xe.message:"保存配置失败",variant:"destructive"})}finally{w(!1)}},z=async()=>{h&&await le(h)},V=Z=>{if(Z!==l){if(i){T(Z),k(!0);return}U(Z)}},U=Z=>{c(null),x(""),v(""),n(Z),Z==="preset"&&ve("oneclick"),G({title:"已切换模式",description:{upload:"现在可以上传配置文件",path:"现在可以指定配置文件路径",preset:"现在可以使用预设配置"}[Z]})},L=()=>{S&&(U(S),T(null)),k(!1)},P=()=>{if(i){M(!0);return}_e()},_e=()=>{f(""),c(null),v(""),G({title:"已清空",description:"路径和配置已清空"})},je=()=>{_e(),M(!1)},Se=Z=>{const xe=Z.target.files?.[0];if(!xe)return;const Me=new FileReader;Me.onload=J=>{try{const ce=J.target?.result,Fe=ym(ce);c(Fe),x(xe.name),G({title:"上传成功",description:`已加载配置文件:${xe.name}`})}catch(ce){console.error("解析配置文件失败:",ce),G({title:"解析失败",description:"配置文件格式错误,请检查文件内容",variant:"destructive"})}},Me.readAsText(xe)},Y=()=>{if(!i)return;const Z=wm(i),xe=new Blob([Z],{type:"text/plain;charset=utf-8"}),Me=URL.createObjectURL(xe),J=document.createElement("a");J.href=Me,J.download=u||"config.toml",document.body.appendChild(J),J.click(),document.body.removeChild(J),URL.revokeObjectURL(Me),G({title:"下载成功",description:"配置文件已下载,请手动覆盖并重启适配器"})},be=()=>{c(JSON.parse(JSON.stringify(vt))),x("config.toml"),G({title:"已加载默认配置",description:"可以开始编辑配置"})};return e.jsx(es,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦适配器配置"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的 QQ 适配器的配置文件"})]})}),e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg border border-amber-500/50 bg-amber-500/10 text-amber-700 dark:text-amber-400",children:[e.jsx(Ct,{className:"h-4 w-4 mt-0.5 flex-shrink-0"}),e.jsx("p",{className:"text-sm",children:"适配器配置保存之后使用 WebUI 的重启功能适配器并不会重启,需要手动重启适配器。"})]}),e.jsx(Ki,{open:$,onOpenChange:A,children:e.jsxs(De,{children:[e.jsx(Xe,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(We,{children:"工作模式"}),e.jsx(Is,{children:"选择配置文件的管理方式"})]}),e.jsx(Qi,{asChild:!0,children:e.jsxs(C,{variant:"ghost",size:"sm",className:"w-9 p-0",children:[e.jsx($a,{className:`h-4 w-4 transition-transform duration-200 ${$?"transform rotate-180":""}`}),e.jsx("span",{className:"sr-only",children:"切换"})]})})]})}),e.jsx(Yi,{children:e.jsxs(Qe,{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(Wt,{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(Gi,{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(Iw,{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(bm).map(([Z,xe])=>{const Me=xe.icon,J=p===Z;return e.jsx("div",{className:`border-2 rounded-lg p-3 cursor-pointer transition-all ${J?"border-primary bg-primary/5":"border-muted hover:border-primary/50"}`,onClick:()=>{g(Z),ve(Z)},children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Me,{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:xe.name}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:xe.description}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 font-mono break-all",children:xe.path})]})]})},Z)})})]}),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(ie,{id:"config-path",value:h,onChange:Z=>oe(Z.target.value),placeholder:"例: C:\\Adapter\\config.toml",className:`text-sm ${N?"border-destructive":""}`}),N&&e.jsx("p",{className:"text-xs text-destructive",children:N})]}),e.jsx(C,{onClick:()=>le(h),disabled:y||!h||!!N,className:"w-full sm:w-auto",children:y?e.jsxs(e.Fragment,{children:[e.jsx(kt,{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(nt,{children:[e.jsx(qt,{className:"h-4 w-4"}),e.jsx(rt,{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:Q,type:"file",accept:".toml",className:"hidden",onChange:Se}),e.jsxs(C,{onClick:()=>Q.current?.click(),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(Gi,{className:"mr-2 h-4 w-4"}),"上传配置"]}),e.jsxs(C,{onClick:be,size:"sm",className:"w-full sm:w-auto",children:[e.jsx(qa,{className:"mr-2 h-4 w-4"}),"使用默认配置"]})]}),l==="upload"&&i&&e.jsx("div",{className:"flex gap-2",children:e.jsxs(C,{onClick:Y,size:"sm",className:"w-full sm:w-auto",children:[e.jsx(Xt,{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(C,{onClick:ge,size:"sm",disabled:b||!!N,className:"w-full sm:w-auto",children:[e.jsx(Xi,{className:"mr-2 h-4 w-4"}),b?"保存中...":"立即保存"]}),e.jsxs(C,{onClick:z,size:"sm",variant:"outline",disabled:y,className:"w-full sm:w-auto",children:[e.jsx(kt,{className:`mr-2 h-4 w-4 ${y?"animate-spin":""}`}),"刷新"]}),l==="path"&&e.jsxs(C,{onClick:P,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(ls,{className:"mr-2 h-4 w-4"}),"清空路径"]})]}),i?e.jsxs(ma,{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(ta,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5",children:[e.jsxs(as,{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(as,{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(as,{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(as,{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(as,{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(SS,{config:i,onChange:Z=>{c(Z),fe(Z)}})}),e.jsx(ys,{value:"maibot",className:"space-y-4",children:e.jsx(kS,{config:i,onChange:Z=>{c(Z),fe(Z)}})}),e.jsx(ys,{value:"chat",className:"space-y-4",children:e.jsx(CS,{config:i,onChange:Z=>{c(Z),fe(Z)}})}),e.jsx(ys,{value:"voice",className:"space-y-4",children:e.jsx(TS,{config:i,onChange:Z=>{c(Z),fe(Z)}})}),e.jsx(ys,{value:"debug",className:"space-y-4",children:e.jsx(ES,{config:i,onChange:Z=>{c(Z),fe(Z)}})})]}):e.jsx("div",{className:"rounded-lg border bg-card p-6 md:p-12",children:e.jsxs("div",{className:"text-center space-y-3 md:space-y-4",children:[e.jsx(qa,{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(ps,{open:D,onOpenChange:k,children:e.jsxs(os,{children:[e.jsxs(ds,{children:[e.jsx(ms,{children:"确认切换模式"}),e.jsxs(xs,{children:["切换模式将清空当前配置,确定要继续吗?",e.jsx("br",{}),e.jsx("span",{className:"text-destructive font-medium",children:"请确保已保存重要配置"})]})]}),e.jsxs(us,{children:[e.jsx(fs,{onClick:()=>{k(!1),T(null)},children:"取消"}),e.jsx(hs,{onClick:L,children:"确认切换"})]})]})}),e.jsx(ps,{open:I,onOpenChange:M,children:e.jsxs(os,{children:[e.jsxs(ds,{children:[e.jsx(ms,{children:"确认清空路径"}),e.jsxs(xs,{children:["清空路径将清除当前配置,确定要继续吗?",e.jsx("br",{}),e.jsx("span",{className:"text-muted-foreground text-sm",children:"此操作不会删除配置文件,只是清除界面中的配置"})]})]}),e.jsxs(us,{children:[e.jsx(fs,{onClick:()=>M(!1),children:"取消"}),e.jsx(hs,{onClick:je,className:"bg-destructive hover:bg-destructive/90",children:"确认清空"})]})]})})]})})}function SS({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(ie,{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(ie,{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(ie,{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(ie,{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 kS({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(ie,{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(ie,{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 CS({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(Be,{value:l.chat.group_list_type,onValueChange:x=>n({...l,chat:{...l.chat,group_list_type:x}}),children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),e.jsx(ae,{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(C,{onClick:()=>i("group"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(qa,{className:"mr-1 h-4 w-4"}),"添加群号"]})]}),l.chat.group_list.map((x,h)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ie,{type:"number",value:x,onChange:f=>u("group",h,parseInt(f.target.value)||0),placeholder:"输入群号",className:"text-sm md:text-base"}),e.jsxs(ps,{children:[e.jsx(bt,{asChild:!0,children:e.jsx(C,{size:"icon",variant:"outline",children:e.jsx(ls,{className:"h-4 w-4"})})}),e.jsxs(os,{children:[e.jsxs(ds,{children:[e.jsx(ms,{children:"确认删除"}),e.jsxs(xs,{children:["确定要删除群号 ",x," 吗?此操作无法撤销。"]})]}),e.jsxs(us,{children:[e.jsx(fs,{children:"取消"}),e.jsx(hs,{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(Be,{value:l.chat.private_list_type,onValueChange:x=>n({...l,chat:{...l.chat,private_list_type:x}}),children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),e.jsx(ae,{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(C,{onClick:()=>i("private"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(qa,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),l.chat.private_list.map((x,h)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ie,{type:"number",value:x,onChange:f=>u("private",h,parseInt(f.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),e.jsxs(ps,{children:[e.jsx(bt,{asChild:!0,children:e.jsx(C,{size:"icon",variant:"outline",children:e.jsx(ls,{className:"h-4 w-4"})})}),e.jsxs(os,{children:[e.jsxs(ds,{children:[e.jsx(ms,{children:"确认删除"}),e.jsxs(xs,{children:["确定要删除用户 ",x," 吗?此操作无法撤销。"]})]}),e.jsxs(us,{children:[e.jsx(fs,{children:"取消"}),e.jsx(hs,{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(C,{onClick:()=>i("ban"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(qa,{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(ie,{type:"number",value:x,onChange:f=>u("ban",h,parseInt(f.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),e.jsxs(ps,{children:[e.jsx(bt,{asChild:!0,children:e.jsx(C,{size:"icon",variant:"outline",children:e.jsx(ls,{className:"h-4 w-4"})})}),e.jsxs(os,{children:[e.jsxs(ds,{children:[e.jsx(ms,{children:"确认删除"}),e.jsxs(xs,{children:["确定要从全局禁止名单中删除用户 ",x," 吗?此操作无法撤销。"]})]}),e.jsxs(us,{children:[e.jsx(fs,{children:"取消"}),e.jsx(hs,{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(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(E,{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 TS({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(Ge,{checked:l.voice.use_tts,onCheckedChange:i=>n({...l,voice:{use_tts:i}})})]})]})})}function ES({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(Be,{value:l.debug.level,onValueChange:i=>n({...l,debug:{level:i}}),children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"DEBUG",children:"DEBUG(调试)"}),e.jsx(ae,{value:"INFO",children:"INFO(信息)"}),e.jsx(ae,{value:"WARNING",children:"WARNING(警告)"}),e.jsx(ae,{value:"ERROR",children:"ERROR(错误)"}),e.jsx(ae,{value:"CRITICAL",children:"CRITICAL(严重)"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"设置适配器的日志输出等级"})]})})]})})}const MS=["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"],AS=/^(aria-|data-)/,hv=l=>Object.fromEntries(Object.entries(l).filter(([n])=>AS.test(n)||MS.includes(n)));function zS(l,n){const i=hv(l);return Object.keys(l).some(c=>!Object.hasOwn(i,c)&&l[c]!==n[c])}class DS extends m.Component{container;plugin;componentDidMount(){this.installPlugin()}componentDidUpdate(n){if(n.uppy!==this.props.uppy)this.uninstallPlugin(n),this.installPlugin();else if(zS(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(f1,i),this.plugin=n.getPlugin(i.id)}uninstallPlugin(n=this.props){const{uppy:i}=n;i.removePlugin(this.plugin)}render(){return m.createElement("div",{className:"uppy-Container",ref:n=>{this.container=n},...hv(this.props)})}}function OS({src:l,alt:n="表情包",className:i,maxRetries:c=5,retryInterval:u=1500}){const[x,h]=m.useState("loading"),[f,p]=m.useState(0),[g,N]=m.useState(null),[v,b]=m.useState(l);l!==v&&(h("loading"),p(0),N(null),b(l));const w=m.useCallback(async()=>{try{const y=await fetch(l,{credentials:"include"});if(y.status===202){h("generating"),f{p(k=>k+1)},u):h("error");return}if(!y.ok){h("error");return}const R=await y.blob(),D=URL.createObjectURL(R);N(D),h("loaded")}catch(y){console.error("加载缩略图失败:",y),h("error")}},[l,f,c,u]);return m.useEffect(()=>{w()},[w]),m.useEffect(()=>()=>{g&&URL.revokeObjectURL(g)},[g]),x==="loading"||x==="generating"?e.jsx(Js,{className:B("w-full h-full",i)}):x==="error"||!g?e.jsx("div",{className:B("w-full h-full flex items-center justify-center bg-muted",i),children:e.jsx(bj,{className:"h-8 w-8 text-muted-foreground"})}):e.jsx("img",{src:g,alt:n,className:B("w-full h-full object-contain",i)})}function RS({children:l,className:n}){return e.jsx(Im,{content:l,className:n})}const Ia="/api/webui/emoji";async function LS(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(`${Ia}/list?${n}`,{});if(!i.ok)throw new Error(`获取表情包列表失败: ${i.statusText}`);return i.json()}async function US(l){const n=await we(`${Ia}/${l}`,{});if(!n.ok)throw new Error(`获取表情包详情失败: ${n.statusText}`);return n.json()}async function BS(l,n){const i=await we(`${Ia}/${l}`,{method:"PATCH",body:JSON.stringify(n)});if(!i.ok)throw new Error(`更新表情包失败: ${i.statusText}`);return i.json()}async function $S(l){const n=await we(`${Ia}/${l}`,{method:"DELETE"});if(!n.ok)throw new Error(`删除表情包失败: ${n.statusText}`);return n.json()}async function IS(){const l=await we(`${Ia}/stats/summary`,{});if(!l.ok)throw new Error(`获取统计数据失败: ${l.statusText}`);return l.json()}async function PS(l){const n=await we(`${Ia}/${l}/register`,{method:"POST"});if(!n.ok)throw new Error(`注册表情包失败: ${n.statusText}`);return n.json()}async function HS(l){const n=await we(`${Ia}/${l}/ban`,{method:"POST"});if(!n.ok)throw new Error(`封禁表情包失败: ${n.statusText}`);return n.json()}function GS(l,n=!1){return n?`${Ia}/${l}/thumbnail?original=true`:`${Ia}/${l}/thumbnail`}function FS(l){return`${Ia}/${l}/thumbnail?original=true`}async function qS(l){const n=await we(`${Ia}/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 VS(){return`${Ia}/upload`}function KS(){const[l,n]=m.useState([]),[i,c]=m.useState(null),[u,x]=m.useState(!1),[h,f]=m.useState(1),[p,g]=m.useState(0),[N,v]=m.useState(20),[b,w]=m.useState("all"),[y,R]=m.useState("all"),[D,k]=m.useState("all"),[I,M]=m.useState("usage_count"),[S,T]=m.useState("desc"),[$,A]=m.useState(null),[Q,G]=m.useState(!1),[de,oe]=m.useState(!1),[ve,le]=m.useState(!1),[fe,ge]=m.useState(new Set),[z,V]=m.useState(!1),[U,L]=m.useState(""),[P,_e]=m.useState("medium"),[je,Se]=m.useState(!1),{toast:Y}=Ws(),be=m.useCallback(async()=>{try{x(!0);const me=await LS({page:h,page_size:N,is_registered:b==="all"?void 0:b==="registered",is_banned:y==="all"?void 0:y==="banned",format:D==="all"?void 0:D,sort_by:I,sort_order:S});n(me.data),g(me.total)}catch(me){const ze=me instanceof Error?me.message:"加载表情包列表失败";Y({title:"错误",description:ze,variant:"destructive"})}finally{x(!1)}},[h,N,b,y,D,I,S,Y]),Z=async()=>{try{const me=await IS();c(me.data)}catch(me){console.error("加载统计数据失败:",me)}};m.useEffect(()=>{be()},[be]),m.useEffect(()=>{Z()},[]);const xe=async me=>{try{const ze=await US(me.id);A(ze.data),G(!0)}catch(ze){const rs=ze instanceof Error?ze.message:"加载详情失败";Y({title:"错误",description:rs,variant:"destructive"})}},Me=me=>{A(me),oe(!0)},J=me=>{A(me),le(!0)},ce=async()=>{if($)try{await $S($.id),Y({title:"成功",description:"表情包已删除"}),le(!1),A(null),be(),Z()}catch(me){const ze=me instanceof Error?me.message:"删除失败";Y({title:"错误",description:ze,variant:"destructive"})}},Fe=async me=>{try{await PS(me.id),Y({title:"成功",description:"表情包已注册"}),be(),Z()}catch(ze){const rs=ze instanceof Error?ze.message:"注册失败";Y({title:"错误",description:rs,variant:"destructive"})}},q=async me=>{try{await HS(me.id),Y({title:"成功",description:"表情包已封禁"}),be(),Z()}catch(ze){const rs=ze instanceof Error?ze.message:"封禁失败";Y({title:"错误",description:rs,variant:"destructive"})}},ee=me=>{const ze=new Set(fe);ze.has(me)?ze.delete(me):ze.add(me),ge(ze)},ke=async()=>{try{const me=await qS(Array.from(fe));Y({title:"批量删除完成",description:me.message}),ge(new Set),V(!1),be(),Z()}catch(me){Y({title:"批量删除失败",description:me instanceof Error?me.message:"批量删除失败",variant:"destructive"})}},Te=()=>{const me=parseInt(U),ze=Math.ceil(p/N);me>=1&&me<=ze?(f(me),L("")):Y({title:"无效的页码",description:`请输入1-${ze}之间的页码`,variant:"destructive"})},Oe=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(C,{onClick:()=>Se(!0),className:"gap-2",children:[e.jsx(Gi,{className:"h-4 w-4"}),"上传表情包"]})]}),e.jsx(es,{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(De,{children:e.jsxs(Xe,{className:"pb-2",children:[e.jsx(Is,{children:"总数"}),e.jsx(We,{className:"text-2xl",children:i.total})]})}),e.jsx(De,{children:e.jsxs(Xe,{className:"pb-2",children:[e.jsx(Is,{children:"已注册"}),e.jsx(We,{className:"text-2xl text-green-600",children:i.registered})]})}),e.jsx(De,{children:e.jsxs(Xe,{className:"pb-2",children:[e.jsx(Is,{children:"已封禁"}),e.jsx(We,{className:"text-2xl text-red-600",children:i.banned})]})}),e.jsx(De,{children:e.jsxs(Xe,{className:"pb-2",children:[e.jsx(Is,{children:"未注册"}),e.jsx(We,{className:"text-2xl text-gray-600",children:i.unregistered})]})})]}),e.jsxs(De,{children:[e.jsx(Xe,{children:e.jsxs(We,{className:"flex items-center gap-2",children:[e.jsx(yo,{className:"h-5 w-5"}),"筛选和排序"]})}),e.jsxs(Qe,{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(Be,{value:`${I}-${S}`,onValueChange:me=>{const[ze,rs]=me.split("-");M(ze),T(rs),f(1)},children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"usage_count-desc",children:"使用次数 (多→少)"}),e.jsx(ae,{value:"usage_count-asc",children:"使用次数 (少→多)"}),e.jsx(ae,{value:"register_time-desc",children:"注册时间 (新→旧)"}),e.jsx(ae,{value:"register_time-asc",children:"注册时间 (旧→新)"}),e.jsx(ae,{value:"record_time-desc",children:"记录时间 (新→旧)"}),e.jsx(ae,{value:"record_time-asc",children:"记录时间 (旧→新)"}),e.jsx(ae,{value:"last_used_time-desc",children:"最后使用 (新→旧)"}),e.jsx(ae,{value:"last_used_time-asc",children:"最后使用 (旧→新)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:"注册状态"}),e.jsxs(Be,{value:b,onValueChange:me=>{w(me),f(1)},children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"all",children:"全部"}),e.jsx(ae,{value:"registered",children:"已注册"}),e.jsx(ae,{value:"unregistered",children:"未注册"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:"封禁状态"}),e.jsxs(Be,{value:y,onValueChange:me=>{R(me),f(1)},children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"all",children:"全部"}),e.jsx(ae,{value:"banned",children:"已封禁"}),e.jsx(ae,{value:"unbanned",children:"未封禁"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:"格式"}),e.jsxs(Be,{value:D,onValueChange:me=>{k(me),f(1)},children:[e.jsx(Le,{children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"all",children:"全部"}),Oe.map(me=>e.jsxs(ae,{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(E,{className:"text-sm whitespace-nowrap",children:"卡片大小"}),e.jsxs(Be,{value:P,onValueChange:me=>_e(me),children:[e.jsx(Le,{className:"w-24",children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"small",children:"小"}),e.jsx(ae,{value:"medium",children:"中"}),e.jsx(ae,{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(Be,{value:N.toString(),onValueChange:me=>{v(parseInt(me)),f(1),ge(new Set)},children:[e.jsx(Le,{id:"emoji-page-size",className:"w-20",children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"20",children:"20"}),e.jsx(ae,{value:"40",children:"40"}),e.jsx(ae,{value:"60",children:"60"}),e.jsx(ae,{value:"100",children:"100"})]})]}),fe.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(C,{variant:"outline",size:"sm",onClick:()=>ge(new Set),children:"取消选择"}),e.jsxs(C,{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(C,{variant:"outline",size:"sm",onClick:be,disabled:u,children:[e.jsx(kt,{className:`h-4 w-4 mr-2 ${u?"animate-spin":""}`}),"刷新"]})})]})]}),e.jsxs(De,{children:[e.jsxs(Xe,{children:[e.jsx(We,{children:"表情包列表"}),e.jsxs(Is,{children:["共 ",p," 个表情包,当前第 ",h," 页"]})]}),e.jsxs(Qe,{children:[l.length===0?e.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"暂无数据"}):e.jsx("div",{className:`grid gap-3 ${P==="small"?"grid-cols-3 sm:grid-cols-4 md:grid-cols-6 lg:grid-cols-8 xl:grid-cols-10":P==="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(ea,{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(Ae,{variant:"default",className:"bg-green-600 text-[10px] px-1 py-0",children:"已注册"}),me.is_banned&&e.jsx(Ae,{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 ${P==="small"?"p-1":P==="medium"?"p-2":"p-3"}`,children:e.jsx(OS,{src:GS(me.id),alt:"表情包"})}),e.jsxs("div",{className:`border-t bg-card ${P==="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(Ae,{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 ${P==="small"?"flex-wrap":""}`,children:[e.jsx(C,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:ze=>{ze.stopPropagation(),Me(me)},title:"编辑",children:e.jsx(Un,{className:"h-3 w-3"})}),e.jsx(C,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:ze=>{ze.stopPropagation(),xe(me)},title:"详情",children:e.jsx(qt,{className:"h-3 w-3"})}),!me.is_registered&&e.jsx(C,{variant:"ghost",size:"icon",className:"h-6 w-6 text-green-600 hover:text-green-700",onClick:ze=>{ze.stopPropagation(),Fe(me)},title:"注册",children:e.jsx(ea,{className:"h-3 w-3"})}),!me.is_banned&&e.jsx(C,{variant:"ghost",size:"icon",className:"h-6 w-6 text-orange-600 hover:text-orange-700",onClick:ze=>{ze.stopPropagation(),q(me)},title:"封禁",children:e.jsx(Pw,{className:"h-3 w-3"})}),e.jsx(C,{variant:"ghost",size:"icon",className:"h-6 w-6 text-red-600 hover:text-red-700",onClick:ze=>{ze.stopPropagation(),J(me)},title:"删除",children:e.jsx(ls,{className:"h-3 w-3"})})]})]})]},me.id))}),p>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["显示 ",(h-1)*N+1," 到"," ",Math.min(h*N,p)," 条,共 ",p," 条"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{variant:"outline",size:"sm",onClick:()=>f(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(Ur,{className:"h-4 w-4"})}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>f(me=>Math.max(1,me-1)),disabled:h===1,children:[e.jsx(ll,{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(ie,{type:"number",value:U,onChange:me=>L(me.target.value),onKeyDown:me=>me.key==="Enter"&&Te(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(p/N)}),e.jsx(C,{variant:"outline",size:"sm",onClick:Te,disabled:!U,className:"h-8",children:"跳转"})]}),e.jsxs(C,{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(Sa,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(C,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(p/N)),disabled:h>=Math.ceil(p/N),className:"hidden sm:flex",children:e.jsx(Br,{className:"h-4 w-4"})})]})]})]})]}),e.jsx(QS,{emoji:$,open:Q,onOpenChange:G}),e.jsx(YS,{emoji:$,open:de,onOpenChange:oe,onSuccess:()=>{be(),Z()}}),e.jsx(JS,{open:je,onOpenChange:Se,onSuccess:()=>{be(),Z()}})]})}),e.jsx(ps,{open:z,onOpenChange:V,children:e.jsxs(os,{children:[e.jsxs(ds,{children:[e.jsx(ms,{children:"确认批量删除"}),e.jsxs(xs,{children:["你确定要删除选中的 ",fe.size," 个表情包吗?此操作不可撤销。"]})]}),e.jsxs(us,{children:[e.jsx(fs,{children:"取消"}),e.jsx(hs,{onClick:ke,children:"确认删除"})]})]})}),e.jsx(Ks,{open:ve,onOpenChange:le,children:e.jsxs(Ps,{children:[e.jsxs(Hs,{children:[e.jsx(Gs,{children:"确认删除"}),e.jsx(ot,{children:"确定要删除这个表情包吗?此操作无法撤销。"})]}),e.jsxs(xt,{children:[e.jsx(C,{variant:"outline",onClick:()=>le(!1),children:"取消"}),e.jsx(C,{variant:"destructive",onClick:ce,children:"删除"})]})]})})]})}function QS({emoji:l,open:n,onOpenChange:i}){if(!l)return null;const c=u=>u?new Date(u*1e3).toLocaleString("zh-CN"):"-";return e.jsx(Ks,{open:n,onOpenChange:i,children:e.jsxs(Ps,{className:"max-w-2xl max-h-[90vh]",children:[e.jsx(Hs,{children:e.jsx(Gs,{children:"表情包详情"})}),e.jsx(es,{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:FS(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(Ae,{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(RS,{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(Ae,{variant:"default",className:"bg-green-600",children:"已注册"}),l.is_banned&&e.jsx(Ae,{variant:"destructive",children:"已封禁"}),!l.is_registered&&!l.is_banned&&e.jsx(Ae,{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 YS({emoji:l,open:n,onOpenChange:i,onSuccess:c}){const[u,x]=m.useState(""),[h,f]=m.useState(!1),[p,g]=m.useState(!1),[N,v]=m.useState(!1),{toast:b}=Ws();m.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 BS(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(Ks,{open:n,onOpenChange:i,children:e.jsxs(Ps,{className:"max-w-2xl",children:[e.jsxs(Hs,{children:[e.jsx(Gs,{children:"编辑表情包"}),e.jsx(ot,{children:"修改表情包的情绪和状态信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(E,{children:"情绪"}),e.jsx(et,{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(Xs,{id:"is_registered",checked:h,onCheckedChange:y=>{y===!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(Xs,{id:"is_banned",checked:p,onCheckedChange:y=>{y===!0?(g(!0),f(!1)):g(!1)}}),e.jsx(E,{htmlFor:"is_banned",className:"cursor-pointer",children:"已封禁"})]})]})]}),e.jsxs(xt,{children:[e.jsx(C,{variant:"outline",onClick:()=>i(!1),children:"取消"}),e.jsx(C,{onClick:w,disabled:N,children:N?"保存中...":"保存"})]})]})}):null}function JS({open:l,onOpenChange:n,onSuccess:i}){const[c,u]=m.useState("select"),[x,h]=m.useState([]),[f,p]=m.useState(null),[g,N]=m.useState(!1),{toast:v}=Ws(),b=m.useMemo(()=>new p1({id:"emoji-uploader",autoProceed:!1,restrictions:{maxFileSize:10485760,allowedFileTypes:["image/jpeg","image/png","image/gif","image/webp"],maxNumberOfFiles:20},locale:{pluralize:()=>0,strings:{addMoreFiles:"添加更多文件",addingMoreFiles:"正在添加更多文件",allowedFileTypes:"允许的文件类型:%{types}",cancel:"取消",closeModal:"关闭",complete:"完成",connectedToInternet:"已连接到互联网",copyLink:"复制链接",copyLinkToClipboardFallback:"复制下方链接",copyLinkToClipboardSuccess:"链接已复制到剪贴板",dashboardTitle:"选择文件",dashboardWindowTitle:"文件选择窗口(按 ESC 关闭)",done:"完成",dropHereOr:"拖放文件到这里或 %{browse}",dropHint:"将文件拖放到此处",dropPasteFiles:"将文件拖放到这里或 %{browseFiles}",dropPasteFolders:"将文件拖放到这里或 %{browseFolders}",dropPasteBoth:"将文件拖放到这里,%{browseFiles} 或 %{browseFolders}",dropPasteImportFiles:"将文件拖放到这里,%{browseFiles} 或从以下位置导入:",dropPasteImportFolders:"将文件拖放到这里,%{browseFolders} 或从以下位置导入:",dropPasteImportBoth:"将文件拖放到这里,%{browseFiles},%{browseFolders} 或从以下位置导入:",editFile:"编辑文件",editing:"正在编辑 %{file}",emptyFolderAdded:"未从空文件夹添加文件",exceedsSize:"%{file} 超过了最大允许大小 %{size}",failedToUpload:"上传 %{file} 失败",fileSource:"文件来源:%{name}",filesUploadedOfTotal:{0:"已上传 %{complete} / %{smart_count} 个文件",1:"已上传 %{complete} / %{smart_count} 个文件"},filter:"筛选",finishEditingFile:"完成编辑文件",folderAdded:{0:"已从 %{folder} 添加 %{smart_count} 个文件",1:"已从 %{folder} 添加 %{smart_count} 个文件"},generatingThumbnails:"正在生成缩略图...",import:"导入",importFiles:"从以下位置导入文件:",importFrom:"从 %{name} 导入",loading:"加载中...",logOut:"登出",myDevice:"我的设备",noFilesFound:"这里没有文件或文件夹",noInternetConnection:"无网络连接",openFolderNamed:"打开文件夹 %{name}",pause:"暂停",pauseUpload:"暂停上传",paused:"已暂停",poweredBy:"技术支持:%{uppy}",processingXFiles:{0:"正在处理 %{smart_count} 个文件",1:"正在处理 %{smart_count} 个文件"},recording:"录制中",removeFile:"移除文件",resetFilter:"重置筛选",resume:"继续",resumeUpload:"继续上传",retry:"重试",retryUpload:"重试上传",save:"保存",saveChanges:"保存更改",selectFileNamed:"选择文件 %{name}",selectX:{0:"选择 %{smart_count}",1:"选择 %{smart_count}"},smile:"笑一个!",startRecording:"开始录制视频",stopRecording:"停止录制视频",takePicture:"拍照",timedOut:"上传已停滞 %{seconds} 秒,正在中止。",upload:"下一步",uploadComplete:"上传完成",uploadFailed:"上传失败",uploadPaused:"上传已暂停",uploadXFiles:{0:"下一步(%{smart_count} 个文件)",1:"下一步(%{smart_count} 个文件)"},uploadXNewFiles:{0:"下一步(+%{smart_count} 个文件)",1:"下一步(+%{smart_count} 个文件)"},uploading:"正在上传",uploadingXFiles:{0:"正在上传 %{smart_count} 个文件",1:"正在上传 %{smart_count} 个文件"},xFilesSelected:{0:"已选择 %{smart_count} 个文件",1:"已选择 %{smart_count} 个文件"},xMoreFilesAdded:{0:"又添加了 %{smart_count} 个文件",1:"又添加了 %{smart_count} 个文件"},xTimeLeft:"剩余 %{time}",youCanOnlyUploadFileTypes:"您只能上传:%{types}",youCanOnlyUploadX:{0:"您只能上传 %{smart_count} 个文件",1:"您只能上传 %{smart_count} 个文件"},youHaveToAtLeastSelectX:{0:"您至少需要选择 %{smart_count} 个文件",1:"您至少需要选择 %{smart_count} 个文件"},browseFiles:"浏览文件",browseFolders:"浏览文件夹",cancelUpload:"取消上传",addMore:"添加更多",back:"返回",editFileWithFilename:"编辑文件 %{file}"}}}),[]);m.useEffect(()=>{const $=()=>{const A=b.getFiles();if(A.length===0)return;const Q=A.map(G=>({id:G.id,name:G.name,previewUrl:G.preview||URL.createObjectURL(G.data),emotion:"",description:"",isRegistered:!0,file:G.data}));h(Q),A.length===1?(p(Q[0].id),u("edit-single")):u("edit-multiple")};return b.on("upload",$),()=>{b.off("upload",$)}},[b]),m.useEffect(()=>{l||(b.cancelAll(),u("select"),h([]),p(null),N(!1))},[l,b]);const w=m.useCallback(($,A)=>{h(Q=>Q.map(G=>G.id===$?{...G,...A}:G))},[]),y=m.useCallback($=>$.emotion.trim().length>0,[]),R=m.useMemo(()=>x.length>0&&x.every(y),[x,y]),D=m.useMemo(()=>x.find($=>$.id===f)||null,[x,f]),k=m.useCallback(()=>{(c==="edit-single"||c==="edit-multiple")&&(u("select"),h([]),p(null))},[c]),I=m.useCallback(async()=>{if(!R){v({title:"请填写必填项",description:"每个表情包的情感标签都是必填的",variant:"destructive"});return}N(!0);let $=0,A=0;try{for(const Q of x){const G=new FormData;G.append("file",Q.file),G.append("emotion",Q.emotion),G.append("description",Q.description),G.append("is_registered",Q.isRegistered.toString());try{(await we(VS(),{method:"POST",body:G})).ok?$++:A++}catch{A++}}A===0?(v({title:"上传成功",description:`成功上传 ${$} 个表情包`}),n(!1),i()):(v({title:"部分上传失败",description:`成功 ${$} 个,失败 ${A} 个`,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(DS,{uppy:b,proudlyDisplayPoweredByUppy:!1,hideProgressDetails:!0,height:350,width:"100%",theme:"auto",note:"支持 JPG、PNG、GIF、WebP 格式,最多 20 个文件"})})}),S=()=>{const $=x[0];return $?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(C,{variant:"ghost",size:"sm",onClick:k,children:[e.jsx(Va,{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:$.previewUrl,alt:$.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:$.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(ie,{id:"single-emotion",value:$.emotion,onChange:A=>w($.id,{emotion:A.target.value}),placeholder:"多个标签用逗号分隔,如:开心,高兴",className:$.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(ie,{id:"single-description",value:$.description,onChange:A=>w($.id,{description:A.target.value}),placeholder:"输入表情包描述..."})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Xs,{id:"single-is-registered",checked:$.isRegistered,onCheckedChange:A=>w($.id,{isRegistered:A===!0})}),e.jsx(E,{htmlFor:"single-is-registered",className:"cursor-pointer",children:"上传后立即注册(可被麦麦使用)"})]})]})]}),e.jsx(xt,{children:e.jsx(C,{onClick:I,disabled:!R||g,children:g?"上传中...":"上传"})})]}):null},T=()=>{const $=x.filter(y).length,A=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(C,{variant:"ghost",size:"sm",onClick:k,children:[e.jsx(Va,{className:"h-4 w-4 mr-1"}),"返回"]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["编辑表情包信息(",$,"/",A," 已完成)"]})]}),e.jsx(Ae,{variant:R?"default":"secondary",children:R?e.jsxs(e.Fragment,{children:[e.jsx(St,{className:"h-3 w-3 mr-1"}),"全部完成"]}):e.jsxs(e.Fragment,{children:[e.jsx(_a,{className:"h-3 w-3 mr-1"}),"未完成"]})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(es,{className:"h-[350px] pr-2",children:e.jsx("div",{className:"space-y-2",children:x.map(Q=>{const G=y(Q),de=f===Q.id;return e.jsxs("div",{onClick:()=>p(Q.id),className:` - flex items-center gap-3 p-3 rounded-lg border-2 cursor-pointer transition-all - ${de?"ring-2 ring-primary":""} - ${G?"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:Q.previewUrl,alt:Q.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:Q.name}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:Q.emotion||"未填写情感标签"})]}),G?e.jsx(ea,{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"})]},Q.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}),y(D)&&e.jsxs(Ae,{variant:"outline",className:"text-green-600 border-green-600",children:[e.jsx(St,{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(ie,{id:"multi-emotion",value:D.emotion,onChange:Q=>w(D.id,{emotion:Q.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(ie,{id:"multi-description",value:D.description,onChange:Q=>w(D.id,{description:Q.target.value}),placeholder:"输入表情包描述..."})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Xs,{id:"multi-is-registered",checked:D.isRegistered,onCheckedChange:Q=>w(D.id,{isRegistered:Q===!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(bj,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"点击左侧卡片编辑"})]})})})]}),e.jsx(xt,{children:e.jsx(C,{onClick:I,disabled:!R||g,children:g?"上传中...":`上传全部 (${A})`})})]})};return e.jsx(Ks,{open:l,onOpenChange:n,children:e.jsxs(Ps,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[e.jsxs(Hs,{children:[e.jsxs(Gs,{className:"flex items-center gap-2",children:[e.jsx(Gi,{className:"h-5 w-5"}),c==="select"&&"上传表情包 - 选择文件",c==="edit-single"&&"上传表情包 - 填写信息",c==="edit-multiple"&&"上传表情包 - 批量编辑"]}),e.jsxs(ot,{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"&&S(),c==="edit-multiple"&&T()]})]})})}const mn="/api/webui/expression";async function XS(){const l=await we(`${mn}/chats`,{});if(!l.ok){const n=await l.json();throw new Error(n.detail||"获取聊天列表失败")}return l.json()}async function ZS(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(`${mn}/list?${n}`,{});if(!i.ok){const c=await i.json();throw new Error(c.detail||"获取表达方式列表失败")}return i.json()}async function WS(l){const n=await we(`${mn}/${l}`,{});if(!n.ok){const i=await n.json();throw new Error(i.detail||"获取表达方式详情失败")}return n.json()}async function e4(l){const n=await we(`${mn}/`,{method:"POST",body:JSON.stringify(l)});if(!n.ok){const i=await n.json();throw new Error(i.detail||"创建表达方式失败")}return n.json()}async function s4(l,n){const i=await we(`${mn}/${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 t4(l){const n=await we(`${mn}/${l}`,{method:"DELETE"});if(!n.ok){const i=await n.json();throw new Error(i.detail||"删除表达方式失败")}return n.json()}async function a4(l){const n=await we(`${mn}/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 l4(){const l=await we(`${mn}/stats/summary`,{});if(!l.ok){const n=await l.json();throw new Error(n.detail||"获取统计数据失败")}return l.json()}function n4(){const[l,n]=m.useState([]),[i,c]=m.useState(!0),[u,x]=m.useState(0),[h,f]=m.useState(1),[p,g]=m.useState(20),[N,v]=m.useState(""),[b,w]=m.useState(null),[y,R]=m.useState(!1),[D,k]=m.useState(!1),[I,M]=m.useState(!1),[S,T]=m.useState(null),[$,A]=m.useState(new Set),[Q,G]=m.useState(!1),[de,oe]=m.useState(""),[ve,le]=m.useState({total:0,recent_7days:0,chat_count:0,top_chats:{}}),[fe,ge]=m.useState([]),[z,V]=m.useState(new Map),{toast:U}=Ws(),L=async()=>{try{c(!0);const ce=await ZS({page:h,page_size:p,search:N||void 0});n(ce.data),x(ce.total)}catch(ce){U({title:"加载失败",description:ce instanceof Error?ce.message:"无法加载表达方式",variant:"destructive"})}finally{c(!1)}},P=async()=>{try{const ce=await l4();ce?.data&&le(ce.data)}catch(ce){console.error("加载统计数据失败:",ce)}},_e=async()=>{try{const ce=await XS();if(ce?.data){ge(ce.data);const Fe=new Map;ce.data.forEach(q=>{Fe.set(q.chat_id,q.chat_name)}),V(Fe)}}catch(ce){console.error("加载聊天列表失败:",ce)}},je=ce=>z.get(ce)||ce;m.useEffect(()=>{L(),P(),_e()},[h,p,N]);const Se=async ce=>{try{const Fe=await WS(ce.id);w(Fe.data),R(!0)}catch(Fe){U({title:"加载详情失败",description:Fe instanceof Error?Fe.message:"无法加载表达方式详情",variant:"destructive"})}},Y=ce=>{w(ce),k(!0)},be=async ce=>{try{await t4(ce.id),U({title:"删除成功",description:`已删除表达方式: ${ce.situation}`}),T(null),L(),P()}catch(Fe){U({title:"删除失败",description:Fe instanceof Error?Fe.message:"无法删除表达方式",variant:"destructive"})}},Z=ce=>{const Fe=new Set($);Fe.has(ce)?Fe.delete(ce):Fe.add(ce),A(Fe)},xe=()=>{$.size===l.length&&l.length>0?A(new Set):A(new Set(l.map(ce=>ce.id)))},Me=async()=>{try{await a4(Array.from($)),U({title:"批量删除成功",description:`已删除 ${$.size} 个表达方式`}),A(new Set),G(!1),L(),P()}catch(ce){U({title:"批量删除失败",description:ce instanceof Error?ce.message:"无法批量删除表达方式",variant:"destructive"})}},J=()=>{const ce=parseInt(de),Fe=Math.ceil(u/p);ce>=1&&ce<=Fe?(f(ce),oe("")):U({title:"无效的页码",description:`请输入1-${Fe}之间的页码`,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(on,{className:"h-8 w-8",strokeWidth:2}),"表达方式管理"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦的表达方式和话术模板"})]}),e.jsxs(C,{onClick:()=>M(!0),className:"gap-2",children:[e.jsx(it,{className:"h-4 w-4"}),"新增表达方式"]})]})}),e.jsx(es,{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:ve.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:ve.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:ve.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(Vt,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(ie,{id:"search",placeholder:"搜索情境、风格或上下文...",value:N,onChange:ce=>v(ce.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:$.size>0&&e.jsxs("span",{children:["已选择 ",$.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(Be,{value:p.toString(),onValueChange:ce=>{g(parseInt(ce)),f(1),A(new Set)},children:[e.jsx(Le,{id:"page-size",className:"w-20",children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"10",children:"10"}),e.jsx(ae,{value:"20",children:"20"}),e.jsx(ae,{value:"50",children:"50"}),e.jsx(ae,{value:"100",children:"100"})]})]}),$.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(C,{variant:"outline",size:"sm",onClick:()=>A(new Set),children:"取消选择"}),e.jsxs(C,{variant:"destructive",size:"sm",onClick:()=>G(!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(El,{children:[e.jsx(Ml,{children:e.jsxs(ct,{children:[e.jsx(Je,{className:"w-12",children:e.jsx(Xs,{checked:$.size===l.length&&l.length>0,onCheckedChange:xe})}),e.jsx(Je,{children:"情境"}),e.jsx(Je,{children:"风格"}),e.jsx(Je,{children:"聊天"}),e.jsx(Je,{className:"text-right",children:"操作"})]})}),e.jsx(Al,{children:i?e.jsx(ct,{children:e.jsx(He,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):l.length===0?e.jsx(ct,{children:e.jsx(He,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):l.map(ce=>e.jsxs(ct,{children:[e.jsx(He,{children:e.jsx(Xs,{checked:$.has(ce.id),onCheckedChange:()=>Z(ce.id)})}),e.jsx(He,{className:"font-medium max-w-xs truncate",children:ce.situation}),e.jsx(He,{className:"max-w-xs truncate",children:ce.style}),e.jsx(He,{className:"max-w-[200px] truncate",title:je(ce.chat_id),style:{wordBreak:"keep-all"},children:e.jsx("span",{className:"whitespace-nowrap overflow-hidden text-ellipsis block",children:je(ce.chat_id)})}),e.jsx(He,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(C,{variant:"default",size:"sm",onClick:()=>Y(ce),children:[e.jsx(Un,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(C,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>Se(ce),title:"查看详情",children:e.jsx(sa,{className:"h-4 w-4"})}),e.jsxs(C,{size:"sm",onClick:()=>T(ce),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(ls,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},ce.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(ce=>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(Xs,{checked:$.has(ce.id),onCheckedChange:()=>Z(ce.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:ce.situation,children:ce.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:ce.style,children:ce.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:je(ce.chat_id),style:{wordBreak:"keep-all"},children:je(ce.chat_id)})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>Y(ce),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(Un,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(C,{variant:"outline",size:"sm",onClick:()=>Se(ce),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:e.jsx(sa,{className:"h-3 w-3"})}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>T(ce),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"}),"删除"]})]})]},ce.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(C,{variant:"outline",size:"sm",onClick:()=>f(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(Ur,{className:"h-4 w-4"})}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>f(h-1),disabled:h===1,children:[e.jsx(ll,{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(ie,{type:"number",value:de,onChange:ce=>oe(ce.target.value),onKeyDown:ce=>ce.key==="Enter"&&J(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(u/p)}),e.jsx(C,{variant:"outline",size:"sm",onClick:J,disabled:!de,className:"h-8",children:"跳转"})]}),e.jsxs(C,{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(Sa,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(C,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(u/p)),disabled:h>=Math.ceil(u/p),className:"hidden sm:flex",children:e.jsx(Br,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(r4,{expression:b,open:y,onOpenChange:R,chatNameMap:z}),e.jsx(i4,{open:I,onOpenChange:M,chatList:fe,onSuccess:()=>{L(),P(),M(!1)}}),e.jsx(c4,{expression:b,open:D,onOpenChange:k,chatList:fe,onSuccess:()=>{L(),P(),k(!1)}}),e.jsx(ps,{open:!!S,onOpenChange:()=>T(null),children:e.jsxs(os,{children:[e.jsxs(ds,{children:[e.jsx(ms,{children:"确认删除"}),e.jsxs(xs,{children:['确定要删除表达方式 "',S?.situation,'" 吗? 此操作不可撤销。']})]}),e.jsxs(us,{children:[e.jsx(fs,{children:"取消"}),e.jsx(hs,{onClick:()=>S&&be(S),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(o4,{open:Q,onOpenChange:G,onConfirm:Me,count:$.size})]})}function r4({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(Ks,{open:n,onOpenChange:i,children:e.jsxs(Ps,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Hs,{children:[e.jsx(Gs,{children:"表达方式详情"}),e.jsx(ot,{children:"查看表达方式的完整信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Oi,{label:"情境",value:l.situation}),e.jsx(Oi,{label:"风格",value:l.style}),e.jsx(Oi,{label:"聊天",value:x(l.chat_id)}),e.jsx(Oi,{icon:Or,label:"记录ID",value:l.id.toString(),mono:!0})]}),e.jsx("div",{className:"grid grid-cols-2 gap-4",children:e.jsx(Oi,{icon:kl,label:"创建时间",value:u(l.create_date)})})]}),e.jsx(xt,{children:e.jsx(C,{onClick:()=>i(!1),children:"关闭"})})]})})}function Oi({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:B("text-sm",c&&"font-mono",!i&&"text-muted-foreground"),children:i||"-"})]})}function i4({open:l,onOpenChange:n,chatList:i,onSuccess:c}){const[u,x]=m.useState({situation:"",style:"",chat_id:""}),[h,f]=m.useState(!1),{toast:p}=Ws(),g=async()=>{if(!u.situation||!u.style||!u.chat_id){p({title:"验证失败",description:"请填写必填字段:情境、风格和聊天",variant:"destructive"});return}try{f(!0),await e4(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(Ks,{open:l,onOpenChange:n,children:e.jsxs(Ps,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Hs,{children:[e.jsx(Gs,{children:"新增表达方式"}),e.jsx(ot,{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(ie,{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(ie,{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(Be,{value:u.chat_id,onValueChange:N=>x({...u,chat_id:N}),children:[e.jsx(Le,{children:e.jsx($e,{placeholder:"选择关联的聊天"})}),e.jsx(Ue,{children:i.map(N=>e.jsx(ae,{value:N.chat_id,children:e.jsxs("span",{className:"truncate",style:{wordBreak:"keep-all"},children:[N.chat_name,N.is_group&&e.jsx("span",{className:"text-muted-foreground ml-1",children:"(群聊)"})]})},N.chat_id))})]})]})]}),e.jsxs(xt,{children:[e.jsx(C,{variant:"outline",onClick:()=>n(!1),children:"取消"}),e.jsx(C,{onClick:g,disabled:h,children:h?"创建中...":"创建"})]})]})})}function c4({expression:l,open:n,onOpenChange:i,chatList:c,onSuccess:u}){const[x,h]=m.useState({}),[f,p]=m.useState(!1),{toast:g}=Ws();m.useEffect(()=>{l&&h({situation:l.situation,style:l.style,chat_id:l.chat_id})},[l]);const N=async()=>{if(l)try{p(!0),await s4(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(Ks,{open:n,onOpenChange:i,children:e.jsxs(Ps,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Hs,{children:[e.jsx(Gs,{children:"编辑表达方式"}),e.jsx(ot,{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(ie,{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(ie,{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(Be,{value:x.chat_id||"",onValueChange:v=>h({...x,chat_id:v}),children:[e.jsx(Le,{children:e.jsx($e,{placeholder:"选择关联的聊天"})}),e.jsx(Ue,{children:c.map(v=>e.jsx(ae,{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(xt,{children:[e.jsx(C,{variant:"outline",onClick:()=>i(!1),children:"取消"}),e.jsx(C,{onClick:N,disabled:f,children:f?"保存中...":"保存"})]})]})}):null}function o4({open:l,onOpenChange:n,onConfirm:i,count:c}){return e.jsx(ps,{open:l,onOpenChange:n,children:e.jsxs(os,{children:[e.jsxs(ds,{children:[e.jsx(ms,{children:"确认批量删除"}),e.jsxs(xs,{children:["您即将删除 ",c," 个表达方式,此操作无法撤销。确定要继续吗?"]})]}),e.jsxs(us,{children:[e.jsx(fs,{children:"取消"}),e.jsx(hs,{onClick:i,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})}const zl="/api/webui/jargon";async function d4(){const l=await we(`${zl}/chats`,{});if(!l.ok){const n=await l.json();throw new Error(n.detail||"获取聊天列表失败")}return l.json()}async function u4(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(`${zl}/list?${n}`,{});if(!i.ok){const c=await i.json();throw new Error(c.detail||"获取黑话列表失败")}return i.json()}async function m4(l){const n=await we(`${zl}/${l}`,{});if(!n.ok){const i=await n.json();throw new Error(i.detail||"获取黑话详情失败")}return n.json()}async function x4(l){const n=await we(`${zl}/`,{method:"POST",body:JSON.stringify(l)});if(!n.ok){const i=await n.json();throw new Error(i.detail||"创建黑话失败")}return n.json()}async function h4(l,n){const i=await we(`${zl}/${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 f4(l){const n=await we(`${zl}/${l}`,{method:"DELETE"});if(!n.ok){const i=await n.json();throw new Error(i.detail||"删除黑话失败")}return n.json()}async function p4(l){const n=await we(`${zl}/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 g4(){const l=await we(`${zl}/stats/summary`,{});if(!l.ok){const n=await l.json();throw new Error(n.detail||"获取黑话统计失败")}return l.json()}async function j4(l,n){const i=new URLSearchParams;l.forEach(u=>i.append("ids",u.toString())),i.append("is_jargon",n.toString());const c=await we(`${zl}/batch/set-jargon?${i}`,{method:"POST"});if(!c.ok){const u=await c.json();throw new Error(u.detail||"批量设置黑话状态失败")}return c.json()}function v4(){const[l,n]=m.useState([]),[i,c]=m.useState(!0),[u,x]=m.useState(0),[h,f]=m.useState(1),[p,g]=m.useState(20),[N,v]=m.useState(""),[b,w]=m.useState("all"),[y,R]=m.useState("all"),[D,k]=m.useState(null),[I,M]=m.useState(!1),[S,T]=m.useState(!1),[$,A]=m.useState(!1),[Q,G]=m.useState(null),[de,oe]=m.useState(new Set),[ve,le]=m.useState(!1),[fe,ge]=m.useState(""),[z,V]=m.useState({total:0,confirmed_jargon:0,confirmed_not_jargon:0,pending:0,global_count:0,complete_count:0,chat_count:0,top_chats:{}}),[U,L]=m.useState([]),{toast:P}=Ws(),_e=async()=>{try{c(!0);const ee=await u4({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){P({title:"加载失败",description:ee instanceof Error?ee.message:"无法加载黑话列表",variant:"destructive"})}finally{c(!1)}},je=async()=>{try{const ee=await g4();ee?.data&&V(ee.data)}catch(ee){console.error("加载统计数据失败:",ee)}},Se=async()=>{try{const ee=await d4();ee?.data&&L(ee.data)}catch(ee){console.error("加载聊天列表失败:",ee)}};m.useEffect(()=>{_e(),je(),Se()},[h,p,N,b,y]);const Y=async ee=>{try{const ke=await m4(ee.id);k(ke.data),M(!0)}catch(ke){P({title:"加载详情失败",description:ke instanceof Error?ke.message:"无法加载黑话详情",variant:"destructive"})}},be=ee=>{k(ee),T(!0)},Z=async ee=>{try{await f4(ee.id),P({title:"删除成功",description:`已删除黑话: ${ee.content}`}),G(null),_e(),je()}catch(ke){P({title:"删除失败",description:ke instanceof Error?ke.message:"无法删除黑话",variant:"destructive"})}},xe=ee=>{const ke=new Set(de);ke.has(ee)?ke.delete(ee):ke.add(ee),oe(ke)},Me=()=>{de.size===l.length&&l.length>0?oe(new Set):oe(new Set(l.map(ee=>ee.id)))},J=async()=>{try{await p4(Array.from(de)),P({title:"批量删除成功",description:`已删除 ${de.size} 个黑话`}),oe(new Set),le(!1),_e(),je()}catch(ee){P({title:"批量删除失败",description:ee instanceof Error?ee.message:"无法批量删除黑话",variant:"destructive"})}},ce=async ee=>{try{await j4(Array.from(de),ee),P({title:"操作成功",description:`已将 ${de.size} 个词条设为${ee?"黑话":"非黑话"}`}),oe(new Set),_e(),je()}catch(ke){P({title:"操作失败",description:ke instanceof Error?ke.message:"批量设置失败",variant:"destructive"})}},Fe=()=>{const ee=parseInt(fe),ke=Math.ceil(u/p);ee>=1&&ee<=ke?(f(ee),ge("")):P({title:"无效的页码",description:`请输入1-${ke}之间的页码`,variant:"destructive"})},q=ee=>ee===!0?e.jsxs(Ae,{variant:"default",className:"bg-green-600 hover:bg-green-700",children:[e.jsx(St,{className:"h-3 w-3 mr-1"}),"是黑话"]}):ee===!1?e.jsxs(Ae,{variant:"secondary",children:[e.jsx(_a,{className:"h-3 w-3 mr-1"}),"非黑话"]}):e.jsxs(Ae,{variant:"outline",children:[e.jsx(pj,{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(Hw,{className:"h-8 w-8",strokeWidth:2}),"黑话管理"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦学习到的黑话和俚语"})]}),e.jsxs(C,{onClick:()=>A(!0),className:"gap-2",children:[e.jsx(it,{className:"h-4 w-4"}),"新增黑话"]})]})}),e.jsx(es,{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(Vt,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(ie,{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(Be,{value:b,onValueChange:w,children:[e.jsx(Le,{children:e.jsx($e,{placeholder:"全部聊天"})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"all",children:"全部聊天"}),U.map(ee=>e.jsx(ae,{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(Be,{value:y,onValueChange:R,children:[e.jsx(Le,{children:e.jsx($e,{placeholder:"全部状态"})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"all",children:"全部状态"}),e.jsx(ae,{value:"true",children:"是黑话"}),e.jsx(ae,{value:"false",children:"非黑话"})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(E,{htmlFor:"page-size",children:"每页显示"}),e.jsxs(Be,{value:p.toString(),onValueChange:ee=>{g(parseInt(ee)),f(1),oe(new Set)},children:[e.jsx(Le,{id:"page-size",children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"10",children:"10"}),e.jsx(ae,{value:"20",children:"20"}),e.jsx(ae,{value:"50",children:"50"}),e.jsx(ae,{value:"100",children:"100"})]})]})]})]}),de.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:["已选择 ",de.size," 个"]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>ce(!0),children:[e.jsx(St,{className:"h-4 w-4 mr-1"}),"标记为黑话"]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>ce(!1),children:[e.jsx(_a,{className:"h-4 w-4 mr-1"}),"标记为非黑话"]}),e.jsx(C,{variant:"outline",size:"sm",onClick:()=>oe(new Set),children:"取消选择"}),e.jsxs(C,{variant:"destructive",size:"sm",onClick:()=>le(!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(El,{children:[e.jsx(Ml,{children:e.jsxs(ct,{children:[e.jsx(Je,{className:"w-12",children:e.jsx(Xs,{checked:de.size===l.length&&l.length>0,onCheckedChange:Me})}),e.jsx(Je,{children:"内容"}),e.jsx(Je,{children:"含义"}),e.jsx(Je,{children:"聊天"}),e.jsx(Je,{children:"状态"}),e.jsx(Je,{className:"text-center",children:"次数"}),e.jsx(Je,{className:"text-right",children:"操作"})]})}),e.jsx(Al,{children:i?e.jsx(ct,{children:e.jsx(He,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):l.length===0?e.jsx(ct,{children:e.jsx(He,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):l.map(ee=>e.jsxs(ct,{children:[e.jsx(He,{children:e.jsx(Xs,{checked:de.has(ee.id),onCheckedChange:()=>xe(ee.id)})}),e.jsx(He,{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(Co,{className:"h-4 w-4 text-blue-500 flex-shrink-0"})}),e.jsx("span",{className:"truncate",title:ee.content,children:ee.content})]})}),e.jsx(He,{className:"max-w-[200px] truncate",title:ee.meaning||"",children:ee.meaning||e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx(He,{className:"max-w-[150px] truncate",title:ee.chat_name||ee.chat_id,children:ee.chat_name||ee.chat_id}),e.jsx(He,{children:q(ee.is_jargon)}),e.jsx(He,{className:"text-center",children:ee.count}),e.jsx(He,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(C,{variant:"default",size:"sm",onClick:()=>be(ee),children:[e.jsx(Un,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(C,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>Y(ee),title:"查看详情",children:e.jsx(sa,{className:"h-4 w-4"})}),e.jsxs(C,{size:"sm",onClick:()=>G(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(Xs,{checked:de.has(ee.id),onCheckedChange:()=>xe(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(Co,{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(C,{variant:"outline",size:"sm",onClick:()=>be(ee),className:"text-xs px-2 py-1 h-auto",children:[e.jsx(Un,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(C,{variant:"outline",size:"sm",onClick:()=>Y(ee),className:"text-xs px-2 py-1 h-auto",children:e.jsx(sa,{className:"h-3 w-3"})}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>G(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(C,{variant:"outline",size:"sm",onClick:()=>f(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(Ur,{className:"h-4 w-4"})}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>f(h-1),disabled:h===1,children:[e.jsx(ll,{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(ie,{type:"number",value:fe,onChange:ee=>ge(ee.target.value),onKeyDown:ee=>ee.key==="Enter"&&Fe(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(u/p)}),e.jsx(C,{variant:"outline",size:"sm",onClick:Fe,disabled:!fe,className:"h-8",children:"跳转"})]}),e.jsxs(C,{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(Sa,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(C,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(u/p)),disabled:h>=Math.ceil(u/p),className:"hidden sm:flex",children:e.jsx(Br,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(N4,{jargon:D,open:I,onOpenChange:M}),e.jsx(b4,{open:$,onOpenChange:A,chatList:U,onSuccess:()=>{_e(),je(),A(!1)}}),e.jsx(y4,{jargon:D,open:S,onOpenChange:T,chatList:U,onSuccess:()=>{_e(),je(),T(!1)}}),e.jsx(ps,{open:!!Q,onOpenChange:()=>G(null),children:e.jsxs(os,{children:[e.jsxs(ds,{children:[e.jsx(ms,{children:"确认删除"}),e.jsxs(xs,{children:['确定要删除黑话 "',Q?.content,'" 吗?此操作不可撤销。']})]}),e.jsxs(us,{children:[e.jsx(fs,{children:"取消"}),e.jsx(hs,{onClick:()=>Q&&Z(Q),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(ps,{open:ve,onOpenChange:le,children:e.jsxs(os,{children:[e.jsxs(ds,{children:[e.jsx(ms,{children:"确认批量删除"}),e.jsxs(xs,{children:["您即将删除 ",de.size," 个黑话,此操作无法撤销。确定要继续吗?"]})]}),e.jsxs(us,{children:[e.jsx(fs,{children:"取消"}),e.jsx(hs,{onClick:J,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})]})}function N4({jargon:l,open:n,onOpenChange:i}){return l?e.jsx(Ks,{open:n,onOpenChange:i,children:e.jsxs(Ps,{className:"max-w-2xl max-h-[80vh] grid grid-rows-[auto_1fr_auto] overflow-hidden",children:[e.jsxs(Hs,{children:[e.jsx(Gs,{children:"黑话详情"}),e.jsx(ot,{children:"查看黑话的完整信息"})]}),e.jsx(es,{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(Sm,{icon:Or,label:"记录ID",value:l.id.toString(),mono:!0}),e.jsx(Sm,{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(Im,{content:l.meaning}):"-"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Sm,{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(Ae,{variant:"default",className:"bg-green-600",children:"是黑话"}),l.is_jargon===!1&&e.jsx(Ae,{variant:"secondary",children:"非黑话"}),l.is_jargon===null&&e.jsx(Ae,{variant:"outline",children:"未判定"}),l.is_global&&e.jsx(Ae,{variant:"outline",className:"border-blue-500 text-blue-500",children:"全局"}),l.is_complete&&e.jsx(Ae,{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(xt,{className:"flex-shrink-0",children:e.jsx(C,{onClick:()=>i(!1),children:"关闭"})})]})}):null}function Sm({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:B("text-sm",c&&"font-mono",!i&&"text-muted-foreground"),children:i||"-"})]})}function b4({open:l,onOpenChange:n,chatList:i,onSuccess:c}){const[u,x]=m.useState({content:"",meaning:"",chat_id:"",is_global:!1}),[h,f]=m.useState(!1),{toast:p}=Ws(),g=async()=>{if(!u.content||!u.chat_id){p({title:"验证失败",description:"请填写必填字段:内容和聊天",variant:"destructive"});return}try{f(!0),await x4(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(Ks,{open:l,onOpenChange:n,children:e.jsxs(Ps,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Hs,{children:[e.jsx(Gs,{children:"新增黑话"}),e.jsx(ot,{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(ie,{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(et,{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(Be,{value:u.chat_id,onValueChange:N=>x({...u,chat_id:N}),children:[e.jsx(Le,{children:e.jsx($e,{placeholder:"选择关联的聊天"})}),e.jsx(Ue,{children:i.map(N=>e.jsx(ae,{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(E,{htmlFor:"is_global",children:"设为全局黑话"})]})]}),e.jsxs(xt,{children:[e.jsx(C,{variant:"outline",onClick:()=>n(!1),children:"取消"}),e.jsx(C,{onClick:g,disabled:h,children:h?"创建中...":"创建"})]})]})})}function y4({jargon:l,open:n,onOpenChange:i,chatList:c,onSuccess:u}){const[x,h]=m.useState({}),[f,p]=m.useState(!1),{toast:g}=Ws();m.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 h4(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(Ks,{open:n,onOpenChange:i,children:e.jsxs(Ps,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Hs,{children:[e.jsx(Gs,{children:"编辑黑话"}),e.jsx(ot,{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(ie,{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(et,{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(Be,{value:x.chat_id||"",onValueChange:v=>h({...x,chat_id:v}),children:[e.jsx(Le,{children:e.jsx($e,{placeholder:"选择关联的聊天"})}),e.jsx(Ue,{children:c.map(v=>e.jsx(ae,{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(Be,{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(Le,{children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"null",children:"未判定"}),e.jsx(ae,{value:"true",children:"是黑话"}),e.jsx(ae,{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(E,{htmlFor:"edit_is_global",children:"全局黑话"})]})]}),e.jsxs(xt,{children:[e.jsx(C,{variant:"outline",onClick:()=>i(!1),children:"取消"}),e.jsx(C,{onClick:N,disabled:f,children:f?"保存中...":"保存"})]})]})}):null}const Pr="/api/webui/person";async function w4(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(`${Pr}/list?${n}`,{headers:Us()});if(!i.ok){const c=await i.json();throw new Error(c.detail||"获取人物列表失败")}return i.json()}async function _4(l){const n=await we(`${Pr}/${l}`,{headers:Us()});if(!n.ok){const i=await n.json();throw new Error(i.detail||"获取人物详情失败")}return n.json()}async function S4(l,n){const i=await we(`${Pr}/${l}`,{method:"PATCH",headers:Us(),body:JSON.stringify(n)});if(!i.ok){const c=await i.json();throw new Error(c.detail||"更新人物信息失败")}return i.json()}async function k4(l){const n=await we(`${Pr}/${l}`,{method:"DELETE",headers:Us()});if(!n.ok){const i=await n.json();throw new Error(i.detail||"删除人物信息失败")}return n.json()}async function C4(){const l=await we(`${Pr}/stats/summary`,{headers:Us()});if(!l.ok){const n=await l.json();throw new Error(n.detail||"获取统计数据失败")}return l.json()}async function T4(l){const n=await we(`${Pr}/batch/delete`,{method:"POST",headers:Us(),body:JSON.stringify({person_ids:l})});if(!n.ok){const i=await n.json();throw new Error(i.detail||"批量删除失败")}return n.json()}function E4(){const[l,n]=m.useState([]),[i,c]=m.useState(!0),[u,x]=m.useState(0),[h,f]=m.useState(1),[p,g]=m.useState(20),[N,v]=m.useState(""),[b,w]=m.useState(void 0),[y,R]=m.useState(void 0),[D,k]=m.useState(null),[I,M]=m.useState(!1),[S,T]=m.useState(!1),[$,A]=m.useState(null),[Q,G]=m.useState({total:0,known:0,unknown:0,platforms:{}}),[de,oe]=m.useState(new Set),[ve,le]=m.useState(!1),[fe,ge]=m.useState(""),{toast:z}=Ws(),V=async()=>{try{c(!0);const J=await w4({page:h,page_size:p,search:N||void 0,is_known:b,platform:y});n(J.data),x(J.total)}catch(J){z({title:"加载失败",description:J instanceof Error?J.message:"无法加载人物信息",variant:"destructive"})}finally{c(!1)}},U=async()=>{try{const J=await C4();J?.data&&G(J.data)}catch(J){console.error("加载统计数据失败:",J)}};m.useEffect(()=>{V(),U()},[h,p,N,b,y]);const L=async J=>{try{const ce=await _4(J.person_id);k(ce.data),M(!0)}catch(ce){z({title:"加载详情失败",description:ce instanceof Error?ce.message:"无法加载人物详情",variant:"destructive"})}},P=J=>{k(J),T(!0)},_e=async J=>{try{await k4(J.person_id),z({title:"删除成功",description:`已删除人物信息: ${J.person_name||J.nickname||J.user_id}`}),A(null),V(),U()}catch(ce){z({title:"删除失败",description:ce instanceof Error?ce.message:"无法删除人物信息",variant:"destructive"})}},je=m.useMemo(()=>Object.keys(Q.platforms),[Q.platforms]),Se=J=>{const ce=new Set(de);ce.has(J)?ce.delete(J):ce.add(J),oe(ce)},Y=()=>{de.size===l.length&&l.length>0?oe(new Set):oe(new Set(l.map(J=>J.person_id)))},be=()=>{if(de.size===0){z({title:"未选择任何人物",description:"请先选择要删除的人物",variant:"destructive"});return}le(!0)},Z=async()=>{try{const J=await T4(Array.from(de));z({title:"批量删除完成",description:J.message}),oe(new Set),le(!1),V(),U()}catch(J){z({title:"批量删除失败",description:J instanceof Error?J.message:"批量删除失败",variant:"destructive"})}},xe=()=>{const J=parseInt(fe),ce=Math.ceil(u/p);J>=1&&J<=ce?(f(J),ge("")):z({title:"无效的页码",description:`请输入1-${ce}之间的页码`,variant:"destructive"})},Me=J=>J?new Date(J*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(Tm,{className:"h-8 w-8",strokeWidth:2}),"人物信息管理"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦认识的所有人物信息"})]})})}),e.jsx(es,{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:Q.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:Q.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:Q.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(Vt,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(ie,{id:"search",placeholder:"搜索名称、昵称或用户ID...",value:N,onChange:J=>v(J.target.value),className:"pl-9"})]})]}),e.jsxs("div",{children:[e.jsx(E,{htmlFor:"filter-known",children:"认识状态"}),e.jsxs(Be,{value:b===void 0?"all":b.toString(),onValueChange:J=>{w(J==="all"?void 0:J==="true"),f(1)},children:[e.jsx(Le,{id:"filter-known",className:"mt-1.5",children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"all",children:"全部"}),e.jsx(ae,{value:"true",children:"已认识"}),e.jsx(ae,{value:"false",children:"未认识"})]})]})]}),e.jsxs("div",{children:[e.jsx(E,{htmlFor:"filter-platform",children:"平台"}),e.jsxs(Be,{value:y||"all",onValueChange:J=>{R(J==="all"?void 0:J),f(1)},children:[e.jsx(Le,{id:"filter-platform",className:"mt-1.5",children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"all",children:"全部平台"}),je.map(J=>e.jsxs(ae,{value:J,children:[J," (",Q.platforms[J],")"]},J))]})]})]})]}),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:de.size>0&&e.jsxs("span",{children:["已选择 ",de.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(Be,{value:p.toString(),onValueChange:J=>{g(parseInt(J)),f(1),oe(new Set)},children:[e.jsx(Le,{id:"page-size",className:"w-20",children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"10",children:"10"}),e.jsx(ae,{value:"20",children:"20"}),e.jsx(ae,{value:"50",children:"50"}),e.jsx(ae,{value:"100",children:"100"})]})]}),de.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(C,{variant:"outline",size:"sm",onClick:()=>oe(new Set),children:"取消选择"}),e.jsxs(C,{variant:"destructive",size:"sm",onClick:be,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(El,{children:[e.jsx(Ml,{children:e.jsxs(ct,{children:[e.jsx(Je,{className:"w-12",children:e.jsx(Xs,{checked:l.length>0&&de.size===l.length,onCheckedChange:Y,"aria-label":"全选"})}),e.jsx(Je,{children:"状态"}),e.jsx(Je,{children:"名称"}),e.jsx(Je,{children:"昵称"}),e.jsx(Je,{children:"平台"}),e.jsx(Je,{children:"用户ID"}),e.jsx(Je,{children:"最后更新"}),e.jsx(Je,{className:"text-right",children:"操作"})]})}),e.jsx(Al,{children:i?e.jsx(ct,{children:e.jsx(He,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):l.length===0?e.jsx(ct,{children:e.jsx(He,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):l.map(J=>e.jsxs(ct,{children:[e.jsx(He,{children:e.jsx(Xs,{checked:de.has(J.person_id),onCheckedChange:()=>Se(J.person_id),"aria-label":`选择 ${J.person_name||J.nickname||J.user_id}`})}),e.jsx(He,{children:e.jsx("div",{className:B("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",J.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:J.is_known?"已认识":"未认识"})}),e.jsx(He,{className:"font-medium",children:J.person_name||e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx(He,{children:J.nickname||"-"}),e.jsx(He,{children:J.platform}),e.jsx(He,{className:"font-mono text-sm",children:J.user_id}),e.jsx(He,{className:"text-sm text-muted-foreground",children:Me(J.last_know)}),e.jsx(He,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(C,{variant:"default",size:"sm",onClick:()=>L(J),children:[e.jsx(sa,{className:"h-4 w-4 mr-1"}),"详情"]}),e.jsxs(C,{variant:"default",size:"sm",onClick:()=>P(J),children:[e.jsx(Un,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsxs(C,{size:"sm",onClick:()=>A(J),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(ls,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},J.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(J=>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(Xs,{checked:de.has(J.person_id),onCheckedChange:()=>Se(J.person_id),className:"mt-1"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:B("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium mb-2",J.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:J.is_known?"已认识":"未认识"}),e.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",children:J.person_name||e.jsx("span",{className:"text-muted-foreground",children:"未命名"})}),J.nickname&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-1 w-full break-all",children:["昵称: ",J.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:J.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:J.user_id,children:J.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:Me(J.last_know)})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>L(J),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(sa,{className:"h-3 w-3 mr-1"}),"查看"]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>P(J),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(Un,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>A(J),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"}),"删除"]})]})]},J.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(C,{variant:"outline",size:"sm",onClick:()=>f(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(Ur,{className:"h-4 w-4"})}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>f(h-1),disabled:h===1,children:[e.jsx(ll,{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(ie,{type:"number",value:fe,onChange:J=>ge(J.target.value),onKeyDown:J=>J.key==="Enter"&&xe(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(u/p)}),e.jsx(C,{variant:"outline",size:"sm",onClick:xe,disabled:!fe,className:"h-8",children:"跳转"})]}),e.jsxs(C,{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(Sa,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(C,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(u/p)),disabled:h>=Math.ceil(u/p),className:"hidden sm:flex",children:e.jsx(Br,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(M4,{person:D,open:I,onOpenChange:M}),e.jsx(A4,{person:D,open:S,onOpenChange:T,onSuccess:()=>{V(),U(),T(!1)}}),e.jsx(ps,{open:!!$,onOpenChange:()=>A(null),children:e.jsxs(os,{children:[e.jsxs(ds,{children:[e.jsx(ms,{children:"确认删除"}),e.jsxs(xs,{children:['确定要删除人物信息 "',$?.person_name||$?.nickname||$?.user_id,'" 吗? 此操作不可撤销。']})]}),e.jsxs(us,{children:[e.jsx(fs,{children:"取消"}),e.jsx(hs,{onClick:()=>$&&_e($),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(ps,{open:ve,onOpenChange:le,children:e.jsxs(os,{children:[e.jsxs(ds,{children:[e.jsx(ms,{children:"确认批量删除"}),e.jsxs(xs,{children:["确定要删除选中的 ",de.size," 个人物信息吗? 此操作不可撤销。"]})]}),e.jsxs(us,{children:[e.jsx(fs,{children:"取消"}),e.jsx(hs,{onClick:Z,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})})]})}function M4({person:l,open:n,onOpenChange:i}){if(!l)return null;const c=u=>u?new Date(u*1e3).toLocaleString("zh-CN"):"-";return e.jsx(Ks,{open:n,onOpenChange:i,children:e.jsxs(Ps,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Hs,{children:[e.jsx(Gs,{children:"人物详情"}),e.jsxs(ot,{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(_l,{icon:Dn,label:"人物名称",value:l.person_name}),e.jsx(_l,{icon:on,label:"昵称",value:l.nickname}),e.jsx(_l,{icon:Or,label:"用户ID",value:l.user_id,mono:!0}),e.jsx(_l,{icon:Or,label:"人物ID",value:l.person_id,mono:!0}),e.jsx(_l,{label:"平台",value:l.platform}),e.jsx(_l,{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(_l,{icon:kl,label:"认识时间",value:c(l.know_times)}),e.jsx(_l,{icon:kl,label:"首次记录",value:c(l.know_since)}),e.jsx(_l,{icon:kl,label:"最后更新",value:c(l.last_know)})]})]}),e.jsx(xt,{children:e.jsx(C,{onClick:()=>i(!1),children:"关闭"})})]})})}function _l({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:B("text-sm",c&&"font-mono",!i&&"text-muted-foreground"),children:i||"-"})]})}function A4({person:l,open:n,onOpenChange:i,onSuccess:c}){const[u,x]=m.useState({}),[h,f]=m.useState(!1),{toast:p}=Ws();m.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 S4(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(Ks,{open:n,onOpenChange:i,children:e.jsxs(Ps,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Hs,{children:[e.jsx(Gs,{children:"编辑人物信息"}),e.jsxs(ot,{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(ie,{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(ie,{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(et,{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(Ge,{id:"is_known",checked:u.is_known,onCheckedChange:N=>x({...u,is_known:N})})]})]}),e.jsxs(xt,{children:[e.jsx(C,{variant:"outline",onClick:()=>i(!1),children:"取消"}),e.jsx(C,{onClick:g,disabled:h,children:h?"保存中...":"保存"})]})]})}):null}var z4=b1();const gg=d0(z4),Km="/api/webui";async function D4(l=100,n="all"){const i=`${Km}/knowledge/graph?limit=${l}&node_type=${n}`,c=await fetch(i);if(!c.ok)throw new Error(`获取知识图谱失败: ${c.status}`);return c.json()}async function O4(){const l=await fetch(`${Km}/knowledge/stats`);if(!l.ok)throw new Error("获取知识图谱统计信息失败");return l.json()}async function R4(l){const n=await fetch(`${Km}/knowledge/search?query=${encodeURIComponent(l)}`);if(!n.ok)throw new Error("搜索知识节点失败");return n.json()}const fv=m.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(Mo,{type:"target",position:Ao.Top}),e.jsx("div",{className:"font-semibold text-white text-sm truncate max-w-[200px]",title:l.content,children:l.label}),e.jsx(Mo,{type:"source",position:Ao.Bottom})]}));fv.displayName="EntityNode";const pv=m.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(Mo,{type:"target",position:Ao.Top}),e.jsx("div",{className:"font-medium text-white text-xs truncate max-w-[150px]",title:l.content,children:l.label}),e.jsx(Mo,{type:"source",position:Ao.Bottom})]}));pv.displayName="ParagraphNode";const L4={entity:fv,paragraph:pv};function U4(l,n){const i=new gg.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)}),gg.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 B4(){const l=aa(),[n,i]=m.useState(!1),[c,u]=m.useState(null),[x,h]=m.useState(""),[f,p]=m.useState("all"),[g,N]=m.useState(50),[v,b]=m.useState("50"),[w,y]=m.useState(!1),[R,D]=m.useState(!0),[k,I]=m.useState(!1),[M,S]=m.useState(!1),[T,$,A]=y1([]),[Q,G,de]=w1([]),[oe,ve]=m.useState(0),[le,fe]=m.useState(null),[ge,z]=m.useState(null),{toast:V}=Ws(),U=m.useCallback(Z=>Z.type==="entity"?"#6366f1":Z.type==="paragraph"?"#10b981":"#6b7280",[]),L=m.useCallback(async(Z=!1)=>{try{if(!Z&&g>200){S(!0);return}i(!0);const[xe,Me]=await Promise.all([D4(g,f),O4()]);if(u(Me),xe.nodes.length===0){V({title:"提示",description:"知识库为空,请先导入知识数据"}),$([]),G([]);return}const{nodes:J,edges:ce}=U4(xe.nodes,xe.edges);$(J),G(ce),ve(J.length),Me&&Me.total_nodes>g&&V({title:"提示",description:`知识图谱包含 ${Me.total_nodes} 个节点,当前显示 ${J.length} 个`}),V({title:"加载成功",description:`已加载 ${J.length} 个节点,${ce.length} 条边`})}catch(xe){console.error("加载知识图谱失败:",xe),V({title:"加载失败",description:xe instanceof Error?xe.message:"未知错误",variant:"destructive"})}finally{i(!1)}},[g,f,V]),P=m.useCallback(async()=>{if(!x.trim()){V({title:"提示",description:"请输入搜索关键词"});return}try{const Z=await R4(x);if(Z.length===0){V({title:"未找到",description:"没有找到匹配的节点"});return}const xe=new Set(Z.map(Me=>Me.id));$(Me=>Me.map(J=>({...J,style:{...J.style,opacity:xe.has(J.id)?1:.3,filter:xe.has(J.id)?"brightness(1.2)":"brightness(0.8)"}}))),V({title:"搜索完成",description:`找到 ${Z.length} 个匹配节点`})}catch(Z){console.error("搜索失败:",Z),V({title:"搜索失败",description:Z instanceof Error?Z.message:"未知错误",variant:"destructive"})}},[x,V]),_e=m.useCallback(()=>{$(Z=>Z.map(xe=>({...xe,style:{...xe.style,opacity:1,filter:"brightness(1)"}})))},[]),je=m.useCallback(()=>{D(!1),I(!0),L()},[L]),Se=m.useCallback(()=>{S(!1),setTimeout(()=>{L(!0)},0)},[L]),Y=m.useCallback((Z,xe)=>{T.find(J=>J.id===xe.id)&&fe({id:xe.id,type:xe.type,content:xe.data.content})},[T]);m.useEffect(()=>{R||k&&L()},[g,f,R,k]);const be=m.useCallback((Z,xe)=>{const Me=T.find(Fe=>Fe.id===xe.source),J=T.find(Fe=>Fe.id===xe.target),ce=Q.find(Fe=>Fe.id===xe.id);Me&&J&&ce&&z({source:{id:Me.id,type:Me.type,content:Me.data.content},target:{id:J.id,type:J.type,content:J.data.content},edge:{source:xe.source,target:xe.target,weight:parseFloat(xe.label||"0")}})},[T,Q]);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(Ae,{variant:"outline",className:"gap-1",children:[e.jsx(zr,{className:"h-3 w-3"}),"节点: ",c.total_nodes]}),e.jsxs(Ae,{variant:"outline",className:"gap-1",children:[e.jsx(yj,{className:"h-3 w-3"}),"边: ",c.total_edges]}),e.jsxs(Ae,{variant:"outline",className:"gap-1",children:[e.jsx(qt,{className:"h-3 w-3"}),"实体: ",c.entity_nodes]}),e.jsxs(Ae,{variant:"outline",className:"gap-1",children:[e.jsx(qa,{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(ie,{placeholder:"搜索节点内容...",value:x,onChange:Z=>h(Z.target.value),onKeyDown:Z=>Z.key==="Enter"&&P(),className:"flex-1"}),e.jsx(C,{onClick:P,size:"sm",children:e.jsx(Vt,{className:"h-4 w-4"})}),e.jsx(C,{onClick:_e,variant:"outline",size:"sm",children:"重置"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(Be,{value:f,onValueChange:Z=>p(Z),children:[e.jsx(Le,{className:"w-[120px]",children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"all",children:"全部节点"}),e.jsx(ae,{value:"entity",children:"仅实体"}),e.jsx(ae,{value:"paragraph",children:"仅段落"})]})]}),e.jsxs(Be,{value:g===1e4?"all":w?"custom":g.toString(),onValueChange:Z=>{Z==="custom"?(y(!0),b(g.toString())):Z==="all"?(y(!1),N(1e4)):(y(!1),N(Number(Z)))},children:[e.jsx(Le,{className:"w-[120px]",children:e.jsx($e,{})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"50",children:"50 节点"}),e.jsx(ae,{value:"100",children:"100 节点"}),e.jsx(ae,{value:"200",children:"200 节点"}),e.jsx(ae,{value:"500",children:"500 节点"}),e.jsx(ae,{value:"1000",children:"1000 节点"}),e.jsx(ae,{value:"all",children:"全部 (最多10000)"}),e.jsx(ae,{value:"custom",children:"自定义..."})]})]}),w&&e.jsx(ie,{type:"number",min:"50",value:v,onChange:Z=>b(Z.target.value),onBlur:()=>{const Z=parseInt(v);!isNaN(Z)&&Z>=50?N(Z):(b("50"),N(50))},onKeyDown:Z=>{if(Z.key==="Enter"){const xe=parseInt(v);!isNaN(xe)&&xe>=50?N(xe):(b("50"),N(50))}},placeholder:"最少50个",className:"w-[120px]"}),e.jsx(C,{onClick:()=>L(),variant:"outline",size:"sm",disabled:n,children:e.jsx(kt,{className:B("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(kt,{className:"h-8 w-8 animate-spin mx-auto mb-2 text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground",children:"加载知识图谱中..."})]})}):T.length===0?e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(zr,{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(_1,{nodes:T,edges:Q,onNodesChange:A,onEdgesChange:de,onNodeClick:Y,onEdgeClick:be,nodeTypes:L4,fitView:!0,minZoom:.05,maxZoom:1.5,defaultViewport:{x:0,y:0,zoom:.5},elevateNodesOnSelect:oe<=500,nodesDraggable:oe<=1e3,attributionPosition:"bottom-left",children:[e.jsx(S1,{variant:k1.Dots,gap:12,size:1}),e.jsx(C1,{}),oe<=500&&e.jsx(T1,{nodeColor:U,nodeBorderRadius:8,pannable:!0,zoomable:!0}),e.jsxs(E1,{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:"段落节点"})]}),oe>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:"已禁用动画"}),oe>500&&e.jsx("div",{children:"已禁用缩略图"})]})]})]})]})}),e.jsx(Ks,{open:!!le,onOpenChange:Z=>!Z&&fe(null),children:e.jsxs(Ps,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsx(Hs,{children:e.jsx(Gs,{children:"节点详情"})}),le&&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(Ae,{variant:le.type==="entity"?"default":"secondary",children:le.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:le.id})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"内容"}),e.jsx(es,{className:"mt-1 h-40 p-3 bg-muted rounded",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:le.content})})]})]})]})}),e.jsx(Ks,{open:!!ge,onOpenChange:Z=>!Z&&z(null),children:e.jsxs(Ps,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[e.jsx(Hs,{children:e.jsx(Gs,{children:"边详情"})}),ge&&e.jsx(es,{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(Ae,{variant:"outline",className:"text-base font-mono",children:ge.edge.weight.toFixed(4)})})]})]})})]})}),e.jsx(ps,{open:R,onOpenChange:D,children:e.jsxs(os,{children:[e.jsxs(ds,{children:[e.jsx(ms,{children:"加载知识图谱"}),e.jsxs(xs,{children:["知识图谱的动态展示会消耗较多系统资源。",e.jsx("br",{}),"确定要加载知识图谱吗?"]})]}),e.jsxs(us,{children:[e.jsx(fs,{onClick:()=>l({to:"/"}),children:"取消 (返回首页)"}),e.jsx(hs,{onClick:je,children:"确认加载"})]})]})}),e.jsx(ps,{open:M,onOpenChange:S,children:e.jsxs(os,{children:[e.jsxs(ds,{children:[e.jsx(ms,{children:"⚠️ 节点数量较多"}),e.jsx(xs,{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(us,{children:[e.jsx(fs,{onClick:()=>{S(!1),g>200&&(N(50),y(!1))},children:"取消"}),e.jsx(hs,{onClick:Se,className:"bg-orange-600 hover:bg-orange-700",children:"我了解风险,继续加载"})]})]})})]})}function $4(){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(De,{children:[e.jsxs(Xe,{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(zr,{className:"h-10 w-10 text-primary"})}),e.jsx(We,{className:"text-2xl",children:"麦麦知识库管理"}),e.jsx(Is,{className:"text-base",children:"功能开发中,敬请期待"})]}),e.jsx(Qe,{className:"text-center text-sm text-muted-foreground",children:e.jsx("p",{children:"此功能将提供知识库的创建、编辑、导入和管理能力"})})]})})})]})}function jg({className:l,classNames:n,showOutsideDays:i=!0,captionLayout:c="label",buttonVariant:u="ghost",formatters:x,components:h,...f}){const p=$j();return e.jsx(h1,{showOutsideDays:i,className:B("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:B("w-fit",p.root),months:B("relative flex flex-col gap-4 md:flex-row",p.months),month:B("flex w-full flex-col gap-4",p.month),nav:B("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",p.nav),button_previous:B(Rr({variant:u}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",p.button_previous),button_next:B(Rr({variant:u}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",p.button_next),month_caption:B("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",p.month_caption),dropdowns:B("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",p.dropdowns),dropdown_root:B("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:B("bg-popover absolute inset-0 opacity-0",p.dropdown),caption_label:B("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:B("flex",p.weekdays),weekday:B("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",p.weekday),week:B("mt-2 flex w-full",p.week),week_number_header:B("w-[--cell-size] select-none",p.week_number_header),week_number:B("text-muted-foreground select-none text-[0.8rem]",p.week_number),day:B("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:B("bg-accent rounded-l-md",p.range_start),range_middle:B("rounded-none",p.range_middle),range_end:B("bg-accent rounded-r-md",p.range_end),today:B("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",p.today),outside:B("text-muted-foreground aria-selected:text-muted-foreground",p.outside),disabled:B("text-muted-foreground opacity-50",p.disabled),hidden:B("invisible",p.hidden),...n},components:{Root:({className:g,rootRef:N,...v})=>e.jsx("div",{"data-slot":"calendar",ref:N,className:B(g),...v}),Chevron:({className:g,orientation:N,...v})=>N==="left"?e.jsx(ll,{className:B("size-4",g),...v}):N==="right"?e.jsx(Sa,{className:B("size-4",g),...v}):e.jsx($a,{className:B("size-4",g),...v}),DayButton:I4,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 I4({className:l,day:n,modifiers:i,...c}){const u=$j(),x=m.useRef(null);return m.useEffect(()=>{i.focused&&x.current?.focus()},[i.focused]),e.jsx(C,{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:B("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 No={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 P4(){const[l,n]=m.useState([]),[i,c]=m.useState(""),[u,x]=m.useState("all"),[h,f]=m.useState("all"),[p,g]=m.useState(void 0),[N,v]=m.useState(void 0),[b,w]=m.useState(!0),[y,R]=m.useState(!1),[D,k]=m.useState("xs"),[I,M]=m.useState(4),[S,T]=m.useState(!1),$=m.useRef(null);m.useEffect(()=>{const P=Mn.getAllLogs();n(P);const _e=Mn.onLog(()=>{n(Mn.getAllLogs())}),je=Mn.onConnectionChange(Se=>{R(Se)});return()=>{_e(),je()}},[]);const A=m.useMemo(()=>{const P=new Set(l.map(_e=>_e.module).filter(_e=>_e&&_e.trim()!==""));return Array.from(P).sort()},[l]),Q=P=>{switch(P){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"}},G=P=>{switch(P){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"}},de=()=>{window.location.reload()},oe=()=>{Mn.clearLogs(),n([])},ve=()=>{const P=ge.map(Y=>`${Y.timestamp} [${Y.level.padEnd(8)}] [${Y.module}] ${Y.message}`).join(` -`),_e=new Blob([P],{type:"text/plain;charset=utf-8"}),je=URL.createObjectURL(_e),Se=document.createElement("a");Se.href=je,Se.download=`logs-${cm(new Date,"yyyy-MM-dd-HHmmss")}.txt`,Se.click(),URL.revokeObjectURL(je)},le=()=>{w(!b)},fe=()=>{g(void 0),v(void 0)},ge=m.useMemo(()=>l.filter(P=>{const _e=i===""||P.message.toLowerCase().includes(i.toLowerCase())||P.module.toLowerCase().includes(i.toLowerCase()),je=u==="all"||P.level===u,Se=h==="all"||P.module===h;let Y=!0;if(p||N){const be=new Date(P.timestamp);if(p){const Z=new Date(p);Z.setHours(0,0,0,0),Y=Y&&be>=Z}if(N){const Z=new Date(N);Z.setHours(23,59,59,999),Y=Y&&be<=Z}}return _e&&je&&Se&&Y}),[l,i,u,h,p,N]),z=No[D].rowHeight+I,V=s0({count:ge.length,getScrollElement:()=>$.current,estimateSize:()=>z,overscan:50}),U=m.useRef(!1),L=m.useRef(ge.length);return m.useEffect(()=>{const P=$.current;if(!P)return;const _e=()=>{if(U.current)return;const{scrollTop:je,scrollHeight:Se,clientHeight:Y}=P,be=Se-je-Y;be>100&&b?w(!1):be<50&&!b&&w(!0)};return P.addEventListener("scroll",_e,{passive:!0}),()=>P.removeEventListener("scroll",_e)},[b]),m.useEffect(()=>{const P=ge.length>L.current;L.current=ge.length,b&&ge.length>0&&P&&(U.current=!0,V.scrollToIndex(ge.length-1,{align:"end",behavior:"auto"}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{U.current=!1})}))},[ge.length,b,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:B("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(De,{className:"p-2 sm:p-3",children:e.jsx(Ki,{open:S,onOpenChange:T,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(Vt,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),e.jsx(ie,{placeholder:"搜索日志...",value:i,onChange:P=>c(P.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(C,{variant:b?"default":"outline",size:"sm",onClick:le,className:"h-8 px-2",title:b?"自动滚动":"已暂停",children:[b?e.jsx(Gw,{className:"h-3.5 w-3.5"}):e.jsx(Fw,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"ml-1 text-xs hidden sm:inline",children:b?"滚动":"暂停"})]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:oe,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(C,{variant:"outline",size:"sm",onClick:ve,className:"h-8 px-2 hidden sm:flex",title:"导出日志",children:[e.jsx(Xt,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"ml-1 text-xs hidden lg:inline",children:"导出"})]}),e.jsx(Qi,{asChild:!0,children:e.jsxs(C,{variant:"outline",size:"sm",className:"h-8 px-2",title:S?"收起筛选":"展开筛选",children:[e.jsx(yo,{className:"h-3.5 w-3.5"}),S?e.jsx(Dr,{className:"h-3.5 w-3.5 ml-1"}):e.jsx($a,{className:"h-3.5 w-3.5 ml-1"})]})})]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground text-center sm:text-right -mt-1",children:[e.jsxs("span",{className:"font-mono",children:[ge.length," / ",l.length]}),e.jsx("span",{className:"ml-1",children:"条日志"})]}),e.jsxs(Yi,{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-2",children:[e.jsxs(Be,{value:u,onValueChange:x,children:[e.jsxs(Le,{className:"w-full sm:flex-1 h-8 text-xs",children:[e.jsx(yo,{className:"h-3.5 w-3.5 mr-1.5"}),e.jsx($e,{placeholder:"级别"})]}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"all",children:"全部级别"}),e.jsx(ae,{value:"DEBUG",children:"DEBUG"}),e.jsx(ae,{value:"INFO",children:"INFO"}),e.jsx(ae,{value:"WARNING",children:"WARNING"}),e.jsx(ae,{value:"ERROR",children:"ERROR"}),e.jsx(ae,{value:"CRITICAL",children:"CRITICAL"})]})]}),e.jsxs(Be,{value:h,onValueChange:f,children:[e.jsxs(Le,{className:"w-full sm:flex-1 h-8 text-xs",children:[e.jsx(yo,{className:"h-3.5 w-3.5 mr-1.5"}),e.jsx($e,{placeholder:"模块"})]}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"all",children:"全部模块"}),A.map(P=>e.jsx(ae,{value:P,children:P},P))]})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-2",children:[e.jsxs(tl,{children:[e.jsx(al,{asChild:!0,children:e.jsxs(C,{variant:"outline",size:"sm",className:B("w-full sm:flex-1 justify-start text-left font-normal h-8",!p&&"text-muted-foreground"),children:[e.jsx(Vp,{className:"mr-1.5 h-3.5 w-3.5"}),e.jsx("span",{className:"text-xs",children:p?cm(p,"PP",{locale:jo}):"开始日期"})]})}),e.jsx(Ka,{className:"w-auto p-0",align:"start",children:e.jsx(jg,{mode:"single",selected:p,onSelect:g,initialFocus:!0,locale:jo})})]}),e.jsxs(tl,{children:[e.jsx(al,{asChild:!0,children:e.jsxs(C,{variant:"outline",size:"sm",className:B("w-full sm:flex-1 justify-start text-left font-normal h-8",!N&&"text-muted-foreground"),children:[e.jsx(Vp,{className:"mr-1.5 h-3.5 w-3.5"}),e.jsx("span",{className:"text-xs",children:N?cm(N,"PP",{locale:jo}):"结束日期"})]})}),e.jsx(Ka,{className:"w-auto p-0",align:"start",children:e.jsx(jg,{mode:"single",selected:N,onSelect:v,initialFocus:!0,locale:jo})})]}),(p||N)&&e.jsxs(C,{variant:"outline",size:"sm",onClick:fe,className:"w-full sm:w-auto h-8",children:[e.jsx(_a,{className:"h-3.5 w-3.5 sm:mr-1"}),e.jsx("span",{className:"text-xs",children:"清除"})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3 pt-2 border-t border-border/50",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(qw,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"字号"})]}),e.jsx("div",{className:"flex gap-1",children:Object.keys(No).map(P=>e.jsx(C,{variant:D===P?"default":"outline",size:"sm",onClick:()=>k(P),className:"h-6 px-2 text-xs",children:No[P].label},P))})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-1 max-w-[200px]",children:[e.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:"行距"}),e.jsx(wa,{value:[I],onValueChange:([P])=>M(P),min:0,max:12,step:2,className:"flex-1"}),e.jsxs("span",{className:"text-xs text-muted-foreground w-7",children:[I,"px"]})]}),e.jsxs("div",{className:"flex gap-2 sm:hidden",children:[e.jsxs(C,{variant:"outline",size:"sm",onClick:de,className:"flex-1 h-8",children:[e.jsx(kt,{className:"h-3.5 w-3.5 mr-1"}),e.jsx("span",{className:"text-xs",children:"刷新"})]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:ve,className:"flex-1 h-8",children:[e.jsx(Xt,{className:"h-3.5 w-3.5 mr-1"}),e.jsx("span",{className:"text-xs",children:"导出"})]})]})]})]})]})})})]}),e.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(De,{className:"bg-black dark:bg-gray-950 border-gray-800 dark:border-gray-900 h-full overflow-hidden",children:e.jsx("div",{ref:$,className:B("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:B("p-2 sm:p-3 font-mono relative",No[D].class),style:{height:`${V.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:"暂无日志数据"}):V.getVirtualItems().map(P=>{const _e=ge[P.index];return e.jsxs("div",{"data-index":P.index,ref:V.measureElement,className:B("absolute top-0 left-0 w-full px-2 sm:px-3 rounded hover:bg-white/5 transition-colors",G(_e.level)),style:{transform:`translateY(${P.start}px)`,paddingTop:`${I/2}px`,paddingBottom:`${I/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:B("font-semibold text-[10px]",Q(_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:B("flex-shrink-0 w-[65px] lg:w-[75px] font-semibold",Q(_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})]})]},P.key)})})})})})]})}const H4="Mai-with-u",G4="plugin-repo",F4="main",q4="plugin_details.json";async function V4(){try{const l=await we("/api/webui/plugins/fetch-raw",{method:"POST",body:JSON.stringify({owner:H4,repo:G4,branch:F4,file_path:q4})});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 gv(){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 jv(){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 vv(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 K4(){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 Q4(l,n){const i=await K4();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 Sl(){try{const l=await we("/api/webui/plugins/installed",{headers:Us()});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 nn(l,n){return n.some(i=>i.id===l)}function rn(l,n){const i=n.find(c=>c.id===l);if(i)return i.manifest?.version||i.version}async function Nv(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 bv(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 yv(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 Y4(l){const n=await we(`/api/webui/plugins/config/${l}/schema`,{headers:Us()});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 J4(l){const n=await we(`/api/webui/plugins/config/${l}`,{headers:Us()});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 X4(l){const n=await we(`/api/webui/plugins/config/${l}/raw`,{headers:Us()});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 Z4(l,n){const i=await we(`/api/webui/plugins/config/${l}`,{method:"PUT",headers:Us(),body:JSON.stringify({config:n})});if(!i.ok){const c=await i.json();throw new Error(c.detail||"保存配置失败")}return await i.json()}async function W4(l,n){const i=await we(`/api/webui/plugins/config/${l}/raw`,{method:"PUT",headers:Us(),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:Us()});if(!n.ok){const i=await n.json();throw new Error(i.detail||"重置配置失败")}return await n.json()}async function sk(l){const n=await we(`/api/webui/plugins/config/${l}/toggle`,{method:"POST",headers:Us()});if(!n.ok){const i=await n.json();throw new Error(i.detail||"切换状态失败")}return await n.json()}const Wi="https://maibot-plugin-stats.maibot-webui.workers.dev";async function wv(l){try{const n=await fetch(`${Wi}/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 tk(l,n){try{const i=n||Qm(),c=await fetch(`${Wi}/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||Qm(),c=await fetch(`${Wi}/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 lk(l,n,i,c){if(n<1||n>5)return{success:!1,error:"评分必须在 1-5 之间"};try{const u=c||Qm(),x=await fetch(`${Wi}/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 _v(l){try{const n=await fetch(`${Wi}/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 nk(){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 Oe=>{try{const me=await wv(Oe.id);return{id:Oe.id,stats:me}}catch(me){return console.warn(`Failed to load stats for ${Oe.id}:`,me),{id:Oe.id,stats:null}}}),ke=await Promise.all(ee),Te={};ke.forEach(({id:Oe,stats:me})=>{me&&(Te[Oe]=me)}),G(Te)};m.useEffect(()=>{let q=null,ee=!1;return(async()=>{if(q=await Q4(Te=>{ee||(S(Te),Te.stage==="success"?setTimeout(()=>{ee||S(null)},2e3):Te.stage==="error"&&(y(!1),D(Te.error||"加载失败")))},Te=>{console.error("WebSocket error:",Te),ee||je({title:"WebSocket 连接失败",description:"无法实时显示加载进度",variant:"destructive"})}),await new Promise(Te=>{if(!q){Te();return}const Oe=()=>{q&&q.readyState===WebSocket.OPEN?(console.log("WebSocket connected, starting to load plugins"),Te()):q&&q.readyState===WebSocket.CLOSED?(console.warn("WebSocket closed before loading plugins"),Te()):setTimeout(Oe,100)};Oe()}),!ee){const Te=await gv();I(Te),Te.installed||je({title:"Git 未安装",description:Te.error||"请先安装 Git 才能使用插件安装功能",variant:"destructive"})}if(!ee){const Te=await jv();$(Te)}if(!ee)try{y(!0),D(null);const Te=await V4();if(!ee){const Oe=await Sl();A(Oe);const me=Te.map(ze=>{const rs=nn(ze.id,Oe),Kt=rn(ze.id,Oe);return{...ze,installed:rs,installed_version:Kt}});for(const ze of Oe)!me.some(Kt=>Kt.id===ze.id)&&ze.manifest&&me.push({id:ze.id,manifest:{manifest_version:ze.manifest.manifest_version||1,name:ze.manifest.name,version:ze.manifest.version,description:ze.manifest.description||"",author:ze.manifest.author,license:ze.manifest.license||"Unknown",host_application:ze.manifest.host_application,homepage_url:ze.manifest.homepage_url,repository_url:ze.manifest.repository_url,keywords:ze.manifest.keywords||[],categories:ze.manifest.categories||[],default_locale:ze.manifest.default_locale||"zh-CN",locales_path:ze.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!0,installed_version:ze.manifest.version,published_at:new Date().toISOString(),updated_at:new Date().toISOString()});b(me),Se(me)}}catch(Te){if(!ee){const Oe=Te instanceof Error?Te.message:"加载插件列表失败";D(Oe),je({title:"加载失败",description:Oe,variant:"destructive"})}}finally{ee||y(!1)}})(),()=>{ee=!0,q&&q.close()}},[je]);const Y=q=>{if(!q.installed&&T&&!be(q))return e.jsxs(Ae,{variant:"destructive",className:"gap-1",children:[e.jsx(Ct,{className:"h-3 w-3"}),"不兼容"]});if(q.installed){const ee=q.installed_version?.trim(),ke=q.manifest.version?.trim();if(ee!==ke){const Te=ee?.split(".").map(Number)||[0,0,0],Oe=ke?.split(".").map(Number)||[0,0,0];for(let me=0;me<3;me++){if((Oe[me]||0)>(Te[me]||0))return e.jsxs(Ae,{variant:"outline",className:"gap-1 text-orange-600 border-orange-600",children:[e.jsx(Ct,{className:"h-3 w-3"}),"可更新"]});if((Oe[me]||0)<(Te[me]||0))break}}return e.jsxs(Ae,{variant:"default",className:"gap-1",children:[e.jsx(ea,{className:"h-3 w-3"}),"已安装"]})}return null},be=q=>!T||!q.manifest?.host_application?!0:vv(q.manifest.host_application.min_version,q.manifest.host_application.max_version,T),Z=q=>{if(!q.installed||!q.installed_version||!q.manifest?.version)return!1;const ee=q.installed_version.trim(),ke=q.manifest.version.trim();if(ee===ke)return!1;const Te=ee.split(".").map(Number),Oe=ke.split(".").map(Number);for(let me=0;me<3;me++){if((Oe[me]||0)>(Te[me]||0))return!0;if((Oe[me]||0)<(Te[me]||0))return!1}return!1},xe=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(me=>me.toLowerCase().includes(c.toLowerCase())),ke=x==="all"||q.manifest.categories&&q.manifest.categories.includes(x);let Te=!0;f==="installed"?Te=q.installed===!0:f==="updates"&&(Te=q.installed===!0&&Z(q));const Oe=!g||!T||be(q);return ee&&ke&&Te&&Oe}),Me=q=>{if(!k?.installed){je({title:"无法安装",description:"Git 未安装",variant:"destructive"});return}if(T&&!be(q)){je({title:"无法安装",description:"插件与当前麦麦版本不兼容",variant:"destructive"});return}le(q),ge("main"),V(""),L("preset"),_e(!1),oe(!0)},J=async()=>{if(!ve)return;const q=U==="custom"?z:fe;if(!q||q.trim()===""){je({title:"分支名称不能为空",variant:"destructive"});return}try{oe(!1),await Nv(ve.id,ve.manifest.repository_url||"",q),_v(ve.id).catch(ke=>{console.warn("Failed to record download:",ke)}),je({title:"安装成功",description:`${ve.manifest.name} 已成功安装`});const ee=await Sl();A(ee),b(ke=>ke.map(Te=>{if(Te.id===ve.id){const Oe=nn(Te.id,ee),me=rn(Te.id,ee);return{...Te,installed:Oe,installed_version:me}}return Te}))}catch(ee){je({title:"安装失败",description:ee instanceof Error?ee.message:"未知错误",variant:"destructive"})}finally{le(null)}},ce=async q=>{try{await bv(q.id),je({title:"卸载成功",description:`${q.manifest.name} 已成功卸载`});const ee=await Sl();A(ee),b(ke=>ke.map(Te=>{if(Te.id===q.id){const Oe=nn(Te.id,ee),me=rn(Te.id,ee);return{...Te,installed:Oe,installed_version:me}}return Te}))}catch(ee){je({title:"卸载失败",description:ee instanceof Error?ee.message:"未知错误",variant:"destructive"})}},Fe=async q=>{if(!k?.installed){je({title:"无法更新",description:"Git 未安装",variant:"destructive"});return}try{const ee=await yv(q.id,q.manifest.repository_url||"","main");je({title:"更新成功",description:`${q.manifest.name} 已从 ${ee.old_version} 更新到 ${ee.new_version}`});const ke=await Sl();A(ke),b(Te=>Te.map(Oe=>{if(Oe.id===q.id){const me=nn(Oe.id,ke),ze=rn(Oe.id,ke);return{...Oe,installed:me,installed_version:ze}}return Oe}))}catch(ee){je({title:"更新失败",description:ee instanceof Error?ee.message:"未知错误",variant:"destructive"})}};return e.jsx(es,{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(C,{variant:"outline",onClick:()=>n(),disabled:i,children:[e.jsx(wj,{className:`h-4 w-4 mr-2 ${i?"animate-spin":""}`}),"重启麦麦"]}),e.jsxs(C,{onClick:()=>l({to:"/plugin-mirrors"}),children:[e.jsx(Vw,{className:"h-4 w-4 mr-2"}),"配置镜像源"]})]})]}),e.jsx(De,{className:"border-blue-200 bg-blue-50 dark:bg-blue-950/20 dark:border-blue-900",children:e.jsx(Qe,{className:"py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(qt,{className:"h-4 w-4 text-blue-600 flex-shrink-0"}),e.jsxs("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:["安装、卸载或更新插件后,需要",e.jsx("span",{className:"font-semibold",children:"重启麦麦"}),"才能使更改生效"]})]})})}),k&&!k.installed&&e.jsxs(De,{className:"border-orange-600 bg-orange-50 dark:bg-orange-950/20",children:[e.jsx(Xe,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ft,{className:"h-5 w-5 text-orange-600"}),e.jsxs("div",{children:[e.jsx(We,{className:"text-lg text-orange-900 dark:text-orange-100",children:"Git 未安装"}),e.jsx(Is,{className:"text-orange-800 dark:text-orange-200",children:k.error||"请先安装 Git 才能使用插件安装功能"})]})]})}),e.jsx(Qe,{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(De,{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(Vt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ie,{placeholder:"搜索插件...",value:c,onChange:q=>u(q.target.value),className:"pl-9"})]}),e.jsxs(Be,{value:x,onValueChange:h,children:[e.jsx(Le,{className:"w-full sm:w-[200px]",children:e.jsx($e,{placeholder:"选择分类"})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"all",children:"全部分类"}),e.jsx(ae,{value:"Group Management",children:"群组管理"}),e.jsx(ae,{value:"Entertainment & Interaction",children:"娱乐互动"}),e.jsx(ae,{value:"Utility Tools",children:"实用工具"}),e.jsx(ae,{value:"Content Generation",children:"内容生成"}),e.jsx(ae,{value:"Multimedia",children:"多媒体"}),e.jsx(ae,{value:"External Integration",children:"外部集成"}),e.jsx(ae,{value:"Data Analysis & Insights",children:"数据分析与洞察"}),e.jsx(ae,{value:"Other",children:"其他"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Xs,{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(ma,{value:f,onValueChange:p,className:"w-full",children:e.jsxs(ta,{className:"grid w-full grid-cols-3",children:[e.jsxs(as,{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(Oe=>Oe.toLowerCase().includes(c.toLowerCase())),ke=x==="all"||q.manifest.categories&&q.manifest.categories.includes(x),Te=!g||!T||be(q);return ee&&ke&&Te}).length,")"]}),e.jsxs(as,{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(Oe=>Oe.toLowerCase().includes(c.toLowerCase())),ke=x==="all"||q.manifest.categories&&q.manifest.categories.includes(x),Te=!g||!T||be(q);return q.installed&&ee&&ke&&Te}).length,")"]}),e.jsxs(as,{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(Oe=>Oe.toLowerCase().includes(c.toLowerCase())),ke=x==="all"||q.manifest.categories&&q.manifest.categories.includes(x),Te=!g||!T||be(q);return q.installed&&Z(q)&&ee&&ke&&Te}).length,")"]})]})}),M&&M.stage==="loading"&&M.operation==="fetch"&&e.jsx(De,{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(zs,{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(Bn,{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(De,{className:"border-destructive bg-destructive/10",children:e.jsx(Xe,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ft,{className:"h-5 w-5 text-destructive"}),e.jsxs("div",{children:[e.jsx(We,{className:"text-lg text-destructive",children:"加载失败"}),e.jsx(Is,{className:"text-destructive/80",children:M.error})]})]})})}),w?e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(zs,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件列表中..."})]}):R?e.jsx(De,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Ft,{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(C,{onClick:()=>window.location.reload(),children:"重新加载"})]})}):xe.length===0?e.jsx(De,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Vt,{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:xe.map(q=>e.jsxs(De,{className:"flex flex-col hover:shadow-lg transition-shadow h-full",children:[e.jsxs(Xe,{children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx(We,{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(Ae,{variant:"secondary",className:"text-xs whitespace-nowrap",children:rk[q.manifest.categories[0]]||q.manifest.categories[0]}),Y(q)]})]}),e.jsx(Is,{className:"line-clamp-2",children:q.manifest?.description||"无描述"})]}),e.jsx(Qe,{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(Xt,{className:"h-4 w-4"}),e.jsx("span",{children:(Q[q.id]?.downloads??q.downloads??0).toLocaleString()})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(an,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),e.jsx("span",{children:(Q[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(Ae,{variant:"outline",className:"text-xs",children:ee},ee)),q.manifest?.keywords&&q.manifest.keywords.length>3&&e.jsxs(Ae,{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(Io,{className:"pt-4",children:e.jsxs("div",{className:"flex items-center justify-end gap-2 w-full",children:[e.jsx(C,{variant:"outline",size:"sm",onClick:()=>l({to:"/plugin-detail",search:{pluginId:q.id}}),children:"查看详情"}),q.installed?Z(q)?e.jsxs(C,{size:"sm",disabled:!k?.installed,title:k?.installed?void 0:"Git 未安装",onClick:()=>Fe(q),children:[e.jsx(kt,{className:"h-4 w-4 mr-1"}),"更新"]}):e.jsxs(C,{variant:"destructive",size:"sm",disabled:!k?.installed,title:k?.installed?void 0:"Git 未安装",onClick:()=>ce(q),children:[e.jsx(ls,{className:"h-4 w-4 mr-1"}),"卸载"]}):e.jsxs(C,{size:"sm",disabled:!k?.installed||M?.operation==="install"||T!==null&&!be(q),title:k?.installed?T!==null&&!be(q)?`不兼容当前版本 (需要 ${q.manifest?.host_application?.min_version||"未知"}${q.manifest?.host_application?.max_version?` - ${q.manifest.host_application.max_version}`:"+"},当前 ${T?.version})`:void 0:"Git 未安装",onClick:()=>Me(q),children:[e.jsx(Xt,{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(zs,{className:"h-3 w-3 animate-spin"}):M.stage==="success"?e.jsx(ea,{className:"h-3 w-3 text-green-600"}):e.jsx(Ct,{className:"h-3 w-3 text-red-600"}),e.jsx("span",{className:`text-xs font-medium ${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(Bn,{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(Ks,{open:de,onOpenChange:oe,children:e.jsxs(Ps,{children:[e.jsxs(Hs,{children:[e.jsx(Gs,{children:"安装插件"}),e.jsxs(ot,{children:["安装 ",ve?.manifest.name]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["版本: ",ve?.manifest.version]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["作者: ",typeof ve?.manifest.author=="string"?ve.manifest.author:ve?.manifest.author?.name]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Xs,{id:"advanced-options",checked:P,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:"高级选项"})]}),P&&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(ma,{value:U,onValueChange:q=>L(q),children:[e.jsxs(ta,{className:"grid w-full grid-cols-2",children:[e.jsx(as,{value:"preset",className:"text-xs",children:"预设分支"}),e.jsx(as,{value:"custom",className:"text-xs",children:"自定义分支"})]}),U==="preset"&&e.jsx("div",{className:"mt-3",children:e.jsxs(Be,{value:fe,onValueChange:ge,children:[e.jsx(Le,{children:e.jsx($e,{placeholder:"选择分支"})}),e.jsxs(Ue,{children:[e.jsx(ae,{value:"main",children:"main (默认)"}),e.jsx(ae,{value:"master",children:"master"}),e.jsx(ae,{value:"dev",children:"dev (开发版)"}),e.jsx(ae,{value:"develop",children:"develop"}),e.jsx(ae,{value:"beta",children:"beta (测试版)"}),e.jsx(ae,{value:"stable",children:"stable (稳定版)"})]})]})}),U==="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 分支名称、标签或提交哈希"})]})]})]})}),!P&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"将从默认分支 (main) 安装插件"})]}),e.jsxs(xt,{children:[e.jsx(C,{variant:"outline",onClick:()=>oe(!1),children:"取消"}),e.jsxs(C,{onClick:J,children:[e.jsx(Xt,{className:"h-4 w-4 mr-2"}),"安装"]})]})]})}),e.jsx(Hn,{})]})})}function ok(){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(_j,{className:"h-8 w-8",strokeWidth:2}),"模型分配预设市场"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"浏览和下载社区共享的模型分配预设配置"})]})})}),e.jsx(es,{className:"flex-1",children:e.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-12rem)]",children:e.jsxs(De,{className:"max-w-2xl w-full border-dashed",children:[e.jsxs(Xe,{className:"text-center",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx(Wt,{className:"h-16 w-16 text-muted-foreground"})}),e.jsx(We,{className:"text-2xl",children:"功能开发中"}),e.jsx(Is,{className:"text-base",children:"模型分配预设市场功能正在开发中,敬请期待!"})]}),e.jsx(Qe,{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 dk({field:l,value:n,onChange:i}){const[c,u]=m.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(Ge,{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(ie,{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(wa,{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(Be,{value:String(n??l.default),onValueChange:i,disabled:l.disabled,children:[e.jsx(Le,{children:e.jsx($e,{placeholder:l.placeholder??"请选择"})}),e.jsx(Ue,{children:l.choices?.map(x=>e.jsx(ae,{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(et,{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(ie,{type:c?"text":"password",value:n??"",onChange:x=>i(x.target.value),placeholder:l.placeholder,disabled:l.disabled,className:"pr-10"}),e.jsx(C,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3",onClick:()=>u(!c),children:c?e.jsx(Hi,{className:"h-4 w-4"}):e.jsx(sa,{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(f_,{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(ie,{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 vg({section:l,config:n,onChange:i}){const[c,u]=m.useState(!l.collapsed),x=Object.entries(l.fields).filter(([,h])=>!h.hidden).sort(([,h],[,f])=>h.order-f.order);return e.jsx(Ki,{open:c,onOpenChange:u,children:e.jsxs(De,{children:[e.jsx(Qi,{asChild:!0,children:e.jsxs(Xe,{className:"cursor-pointer hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[c?e.jsx($a,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(Sa,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(We,{className:"text-lg",children:l.title})]}),e.jsxs(Ae,{variant:"secondary",className:"text-xs",children:[x.length," 项"]})]}),l.description&&e.jsx(Is,{className:"ml-6",children:l.description})]})}),e.jsx(Yi,{children:e.jsx(Qe,{className:"space-y-4 pt-0",children:x.map(([h,f])=>e.jsx(dk,{field:f,value:n[l.name]?.[h],onChange:p=>i(l.name,h,p),sectionName:l.name},h))})})]})})}function uk({plugin:l,onBack:n}){const{toast:i}=Ws(),{triggerRestart:c,isRestarting:u}=dn(),[x,h]=m.useState("visual"),[f,p]=m.useState(null),[g,N]=m.useState({}),[v,b]=m.useState({}),[w,y]=m.useState(""),[R,D]=m.useState(""),[k,I]=m.useState(!0),[M,S]=m.useState(!1),[T,$]=m.useState(!1),[A,Q]=m.useState(!1),[G,de]=m.useState(!1),oe=m.useCallback(async()=>{I(!0);try{const[U,L,P]=await Promise.all([Y4(l.id),J4(l.id),X4(l.id)]);p(U),N(L),b(JSON.parse(JSON.stringify(L))),y(P),D(P)}catch(U){i({title:"加载配置失败",description:U instanceof Error?U.message:"未知错误",variant:"destructive"})}finally{I(!1)}},[l.id,i]);m.useEffect(()=>{oe()},[oe]),m.useEffect(()=>{$(x==="visual"?JSON.stringify(g)!==JSON.stringify(v):w!==R)},[g,v,w,R,x]);const ve=(U,L,P)=>{N(_e=>({..._e,[U]:{..._e[U]||{},[L]:P}}))},le=async()=>{S(!0);try{if(x==="source"){try{mv(w)}catch(U){Q(!0),i({title:"TOML 格式错误",description:U instanceof Error?U.message:"无法解析 TOML 配置,请检查语法",variant:"destructive"}),S(!1);return}await W4(l.id,w),D(w),Q(!1)}else await Z4(l.id,g),b(JSON.parse(JSON.stringify(g)));i({title:"配置已保存",description:"更改将在插件重新加载后生效"})}catch(U){i({title:"保存失败",description:U instanceof Error?U.message:"未知错误",variant:"destructive"})}finally{S(!1)}},fe=async()=>{try{await ek(l.id),i({title:"配置已重置",description:"下次加载插件时将使用默认配置"}),de(!1),oe()}catch(U){i({title:"重置失败",description:U instanceof Error?U.message:"未知错误",variant:"destructive"})}},ge=async()=>{try{const U=await sk(l.id);i({title:U.message,description:U.note}),oe()}catch(U){i({title:"切换状态失败",description:U instanceof Error?U.message:"未知错误",variant:"destructive"})}};if(k)return e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx(zs,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(!f)return e.jsxs("div",{className:"flex flex-col items-center justify-center h-64 space-y-4",children:[e.jsx(Ct,{className:"h-12 w-12 text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground",children:"无法加载配置"}),e.jsxs(C,{onClick:n,variant:"outline",children:[e.jsx(Va,{className:"h-4 w-4 mr-2"}),"返回"]})]});const z=Object.values(f.sections).sort((U,L)=>U.order-L.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(C,{variant:"ghost",size:"icon",onClick:n,children:e.jsx(Va,{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(Ae,{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(C,{variant:"outline",size:"sm",onClick:()=>h(x==="visual"?"source":"visual"),children:x==="visual"?e.jsxs(e.Fragment,{children:[e.jsx(vj,{className:"h-4 w-4 mr-2"}),"源代码"]}):e.jsxs(e.Fragment,{children:[e.jsx(jj,{className:"h-4 w-4 mr-2"}),"可视化"]})}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>c(),disabled:u,children:[e.jsx(wj,{className:`h-4 w-4 mr-2 ${u?"animate-spin":""}`}),"重启麦麦"]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:ge,children:[e.jsx(Ji,{className:"h-4 w-4 mr-2"}),V?"禁用":"启用"]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>de(!0),children:[e.jsx(Pi,{className:"h-4 w-4 mr-2"}),"重置"]}),e.jsxs(C,{size:"sm",onClick:le,disabled:!T||M,children:[M?e.jsx(zs,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(Xi,{className:"h-4 w-4 mr-2"}),"保存"]})]})]}),T&&e.jsx(De,{className:"border-orange-200 bg-orange-50 dark:bg-orange-950/20 dark:border-orange-900",children:e.jsx(Qe,{className:"py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(qt,{className:"h-4 w-4 text-orange-600"}),e.jsx("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:"有未保存的更改"})]})})}),x==="source"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(nt,{children:[e.jsx(Ct,{className:"h-4 w-4"}),e.jsxs(rt,{children:[e.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。保存时会验证格式,只有格式正确才能保存。",A&&e.jsx("span",{className:"text-destructive font-semibold ml-2",children:"⚠️ 上次保存失败,请检查 TOML 格式"})]})]}),e.jsx(ev,{value:w,onChange:U=>{y(U),A&&Q(!1)},language:"toml",theme:"dark",height:"calc(100vh - 350px)",minHeight:"500px",placeholder:"TOML 配置内容"})]}),x==="visual"&&e.jsxs(e.Fragment,{children:[e.jsxs(nt,{children:[e.jsx(qt,{className:"h-4 w-4"}),e.jsxs(rt,{children:[e.jsx("strong",{children:"提示:"}),"如果插件当前未加载或未启用,WebUI 适配器的高级插件可视化编辑功能可能会不可用。 请确保插件已启用并成功加载后,再进行配置编辑。"]})]}),f.layout.type==="tabs"&&f.layout.tabs.length>0?e.jsxs(ma,{defaultValue:f.layout.tabs[0]?.id,children:[e.jsx(ta,{children:f.layout.tabs.map(U=>e.jsxs(as,{value:U.id,children:[U.title,U.badge&&e.jsx(Ae,{variant:"secondary",className:"ml-2 text-xs",children:U.badge})]},U.id))}),f.layout.tabs.map(U=>e.jsx(ys,{value:U.id,className:"space-y-4 mt-4",children:U.sections.map(L=>{const P=f.sections[L];return P?e.jsx(vg,{section:P,config:g,onChange:ve},L):null})},U.id))]}):e.jsx("div",{className:"space-y-4",children:z.map(U=>e.jsx(vg,{section:U,config:g,onChange:ve},U.name))})]}),e.jsx(Ks,{open:G,onOpenChange:de,children:e.jsxs(Ps,{children:[e.jsxs(Hs,{children:[e.jsx(Gs,{children:"确认重置配置"}),e.jsx(ot,{children:"这将删除当前配置文件,下次加载插件时将使用默认配置。此操作不可撤销。"})]}),e.jsxs(xt,{children:[e.jsx(C,{variant:"outline",onClick:()=>de(!1),children:"取消"}),e.jsx(C,{variant:"destructive",onClick:fe,children:"确认重置"})]})]})})]})}function mk(){return e.jsx(Pn,{children:e.jsx(xk,{})})}function xk(){const{toast:l}=Ws(),[n,i]=m.useState([]),[c,u]=m.useState(!0),[x,h]=m.useState(""),[f,p]=m.useState(null),g=async()=>{u(!0);try{const y=await Sl();i(y)}catch(y){l({title:"加载插件列表失败",description:y instanceof Error?y.message:"未知错误",variant:"destructive"})}finally{u(!1)}};m.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,D)=>R===D.findIndex(k=>k.id===y.id)),b=n.length,w=0;return f?e.jsxs(e.Fragment,{children:[e.jsx(es,{className:"h-full",children:e.jsx("div",{className:"p-4 sm:p-6",children:e.jsx(uk,{plugin:f,onBack:()=>p(null)})})}),e.jsx(Hn,{})]}):e.jsx(es,{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(C,{variant:"outline",size:"sm",onClick:g,children:[e.jsx(kt,{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(De,{children:[e.jsxs(Xe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(We,{className:"text-sm font-medium",children:"已安装插件"}),e.jsx(Wt,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(Qe,{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(De,{children:[e.jsxs(Xe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(We,{className:"text-sm font-medium",children:"已启用"}),e.jsx(ea,{className:"h-4 w-4 text-green-600"})]}),e.jsxs(Qe,{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(De,{children:[e.jsxs(Xe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(We,{className:"text-sm font-medium",children:"已禁用"}),e.jsx(Ct,{className:"h-4 w-4 text-orange-600"})]}),e.jsxs(Qe,{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(Vt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ie,{placeholder:"搜索插件...",value:x,onChange:y=>h(y.target.value),className:"pl-9"})]}),e.jsxs(De,{children:[e.jsxs(Xe,{children:[e.jsx(We,{children:"已安装的插件"}),e.jsx(Is,{children:"点击插件查看和编辑配置"})]}),e.jsx(Qe,{children:c?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(zs,{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(Wt,{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(Wt,{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(Ae,{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(C,{variant:"ghost",size:"sm",children:e.jsx(In,{className:"h-4 w-4"})}),e.jsx(Sa,{className:"h-4 w-4 text-muted-foreground"})]})]},y.id))})})]})]})})}function hk(){const l=aa(),{toast:n}=Ws(),[i,c]=m.useState([]),[u,x]=m.useState(!0),[h,f]=m.useState(null),[p,g]=m.useState(null),[N,v]=m.useState(!1),[b,w]=m.useState(!1),[y,R]=m.useState({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),D=m.useCallback(async()=>{try{x(!0),f(null);const A=await we("/api/webui/plugins/mirrors");if(!A.ok)throw new Error("获取镜像源列表失败");const Q=await A.json();c(Q.mirrors||[])}catch(A){const Q=A instanceof Error?A.message:"加载镜像源失败";f(Q),n({title:"加载失败",description:Q,variant:"destructive"})}finally{x(!1)}},[n]);m.useEffect(()=>{D()},[D]);const k=async()=>{try{const A=await we("/api/webui/plugins/mirrors",{method:"POST",body:JSON.stringify(y)});if(!A.ok){const Q=await A.json();throw new Error(Q.detail||"添加镜像源失败")}n({title:"添加成功",description:"镜像源已添加"}),v(!1),R({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),D()}catch(A){n({title:"添加失败",description:A instanceof Error?A.message:"未知错误",variant:"destructive"})}},I=async()=>{if(p)try{if(!(await we(`/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),D()}catch(A){n({title:"更新失败",description:A instanceof Error?A.message:"未知错误",variant:"destructive"})}},M=async A=>{if(confirm("确定要删除这个镜像源吗?"))try{if(!(await we(`/api/webui/plugins/mirrors/${A}`,{method:"DELETE"})).ok)throw new Error("删除镜像源失败");n({title:"删除成功",description:"镜像源已删除"}),D()}catch(Q){n({title:"删除失败",description:Q instanceof Error?Q.message:"未知错误",variant:"destructive"})}},S=async A=>{try{if(!(await we(`/api/webui/plugins/mirrors/${A.id}`,{method:"PUT",body:JSON.stringify({enabled:!A.enabled})})).ok)throw new Error("更新状态失败");D()}catch(Q){n({title:"更新失败",description:Q instanceof Error?Q.message:"未知错误",variant:"destructive"})}},T=A=>{g(A),R({id:A.id,name:A.name,raw_prefix:A.raw_prefix,clone_prefix:A.clone_prefix,enabled:A.enabled,priority:A.priority}),w(!0)},$=async(A,Q)=>{const G=Q==="up"?A.priority-1:A.priority+1;if(!(G<1))try{if(!(await we(`/api/webui/plugins/mirrors/${A.id}`,{method:"PUT",body:JSON.stringify({priority:G})})).ok)throw new Error("更新优先级失败");D()}catch(de){n({title:"更新失败",description:de instanceof Error?de.message:"未知错误",variant:"destructive"})}};return e.jsx(es,{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(C,{variant:"ghost",size:"icon",onClick:()=>l({to:"/plugins"}),children:e.jsx(Va,{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(C,{onClick:()=>v(!0),children:[e.jsx(it,{className:"h-4 w-4 mr-2"}),"添加镜像源"]})]}),u?e.jsx(De,{className:"p-6",children:e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(zs,{className:"h-8 w-8 animate-spin text-primary"})})}):h?e.jsx(De,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Ft,{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(C,{onClick:D,children:"重新加载"})]})}):e.jsxs(De,{children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs(El,{children:[e.jsx(Ml,{children:e.jsxs(ct,{children:[e.jsx(Je,{children:"状态"}),e.jsx(Je,{children:"名称"}),e.jsx(Je,{children:"ID"}),e.jsx(Je,{children:"优先级"}),e.jsx(Je,{className:"text-right",children:"操作"})]})}),e.jsx(Al,{children:i.map(A=>e.jsxs(ct,{children:[e.jsx(He,{children:e.jsx(Ge,{checked:A.enabled,onCheckedChange:()=>S(A)})}),e.jsx(He,{children:e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:A.name}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Raw: ",A.raw_prefix]})]})}),e.jsx(He,{children:e.jsx(Ae,{variant:"outline",children:A.id})}),e.jsx(He,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-mono",children:A.priority}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(C,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>$(A,"up"),disabled:A.priority===1,children:e.jsx(Dr,{className:"h-3 w-3"})}),e.jsx(C,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>$(A,"down"),children:e.jsx($a,{className:"h-3 w-3"})})]})]})}),e.jsx(He,{className:"text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(C,{variant:"ghost",size:"icon",onClick:()=>T(A),children:e.jsx(On,{className:"h-4 w-4"})}),e.jsx(C,{variant:"ghost",size:"icon",onClick:()=>M(A.id),children:e.jsx(ls,{className:"h-4 w-4 text-destructive"})})]})})]},A.id))})]})}),e.jsx("div",{className:"md:hidden p-4 space-y-4",children:i.map(A=>e.jsx(De,{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:A.name}),A.enabled&&e.jsx(Ae,{variant:"default",className:"text-xs",children:"启用"})]}),e.jsx(Ae,{variant:"outline",className:"mt-1 text-xs",children:A.id})]}),e.jsx(Ge,{checked:A.enabled,onCheckedChange:()=>S(A)})]}),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:A.raw_prefix})]}),e.jsxs("div",{className:"text-muted-foreground",children:[e.jsx("span",{className:"font-medium",children:"优先级: "}),e.jsx("span",{className:"font-mono",children:A.priority})]})]}),e.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t",children:[e.jsxs(C,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>T(A),children:[e.jsx(On,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(C,{variant:"outline",size:"sm",onClick:()=>$(A,"up"),disabled:A.priority===1,children:e.jsx(Dr,{className:"h-4 w-4"})}),e.jsx(C,{variant:"outline",size:"sm",onClick:()=>$(A,"down"),children:e.jsx($a,{className:"h-4 w-4"})}),e.jsx(C,{variant:"destructive",size:"sm",onClick:()=>M(A.id),children:e.jsx(ls,{className:"h-4 w-4"})})]})]})},A.id))})]}),e.jsx(Ks,{open:N,onOpenChange:v,children:e.jsxs(Ps,{className:"max-w-lg",children:[e.jsxs(Hs,{children:[e.jsx(Gs,{children:"添加镜像源"}),e.jsx(ot,{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(ie,{id:"add-id",placeholder:"例如: my-mirror",value:y.id,onChange:A=>R({...y,id:A.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"add-name",children:"名称 *"}),e.jsx(ie,{id:"add-name",placeholder:"例如: 我的镜像源",value:y.name,onChange:A=>R({...y,name:A.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"add-raw",children:"Raw 文件前缀 *"}),e.jsx(ie,{id:"add-raw",placeholder:"https://example.com/raw",value:y.raw_prefix,onChange:A=>R({...y,raw_prefix:A.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"add-clone",children:"克隆前缀 *"}),e.jsx(ie,{id:"add-clone",placeholder:"https://example.com/clone",value:y.clone_prefix,onChange:A=>R({...y,clone_prefix:A.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"add-priority",children:"优先级"}),e.jsx(ie,{id:"add-priority",type:"number",min:"1",value:y.priority,onChange:A=>R({...y,priority:parseInt(A.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:A=>R({...y,enabled:A})}),e.jsx(E,{htmlFor:"add-enabled",children:"启用此镜像源"})]})]}),e.jsxs(xt,{children:[e.jsx(C,{variant:"outline",onClick:()=>v(!1),children:"取消"}),e.jsx(C,{onClick:k,children:"添加"})]})]})}),e.jsx(Ks,{open:b,onOpenChange:w,children:e.jsxs(Ps,{className:"max-w-lg",children:[e.jsxs(Hs,{children:[e.jsx(Gs,{children:"编辑镜像源"}),e.jsx(ot,{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(ie,{value:y.id,disabled:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"edit-name",children:"名称 *"}),e.jsx(ie,{id:"edit-name",value:y.name,onChange:A=>R({...y,name:A.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"edit-raw",children:"Raw 文件前缀 *"}),e.jsx(ie,{id:"edit-raw",value:y.raw_prefix,onChange:A=>R({...y,raw_prefix:A.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"edit-clone",children:"克隆前缀 *"}),e.jsx(ie,{id:"edit-clone",value:y.clone_prefix,onChange:A=>R({...y,clone_prefix:A.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{htmlFor:"edit-priority",children:"优先级"}),e.jsx(ie,{id:"edit-priority",type:"number",min:"1",value:y.priority,onChange:A=>R({...y,priority:parseInt(A.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:A=>R({...y,enabled:A})}),e.jsx(E,{htmlFor:"edit-enabled",children:"启用此镜像源"})]})]}),e.jsxs(xt,{children:[e.jsx(C,{variant:"outline",onClick:()=>w(!1),children:"取消"}),e.jsx(C,{onClick:I,children:"保存"})]})]})})]})})}function fk({pluginId:l,compact:n=!1}){const[i,c]=m.useState(null),[u,x]=m.useState(!0),[h,f]=m.useState(0),[p,g]=m.useState(""),[N,v]=m.useState(!1),{toast:b}=Ws(),w=async()=>{x(!0);const k=await wv(l);k&&c(k),x(!1)};m.useEffect(()=>{w()},[l]);const y=async()=>{const k=await tk(l);k.success?(b({title:"已点赞",description:"感谢你的支持!"}),w()):b({title:"点赞失败",description:k.error||"未知错误",variant:"destructive"})},R=async()=>{const k=await ak(l);k.success?(b({title:"已反馈",description:"感谢你的反馈!"}),w()):b({title:"操作失败",description:k.error||"未知错误",variant:"destructive"})},D=async()=>{if(h===0){b({title:"请选择评分",description:"至少选择 1 颗星",variant:"destructive"});return}const k=await lk(l,h,p||void 0);k.success?(b({title:"评分成功",description:"感谢你的评价!"}),v(!1),f(0),g(""),w()):b({title:"评分失败",description:k.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(Xt,{className:"h-4 w-4"}),e.jsx("span",{children:"-"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(an,{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(Xt,{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(an,{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(dm,{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(Xt,{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(an,{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(dm,{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(Kp,{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(C,{variant:"outline",size:"sm",onClick:y,children:[e.jsx(dm,{className:"h-4 w-4 mr-1"}),"点赞"]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:R,children:[e.jsx(Kp,{className:"h-4 w-4 mr-1"}),"点踩"]}),e.jsxs(Ks,{open:N,onOpenChange:v,children:[e.jsx(Ho,{asChild:!0,children:e.jsxs(C,{variant:"default",size:"sm",children:[e.jsx(an,{className:"h-4 w-4 mr-1"}),"评分"]})}),e.jsxs(Ps,{children:[e.jsxs(Hs,{children:[e.jsx(Gs,{children:"为插件评分"}),e.jsx(ot,{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(k=>e.jsx("button",{onClick:()=>f(k),className:"focus:outline-none",children:e.jsx(an,{className:`h-8 w-8 transition-colors ${k<=h?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-300"}`})},k))}),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(et,{value:p,onChange:k=>g(k.target.value),placeholder:"分享你的使用体验...",rows:4,maxLength:500}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1 text-right",children:[p.length," / 500"]})]})]}),e.jsxs(xt,{children:[e.jsx(C,{variant:"outline",onClick:()=>v(!1),children:"取消"}),e.jsx(C,{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((k,I)=>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(an,{className:`h-3 w-3 ${M<=k.rating?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},M))}),e.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(k.created_at).toLocaleDateString()})]}),k.comment&&e.jsx("p",{className:"text-sm text-muted-foreground",children:k.comment})]},I))})]})]}):null}const pk={"Group Management":"群组管理","Entertainment & Interaction":"娱乐互动","Utility Tools":"实用工具","Content Generation":"内容生成",Multimedia:"多媒体","External Integration":"外部集成","Data Analysis & Insights":"数据分析与洞察",Other:"其他"};function gk(){const l=aa(),n=t0({strict:!1}),{toast:i}=Ws(),[c,u]=m.useState(null),[x,h]=m.useState(""),[f,p]=m.useState(!0),[g,N]=m.useState(!0),[v,b]=m.useState(null),[w,y]=m.useState(null),[R,D]=m.useState(null),[k,I]=m.useState(!1),[M,S]=m.useState(),[T,$]=m.useState(!1);m.useEffect(()=>{(async()=>{if(!n.pluginId){b("缺少插件 ID"),p(!1);return}try{p(!0),b(null);const fe=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(!fe.ok)throw new Error("获取插件列表失败");const ge=await fe.json();if(!ge.success||!ge.data)throw new Error(ge.error||"获取插件列表失败");const V=JSON.parse(ge.data).find(je=>je.id===n.pluginId);if(!V)throw new Error("未找到该插件");const U={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(U);const[L,P,_e]=await Promise.all([gv(),jv(),Sl()]);y(L),D(P),I(nn(n.pluginId,_e)),S(rn(n.pluginId,_e))}catch(fe){b(fe instanceof Error?fe.message:"加载失败")}finally{p(!1)}})()},[n.pluginId]),m.useEffect(()=>{(async()=>{if(!c?.manifest?.repository_url){N(!1);return}try{N(!0);const fe=c.manifest.repository_url.match(/github\.com\/([^/]+)\/([^/\s]+)/);if(!fe){h("无法解析仓库地址");return}const[,ge,z]=fe,V=z.replace(/\.git$/,""),U=await we("/api/webui/plugins/fetch-raw",{method:"POST",body:JSON.stringify({owner:ge,repo:V,branch:"main",file_path:"README.md"})});if(!U.ok)throw new Error("获取 README 失败");const L=await U.json();L.success&&L.data?h(L.data):h("该插件暂无 README 文档")}catch(fe){console.error("加载 README 失败:",fe),h("加载 README 失败")}finally{N(!1)}})()},[c]);const A=()=>!c||!k||!M?!1:M!==c.manifest.version,Q=()=>!c||!R?!0:vv(c.manifest.host_application.min_version,c.manifest.host_application.max_version,R),G=async()=>{if(!(!c||!w?.installed))try{$(!0),await Nv(c.id,c.manifest.repository_url||"","main"),_v(c.id).catch(fe=>{console.warn("Failed to record download:",fe)}),i({title:"安装成功",description:`${c.manifest.name} 已成功安装`});const le=await Sl();I(nn(c.id,le)),S(rn(c.id,le))}catch(le){i({title:"安装失败",description:le instanceof Error?le.message:"未知错误",variant:"destructive"})}finally{$(!1)}},de=async()=>{if(c)try{$(!0),await bv(c.id),i({title:"卸载成功",description:`${c.manifest.name} 已成功卸载`});const le=await Sl();I(nn(c.id,le)),S(rn(c.id,le))}catch(le){i({title:"卸载失败",description:le instanceof Error?le.message:"未知错误",variant:"destructive"})}finally{$(!1)}},oe=async()=>{if(!(!c||!w?.installed))try{$(!0);const le=await yv(c.id,c.manifest.repository_url||"","main");i({title:"更新成功",description:`${c.manifest.name} 已从 ${le.old_version} 更新到 ${le.new_version}`});const fe=await Sl();I(nn(c.id,fe)),S(rn(c.id,fe))}catch(le){i({title:"更新失败",description:le instanceof Error?le.message:"未知错误",variant:"destructive"})}finally{$(!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(C,{variant:"ghost",size:"icon",onClick:()=>l({to:"/plugins"}),children:e.jsx(Va,{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(zs,{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(C,{variant:"ghost",size:"icon",onClick:()=>l({to:"/plugins"}),children:e.jsx(Va,{className:"h-5 w-5"})}),e.jsx("div",{children:e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件详情"})})]}),e.jsx(De,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Ct,{className:"h-12 w-12 text-destructive mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:v}),e.jsx(C,{onClick:()=>l({to:"/plugins"}),children:"返回插件列表"})]})})]});const ve=Q();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(C,{variant:"ghost",size:"icon",onClick:()=>l({to:"/plugins"}),className:"shrink-0",children:e.jsx(Va,{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:k?e.jsxs(e.Fragment,{children:[A()?e.jsx(C,{disabled:!w?.installed||T,onClick:oe,title:w?.installed?void 0:"Git 未安装",children:T?e.jsxs(e.Fragment,{children:[e.jsx(zs,{className:"h-4 w-4 mr-2 animate-spin"}),"更新中..."]}):e.jsxs(e.Fragment,{children:[e.jsx(kt,{className:"h-4 w-4 mr-2"}),"更新"]})}):null,e.jsx(C,{variant:"destructive",disabled:!w?.installed||T,onClick:de,title:w?.installed?void 0:"Git 未安装",children:T?e.jsxs(e.Fragment,{children:[e.jsx(zs,{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(C,{disabled:!w?.installed||!ve||T,onClick:G,title:w?.installed?ve?void 0:`不兼容当前版本 (需要 ${c.manifest.host_application.min_version}${c.manifest.host_application.max_version?` - ${c.manifest.host_application.max_version}`:"+"},当前 ${R?.version})`:"Git 未安装",children:T?e.jsxs(e.Fragment,{children:[e.jsx(zs,{className:"h-4 w-4 mr-2 animate-spin"}),"安装中..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Xt,{className:"h-4 w-4 mr-2"}),"安装"]})})})]}),e.jsx(es,{className:"h-[calc(100vh-200px)] sm:h-[calc(100vh-220px)]",children:e.jsxs("div",{className:"space-y-6 pr-4",children:[e.jsx(De,{children:e.jsx(Xe,{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(We,{className:"text-2xl",children:c.manifest.name}),e.jsxs(Ae,{variant:"secondary",className:"text-sm",children:["v",c.manifest.version]}),k&&e.jsxs(Ae,{variant:"default",className:"text-sm",children:[e.jsx(ea,{className:"h-3 w-3 mr-1"}),"已安装 ",M&&`(v${M})`]}),A()&&e.jsxs(Ae,{variant:"outline",className:"text-sm border-orange-500 text-orange-500",children:[e.jsx(kt,{className:"h-3 w-3 mr-1"}),"可更新"]}),!ve&&e.jsxs(Ae,{variant:"destructive",className:"text-sm",children:[e.jsx(Ct,{className:"h-3 w-3 mr-1"}),"不兼容"]})]}),e.jsx(Is,{className:"text-base",children:c.manifest.description})]})})})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-1 space-y-6",children:[e.jsxs(De,{children:[e.jsx(Xe,{children:e.jsx(We,{className:"text-lg",children:"统计信息"})}),e.jsx(Qe,{children:e.jsx(fk,{pluginId:c.id})})]}),e.jsxs(De,{children:[e.jsx(Xe,{children:e.jsx(We,{className:"text-lg",children:"基本信息"})}),e.jsx(Qe,{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(Dn,{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(bo,{className:"h-3 w-3"})})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Wt,{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(mj,{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(Co,{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(bo,{className:"h-3 w-3"})]})]}),c.manifest.repository_url&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Kw,{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(bo,{className:"h-3 w-3"})]})]}),e.jsxs("div",{className:"pt-2 border-t",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm mb-2",children:[e.jsx(qt,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"支持版本:"})]}),e.jsxs("div",{className:"text-sm pl-6 font-medium",children:[c.manifest.host_application.min_version,c.manifest.host_application.max_version?` - ${c.manifest.host_application.max_version}`:" - 最新版本"]})]})]})})]}),(c.manifest.categories||c.manifest.keywords)&&e.jsxs(De,{children:[e.jsx(Xe,{children:e.jsx(We,{className:"text-lg",children:"分类与标签"})}),e.jsxs(Qe,{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(le=>e.jsx(Ae,{variant:"secondary",children:pk[le]||le},le))})]}),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(le=>e.jsxs(Ae,{variant:"outline",className:"text-xs",children:[e.jsx($o,{className:"h-3 w-3 mr-1"}),le]},le))})]})]})]})]}),e.jsxs(De,{className:"lg:col-span-2",children:[e.jsx(Xe,{children:e.jsx(We,{className:"text-lg",children:"插件说明"})}),e.jsx(Qe,{children:e.jsx(es,{className:"h-[600px] pr-4",children:g?e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(zs,{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(Im,{content:x}):e.jsx("div",{className:"text-center text-muted-foreground py-12",children:"暂无说明文档"})})})]})]})]})})]})}const Ui=m.forwardRef(({className:l,...n},i)=>e.jsx($g,{ref:i,className:B("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",l),...n}));Ui.displayName=$g.displayName;const jk=m.forwardRef(({className:l,...n},i)=>e.jsx(Ig,{ref:i,className:B("aspect-square h-full w-full",l),...n}));jk.displayName=Ig.displayName;const Bi=m.forwardRef(({className:l,...n},i)=>e.jsx(Pg,{ref:i,className:B("flex h-full w-full items-center justify-center rounded-full bg-muted",l),...n}));Bi.displayName=Pg.displayName;function vk(){return"webui_"+Math.random().toString(36).substr(2,9)+"_"+Date.now().toString(36)}function Nk(){const l="maibot_webui_user_id";let n=localStorage.getItem(l);return n||(n=vk(),localStorage.setItem(l,n)),n}function bk(){return localStorage.getItem("maibot_webui_user_name")||"WebUI用户"}function yk(l){localStorage.setItem("maibot_webui_user_name",l)}const Sv="maibot_webui_virtual_tabs";function wk(){try{const l=localStorage.getItem(Sv);if(l)return JSON.parse(l)}catch(l){console.error("[Chat] 加载虚拟标签页失败:",l)}return[]}function Ng(l){try{localStorage.setItem(Sv,JSON.stringify(l))}catch(n){console.error("[Chat] 保存虚拟标签页失败:",n)}}function _k({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:B("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 Sk({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(_k,{segment:i},c))}):e.jsx("span",{className:"whitespace-pre-wrap",children:l.content})}function kk(){const l={id:"webui-default",type:"webui",label:"WebUI",messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}},n=()=>{const qe=wk().map(Ie=>{const Ve=Ie.virtualConfig;return!Ve.groupId&&Ve.platform&&Ve.userId&&(Ve.groupId=`webui_virtual_group_${Ve.platform}_${Ve.userId}`),{id:Ie.id,type:"virtual",label:Ie.label,virtualConfig:Ve,messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}}});return[l,...qe]},[i,c]=m.useState(n),[u,x]=m.useState("webui-default"),h=i.find(F=>F.id===u)||i[0],[f,p]=m.useState(""),[g,N]=m.useState(!1),[v,b]=m.useState(!0),[w,y]=m.useState(bk()),[R,D]=m.useState(!1),[k,I]=m.useState(""),[M,S]=m.useState(!1),[T,$]=m.useState([]),[A,Q]=m.useState([]),[G,de]=m.useState(!1),[oe,ve]=m.useState(!1),[le,fe]=m.useState(""),[ge,z]=m.useState({platform:"",personId:"",userId:"",userName:"",groupName:"",groupId:""}),V=m.useRef(Nk()),U=m.useRef(new Map),L=m.useRef(null),P=m.useRef(new Map),_e=m.useRef(0),je=m.useRef(new Map),{toast:Se}=Ws(),Y=F=>(_e.current+=1,`${F}-${Date.now()}-${_e.current}-${Math.random().toString(36).substr(2,9)}`),be=m.useCallback((F,qe)=>{c(Ie=>Ie.map(Ve=>Ve.id===F?{...Ve,...qe}:Ve))},[]),Z=m.useCallback((F,qe)=>{c(Ie=>Ie.map(Ve=>Ve.id===F?{...Ve,messages:[...Ve.messages,qe]}:Ve))},[]),xe=m.useCallback(()=>{L.current?.scrollIntoView({behavior:"smooth"})},[]);m.useEffect(()=>{xe()},[h?.messages,xe]);const Me=m.useCallback(async()=>{de(!0);try{const F=await we("/api/chat/platforms");if(console.log("[Chat] 平台列表响应:",F.status,F.headers.get("content-type")),F.ok){const qe=F.headers.get("content-type");if(qe&&qe.includes("application/json")){const Ie=await F.json();console.log("[Chat] 平台列表数据:",Ie),$(Ie.platforms||[])}else{const Ie=await F.text();console.error("[Chat] 获取平台列表失败: 非 JSON 响应:",Ie.substring(0,200)),Se({title:"连接失败",description:"无法连接到后端服务,请确保 MaiBot 已启动",variant:"destructive"})}}else console.error("[Chat] 获取平台列表失败: HTTP",F.status),Se({title:"获取平台失败",description:`服务器返回错误: ${F.status}`,variant:"destructive"})}catch(F){console.error("[Chat] 获取平台列表失败:",F),Se({title:"网络错误",description:"无法连接到后端服务",variant:"destructive"})}finally{de(!1)}},[Se]),J=m.useCallback(async(F,qe)=>{ve(!0);try{const Ie=new URLSearchParams;F&&Ie.append("platform",F),qe&&Ie.append("search",qe),Ie.append("limit","50");const Ve=await we(`/api/chat/persons?${Ie.toString()}`);if(Ve.ok){const Cs=Ve.headers.get("content-type");if(Cs&&Cs.includes("application/json")){const ns=await Ve.json();Q(ns.persons||[])}else console.error("[Chat] 获取用户列表失败: 后端返回非 JSON 响应")}}catch(Ie){console.error("[Chat] 获取用户列表失败:",Ie)}finally{ve(!1)}},[]);m.useEffect(()=>{ge.platform&&J(ge.platform,le)},[ge.platform,le,J]);const ce=m.useCallback(async(F,qe)=>{b(!0);try{const Ie=new URLSearchParams;Ie.append("user_id",V.current),Ie.append("limit","50"),qe&&Ie.append("group_id",qe);const Ve=`/api/chat/history?${Ie.toString()}`;console.log("[Chat] 正在加载历史消息:",Ve);const Cs=await we(Ve);if(Cs.ok){const ns=await Cs.text();try{const Rs=JSON.parse(ns);if(Rs.messages&&Rs.messages.length>0){const Ee=Rs.messages.map(ts=>({id:ts.id,type:ts.type,content:ts.content,timestamp:ts.timestamp,sender:{name:ts.sender_name||(ts.is_bot?"麦麦":"WebUI用户"),user_id:ts.user_id,is_bot:ts.is_bot}}));be(F,{messages:Ee});const gs=je.current.get(F)||new Set;Ee.forEach(ts=>{if(ts.type==="bot"){const Ze=`bot-${ts.content}-${Math.floor(ts.timestamp*1e3)}`;gs.add(Ze)}}),je.current.set(F,gs)}}catch(Rs){console.error("[Chat] JSON 解析失败:",Rs)}}}catch(Ie){console.error("[Chat] 加载历史消息失败:",Ie)}finally{b(!1)}},[be]),Fe=m.useCallback(async(F,qe,Ie)=>{const Ve=U.current.get(F);if(Ve?.readyState===WebSocket.OPEN||Ve?.readyState===WebSocket.CONNECTING){console.log(`[Tab ${F}] WebSocket 已存在,跳过连接`);return}N(!0);let Cs=null;try{const gs=await we("/api/webui/ws-token");if(gs.ok){const ts=await gs.json();if(ts.success&&ts.token)Cs=ts.token;else{console.warn(`[Tab ${F}] 获取 WebSocket token 失败: ${ts.message||"未登录"}`),N(!1);return}}}catch(gs){console.error(`[Tab ${F}] 获取 WebSocket token 失败:`,gs),N(!1);return}if(!Cs){N(!1);return}const ns=window.location.protocol==="https:"?"wss:":"ws:",Rs=new URLSearchParams;Rs.append("token",Cs),qe==="virtual"&&Ie?(Rs.append("user_id",Ie.userId),Rs.append("user_name",Ie.userName),Rs.append("platform",Ie.platform),Rs.append("person_id",Ie.personId),Rs.append("group_name",Ie.groupName||"WebUI虚拟群聊"),Ie.groupId&&Rs.append("group_id",Ie.groupId)):(Rs.append("user_id",V.current),Rs.append("user_name",w));const Ee=`${ns}//${window.location.host}/api/chat/ws?${Rs.toString()}`;console.log(`[Tab ${F}] 正在连接 WebSocket:`,Ee);try{const gs=new WebSocket(Ee);U.current.set(F,gs),gs.onopen=()=>{be(F,{isConnected:!0}),N(!1),console.log(`[Tab ${F}] WebSocket 已连接`)},gs.onmessage=ts=>{try{const Ze=JSON.parse(ts.data);switch(Ze.type){case"session_info":be(F,{sessionInfo:{session_id:Ze.session_id,user_id:Ze.user_id,user_name:Ze.user_name,bot_name:Ze.bot_name}});break;case"system":Z(F,{id:Y("sys"),type:"system",content:Ze.content||"",timestamp:Ze.timestamp||Date.now()/1e3});break;case"user_message":{const js=Ze.sender?.user_id,dt=qe==="virtual"&&Ie?Ie.userId:V.current;console.log(`[Tab ${F}] 收到 user_message, sender: ${js}, current: ${dt}`);const Ot=js?js.replace(/^webui_user_/,""):"",ut=dt?dt.replace(/^webui_user_/,""):"";if(Ot&&ut&&Ot===ut){console.log(`[Tab ${F}] 跳过自己的消息(user_id 匹配)`);break}const _s=je.current.get(F)||new Set,Tt=`user-${Ze.content}-${Math.floor((Ze.timestamp||0)*1e3)}`;if(_s.has(Tt)){console.log(`[Tab ${F}] 跳过自己的消息(内容去重)`);break}if(_s.add(Tt),je.current.set(F,_s),_s.size>100){const Bt=_s.values().next().value;Bt&&_s.delete(Bt)}Z(F,{id:Ze.message_id||Y("user"),type:"user",content:Ze.content||"",timestamp:Ze.timestamp||Date.now()/1e3,sender:Ze.sender});break}case"bot_message":{be(F,{isTyping:!1});const js=je.current.get(F)||new Set,dt=`bot-${Ze.content}-${Math.floor((Ze.timestamp||0)*1e3)}`;if(js.has(dt))break;if(js.add(dt),je.current.set(F,js),js.size>100){const Ot=js.values().next().value;Ot&&js.delete(Ot)}c(Ot=>Ot.map(ut=>{if(ut.id!==F)return ut;const _s=ut.messages.filter(Bt=>Bt.type!=="thinking"),Tt={id:Y("bot"),type:"bot",content:Ze.content||"",message_type:Ze.message_type==="rich"?"rich":"text",segments:Ze.segments,timestamp:Ze.timestamp||Date.now()/1e3,sender:Ze.sender};return{...ut,messages:[..._s,Tt]}}));break}case"typing":be(F,{isTyping:Ze.is_typing||!1});break;case"error":c(js=>js.map(dt=>{if(dt.id!==F)return dt;const Ot=dt.messages.filter(ut=>ut.type!=="thinking");return{...dt,messages:[...Ot,{id:Y("error"),type:"error",content:Ze.content||"发生错误",timestamp:Ze.timestamp||Date.now()/1e3}]}})),Se({title:"错误",description:Ze.content,variant:"destructive"});break;case"pong":break;case"history":{const js=Ze.messages||[];if(js.length>0){const dt=je.current.get(F)||new Set,Ot=js.map(ut=>{const _s=ut.is_bot||!1,Tt=ut.id||Y(_s?"bot":"user"),Bt=`${_s?"bot":"user"}-${ut.content}-${Math.floor(ut.timestamp*1e3)}`;return dt.add(Bt),{id:Tt,type:_s?"bot":"user",content:ut.content,timestamp:ut.timestamp,sender:{name:ut.sender_name||(_s?"麦麦":"用户"),user_id:ut.sender_id,is_bot:_s}}});je.current.set(F,dt),be(F,{messages:Ot}),console.log(`[Tab ${F}] 已加载 ${Ot.length} 条历史消息`)}break}default:console.log("未知消息类型:",Ze.type)}}catch(Ze){console.error("解析消息失败:",Ze)}},gs.onclose=()=>{be(F,{isConnected:!1}),N(!1),U.current.delete(F),console.log(`[Tab ${F}] WebSocket 已断开`);const ts=P.current.get(F);ts&&clearTimeout(ts);const Ze=window.setTimeout(()=>{if(!q.current){const js=i.find(dt=>dt.id===F);js&&Fe(F,js.type,js.virtualConfig)}},5e3);P.current.set(F,Ze)},gs.onerror=ts=>{console.error(`[Tab ${F}] WebSocket 错误:`,ts),N(!1)}}catch(gs){console.error(`[Tab ${F}] 创建 WebSocket 失败:`,gs),N(!1)}},[w,be,Z,Se,i]),q=m.useRef(!1);m.useEffect(()=>{q.current=!1;const F=U.current,qe=P.current,Ie=je.current;ce("webui-default");const Ve=setTimeout(()=>{q.current||(Fe("webui-default","webui"),i.forEach(ns=>{ns.type==="virtual"&&ns.virtualConfig&&(Ie.set(ns.id,new Set),setTimeout(()=>{q.current||Fe(ns.id,"virtual",ns.virtualConfig)},200))}))},100),Cs=setInterval(()=>{F.forEach(ns=>{ns.readyState===WebSocket.OPEN&&ns.send(JSON.stringify({type:"ping"}))})},3e4);return()=>{q.current=!0,clearTimeout(Ve),clearInterval(Cs),qe.forEach(ns=>{clearTimeout(ns)}),qe.clear(),F.forEach(ns=>{ns.close()}),F.clear()}},[]);const ee=m.useCallback(()=>{const F=U.current.get(u);if(!f.trim()||!F||F.readyState!==WebSocket.OPEN)return;const qe=h?.type==="virtual"&&h.virtualConfig?.userName||w,Ie=f.trim(),Ve=Date.now()/1e3;F.send(JSON.stringify({type:"message",content:Ie,user_name:qe}));const Cs=je.current.get(u)||new Set,ns=`user-${Ie}-${Math.floor(Ve*1e3)}`;if(Cs.add(ns),je.current.set(u,Cs),Cs.size>100){const gs=Cs.values().next().value;gs&&Cs.delete(gs)}const Rs={id:Y("user"),type:"user",content:Ie,timestamp:Ve,sender:{name:qe,is_bot:!1}};Z(u,Rs);const Ee={id:Y("thinking"),type:"thinking",content:"",timestamp:Ve+.001,sender:{name:h?.sessionInfo.bot_name||"麦麦",is_bot:!0}};Z(u,Ee),p("")},[f,w,u,h,Z]),ke=F=>{F.key==="Enter"&&!F.shiftKey&&(F.preventDefault(),ee())},Te=()=>{I(w),D(!0)},Oe=()=>{const F=k.trim()||"WebUI用户";y(F),yk(F),D(!1);const qe=U.current.get(u);qe?.readyState===WebSocket.OPEN&&qe.send(JSON.stringify({type:"update_nickname",user_name:F}))},me=()=>{I(""),D(!1)},ze=F=>new Date(F*1e3).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}),rs=()=>{const F=U.current.get(u);F&&(F.close(),U.current.delete(u)),Fe(u,h?.type||"webui",h?.virtualConfig)},Kt=()=>{z({platform:"",personId:"",userId:"",userName:"",groupName:"",groupId:""}),fe(""),Me(),S(!0)},Qt=()=>{if(!ge.platform||!ge.personId){Se({title:"配置不完整",description:"请选择平台和用户",variant:"destructive"});return}const F=`webui_virtual_group_${ge.platform}_${ge.userId}`,qe=`virtual-${ge.platform}-${ge.userId}-${Date.now()}`,Ie=ge.userName||ge.userId,Ve={id:qe,type:"virtual",label:Ie,virtualConfig:{...ge,groupId:F},messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}};c(Cs=>{const ns=[...Cs,Ve],Rs=ns.filter(Ee=>Ee.type==="virtual"&&Ee.virtualConfig).map(Ee=>({id:Ee.id,label:Ee.label,virtualConfig:Ee.virtualConfig,createdAt:Date.now()}));return Ng(Rs),ns}),x(qe),S(!1),je.current.set(qe,new Set),setTimeout(()=>{Fe(qe,"virtual",ge)},100),Se({title:"虚拟身份标签页",description:`已创建 ${Ie} 的对话`})},ka=(F,qe)=>{if(qe?.stopPropagation(),F==="webui-default")return;const Ie=U.current.get(F);Ie&&(Ie.close(),U.current.delete(F));const Ve=P.current.get(F);Ve&&(clearTimeout(Ve),P.current.delete(F)),je.current.delete(F),c(Cs=>{const ns=Cs.filter(Ee=>Ee.id!==F),Rs=ns.filter(Ee=>Ee.type==="virtual"&&Ee.virtualConfig).map(Ee=>({id:Ee.id,label:Ee.label,virtualConfig:Ee.virtualConfig,createdAt:Date.now()}));return Ng(Rs),ns}),u===F&&x("webui-default")},yt=F=>{x(F)},st=F=>{z(qe=>({...qe,personId:F.person_id,userId:F.user_id,userName:F.nickname||F.person_name}))};return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(Ks,{open:M,onOpenChange:S,children:e.jsxs(Ps,{className:"sm:max-w-[500px] max-h-[85vh] overflow-hidden flex flex-col",children:[e.jsxs(Hs,{children:[e.jsxs(Gs,{className:"flex items-center gap-2",children:[e.jsx(um,{className:"h-5 w-5"}),"新建虚拟身份对话"]}),e.jsx(ot,{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(Co,{className:"h-4 w-4"}),"选择平台"]}),e.jsxs(Be,{value:ge.platform,onValueChange:F=>{z(qe=>({...qe,platform:F,personId:"",userId:"",userName:""})),Q([])},children:[e.jsx(Le,{disabled:G,children:e.jsx($e,{placeholder:G?"加载中...":"选择平台"})}),e.jsx(Ue,{children:T.map(F=>e.jsxs(ae,{value:F.platform,children:[F.platform," (",F.count," 人)"]},F.platform))})]})]}),ge.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(Tm,{className:"h-4 w-4"}),"选择用户"]}),e.jsxs("div",{className:"relative",children:[e.jsx(Vt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ie,{placeholder:"搜索用户名...",value:le,onChange:F=>fe(F.target.value),className:"pl-9"})]}),e.jsx(es,{className:"h-[250px] border rounded-md",children:e.jsx("div",{className:"p-2",children:oe?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(zs,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):A.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground",children:[e.jsx(Tm,{className:"h-8 w-8 mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"没有找到用户"})]}):e.jsx("div",{className:"space-y-1",children:A.map(F=>e.jsxs("button",{onClick:()=>st(F),className:B("w-full flex items-center gap-3 p-2 rounded-md text-left transition-colors",ge.personId===F.person_id?"bg-primary text-primary-foreground":"hover:bg-muted"),children:[e.jsx(Ui,{className:"h-8 w-8 shrink-0",children:e.jsx(Bi,{className:B("text-xs",ge.personId===F.person_id?"bg-primary-foreground/20":"bg-muted"),children:(F.nickname||F.person_name||"?").charAt(0)})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-medium truncate",children:F.nickname||F.person_name}),e.jsxs("div",{className:B("text-xs truncate",ge.personId===F.person_id?"text-primary-foreground/70":"text-muted-foreground"),children:["ID: ",F.user_id,F.is_known&&" · 已认识"]})]})]},F.person_id))})})})]}),ge.personId&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(E,{children:"虚拟群名(可选)"}),e.jsx(ie,{placeholder:"WebUI虚拟群聊",value:ge.groupName,onChange:F=>z(qe=>({...qe,groupName:F.target.value}))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦会认为这是一个名为此名称的群聊"})]})]}),e.jsxs(xt,{className:"gap-2 sm:gap-0",children:[e.jsx(C,{variant:"outline",onClick:()=>S(!1),children:"取消"}),e.jsx(C,{onClick:Qt,disabled:!ge.platform||!ge.personId,children:"创建对话"})]})]})}),e.jsx("div",{className:"shrink-0 border-b bg-muted/30",children:e.jsx("div",{className:"max-w-4xl mx-auto px-2 sm:px-4",children:e.jsxs("div",{className:"flex items-center gap-1 overflow-x-auto py-1.5 scrollbar-thin",children:[i.map(F=>e.jsxs("div",{className:B("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===F.id?"bg-background shadow-sm border":"text-muted-foreground"),onClick:()=>yt(F.id),children:[F.type==="webui"?e.jsx(on,{className:"h-3.5 w-3.5"}):e.jsx(um,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"max-w-[100px] truncate",children:F.label}),e.jsx("span",{className:B("w-1.5 h-1.5 rounded-full",F.isConnected?"bg-green-500":"bg-muted-foreground/50")}),F.id!=="webui-default"&&e.jsx("span",{onClick:qe=>ka(F.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(),ka(F.id,qe))},children:e.jsx(_a,{className:"h-3 w-3"})})]},F.id)),e.jsx("button",{onClick:Kt,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(it,{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(Ui,{className:"h-8 w-8 sm:h-10 sm:w-10 shrink-0",children:e.jsx(Bi,{className:"bg-primary/10 text-primary",children:e.jsx(Ri,{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(Qw,{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(zs,{className:"h-3 w-3 animate-spin"}),e.jsx("span",{children:"连接中..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(Yw,{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(zs,{className:"h-4 w-4 animate-spin text-muted-foreground"}),e.jsx(C,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:rs,disabled:g,title:"重新连接",children:e.jsx(kt,{className:B("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(um,{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(Dn,{className:"h-3 w-3"}),e.jsx("span",{children:"当前身份:"}),R?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ie,{value:k,onChange:F=>I(F.target.value),onKeyDown:F=>{F.key==="Enter"&&Oe(),F.key==="Escape"&&me()},className:"h-7 w-32",placeholder:"输入昵称",autoFocus:!0}),e.jsx(C,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:Oe,children:"保存"}),e.jsx(C,{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(C,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:Te,title:"修改昵称",children:e.jsx(Jw,{className:"h-3 w-3"})})]})]})})]})}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(es,{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(Ri,{className:"h-12 w-12 mb-4 opacity-50"}),e.jsxs("p",{className:"text-sm",children:["开始与 ",h?.sessionInfo.bot_name||"麦麦"," 对话吧!"]})]}),h?.messages.map(F=>e.jsxs("div",{className:B("flex gap-2 sm:gap-3",F.type==="user"&&"flex-row-reverse",F.type==="system"&&"justify-center",F.type==="error"&&"justify-center"),children:[F.type==="system"&&e.jsx("div",{className:"text-xs text-muted-foreground bg-muted/50 px-3 py-1 rounded-full max-w-[90%]",children:F.content}),F.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:F.content}),F.type==="thinking"&&e.jsxs(e.Fragment,{children:[e.jsx(Ui,{className:"h-7 w-7 sm:h-8 sm:w-8 shrink-0",children:e.jsx(Bi,{className:"bg-primary/10 text-primary",children:e.jsx(Ri,{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:F.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:"思考中..."})]})})]})]}),(F.type==="user"||F.type==="bot")&&e.jsxs(e.Fragment,{children:[e.jsx(Ui,{className:"h-7 w-7 sm:h-8 sm:w-8 shrink-0",children:e.jsx(Bi,{className:B("text-xs",F.type==="bot"?"bg-primary/10 text-primary":"bg-secondary text-secondary-foreground"),children:F.type==="bot"?e.jsx(Ri,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"}):e.jsx(Dn,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"})})}),e.jsxs("div",{className:B("flex flex-col gap-1 max-w-[75%] sm:max-w-[70%]",F.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:F.sender?.name||(F.type==="bot"?h?.sessionInfo.bot_name:w)}),e.jsx("span",{children:ze(F.timestamp)})]}),e.jsx("div",{className:B("rounded-2xl px-3 py-2 text-sm break-words",F.type==="bot"?"bg-muted rounded-tl-sm":"bg-primary text-primary-foreground rounded-tr-sm"),children:e.jsx(Sk,{message:F,isBot:F.type==="bot"})})]})]})]},F.id)),e.jsx("div",{ref:L})]})})}),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(ie,{value:f,onChange:F=>p(F.target.value),onKeyDown:ke,placeholder:h?.isConnected?"输入消息...":"等待连接...",disabled:!h?.isConnected,className:"flex-1 h-10 sm:h-10"}),e.jsx(C,{onClick:ee,disabled:!h?.isConnected||!f.trim(),size:"icon",className:"h-10 w-10 shrink-0",children:e.jsx(Xw,{className:"h-4 w-4"})})]})})})]})}var Ym="Radio",[Ck,kv]=Lo(Ym),[Tk,Ek]=Ck(Ym),Cv=m.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]=m.useState(null),w=Uo(n,D=>b(D)),y=m.useRef(!1),R=v?g||!!v.closest("form"):!0;return e.jsxs(Tk,{scope:i,checked:u,disabled:h,children:[e.jsx($n.button,{type:"button",role:"radio","aria-checked":u,"data-state":Av(u),"data-disabled":h?"":void 0,disabled:h,value:f,...N,ref:w,onClick:cn(l.onClick,D=>{u||p?.(),R&&(y.current=D.isPropagationStopped(),y.current||D.stopPropagation())})}),R&&e.jsx(Mv,{control:v,bubbles:!y.current,name:c,value:f,checked:u,required:x,disabled:h,form:g,style:{transform:"translateX(-100%)"}})]})});Cv.displayName=Ym;var Tv="RadioIndicator",Ev=m.forwardRef((l,n)=>{const{__scopeRadio:i,forceMount:c,...u}=l,x=Ek(Tv,i);return e.jsx(gw,{present:c||x.checked,children:e.jsx($n.span,{"data-state":Av(x.checked),"data-disabled":x.disabled?"":void 0,...u,ref:n})})});Ev.displayName=Tv;var Mk="RadioBubbleInput",Mv=m.forwardRef(({__scopeRadio:l,control:n,checked:i,bubbles:c=!0,...u},x)=>{const h=m.useRef(null),f=Uo(h,x),p=jw(i),g=vw(n);return m.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($n.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}})});Mv.displayName=Mk;function Av(l){return l?"checked":"unchecked"}var Ak=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Qo="RadioGroup",[zk]=Lo(Qo,[Hg,kv]),zv=Hg(),Dv=kv(),[Dk,Ok]=zk(Qo),Ov=m.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=zv(i),y=lj(g),[R,D]=Ro({prop:x,defaultProp:u??null,onChange:v,caller:Qo});return e.jsx(Dk,{scope:i,name:c,required:h,disabled:f,value:R,onValueChange:D,children:e.jsx(A0,{asChild:!0,...w,orientation:p,dir:y,loop:N,children:e.jsx($n.div,{role:"radiogroup","aria-required":h,"aria-orientation":p,"data-disabled":f?"":void 0,dir:y,...b,ref:n})})})});Ov.displayName=Qo;var Rv="RadioGroupItem",Lv=m.forwardRef((l,n)=>{const{__scopeRadioGroup:i,disabled:c,...u}=l,x=Ok(Rv,i),h=x.disabled||c,f=zv(i),p=Dv(i),g=m.useRef(null),N=Uo(n,g),v=x.value===u.value,b=m.useRef(!1);return m.useEffect(()=>{const w=R=>{Ak.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(Cv,{disabled:h,required:x.required,checked:v,...p,...u,name:x.name,ref:N,onCheck:()=>x.onValueChange(u.value),onKeyDown:cn(w=>{w.key==="Enter"&&w.preventDefault()}),onFocus:cn(u.onFocus,()=>{b.current&&g.current?.click()})})})});Lv.displayName=Rv;var Rk="RadioGroupIndicator",Uv=m.forwardRef((l,n)=>{const{__scopeRadioGroup:i,...c}=l,u=Dv(i);return e.jsx(Ev,{...u,...c,ref:n})});Uv.displayName=Rk;var Bv=Ov,$v=Lv,Lk=Uv;const Jm=m.forwardRef(({className:l,...n},i)=>e.jsx(Bv,{className:B("grid gap-2",l),...n,ref:i}));Jm.displayName=Bv.displayName;const Do=m.forwardRef(({className:l,...n},i)=>e.jsx($v,{ref:i,className:B("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(Lk,{className:"flex items-center justify-center",children:e.jsx(Sj,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Do.displayName=$v.displayName;function Uk({question:l,value:n,onChange:i,error:c,disabled:u=!1}){const[x,h]=m.useState(null),f=u||l.readOnly,p=()=>{switch(l.type){case"single":return e.jsx(Jm,{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(Do,{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(Xs,{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(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(ie,{value:n||"",onChange:g=>i(g.target.value),placeholder:l.placeholder||"请输入...",disabled:f,readOnly:l.readOnly,maxLength:l.maxLength,className:B(l.readOnly&&"bg-muted cursor-not-allowed")});case"textarea":return e.jsxs("div",{className:"space-y-1",children:[e.jsx(et,{value:n||"",onChange:g=>i(g.target.value),placeholder:l.placeholder||"请输入...",disabled:f,readOnly:l.readOnly,maxLength:l.maxLength,rows:4,className:B(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:B("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(an,{className:B("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(wa,{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(Be,{value:n||"",onValueChange:i,disabled:f,children:[e.jsx(Le,{children:e.jsx($e,{placeholder:l.placeholder||"请选择..."})}),e.jsx(Ue,{children:l.options?.map(g=>e.jsx(ae,{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 Iv="https://maibot-plugin-stats.maibot-webui.workers.dev";function Pv(){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 Bk(l,n,i,c){try{const u=c?.userId||Pv(),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(`${Iv}/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 $k(l,n){try{const i=n||Pv(),c=new URLSearchParams({user_id:i,survey_id:l}),u=await fetch(`${Iv}/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 Hv({config:l,initialAnswers:n,onSubmitSuccess:i,onSubmitError:c,showProgress:u=!0,paginateQuestions:x=!1,className:h}){const f=m.useCallback(()=>!n||n.length===0?{}:n.reduce((U,L)=>(U[L.questionId]=L.value,U),{}),[n]),[p,g]=m.useState(()=>f()),[N,v]=m.useState({}),[b,w]=m.useState(0),[y,R]=m.useState(!1),[D,k]=m.useState(!1),[I,M]=m.useState(null),[S,T]=m.useState(null),[$,A]=m.useState(!1),[Q,G]=m.useState(!0);m.useEffect(()=>{n&&n.length>0&&g(U=>({...U,...f()}))},[n,f]),m.useEffect(()=>{(async()=>{if(!l.settings?.allowMultiple){const L=await $k(l.id);L.success&&L.hasSubmitted&&A(!0)}G(!1)})()},[l.id,l.settings?.allowMultiple]);const de=m.useCallback(()=>{const U=new Date;return!(l.settings?.startTime&&new Date(l.settings.startTime)>U||l.settings?.endTime&&new Date(l.settings.endTime){const L=p[U.id];return L==null?!1:Array.isArray(L)?L.length>0:typeof L=="string"?L.trim()!=="":!0}).length,ve=oe/l.questions.length*100,le=m.useCallback((U,L)=>{g(P=>({...P,[U]:L})),v(P=>{const _e={...P};return delete _e[U],_e})},[]),fe=m.useCallback(()=>{const U={};for(const L of l.questions){if(L.required){const P=p[L.id];if(P==null){U[L.id]="此题为必填项";continue}if(Array.isArray(P)&&P.length===0){U[L.id]="请至少选择一项";continue}if(typeof P=="string"&&P.trim()===""){U[L.id]="此题为必填项";continue}}L.minLength&&typeof p[L.id]=="string"&&p[L.id].length{if(!fe()){if(x){const U=l.questions.findIndex(L=>N[L.id]);U>=0&&w(U)}return}R(!0),M(null);try{const U=l.questions.filter(P=>p[P.id]!==void 0).map(P=>({questionId:P.id,value:p[P.id]})),L=await Bk(l.id,l.version,U,{allowMultiple:l.settings?.allowMultiple});if(L.success&&L.submissionId)k(!0),T(L.submissionId),i?.(L.submissionId);else{const P=L.error||"提交失败";M(P),c?.(P)}}catch(U){const L=U instanceof Error?U.message:"提交失败";M(L),c?.(L)}finally{R(!1)}},[fe,x,l,p,N,i,c]),z=m.useCallback(U=>{U>=0&&Ue.jsxs("div",{className:B("p-4 rounded-lg border bg-card",N[U.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:[L+1,"."]}),e.jsx(Uk,{question:U,value:p[U.id],onChange:P=>le(U.id,P),error:N[U.id],disabled:y})]},U.id)),I&&e.jsxs(nt,{variant:"destructive",children:[e.jsx(Ct,{className:"h-4 w-4"}),e.jsx(rt,{children:I})]}),e.jsx("div",{className:"flex justify-between items-center py-4",children:x?e.jsxs(e.Fragment,{children:[e.jsxs(C,{variant:"outline",onClick:()=>z(b-1),disabled:b===0||y,children:[e.jsx(ll,{className:"h-4 w-4 mr-1"}),"上一题"]}),b===l.questions.length-1?e.jsxs(C,{onClick:ge,disabled:y,children:[y&&e.jsx(zs,{className:"h-4 w-4 mr-2 animate-spin"}),"提交问卷"]}):e.jsxs(C,{onClick:()=>z(b+1),disabled:y,children:["下一题",e.jsx(Sa,{className:"h-4 w-4 ml-1"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:Object.keys(N).length>0&&e.jsxs("span",{className:"text-destructive",children:["还有 ",Object.keys(N).length," 个必填项未完成"]})}),e.jsxs(C,{onClick:ge,disabled:y,size:"lg",children:[y&&e.jsx(zs,{className:"h-4 w-4 mr-2 animate-spin"}),"提交问卷"]})]})})]})})]})}const Ik={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:"感谢你的反馈!你的意见对我们非常重要,我们会认真考虑每一条建议。"}},Pk={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 Hk(){const[l,n]=m.useState(!0),i=m.useMemo(()=>JSON.parse(JSON.stringify(Ik)),[]);m.useEffect(()=>{n(!1)},[]);const c=m.useMemo(()=>[{questionId:"webui_version",value:`v${Po}`}],[]),u=m.useCallback(h=>{console.log("WebUI Survey submitted:",h)},[]),x=m.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(zs,{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(kj,{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(Hv,{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(nt,{variant:"destructive",className:"max-w-md",children:[e.jsx(Ct,{className:"h-4 w-4"}),e.jsx(rt,{children:"无法加载问卷配置"})]}),e.jsx(C,{variant:"outline",onClick:()=>window.location.reload(),children:"重试"})]})}function Gk(){const[l,n]=m.useState(null),[i,c]=m.useState(!0),[u,x]=m.useState("未知版本");m.useEffect(()=>{(async()=>{try{const v=await P1();x(v.version||"未知版本")}catch(v){console.error("Failed to get MaiBot version:",v),x("获取失败")}const N=JSON.parse(JSON.stringify(Pk));n(N),c(!1)})()},[]);const h=m.useMemo(()=>[{questionId:"maibot_version",value:u}],[u]),f=m.useCallback(g=>{console.log("MaiBot Survey submitted:",g)},[]),p=m.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(zs,{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(kj,{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(Hv,{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(nt,{variant:"destructive",className:"max-w-md",children:[e.jsx(Ct,{className:"h-4 w-4"}),e.jsx(rt,{children:"无法加载问卷配置"})]}),e.jsx(C,{variant:"outline",onClick:()=>window.location.reload(),children:"重试"})]})}var Yo="DropdownMenu",[Fk]=Lo(Yo,[Gg]),la=Gg(),[qk,Gv]=Fk(Yo),Fv=l=>{const{__scopeDropdownMenu:n,children:i,dir:c,open:u,defaultOpen:x,onOpenChange:h,modal:f=!0}=l,p=la(n),g=m.useRef(null),[N,v]=Ro({prop:u,defaultProp:x??!1,onChange:h,caller:Yo});return e.jsx(qk,{scope:n,triggerId:Cm(),triggerRef:g,contentId:Cm(),open:N,onOpenChange:v,onOpenToggle:m.useCallback(()=>v(b=>!b),[v]),modal:f,children:e.jsx(G0,{...p,open:N,onOpenChange:v,dir:c,modal:f,children:i})})};Fv.displayName=Yo;var qv="DropdownMenuTrigger",Vv=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,disabled:c=!1,...u}=l,x=Gv(qv,i),h=la(i);return e.jsx(F0,{asChild:!0,...h,children:e.jsx($n.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:Nw(n,x.triggerRef),onPointerDown:cn(l.onPointerDown,f=>{!c&&f.button===0&&f.ctrlKey===!1&&(x.onOpenToggle(),x.open||f.preventDefault())}),onKeyDown:cn(l.onKeyDown,f=>{c||(["Enter"," "].includes(f.key)&&x.onOpenToggle(),f.key==="ArrowDown"&&x.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(f.key)&&f.preventDefault())})})})});Vv.displayName=qv;var Vk="DropdownMenuPortal",Kv=l=>{const{__scopeDropdownMenu:n,...i}=l,c=la(n);return e.jsx(R0,{...c,...i})};Kv.displayName=Vk;var Qv="DropdownMenuContent",Yv=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=Gv(Qv,i),x=la(i),h=m.useRef(!1);return e.jsx(L0,{id:u.contentId,"aria-labelledby":u.triggerId,...x,...c,ref:n,onCloseAutoFocus:cn(l.onCloseAutoFocus,f=>{h.current||u.triggerRef.current?.focus(),h.current=!1,f.preventDefault()}),onInteractOutside:cn(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)"}})});Yv.displayName=Qv;var Kk="DropdownMenuGroup",Qk=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=la(i);return e.jsx(q0,{...u,...c,ref:n})});Qk.displayName=Kk;var Yk="DropdownMenuLabel",Jv=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=la(i);return e.jsx(P0,{...u,...c,ref:n})});Jv.displayName=Yk;var Jk="DropdownMenuItem",Xv=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=la(i);return e.jsx(U0,{...u,...c,ref:n})});Xv.displayName=Jk;var Xk="DropdownMenuCheckboxItem",Zv=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=la(i);return e.jsx(B0,{...u,...c,ref:n})});Zv.displayName=Xk;var Zk="DropdownMenuRadioGroup",Wk=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=la(i);return e.jsx(V0,{...u,...c,ref:n})});Wk.displayName=Zk;var eC="DropdownMenuRadioItem",Wv=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=la(i);return e.jsx(I0,{...u,...c,ref:n})});Wv.displayName=eC;var sC="DropdownMenuItemIndicator",eN=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=la(i);return e.jsx($0,{...u,...c,ref:n})});eN.displayName=sC;var tC="DropdownMenuSeparator",sN=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=la(i);return e.jsx(H0,{...u,...c,ref:n})});sN.displayName=tC;var aC="DropdownMenuArrow",lC=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=la(i);return e.jsx(K0,{...u,...c,ref:n})});lC.displayName=aC;var nC="DropdownMenuSubTrigger",tN=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=la(i);return e.jsx(D0,{...u,...c,ref:n})});tN.displayName=nC;var rC="DropdownMenuSubContent",aN=m.forwardRef((l,n)=>{const{__scopeDropdownMenu:i,...c}=l,u=la(i);return e.jsx(O0,{...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)"}})});aN.displayName=rC;var iC=Fv,cC=Vv,oC=Kv,lN=Yv,nN=Jv,rN=Xv,iN=Zv,cN=Wv,oN=eN,dN=sN,uN=tN,mN=aN;const dC=iC,uC=cC,mC=m.forwardRef(({className:l,inset:n,children:i,...c},u)=>e.jsxs(uN,{ref:u,className:B("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(Sa,{className:"ml-auto h-4 w-4"})]}));mC.displayName=uN.displayName;const xC=m.forwardRef(({className:l,...n},i)=>e.jsx(mN,{ref:i,className:B("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}));xC.displayName=mN.displayName;const xN=m.forwardRef(({className:l,sideOffset:n=4,...i},c)=>e.jsx(oC,{children:e.jsx(lN,{ref:c,sideOffset:n,className:B("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})}));xN.displayName=lN.displayName;const hN=m.forwardRef(({className:l,inset:n,...i},c)=>e.jsx(rN,{ref:c,className:B("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}));hN.displayName=rN.displayName;const hC=m.forwardRef(({className:l,children:n,checked:i,...c},u)=>e.jsxs(iN,{ref:u,className:B("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(oN,{children:e.jsx(St,{className:"h-4 w-4"})})}),n]}));hC.displayName=iN.displayName;const fC=m.forwardRef(({className:l,children:n,...i},c)=>e.jsxs(cN,{ref:c,className:B("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(oN,{children:e.jsx(Sj,{className:"h-2 w-2 fill-current"})})}),n]}));fC.displayName=cN.displayName;const pC=m.forwardRef(({className:l,inset:n,...i},c)=>e.jsx(nN,{ref:c,className:B("px-2 py-1.5 text-sm font-semibold",n&&"pl-8",l),...i}));pC.displayName=nN.displayName;const gC=m.forwardRef(({className:l,...n},i)=>e.jsx(dN,{ref:i,className:B("-mx-1 my-1 h-px bg-muted",l),...n}));gC.displayName=dN.displayName;const fN=({className:l,...n})=>e.jsx("nav",{role:"navigation","aria-label":"pagination",className:B("mx-auto flex w-full justify-center",l),...n});fN.displayName="Pagination";const pN=m.forwardRef(({className:l,...n},i)=>e.jsx("ul",{ref:i,className:B("flex flex-row items-center gap-1",l),...n}));pN.displayName="PaginationContent";const So=m.forwardRef(({className:l,...n},i)=>e.jsx("li",{ref:i,className:B("",l),...n}));So.displayName="PaginationItem";const Jo=({className:l,isActive:n,size:i="icon",...c})=>e.jsx("a",{"aria-current":n?"page":void 0,className:B(Rr({variant:n?"outline":"ghost",size:i}),l),...c});Jo.displayName="PaginationLink";const gN=({className:l,...n})=>e.jsxs(Jo,{"aria-label":"Go to previous page",size:"default",className:B("gap-1 pl-2.5",l),...n,children:[e.jsx(ll,{className:"h-4 w-4"}),e.jsx("span",{children:"上一页"})]});gN.displayName="PaginationPrevious";const jN=({className:l,...n})=>e.jsxs(Jo,{"aria-label":"Go to next page",size:"default",className:B("gap-1 pr-2.5",l),...n,children:[e.jsx("span",{children:"下一页"}),e.jsx(Sa,{className:"h-4 w-4"})]});jN.displayName="PaginationNext";const km=[{value:"created_at",label:"最新发布",icon:kl},{value:"downloads",label:"下载最多",icon:Xt},{value:"likes",label:"最受欢迎",icon:To}];function jC(){const l=aa(),[n,i]=m.useState([]),[c,u]=m.useState(!0),[x,h]=m.useState(""),[f,p]=m.useState("downloads"),[g,N]=m.useState(1),[v,b]=m.useState(1),[w,y]=m.useState(0),[R,D]=m.useState(new Set),[k,I]=m.useState(new Set),M=ov(),S=m.useCallback(async()=>{u(!0);try{const G=await L_({status:"approved",page:g,page_size:12,search:x||void 0,sort_by:f,sort_order:"desc"});i(G.packs),b(G.total_pages),y(G.total);const de=new Set;for(const oe of G.packs)await cv(oe.id,M)&&de.add(oe.id);D(de)}catch(G){console.error("加载 Pack 列表失败:",G),Gt({title:"加载 Pack 列表失败",variant:"destructive"})}finally{u(!1)}},[g,x,f,M]);m.useEffect(()=>{S()},[S]);const T=G=>{G.preventDefault(),N(1),S()},$=async G=>{if(!k.has(G)){I(de=>new Set(de).add(G));try{const de=await iv(G,M);D(oe=>{const ve=new Set(oe);return de.liked?ve.add(G):ve.delete(G),ve}),i(oe=>oe.map(ve=>ve.id===G?{...ve,likes:de.likes}:ve))}catch(de){console.error("点赞失败:",de),Gt({title:"点赞失败",variant:"destructive"})}finally{I(de=>{const oe=new Set(de);return oe.delete(G),oe})}}},A=G=>{l({to:"/config/pack-market/$packId",params:{packId:G}})},Q=km.find(G=>G.value===f)||km[0];return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsx("div",{className:"mb-4 sm:mb-6",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(Wt,{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(C,{variant:"outline",onClick:S,disabled:c,className:"gap-2",children:[e.jsx(kt,{className:`h-4 w-4 ${c?"animate-spin":""}`}),"刷新"]})]})}),e.jsx(es,{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:T,className:"flex-1 min-w-[200px] max-w-md",children:e.jsxs("div",{className:"relative",children:[e.jsx(Vt,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(ie,{placeholder:"搜索模板名称、描述...",value:x,onChange:G=>h(G.target.value),className:"pl-10"})]})}),e.jsxs(dC,{children:[e.jsx(uC,{asChild:!0,children:e.jsxs(C,{variant:"outline",className:"min-w-[140px] gap-2",children:[e.jsx(Zw,{className:"w-4 h-4"}),Q.label,e.jsx($a,{className:"w-4 h-4 ml-auto"})]})}),e.jsx(xN,{align:"end",children:km.map(G=>e.jsxs(hN,{onClick:()=>{p(G.value),N(1)},children:[e.jsx(G.icon,{className:"w-4 h-4 mr-2"}),G.label]},G.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((G,de)=>e.jsxs(De,{children:[e.jsxs(Xe,{children:[e.jsx(Js,{className:"h-6 w-3/4"}),e.jsx(Js,{className:"h-4 w-full mt-2"})]}),e.jsx(Qe,{children:e.jsx(Js,{className:"h-20 w-full"})}),e.jsx(Io,{children:e.jsx(Js,{className:"h-9 w-full"})})]},de))}):n.length===0?e.jsx(De,{className:"py-12",children:e.jsxs(Qe,{className:"text-center text-muted-foreground",children:[e.jsx(Wt,{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(G=>e.jsx(vC,{pack:G,liked:R.has(G.id),liking:k.has(G.id),onLike:()=>$(G.id),onView:()=>A(G.id)},G.id))}),v>1&&e.jsx(fN,{children:e.jsxs(pN,{children:[e.jsx(So,{children:e.jsx(gN,{onClick:()=>N(G=>Math.max(1,G-1)),className:g===1?"pointer-events-none opacity-50":"cursor-pointer"})}),Array.from({length:v},(G,de)=>de+1).filter(G=>G===1||G===v||Math.abs(G-g)<=1).map((G,de,oe)=>{const ve=de>0&&G-oe[de-1]>1;return e.jsxs(So,{children:[ve&&e.jsx("span",{className:"px-2",children:"..."}),e.jsx(Jo,{onClick:()=>N(G),isActive:G===g,className:"cursor-pointer",children:G})]},G)}),e.jsx(So,{children:e.jsx(jN,{onClick:()=>N(G=>Math.min(v,G+1)),className:g===v?"pointer-events-none opacity-50":"cursor-pointer"})})]})})]})})]})}function vC({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(De,{className:"flex flex-col hover:shadow-md transition-shadow",children:[e.jsxs(Xe,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx(We,{className:"text-lg line-clamp-1",children:l.name}),e.jsxs(Ae,{variant:"secondary",className:"text-xs",children:["v",l.version]})]}),e.jsx(Is,{className:"line-clamp-2 min-h-[40px]",children:l.description})]}),e.jsxs(Qe,{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(Dn,{className:"w-3.5 h-3.5"}),l.author]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(kl,{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(Tl,{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(Rn,{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(Ln,{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(Ae,{variant:"outline",className:"text-xs",children:[e.jsx($o,{className:"w-2.5 h-2.5 mr-1"}),h]},h)),l.tags.length>3&&e.jsxs(Ae,{variant:"outline",className:"text-xs",children:["+",l.tags.length-3]})]})]}),e.jsx(Io,{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(Xt,{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(To,{className:`w-4 h-4 ${n?"fill-current":""}`}),l.likes]})]}),e.jsx(C,{size:"sm",onClick:u,children:"查看详情"})]})})]})}var Qa="Accordion",NC=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Xm,bC,yC]=bw(Qa),[Xo]=Lo(Qa,[yC,Fg]),Zm=Fg(),vN=Es.forwardRef((l,n)=>{const{type:i,...c}=l,u=c,x=c;return e.jsx(Xm.Provider,{scope:l.__scopeAccordion,children:i==="multiple"?e.jsx(kC,{...x,ref:n}):e.jsx(SC,{...u,ref:n})})});vN.displayName=Qa;var[NN,wC]=Xo(Qa),[bN,_C]=Xo(Qa,{collapsible:!1}),SC=Es.forwardRef((l,n)=>{const{value:i,defaultValue:c,onValueChange:u=()=>{},collapsible:x=!1,...h}=l,[f,p]=Ro({prop:i,defaultProp:c??"",onChange:u,caller:Qa});return e.jsx(NN,{scope:l.__scopeAccordion,value:Es.useMemo(()=>f?[f]:[],[f]),onItemOpen:p,onItemClose:Es.useCallback(()=>x&&p(""),[x,p]),children:e.jsx(bN,{scope:l.__scopeAccordion,collapsible:x,children:e.jsx(yN,{...h,ref:n})})})}),kC=Es.forwardRef((l,n)=>{const{value:i,defaultValue:c,onValueChange:u=()=>{},...x}=l,[h,f]=Ro({prop:i,defaultProp:c??[],onChange:u,caller:Qa}),p=Es.useCallback(N=>f((v=[])=>[...v,N]),[f]),g=Es.useCallback(N=>f((v=[])=>v.filter(b=>b!==N)),[f]);return e.jsx(NN,{scope:l.__scopeAccordion,value:h,onItemOpen:p,onItemClose:g,children:e.jsx(bN,{scope:l.__scopeAccordion,collapsible:!0,children:e.jsx(yN,{...x,ref:n})})})}),[CC,Zo]=Xo(Qa),yN=Es.forwardRef((l,n)=>{const{__scopeAccordion:i,disabled:c,dir:u,orientation:x="vertical",...h}=l,f=Es.useRef(null),p=Uo(f,n),g=bC(i),v=lj(u)==="ltr",b=cn(l.onKeyDown,w=>{if(!NC.includes(w.key))return;const y=w.target,R=g().filter(Q=>!Q.ref.current?.disabled),D=R.findIndex(Q=>Q.ref.current===y),k=R.length;if(D===-1)return;w.preventDefault();let I=D;const M=0,S=k-1,T=()=>{I=D+1,I>S&&(I=M)},$=()=>{I=D-1,I{const{__scopeAccordion:i,value:c,...u}=l,x=Zo(Oo,i),h=wC(Oo,i),f=Zm(i),p=Cm(),g=c&&h.value.includes(c)||!1,N=x.disabled||l.disabled;return e.jsx(TC,{scope:i,open:g,disabled:N,triggerId:p,children:e.jsx(Bg,{"data-orientation":x.orientation,"data-state":EN(g),...f,...u,ref:n,disabled:N,open:g,onOpenChange:v=>{v?h.onItemOpen(c):h.onItemClose(c)}})})});wN.displayName=Oo;var _N="AccordionHeader",SN=Es.forwardRef((l,n)=>{const{__scopeAccordion:i,...c}=l,u=Zo(Qa,i),x=Wm(_N,i);return e.jsx($n.h3,{"data-orientation":u.orientation,"data-state":EN(x.open),"data-disabled":x.disabled?"":void 0,...c,ref:n})});SN.displayName=_N;var Dm="AccordionTrigger",kN=Es.forwardRef((l,n)=>{const{__scopeAccordion:i,...c}=l,u=Zo(Qa,i),x=Wm(Dm,i),h=_C(Dm,i),f=Zm(i);return e.jsx(Xm.ItemSlot,{scope:i,children:e.jsx(Q0,{"aria-disabled":x.open&&!h.collapsible||void 0,"data-orientation":u.orientation,id:x.triggerId,...f,...c,ref:n})})});kN.displayName=Dm;var CN="AccordionContent",TN=Es.forwardRef((l,n)=>{const{__scopeAccordion:i,...c}=l,u=Zo(Qa,i),x=Wm(CN,i),h=Zm(i);return e.jsx(Y0,{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}})});TN.displayName=CN;function EN(l){return l?"open":"closed"}var EC=vN,MC=wN,AC=SN,MN=kN,AN=TN;const zC=EC,zN=m.forwardRef(({className:l,...n},i)=>e.jsx(MC,{ref:i,className:B("border-b",l),...n}));zN.displayName="AccordionItem";const DN=m.forwardRef(({className:l,children:n,...i},c)=>e.jsx(AC,{className:"flex",children:e.jsxs(MN,{ref:c,className:B("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($a,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));DN.displayName=MN.displayName;const ON=m.forwardRef(({className:l,children:n,...i},c)=>e.jsx(AN,{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:B("pb-4 pt-0",l),children:n})}));ON.displayName=AN.displayName;const DC={utils:"通用工具",utils_small:"轻量工具",tool_use:"工具调用",replyer:"回复生成",planner:"规划推理",vlm:"视觉模型",voice:"语音处理",embedding:"向量嵌入",lpmm_entity_extract:"实体提取",lpmm_rdf_build:"RDF构建",lpmm_qa:"问答模型"};function OC(){const{packId:l}=$N.useParams(),n=aa(),[i,c]=m.useState(null),[u,x]=m.useState(!0),[h,f]=m.useState(!1),[p,g]=m.useState(!1),[N,v]=m.useState(!1),[b,w]=m.useState(1),[y,R]=m.useState(null),[D,k]=m.useState(!1),[I,M]=m.useState(!1),[S,T]=m.useState({apply_providers:!0,apply_models:!0,apply_task_config:!0,task_mode:"append",selected_providers:void 0,selected_models:void 0,selected_tasks:void 0}),[$,A]=m.useState({}),[Q,G]=m.useState({}),de=ov(),oe=m.useCallback(async()=>{if(l){x(!0);try{const z=await U_(l);c(z);const V=await cv(l,de);f(V)}catch(z){console.error("加载 Pack 失败:",z),Gt({title:"加载模板失败",variant:"destructive"})}finally{x(!1)}}},[l,de]);m.useEffect(()=>{oe()},[oe]);const ve=async()=>{if(!(!l||p)){g(!0);try{const z=await iv(l,de);f(z.liked),i&&c({...i,likes:z.likes})}catch(z){console.error("点赞失败:",z),Gt({title:"点赞失败",variant:"destructive"})}finally{g(!1)}}},le=async()=>{if(i){v(!0),w(1),k(!0);try{const z=await I_(i);R(z);const V={};for(const L of z.existing_providers)V[L.pack_provider.name]=L.local_providers[0].name;A(V);const U={};for(const L of z.new_providers)U[L.name]="";G(U)}catch(z){console.error("检测冲突失败:",z),Gt({title:"检测配置冲突失败",variant:"destructive"}),v(!1)}finally{k(!1)}}},fe=async()=>{if(i){if(S.apply_providers&&y){for(const z of y.new_providers)if(!Q[z.name]){Gt({title:`请填写提供商 "${z.name}" 的 API Key`,variant:"destructive"});return}}M(!0);try{await P_(i,S,$,Q),await $_(i.id,de),c({...i,downloads:i.downloads+1}),Gt({title:"配置模板应用成功!"}),v(!1)}catch(z){console.error("应用 Pack 失败:",z),Gt({title:z instanceof Error?z.message:"应用配置失败",variant:"destructive"})}finally{M(!1)}}},ge=z=>new Date(z).toLocaleDateString("zh-CN",{year:"numeric",month:"long",day:"numeric"});return u?e.jsx(LC,{}):i?e.jsx("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:e.jsx(es,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsxs(C,{variant:"ghost",size:"sm",onClick:()=>n({to:"/config/pack-market"}),className:"gap-2",children:[e.jsx(Va,{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(Wt,{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(Ae,{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(Dn,{className:"w-4 h-4"}),i.author]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(kl,{className:"w-4 h-4"}),ge(i.created_at)]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Xt,{className:"w-4 h-4"}),i.downloads," 次下载"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(To,{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(Ae,{variant:"outline",children:[e.jsx($o,{className:"w-3 h-3 mr-1"}),z]},z))})]}),e.jsxs("div",{className:"flex flex-col gap-2 min-w-[160px]",children:[e.jsxs(C,{size:"lg",onClick:le,children:[e.jsx(Xt,{className:"w-4 h-4 mr-2"}),"应用模板"]}),e.jsxs(C,{variant:"outline",onClick:ve,disabled:p,className:h?"text-red-500 border-red-200":"",children:[e.jsx(To,{className:`w-4 h-4 mr-2 ${h?"fill-current":""}`}),h?"已点赞":"点赞"]})]})]}),e.jsx($r,{}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx(De,{children:e.jsxs(Qe,{className:"flex items-center gap-3 py-4",children:[e.jsx(Tl,{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(De,{children:e.jsxs(Qe,{className:"flex items-center gap-3 py-4",children:[e.jsx(Rn,{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(De,{children:e.jsxs(Qe,{className:"flex items-center gap-3 py-4",children:[e.jsx(Ln,{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(ma,{defaultValue:"providers",className:"space-y-4",children:[e.jsxs(ta,{children:[e.jsxs(as,{value:"providers",children:[e.jsx(Tl,{className:"w-4 h-4 mr-2"}),"提供商 (",i.providers.length,")"]}),e.jsxs(as,{value:"models",children:[e.jsx(Rn,{className:"w-4 h-4 mr-2"}),"模型 (",i.models.length,")"]}),e.jsxs(as,{value:"tasks",children:[e.jsx(Ln,{className:"w-4 h-4 mr-2"}),"任务配置 (",Object.keys(i.task_config).length,")"]})]}),e.jsx(ys,{value:"providers",children:e.jsxs(De,{children:[e.jsxs(Xe,{children:[e.jsx(We,{children:"API 提供商"}),e.jsx(Is,{children:"模板中包含的 API 提供商配置(不含 API Key)"})]}),e.jsx(Qe,{children:e.jsxs(El,{children:[e.jsx(Ml,{children:e.jsxs(ct,{children:[e.jsx(Je,{children:"名称"}),e.jsx(Je,{children:"Base URL"}),e.jsx(Je,{children:"类型"})]})}),e.jsx(Al,{children:i.providers.map(z=>e.jsxs(ct,{children:[e.jsx(He,{className:"font-medium",children:z.name}),e.jsx(He,{className:"text-muted-foreground font-mono text-sm",children:z.base_url}),e.jsx(He,{children:e.jsx(Ae,{variant:"outline",children:z.client_type})})]},z.name))})]})})]})}),e.jsx(ys,{value:"models",children:e.jsxs(De,{children:[e.jsxs(Xe,{children:[e.jsx(We,{children:"模型配置"}),e.jsx(Is,{children:"模板中包含的模型配置"})]}),e.jsx(Qe,{children:e.jsxs(El,{children:[e.jsx(Ml,{children:e.jsxs(ct,{children:[e.jsx(Je,{children:"模型名称"}),e.jsx(Je,{children:"标识符"}),e.jsx(Je,{children:"提供商"}),e.jsx(Je,{className:"text-right",children:"价格 (入/出)"})]})}),e.jsx(Al,{children:i.models.map(z=>e.jsxs(ct,{children:[e.jsx(He,{className:"font-medium",children:z.name}),e.jsx(He,{className:"text-muted-foreground font-mono text-sm",children:z.model_identifier}),e.jsx(He,{children:z.api_provider}),e.jsxs(He,{className:"text-right text-muted-foreground",children:["¥",z.price_in," / ¥",z.price_out]})]},z.name))})]})})]})}),e.jsx(ys,{value:"tasks",children:e.jsxs(De,{children:[e.jsxs(Xe,{children:[e.jsx(We,{children:"任务配置"}),e.jsx(Is,{children:"模板中各任务类型的模型分配"})]}),e.jsx(Qe,{children:e.jsx(zC,{type:"multiple",className:"w-full",children:Object.entries(i.task_config).map(([z,V])=>e.jsxs(zN,{value:z,children:[e.jsx(DN,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(In,{className:"w-4 h-4"}),DC[z]||z,e.jsxs(Ae,{variant:"secondary",className:"ml-2",children:[V.model_list.length," 个模型"]})]})}),e.jsx(ON,{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(U=>e.jsx(Ae,{variant:"outline",children:U},U))}),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(RC,{open:N,onOpenChange:v,pack:i,step:b,setStep:w,conflicts:y,detectingConflicts:D,applying:I,options:S,setOptions:T,_providerMapping:$,_setProviderMapping:A,newProviderApiKeys:Q,setNewProviderApiKeys:G,onApply:fe})]})})}):e.jsxs("div",{className:"text-center py-12",children:[e.jsx(Wt,{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(C,{className:"mt-4",onClick:()=>n({to:"/config/pack-market"}),children:[e.jsx(Va,{className:"w-4 h-4 mr-2"}),"返回市场"]})]})}function RC({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(Ks,{open:l,onOpenChange:n,children:e.jsxs(Ps,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Hs,{children:[e.jsxs(Gs,{className:"flex items-center gap-2",children:[e.jsx(Wt,{className:"w-5 h-5"}),"应用配置模板"]}),e.jsxs(ot,{children:["步骤 ",c," / ",3,":",c===1&&"选择要应用的内容",c===2&&"配置提供商映射",c===3&&"确认并应用"]})]}),h?e.jsxs("div",{className:"py-8 text-center",children:[e.jsx(zs,{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(Xs,{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(Tl,{className:"w-4 h-4"}),"应用提供商配置 (",i.providers.length," 个)"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Xs,{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(Rn,{className:"w-4 h-4"}),"应用模型配置 (",i.models.length," 个)"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Xs,{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(Ln,{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(Jm,{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(Do,{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(Do,{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(nt,{children:[e.jsx(qt,{className:"h-4 w-4"}),e.jsx(An,{children:"发现已有的提供商"}),e.jsx(rt,{children:"以下提供商的 URL 与您本地配置中的提供商匹配,将自动使用本地提供商:"})]}),e.jsx("div",{className:"space-y-2",children:x.existing_providers.map(({pack_provider:D,local_providers:k})=>e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-lg",children:[e.jsx(St,{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(Sa,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),k.length===1?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-muted-foreground",children:k[0].name}),e.jsx(Ae,{variant:"outline",className:"ml-auto",children:"URL 匹配"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(Be,{value:N[D.name]||k[0].name,onValueChange:I=>v({...N,[D.name]:I}),children:[e.jsx(Le,{className:"w-[200px]",children:e.jsx($e,{})}),e.jsx(Ue,{children:k.map(I=>e.jsx(ae,{value:I.name,children:I.name},I.name))})]}),e.jsxs(Ae,{variant:"outline",className:"ml-auto",children:[k.length," 个匹配"]})]})]},D.name))})]}),p.apply_providers&&x.new_providers.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs(nt,{variant:"destructive",children:[e.jsx(Ft,{className:"h-4 w-4"}),e.jsx(An,{children:"需要配置 API Key"}),e.jsx(rt,{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(Om,{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(ie,{type:"password",placeholder:`输入 ${D.name} 的 API Key`,value:b[D.name]||"",onChange:k=>w({...b,[D.name]:k.target.value})})]},D.name))})]}),(!p.apply_providers||x.existing_providers.length===0&&x.new_providers.length===0)&&e.jsxs(nt,{children:[e.jsx(St,{className:"h-4 w-4"}),e.jsx(An,{children:"无需配置"}),e.jsx(rt,{children:"模板中没有提供商配置,或您选择不应用提供商。"})]})]}),c===3&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(nt,{children:[e.jsx(qt,{className:"h-4 w-4"}),e.jsx(An,{children:"确认应用"}),e.jsx(rt,{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(St,{className:"w-4 h-4 text-green-500"}),e.jsx(Tl,{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(St,{className:"w-4 h-4 text-green-500"}),e.jsx(Rn,{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(St,{className:"w-4 h-4 text-green-500"}),e.jsx(Ln,{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(nt,{variant:"destructive",children:[e.jsx(Ft,{className:"h-4 w-4"}),e.jsxs(rt,{children:["将添加 ",x.new_providers.length," 个新提供商,请确保已填写正确的 API Key。"]})]})]})]}),e.jsxs(xt,{className:"flex justify-between",children:[e.jsx("div",{children:c>1&&!h&&e.jsx(C,{variant:"outline",onClick:()=>u(c-1),disabled:f,children:"上一步"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(C,{variant:"outline",onClick:()=>n(!1),disabled:f,children:"取消"}),c<3?e.jsx(C,{onClick:()=>u(c+1),disabled:h,children:"下一步"}):e.jsxs(C,{onClick:y,disabled:f,children:[f&&e.jsx(zs,{className:"w-4 h-4 mr-2 animate-spin"}),"应用模板"]})]})]})]})})}function LC(){return e.jsx("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:e.jsx(es,{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 UC(){const l=aa(),[n,i]=m.useState(!0);return m.useEffect(()=>{let c=!1;return(async()=>{try{const x=await Fi();!c&&!x&&l({to:"/auth"})}catch{c||l({to:"/auth"})}finally{c||i(!1)}})(),()=>{c=!0}},[l]),{checking:n}}async function BC(){return await Fi()}const $C=Lr("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"}}),RN=m.forwardRef(({className:l,size:n,abbrTitle:i,children:c,...u},x)=>e.jsx("kbd",{className:B($C({size:n,className:l})),ref:x,...u,children:i?e.jsx("abbr",{title:i,children:c}):c}));RN.displayName="Kbd";const IC=[{icon:Bo,title:"首页",description:"查看仪表板概览",path:"/",category:"概览"},{icon:qa,title:"麦麦主程序配置",description:"配置麦麦的核心设置",path:"/config/bot",category:"配置"},{icon:Tl,title:"麦麦模型提供商配置",description:"配置模型提供商",path:"/config/modelProvider",category:"配置"},{icon:Cj,title:"麦麦模型配置",description:"配置模型参数",path:"/config/model",category:"配置"},{icon:Rm,title:"表情包管理",description:"管理麦麦的表情包",path:"/resource/emoji",category:"资源"},{icon:on,title:"表达方式管理",description:"管理麦麦的表达方式",path:"/resource/expression",category:"资源"},{icon:Tj,title:"人物信息管理",description:"管理人物信息",path:"/resource/person",category:"资源"},{icon:Or,title:"黑话管理",description:"管理麦麦学习到的黑话和俚语",path:"/resource/jargon",category:"资源"},{icon:Ww,title:"统计信息",description:"查看使用统计",path:"/statistics",category:"监控"},{icon:Wt,title:"插件市场",description:"浏览和安装插件",path:"/plugins",category:"扩展"},{icon:Lm,title:"日志查看器",description:"查看系统日志",path:"/logs",category:"监控"},{icon:In,title:"系统设置",description:"配置系统参数",path:"/settings",category:"系统"}];function PC({open:l,onOpenChange:n}){const[i,c]=m.useState(""),[u,x]=m.useState(0),h=aa(),f=IC.filter(N=>N.title.toLowerCase().includes(i.toLowerCase())||N.description.toLowerCase().includes(i.toLowerCase())||N.category.toLowerCase().includes(i.toLowerCase())),p=m.useCallback(N=>{h({to:N}),n(!1),c(""),x(0)},[h,n]),g=m.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(Ks,{open:l,onOpenChange:n,children:e.jsxs(Ps,{className:"max-w-2xl p-0 gap-0",children:[e.jsxs(Hs,{className:"px-4 pt-4 pb-0",children:[e.jsx(Gs,{className:"sr-only",children:"搜索"}),e.jsxs("div",{className:"relative",children:[e.jsx(Vt,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground"}),e.jsx(ie,{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(es,{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:B("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(Vt,{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 HC(){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]=m.useState(l&&!i&&!c),[h,f]=m.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(Ft,{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(C,{variant:"ghost",size:"icon",onClick:p,className:"h-8 w-8 text-amber-700 hover:text-amber-900 dark:text-amber-400 dark:hover:text-amber-200 flex-shrink-0","aria-label":"关闭警告",children:e.jsx(_a,{className:"h-4 w-4"})})]})})})}function GC(){const[l,n]=m.useState(0),[i,c]=m.useState(!1),u=m.useRef(null);m.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:B("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(C,{variant:"outline",size:"icon",className:B("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(e1,{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 FC=ww,qC=_w,VC=Sw,LN=m.forwardRef(({className:l,sideOffset:n=4,...i},c)=>e.jsx(yw,{children:e.jsx(nj,{ref:c,sideOffset:n,className:B("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})}));LN.displayName=nj.displayName;function KC({children:l}){const{checking:n}=UC(),[i,c]=m.useState(!0),[u,x]=m.useState(!1),[h,f]=m.useState(!1),{theme:p,setTheme:g}=Bm(),N=a0();if(m.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:Bo,label:"首页",path:"/"}]},{title:"麦麦配置编辑",items:[{icon:qa,label:"麦麦主程序配置",path:"/config/bot"},{icon:Tl,label:"AI模型厂商配置",path:"/config/modelProvider",tourId:"sidebar-model-provider"},{icon:Cj,label:"模型管理与分配",path:"/config/model",tourId:"sidebar-model-management"},{icon:Qp,label:"麦麦适配器配置",path:"/config/adapter"}]},{title:"麦麦资源管理",items:[{icon:Rm,label:"表情包管理",path:"/resource/emoji"},{icon:on,label:"表达方式管理",path:"/resource/expression"},{icon:Or,label:"黑话管理",path:"/resource/jargon"},{icon:Tj,label:"人物信息管理",path:"/resource/person"},{icon:yj,label:"知识库图谱可视化",path:"/resource/knowledge-graph"},{icon:zr,label:"麦麦知识库管理",path:"/resource/knowledge-base"}]},{title:"扩展与监控",items:[{icon:Wt,label:"插件市场",path:"/plugins"},{icon:_j,label:"配置模板市场",path:"/config/pack-market"},{icon:Qp,label:"插件配置",path:"/plugin-config"},{icon:Lm,label:"日志查看器",path:"/logs"},{icon:on,label:"本地聊天室",path:"/chat"}]},{title:"系统",items:[{icon:In,label:"系统设置",path:"/settings"}]}],w=p==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":p,y=async()=>{await R1()};return e.jsx(FC,{delayDuration:300,children:e.jsxs("div",{className:"flex h-screen overflow-hidden",children:[e.jsxs("aside",{className:B("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:B("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:B("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:n2()})]}),!i&&e.jsx("span",{className:"hidden lg:block font-bold text-primary-gradient text-2xl",children:"M"})]})}),e.jsx(es,{className:B("flex-1 overflow-x-hidden",!i&&"lg:w-16"),children:e.jsx("nav",{className:B("p-4",!i&&"lg:p-2 lg:w-16"),children:e.jsx("ul",{className:B("space-y-6",!i&&"lg:space-y-3 lg:w-full"),children:v.map((R,D)=>e.jsxs("li",{children:[e.jsx("div",{className:B("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(k=>{const I=N({to:k.path}),M=k.icon,S=e.jsxs(e.Fragment,{children:[I&&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:B("flex items-center transition-all duration-300",i?"gap-3":"gap-3 lg:gap-0"),children:[e.jsx(M,{className:B("h-5 w-5 flex-shrink-0",I&&"text-primary"),strokeWidth:2,fill:"none"}),e.jsx("span",{className:B("text-sm font-medium whitespace-nowrap transition-all duration-300",I&&"font-semibold",i?"opacity-100 max-w-[200px]":"opacity-100 max-w-[200px] lg:opacity-0 lg:max-w-0 lg:overflow-hidden"),children:k.label})]})]});return e.jsx("li",{className:"relative",children:e.jsxs(qC,{children:[e.jsx(VC,{asChild:!0,children:e.jsx(Cr,{to:k.path,"data-tour":k.tourId,className:B("relative flex items-center rounded-lg py-2 transition-all duration-300","hover:bg-accent hover:text-accent-foreground",I?"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:S})}),!i&&e.jsx(LN,{side:"right",className:"hidden lg:block",children:e.jsx("p",{children:k.label})})]})},k.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(HC,{}),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(s1,{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(ll,{className:B("h-5 w-5 transition-transform",!i&&"rotate-180")})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[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(Vt,{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(RN,{size:"sm",className:"absolute right-2 top-1/2 -translate-y-1/2",children:[e.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),e.jsx(PC,{open:h,onOpenChange:f}),e.jsxs(C,{variant:"ghost",size:"sm",onClick:()=>window.open("https://docs.mai-mai.org","_blank"),className:"gap-2",title:"查看麦麦文档",children:[e.jsx(t1,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"麦麦文档"})]}),e.jsx("button",{onClick:R=>{J1(w==="dark"?"light":"dark",g,R)},className:"rounded-lg p-2 hover:bg-accent",title:w==="dark"?"切换到浅色模式":"切换到深色模式",children:w==="dark"?e.jsx(hj,{className:"h-5 w-5"}):e.jsx(fj,{className:"h-5 w-5"})}),e.jsx("div",{className:"h-6 w-px bg-border"}),e.jsxs(C,{variant:"ghost",size:"sm",onClick:y,className:"gap-2",title:"登出系统",children:[e.jsx(a1,{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(GC,{})]})]})})}function QC(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 YC({error:l,errorInfo:n}){const[i,c]=m.useState(!0),[u,x]=m.useState(!1),[h,f]=m.useState(!1),p=l.stack?QC(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(nt,{variant:"destructive",className:"border-red-500/50 bg-red-500/10",children:[e.jsx(Ft,{className:"h-4 w-4"}),e.jsxs(rt,{className:"font-mono text-sm",children:[e.jsxs("span",{className:"font-semibold",children:[l.name,":"]})," ",l.message]})]}),p.length>0&&e.jsxs(Ki,{open:i,onOpenChange:c,children:[e.jsx(Qi,{asChild:!0,children:e.jsxs(C,{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(l1,{className:"h-4 w-4"}),"Stack Trace (",p.length," frames)"]}),i?e.jsx(Dr,{className:"h-4 w-4"}):e.jsx($a,{className:"h-4 w-4"})]})}),e.jsx(Yi,{children:e.jsx(es,{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(Ki,{open:u,onOpenChange:x,children:[e.jsx(Qi,{asChild:!0,children:e.jsxs(C,{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(Ft,{className:"h-4 w-4"}),"Component Stack"]}),u?e.jsx(Dr,{className:"h-4 w-4"}):e.jsx($a,{className:"h-4 w-4"})]})}),e.jsx(Yi,{children:e.jsx(es,{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(C,{variant:"outline",size:"sm",onClick:g,className:"w-full",children:h?e.jsxs(e.Fragment,{children:[e.jsx(St,{className:"mr-2 h-4 w-4 text-green-500"}),"已复制到剪贴板"]}):e.jsxs(e.Fragment,{children:[e.jsx(ko,{className:"mr-2 h-4 w-4"}),"复制错误信息"]})})]})}function UN({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(De,{className:"w-full max-w-2xl shadow-lg",children:[e.jsxs(Xe,{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(Ft,{className:"h-8 w-8 text-red-600 dark:text-red-400"})}),e.jsx(We,{className:"text-2xl font-bold",children:"页面出现了问题"}),e.jsx(Is,{className:"text-base mt-2",children:"应用程序遇到了意外错误。您可以尝试刷新页面或返回首页。"})]}),e.jsxs(Qe,{className:"space-y-4",children:[e.jsx(YC,{error:l,errorInfo:n}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 pt-2",children:[e.jsxs(C,{onClick:c,className:"flex-1",children:[e.jsx(kt,{className:"mr-2 h-4 w-4"}),"刷新页面"]}),e.jsxs(C,{onClick:i,variant:"outline",className:"flex-1",children:[e.jsx(Bo,{className:"mr-2 h-4 w-4"}),"返回首页"]})]}),e.jsx("p",{className:"text-xs text-center text-muted-foreground pt-2",children:"如果问题持续存在,请将错误信息复制并反馈给开发者"})]})]})})}class JC extends m.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(UN,{error:this.state.error,errorInfo:this.state.errorInfo}):this.props.children}}function BN({error:l}){return e.jsx(UN,{error:l,errorInfo:null})}const ec=l0({component:()=>e.jsxs(e.Fragment,{children:[e.jsx(bg,{}),!1]}),beforeLoad:()=>{if(window.location.pathname==="/"&&!BC())throw r0({to:"/auth"})}}),XC=Zs({getParentRoute:()=>ec,path:"/auth",component:y2}),ZC=Zs({getParentRoute:()=>ec,path:"/setup",component:B2}),ht=Zs({getParentRoute:()=>ec,id:"protected",component:()=>e.jsx(KC,{children:e.jsx(bg,{})}),errorComponent:({error:l})=>e.jsx(BN,{error:l})}),WC=Zs({getParentRoute:()=>ht,path:"/",component:V1}),e3=Zs({getParentRoute:()=>ht,path:"/config/bot",component:j_}),s3=Zs({getParentRoute:()=>ht,path:"/config/modelProvider",component:M_}),t3=Zs({getParentRoute:()=>ht,path:"/config/model",component:tS}),a3=Zs({getParentRoute:()=>ht,path:"/config/adapter",component:_S}),l3=Zs({getParentRoute:()=>ht,path:"/resource/emoji",component:KS}),n3=Zs({getParentRoute:()=>ht,path:"/resource/expression",component:n4}),r3=Zs({getParentRoute:()=>ht,path:"/resource/person",component:E4}),i3=Zs({getParentRoute:()=>ht,path:"/resource/jargon",component:v4}),c3=Zs({getParentRoute:()=>ht,path:"/resource/knowledge-graph",component:B4}),o3=Zs({getParentRoute:()=>ht,path:"/resource/knowledge-base",component:$4}),d3=Zs({getParentRoute:()=>ht,path:"/logs",component:P4}),u3=Zs({getParentRoute:()=>ht,path:"/chat",component:kk}),m3=Zs({getParentRoute:()=>ht,path:"/plugins",component:ik}),x3=Zs({getParentRoute:()=>ht,path:"/plugin-detail",component:gk}),h3=Zs({getParentRoute:()=>ht,path:"/model-presets",component:ok}),f3=Zs({getParentRoute:()=>ht,path:"/plugin-config",component:mk}),p3=Zs({getParentRoute:()=>ht,path:"/plugin-mirrors",component:hk}),g3=Zs({getParentRoute:()=>ht,path:"/settings",component:f2}),j3=Zs({getParentRoute:()=>ht,path:"/config/pack-market",component:jC}),$N=Zs({getParentRoute:()=>ht,path:"/config/pack-market/$packId",component:OC}),v3=Zs({getParentRoute:()=>ht,path:"/survey/webui-feedback",component:Hk}),N3=Zs({getParentRoute:()=>ht,path:"/survey/maibot-feedback",component:Gk}),b3=Zs({getParentRoute:()=>ec,path:"*",component:Xj}),y3=ec.addChildren([XC,ZC,ht.addChildren([WC,e3,s3,t3,a3,l3,n3,i3,r3,c3,o3,m3,x3,h3,f3,p3,d3,u3,g3,j3,$N,v3,N3]),b3]),w3=n0({routeTree:y3,defaultNotFoundComponent:Xj,defaultErrorComponent:({error:l})=>e.jsx(BN,{error:l})});function _3({children:l,defaultTheme:n="system",storageKey:i="ui-theme",...c}){const[u,x]=m.useState(()=>localStorage.getItem(i)||n);m.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]),m.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(qj.Provider,{...c,value:h,children:l})}function S3({children:l,defaultEnabled:n=!0,defaultWavesEnabled:i=!0,storageKey:c="enable-animations",wavesStorageKey:u="enable-waves-background"}){const[x,h]=m.useState(()=>{const N=localStorage.getItem(c);return N!==null?N==="true":n}),[f,p]=m.useState(()=>{const N=localStorage.getItem(u);return N!==null?N==="true":i});m.useEffect(()=>{const N=document.documentElement;x?N.classList.remove("no-animations"):N.classList.add("no-animations"),localStorage.setItem(c,String(x))},[x,c]),m.useEffect(()=>{localStorage.setItem(u,String(f))},[f,u]);const g={enableAnimations:x,setEnableAnimations:h,enableWavesBackground:f,setEnableWavesBackground:p};return e.jsx(Vj.Provider,{value:g,children:l})}const k3=kw,IN=m.forwardRef(({className:l,...n},i)=>e.jsx(rj,{ref:i,className:B("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}));IN.displayName=rj.displayName;const C3=Lr("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"}}),PN=m.forwardRef(({className:l,variant:n,...i},c)=>e.jsx(ij,{ref:c,className:B(C3({variant:n}),l),...i}));PN.displayName=ij.displayName;const T3=m.forwardRef(({className:l,...n},i)=>e.jsx(cj,{ref:i,className:B("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}));T3.displayName=cj.displayName;const HN=m.forwardRef(({className:l,...n},i)=>e.jsx(oj,{ref:i,className:B("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(_a,{className:"h-4 w-4"})}));HN.displayName=oj.displayName;const GN=m.forwardRef(({className:l,...n},i)=>e.jsx(dj,{ref:i,className:B("text-sm font-semibold [&+div]:text-xs",l),...n}));GN.displayName=dj.displayName;const FN=m.forwardRef(({className:l,...n},i)=>e.jsx(uj,{ref:i,className:B("text-sm opacity-90",l),...n}));FN.displayName=uj.displayName;function E3(){const{toasts:l}=Ws();return e.jsxs(k3,{children:[l.map(function({id:n,title:i,description:c,action:u,...x}){return e.jsxs(PN,{...x,children:[e.jsxs("div",{className:"grid gap-1",children:[i&&e.jsx(GN,{children:i}),c&&e.jsx(FN,{children:c})]}),u,e.jsx(HN,{})]},n)}),e.jsx(IN,{})]})}O1.createRoot(document.getElementById("root")).render(e.jsx(m.StrictMode,{children:e.jsx(JC,{children:e.jsx(_3,{defaultTheme:"system",children:e.jsx(S3,{children:e.jsxs(__,{children:[e.jsx(i0,{router:w3}),e.jsx(C_,{}),e.jsx(E3,{})]})})})})})); diff --git a/webui/dist/index.html b/webui/dist/index.html index 2743cd31..a33bcc6c 100644 --- a/webui/dist/index.html +++ b/webui/dist/index.html @@ -11,7 +11,7 @@ MaiBot Dashboard - + @@ -25,7 +25,7 @@ - +