From 056b4df2dd6e0342d6f33bdda1daf3115a153c39 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, 13 Jan 2026 00:43:55 +0800 Subject: [PATCH] WebUI b2a259fbc4c8477f2ab01eb5e7a75969cda53a1e --- .../{index-DD4VGX3W.js => index-CbKchl83.js} | 50 +++++++++---------- webui/dist/assets/index-DkXVyv8m.css | 1 + webui/dist/assets/index-RB5cYCSR.css | 1 - webui/dist/index.html | 4 +- 4 files changed, 28 insertions(+), 28 deletions(-) rename webui/dist/assets/{index-DD4VGX3W.js => index-CbKchl83.js} (83%) create mode 100644 webui/dist/assets/index-DkXVyv8m.css delete mode 100644 webui/dist/assets/index-RB5cYCSR.css diff --git a/webui/dist/assets/index-DD4VGX3W.js b/webui/dist/assets/index-CbKchl83.js similarity index 83% rename from webui/dist/assets/index-DD4VGX3W.js rename to webui/dist/assets/index-CbKchl83.js index d54d300c..8099353e 100644 --- a/webui/dist/assets/index-DD4VGX3W.js +++ b/webui/dist/assets/index-CbKchl83.js @@ -1,35 +1,35 @@ -import{r as u,j as e,L as Kn,e as ha,R as Bs,b as tw,f as aw,g as lw,h as nw,k as rw,l as lt,m as iw,n as cw,O as xj,o as ow}from"./router-9vIXuQkh.js";import{a as dw,b as uw,g as mw}from"./react-vendor-BmxF9s7Q.js";import{N as xw,c as hw,O as ti,P as fw,g as Em}from"./utils-BqoaXoQ1.js";import{L as hj,T as fj,C as pj,R as pw,a as gj,V as gw,b as jw,S as jj,c as vw,d as vj,I as Nw,e as Nj,f as bw,g as bj,h as yw,i as ww,j as _w,O as yj,P as Sw,k as wj,l as _j,D as Sj,A as kj,m as Cj,n as kw,o as Cw,p as Tj,q as Tw,r as Ej,s as Ew,t as Mw,u as Mj,v as Aw,w as zw,x as Aj,y as zj,F as Rj,z as Dj,B as Rw,E as Dw,G as Oj,H as Ow,J as Lw,K as Uw,M as $w,N as Bw,Q as Iw,U as Pw,W as Fw,X as Hw,Y as qw,Z as Vw,_ as Gw,$ as Kw,a0 as Qw,a1 as Yw,a2 as Lj,a3 as Jw,a4 as Xw}from"./radix-extra-DmmnfeQE.js";import{R as Uj,T as $j,L as Zw,g as Ww,C as Ji,X as Xi,Y as Gr,h as e1,B as Bo,j as Zi,P as s1,k as t1,l as a1}from"./charts-simvewUa.js";import{S as l1,O as Bj,o as n1,C as Ij,p as r1,T as Pj,D as Fj,R as i1,q as c1,H as Hj,I as o1,J as qj,K as d1,L as Vj,M as Gj,N as u1,Q as Kj,V as m1,U as Qj,X as Yj,Y as x1,Z as h1,_ as Jj,$ as f1,a0 as p1,a1 as Xj,a2 as g1,a3 as Zj,a4 as j1,a5 as v1,a6 as N1,e as Wj,f as ad,c as ld,P as ar,d as nd,b as _n,h as b1,l as y1,m as w1,u as Ym,r as _1,a as S1,a7 as ev,a8 as sv,a9 as tv,aa as av,ab as lv,ac as nv,ad as k1}from"./radix-core-DyJi0yyw.js";import{R as dt,a as rc,C as Ut,b as st,L as Fs,X as Sa,c as Ot,d as Ba,e as Xr,f as Pa,g as ra,E as C1,h as rv,Z as sl,i as da,j as ta,S as $t,B as iv,U as Fl,k as Yn,P as pc,l as cv,F as Ua,m as T1,n as Sn,o as E1,M as Ia,A as nx,D as M1,p as Zr,T as rx,q as A1,r as ov,I as Yt,s as Lt,t as qo,u as ic,v as ua,H as z1,w as os,x as na,y as cc,z as ix,G as tc,J as Jm,K as cx,N as ox,O as R1,Q as Io,V as D1,W as rd,Y as O1,_ as L1,$ as id,a0 as $a,a1 as Xs,a2 as dx,a3 as ux,a4 as dv,a5 as gc,a6 as uv,a7 as Zn,a8 as kn,a9 as Cn,aa as mx,ab as mv,ac as xa,ad as Hl,ae as Wn,af as er,ag as cd,ah as U1,ai as $1,aj as B1,ak as I1,al as xx,am as Po,an as sr,ao as Wr,ap as Vo,aq as P1,ar as Go,as as oc,at as xv,au as F1,av as H1,aw as Ko,ax as q1,ay as hx,az as Mg,aA as V1,aB as G1,aC as hv,aD as K1,aE as vn,aF as fv,aG as Mm,aH as Ag,aI as Q1,aJ as Am,aK as Y1,aL as J1,aM as X1,aN as Z1,aO as pv,aP as W1,aQ as ei,aR as e_,aS as s_,aT as gv,aU as jv,aV as t_,aW as a_,aX as zg,aY as l_,aZ as n_,a_ as r_,a$ as i_,b0 as c_}from"./icons-8bdCaZgy.js";import{S as o_,p as d_,j as u_,a as m_,E as zm,R as x_,o as h_}from"./codemirror-TZqPU532.js";import{u as vv,a as Qo,s as Nv,K as bv,P as yv,b as wv,D as _v,c as Sv,S as kv,v as f_,d as Cv,C as Tv,h as p_}from"./dnd-BiPfFtVp.js";import{_ as ka,c as g_,g as Ev,D as j_,z as Oo}from"./misc-CJqnlRwD.js";import{D as v_,U as N_}from"./uppy-DFP_VzYR.js";import{M as b_,r as y_,a as w_,b as __}from"./markdown-CKA5gBQ9.js";import{c as S_,H as Yo,P as Jo,u as k_,d as C_,R as T_,B as E_,e as M_,C as A_,M as z_,f as R_}from"./reactflow-DtsZHOR4.js";(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))c(d);new MutationObserver(d=>{for(const m of d)if(m.type==="childList")for(const h of m.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&c(h)}).observe(document,{childList:!0,subtree:!0});function r(d){const m={};return d.integrity&&(m.integrity=d.integrity),d.referrerPolicy&&(m.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?m.credentials="include":d.crossOrigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function c(d){if(d.ep)return;d.ep=!0;const m=r(d);fetch(d.href,m)}})();var Rm={exports:{}},Ki={},Dm={exports:{}},Om={};var Rg;function D_(){return Rg||(Rg=1,(function(a){function l(D,Q){var B=D.length;D.push(Q);e:for(;0>>1,Y=D[ue];if(0>>1;ued(Ee,B))Gd($,Ee)?(D[ue]=$,D[G]=B,ue=G):(D[ue]=Ee,D[fe]=B,ue=fe);else if(Gd($,B))D[ue]=$,D[G]=B,ue=G;else break e}}return Q}function d(D,Q){var B=D.sortIndex-Q.sortIndex;return B!==0?B:D.id-Q.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var m=performance;a.unstable_now=function(){return m.now()}}else{var h=Date,f=h.now();a.unstable_now=function(){return h.now()-f}}var p=[],g=[],N=1,j=null,b=3,y=!1,w=!1,z=!1,M=!1,S=typeof setTimeout=="function"?setTimeout:null,F=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function C(D){for(var Q=r(g);Q!==null;){if(Q.callback===null)c(g);else if(Q.startTime<=D)c(g),Q.sortIndex=Q.expirationTime,l(p,Q);else break;Q=r(g)}}function R(D){if(z=!1,C(D),!w)if(r(p)!==null)w=!0,H||(H=!0,je());else{var Q=r(g);Q!==null&&pe(R,Q.startTime-D)}}var H=!1,O=-1,X=5,L=-1;function me(){return M?!0:!(a.unstable_now()-LD&&me());){var ue=j.callback;if(typeof ue=="function"){j.callback=null,b=j.priorityLevel;var Y=ue(j.expirationTime<=D);if(D=a.unstable_now(),typeof Y=="function"){j.callback=Y,C(D),Q=!0;break s}j===r(p)&&c(p),C(D)}else c(p);j=r(p)}if(j!==null)Q=!0;else{var we=r(g);we!==null&&pe(R,we.startTime-D),Q=!1}}break e}finally{j=null,b=B,y=!1}Q=void 0}}finally{Q?je():H=!1}}}var je;if(typeof E=="function")je=function(){E(Ne)};else if(typeof MessageChannel<"u"){var ce=new MessageChannel,ge=ce.port2;ce.port1.onmessage=Ne,je=function(){ge.postMessage(null)}}else je=function(){S(Ne,0)};function pe(D,Q){O=S(function(){D(a.unstable_now())},Q)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(D){D.callback=null},a.unstable_forceFrameRate=function(D){0>D||125ue?(D.sortIndex=B,l(g,D),r(p)===null&&D===r(g)&&(z?(F(O),O=-1):z=!0,pe(R,B-ue))):(D.sortIndex=Y,l(p,D),w||y||(w=!0,H||(H=!0,je()))),D},a.unstable_shouldYield=me,a.unstable_wrapCallback=function(D){var Q=b;return function(){var B=b;b=Q;try{return D.apply(this,arguments)}finally{b=B}}}})(Om)),Om}var Dg;function O_(){return Dg||(Dg=1,Dm.exports=D_()),Dm.exports}var Og;function L_(){if(Og)return Ki;Og=1;var a=O_(),l=dw(),r=uw();function c(s){var t="https://react.dev/errors/"+s;if(1Y||(s.current=ue[Y],ue[Y]=null,Y--)}function Ee(s,t){Y++,ue[Y]=s.current,s.current=t}var G=we(null),$=we(null),A=we(null),K=we(null);function Re(s,t){switch(Ee(A,t),Ee($,s),Ee(G,null),t.nodeType){case 9:case 11:s=(s=t.documentElement)&&(s=s.namespaceURI)?Wp(s):0;break;default:if(s=t.tagName,t=t.namespaceURI)t=Wp(t),s=eg(t,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}fe(G),Ee(G,s)}function se(){fe(G),fe($),fe(A)}function $e(s){s.memoizedState!==null&&Ee(K,s);var t=G.current,n=eg(t,s.type);t!==n&&(Ee($,s),Ee(G,n))}function cs(s){$.current===s&&(fe(G),fe($)),K.current===s&&(fe(K),Hi._currentValue=B)}var J,Z;function Le(s){if(J===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);J=t&&t[1]||"",Z=-1{for(const m of d)if(m.type==="childList")for(const h of m.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&c(h)}).observe(document,{childList:!0,subtree:!0});function r(d){const m={};return d.integrity&&(m.integrity=d.integrity),d.referrerPolicy&&(m.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?m.credentials="include":d.crossOrigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function c(d){if(d.ep)return;d.ep=!0;const m=r(d);fetch(d.href,m)}})();var Rm={exports:{}},Ki={},Dm={exports:{}},Om={};var Rg;function D1(){return Rg||(Rg=1,(function(a){function l(D,Q){var I=D.length;D.push(Q);e:for(;0>>1,Y=D[ue];if(0>>1;ued(Ee,I))Gd($,Ee)?(D[ue]=$,D[G]=I,ue=G):(D[ue]=Ee,D[fe]=I,ue=fe);else if(Gd($,I))D[ue]=$,D[G]=I,ue=G;else break e}}return Q}function d(D,Q){var I=D.sortIndex-Q.sortIndex;return I!==0?I:D.id-Q.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var m=performance;a.unstable_now=function(){return m.now()}}else{var h=Date,f=h.now();a.unstable_now=function(){return h.now()-f}}var p=[],g=[],N=1,j=null,b=3,y=!1,w=!1,z=!1,M=!1,S=typeof setTimeout=="function"?setTimeout:null,F=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function C(D){for(var Q=r(g);Q!==null;){if(Q.callback===null)c(g);else if(Q.startTime<=D)c(g),Q.sortIndex=Q.expirationTime,l(p,Q);else break;Q=r(g)}}function R(D){if(z=!1,C(D),!w)if(r(p)!==null)w=!0,H||(H=!0,je());else{var Q=r(g);Q!==null&&pe(R,Q.startTime-D)}}var H=!1,O=-1,X=5,L=-1;function me(){return M?!0:!(a.unstable_now()-LD&&me());){var ue=j.callback;if(typeof ue=="function"){j.callback=null,b=j.priorityLevel;var Y=ue(j.expirationTime<=D);if(D=a.unstable_now(),typeof Y=="function"){j.callback=Y,C(D),Q=!0;break s}j===r(p)&&c(p),C(D)}else c(p);j=r(p)}if(j!==null)Q=!0;else{var we=r(g);we!==null&&pe(R,we.startTime-D),Q=!1}}break e}finally{j=null,b=I,y=!1}Q=void 0}}finally{Q?je():H=!1}}}var je;if(typeof E=="function")je=function(){E(Ne)};else if(typeof MessageChannel<"u"){var re=new MessageChannel,ge=re.port2;re.port1.onmessage=Ne,je=function(){ge.postMessage(null)}}else je=function(){S(Ne,0)};function pe(D,Q){O=S(function(){D(a.unstable_now())},Q)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(D){D.callback=null},a.unstable_forceFrameRate=function(D){0>D||125ue?(D.sortIndex=I,l(g,D),r(p)===null&&D===r(g)&&(z?(F(O),O=-1):z=!0,pe(R,I-ue))):(D.sortIndex=Y,l(p,D),w||y||(w=!0,H||(H=!0,je()))),D},a.unstable_shouldYield=me,a.unstable_wrapCallback=function(D){var Q=b;return function(){var I=b;b=Q;try{return D.apply(this,arguments)}finally{b=I}}}})(Om)),Om}var Dg;function O1(){return Dg||(Dg=1,Dm.exports=D1()),Dm.exports}var Og;function L1(){if(Og)return Ki;Og=1;var a=O1(),l=dw(),r=uw();function c(s){var t="https://react.dev/errors/"+s;if(1Y||(s.current=ue[Y],ue[Y]=null,Y--)}function Ee(s,t){Y++,ue[Y]=s.current,s.current=t}var G=we(null),$=we(null),A=we(null),K=we(null);function Re(s,t){switch(Ee(A,t),Ee($,s),Ee(G,null),t.nodeType){case 9:case 11:s=(s=t.documentElement)&&(s=s.namespaceURI)?Wp(s):0;break;default:if(s=t.tagName,t=t.namespaceURI)t=Wp(t),s=eg(t,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}fe(G),Ee(G,s)}function se(){fe(G),fe($),fe(A)}function $e(s){s.memoizedState!==null&&Ee(K,s);var t=G.current,n=eg(t,s.type);t!==n&&(Ee($,s),Ee(G,n))}function cs(s){$.current===s&&(fe(G),fe($)),K.current===s&&(fe(K),Hi._currentValue=I)}var J,Z;function Le(s){if(J===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);J=t&&t[1]||"",Z=-1)":-1o||I[i]!==ie[o]){var ve=` -`+I[i].replace(" at new "," at ");return s.displayName&&ve.includes("")&&(ve=ve.replace("",s.displayName)),ve}while(1<=i&&0<=o);break}}}finally{le=!1,Error.prepareStackTrace=n}return(n=s?s.displayName||s.name:"")?Le(n):""}function xe(s,t){switch(s.tag){case 26:case 27:case 5:return Le(s.type);case 16:return Le("Lazy");case 13:return s.child!==t&&t!==null?Le("Suspense Fallback"):Le("Suspense");case 19:return Le("SuspenseList");case 0:case 15:return De(s.type,!1);case 11:return De(s.type.render,!1);case 1:return De(s.type,!0);case 31:return Le("Activity");default:return""}}function Me(s){try{var t="",n=null;do t+=xe(s,n),n=s,s=s.return;while(s);return t}catch(i){return` +`+J+s+Z}var ne=!1;function De(s,t){if(!s||ne)return"";ne=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(t){var ye=function(){throw Error()};if(Object.defineProperty(ye.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ye,[])}catch(he){var de=he}Reflect.construct(s,[],ye)}else{try{ye.call()}catch(he){de=he}s.call(ye.prototype)}}else{try{throw Error()}catch(he){de=he}(ye=s())&&typeof ye.catch=="function"&&ye.catch(function(){})}}catch(he){if(he&&de&&typeof he.stack=="string")return[he.stack,de.stack]}return[null,null]}};i.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var o=Object.getOwnPropertyDescriptor(i.DetermineComponentFrameRoot,"name");o&&o.configurable&&Object.defineProperty(i.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=i.DetermineComponentFrameRoot(),v=x[0],k=x[1];if(v&&k){var B=v.split(` +`),ce=k.split(` +`);for(o=i=0;io||B[i]!==ce[o]){var ve=` +`+B[i].replace(" at new "," at ");return s.displayName&&ve.includes("")&&(ve=ve.replace("",s.displayName)),ve}while(1<=i&&0<=o);break}}}finally{ne=!1,Error.prepareStackTrace=n}return(n=s?s.displayName||s.name:"")?Le(n):""}function xe(s,t){switch(s.tag){case 26:case 27:case 5:return Le(s.type);case 16:return Le("Lazy");case 13:return s.child!==t&&t!==null?Le("Suspense Fallback"):Le("Suspense");case 19:return Le("SuspenseList");case 0:case 15:return De(s.type,!1);case 11:return De(s.type.render,!1);case 1:return De(s.type,!0);case 31:return Le("Activity");default:return""}}function Me(s){try{var t="",n=null;do t+=xe(s,n),n=s,s=s.return;while(s);return t}catch(i){return` Error generating stack: `+i.message+` -`+i.stack}}var ds=Object.prototype.hasOwnProperty,Ts=a.unstable_scheduleCallback,Ct=a.unstable_cancelCallback,ia=a.unstable_shouldYield,ut=a.unstable_requestPaint,Is=a.unstable_now,V=a.unstable_getCurrentPriorityLevel,Ke=a.unstable_ImmediatePriority,He=a.unstable_UserBlockingPriority,Je=a.unstable_NormalPriority,Es=a.unstable_LowPriority,ms=a.unstable_IdlePriority,Ms=a.log,We=a.unstable_setDisableYieldValue,Cs=null,rs=null;function is(s){if(typeof Ms=="function"&&We(s),rs&&typeof rs.setStrictMode=="function")try{rs.setStrictMode(Cs,s)}catch{}}var ys=Math.clz32?Math.clz32:Ae,rt=Math.log,jt=Math.LN2;function Ae(s){return s>>>=0,s===0?32:31-(rt(s)/jt|0)|0}var Qe=256,As=262144,mt=4194304;function Ht(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 ca(s,t,n){var i=s.pendingLanes;if(i===0)return 0;var o=0,x=s.suspendedLanes,v=s.pingedLanes;s=s.warmLanes;var k=i&134217727;return k!==0?(i=k&~x,i!==0?o=Ht(i):(v&=k,v!==0?o=Ht(v):n||(n=k&~s,n!==0&&(o=Ht(n))))):(k=i&~x,k!==0?o=Ht(k):v!==0?o=Ht(v):n||(n=i&~s,n!==0&&(o=Ht(n)))),o===0?0:t!==0&&t!==o&&(t&x)===0&&(x=o&-o,n=t&-t,x>=n||x===32&&(n&4194048)!==0)?t:o}function Fa(s,t){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&t)===0}function Xt(s,t){switch(s){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function te(){var s=mt;return mt<<=1,(mt&62914560)===0&&(mt=4194304),s}function _e(s){for(var t=[],n=0;31>n;n++)t.push(s);return t}function U(s,t){s.pendingLanes|=t,t!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function Se(s,t,n,i,o,x){var v=s.pendingLanes;s.pendingLanes=n,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=n,s.entangledLanes&=n,s.errorRecoveryDisabledLanes&=n,s.shellSuspendCounter=0;var k=s.entanglements,I=s.expirationTimes,ie=s.hiddenUpdates;for(n=v&~n;0"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var Jb=/[\n"\\]/g;function qa(s){return s.replace(Jb,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function wd(s,t,n,i,o,x,v,k){s.name="",v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?s.type=v:s.removeAttribute("type"),t!=null?v==="number"?(t===0&&s.value===""||s.value!=t)&&(s.value=""+Ha(t)):s.value!==""+Ha(t)&&(s.value=""+Ha(t)):v!=="submit"&&v!=="reset"||s.removeAttribute("value"),t!=null?_d(s,v,Ha(t)):n!=null?_d(s,v,Ha(n)):i!=null&&s.removeAttribute("value"),o==null&&x!=null&&(s.defaultChecked=!!x),o!=null&&(s.checked=o&&typeof o!="function"&&typeof o!="symbol"),k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?s.name=""+Ha(k):s.removeAttribute("name")}function Gx(s,t,n,i,o,x,v,k){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(s.type=x),t!=null||n!=null){if(!(x!=="submit"&&x!=="reset"||t!=null)){yd(s);return}n=n!=null?""+Ha(n):"",t=t!=null?""+Ha(t):n,k||t===s.value||(s.value=t),s.defaultValue=t}i=i??o,i=typeof i!="function"&&typeof i!="symbol"&&!!i,s.checked=k?s.checked:!!i,s.defaultChecked=!!i,v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(s.name=v),yd(s)}function _d(s,t,n){t==="number"&&_c(s.ownerDocument)===s||s.defaultValue===""+n||(s.defaultValue=""+n)}function dr(s,t,n,i){if(s=s.options,t){t={};for(var o=0;o"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ed=!1;if(bl)try{var ii={};Object.defineProperty(ii,"passive",{get:function(){Ed=!0}}),window.addEventListener("test",ii,ii),window.removeEventListener("test",ii,ii)}catch{Ed=!1}var Yl=null,Md=null,kc=null;function Wx(){if(kc)return kc;var s,t=Md,n=t.length,i,o="value"in Yl?Yl.value:Yl.textContent,x=o.length;for(s=0;s=di),nh=" ",rh=!1;function ih(s,t){switch(s){case"keyup":return _y.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ch(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var hr=!1;function ky(s,t){switch(s){case"compositionend":return ch(t);case"keypress":return t.which!==32?null:(rh=!0,nh);case"textInput":return s=t.data,s===nh&&rh?null:s;default:return null}}function Cy(s,t){if(hr)return s==="compositionend"||!Od&&ih(s,t)?(s=Wx(),kc=Md=Yl=null,hr=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-s};s=i}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=ph(n)}}function jh(s,t){return s&&t?s===t?!0:s&&s.nodeType===3?!1:t&&t.nodeType===3?jh(s,t.parentNode):"contains"in s?s.contains(t):s.compareDocumentPosition?!!(s.compareDocumentPosition(t)&16):!1:!1}function vh(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var t=_c(s.document);t instanceof s.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)s=t.contentWindow;else break;t=_c(s.document)}return t}function $d(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 Oy=bl&&"documentMode"in document&&11>=document.documentMode,fr=null,Bd=null,hi=null,Id=!1;function Nh(s,t,n){var i=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Id||fr==null||fr!==_c(i)||(i=fr,"selectionStart"in i&&$d(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),hi&&xi(hi,i)||(hi=i,i=No(Bd,"onSelect"),0>=v,o-=v,xl=1<<32-ys(t)+o|n<_s?(Ls=Ye,Ye=null):Ls=Ye.sibling;var Ks=de(ee,Ye,re[_s],be);if(Ks===null){Ye===null&&(Ye=Ls);break}s&&Ye&&Ks.alternate===null&&t(ee,Ye),q=x(Ks,q,_s),Gs===null?ss=Ks:Gs.sibling=Ks,Gs=Ks,Ye=Ls}if(_s===re.length)return n(ee,Ye),Us&&wl(ee,_s),ss;if(Ye===null){for(;_s_s?(Ls=Ye,Ye=null):Ls=Ye.sibling;var jn=de(ee,Ye,Ks.value,be);if(jn===null){Ye===null&&(Ye=Ls);break}s&&Ye&&jn.alternate===null&&t(ee,Ye),q=x(jn,q,_s),Gs===null?ss=jn:Gs.sibling=jn,Gs=jn,Ye=Ls}if(Ks.done)return n(ee,Ye),Us&&wl(ee,_s),ss;if(Ye===null){for(;!Ks.done;_s++,Ks=re.next())Ks=ye(ee,Ks.value,be),Ks!==null&&(q=x(Ks,q,_s),Gs===null?ss=Ks:Gs.sibling=Ks,Gs=Ks);return Us&&wl(ee,_s),ss}for(Ye=i(Ye);!Ks.done;_s++,Ks=re.next())Ks=he(Ye,ee,_s,Ks.value,be),Ks!==null&&(s&&Ks.alternate!==null&&Ye.delete(Ks.key===null?_s:Ks.key),q=x(Ks,q,_s),Gs===null?ss=Ks:Gs.sibling=Ks,Gs=Ks);return s&&Ye.forEach(function(sw){return t(ee,sw)}),Us&&wl(ee,_s),ss}function ot(ee,q,re,be){if(typeof re=="object"&&re!==null&&re.type===z&&re.key===null&&(re=re.props.children),typeof re=="object"&&re!==null){switch(re.$$typeof){case y:e:{for(var ss=re.key;q!==null;){if(q.key===ss){if(ss=re.type,ss===z){if(q.tag===7){n(ee,q.sibling),be=o(q,re.props.children),be.return=ee,ee=be;break e}}else if(q.elementType===ss||typeof ss=="object"&&ss!==null&&ss.$$typeof===X&&In(ss)===q.type){n(ee,q.sibling),be=o(q,re.props),Ni(be,re),be.return=ee,ee=be;break e}n(ee,q);break}else t(ee,q);q=q.sibling}re.type===z?(be=On(re.props.children,ee.mode,be,re.key),be.return=ee,ee=be):(be=Lc(re.type,re.key,re.props,null,ee.mode,be),Ni(be,re),be.return=ee,ee=be)}return v(ee);case w:e:{for(ss=re.key;q!==null;){if(q.key===ss)if(q.tag===4&&q.stateNode.containerInfo===re.containerInfo&&q.stateNode.implementation===re.implementation){n(ee,q.sibling),be=o(q,re.children||[]),be.return=ee,ee=be;break e}else{n(ee,q);break}else t(ee,q);q=q.sibling}be=Kd(re,ee.mode,be),be.return=ee,ee=be}return v(ee);case X:return re=In(re),ot(ee,q,re,be)}if(pe(re))return Ve(ee,q,re,be);if(je(re)){if(ss=je(re),typeof ss!="function")throw Error(c(150));return re=ss.call(re),ls(ee,q,re,be)}if(typeof re.then=="function")return ot(ee,q,Hc(re),be);if(re.$$typeof===E)return ot(ee,q,Bc(ee,re),be);qc(ee,re)}return typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint"?(re=""+re,q!==null&&q.tag===6?(n(ee,q.sibling),be=o(q,re),be.return=ee,ee=be):(n(ee,q),be=Gd(re,ee.mode,be),be.return=ee,ee=be),v(ee)):n(ee,q)}return function(ee,q,re,be){try{vi=0;var ss=ot(ee,q,re,be);return kr=null,ss}catch(Ye){if(Ye===Sr||Ye===Pc)throw Ye;var Gs=Ea(29,Ye,null,ee.mode);return Gs.lanes=be,Gs.return=ee,Gs}finally{}}}var Fn=Hh(!0),qh=Hh(!1),en=!1;function nu(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ru(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 sn(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function tn(s,t,n){var i=s.updateQueue;if(i===null)return null;if(i=i.shared,(Js&2)!==0){var o=i.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),i.pending=t,t=Oc(s),Ch(s,null,n),t}return Dc(s,i,t,n),Oc(s)}function bi(s,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var i=t.lanes;i&=s.pendingLanes,n|=i,t.lanes=n,us(s,n)}}function iu(s,t){var n=s.updateQueue,i=s.alternate;if(i!==null&&(i=i.updateQueue,n===i)){var o=null,x=null;if(n=n.firstBaseUpdate,n!==null){do{var v={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};x===null?o=x=v:x=x.next=v,n=n.next}while(n!==null);x===null?o=x=t:x=x.next=t}else o=x=t;n={baseState:i.baseState,firstBaseUpdate:o,lastBaseUpdate:x,shared:i.shared,callbacks:i.callbacks},s.updateQueue=n;return}s=n.lastBaseUpdate,s===null?n.firstBaseUpdate=t:s.next=t,n.lastBaseUpdate=t}var cu=!1;function yi(){if(cu){var s=_r;if(s!==null)throw s}}function wi(s,t,n,i){cu=!1;var o=s.updateQueue;en=!1;var x=o.firstBaseUpdate,v=o.lastBaseUpdate,k=o.shared.pending;if(k!==null){o.shared.pending=null;var I=k,ie=I.next;I.next=null,v===null?x=ie:v.next=ie,v=I;var ve=s.alternate;ve!==null&&(ve=ve.updateQueue,k=ve.lastBaseUpdate,k!==v&&(k===null?ve.firstBaseUpdate=ie:k.next=ie,ve.lastBaseUpdate=I))}if(x!==null){var ye=o.baseState;v=0,ve=ie=I=null,k=x;do{var de=k.lane&-536870913,he=de!==k.lane;if(he?(Os&de)===de:(i&de)===de){de!==0&&de===wr&&(cu=!0),ve!==null&&(ve=ve.next={lane:0,tag:k.tag,payload:k.payload,callback:null,next:null});e:{var Ve=s,ls=k;de=t;var ot=n;switch(ls.tag){case 1:if(Ve=ls.payload,typeof Ve=="function"){ye=Ve.call(ot,ye,de);break e}ye=Ve;break e;case 3:Ve.flags=Ve.flags&-65537|128;case 0:if(Ve=ls.payload,de=typeof Ve=="function"?Ve.call(ot,ye,de):Ve,de==null)break e;ye=j({},ye,de);break e;case 2:en=!0}}de=k.callback,de!==null&&(s.flags|=64,he&&(s.flags|=8192),he=o.callbacks,he===null?o.callbacks=[de]:he.push(de))}else he={lane:de,tag:k.tag,payload:k.payload,callback:k.callback,next:null},ve===null?(ie=ve=he,I=ye):ve=ve.next=he,v|=de;if(k=k.next,k===null){if(k=o.shared.pending,k===null)break;he=k,k=he.next,he.next=null,o.lastBaseUpdate=he,o.shared.pending=null}}while(!0);ve===null&&(I=ye),o.baseState=I,o.firstBaseUpdate=ie,o.lastBaseUpdate=ve,x===null&&(o.shared.lanes=0),cn|=v,s.lanes=v,s.memoizedState=ye}}function Vh(s,t){if(typeof s!="function")throw Error(c(191,s));s.call(t)}function Gh(s,t){var n=s.callbacks;if(n!==null)for(s.callbacks=null,s=0;sx?x:8;var v=D.T,k={};D.T=k,Cu(s,!1,t,n);try{var I=o(),ie=D.S;if(ie!==null&&ie(k,I),I!==null&&typeof I=="object"&&typeof I.then=="function"){var ve=qy(I,i);ki(s,t,ve,Da(s))}else ki(s,t,i,Da(s))}catch(ye){ki(s,t,{then:function(){},status:"rejected",reason:ye},Da())}finally{Q.p=x,v!==null&&k.types!==null&&(v.types=k.types),D.T=v}}function Jy(){}function Su(s,t,n,i){if(s.tag!==5)throw Error(c(476));var o=Sf(s).queue;_f(s,o,t,B,n===null?Jy:function(){return kf(s),n(i)})}function Sf(s){var t=s.memoizedState;if(t!==null)return t;t={memoizedState:B,baseState:B,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Cl,lastRenderedState:B},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Cl,lastRenderedState:n},next:null},s.memoizedState=t,s=s.alternate,s!==null&&(s.memoizedState=t),t}function kf(s){var t=Sf(s);t.next===null&&(t=s.alternate.memoizedState),ki(s,t.next.queue,{},Da())}function ku(){return Wt(Hi)}function Cf(){return Dt().memoizedState}function Tf(){return Dt().memoizedState}function Xy(s){for(var t=s.return;t!==null;){switch(t.tag){case 24:case 3:var n=Da();s=sn(n);var i=tn(t,s,n);i!==null&&(ya(i,t,n),bi(i,t,n)),t={cache:su()},s.payload=t;return}t=t.return}}function Zy(s,t,n){var i=Da();n={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},eo(s)?Mf(t,n):(n=qd(s,t,n,i),n!==null&&(ya(n,s,i),Af(n,t,i)))}function Ef(s,t,n){var i=Da();ki(s,t,n,i)}function ki(s,t,n,i){var o={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(eo(s))Mf(t,o);else{var x=s.alternate;if(s.lanes===0&&(x===null||x.lanes===0)&&(x=t.lastRenderedReducer,x!==null))try{var v=t.lastRenderedState,k=x(v,n);if(o.hasEagerState=!0,o.eagerState=k,Ta(k,v))return Dc(s,t,o,0),xt===null&&Rc(),!1}catch{}finally{}if(n=qd(s,t,o,i),n!==null)return ya(n,s,i),Af(n,t,i),!0}return!1}function Cu(s,t,n,i){if(i={lane:2,revertLane:nm(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},eo(s)){if(t)throw Error(c(479))}else t=qd(s,n,i,2),t!==null&&ya(t,s,2)}function eo(s){var t=s.alternate;return s===ws||t!==null&&t===ws}function Mf(s,t){Tr=Kc=!0;var n=s.pending;n===null?t.next=t:(t.next=n.next,n.next=t),s.pending=t}function Af(s,t,n){if((n&4194048)!==0){var i=t.lanes;i&=s.pendingLanes,n|=i,t.lanes=n,us(s,n)}}var Ci={readContext:Wt,use:Jc,useCallback:Mt,useContext:Mt,useEffect:Mt,useImperativeHandle:Mt,useLayoutEffect:Mt,useInsertionEffect:Mt,useMemo:Mt,useReducer:Mt,useRef:Mt,useState:Mt,useDebugValue:Mt,useDeferredValue:Mt,useTransition:Mt,useSyncExternalStore:Mt,useId:Mt,useHostTransitionStatus:Mt,useFormState:Mt,useActionState:Mt,useOptimistic:Mt,useMemoCache:Mt,useCacheRefresh:Mt};Ci.useEffectEvent=Mt;var zf={readContext:Wt,use:Jc,useCallback:function(s,t){return ma().memoizedState=[s,t===void 0?null:t],s},useContext:Wt,useEffect:ff,useImperativeHandle:function(s,t,n){n=n!=null?n.concat([s]):null,Zc(4194308,4,vf.bind(null,t,s),n)},useLayoutEffect:function(s,t){return Zc(4194308,4,s,t)},useInsertionEffect:function(s,t){Zc(4,2,s,t)},useMemo:function(s,t){var n=ma();t=t===void 0?null:t;var i=s();if(Hn){is(!0);try{s()}finally{is(!1)}}return n.memoizedState=[i,t],i},useReducer:function(s,t,n){var i=ma();if(n!==void 0){var o=n(t);if(Hn){is(!0);try{n(t)}finally{is(!1)}}}else o=t;return i.memoizedState=i.baseState=o,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:o},i.queue=s,s=s.dispatch=Zy.bind(null,ws,s),[i.memoizedState,s]},useRef:function(s){var t=ma();return s={current:s},t.memoizedState=s},useState:function(s){s=Nu(s);var t=s.queue,n=Ef.bind(null,ws,t);return t.dispatch=n,[s.memoizedState,n]},useDebugValue:wu,useDeferredValue:function(s,t){var n=ma();return _u(n,s,t)},useTransition:function(){var s=Nu(!1);return s=_f.bind(null,ws,s.queue,!0,!1),ma().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,t,n){var i=ws,o=ma();if(Us){if(n===void 0)throw Error(c(407));n=n()}else{if(n=t(),xt===null)throw Error(c(349));(Os&127)!==0||Zh(i,t,n)}o.memoizedState=n;var x={value:n,getSnapshot:t};return o.queue=x,ff(ef.bind(null,i,x,s),[s]),i.flags|=2048,Mr(9,{destroy:void 0},Wh.bind(null,i,x,n,t),null),n},useId:function(){var s=ma(),t=xt.identifierPrefix;if(Us){var n=hl,i=xl;n=(i&~(1<<32-ys(i)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Qc++,0<\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof i.is=="string"?v.createElement("select",{is:i.is}):v.createElement("select"),i.multiple?x.multiple=!0:i.size&&(x.size=i.size);break;default:x=typeof i.is=="string"?v.createElement(o,{is:i.is}):v.createElement(o)}}x[oe]=t,x[qe]=i;e:for(v=t.child;v!==null;){if(v.tag===5||v.tag===6)x.appendChild(v.stateNode);else if(v.tag!==4&&v.tag!==27&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===t)break e;for(;v.sibling===null;){if(v.return===null||v.return===t)break e;v=v.return}v.sibling.return=v.return,v=v.sibling}t.stateNode=x;e:switch(sa(x,o,i),o){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&El(t)}}return yt(t),Pu(t,t.type,s===null?null:s.memoizedProps,t.pendingProps,n),null;case 6:if(s&&t.stateNode!=null)s.memoizedProps!==i&&El(t);else{if(typeof i!="string"&&t.stateNode===null)throw Error(c(166));if(s=A.current,br(t)){if(s=t.stateNode,n=t.memoizedProps,i=null,o=Zt,o!==null)switch(o.tag){case 27:case 5:i=o.memoizedProps}s[oe]=t,s=!!(s.nodeValue===n||i!==null&&i.suppressHydrationWarning===!0||Xp(s.nodeValue,n)),s||Zl(t,!0)}else s=bo(s).createTextNode(i),s[oe]=t,t.stateNode=s}return yt(t),null;case 31:if(n=t.memoizedState,s===null||s.memoizedState!==null){if(i=br(t),n!==null){if(s===null){if(!i)throw Error(c(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(c(557));s[oe]=t}else Ln(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;yt(t),s=!1}else n=Xd(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=n),s=!0;if(!s)return t.flags&256?(Aa(t),t):(Aa(t),null);if((t.flags&128)!==0)throw Error(c(558))}return yt(t),null;case 13:if(i=t.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(o=br(t),i!==null&&i.dehydrated!==null){if(s===null){if(!o)throw Error(c(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(c(317));o[oe]=t}else Ln(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;yt(t),o=!1}else o=Xd(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?(Aa(t),t):(Aa(t),null)}return Aa(t),(t.flags&128)!==0?(t.lanes=n,t):(n=i!==null,s=s!==null&&s.memoizedState!==null,n&&(i=t.child,o=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(o=i.alternate.memoizedState.cachePool.pool),x=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(x=i.memoizedState.cachePool.pool),x!==o&&(i.flags|=2048)),n!==s&&n&&(t.child.flags|=8192),no(t,t.updateQueue),yt(t),null);case 4:return se(),s===null&&om(t.stateNode.containerInfo),yt(t),null;case 10:return Sl(t.type),yt(t),null;case 19:if(fe(Rt),i=t.memoizedState,i===null)return yt(t),null;if(o=(t.flags&128)!==0,x=i.rendering,x===null)if(o)Ei(i,!1);else{if(At!==0||s!==null&&(s.flags&128)!==0)for(s=t.child;s!==null;){if(x=Gc(s),x!==null){for(t.flags|=128,Ei(i,!1),s=x.updateQueue,t.updateQueue=s,no(t,s),t.subtreeFlags=0,s=n,n=t.child;n!==null;)Th(n,s),n=n.sibling;return Ee(Rt,Rt.current&1|2),Us&&wl(t,i.treeForkCount),t.child}s=s.sibling}i.tail!==null&&Is()>uo&&(t.flags|=128,o=!0,Ei(i,!1),t.lanes=4194304)}else{if(!o)if(s=Gc(x),s!==null){if(t.flags|=128,o=!0,s=s.updateQueue,t.updateQueue=s,no(t,s),Ei(i,!0),i.tail===null&&i.tailMode==="hidden"&&!x.alternate&&!Us)return yt(t),null}else 2*Is()-i.renderingStartTime>uo&&n!==536870912&&(t.flags|=128,o=!0,Ei(i,!1),t.lanes=4194304);i.isBackwards?(x.sibling=t.child,t.child=x):(s=i.last,s!==null?s.sibling=x:t.child=x,i.last=x)}return i.tail!==null?(s=i.tail,i.rendering=s,i.tail=s.sibling,i.renderingStartTime=Is(),s.sibling=null,n=Rt.current,Ee(Rt,o?n&1|2:n&1),Us&&wl(t,i.treeForkCount),s):(yt(t),null);case 22:case 23:return Aa(t),du(),i=t.memoizedState!==null,s!==null?s.memoizedState!==null!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?(n&536870912)!==0&&(t.flags&128)===0&&(yt(t),t.subtreeFlags&6&&(t.flags|=8192)):yt(t),n=t.updateQueue,n!==null&&no(t,n.retryQueue),n=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(n=s.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==n&&(t.flags|=2048),s!==null&&fe(Bn),null;case 24:return n=null,s!==null&&(n=s.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Sl(Bt),yt(t),null;case 25:return null;case 30:return null}throw Error(c(156,t.tag))}function a0(s,t){switch(Yd(t),t.tag){case 1:return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 3:return Sl(Bt),se(),s=t.flags,(s&65536)!==0&&(s&128)===0?(t.flags=s&-65537|128,t):null;case 26:case 27:case 5:return cs(t),null;case 31:if(t.memoizedState!==null){if(Aa(t),t.alternate===null)throw Error(c(340));Ln()}return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 13:if(Aa(t),s=t.memoizedState,s!==null&&s.dehydrated!==null){if(t.alternate===null)throw Error(c(340));Ln()}return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 19:return fe(Rt),null;case 4:return se(),null;case 10:return Sl(t.type),null;case 22:case 23:return Aa(t),du(),s!==null&&fe(Bn),s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 24:return Sl(Bt),null;case 25:return null;default:return null}}function tp(s,t){switch(Yd(t),t.tag){case 3:Sl(Bt),se();break;case 26:case 27:case 5:cs(t);break;case 4:se();break;case 31:t.memoizedState!==null&&Aa(t);break;case 13:Aa(t);break;case 19:fe(Rt);break;case 10:Sl(t.type);break;case 22:case 23:Aa(t),du(),s!==null&&fe(Bn);break;case 24:Sl(Bt)}}function Mi(s,t){try{var n=t.updateQueue,i=n!==null?n.lastEffect:null;if(i!==null){var o=i.next;n=o;do{if((n.tag&s)===s){i=void 0;var x=n.create,v=n.inst;i=x(),v.destroy=i}n=n.next}while(n!==o)}}catch(k){et(t,t.return,k)}}function nn(s,t,n){try{var i=t.updateQueue,o=i!==null?i.lastEffect:null;if(o!==null){var x=o.next;i=x;do{if((i.tag&s)===s){var v=i.inst,k=v.destroy;if(k!==void 0){v.destroy=void 0,o=t;var I=n,ie=k;try{ie()}catch(ve){et(o,I,ve)}}}i=i.next}while(i!==x)}}catch(ve){et(t,t.return,ve)}}function ap(s){var t=s.updateQueue;if(t!==null){var n=s.stateNode;try{Gh(t,n)}catch(i){et(s,s.return,i)}}}function lp(s,t,n){n.props=qn(s.type,s.memoizedProps),n.state=s.memoizedState;try{n.componentWillUnmount()}catch(i){et(s,t,i)}}function Ai(s,t){try{var n=s.ref;if(n!==null){switch(s.tag){case 26:case 27:case 5:var i=s.stateNode;break;case 30:i=s.stateNode;break;default:i=s.stateNode}typeof n=="function"?s.refCleanup=n(i):n.current=i}}catch(o){et(s,t,o)}}function fl(s,t){var n=s.ref,i=s.refCleanup;if(n!==null)if(typeof i=="function")try{i()}catch(o){et(s,t,o)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(o){et(s,t,o)}else n.current=null}function np(s){var t=s.type,n=s.memoizedProps,i=s.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&i.focus();break e;case"img":n.src?i.src=n.src:n.srcSet&&(i.srcset=n.srcSet)}}catch(o){et(s,s.return,o)}}function Fu(s,t,n){try{var i=s.stateNode;S0(i,s.type,n,t),i[qe]=t}catch(o){et(s,s.return,o)}}function rp(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&xn(s.type)||s.tag===4}function Hu(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||rp(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&&xn(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 qu(s,t,n){var i=s.tag;if(i===5||i===6)s=s.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(s,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(s),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Nl));else if(i!==4&&(i===27&&xn(s.type)&&(n=s.stateNode,t=null),s=s.child,s!==null))for(qu(s,t,n),s=s.sibling;s!==null;)qu(s,t,n),s=s.sibling}function ro(s,t,n){var i=s.tag;if(i===5||i===6)s=s.stateNode,t?n.insertBefore(s,t):n.appendChild(s);else if(i!==4&&(i===27&&xn(s.type)&&(n=s.stateNode),s=s.child,s!==null))for(ro(s,t,n),s=s.sibling;s!==null;)ro(s,t,n),s=s.sibling}function ip(s){var t=s.stateNode,n=s.memoizedProps;try{for(var i=s.type,o=t.attributes;o.length;)t.removeAttributeNode(o[0]);sa(t,i,n),t[oe]=s,t[qe]=n}catch(x){et(s,s.return,x)}}var Ml=!1,Ft=!1,Vu=!1,cp=typeof WeakSet=="function"?WeakSet:Set,Qt=null;function l0(s,t){if(s=s.containerInfo,mm=To,s=vh(s),$d(s)){if("selectionStart"in s)var n={start:s.selectionStart,end:s.selectionEnd};else e:{n=(n=s.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var o=i.anchorOffset,x=i.focusNode;i=i.focusOffset;try{n.nodeType,x.nodeType}catch{n=null;break e}var v=0,k=-1,I=-1,ie=0,ve=0,ye=s,de=null;s:for(;;){for(var he;ye!==n||o!==0&&ye.nodeType!==3||(k=v+o),ye!==x||i!==0&&ye.nodeType!==3||(I=v+i),ye.nodeType===3&&(v+=ye.nodeValue.length),(he=ye.firstChild)!==null;)de=ye,ye=he;for(;;){if(ye===s)break s;if(de===n&&++ie===o&&(k=v),de===x&&++ve===i&&(I=v),(he=ye.nextSibling)!==null)break;ye=de,de=ye.parentNode}ye=he}n=k===-1||I===-1?null:{start:k,end:I}}else n=null}n=n||{start:0,end:0}}else n=null;for(xm={focusedElem:s,selectionRange:n},To=!1,Qt=t;Qt!==null;)if(t=Qt,s=t.child,(t.subtreeFlags&1028)!==0&&s!==null)s.return=t,Qt=s;else for(;Qt!==null;){switch(t=Qt,x=t.alternate,s=t.flags,t.tag){case 0:if((s&4)!==0&&(s=t.updateQueue,s=s!==null?s.events:null,s!==null))for(n=0;n title"))),sa(x,i,n),x[oe]=s,Kt(x),i=x;break e;case"link":var v=hg("link","href",o).get(i+(n.href||""));if(v){for(var k=0;kot&&(v=ot,ot=ls,ls=v);var ee=gh(k,ls),q=gh(k,ot);if(ee&&q&&(he.rangeCount!==1||he.anchorNode!==ee.node||he.anchorOffset!==ee.offset||he.focusNode!==q.node||he.focusOffset!==q.offset)){var re=ye.createRange();re.setStart(ee.node,ee.offset),he.removeAllRanges(),ls>ot?(he.addRange(re),he.extend(q.node,q.offset)):(re.setEnd(q.node,q.offset),he.addRange(re))}}}}for(ye=[],he=k;he=he.parentNode;)he.nodeType===1&&ye.push({element:he,left:he.scrollLeft,top:he.scrollTop});for(typeof k.focus=="function"&&k.focus(),k=0;kn?32:n,D.T=null,n=Zu,Zu=null;var x=dn,v=Ol;if(qt=0,Or=dn=null,Ol=0,(Js&6)!==0)throw Error(c(331));var k=Js;if(Js|=4,vp(x.current),pp(x,x.current,v,n),Js=k,Ui(0,!1),rs&&typeof rs.onPostCommitFiberRoot=="function")try{rs.onPostCommitFiberRoot(Cs,x)}catch{}return!0}finally{Q.p=o,D.T=i,Up(s,t)}}function Bp(s,t,n){t=Ga(n,t),t=Au(s.stateNode,t,2),s=tn(s,t,2),s!==null&&(U(s,2),pl(s))}function et(s,t,n){if(s.tag===3)Bp(s,s,n);else for(;t!==null;){if(t.tag===3){Bp(t,s,n);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(on===null||!on.has(i))){s=Ga(n,s),n=If(2),i=tn(t,n,2),i!==null&&(Pf(n,i,t,s),U(i,2),pl(i));break}}t=t.return}}function tm(s,t,n){var i=s.pingCache;if(i===null){i=s.pingCache=new i0;var o=new Set;i.set(t,o)}else o=i.get(t),o===void 0&&(o=new Set,i.set(t,o));o.has(n)||(Qu=!0,o.add(n),s=m0.bind(null,s,t,n),t.then(s,s))}function m0(s,t,n){var i=s.pingCache;i!==null&&i.delete(t),s.pingedLanes|=s.suspendedLanes&n,s.warmLanes&=~n,xt===s&&(Os&n)===n&&(At===4||At===3&&(Os&62914560)===Os&&300>Is()-oo?(Js&2)===0&&Lr(s,0):Yu|=n,Dr===Os&&(Dr=0)),pl(s)}function Ip(s,t){t===0&&(t=te()),s=Dn(s,t),s!==null&&(U(s,t),pl(s))}function x0(s){var t=s.memoizedState,n=0;t!==null&&(n=t.retryLane),Ip(s,n)}function h0(s,t){var n=0;switch(s.tag){case 31:case 13:var i=s.stateNode,o=s.memoizedState;o!==null&&(n=o.retryLane);break;case 19:i=s.stateNode;break;case 22:i=s.stateNode._retryCache;break;default:throw Error(c(314))}i!==null&&i.delete(t),Ip(s,n)}function f0(s,t){return Ts(s,t)}var go=null,$r=null,am=!1,jo=!1,lm=!1,mn=0;function pl(s){s!==$r&&s.next===null&&($r===null?go=$r=s:$r=$r.next=s),jo=!0,am||(am=!0,g0())}function Ui(s,t){if(!lm&&jo){lm=!0;do for(var n=!1,i=go;i!==null;){if(s!==0){var o=i.pendingLanes;if(o===0)var x=0;else{var v=i.suspendedLanes,k=i.pingedLanes;x=(1<<31-ys(42|s)+1)-1,x&=o&~(v&~k),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(n=!0,qp(i,x))}else x=Os,x=ca(i,i===xt?x:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(x&3)===0||Fa(i,x)||(n=!0,qp(i,x));i=i.next}while(n);lm=!1}}function p0(){Pp()}function Pp(){jo=am=!1;var s=0;mn!==0&&C0()&&(s=mn);for(var t=Is(),n=null,i=go;i!==null;){var o=i.next,x=Fp(i,t);x===0?(i.next=null,n===null?go=o:n.next=o,o===null&&($r=n)):(n=i,(s!==0||(x&3)!==0)&&(jo=!0)),i=o}qt!==0&&qt!==5||Ui(s),mn!==0&&(mn=0)}function Fp(s,t){for(var n=s.suspendedLanes,i=s.pingedLanes,o=s.expirationTimes,x=s.pendingLanes&-62914561;0k)break;var ve=I.transferSize,ye=I.initiatorType;ve&&Zp(ye)&&(I=I.responseEnd,v+=ve*(I"u"?null:document;function dg(s,t,n){var i=Br;if(i&&typeof t=="string"&&t){var o=qa(t);o='link[rel="'+s+'"][href="'+o+'"]',typeof n=="string"&&(o+='[crossorigin="'+n+'"]'),og.has(o)||(og.add(o),s={rel:s,crossOrigin:n,href:t},i.querySelector(o)===null&&(t=i.createElement("link"),sa(t,"link",s),Kt(t),i.head.appendChild(t)))}}function L0(s){Ll.D(s),dg("dns-prefetch",s,null)}function U0(s,t){Ll.C(s,t),dg("preconnect",s,t)}function $0(s,t,n){Ll.L(s,t,n);var i=Br;if(i&&s&&t){var o='link[rel="preload"][as="'+qa(t)+'"]';t==="image"&&n&&n.imageSrcSet?(o+='[imagesrcset="'+qa(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(o+='[imagesizes="'+qa(n.imageSizes)+'"]')):o+='[href="'+qa(s)+'"]';var x=o;switch(t){case"style":x=Ir(s);break;case"script":x=Pr(s)}Za.has(x)||(s=j({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:s,as:t},n),Za.set(x,s),i.querySelector(o)!==null||t==="style"&&i.querySelector(Pi(x))||t==="script"&&i.querySelector(Fi(x))||(t=i.createElement("link"),sa(t,"link",s),Kt(t),i.head.appendChild(t)))}}function B0(s,t){Ll.m(s,t);var n=Br;if(n&&s){var i=t&&typeof t.as=="string"?t.as:"script",o='link[rel="modulepreload"][as="'+qa(i)+'"][href="'+qa(s)+'"]',x=o;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=Pr(s)}if(!Za.has(x)&&(s=j({rel:"modulepreload",href:s},t),Za.set(x,s),n.querySelector(o)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Fi(x)))return}i=n.createElement("link"),sa(i,"link",s),Kt(i),n.head.appendChild(i)}}}function I0(s,t,n){Ll.S(s,t,n);var i=Br;if(i&&s){var o=cr(i).hoistableStyles,x=Ir(s);t=t||"default";var v=o.get(x);if(!v){var k={loading:0,preload:null};if(v=i.querySelector(Pi(x)))k.loading=5;else{s=j({rel:"stylesheet",href:s,"data-precedence":t},n),(n=Za.get(x))&&Nm(s,n);var I=v=i.createElement("link");Kt(I),sa(I,"link",s),I._p=new Promise(function(ie,ve){I.onload=ie,I.onerror=ve}),I.addEventListener("load",function(){k.loading|=1}),I.addEventListener("error",function(){k.loading|=2}),k.loading|=4,wo(v,t,i)}v={type:"stylesheet",instance:v,count:1,state:k},o.set(x,v)}}}function P0(s,t){Ll.X(s,t);var n=Br;if(n&&s){var i=cr(n).hoistableScripts,o=Pr(s),x=i.get(o);x||(x=n.querySelector(Fi(o)),x||(s=j({src:s,async:!0},t),(t=Za.get(o))&&bm(s,t),x=n.createElement("script"),Kt(x),sa(x,"link",s),n.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},i.set(o,x))}}function F0(s,t){Ll.M(s,t);var n=Br;if(n&&s){var i=cr(n).hoistableScripts,o=Pr(s),x=i.get(o);x||(x=n.querySelector(Fi(o)),x||(s=j({src:s,async:!0,type:"module"},t),(t=Za.get(o))&&bm(s,t),x=n.createElement("script"),Kt(x),sa(x,"link",s),n.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},i.set(o,x))}}function ug(s,t,n,i){var o=(o=A.current)?yo(o):null;if(!o)throw Error(c(446));switch(s){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=Ir(n.href),n=cr(o).hoistableStyles,i=n.get(t),i||(i={type:"style",instance:null,count:0,state:null},n.set(t,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){s=Ir(n.href);var x=cr(o).hoistableStyles,v=x.get(s);if(v||(o=o.ownerDocument||o,v={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(s,v),(x=o.querySelector(Pi(s)))&&!x._p&&(v.instance=x,v.state.loading=5),Za.has(s)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Za.set(s,n),x||H0(o,s,n,v.state))),t&&i===null)throw Error(c(528,""));return v}if(t&&i!==null)throw Error(c(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Pr(n),n=cr(o).hoistableScripts,i=n.get(t),i||(i={type:"script",instance:null,count:0,state:null},n.set(t,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(c(444,s))}}function Ir(s){return'href="'+qa(s)+'"'}function Pi(s){return'link[rel="stylesheet"]['+s+"]"}function mg(s){return j({},s,{"data-precedence":s.precedence,precedence:null})}function H0(s,t,n,i){s.querySelector('link[rel="preload"][as="style"]['+t+"]")?i.loading=1:(t=s.createElement("link"),i.preload=t,t.addEventListener("load",function(){return i.loading|=1}),t.addEventListener("error",function(){return i.loading|=2}),sa(t,"link",n),Kt(t),s.head.appendChild(t))}function Pr(s){return'[src="'+qa(s)+'"]'}function Fi(s){return"script[async]"+s}function xg(s,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var i=s.querySelector('style[data-href~="'+qa(n.href)+'"]');if(i)return t.instance=i,Kt(i),i;var o=j({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return i=(s.ownerDocument||s).createElement("style"),Kt(i),sa(i,"style",o),wo(i,n.precedence,s),t.instance=i;case"stylesheet":o=Ir(n.href);var x=s.querySelector(Pi(o));if(x)return t.state.loading|=4,t.instance=x,Kt(x),x;i=mg(n),(o=Za.get(o))&&Nm(i,o),x=(s.ownerDocument||s).createElement("link"),Kt(x);var v=x;return v._p=new Promise(function(k,I){v.onload=k,v.onerror=I}),sa(x,"link",i),t.state.loading|=4,wo(x,n.precedence,s),t.instance=x;case"script":return x=Pr(n.src),(o=s.querySelector(Fi(x)))?(t.instance=o,Kt(o),o):(i=n,(o=Za.get(x))&&(i=j({},n),bm(i,o)),s=s.ownerDocument||s,o=s.createElement("script"),Kt(o),sa(o,"link",i),s.head.appendChild(o),t.instance=o);case"void":return null;default:throw Error(c(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(i=t.instance,t.state.loading|=4,wo(i,n.precedence,s));return t.instance}function wo(s,t,n){for(var i=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),o=i.length?i[i.length-1]:null,x=o,v=0;v title"):null)}function q0(s,t,n){if(n===1||t.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return s=t.disabled,typeof t.precedence=="string"&&s==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function pg(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function V0(s,t,n,i){if(n.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var o=Ir(i.href),x=t.querySelector(Pi(o));if(x){t=x._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(s.count++,s=So.bind(s),t.then(s,s)),n.state.loading|=4,n.instance=x,Kt(x);return}x=t.ownerDocument||t,i=mg(i),(o=Za.get(o))&&Nm(i,o),x=x.createElement("link"),Kt(x);var v=x;v._p=new Promise(function(k,I){v.onload=k,v.onerror=I}),sa(x,"link",i),n.instance=x}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(s.count++,n=So.bind(s),t.addEventListener("load",n),t.addEventListener("error",n))}}var ym=0;function G0(s,t){return s.stylesheets&&s.count===0&&Co(s,s.stylesheets),0ym?50:800)+t);return s.unsuspend=n,function(){s.unsuspend=null,clearTimeout(i),clearTimeout(o)}}:null}function So(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Co(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var ko=null;function Co(s,t){s.stylesheets=null,s.unsuspend!==null&&(s.count++,ko=new Map,t.forEach(K0,s),ko=null,So.call(s))}function K0(s,t){if(!(t.state.loading&4)){var n=ko.get(s);if(n)var i=n.get(null);else{n=new Map,ko.set(s,n);for(var o=s.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(l){console.error(l)}}return a(),Rm.exports=L_(),Rm.exports}var $_=U_();function P(...a){return xw(hw(a))}const Te=u.forwardRef(({className:a,...l},r)=>e.jsx("div",{ref:r,className:P("rounded-xl border bg-card text-card-foreground shadow",a),...l}));Te.displayName="Card";const Oe=u.forwardRef(({className:a,...l},r)=>e.jsx("div",{ref:r,className:P("flex flex-col space-y-1.5 p-6",a),...l}));Oe.displayName="CardHeader";const Ue=u.forwardRef(({className:a,...l},r)=>e.jsx("div",{ref:r,className:P("font-semibold leading-none tracking-tight",a),...l}));Ue.displayName="CardTitle";const Ns=u.forwardRef(({className:a,...l},r)=>e.jsx("div",{ref:r,className:P("text-sm text-muted-foreground",a),...l}));Ns.displayName="CardDescription";const ze=u.forwardRef(({className:a,...l},r)=>e.jsx("div",{ref:r,className:P("p-6 pt-0",a),...l}));ze.displayName="CardContent";const od=u.forwardRef(({className:a,...l},r)=>e.jsx("div",{ref:r,className:P("flex items-center p-6 pt-0",a),...l}));od.displayName="CardFooter";const Jt=pw,Gt=u.forwardRef(({className:a,...l},r)=>e.jsx(hj,{ref:r,className:P("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",a),...l}));Gt.displayName=hj.displayName;const Xe=u.forwardRef(({className:a,...l},r)=>e.jsx(fj,{ref:r,className:P("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all duration-300 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",a),...l}));Xe.displayName=fj.displayName;const Ss=u.forwardRef(({className:a,...l},r)=>e.jsx(pj,{ref:r,className:P("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=active]:animate-in data-[state=active]:fade-in data-[state=active]:duration-300",a),...l}));Ss.displayName=pj.displayName;const ts=u.forwardRef(({className:a,children:l,viewportRef:r,...c},d)=>e.jsxs(gj,{ref:d,className:P("relative overflow-hidden",a),...c,children:[e.jsx(gw,{ref:r,className:"h-full w-full rounded-[inherit]",children:l}),e.jsx(Xm,{}),e.jsx(Xm,{orientation:"horizontal"}),e.jsx(jw,{})]}));ts.displayName=gj.displayName;const Xm=u.forwardRef(({className:a,orientation:l="vertical",...r},c)=>e.jsx(jj,{ref:c,orientation:l,className:P("flex touch-none select-none transition-colors",l==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",l==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",a),...r,children:e.jsx(vw,{className:"relative flex-1 rounded-full bg-border"})}));Xm.displayName=jj.displayName;function ks({className:a,...l}){return e.jsx("div",{className:P("animate-pulse rounded-md bg-primary/10",a),...l})}const tr=u.forwardRef(({className:a,value:l,...r},c)=>e.jsx(vj,{ref:c,className:P("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",a),...r,children:e.jsx(Nw,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(l||0)}%)`}})}));tr.displayName=vj.displayName;async function ke(a,l){const c=l?.body instanceof FormData?{...l?.headers}:{"Content-Type":"application/json",...l?.headers},d={...l,credentials:"include",headers:c},m=await fetch(a,d);if(m.status===401)throw window.location.href="/auth",new Error("่ฎค่ฏๅคฑ่ดฅ๏ผŒ่ฏท้‡ๆ–ฐ็™ปๅฝ•");return m}function Zs(){return{"Content-Type":"application/json"}}async function B_(){try{await fetch("/api/webui/auth/logout",{method:"POST",credentials:"include"})}catch(a){console.error("็™ปๅ‡บ่ฏทๆฑ‚ๅคฑ่ดฅ:",a)}window.location.href="/auth"}async function dc(){try{return(await(await fetch("/api/webui/auth/check",{method:"GET",credentials:"include"})).json()).authenticated===!0}catch{return!1}}const I_={light:"",dark:".dark"},Mv=u.createContext(null);function Av(){const a=u.useContext(Mv);if(!a)throw new Error("useChart must be used within a ");return a}const Kr=u.forwardRef(({id:a,className:l,children:r,config:c,...d},m)=>{const h=u.useId(),f=`chart-${a||h.replace(/:/g,"")}`;return e.jsx(Mv.Provider,{value:{config:c},children:e.jsxs("div",{"data-chart":f,ref:m,className:P("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",l),...d,children:[e.jsx(P_,{id:f,config:c}),e.jsx(Uj,{children:r})]})})});Kr.displayName="Chart";const P_=({id:a,config:l})=>{const r=Object.entries(l).filter(([,c])=>c.theme||c.color);return r.length?e.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(I_).map(([c,d])=>` +`+i.stack}}var ds=Object.prototype.hasOwnProperty,Ts=a.unstable_scheduleCallback,Ct=a.unstable_cancelCallback,ia=a.unstable_shouldYield,ut=a.unstable_requestPaint,Bs=a.unstable_now,V=a.unstable_getCurrentPriorityLevel,Ke=a.unstable_ImmediatePriority,He=a.unstable_UserBlockingPriority,Je=a.unstable_NormalPriority,Es=a.unstable_LowPriority,ms=a.unstable_IdlePriority,Ms=a.log,We=a.unstable_setDisableYieldValue,Cs=null,rs=null;function is(s){if(typeof Ms=="function"&&We(s),rs&&typeof rs.setStrictMode=="function")try{rs.setStrictMode(Cs,s)}catch{}}var ys=Math.clz32?Math.clz32:Ae,rt=Math.log,jt=Math.LN2;function Ae(s){return s>>>=0,s===0?32:31-(rt(s)/jt|0)|0}var Qe=256,As=262144,mt=4194304;function Ht(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 ca(s,t,n){var i=s.pendingLanes;if(i===0)return 0;var o=0,x=s.suspendedLanes,v=s.pingedLanes;s=s.warmLanes;var k=i&134217727;return k!==0?(i=k&~x,i!==0?o=Ht(i):(v&=k,v!==0?o=Ht(v):n||(n=k&~s,n!==0&&(o=Ht(n))))):(k=i&~x,k!==0?o=Ht(k):v!==0?o=Ht(v):n||(n=i&~s,n!==0&&(o=Ht(n)))),o===0?0:t!==0&&t!==o&&(t&x)===0&&(x=o&-o,n=t&-t,x>=n||x===32&&(n&4194048)!==0)?t:o}function Fa(s,t){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&t)===0}function Xt(s,t){switch(s){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function te(){var s=mt;return mt<<=1,(mt&62914560)===0&&(mt=4194304),s}function _e(s){for(var t=[],n=0;31>n;n++)t.push(s);return t}function U(s,t){s.pendingLanes|=t,t!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function Se(s,t,n,i,o,x){var v=s.pendingLanes;s.pendingLanes=n,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=n,s.entangledLanes&=n,s.errorRecoveryDisabledLanes&=n,s.shellSuspendCounter=0;var k=s.entanglements,B=s.expirationTimes,ce=s.hiddenUpdates;for(n=v&~n;0"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var Jb=/[\n"\\]/g;function qa(s){return s.replace(Jb,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function wd(s,t,n,i,o,x,v,k){s.name="",v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?s.type=v:s.removeAttribute("type"),t!=null?v==="number"?(t===0&&s.value===""||s.value!=t)&&(s.value=""+Ha(t)):s.value!==""+Ha(t)&&(s.value=""+Ha(t)):v!=="submit"&&v!=="reset"||s.removeAttribute("value"),t!=null?_d(s,v,Ha(t)):n!=null?_d(s,v,Ha(n)):i!=null&&s.removeAttribute("value"),o==null&&x!=null&&(s.defaultChecked=!!x),o!=null&&(s.checked=o&&typeof o!="function"&&typeof o!="symbol"),k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?s.name=""+Ha(k):s.removeAttribute("name")}function Gx(s,t,n,i,o,x,v,k){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(s.type=x),t!=null||n!=null){if(!(x!=="submit"&&x!=="reset"||t!=null)){yd(s);return}n=n!=null?""+Ha(n):"",t=t!=null?""+Ha(t):n,k||t===s.value||(s.value=t),s.defaultValue=t}i=i??o,i=typeof i!="function"&&typeof i!="symbol"&&!!i,s.checked=k?s.checked:!!i,s.defaultChecked=!!i,v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(s.name=v),yd(s)}function _d(s,t,n){t==="number"&&_c(s.ownerDocument)===s||s.defaultValue===""+n||(s.defaultValue=""+n)}function dr(s,t,n,i){if(s=s.options,t){t={};for(var o=0;o"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ed=!1;if(bl)try{var ii={};Object.defineProperty(ii,"passive",{get:function(){Ed=!0}}),window.addEventListener("test",ii,ii),window.removeEventListener("test",ii,ii)}catch{Ed=!1}var Yl=null,Md=null,kc=null;function Wx(){if(kc)return kc;var s,t=Md,n=t.length,i,o="value"in Yl?Yl.value:Yl.textContent,x=o.length;for(s=0;s=di),nh=" ",rh=!1;function ih(s,t){switch(s){case"keyup":return _y.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ch(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var hr=!1;function ky(s,t){switch(s){case"compositionend":return ch(t);case"keypress":return t.which!==32?null:(rh=!0,nh);case"textInput":return s=t.data,s===nh&&rh?null:s;default:return null}}function Cy(s,t){if(hr)return s==="compositionend"||!Od&&ih(s,t)?(s=Wx(),kc=Md=Yl=null,hr=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-s};s=i}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=ph(n)}}function jh(s,t){return s&&t?s===t?!0:s&&s.nodeType===3?!1:t&&t.nodeType===3?jh(s,t.parentNode):"contains"in s?s.contains(t):s.compareDocumentPosition?!!(s.compareDocumentPosition(t)&16):!1:!1}function vh(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var t=_c(s.document);t instanceof s.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)s=t.contentWindow;else break;t=_c(s.document)}return t}function $d(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 Oy=bl&&"documentMode"in document&&11>=document.documentMode,fr=null,Id=null,hi=null,Bd=!1;function Nh(s,t,n){var i=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Bd||fr==null||fr!==_c(i)||(i=fr,"selectionStart"in i&&$d(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),hi&&xi(hi,i)||(hi=i,i=No(Id,"onSelect"),0>=v,o-=v,xl=1<<32-ys(t)+o|n<_s?(Ls=Ye,Ye=null):Ls=Ye.sibling;var Ks=de(ee,Ye,ie[_s],be);if(Ks===null){Ye===null&&(Ye=Ls);break}s&&Ye&&Ks.alternate===null&&t(ee,Ye),q=x(Ks,q,_s),Gs===null?ss=Ks:Gs.sibling=Ks,Gs=Ks,Ye=Ls}if(_s===ie.length)return n(ee,Ye),Us&&wl(ee,_s),ss;if(Ye===null){for(;_s_s?(Ls=Ye,Ye=null):Ls=Ye.sibling;var jn=de(ee,Ye,Ks.value,be);if(jn===null){Ye===null&&(Ye=Ls);break}s&&Ye&&jn.alternate===null&&t(ee,Ye),q=x(jn,q,_s),Gs===null?ss=jn:Gs.sibling=jn,Gs=jn,Ye=Ls}if(Ks.done)return n(ee,Ye),Us&&wl(ee,_s),ss;if(Ye===null){for(;!Ks.done;_s++,Ks=ie.next())Ks=ye(ee,Ks.value,be),Ks!==null&&(q=x(Ks,q,_s),Gs===null?ss=Ks:Gs.sibling=Ks,Gs=Ks);return Us&&wl(ee,_s),ss}for(Ye=i(Ye);!Ks.done;_s++,Ks=ie.next())Ks=he(Ye,ee,_s,Ks.value,be),Ks!==null&&(s&&Ks.alternate!==null&&Ye.delete(Ks.key===null?_s:Ks.key),q=x(Ks,q,_s),Gs===null?ss=Ks:Gs.sibling=Ks,Gs=Ks);return s&&Ye.forEach(function(sw){return t(ee,sw)}),Us&&wl(ee,_s),ss}function ot(ee,q,ie,be){if(typeof ie=="object"&&ie!==null&&ie.type===z&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case y:e:{for(var ss=ie.key;q!==null;){if(q.key===ss){if(ss=ie.type,ss===z){if(q.tag===7){n(ee,q.sibling),be=o(q,ie.props.children),be.return=ee,ee=be;break e}}else if(q.elementType===ss||typeof ss=="object"&&ss!==null&&ss.$$typeof===X&&Bn(ss)===q.type){n(ee,q.sibling),be=o(q,ie.props),Ni(be,ie),be.return=ee,ee=be;break e}n(ee,q);break}else t(ee,q);q=q.sibling}ie.type===z?(be=On(ie.props.children,ee.mode,be,ie.key),be.return=ee,ee=be):(be=Lc(ie.type,ie.key,ie.props,null,ee.mode,be),Ni(be,ie),be.return=ee,ee=be)}return v(ee);case w:e:{for(ss=ie.key;q!==null;){if(q.key===ss)if(q.tag===4&&q.stateNode.containerInfo===ie.containerInfo&&q.stateNode.implementation===ie.implementation){n(ee,q.sibling),be=o(q,ie.children||[]),be.return=ee,ee=be;break e}else{n(ee,q);break}else t(ee,q);q=q.sibling}be=Kd(ie,ee.mode,be),be.return=ee,ee=be}return v(ee);case X:return ie=Bn(ie),ot(ee,q,ie,be)}if(pe(ie))return Ge(ee,q,ie,be);if(je(ie)){if(ss=je(ie),typeof ss!="function")throw Error(c(150));return ie=ss.call(ie),ls(ee,q,ie,be)}if(typeof ie.then=="function")return ot(ee,q,Hc(ie),be);if(ie.$$typeof===E)return ot(ee,q,Ic(ee,ie),be);qc(ee,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint"?(ie=""+ie,q!==null&&q.tag===6?(n(ee,q.sibling),be=o(q,ie),be.return=ee,ee=be):(n(ee,q),be=Gd(ie,ee.mode,be),be.return=ee,ee=be),v(ee)):n(ee,q)}return function(ee,q,ie,be){try{vi=0;var ss=ot(ee,q,ie,be);return kr=null,ss}catch(Ye){if(Ye===Sr||Ye===Pc)throw Ye;var Gs=Ea(29,Ye,null,ee.mode);return Gs.lanes=be,Gs.return=ee,Gs}finally{}}}var Fn=Hh(!0),qh=Hh(!1),en=!1;function nu(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ru(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 sn(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function tn(s,t,n){var i=s.updateQueue;if(i===null)return null;if(i=i.shared,(Js&2)!==0){var o=i.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),i.pending=t,t=Oc(s),Ch(s,null,n),t}return Dc(s,i,t,n),Oc(s)}function bi(s,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var i=t.lanes;i&=s.pendingLanes,n|=i,t.lanes=n,us(s,n)}}function iu(s,t){var n=s.updateQueue,i=s.alternate;if(i!==null&&(i=i.updateQueue,n===i)){var o=null,x=null;if(n=n.firstBaseUpdate,n!==null){do{var v={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};x===null?o=x=v:x=x.next=v,n=n.next}while(n!==null);x===null?o=x=t:x=x.next=t}else o=x=t;n={baseState:i.baseState,firstBaseUpdate:o,lastBaseUpdate:x,shared:i.shared,callbacks:i.callbacks},s.updateQueue=n;return}s=n.lastBaseUpdate,s===null?n.firstBaseUpdate=t:s.next=t,n.lastBaseUpdate=t}var cu=!1;function yi(){if(cu){var s=_r;if(s!==null)throw s}}function wi(s,t,n,i){cu=!1;var o=s.updateQueue;en=!1;var x=o.firstBaseUpdate,v=o.lastBaseUpdate,k=o.shared.pending;if(k!==null){o.shared.pending=null;var B=k,ce=B.next;B.next=null,v===null?x=ce:v.next=ce,v=B;var ve=s.alternate;ve!==null&&(ve=ve.updateQueue,k=ve.lastBaseUpdate,k!==v&&(k===null?ve.firstBaseUpdate=ce:k.next=ce,ve.lastBaseUpdate=B))}if(x!==null){var ye=o.baseState;v=0,ve=ce=B=null,k=x;do{var de=k.lane&-536870913,he=de!==k.lane;if(he?(Os&de)===de:(i&de)===de){de!==0&&de===wr&&(cu=!0),ve!==null&&(ve=ve.next={lane:0,tag:k.tag,payload:k.payload,callback:null,next:null});e:{var Ge=s,ls=k;de=t;var ot=n;switch(ls.tag){case 1:if(Ge=ls.payload,typeof Ge=="function"){ye=Ge.call(ot,ye,de);break e}ye=Ge;break e;case 3:Ge.flags=Ge.flags&-65537|128;case 0:if(Ge=ls.payload,de=typeof Ge=="function"?Ge.call(ot,ye,de):Ge,de==null)break e;ye=j({},ye,de);break e;case 2:en=!0}}de=k.callback,de!==null&&(s.flags|=64,he&&(s.flags|=8192),he=o.callbacks,he===null?o.callbacks=[de]:he.push(de))}else he={lane:de,tag:k.tag,payload:k.payload,callback:k.callback,next:null},ve===null?(ce=ve=he,B=ye):ve=ve.next=he,v|=de;if(k=k.next,k===null){if(k=o.shared.pending,k===null)break;he=k,k=he.next,he.next=null,o.lastBaseUpdate=he,o.shared.pending=null}}while(!0);ve===null&&(B=ye),o.baseState=B,o.firstBaseUpdate=ce,o.lastBaseUpdate=ve,x===null&&(o.shared.lanes=0),cn|=v,s.lanes=v,s.memoizedState=ye}}function Vh(s,t){if(typeof s!="function")throw Error(c(191,s));s.call(t)}function Gh(s,t){var n=s.callbacks;if(n!==null)for(s.callbacks=null,s=0;sx?x:8;var v=D.T,k={};D.T=k,Cu(s,!1,t,n);try{var B=o(),ce=D.S;if(ce!==null&&ce(k,B),B!==null&&typeof B=="object"&&typeof B.then=="function"){var ve=qy(B,i);ki(s,t,ve,Da(s))}else ki(s,t,i,Da(s))}catch(ye){ki(s,t,{then:function(){},status:"rejected",reason:ye},Da())}finally{Q.p=x,v!==null&&k.types!==null&&(v.types=k.types),D.T=v}}function Jy(){}function Su(s,t,n,i){if(s.tag!==5)throw Error(c(476));var o=Sf(s).queue;_f(s,o,t,I,n===null?Jy:function(){return kf(s),n(i)})}function Sf(s){var t=s.memoizedState;if(t!==null)return t;t={memoizedState:I,baseState:I,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Cl,lastRenderedState:I},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Cl,lastRenderedState:n},next:null},s.memoizedState=t,s=s.alternate,s!==null&&(s.memoizedState=t),t}function kf(s){var t=Sf(s);t.next===null&&(t=s.alternate.memoizedState),ki(s,t.next.queue,{},Da())}function ku(){return Wt(Hi)}function Cf(){return Dt().memoizedState}function Tf(){return Dt().memoizedState}function Xy(s){for(var t=s.return;t!==null;){switch(t.tag){case 24:case 3:var n=Da();s=sn(n);var i=tn(t,s,n);i!==null&&(ya(i,t,n),bi(i,t,n)),t={cache:su()},s.payload=t;return}t=t.return}}function Zy(s,t,n){var i=Da();n={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},eo(s)?Mf(t,n):(n=qd(s,t,n,i),n!==null&&(ya(n,s,i),Af(n,t,i)))}function Ef(s,t,n){var i=Da();ki(s,t,n,i)}function ki(s,t,n,i){var o={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(eo(s))Mf(t,o);else{var x=s.alternate;if(s.lanes===0&&(x===null||x.lanes===0)&&(x=t.lastRenderedReducer,x!==null))try{var v=t.lastRenderedState,k=x(v,n);if(o.hasEagerState=!0,o.eagerState=k,Ta(k,v))return Dc(s,t,o,0),xt===null&&Rc(),!1}catch{}finally{}if(n=qd(s,t,o,i),n!==null)return ya(n,s,i),Af(n,t,i),!0}return!1}function Cu(s,t,n,i){if(i={lane:2,revertLane:nm(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},eo(s)){if(t)throw Error(c(479))}else t=qd(s,n,i,2),t!==null&&ya(t,s,2)}function eo(s){var t=s.alternate;return s===ws||t!==null&&t===ws}function Mf(s,t){Tr=Kc=!0;var n=s.pending;n===null?t.next=t:(t.next=n.next,n.next=t),s.pending=t}function Af(s,t,n){if((n&4194048)!==0){var i=t.lanes;i&=s.pendingLanes,n|=i,t.lanes=n,us(s,n)}}var Ci={readContext:Wt,use:Jc,useCallback:Mt,useContext:Mt,useEffect:Mt,useImperativeHandle:Mt,useLayoutEffect:Mt,useInsertionEffect:Mt,useMemo:Mt,useReducer:Mt,useRef:Mt,useState:Mt,useDebugValue:Mt,useDeferredValue:Mt,useTransition:Mt,useSyncExternalStore:Mt,useId:Mt,useHostTransitionStatus:Mt,useFormState:Mt,useActionState:Mt,useOptimistic:Mt,useMemoCache:Mt,useCacheRefresh:Mt};Ci.useEffectEvent=Mt;var zf={readContext:Wt,use:Jc,useCallback:function(s,t){return ma().memoizedState=[s,t===void 0?null:t],s},useContext:Wt,useEffect:ff,useImperativeHandle:function(s,t,n){n=n!=null?n.concat([s]):null,Zc(4194308,4,vf.bind(null,t,s),n)},useLayoutEffect:function(s,t){return Zc(4194308,4,s,t)},useInsertionEffect:function(s,t){Zc(4,2,s,t)},useMemo:function(s,t){var n=ma();t=t===void 0?null:t;var i=s();if(Hn){is(!0);try{s()}finally{is(!1)}}return n.memoizedState=[i,t],i},useReducer:function(s,t,n){var i=ma();if(n!==void 0){var o=n(t);if(Hn){is(!0);try{n(t)}finally{is(!1)}}}else o=t;return i.memoizedState=i.baseState=o,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:o},i.queue=s,s=s.dispatch=Zy.bind(null,ws,s),[i.memoizedState,s]},useRef:function(s){var t=ma();return s={current:s},t.memoizedState=s},useState:function(s){s=Nu(s);var t=s.queue,n=Ef.bind(null,ws,t);return t.dispatch=n,[s.memoizedState,n]},useDebugValue:wu,useDeferredValue:function(s,t){var n=ma();return _u(n,s,t)},useTransition:function(){var s=Nu(!1);return s=_f.bind(null,ws,s.queue,!0,!1),ma().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,t,n){var i=ws,o=ma();if(Us){if(n===void 0)throw Error(c(407));n=n()}else{if(n=t(),xt===null)throw Error(c(349));(Os&127)!==0||Zh(i,t,n)}o.memoizedState=n;var x={value:n,getSnapshot:t};return o.queue=x,ff(ef.bind(null,i,x,s),[s]),i.flags|=2048,Mr(9,{destroy:void 0},Wh.bind(null,i,x,n,t),null),n},useId:function(){var s=ma(),t=xt.identifierPrefix;if(Us){var n=hl,i=xl;n=(i&~(1<<32-ys(i)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Qc++,0<\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof i.is=="string"?v.createElement("select",{is:i.is}):v.createElement("select"),i.multiple?x.multiple=!0:i.size&&(x.size=i.size);break;default:x=typeof i.is=="string"?v.createElement(o,{is:i.is}):v.createElement(o)}}x[oe]=t,x[Ve]=i;e:for(v=t.child;v!==null;){if(v.tag===5||v.tag===6)x.appendChild(v.stateNode);else if(v.tag!==4&&v.tag!==27&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===t)break e;for(;v.sibling===null;){if(v.return===null||v.return===t)break e;v=v.return}v.sibling.return=v.return,v=v.sibling}t.stateNode=x;e:switch(sa(x,o,i),o){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&El(t)}}return yt(t),Pu(t,t.type,s===null?null:s.memoizedProps,t.pendingProps,n),null;case 6:if(s&&t.stateNode!=null)s.memoizedProps!==i&&El(t);else{if(typeof i!="string"&&t.stateNode===null)throw Error(c(166));if(s=A.current,br(t)){if(s=t.stateNode,n=t.memoizedProps,i=null,o=Zt,o!==null)switch(o.tag){case 27:case 5:i=o.memoizedProps}s[oe]=t,s=!!(s.nodeValue===n||i!==null&&i.suppressHydrationWarning===!0||Xp(s.nodeValue,n)),s||Zl(t,!0)}else s=bo(s).createTextNode(i),s[oe]=t,t.stateNode=s}return yt(t),null;case 31:if(n=t.memoizedState,s===null||s.memoizedState!==null){if(i=br(t),n!==null){if(s===null){if(!i)throw Error(c(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(c(557));s[oe]=t}else Ln(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;yt(t),s=!1}else n=Xd(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=n),s=!0;if(!s)return t.flags&256?(Aa(t),t):(Aa(t),null);if((t.flags&128)!==0)throw Error(c(558))}return yt(t),null;case 13:if(i=t.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(o=br(t),i!==null&&i.dehydrated!==null){if(s===null){if(!o)throw Error(c(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(c(317));o[oe]=t}else Ln(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;yt(t),o=!1}else o=Xd(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?(Aa(t),t):(Aa(t),null)}return Aa(t),(t.flags&128)!==0?(t.lanes=n,t):(n=i!==null,s=s!==null&&s.memoizedState!==null,n&&(i=t.child,o=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(o=i.alternate.memoizedState.cachePool.pool),x=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(x=i.memoizedState.cachePool.pool),x!==o&&(i.flags|=2048)),n!==s&&n&&(t.child.flags|=8192),no(t,t.updateQueue),yt(t),null);case 4:return se(),s===null&&om(t.stateNode.containerInfo),yt(t),null;case 10:return Sl(t.type),yt(t),null;case 19:if(fe(Rt),i=t.memoizedState,i===null)return yt(t),null;if(o=(t.flags&128)!==0,x=i.rendering,x===null)if(o)Ei(i,!1);else{if(At!==0||s!==null&&(s.flags&128)!==0)for(s=t.child;s!==null;){if(x=Gc(s),x!==null){for(t.flags|=128,Ei(i,!1),s=x.updateQueue,t.updateQueue=s,no(t,s),t.subtreeFlags=0,s=n,n=t.child;n!==null;)Th(n,s),n=n.sibling;return Ee(Rt,Rt.current&1|2),Us&&wl(t,i.treeForkCount),t.child}s=s.sibling}i.tail!==null&&Bs()>uo&&(t.flags|=128,o=!0,Ei(i,!1),t.lanes=4194304)}else{if(!o)if(s=Gc(x),s!==null){if(t.flags|=128,o=!0,s=s.updateQueue,t.updateQueue=s,no(t,s),Ei(i,!0),i.tail===null&&i.tailMode==="hidden"&&!x.alternate&&!Us)return yt(t),null}else 2*Bs()-i.renderingStartTime>uo&&n!==536870912&&(t.flags|=128,o=!0,Ei(i,!1),t.lanes=4194304);i.isBackwards?(x.sibling=t.child,t.child=x):(s=i.last,s!==null?s.sibling=x:t.child=x,i.last=x)}return i.tail!==null?(s=i.tail,i.rendering=s,i.tail=s.sibling,i.renderingStartTime=Bs(),s.sibling=null,n=Rt.current,Ee(Rt,o?n&1|2:n&1),Us&&wl(t,i.treeForkCount),s):(yt(t),null);case 22:case 23:return Aa(t),du(),i=t.memoizedState!==null,s!==null?s.memoizedState!==null!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?(n&536870912)!==0&&(t.flags&128)===0&&(yt(t),t.subtreeFlags&6&&(t.flags|=8192)):yt(t),n=t.updateQueue,n!==null&&no(t,n.retryQueue),n=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(n=s.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==n&&(t.flags|=2048),s!==null&&fe(In),null;case 24:return n=null,s!==null&&(n=s.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Sl(It),yt(t),null;case 25:return null;case 30:return null}throw Error(c(156,t.tag))}function a0(s,t){switch(Yd(t),t.tag){case 1:return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 3:return Sl(It),se(),s=t.flags,(s&65536)!==0&&(s&128)===0?(t.flags=s&-65537|128,t):null;case 26:case 27:case 5:return cs(t),null;case 31:if(t.memoizedState!==null){if(Aa(t),t.alternate===null)throw Error(c(340));Ln()}return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 13:if(Aa(t),s=t.memoizedState,s!==null&&s.dehydrated!==null){if(t.alternate===null)throw Error(c(340));Ln()}return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 19:return fe(Rt),null;case 4:return se(),null;case 10:return Sl(t.type),null;case 22:case 23:return Aa(t),du(),s!==null&&fe(In),s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 24:return Sl(It),null;case 25:return null;default:return null}}function tp(s,t){switch(Yd(t),t.tag){case 3:Sl(It),se();break;case 26:case 27:case 5:cs(t);break;case 4:se();break;case 31:t.memoizedState!==null&&Aa(t);break;case 13:Aa(t);break;case 19:fe(Rt);break;case 10:Sl(t.type);break;case 22:case 23:Aa(t),du(),s!==null&&fe(In);break;case 24:Sl(It)}}function Mi(s,t){try{var n=t.updateQueue,i=n!==null?n.lastEffect:null;if(i!==null){var o=i.next;n=o;do{if((n.tag&s)===s){i=void 0;var x=n.create,v=n.inst;i=x(),v.destroy=i}n=n.next}while(n!==o)}}catch(k){et(t,t.return,k)}}function nn(s,t,n){try{var i=t.updateQueue,o=i!==null?i.lastEffect:null;if(o!==null){var x=o.next;i=x;do{if((i.tag&s)===s){var v=i.inst,k=v.destroy;if(k!==void 0){v.destroy=void 0,o=t;var B=n,ce=k;try{ce()}catch(ve){et(o,B,ve)}}}i=i.next}while(i!==x)}}catch(ve){et(t,t.return,ve)}}function ap(s){var t=s.updateQueue;if(t!==null){var n=s.stateNode;try{Gh(t,n)}catch(i){et(s,s.return,i)}}}function lp(s,t,n){n.props=qn(s.type,s.memoizedProps),n.state=s.memoizedState;try{n.componentWillUnmount()}catch(i){et(s,t,i)}}function Ai(s,t){try{var n=s.ref;if(n!==null){switch(s.tag){case 26:case 27:case 5:var i=s.stateNode;break;case 30:i=s.stateNode;break;default:i=s.stateNode}typeof n=="function"?s.refCleanup=n(i):n.current=i}}catch(o){et(s,t,o)}}function fl(s,t){var n=s.ref,i=s.refCleanup;if(n!==null)if(typeof i=="function")try{i()}catch(o){et(s,t,o)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(o){et(s,t,o)}else n.current=null}function np(s){var t=s.type,n=s.memoizedProps,i=s.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&i.focus();break e;case"img":n.src?i.src=n.src:n.srcSet&&(i.srcset=n.srcSet)}}catch(o){et(s,s.return,o)}}function Fu(s,t,n){try{var i=s.stateNode;S0(i,s.type,n,t),i[Ve]=t}catch(o){et(s,s.return,o)}}function rp(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&xn(s.type)||s.tag===4}function Hu(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||rp(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&&xn(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 qu(s,t,n){var i=s.tag;if(i===5||i===6)s=s.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(s,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(s),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Nl));else if(i!==4&&(i===27&&xn(s.type)&&(n=s.stateNode,t=null),s=s.child,s!==null))for(qu(s,t,n),s=s.sibling;s!==null;)qu(s,t,n),s=s.sibling}function ro(s,t,n){var i=s.tag;if(i===5||i===6)s=s.stateNode,t?n.insertBefore(s,t):n.appendChild(s);else if(i!==4&&(i===27&&xn(s.type)&&(n=s.stateNode),s=s.child,s!==null))for(ro(s,t,n),s=s.sibling;s!==null;)ro(s,t,n),s=s.sibling}function ip(s){var t=s.stateNode,n=s.memoizedProps;try{for(var i=s.type,o=t.attributes;o.length;)t.removeAttributeNode(o[0]);sa(t,i,n),t[oe]=s,t[Ve]=n}catch(x){et(s,s.return,x)}}var Ml=!1,Ft=!1,Vu=!1,cp=typeof WeakSet=="function"?WeakSet:Set,Qt=null;function l0(s,t){if(s=s.containerInfo,mm=To,s=vh(s),$d(s)){if("selectionStart"in s)var n={start:s.selectionStart,end:s.selectionEnd};else e:{n=(n=s.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var o=i.anchorOffset,x=i.focusNode;i=i.focusOffset;try{n.nodeType,x.nodeType}catch{n=null;break e}var v=0,k=-1,B=-1,ce=0,ve=0,ye=s,de=null;s:for(;;){for(var he;ye!==n||o!==0&&ye.nodeType!==3||(k=v+o),ye!==x||i!==0&&ye.nodeType!==3||(B=v+i),ye.nodeType===3&&(v+=ye.nodeValue.length),(he=ye.firstChild)!==null;)de=ye,ye=he;for(;;){if(ye===s)break s;if(de===n&&++ce===o&&(k=v),de===x&&++ve===i&&(B=v),(he=ye.nextSibling)!==null)break;ye=de,de=ye.parentNode}ye=he}n=k===-1||B===-1?null:{start:k,end:B}}else n=null}n=n||{start:0,end:0}}else n=null;for(xm={focusedElem:s,selectionRange:n},To=!1,Qt=t;Qt!==null;)if(t=Qt,s=t.child,(t.subtreeFlags&1028)!==0&&s!==null)s.return=t,Qt=s;else for(;Qt!==null;){switch(t=Qt,x=t.alternate,s=t.flags,t.tag){case 0:if((s&4)!==0&&(s=t.updateQueue,s=s!==null?s.events:null,s!==null))for(n=0;n title"))),sa(x,i,n),x[oe]=s,Kt(x),i=x;break e;case"link":var v=hg("link","href",o).get(i+(n.href||""));if(v){for(var k=0;kot&&(v=ot,ot=ls,ls=v);var ee=gh(k,ls),q=gh(k,ot);if(ee&&q&&(he.rangeCount!==1||he.anchorNode!==ee.node||he.anchorOffset!==ee.offset||he.focusNode!==q.node||he.focusOffset!==q.offset)){var ie=ye.createRange();ie.setStart(ee.node,ee.offset),he.removeAllRanges(),ls>ot?(he.addRange(ie),he.extend(q.node,q.offset)):(ie.setEnd(q.node,q.offset),he.addRange(ie))}}}}for(ye=[],he=k;he=he.parentNode;)he.nodeType===1&&ye.push({element:he,left:he.scrollLeft,top:he.scrollTop});for(typeof k.focus=="function"&&k.focus(),k=0;kn?32:n,D.T=null,n=Zu,Zu=null;var x=dn,v=Ol;if(qt=0,Or=dn=null,Ol=0,(Js&6)!==0)throw Error(c(331));var k=Js;if(Js|=4,vp(x.current),pp(x,x.current,v,n),Js=k,Ui(0,!1),rs&&typeof rs.onPostCommitFiberRoot=="function")try{rs.onPostCommitFiberRoot(Cs,x)}catch{}return!0}finally{Q.p=o,D.T=i,Up(s,t)}}function Ip(s,t,n){t=Ga(n,t),t=Au(s.stateNode,t,2),s=tn(s,t,2),s!==null&&(U(s,2),pl(s))}function et(s,t,n){if(s.tag===3)Ip(s,s,n);else for(;t!==null;){if(t.tag===3){Ip(t,s,n);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(on===null||!on.has(i))){s=Ga(n,s),n=Bf(2),i=tn(t,n,2),i!==null&&(Pf(n,i,t,s),U(i,2),pl(i));break}}t=t.return}}function tm(s,t,n){var i=s.pingCache;if(i===null){i=s.pingCache=new i0;var o=new Set;i.set(t,o)}else o=i.get(t),o===void 0&&(o=new Set,i.set(t,o));o.has(n)||(Qu=!0,o.add(n),s=m0.bind(null,s,t,n),t.then(s,s))}function m0(s,t,n){var i=s.pingCache;i!==null&&i.delete(t),s.pingedLanes|=s.suspendedLanes&n,s.warmLanes&=~n,xt===s&&(Os&n)===n&&(At===4||At===3&&(Os&62914560)===Os&&300>Bs()-oo?(Js&2)===0&&Lr(s,0):Yu|=n,Dr===Os&&(Dr=0)),pl(s)}function Bp(s,t){t===0&&(t=te()),s=Dn(s,t),s!==null&&(U(s,t),pl(s))}function x0(s){var t=s.memoizedState,n=0;t!==null&&(n=t.retryLane),Bp(s,n)}function h0(s,t){var n=0;switch(s.tag){case 31:case 13:var i=s.stateNode,o=s.memoizedState;o!==null&&(n=o.retryLane);break;case 19:i=s.stateNode;break;case 22:i=s.stateNode._retryCache;break;default:throw Error(c(314))}i!==null&&i.delete(t),Bp(s,n)}function f0(s,t){return Ts(s,t)}var go=null,$r=null,am=!1,jo=!1,lm=!1,mn=0;function pl(s){s!==$r&&s.next===null&&($r===null?go=$r=s:$r=$r.next=s),jo=!0,am||(am=!0,g0())}function Ui(s,t){if(!lm&&jo){lm=!0;do for(var n=!1,i=go;i!==null;){if(s!==0){var o=i.pendingLanes;if(o===0)var x=0;else{var v=i.suspendedLanes,k=i.pingedLanes;x=(1<<31-ys(42|s)+1)-1,x&=o&~(v&~k),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(n=!0,qp(i,x))}else x=Os,x=ca(i,i===xt?x:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(x&3)===0||Fa(i,x)||(n=!0,qp(i,x));i=i.next}while(n);lm=!1}}function p0(){Pp()}function Pp(){jo=am=!1;var s=0;mn!==0&&C0()&&(s=mn);for(var t=Bs(),n=null,i=go;i!==null;){var o=i.next,x=Fp(i,t);x===0?(i.next=null,n===null?go=o:n.next=o,o===null&&($r=n)):(n=i,(s!==0||(x&3)!==0)&&(jo=!0)),i=o}qt!==0&&qt!==5||Ui(s),mn!==0&&(mn=0)}function Fp(s,t){for(var n=s.suspendedLanes,i=s.pingedLanes,o=s.expirationTimes,x=s.pendingLanes&-62914561;0k)break;var ve=B.transferSize,ye=B.initiatorType;ve&&Zp(ye)&&(B=B.responseEnd,v+=ve*(B"u"?null:document;function dg(s,t,n){var i=Ir;if(i&&typeof t=="string"&&t){var o=qa(t);o='link[rel="'+s+'"][href="'+o+'"]',typeof n=="string"&&(o+='[crossorigin="'+n+'"]'),og.has(o)||(og.add(o),s={rel:s,crossOrigin:n,href:t},i.querySelector(o)===null&&(t=i.createElement("link"),sa(t,"link",s),Kt(t),i.head.appendChild(t)))}}function L0(s){Ll.D(s),dg("dns-prefetch",s,null)}function U0(s,t){Ll.C(s,t),dg("preconnect",s,t)}function $0(s,t,n){Ll.L(s,t,n);var i=Ir;if(i&&s&&t){var o='link[rel="preload"][as="'+qa(t)+'"]';t==="image"&&n&&n.imageSrcSet?(o+='[imagesrcset="'+qa(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(o+='[imagesizes="'+qa(n.imageSizes)+'"]')):o+='[href="'+qa(s)+'"]';var x=o;switch(t){case"style":x=Br(s);break;case"script":x=Pr(s)}Za.has(x)||(s=j({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:s,as:t},n),Za.set(x,s),i.querySelector(o)!==null||t==="style"&&i.querySelector(Pi(x))||t==="script"&&i.querySelector(Fi(x))||(t=i.createElement("link"),sa(t,"link",s),Kt(t),i.head.appendChild(t)))}}function I0(s,t){Ll.m(s,t);var n=Ir;if(n&&s){var i=t&&typeof t.as=="string"?t.as:"script",o='link[rel="modulepreload"][as="'+qa(i)+'"][href="'+qa(s)+'"]',x=o;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=Pr(s)}if(!Za.has(x)&&(s=j({rel:"modulepreload",href:s},t),Za.set(x,s),n.querySelector(o)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Fi(x)))return}i=n.createElement("link"),sa(i,"link",s),Kt(i),n.head.appendChild(i)}}}function B0(s,t,n){Ll.S(s,t,n);var i=Ir;if(i&&s){var o=cr(i).hoistableStyles,x=Br(s);t=t||"default";var v=o.get(x);if(!v){var k={loading:0,preload:null};if(v=i.querySelector(Pi(x)))k.loading=5;else{s=j({rel:"stylesheet",href:s,"data-precedence":t},n),(n=Za.get(x))&&Nm(s,n);var B=v=i.createElement("link");Kt(B),sa(B,"link",s),B._p=new Promise(function(ce,ve){B.onload=ce,B.onerror=ve}),B.addEventListener("load",function(){k.loading|=1}),B.addEventListener("error",function(){k.loading|=2}),k.loading|=4,wo(v,t,i)}v={type:"stylesheet",instance:v,count:1,state:k},o.set(x,v)}}}function P0(s,t){Ll.X(s,t);var n=Ir;if(n&&s){var i=cr(n).hoistableScripts,o=Pr(s),x=i.get(o);x||(x=n.querySelector(Fi(o)),x||(s=j({src:s,async:!0},t),(t=Za.get(o))&&bm(s,t),x=n.createElement("script"),Kt(x),sa(x,"link",s),n.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},i.set(o,x))}}function F0(s,t){Ll.M(s,t);var n=Ir;if(n&&s){var i=cr(n).hoistableScripts,o=Pr(s),x=i.get(o);x||(x=n.querySelector(Fi(o)),x||(s=j({src:s,async:!0,type:"module"},t),(t=Za.get(o))&&bm(s,t),x=n.createElement("script"),Kt(x),sa(x,"link",s),n.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},i.set(o,x))}}function ug(s,t,n,i){var o=(o=A.current)?yo(o):null;if(!o)throw Error(c(446));switch(s){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=Br(n.href),n=cr(o).hoistableStyles,i=n.get(t),i||(i={type:"style",instance:null,count:0,state:null},n.set(t,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){s=Br(n.href);var x=cr(o).hoistableStyles,v=x.get(s);if(v||(o=o.ownerDocument||o,v={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(s,v),(x=o.querySelector(Pi(s)))&&!x._p&&(v.instance=x,v.state.loading=5),Za.has(s)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Za.set(s,n),x||H0(o,s,n,v.state))),t&&i===null)throw Error(c(528,""));return v}if(t&&i!==null)throw Error(c(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Pr(n),n=cr(o).hoistableScripts,i=n.get(t),i||(i={type:"script",instance:null,count:0,state:null},n.set(t,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(c(444,s))}}function Br(s){return'href="'+qa(s)+'"'}function Pi(s){return'link[rel="stylesheet"]['+s+"]"}function mg(s){return j({},s,{"data-precedence":s.precedence,precedence:null})}function H0(s,t,n,i){s.querySelector('link[rel="preload"][as="style"]['+t+"]")?i.loading=1:(t=s.createElement("link"),i.preload=t,t.addEventListener("load",function(){return i.loading|=1}),t.addEventListener("error",function(){return i.loading|=2}),sa(t,"link",n),Kt(t),s.head.appendChild(t))}function Pr(s){return'[src="'+qa(s)+'"]'}function Fi(s){return"script[async]"+s}function xg(s,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var i=s.querySelector('style[data-href~="'+qa(n.href)+'"]');if(i)return t.instance=i,Kt(i),i;var o=j({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return i=(s.ownerDocument||s).createElement("style"),Kt(i),sa(i,"style",o),wo(i,n.precedence,s),t.instance=i;case"stylesheet":o=Br(n.href);var x=s.querySelector(Pi(o));if(x)return t.state.loading|=4,t.instance=x,Kt(x),x;i=mg(n),(o=Za.get(o))&&Nm(i,o),x=(s.ownerDocument||s).createElement("link"),Kt(x);var v=x;return v._p=new Promise(function(k,B){v.onload=k,v.onerror=B}),sa(x,"link",i),t.state.loading|=4,wo(x,n.precedence,s),t.instance=x;case"script":return x=Pr(n.src),(o=s.querySelector(Fi(x)))?(t.instance=o,Kt(o),o):(i=n,(o=Za.get(x))&&(i=j({},n),bm(i,o)),s=s.ownerDocument||s,o=s.createElement("script"),Kt(o),sa(o,"link",i),s.head.appendChild(o),t.instance=o);case"void":return null;default:throw Error(c(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(i=t.instance,t.state.loading|=4,wo(i,n.precedence,s));return t.instance}function wo(s,t,n){for(var i=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),o=i.length?i[i.length-1]:null,x=o,v=0;v title"):null)}function q0(s,t,n){if(n===1||t.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return s=t.disabled,typeof t.precedence=="string"&&s==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function pg(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function V0(s,t,n,i){if(n.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var o=Br(i.href),x=t.querySelector(Pi(o));if(x){t=x._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(s.count++,s=So.bind(s),t.then(s,s)),n.state.loading|=4,n.instance=x,Kt(x);return}x=t.ownerDocument||t,i=mg(i),(o=Za.get(o))&&Nm(i,o),x=x.createElement("link"),Kt(x);var v=x;v._p=new Promise(function(k,B){v.onload=k,v.onerror=B}),sa(x,"link",i),n.instance=x}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(s.count++,n=So.bind(s),t.addEventListener("load",n),t.addEventListener("error",n))}}var ym=0;function G0(s,t){return s.stylesheets&&s.count===0&&Co(s,s.stylesheets),0ym?50:800)+t);return s.unsuspend=n,function(){s.unsuspend=null,clearTimeout(i),clearTimeout(o)}}:null}function So(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Co(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var ko=null;function Co(s,t){s.stylesheets=null,s.unsuspend!==null&&(s.count++,ko=new Map,t.forEach(K0,s),ko=null,So.call(s))}function K0(s,t){if(!(t.state.loading&4)){var n=ko.get(s);if(n)var i=n.get(null);else{n=new Map,ko.set(s,n);for(var o=s.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(l){console.error(l)}}return a(),Rm.exports=L1(),Rm.exports}var $1=U1();function P(...a){return xw(hw(a))}const Te=u.forwardRef(({className:a,...l},r)=>e.jsx("div",{ref:r,className:P("rounded-xl border bg-card text-card-foreground shadow",a),...l}));Te.displayName="Card";const Oe=u.forwardRef(({className:a,...l},r)=>e.jsx("div",{ref:r,className:P("flex flex-col space-y-1.5 p-6",a),...l}));Oe.displayName="CardHeader";const Ue=u.forwardRef(({className:a,...l},r)=>e.jsx("div",{ref:r,className:P("font-semibold leading-none tracking-tight",a),...l}));Ue.displayName="CardTitle";const Ns=u.forwardRef(({className:a,...l},r)=>e.jsx("div",{ref:r,className:P("text-sm text-muted-foreground",a),...l}));Ns.displayName="CardDescription";const ze=u.forwardRef(({className:a,...l},r)=>e.jsx("div",{ref:r,className:P("p-6 pt-0",a),...l}));ze.displayName="CardContent";const od=u.forwardRef(({className:a,...l},r)=>e.jsx("div",{ref:r,className:P("flex items-center p-6 pt-0",a),...l}));od.displayName="CardFooter";const Jt=pw,Gt=u.forwardRef(({className:a,...l},r)=>e.jsx(hj,{ref:r,className:P("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",a),...l}));Gt.displayName=hj.displayName;const Xe=u.forwardRef(({className:a,...l},r)=>e.jsx(fj,{ref:r,className:P("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all duration-300 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",a),...l}));Xe.displayName=fj.displayName;const Ss=u.forwardRef(({className:a,...l},r)=>e.jsx(pj,{ref:r,className:P("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=active]:animate-in data-[state=active]:fade-in data-[state=active]:duration-300",a),...l}));Ss.displayName=pj.displayName;const ts=u.forwardRef(({className:a,children:l,viewportRef:r,...c},d)=>e.jsxs(gj,{ref:d,className:P("relative overflow-hidden",a),...c,children:[e.jsx(gw,{ref:r,className:"h-full w-full rounded-[inherit]",children:l}),e.jsx(Xm,{}),e.jsx(Xm,{orientation:"horizontal"}),e.jsx(jw,{})]}));ts.displayName=gj.displayName;const Xm=u.forwardRef(({className:a,orientation:l="vertical",...r},c)=>e.jsx(jj,{ref:c,orientation:l,className:P("flex touch-none select-none transition-colors",l==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",l==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",a),...r,children:e.jsx(vw,{className:"relative flex-1 rounded-full bg-border"})}));Xm.displayName=jj.displayName;function ks({className:a,...l}){return e.jsx("div",{className:P("animate-pulse rounded-md bg-primary/10",a),...l})}const tr=u.forwardRef(({className:a,value:l,...r},c)=>e.jsx(vj,{ref:c,className:P("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",a),...r,children:e.jsx(Nw,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(l||0)}%)`}})}));tr.displayName=vj.displayName;async function ke(a,l){const c=l?.body instanceof FormData?{...l?.headers}:{"Content-Type":"application/json",...l?.headers},d={...l,credentials:"include",headers:c},m=await fetch(a,d);if(m.status===401)throw window.location.href="/auth",new Error("่ฎค่ฏๅคฑ่ดฅ๏ผŒ่ฏท้‡ๆ–ฐ็™ปๅฝ•");return m}function Zs(){return{"Content-Type":"application/json"}}async function I1(){try{await fetch("/api/webui/auth/logout",{method:"POST",credentials:"include"})}catch(a){console.error("็™ปๅ‡บ่ฏทๆฑ‚ๅคฑ่ดฅ:",a)}window.location.href="/auth"}async function dc(){try{return(await(await fetch("/api/webui/auth/check",{method:"GET",credentials:"include"})).json()).authenticated===!0}catch{return!1}}const B1={light:"",dark:".dark"},Mv=u.createContext(null);function Av(){const a=u.useContext(Mv);if(!a)throw new Error("useChart must be used within a ");return a}const Kr=u.forwardRef(({id:a,className:l,children:r,config:c,...d},m)=>{const h=u.useId(),f=`chart-${a||h.replace(/:/g,"")}`;return e.jsx(Mv.Provider,{value:{config:c},children:e.jsxs("div",{"data-chart":f,ref:m,className:P("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",l),...d,children:[e.jsx(P1,{id:f,config:c}),e.jsx(Uj,{children:r})]})})});Kr.displayName="Chart";const P1=({id:a,config:l})=>{const r=Object.entries(l).filter(([,c])=>c.theme||c.color);return r.length?e.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(B1).map(([c,d])=>` ${d} [data-chart=${a}] { ${r.map(([m,h])=>{const f=h.theme?.[c]||h.color;return f?` --color-${m}: ${f};`:null}).join(` `)} } `).join(` -`)}}):null},Qi=$j,Qr=u.forwardRef(({active:a,payload:l,className:r,indicator:c="dot",hideLabel:d=!1,hideIndicator:m=!1,label:h,labelFormatter:f,labelClassName:p,formatter:g,color:N,nameKey:j,labelKey:b},y)=>{const{config:w}=Av(),z=u.useMemo(()=>{if(d||!l?.length)return null;const[S]=l,F=`${b||S?.dataKey||S?.name||"value"}`,E=Zm(w,S,F),C=!b&&typeof h=="string"?w[h]?.label||h:E?.label;return f?e.jsx("div",{className:P("font-medium",p),children:f(C,l)}):C?e.jsx("div",{className:P("font-medium",p),children:C}):null},[h,f,l,d,p,w,b]);if(!a||!l?.length)return null;const M=l.length===1&&c!=="dot";return e.jsxs("div",{ref:y,className:P("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",r),children:[M?null:z,e.jsx("div",{className:"grid gap-1.5",children:l.filter(S=>S.type!=="none").map((S,F)=>{const E=`${j||S.name||S.dataKey||"value"}`,C=Zm(w,S,E),R=N||S.payload.fill||S.color;return e.jsx("div",{className:P("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",c==="dot"&&"items-center"),children:g&&S?.value!==void 0&&S.name?g(S.value,S.name,S,F,S.payload):e.jsxs(e.Fragment,{children:[C?.icon?e.jsx(C.icon,{}):!m&&e.jsx("div",{className:P("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":c==="dot","w-1":c==="line","w-0 border-[1.5px] border-dashed bg-transparent":c==="dashed","my-0.5":M&&c==="dashed"}),style:{"--color-bg":R,"--color-border":R}}),e.jsxs("div",{className:P("flex flex-1 justify-between leading-none",M?"items-end":"items-center"),children:[e.jsxs("div",{className:"grid gap-1.5",children:[M?z:null,e.jsx("span",{className:"text-muted-foreground",children:C?.label||S.name})]}),S.value&&e.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:S.value.toLocaleString()})]})]})},S.dataKey)})})]})});Qr.displayName="ChartTooltip";const F_=Zw,zv=u.forwardRef(({className:a,hideIcon:l=!1,payload:r,verticalAlign:c="bottom",nameKey:d},m)=>{const{config:h}=Av();return r?.length?e.jsx("div",{ref:m,className:P("flex items-center justify-center gap-4",c==="top"?"pb-3":"pt-3",a),children:r.filter(f=>f.type!=="none").map(f=>{const p=`${d||f.dataKey||"value"}`,g=Zm(h,f,p);return e.jsxs("div",{className:P("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[g?.icon&&!l?e.jsx(g.icon,{}):e.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:f.color}}),g?.label]},f.value)})}):null});zv.displayName="ChartLegend";function Zm(a,l,r){if(typeof l!="object"||l===null)return;const c="payload"in l&&typeof l.payload=="object"&&l.payload!==null?l.payload:void 0;let d=r;return r in l&&typeof l[r]=="string"?d=l[r]:c&&r in c&&typeof c[r]=="string"&&(d=c[r]),d in a?a[d]:a[r]}const si=ti("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),_=u.forwardRef(({className:a,variant:l,size:r,asChild:c=!1,...d},m)=>{const h=c?l1:"button";return e.jsx(h,{className:P(si({variant:l,size:r,className:a})),ref:m,...d})});_.displayName="Button";const H_=ti("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Ce({className:a,variant:l,...r}){return e.jsx("div",{className:P(H_({variant:l}),a),...r})}async function q_(){const a=await ke("/api/webui/system/restart",{method:"POST",headers:Zs()});if(!a.ok){const l=await a.json();throw new Error(l.detail||"้‡ๅฏๅคฑ่ดฅ")}return await a.json()}async function V_(){const a=await ke("/api/webui/system/status",{method:"GET",headers:Zs()});if(!a.ok){const l=await a.json();throw new Error(l.detail||"่Žทๅ–็Šถๆ€ๅคฑ่ดฅ")}return await a.json()}const Hr={INITIAL_DELAY:3e3,CHECK_INTERVAL:2e3,CHECK_TIMEOUT:3e3,MAX_ATTEMPTS:60,PROGRESS_INTERVAL:200,SUCCESS_REDIRECT_DELAY:1500},Rv=u.createContext(null);function lr({children:a,onRestartComplete:l,onRestartFailed:r,healthCheckUrl:c="/api/webui/system/status",maxAttempts:d=Hr.MAX_ATTEMPTS}){const[m,h]=u.useState({status:"idle",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:d}),f=u.useRef({}),p=u.useCallback(()=>{const z=f.current;z.progress&&(clearInterval(z.progress),z.progress=void 0),z.elapsed&&(clearInterval(z.elapsed),z.elapsed=void 0),z.check&&(clearTimeout(z.check),z.check=void 0)},[]),g=u.useCallback(()=>{p(),h({status:"idle",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:d})},[p,d]),N=u.useCallback(async()=>{try{const z=new AbortController,M=setTimeout(()=>z.abort(),Hr.CHECK_TIMEOUT),S=await fetch(c,{method:"GET",headers:{"Content-Type":"application/json"},credentials:"include",signal:z.signal});return clearTimeout(M),S.ok}catch{return!1}},[c]),j=u.useCallback(()=>{let z=0;const M=async()=>{if(z++,h(F=>({...F,status:"checking",checkAttempts:z})),await N())p(),h(F=>({...F,status:"success",progress:100})),setTimeout(()=>{l?.(),window.location.href="/auth"},Hr.SUCCESS_REDIRECT_DELAY);else if(z>=d){p();const F=`ๅฅๅบทๆฃ€ๆŸฅ่ถ…ๆ—ถ (${z}/${d})`;h(E=>({...E,status:"failed",error:F})),r?.(F)}else{const F=setTimeout(M,Hr.CHECK_INTERVAL);f.current.check=F}};M()},[N,p,d,l,r]),b=u.useCallback(()=>{h(z=>({...z,status:"checking",checkAttempts:0,error:void 0})),j()},[j]),y=u.useCallback(async z=>{const{delay:M=0,skipApiCall:S=!1}=z??{};if(m.status!=="idle"&&m.status!=="failed")return;if(p(),h({status:"requesting",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:d}),M>0&&await new Promise(C=>setTimeout(C,M)),S)h(C=>({...C,status:"restarting"}));else try{h(C=>({...C,status:"restarting"})),await Promise.race([q_(),new Promise(C=>setTimeout(C,5e3))])}catch{}const F=setInterval(()=>{h(C=>({...C,progress:C.progress>=90?C.progress:C.progress+1}))},Hr.PROGRESS_INTERVAL),E=setInterval(()=>{h(C=>({...C,elapsedTime:C.elapsedTime+1}))},1e3);f.current.progress=F,f.current.elapsed=E,setTimeout(()=>{j()},Hr.INITIAL_DELAY)},[m.status,p,d,j]),w={state:m,isRestarting:m.status!=="idle",triggerRestart:y,resetState:g,retryHealthCheck:b};return e.jsx(Rv.Provider,{value:w,children:a})}function Tn(){const a=u.useContext(Rv);if(!a)throw new Error("useRestart must be used within a RestartProvider");return a}function G_(){try{return Tn()}catch{return null}}const K_=(a,l,r,c,d)=>({idle:{icon:null,title:"",description:"",tip:""},requesting:{icon:e.jsx(Fs,{className:"h-16 w-16 text-primary animate-spin"}),title:c??"ๅ‡†ๅค‡้‡ๅฏ",description:d??"ๆญฃๅœจๅ‘้€้‡ๅฏ่ฏทๆฑ‚...",tip:"๐Ÿ”„ ๆญฃๅœจๅ‡†ๅค‡้‡ๅฏ้บฆ้บฆ..."},restarting:{icon:e.jsx(Fs,{className:"h-16 w-16 text-primary animate-spin"}),title:c??"ๆญฃๅœจ้‡ๅฏ้บฆ้บฆ",description:d??"่ฏท็จๅ€™๏ผŒ้บฆ้บฆๆญฃๅœจ้‡ๅฏไธญ...",tip:"๐Ÿ”„ ้…็ฝฎๅทฒไฟๅญ˜๏ผŒๆญฃๅœจ้‡ๅฏไธป็จ‹ๅบ..."},checking:{icon:e.jsx(Fs,{className:"h-16 w-16 text-primary animate-spin"}),title:"ๆฃ€ๆŸฅๆœๅŠก็Šถๆ€",description:`็ญ‰ๅพ…ๆœๅŠกๆขๅค... (${l}/${r})`,tip:"โณ ๆญฃๅœจ็ญ‰ๅพ…ๆœๅŠกๆขๅค๏ผŒ่ฏทๅ‹ฟๅ…ณ้—ญ้กต้ข..."},success:{icon:e.jsx(st,{className:"h-16 w-16 text-green-500"}),title:"้‡ๅฏๆˆๅŠŸ",description:"ๆญฃๅœจ่ทณ่ฝฌๅˆฐ็™ปๅฝ•้กต้ข...",tip:"โœ… ้…็ฝฎๅทฒ็”Ÿๆ•ˆ๏ผŒๆœๅŠก่ฟ่กŒๆญฃๅธธ"},failed:{icon:e.jsx(Ut,{className:"h-16 w-16 text-destructive"}),title:"้‡ๅฏ่ถ…ๆ—ถ",description:"ๆœๅŠกๆœช่ƒฝๅœจ้ข„ๆœŸๆ—ถ้—ดๅ†…ๆขๅค",tip:"โš ๏ธ ๅฆ‚ๆžœ้•ฟๆ—ถ้—ดๆ— ๅ“ๅบ”๏ผŒ่ฏทๅฐ่ฏ•ๆ‰‹ๅŠจ้‡ๅฏ"}})[a];function nr({visible:a,onComplete:l,onFailed:r,title:c,description:d,showAnimation:m=!0,className:h}){const f=G_();return(f?f.isRestarting:a)?f?e.jsx(Dv,{state:f.state,onRetry:f.retryHealthCheck,onComplete:l,onFailed:r,title:c,description:d,showAnimation:m,className:h}):e.jsx(Q_,{onComplete:l,onFailed:r,title:c,description:d,showAnimation:m,className:h}):null}function Dv({state:a,onRetry:l,onComplete:r,onFailed:c,title:d,description:m,showAnimation:h,className:f}){const{status:p,progress:g,elapsedTime:N,checkAttempts:j,maxAttempts:b}=a;u.useEffect(()=>{p==="success"&&r?r():p==="failed"&&c&&c()},[p,r,c]);const y=K_(p,j,b,d,m),w=z=>{const M=Math.floor(z/60),S=z%60;return`${M}:${S.toString().padStart(2,"0")}`};return e.jsxs("div",{className:P("fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center",f),children:[h&&e.jsx(Y_,{}),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:[y.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:y.title}),e.jsx("p",{className:"text-muted-foreground text-center",children:y.description})]}),p!=="failed"&&p!=="idle"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(tr,{value:g,className:"h-2"}),e.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[e.jsxs("span",{children:[g,"%"]}),e.jsxs("span",{children:["ๅทฒ็”จๆ—ถ: ",w(N)]})]})]}),e.jsx("div",{className:"bg-muted/50 rounded-lg p-4",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:y.tip})}),p==="failed"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(_,{onClick:()=>window.location.reload(),variant:"default",className:"flex-1",children:[e.jsx(dt,{className:"mr-2 h-4 w-4"}),"ๅˆทๆ–ฐ้กต้ข"]}),e.jsxs(_,{onClick:l,variant:"secondary",className:"flex-1",children:[e.jsx(rc,{className:"mr-2 h-4 w-4"}),"้‡่ฏ•ๆฃ€ๆต‹"]})]})]})]})}function Q_({onComplete:a,onFailed:l,title:r,description:c,showAnimation:d,className:m}){const[h,f]=u.useState({status:"restarting",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:60}),p=u.useCallback(()=>{let g=0;const N=60,j=async()=>{g++,f(b=>({...b,status:"checking",checkAttempts:g}));try{if((await fetch("/api/webui/system/status",{method:"GET",signal:AbortSignal.timeout(3e3)})).ok){f(y=>({...y,status:"success",progress:100})),setTimeout(()=>{a?.(),window.location.href="/auth"},1500);return}}catch{}g>=N?(f(b=>({...b,status:"failed"})),l?.()):setTimeout(j,2e3)};j()},[a,l]);return u.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),j=setTimeout(()=>{p()},3e3);return()=>{clearInterval(g),clearInterval(N),clearTimeout(j)}},[p]),e.jsx(Dv,{state:h,onRetry:p,onComplete:a,onFailed:l,title:r,description:c,showAnimation:d,className:m})}function Y_(){return e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsxs("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[600px] h-[600px]",children:[e.jsx("div",{className:"absolute inset-0 rounded-full border border-primary/10 animate-[ping_3s_ease-in-out_infinite]"}),e.jsx("div",{className:"absolute inset-8 rounded-full border border-primary/10 animate-[ping_3s_ease-in-out_infinite_0.5s]"}),e.jsx("div",{className:"absolute inset-16 rounded-full border border-primary/10 animate-[ping_3s_ease-in-out_infinite_1s]"})]}),e.jsx("div",{className:"absolute top-1/4 left-1/4 w-2 h-2 bg-primary/20 rounded-full animate-bounce"}),e.jsx("div",{className:"absolute top-3/4 right-1/4 w-3 h-3 bg-primary/15 rounded-full animate-bounce delay-150"}),e.jsx("div",{className:"absolute top-1/2 right-1/3 w-2 h-2 bg-primary/20 rounded-full animate-bounce delay-300"})]})}const Qs=i1,dd=c1,J_=n1,Ov=u.forwardRef(({className:a,...l},r)=>e.jsx(Bj,{ref:r,className:P("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),...l}));Ov.displayName=Bj.displayName;const Hs=u.forwardRef(({className:a,children:l,preventOutsideClose:r=!1,hideCloseButton:c=!1,...d},m)=>e.jsxs(J_,{children:[e.jsx(Ov,{}),e.jsxs(Ij,{ref:m,className:P("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",a),onPointerDownOutside:r?h=>h.preventDefault():void 0,onInteractOutside:r?h=>h.preventDefault():void 0,...d,children:[l,!c&&e.jsxs(r1,{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(Sa,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Hs.displayName=Ij.displayName;const qs=({className:a,...l})=>e.jsx("div",{className:P("flex flex-col space-y-1.5 text-center sm:text-left",a),...l});qs.displayName="DialogHeader";const gt=({className:a,...l})=>e.jsx("div",{className:P("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",a),...l});gt.displayName="DialogFooter";const Vs=u.forwardRef(({className:a,...l},r)=>e.jsx(Pj,{ref:r,className:P("text-lg font-semibold leading-none tracking-tight",a),...l}));Vs.displayName=Pj.displayName;const at=u.forwardRef(({className:a,...l},r)=>e.jsx(Fj,{ref:r,className:P("text-sm text-muted-foreground",a),...l}));at.displayName=Fj.displayName;const ne=u.forwardRef(({className:a,type:l,...r},c)=>e.jsx("input",{type:l,className:P("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",a),ref:c,...r}));ne.displayName="Input";const tt=u.forwardRef(({className:a,...l},r)=>e.jsx(Hj,{ref:r,className:P("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",a),...l,children:e.jsx(o1,{className:P("grid place-content-center text-current"),children:e.jsx(Ot,{className:"h-4 w-4"})})}));tt.displayName=Hj.displayName;const Pe=f1,Fe=p1,Be=u.forwardRef(({className:a,children:l,...r},c)=>e.jsxs(qj,{ref:c,className:P("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",a),...r,children:[l,e.jsx(d1,{asChild:!0,children:e.jsx(Ba,{className:"h-4 w-4 opacity-50"})})]}));Be.displayName=qj.displayName;const Lv=u.forwardRef(({className:a,...l},r)=>e.jsx(Vj,{ref:r,className:P("flex cursor-default items-center justify-center py-1",a),...l,children:e.jsx(Xr,{className:"h-4 w-4"})}));Lv.displayName=Vj.displayName;const Uv=u.forwardRef(({className:a,...l},r)=>e.jsx(Gj,{ref:r,className:P("flex cursor-default items-center justify-center py-1",a),...l,children:e.jsx(Ba,{className:"h-4 w-4"})}));Uv.displayName=Gj.displayName;const Ie=u.forwardRef(({className:a,children:l,position:r="popper",...c},d)=>e.jsx(u1,{children:e.jsxs(Kj,{ref:d,className:P("relative z-[100] max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-hidden rounded-md border border-border bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",a),position:r,...c,children:[e.jsx(Lv,{}),e.jsx(m1,{className:P("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:l}),e.jsx(Uv,{})]})}));Ie.displayName=Kj.displayName;const X_=u.forwardRef(({className:a,...l},r)=>e.jsx(Qj,{ref:r,className:P("px-2 py-1.5 text-sm font-semibold",a),...l}));X_.displayName=Qj.displayName;const W=u.forwardRef(({className:a,children:l,...r},c)=>e.jsxs(Yj,{ref:c,className:P("relative flex w-full cursor-default select-none items-center rounded-sm py-2 pl-2 pr-8 text-sm outline-none bg-white dark:bg-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 focus:bg-gray-100 dark:focus:bg-gray-800 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),...r,children:[e.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(x1,{children:e.jsx(Ot,{className:"h-4 w-4"})})}),e.jsx(h1,{children:l})]}));W.displayName=Yj.displayName;const Z_=u.forwardRef(({className:a,...l},r)=>e.jsx(Jj,{ref:r,className:P("-mx-1 my-1 h-px bg-muted",a),...l}));Z_.displayName=Jj.displayName;const fx=({className:a,...l})=>e.jsx("nav",{role:"navigation","aria-label":"pagination",className:P("mx-auto flex w-full justify-center",a),...l});fx.displayName="Pagination";const px=u.forwardRef(({className:a,...l},r)=>e.jsx("ul",{ref:r,className:P("flex flex-row items-center gap-1",a),...l}));px.displayName="PaginationContent";const Xn=u.forwardRef(({className:a,...l},r)=>e.jsx("li",{ref:r,className:P("",a),...l}));Xn.displayName="PaginationItem";const jc=({className:a,isActive:l,size:r="icon",...c})=>e.jsx("a",{"aria-current":l?"page":void 0,className:P(si({variant:l?"outline":"ghost",size:r}),a),...c});jc.displayName="PaginationLink";const $v=({className:a,...l})=>e.jsxs(jc,{"aria-label":"Go to previous page",size:"default",className:P("gap-1 pl-2.5",a),...l,children:[e.jsx(Pa,{className:"h-4 w-4"}),e.jsx("span",{children:"ไธŠไธ€้กต"})]});$v.displayName="PaginationPrevious";const Bv=({className:a,...l})=>e.jsxs(jc,{"aria-label":"Go to next page",size:"default",className:P("gap-1 pr-2.5",a),...l,children:[e.jsx("span",{children:"ไธ‹ไธ€้กต"}),e.jsx(ra,{className:"h-4 w-4"})]});Bv.displayName="PaginationNext";const Iv=({className:a,...l})=>e.jsxs("span",{"aria-hidden":!0,className:P("flex h-9 w-9 items-center justify-center",a),...l,children:[e.jsx(C1,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"More pages"})]});Iv.displayName="PaginationEllipsis";const W_=5,e2=5e3;let Lm=0;function s2(){return Lm=(Lm+1)%Number.MAX_SAFE_INTEGER,Lm.toString()}const Um=new Map,Ug=a=>{if(Um.has(a))return;const l=setTimeout(()=>{Um.delete(a),ac({type:"REMOVE_TOAST",toastId:a})},e2);Um.set(a,l)},t2=(a,l)=>{switch(l.type){case"ADD_TOAST":return{...a,toasts:[l.toast,...a.toasts].slice(0,W_)};case"UPDATE_TOAST":return{...a,toasts:a.toasts.map(r=>r.id===l.toast.id?{...r,...l.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=l;return r?Ug(r):a.toasts.forEach(c=>{Ug(c.id)}),{...a,toasts:a.toasts.map(c=>c.id===r||r===void 0?{...c,open:!1}:c)}}case"REMOVE_TOAST":return l.toastId===void 0?{...a,toasts:[]}:{...a,toasts:a.toasts.filter(r=>r.id!==l.toastId)}}},Fo=[];let Ho={toasts:[]};function ac(a){Ho=t2(Ho,a),Fo.forEach(l=>{l(Ho)})}function aa({...a}){const l=s2(),r=d=>ac({type:"UPDATE_TOAST",toast:{...d,id:l}}),c=()=>ac({type:"DISMISS_TOAST",toastId:l});return ac({type:"ADD_TOAST",toast:{...a,id:l,open:!0,onOpenChange:d=>{d||c()}}}),{id:l,dismiss:c,update:r}}function nt(){const[a,l]=u.useState(Ho);return u.useEffect(()=>(Fo.push(l),()=>{const r=Fo.indexOf(l);r>-1&&Fo.splice(r,1)}),[a]),{...a,toast:aa,dismiss:r=>ac({type:"DISMISS_TOAST",toastId:r})}}const dl="/api/webui/expression";async function gx(){const a=await ke(`${dl}/chats`,{});if(!a.ok){const l=await a.json();throw new Error(l.detail||"่Žทๅ–่Šๅคฉๅˆ—่กจๅคฑ่ดฅ")}return a.json()}async function a2(a){const l=new URLSearchParams;a.page&&l.append("page",a.page.toString()),a.page_size&&l.append("page_size",a.page_size.toString()),a.search&&l.append("search",a.search),a.chat_id&&l.append("chat_id",a.chat_id);const r=await ke(`${dl}/list?${l}`,{});if(!r.ok){const c=await r.json();throw new Error(c.detail||"่Žทๅ–่กจ่พพๆ–นๅผๅˆ—่กจๅคฑ่ดฅ")}return r.json()}async function l2(a){const l=await ke(`${dl}/${a}`,{});if(!l.ok){const r=await l.json();throw new Error(r.detail||"่Žทๅ–่กจ่พพๆ–นๅผ่ฏฆๆƒ…ๅคฑ่ดฅ")}return l.json()}async function n2(a){const l=await ke(`${dl}/`,{method:"POST",body:JSON.stringify(a)});if(!l.ok){const r=await l.json();throw new Error(r.detail||"ๅˆ›ๅปบ่กจ่พพๆ–นๅผๅคฑ่ดฅ")}return l.json()}async function r2(a,l){const r=await ke(`${dl}/${a}`,{method:"PATCH",body:JSON.stringify(l)});if(!r.ok){const c=await r.json();throw new Error(c.detail||"ๆ›ดๆ–ฐ่กจ่พพๆ–นๅผๅคฑ่ดฅ")}return r.json()}async function i2(a){const l=await ke(`${dl}/${a}`,{method:"DELETE"});if(!l.ok){const r=await l.json();throw new Error(r.detail||"ๅˆ ้™ค่กจ่พพๆ–นๅผๅคฑ่ดฅ")}return l.json()}async function c2(a){const l=await ke(`${dl}/batch/delete`,{method:"POST",body:JSON.stringify({ids:a})});if(!l.ok){const r=await l.json();throw new Error(r.detail||"ๆ‰น้‡ๅˆ ้™ค่กจ่พพๆ–นๅผๅคฑ่ดฅ")}return l.json()}async function o2(){const a=await ke(`${dl}/stats/summary`,{});if(!a.ok){const l=await a.json();throw new Error(l.detail||"่Žทๅ–็ปŸ่ฎกๆ•ฐๆฎๅคฑ่ดฅ")}return a.json()}async function jx(){const a=await ke(`${dl}/review/stats`);if(!a.ok){const l=await a.json();throw new Error(l.detail||"่Žทๅ–ๅฎกๆ ธ็ปŸ่ฎกๅคฑ่ดฅ")}return a.json()}async function $g(a){const l=new URLSearchParams;a.page&&l.append("page",a.page.toString()),a.page_size&&l.append("page_size",a.page_size.toString()),a.filter_type&&l.append("filter_type",a.filter_type),a.search&&l.append("search",a.search),a.chat_id&&l.append("chat_id",a.chat_id);const r=await ke(`${dl}/review/list?${l}`);if(!r.ok){const c=await r.json();throw new Error(c.detail||"่Žทๅ–ๅฎกๆ ธๅˆ—่กจๅคฑ่ดฅ")}return r.json()}async function $m(a){const l=await ke(`${dl}/review/batch`,{method:"POST",body:JSON.stringify({items:a})});if(!l.ok){const r=await l.json();throw new Error(r.detail||"ๆ‰น้‡ๅฎกๆ ธๅคฑ่ดฅ")}return l.json()}function Pv({open:a,onOpenChange:l}){const[r,c]=u.useState("list"),[d,m]=u.useState(null),[h,f]=u.useState([]),[p,g]=u.useState("unchecked"),[N,j]=u.useState([]),[b,y]=u.useState(0),[w,z]=u.useState(!1),[M,S]=u.useState(0),[F,E]=u.useState(1),[C,R]=u.useState(null),[H,O]=u.useState(0),[X,L]=u.useState(!1),[me,Ne]=u.useState(null),je=u.useRef(null),ce=u.useRef(null),ge=u.useRef(!1),[pe,D]=u.useState(!1),[Q,B]=u.useState(!1),[ue,Y]=u.useState(0),[we,fe]=u.useState(1),[Ee,G]=u.useState(20),[$,A]=u.useState(""),[K,Re]=u.useState("unchecked"),[se,$e]=u.useState(""),[cs,J]=u.useState(""),[Z,Le]=u.useState(new Set),[le,De]=u.useState(new Set),[xe,Me]=u.useState(new Map),{toast:ds}=nt(),Ts=u.useCallback(async()=>{try{B(!0);const U=await jx();m(U)}catch(U){console.error("ๅŠ ่ฝฝ็ปŸ่ฎกๅคฑ่ดฅ:",U)}finally{B(!1)}},[]),Ct=u.useCallback(async()=>{try{D(!0);const U=await $g({page:we,page_size:Ee,filter_type:K,search:se||void 0});f(U.data),Y(U.total)}catch(U){ds({title:"ๅŠ ่ฝฝๅคฑ่ดฅ",description:U instanceof Error?U.message:"ๆ— ๆณ•ๅŠ ่ฝฝๅˆ—่กจ",variant:"destructive"})}finally{D(!1)}},[we,Ee,K,se,ds]),ia=u.useCallback(async()=>{try{const U=await gx();if(U?.data){const Se=new Map;U.data.forEach(as=>{Se.set(as.chat_id,as.chat_name)}),Me(Se)}}catch(U){console.error("ๅŠ ่ฝฝ่Šๅคฉๅ็งฐๅคฑ่ดฅ:",U)}},[]),ut=u.useCallback(async(U=!0,Se=!1)=>{try{z(!0);const as=Se?F+1:F,us=await $g({page:as,page_size:20,filter_type:p});Se?(j(es=>[...es,...us.data]),E(as)):j(us.data),S(us.total),U&&y(0)}catch(as){ds({title:"ๅŠ ่ฝฝๅคฑ่ดฅ",description:as instanceof Error?as.message:"ๆ— ๆณ•ๅŠ ่ฝฝๅˆ—่กจ",variant:"destructive"})}finally{z(!1)}},[F,p,ds]);u.useEffect(()=>{r==="quick"&&(E(1),y(0))},[p,r]),u.useEffect(()=>{a&&r==="quick"&&(ut(),Ts())},[a,r,F,p,ut,Ts]);const Is=u.useCallback(U=>U?p==="unchecked"?{left:!0,right:!0}:p==="passed"?{left:!0,right:!1}:p==="rejected"?{left:!1,right:!0}:U.checked?U.rejected?{left:!1,right:!0}:{left:!0,right:!1}:{left:!0,right:!0}:{left:!1,right:!1},[p]),V=u.useCallback(async U=>{const Se=N[b];if(!Se||X)return;const as=Is(Se);if(!(U&&!as.left||!U&&!as.right)){L(!0),R(U?"left":"right"),O(U?-400:400);try{(await $m([{id:Se.id,rejected:U,require_unchecked:p==="unchecked"}])).results[0]?.success?(ds({title:U?"ๅทฒๆ‹’็ป":"ๅทฒ้€š่ฟ‡",description:`่กจ่พพๆ–นๅผ #${Se.id} ${U?"ๅทฒๆ‹’็ป":"ๅทฒ้€š่ฟ‡"}`}),setTimeout(()=>{j(es=>es.filter((Tt,$s)=>$s!==b)),S(es=>es-1),b>=N.length-1&&y(Math.max(0,b-1)),R(null),O(0),L(!1),Ts(),N.length<=1&&M>1&&ut(!1)},300)):(Ne(Se.id),ds({title:"ๆ•ฐๆฎๅ†ฒ็ช",description:"่ฏฅๆก็›ฎๅทฒ่ขซๅŽๅฐไปปๅŠกๅค„็†๏ผŒๆญฃๅœจๅˆทๆ–ฐๆ•ฐๆฎ...",variant:"destructive"}),setTimeout(()=>{Ne(null),R(null),O(0),L(!1),ut(!1),Ts()},1500))}catch(us){ds({title:"ๆ“ไฝœๅคฑ่ดฅ",description:us instanceof Error?us.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"}),R(null),O(0),L(!1)}}},[N,b,X,Is,p,ds,Ts,M,ut]),Ke=u.useCallback((U,Se)=>{X||(ce.current={x:U,y:Se},ge.current=!1)},[X]),He=u.useCallback(U=>{X||(L(!0),O(U==="left"?-30:30),setTimeout(()=>{O(0),setTimeout(()=>L(!1),300)},150))},[X]),Je=u.useCallback(U=>{if(!ce.current||X)return;const Se=U-ce.current.x,as=N[b],us=Is(as);if(Se<0&&!us.left){O(Se*.2),R(null);return}if(Se>0&&!us.right){O(Se*.2),R(null);return}ge.current=!0,O(Se),Math.abs(Se)>50?R(Se>0?"right":"left"):R(null)},[N,b,Is,X]),Es=u.useCallback(()=>{if(!ce.current)return;Math.abs(H)>100&&C?V(C==="left"):(O(0),R(null)),ce.current=null,ge.current=!1},[H,C,V]),ms=u.useCallback(U=>{Ke(U.clientX,U.clientY)},[Ke]),Ms=u.useCallback(U=>{ce.current&&(U.preventDefault(),Je(U.clientX))},[Je]),We=u.useCallback(()=>{Es()},[Es]),Cs=u.useCallback(()=>{ce.current&&Es()},[Es]),rs=u.useCallback(U=>{const Se=U.touches[0];Ke(Se.clientX,Se.clientY)},[Ke]),is=u.useCallback(U=>{const Se=U.touches[0];Je(Se.clientX)},[Je]),ys=u.useCallback(()=>{Es()},[Es]);u.useEffect(()=>{if(!a||r!=="quick")return;const U=Se=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(Se.key)||(Se.preventDefault(),Se.stopPropagation(),Se.stopImmediatePropagation(),X||w))return;const as=N[b],us=Is(as);Se.key==="ArrowLeft"?us.left?V(!0):He("left"):Se.key==="ArrowRight"?us.right?V(!1):He("right"):Se.key==="ArrowDown"?bes+1):Se.key==="ArrowUp"&&b>0&&y(es=>es-1)};return window.addEventListener("keydown",U,!0),()=>window.removeEventListener("keydown",U,!0)},[a,r,N,b,X,w,Is,V,He]),u.useEffect(()=>{if(!a||r!=="quick"||w)return;const U=N.length-b-1,Se=N.length{a&&(Ts(),Ct(),ia())},[a,Ts,Ct,ia]),u.useEffect(()=>{fe(1),Le(new Set)},[K,se]),u.useEffect(()=>{Le(new Set)},[h]);const rt=()=>{$e(cs),fe(1)},jt=U=>xe.get(U)||U,Ae=async(U,Se)=>{try{De(us=>new Set(us).add(U));const as=await $m([{id:U,rejected:Se,require_unchecked:K==="unchecked"}]);as.results[0]?.success?(ds({title:Se?"ๅทฒๆ‹’็ป":"ๅทฒ้€š่ฟ‡",description:`่กจ่พพๆ–นๅผ #${U} ${Se?"ๅทฒๆ‹’็ป":"ๅทฒ้€š่ฟ‡"}`}),Ct(),Ts()):ds({title:"ๆ“ไฝœๅคฑ่ดฅ",description:as.results[0]?.message||"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}catch(as){ds({title:"ๆ“ไฝœๅคฑ่ดฅ",description:as instanceof Error?as.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}finally{De(as=>{const us=new Set(as);return us.delete(U),us})}},Qe=async U=>{if(Z.size===0){ds({title:"่ฏท้€‰ๆ‹ฉ",description:"่ฏทๅ…ˆ้€‰ๆ‹ฉ่ฆๅฎกๆ ธ็š„่กจ่พพๆ–นๅผ",variant:"destructive"});return}try{D(!0);const Se=Array.from(Z).map(us=>({id:us,rejected:U,require_unchecked:K==="unchecked"})),as=await $m(Se);ds({title:"ๆ‰น้‡ๅฎกๆ ธๅฎŒๆˆ",description:`ๆˆๅŠŸ ${as.succeeded} ๆก๏ผŒๅคฑ่ดฅ ${as.failed} ๆก`,variant:as.failed>0?"destructive":"default"}),Le(new Set),Ct(),Ts()}catch(Se){ds({title:"ๆ‰น้‡ๅฎกๆ ธๅคฑ่ดฅ",description:Se instanceof Error?Se.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}finally{D(!1)}},As=()=>{Z.size===h.length?Le(new Set):Le(new Set(h.map(U=>U.id)))},mt=U=>{Le(Se=>{const as=new Set(Se);return as.has(U)?as.delete(U):as.add(U),as})},Ht=U=>U?new Date(U*1e3).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"-",ca=U=>U.checked?U.rejected?e.jsxs(Ce,{variant:"destructive",className:"gap-1",children:[e.jsx(ta,{className:"h-3 w-3"}),"ๅทฒๆ‹’็ป"]}):e.jsxs(Ce,{variant:"default",className:"gap-1 bg-green-600",children:[e.jsx(st,{className:"h-3 w-3"}),"ๅทฒ้€š่ฟ‡"]}):e.jsxs(Ce,{variant:"outline",className:"gap-1",children:[e.jsx(da,{className:"h-3 w-3"}),"ๅพ…ๅฎกๆ ธ"]}),Fa=U=>U?U==="ai"?e.jsxs(Ce,{variant:"secondary",className:"gap-1 text-xs",children:[e.jsx(Yn,{className:"h-3 w-3"}),"AI"]}):e.jsxs(Ce,{variant:"secondary",className:"gap-1 text-xs",children:[e.jsx(Fl,{className:"h-3 w-3"}),"ไบบๅทฅ"]}):null,Xt=Math.ceil(ue/Ee),te=()=>{const U=[];if(Xt<=7)for(let Se=1;Se<=Xt;Se++)U.push(Se);else{U.push(1),we>3&&U.push("ellipsis");const Se=Math.max(2,we-1),as=Math.min(Xt-1,we+1);for(let us=Se;us<=as;us++)U.push(us);we1&&U.push(Xt)}return U},_e=()=>{const U=parseInt($,10);!isNaN(U)&&U>=1&&U<=Xt&&(fe(U),A(""))};return e.jsx(Qs,{open:a,onOpenChange:l,children:e.jsxs(Hs,{className:"max-w-5xl w-[95vw] sm:w-full h-[90vh] sm:h-[85vh] flex flex-col p-0",hideCloseButton:!0,children:[e.jsxs("div",{className:"flex items-end bg-muted/30 px-2 pt-2 shrink-0",children:[e.jsxs("button",{onClick:()=>c("list"),className:P("group relative flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-t-lg transition-all","hover:bg-background/50",r==="list"?"bg-background text-foreground shadow-sm border border-b-0 border-border":"text-muted-foreground hover:text-foreground"),children:[e.jsx(rv,{className:"h-4 w-4"}),e.jsx("span",{children:"ๅˆ—่กจๆจกๅผ"}),r==="list"&&e.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-background"})]}),e.jsxs("button",{onClick:()=>c("quick"),className:P("group relative flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-t-lg transition-all","hover:bg-background/50",r==="quick"?"bg-background text-foreground shadow-sm border border-b-0 border-border":"text-muted-foreground hover:text-foreground"),children:[e.jsx(sl,{className:"h-4 w-4"}),e.jsx("span",{children:"ๅฟซ้€Ÿๅฎกๆ ธ"}),e.jsx(Ce,{variant:"secondary",className:"ml-1 h-5 px-1.5 text-xs",children:"ๆ–ฐ"}),r==="quick"&&e.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-background"})]}),e.jsx("div",{className:"flex-1 border-b border-border"}),e.jsx("button",{onClick:()=>l(!1),className:"mb-[1px] p-2 text-muted-foreground hover:text-foreground hover:bg-muted rounded-lg transition-colors",children:e.jsx(Sa,{className:"h-4 w-4"})})]}),r==="list"&&e.jsxs(e.Fragment,{children:[e.jsxs(qs,{className:"px-4 sm:px-6 pt-4 sm:pt-6 pb-4 border-b shrink-0",children:[e.jsx(Vs,{className:"text-lg sm:text-xl",children:"่กจ่พพๆ–นๅผๅฎกๆ ธ"}),e.jsx(at,{className:"text-xs sm:text-sm",children:"ๅฎกๆ ธ้บฆ้บฆๅญฆไน ๅˆฐ็š„่กจ่พพๆ–นๅผใ€‚้€š่ฟ‡ๅฎกๆ ธ็š„้กน็›ฎๆ‰ไผš่ขซไฝฟ็”จ๏ผˆๅฏๅœจ้…็ฝฎไธญ่ฐƒๆ•ด๏ผ‰๏ผŒ่ขซๆ‹’็ป็š„้กน็›ฎๆฐธ่ฟœไธไผš่ขซไฝฟ็”จใ€‚"}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 sm:gap-3 mt-4",children:[e.jsxs("div",{className:"rounded-lg border p-2 sm:p-3 text-center",children:[e.jsx("div",{className:"text-xl sm:text-2xl font-bold text-orange-500",children:Q?"-":d?.unchecked??0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"ๅพ…ๅฎกๆ ธ"})]}),e.jsxs("div",{className:"rounded-lg border p-2 sm:p-3 text-center",children:[e.jsx("div",{className:"text-xl sm:text-2xl font-bold text-green-500",children:Q?"-":d?.passed??0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"ๅทฒ้€š่ฟ‡"})]}),e.jsxs("div",{className:"rounded-lg border p-2 sm:p-3 text-center",children:[e.jsx("div",{className:"text-xl sm:text-2xl font-bold text-red-500",children:Q?"-":d?.rejected??0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"ๅทฒๆ‹’็ป"})]}),e.jsxs("div",{className:"rounded-lg border p-2 sm:p-3 text-center",children:[e.jsx("div",{className:"text-xl sm:text-2xl font-bold text-blue-500",children:Q?"-":d?.total??0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"ๆ€ป่ฎก"})]})]})]}),e.jsxs("div",{className:"px-4 sm:px-6 py-3 border-b shrink-0 space-y-3",children:[e.jsx(Jt,{value:K,onValueChange:U=>Re(U),className:"w-full",children:e.jsxs(Gt,{className:"grid w-full grid-cols-4",children:[e.jsxs(Xe,{value:"unchecked",className:"gap-1 text-xs sm:text-sm px-1 sm:px-3",children:[e.jsx(da,{className:"h-3 w-3 sm:h-4 sm:w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"ๅพ…ๅฎกๆ ธ"}),e.jsx("span",{className:"sm:hidden",children:"ๅพ…ๅฎก"}),e.jsxs("span",{className:"hidden sm:inline",children:["(",d?.unchecked??0,")"]})]}),e.jsxs(Xe,{value:"passed",className:"gap-1 text-xs sm:text-sm px-1 sm:px-3",children:[e.jsx(st,{className:"h-3 w-3 sm:h-4 sm:w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"ๅทฒ้€š่ฟ‡"}),e.jsx("span",{className:"sm:hidden",children:"้€š่ฟ‡"}),e.jsxs("span",{className:"hidden sm:inline",children:["(",d?.passed??0,")"]})]}),e.jsxs(Xe,{value:"rejected",className:"gap-1 text-xs sm:text-sm px-1 sm:px-3",children:[e.jsx(ta,{className:"h-3 w-3 sm:h-4 sm:w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"ๅทฒๆ‹’็ป"}),e.jsx("span",{className:"sm:hidden",children:"ๆ‹’็ป"}),e.jsxs("span",{className:"hidden sm:inline",children:["(",d?.rejected??0,")"]})]}),e.jsxs(Xe,{value:"all",className:"gap-1 text-xs sm:text-sm px-1 sm:px-3",children:[e.jsx("span",{children:"ๅ…จ้ƒจ"}),e.jsxs("span",{className:"hidden sm:inline",children:["(",d?.total??0,")"]})]})]})}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx($t,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ne,{placeholder:"ๆœ็ดขๆƒ…ๆ™ฏๆˆ–้ฃŽๆ ผ...",value:cs,onChange:U=>J(U.target.value),onKeyDown:U=>U.key==="Enter"&&rt(),className:"pl-9"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"icon",onClick:rt,children:e.jsx($t,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"icon",onClick:()=>{Ct(),Ts()},disabled:pe,children:e.jsx(dt,{className:P("h-4 w-4",pe&&"animate-spin")})})]}),Z.size>0&&e.jsx("div",{className:"flex items-center gap-2 w-full sm:w-auto",children:K==="unchecked"?e.jsxs(e.Fragment,{children:[e.jsxs(_,{variant:"default",size:"sm",className:"bg-green-600 hover:bg-green-700 flex-1 sm:flex-none",onClick:()=>Qe(!1),disabled:pe,children:[e.jsx(st,{className:"h-4 w-4 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"ๆ‰น้‡้€š่ฟ‡"}),e.jsx("span",{className:"sm:hidden",children:"้€š่ฟ‡"}),"(",Z.size,")"]}),e.jsxs(_,{variant:"destructive",size:"sm",className:"flex-1 sm:flex-none",onClick:()=>Qe(!0),disabled:pe,children:[e.jsx(ta,{className:"h-4 w-4 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"ๆ‰น้‡ๆ‹’็ป"}),e.jsx("span",{className:"sm:hidden",children:"ๆ‹’็ป"}),"(",Z.size,")"]})]}):K==="passed"?e.jsxs(_,{variant:"destructive",size:"sm",className:"flex-1 sm:flex-none",onClick:()=>Qe(!0),disabled:pe,children:[e.jsx(ta,{className:"h-4 w-4 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"ๆ‰น้‡ๆ”นไธบๆ‹’็ป"}),e.jsx("span",{className:"sm:hidden",children:"ๆ”นไธบๆ‹’็ป"}),"(",Z.size,")"]}):K==="rejected"?e.jsxs(_,{variant:"default",size:"sm",className:"bg-green-600 hover:bg-green-700 flex-1 sm:flex-none",onClick:()=>Qe(!1),disabled:pe,children:[e.jsx(st,{className:"h-4 w-4 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"ๆ‰น้‡ๆ”นไธบ้€š่ฟ‡"}),e.jsx("span",{className:"sm:hidden",children:"ๆ”นไธบ้€š่ฟ‡"}),"(",Z.size,")"]}):e.jsxs(e.Fragment,{children:[e.jsxs(_,{variant:"default",size:"sm",className:"bg-green-600 hover:bg-green-700 flex-1 sm:flex-none",onClick:()=>Qe(!1),disabled:pe,children:[e.jsx(st,{className:"h-4 w-4 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"ๆ‰น้‡้€š่ฟ‡"}),e.jsx("span",{className:"sm:hidden",children:"้€š่ฟ‡"}),"(",Z.size,")"]}),e.jsxs(_,{variant:"destructive",size:"sm",className:"flex-1 sm:flex-none",onClick:()=>Qe(!0),disabled:pe,children:[e.jsx(ta,{className:"h-4 w-4 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"ๆ‰น้‡ๆ‹’็ป"}),e.jsx("span",{className:"sm:hidden",children:"ๆ‹’็ป"}),"(",Z.size,")"]})]})})]})]}),e.jsx(ts,{className:"flex-1 px-4 sm:px-6",children:pe&&h.length===0?e.jsx("div",{className:"flex items-center justify-center h-40",children:e.jsx(dt,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):h.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-40 text-muted-foreground",children:[e.jsx(Ut,{className:"h-8 w-8 mb-2"}),e.jsx("p",{children:"ๆฒกๆœ‰ๆ‰พๅˆฐ่กจ่พพๆ–นๅผ"})]}):e.jsxs("div",{className:"space-y-2 py-2",children:[h.length>0&&e.jsxs("div",{className:"flex items-center justify-between py-2 px-3 rounded-lg bg-muted/50",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(tt,{checked:Z.size===h.length&&h.length>0,onCheckedChange:As}),e.jsx("span",{className:"text-sm text-muted-foreground",children:Z.size===h.length&&h.length>0?`ๅทฒๅ…จ้€‰ๅฝ“ๅ‰้กต (${h.length} ๆก)`:`ๅ…จ้€‰ๅฝ“ๅ‰้กต (${h.length} ๆก)`})]}),Z.size>0&&e.jsx(_,{variant:"ghost",size:"sm",onClick:()=>Le(new Set),className:"h-7 text-xs",children:"ๅ–ๆถˆ้€‰ๆ‹ฉ"})]}),h.map(U=>e.jsx("div",{className:P("rounded-lg border p-3 sm:p-4 space-y-2 sm:space-y-3 transition-colors",Z.has(U.id)&&"bg-accent border-primary",le.has(U.id)&&"opacity-50"),children:e.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[e.jsx(tt,{checked:Z.has(U.id),onCheckedChange:()=>mt(U.id),disabled:le.has(U.id),className:"mt-1"}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"ๆƒ…ๆ™ฏ๏ผš"}),e.jsx("p",{className:"text-sm font-medium break-words",children:U.situation})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"้ฃŽๆ ผ๏ผš"}),e.jsx("p",{className:"text-sm text-muted-foreground break-words",children:U.style})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1 sm:gap-2 text-xs text-muted-foreground",children:[e.jsxs("span",{children:["#",U.id]}),e.jsx("span",{children:"ยท"}),e.jsx("span",{title:jt(U.chat_id),className:"truncate max-w-24 sm:max-w-32",children:jt(U.chat_id)}),e.jsx("span",{children:"ยท"}),e.jsx("span",{children:Ht(U.create_date)}),e.jsxs("div",{className:"flex items-center gap-1",children:[ca(U),Fa(U.modified_by)]})]})]}),e.jsx("div",{className:"flex flex-col gap-1 sm:gap-2 shrink-0",children:K==="unchecked"?e.jsxs(e.Fragment,{children:[e.jsxs(_,{size:"sm",variant:"outline",className:"text-green-600 hover:text-green-700 hover:bg-green-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>Ae(U.id,!1),disabled:le.has(U.id),children:[e.jsx(st,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"้€š่ฟ‡"})]}),e.jsxs(_,{size:"sm",variant:"outline",className:"text-red-600 hover:text-red-700 hover:bg-red-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>Ae(U.id,!0),disabled:le.has(U.id),children:[e.jsx(ta,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"ๆ‹’็ป"})]})]}):K==="passed"?e.jsxs(_,{size:"sm",variant:"outline",className:"text-red-600 hover:text-red-700 hover:bg-red-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>Ae(U.id,!0),disabled:le.has(U.id),children:[e.jsx(ta,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"ๆ”นไธบๆ‹’็ป"})]}):K==="rejected"?e.jsxs(_,{size:"sm",variant:"outline",className:"text-green-600 hover:text-green-700 hover:bg-green-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>Ae(U.id,!1),disabled:le.has(U.id),children:[e.jsx(st,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"ๆ”นไธบ้€š่ฟ‡"})]}):e.jsx(e.Fragment,{children:U.rejected?e.jsxs(_,{size:"sm",variant:"outline",className:"text-green-600 hover:text-green-700 hover:bg-green-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>Ae(U.id,!1),disabled:le.has(U.id),children:[e.jsx(st,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"ๆ”นไธบ้€š่ฟ‡"})]}):U.checked?e.jsxs(_,{size:"sm",variant:"outline",className:"text-red-600 hover:text-red-700 hover:bg-red-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>Ae(U.id,!0),disabled:le.has(U.id),children:[e.jsx(ta,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"ๆ”นไธบๆ‹’็ป"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(_,{size:"sm",variant:"outline",className:"text-green-600 hover:text-green-700 hover:bg-green-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>Ae(U.id,!1),disabled:le.has(U.id),children:[e.jsx(st,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"้€š่ฟ‡"})]}),e.jsxs(_,{size:"sm",variant:"outline",className:"text-red-600 hover:text-red-700 hover:bg-red-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>Ae(U.id,!0),disabled:le.has(U.id),children:[e.jsx(ta,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"ๆ‹’็ป"})]})]})})})]})},U.id))]})}),e.jsxs("div",{className:"px-4 sm:px-6 py-3 border-t shrink-0 flex flex-col sm:flex-row items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx("span",{className:"hidden sm:inline",children:"ๆฏ้กต"}),e.jsxs(Pe,{value:Ee.toString(),onValueChange:U=>{G(parseInt(U,10)),fe(1)},children:[e.jsx(Be,{className:"w-[70px] h-8",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"10",children:"10"}),e.jsx(W,{value:"20",children:"20"}),e.jsx(W,{value:"50",children:"50"}),e.jsx(W,{value:"100",children:"100"})]})]}),e.jsx("span",{className:"hidden sm:inline",children:"ๆก"}),e.jsxs("span",{className:"text-muted-foreground",children:["ๅ…ฑ ",ue," ๆก"]})]}),e.jsx(fx,{className:"mx-0 w-auto",children:e.jsxs(px,{children:[e.jsx(Xn,{children:e.jsx(_,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>fe(U=>Math.max(1,U-1)),disabled:we<=1||pe,children:e.jsx(Pa,{className:"h-4 w-4"})})}),te().map((U,Se)=>e.jsx(Xn,{children:U==="ellipsis"?e.jsx(Iv,{}):e.jsx(jc,{href:"#",isActive:U===we,onClick:as=>{as.preventDefault(),fe(U)},className:"h-8 w-8 cursor-pointer",children:U})},Se)),e.jsx(Xn,{children:e.jsx(_,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>fe(U=>Math.min(Xt,U+1)),disabled:we>=Xt||pe,children:e.jsx(ra,{className:"h-4 w-4"})})})]})}),e.jsxs("div",{className:"hidden sm:flex items-center gap-2 text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"่ทณ่‡ณ"}),e.jsx(ne,{type:"number",min:1,max:Xt,value:$,onChange:U=>A(U.target.value),onKeyDown:U=>U.key==="Enter"&&_e(),className:"w-16 h-8 text-center",placeholder:we.toString()}),e.jsx("span",{className:"text-muted-foreground",children:"้กต"}),e.jsx(_,{variant:"outline",size:"sm",className:"h-8",onClick:_e,disabled:pe,children:"่ทณ่ฝฌ"})]})]})]}),r==="quick"&&e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"px-4 sm:px-6 py-3 border-b shrink-0 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("span",{className:"text-muted-foreground",children:["ๅพ…ๅฎกๆ ธ: ",e.jsx("span",{className:"font-medium text-orange-500",children:d?.unchecked??0})]}),e.jsxs("span",{className:"text-muted-foreground",children:["ๅทฒ้€š่ฟ‡: ",e.jsx("span",{className:"font-medium text-green-500",children:d?.passed??0})]}),e.jsxs("span",{className:"text-muted-foreground",children:["ๅทฒๆ‹’็ป: ",e.jsx("span",{className:"font-medium text-red-500",children:d?.rejected??0})]})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>{ut(),Ts()},disabled:w,children:[e.jsx(dt,{className:P("h-4 w-4 mr-1",w&&"animate-spin")}),"ๅˆทๆ–ฐ"]})]}),e.jsx(Jt,{value:p,onValueChange:U=>g(U),className:"w-full",children:e.jsxs(Gt,{className:"grid w-full grid-cols-4",children:[e.jsxs(Xe,{value:"unchecked",className:"gap-1 text-xs sm:text-sm",children:[e.jsx(da,{className:"h-3 w-3 sm:h-4 sm:w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"ๅพ…ๅฎกๆ ธ"}),e.jsx("span",{className:"sm:hidden",children:"ๅพ…ๅฎก"})]}),e.jsxs(Xe,{value:"passed",className:"gap-1 text-xs sm:text-sm",children:[e.jsx(st,{className:"h-3 w-3 sm:h-4 sm:w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"ๅทฒ้€š่ฟ‡"}),e.jsx("span",{className:"sm:hidden",children:"้€š่ฟ‡"})]}),e.jsxs(Xe,{value:"rejected",className:"gap-1 text-xs sm:text-sm",children:[e.jsx(ta,{className:"h-3 w-3 sm:h-4 sm:w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"ๅทฒๆ‹’็ป"}),e.jsx("span",{className:"sm:hidden",children:"ๆ‹’็ป"})]}),e.jsx(Xe,{value:"all",className:"gap-1 text-xs sm:text-sm",children:"ๅ…จ้ƒจ"})]})})]}),e.jsx("div",{className:"flex-1 flex flex-col items-center justify-center p-4 sm:p-8 relative overflow-hidden",children:w&&N.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center",children:[e.jsx(dt,{className:"h-8 w-8 animate-spin text-muted-foreground mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"ๅŠ ่ฝฝไธญ..."})]}):N.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center text-center",children:[e.jsx("div",{className:"w-20 h-20 rounded-full bg-muted/50 flex items-center justify-center mb-6",children:e.jsx(st,{className:"h-10 w-10 text-green-500"})}),e.jsx("h3",{className:"text-xl font-semibold mb-2",children:"ๅ…จ้ƒจๅฎกๆ ธๅฎŒๆˆ๏ผ"}),e.jsx("p",{className:"text-muted-foreground",children:"ๅฝ“ๅ‰็ญ›้€‰ๆกไปถไธ‹ๆฒกๆœ‰ๅพ…ๅค„็†็š„้กน็›ฎ"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"absolute top-4 left-1/2 -translate-x-1/2 text-sm text-muted-foreground z-50",children:[b+1," / ",N.length,M>N.length&&e.jsxs("span",{className:"ml-1",children:["๏ผˆๅ…ฑ ",M," ๆก๏ผ‰"]})]}),e.jsx("div",{className:"absolute inset-x-4 top-1/2 -translate-y-1/2 flex justify-between pointer-events-none z-40",children:(()=>{const U=N[b],Se=Is(U);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:P("flex items-center gap-2 px-4 py-2 rounded-lg transition-all duration-300",C==="left"?"bg-red-500/20 text-red-500 scale-110":"bg-muted/50 text-muted-foreground opacity-0",!Se.left&&"invisible"),children:[e.jsx(ta,{className:"h-8 w-8"}),e.jsx("span",{className:"font-bold text-lg hidden sm:inline",children:"ๆ‹’็ป"})]}),e.jsxs("div",{className:P("flex items-center gap-2 px-4 py-2 rounded-lg transition-all duration-300",C==="right"?"bg-green-500/20 text-green-500 scale-110":"bg-muted/50 text-muted-foreground opacity-0",!Se.right&&"invisible"),children:[e.jsx("span",{className:"font-bold text-lg hidden sm:inline",children:"้€š่ฟ‡"}),e.jsx(st,{className:"h-8 w-8"})]})]})})()}),e.jsx("div",{className:"relative w-full max-w-md h-[400px] flex items-center justify-center",children:N.slice(b,b+5).reverse().map((U,Se,as)=>{const us=as.length-1-Se,es=us===0;let Tt={zIndex:5-us,position:"absolute",width:"100%",transition:es&&!ge.current?"all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1)":"none"};if(es)Tt={...Tt,transform:`translateX(${H}px) rotate(${H*.05}deg)`,opacity:Math.max(0,1-Math.abs(H)/500),cursor:"grab"};else{const $s=Math.min(Math.abs(H)/200,1),pa=vt=>{const Ca=vt*7%5,ll=vt*13%7;return{scale:1-vt*.05,translateY:vt*12,rotate:(vt%2===0?1:-1)*(vt*2)+Ca,translateX:(vt%2===0?-1:1)*(vt*4)+ll}},oa=pa(us),ae=pa(us-1),oe=oa.scale+(ae.scale-oa.scale)*$s,qe=oa.translateY+(ae.translateY-oa.translateY)*$s,Ys=oa.rotate+(ae.rotate-oa.rotate)*$s,Ps=oa.translateX+(ae.translateX-oa.translateX)*$s;Tt={...Tt,transform:`translate3d(${Ps}px, ${qe}px, 0) scale(${oe}) rotate(${Ys}deg)`,opacity:1-us*.15,filter:`blur(${Math.max(0,us*1-$s)}px)`,pointerEvents:"none"}}return e.jsxs("div",{ref:es?je:void 0,className:P("bg-card border rounded-xl shadow-xl p-6 select-none h-full flex flex-col",es&&"active:cursor-grabbing shadow-2xl ring-1 ring-border/50",es&&me===U.id&&"ring-4 ring-orange-500/50 bg-orange-50/10"),style:Tt,onMouseDown:es?ms:void 0,onMouseMove:es?Ms:void 0,onMouseUp:es?We:void 0,onMouseLeave:es?Cs:void 0,onTouchStart:es?rs:void 0,onTouchMove:es?is:void 0,onTouchEnd:es?ys:void 0,children:[es&&me===U.id&&e.jsxs("div",{className:"absolute inset-0 z-50 flex flex-col items-center justify-center bg-background/80 backdrop-blur-sm animate-in fade-in duration-300 rounded-xl",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 bg-orange-500/20 rounded-full animate-ping"}),e.jsx(dt,{className:"relative h-16 w-16 text-orange-500 mb-4 animate-spin duration-1000"})]}),e.jsx("h3",{className:"text-xl font-bold text-foreground animate-in slide-in-from-bottom-2 fade-in duration-500",children:"ๆ•ฐๆฎๅทฒๆ›ดๆ–ฐ"}),e.jsx("p",{className:"text-muted-foreground mt-2 animate-in slide-in-from-bottom-3 fade-in duration-700",children:"ๅŽๅฐไปปๅŠกๅทฒๅค„็†ๆญคๆก็›ฎ"})]}),es&&e.jsx("div",{className:P("absolute inset-0 flex items-center justify-center z-20 pointer-events-none transition-opacity duration-200",H<-10&&!Is(U).left||H>10&&!Is(U).right?"opacity-100":"opacity-0"),children:e.jsx("div",{className:"bg-background/80 backdrop-blur-sm p-4 rounded-full shadow-lg border border-border",children:e.jsx(iv,{className:"h-12 w-12 text-muted-foreground"})})}),e.jsxs("div",{className:"space-y-4 flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm text-muted-foreground font-mono",children:["#",U.id]}),e.jsxs("div",{className:"flex items-center gap-2",children:[ca(U),Fa(U.modified_by)]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"ๆƒ…ๆ™ฏ"}),e.jsx("div",{className:"p-3 bg-muted/30 rounded-lg border border-border/50",children:e.jsx("p",{className:"text-lg font-medium leading-relaxed",children:U.situation})})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"้ฃŽๆ ผ"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:U.style.split(/[,๏ผŒ]/).map(($s,pa)=>e.jsx(Ce,{variant:"secondary",className:"font-normal",children:$s.trim()},pa))})]})]}),e.jsxs("div",{className:"mt-auto pt-4 border-t flex items-center justify-between text-xs text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-6 h-6 rounded-full bg-primary/10 flex items-center justify-center text-primary",children:e.jsx(Fl,{className:"h-3 w-3"})}),e.jsx("span",{title:jt(U.chat_id),className:"truncate max-w-[120px] font-medium",children:jt(U.chat_id)})]}),e.jsx("span",{className:"font-mono",children:Ht(U.create_date)})]})]},U.id)})}),e.jsx("div",{className:"flex items-center gap-8 mt-8 sm:hidden z-50",children:(()=>{const U=N[b],Se=Is(U);return e.jsxs(e.Fragment,{children:[e.jsx(_,{variant:"outline",size:"lg",className:P("w-16 h-16 rounded-full border-2 shadow-lg transition-all active:scale-95",Se.left?"hover:bg-red-50 hover:text-red-600 hover:border-red-200":"opacity-30 cursor-not-allowed"),onClick:()=>Se.left&&V(!0),disabled:!Se.left||X,children:e.jsx(ta,{className:"h-8 w-8"})}),e.jsx(_,{variant:"outline",size:"lg",className:P("w-16 h-16 rounded-full border-2 shadow-lg transition-all active:scale-95",Se.right?"hover:bg-green-50 hover:text-green-600 hover:border-green-200":"opacity-30 cursor-not-allowed"),onClick:()=>Se.right&&V(!1),disabled:!Se.right||X,children:e.jsx(st,{className:"h-8 w-8"})})]})})()})]})}),e.jsxs("div",{className:"hidden sm:flex items-center justify-center gap-6 px-6 py-3 border-t text-xs text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-2 py-1 bg-muted rounded text-xs",children:"โ†"}),e.jsx("span",{children:"ๆ‹’็ป"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-2 py-1 bg-muted rounded text-xs",children:"โ†’"}),e.jsx("span",{children:"้€š่ฟ‡"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-2 py-1 bg-muted rounded text-xs",children:"โ†‘"}),e.jsx("span",{children:"ไธŠไธ€ๆก"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-2 py-1 bg-muted rounded text-xs",children:"โ†“"}),e.jsx("span",{children:"ไธ‹ไธ€ๆก"})]}),e.jsx("span",{className:"text-muted-foreground/50",children:"|"}),e.jsx("span",{children:"ๆ‹–ๆ‹ฝๅก็‰‡ๆป‘ๅŠจๅฎกๆ ธ"})]})]})]})})}function d2(){return e.jsx(lr,{children:e.jsx(m2,{})})}const u2=a=>{const l=[];for(let r=0;r(H.current=!0,()=>{H.current=!1,O.current&&(clearInterval(O.current),O.current=null)}),[]);const X=u.useCallback(async()=>{try{const A=await jx();H.current&&E(A.unchecked)}catch(A){console.error("่Žทๅ–ๅฎกๆ ธ็ปŸ่ฎกๅคฑ่ดฅ:",A)}},[]),L=u.useCallback(async()=>{try{y(!0);const A=await fw.get("https://v1.hitokoto.cn/?c=a&c=b&c=c&c=d&c=h&c=i&c=k");H.current&&j({hitokoto:A.data.hitokoto,from:A.data.from||A.data.from_who||"ๆœช็Ÿฅ"})}catch(A){console.error("่Žทๅ–ไธ€่จ€ๅคฑ่ดฅ:",A),H.current&&j({hitokoto:"ไบบ็”Ÿๅฐฑๅƒไธ€็›’ๅทงๅ…‹ๅŠ›๏ผŒไฝ ๆฐธ่ฟœไธ็Ÿฅ้“ไธ‹ไธ€้ข—ๆ˜ฏไป€ไนˆๅ‘ณ้“ใ€‚",from:"้˜ฟ็”˜ๆญฃไผ "})}finally{H.current&&y(!1)}},[]),me=u.useCallback(async()=>{try{const A=await ke("/api/webui/system/status");if(!H.current)return;if(A.ok){const K=await A.json();z(K)}else z(null)}catch(A){console.error("่Žทๅ–ๆœบๅ™จไบบ็Šถๆ€ๅคฑ่ดฅ:",A),H.current&&z(null)}},[]),Ne=async()=>{await C()},je=u.useCallback(async()=>{try{const A=await ke(`/api/webui/statistics/dashboard?hours=${h}`);if(!H.current)return;if(A.ok){const K=await A.json();l(K)}c(!1),m(100)}catch(A){console.error("Failed to fetch dashboard data:",A),H.current&&(c(!1),m(100))}},[h]);if(u.useEffect(()=>{if(!r)return;m(0);const A=setTimeout(()=>m(15),200),K=setTimeout(()=>m(30),800),Re=setTimeout(()=>m(45),2e3),se=setTimeout(()=>m(60),4e3),$e=setTimeout(()=>m(75),6500),cs=setTimeout(()=>m(85),9e3),J=setTimeout(()=>m(92),11e3);return()=>{clearTimeout(A),clearTimeout(K),clearTimeout(Re),clearTimeout(se),clearTimeout($e),clearTimeout(cs),clearTimeout(J)}},[r]),u.useEffect(()=>{je(),L(),me(),X()},[je,L,me,X]),u.useEffect(()=>{if(O.current&&(clearInterval(O.current),O.current=null),!!p)return O.current=setInterval(()=>{H.current&&(je(),me())},3e4),()=>{O.current&&(clearInterval(O.current),O.current=null)}},[p,je,me]),r||!a)return e.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-200px)]",children:e.jsxs("div",{className:"text-center space-y-6 w-full max-w-md px-4",children:[e.jsx(dt,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-lg font-medium",children:"ๅŠ ่ฝฝ็ปŸ่ฎกๆ•ฐๆฎไธญ..."}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๆญฃๅœจ่Žทๅ–้บฆ้บฆ่ฟ่กŒๆ•ฐๆฎ"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(tr,{value:d,className:"h-2"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[d,"%"]})]})]})});const{summary:ce,model_stats:ge=[],hourly_data:pe=[],daily_data:D=[],recent_activity:Q=[]}=a,B=ce??{total_requests:0,total_cost:0,total_tokens:0,online_time:0,total_messages:0,total_replies:0,avg_response_time:0,cost_per_hour:0,tokens_per_hour:0},ue=A=>{const K=Math.floor(A/3600),Re=Math.floor(A%3600/60);return`${K}ๅฐๆ—ถ${Re}ๅˆ†้’Ÿ`},Y=A=>{const K=A.toLocaleString("zh-CN");return A>=1e9?{display:`${(A/1e9).toFixed(2)}B`,exact:K,needsExact:!0}:A>=1e6?{display:`${(A/1e6).toFixed(2)}M`,exact:K,needsExact:!0}:A>=1e4?{display:`${(A/1e3).toFixed(1)}K`,exact:K,needsExact:!0}:A>=1e3?{display:`${(A/1e3).toFixed(2)}K`,exact:K,needsExact:!0}:{display:K,exact:K,needsExact:!1}},we=A=>{const K=`ยฅ${A.toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2})}`;return A>=1e6?{display:`ยฅ${(A/1e6).toFixed(2)}M`,exact:K,needsExact:!0}:A>=1e4?{display:`ยฅ${(A/1e3).toFixed(1)}K`,exact:K,needsExact:!0}:A>=1e3?{display:`ยฅ${(A/1e3).toFixed(2)}K`,exact:K,needsExact:!0}:{display:K,exact:K,needsExact:!1}},fe=A=>new Date(A).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),Ee=u2(ge.length),G=ge.map((A,K)=>({name:A.model_name,value:A.request_count,fill:Ee[K]})),$={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(ts,{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(Jt,{value:h.toString(),onValueChange:A=>f(Number(A)),children:e.jsxs(Gt,{className:"grid grid-cols-3 w-full sm:w-auto",children:[e.jsx(Xe,{value:"24",children:"24ๅฐๆ—ถ"}),e.jsx(Xe,{value:"168",children:"7ๅคฉ"}),e.jsx(Xe,{value:"720",children:"30ๅคฉ"})]})}),e.jsxs(_,{variant:p?"default":"outline",size:"sm",onClick:()=>g(!p),className:"gap-2",children:[e.jsx(dt,{className:`h-4 w-4 ${p?"animate-spin":""}`}),e.jsx("span",{className:"hidden sm:inline",children:"่‡ชๅŠจๅˆทๆ–ฐ"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:je,children:e.jsx(dt,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 rounded-lg border border-dashed border-muted-foreground/30 bg-muted/20",children:[b?e.jsx(ks,{className:"h-5 flex-1"}):N?e.jsxs("p",{className:"flex-1 text-sm text-muted-foreground italic truncate",children:['"',N.hitokoto,'" โ€”โ€” ',N.from]}):null,e.jsx(_,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:L,disabled:b,children:e.jsx(dt,{className:`h-3.5 w-3.5 ${b?"animate-spin":""}`})})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-3",children:[e.jsxs(Te,{className:"lg:col-span-1",children:[e.jsx(Oe,{className:"pb-3",children:e.jsxs(Ue,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(pc,{className:"h-4 w-4"}),"้บฆ้บฆ็Šถๆ€"]})}),e.jsx(ze,{children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex items-center gap-2",children:w?.running?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-3 w-3 rounded-full bg-green-500 animate-pulse"}),e.jsxs(Ce,{variant:"outline",className:"text-green-600 border-green-300 bg-green-50",children:[e.jsx(st,{className:"h-3 w-3 mr-1"}),"่ฟ่กŒไธญ"]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-3 w-3 rounded-full bg-red-500"}),e.jsxs(Ce,{variant:"outline",className:"text-red-600 border-red-300 bg-red-50",children:[e.jsx(Ut,{className:"h-3 w-3 mr-1"}),"ๅทฒๅœๆญข"]})]})}),w&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:[e.jsxs("span",{children:["v",w.version]}),e.jsx("span",{className:"mx-2",children:"|"}),e.jsxs("span",{children:["่ฟ่กŒ ",ue(w.uptime)]})]})]})})]}),e.jsxs(Te,{children:[e.jsx(Oe,{className:"pb-3",children:e.jsxs(Ue,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(sl,{className:"h-4 w-4"}),"ๅฟซ้€Ÿๆ“ไฝœ"]})}),e.jsx(ze,{children:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:Ne,disabled:R,className:"gap-2",children:[e.jsx(rc,{className:`h-4 w-4 ${R?"animate-spin":""}`}),R?"้‡ๅฏไธญ...":"้‡ๅฏ้บฆ้บฆ"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>S(!0),className:"gap-2",children:[e.jsx(cv,{className:"h-4 w-4"}),"่กจ่พพๅฎกๆ ธ",F>0&&e.jsx("span",{className:"ml-1 px-1.5 py-0.5 text-xs rounded-full bg-orange-500 text-white",children:F>99?"99+":F})]}),e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Kn,{to:"/logs",children:[e.jsx(Ua,{className:"h-4 w-4"}),"ๆŸฅ็œ‹ๆ—ฅๅฟ—"]})}),e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Kn,{to:"/plugins",children:[e.jsx(T1,{className:"h-4 w-4"}),"ๆ’ไปถ็ฎก็†"]})}),e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Kn,{to:"/settings",children:[e.jsx(Sn,{className:"h-4 w-4"}),"็ณป็ปŸ่ฎพ็ฝฎ"]})})]})})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{className:"pb-3",children:[e.jsxs(Ue,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(E1,{className:"h-4 w-4"}),"ๅ้ฆˆ้—ฎๅท"]}),e.jsx(Ns,{className:"text-xs",children:"ๅธฎๅŠฉๆˆ‘ไปฌๆ”น่ฟ›ไบงๅ“ไฝ“้ชŒ"})]}),e.jsx(ze,{children:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Kn,{to:"/survey/webui-feedback",children:[e.jsx(Ua,{className:"h-4 w-4"}),"WebUI ๅ้ฆˆ"]})}),e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Kn,{to:"/survey/maibot-feedback",children:[e.jsx(Ia,{className:"h-4 w-4"}),"้บฆ้บฆๅ้ฆˆ"]})})]})})]})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"ๆ€ป่ฏทๆฑ‚ๆ•ฐ"}),e.jsx(nx,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(ze,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[Y(B.total_requests).display,Y(B.total_requests).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",Y(B.total_requests).exact,")"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["ๆœ€่ฟ‘",h<48?h+"ๅฐๆ—ถ":Math.floor(h/24)+"ๅคฉ"]})]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"ๆ€ป่Šฑ่ดน"}),e.jsx(M1,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(ze,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[we(B.total_cost).display,we(B.total_cost).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",we(B.total_cost).exact,")"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:B.cost_per_hour>0?`ยฅ${B.cost_per_hour.toFixed(2)}/ๅฐๆ—ถ`:"ๆš‚ๆ— ๆ•ฐๆฎ"})]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"Tokenๆถˆ่€—"}),e.jsx(Zr,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(ze,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[Y(B.total_tokens).display,Y(B.total_tokens).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",Y(B.total_tokens).exact,")"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:B.tokens_per_hour>0?`${Y(B.tokens_per_hour).display}/ๅฐๆ—ถ`:"ๆš‚ๆ— ๆ•ฐๆฎ"})]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"ๅนณๅ‡ๅ“ๅบ”"}),e.jsx(sl,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(ze,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[B.avg_response_time.toFixed(2),"s"]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"APIๅนณๅ‡่€—ๆ—ถ"})]})]})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 sm:grid-cols-3",children:[e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"ๅœจ็บฟๆ—ถ้•ฟ"}),e.jsx(da,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(ze,{children:e.jsxs("div",{className:"text-xl font-bold",children:[ue(B.online_time),e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",B.online_time.toLocaleString(),"็ง’)"]})]})})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"ๆถˆๆฏๅค„็†"}),e.jsx(Ia,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(ze,{children:[e.jsxs("div",{className:"text-xl font-bold",children:[Y(B.total_messages).display,Y(B.total_messages).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",Y(B.total_messages).exact,")"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["ๅ›žๅค ",Y(B.total_replies).display,Y(B.total_replies).needsExact&&e.jsxs("span",{children:["(",Y(B.total_replies).exact,")"]})," ๆก"]})]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"ๆˆๆœฌๆ•ˆ็އ"}),e.jsx(rx,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(ze,{children:[e.jsx("div",{className:"text-xl font-bold",children:B.total_messages>0?`ยฅ${(B.total_cost/B.total_messages*100).toFixed(2)}`:"ยฅ0.00"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"ๆฏ100ๆกๆถˆๆฏ"})]})]})]}),e.jsxs(Jt,{defaultValue:"trends",className:"space-y-4",children:[e.jsxs(Gt,{className:"grid w-full grid-cols-2 sm:grid-cols-4",children:[e.jsx(Xe,{value:"trends",children:"่ถ‹ๅŠฟ"}),e.jsx(Xe,{value:"models",children:"ๆจกๅž‹"}),e.jsx(Xe,{value:"activity",children:"ๆดปๅŠจ"}),e.jsx(Xe,{value:"daily",children:"ๆ—ฅ็ปŸ่ฎก"})]}),e.jsxs(Ss,{value:"trends",className:"space-y-4",children:[e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"่ฏทๆฑ‚่ถ‹ๅŠฟ"}),e.jsxs(Ns,{children:["ๆœ€่ฟ‘",h,"ๅฐๆ—ถ็š„่ฏทๆฑ‚้‡ๅ˜ๅŒ–"]})]}),e.jsx(ze,{children:e.jsx(Kr,{config:$,className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:e.jsxs(Ww,{data:pe,children:[e.jsx(Ji,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Xi,{dataKey:"timestamp",tickFormatter:A=>fe(A),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Gr,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Qi,{content:e.jsx(Qr,{labelFormatter:A=>fe(A)})}),e.jsx(e1,{type:"monotone",dataKey:"requests",stroke:"var(--color-requests)",strokeWidth:2})]})})})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"่Šฑ่ดน่ถ‹ๅŠฟ"}),e.jsx(Ns,{children:"API่ฐƒ็”จๆˆๆœฌๅ˜ๅŒ–"})]}),e.jsx(ze,{children:e.jsx(Kr,{config:$,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:e.jsxs(Bo,{data:pe,children:[e.jsx(Ji,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Xi,{dataKey:"timestamp",tickFormatter:A=>fe(A),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Gr,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Qi,{content:e.jsx(Qr,{labelFormatter:A=>fe(A)})}),e.jsx(Zi,{dataKey:"cost",fill:"var(--color-cost)"})]})})})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"Tokenๆถˆ่€—"}),e.jsx(Ns,{children:"Tokenไฝฟ็”จ้‡ๅ˜ๅŒ–"})]}),e.jsx(ze,{children:e.jsx(Kr,{config:$,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:e.jsxs(Bo,{data:pe,children:[e.jsx(Ji,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Xi,{dataKey:"timestamp",tickFormatter:A=>fe(A),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Gr,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Qi,{content:e.jsx(Qr,{labelFormatter:A=>fe(A)})}),e.jsx(Zi,{dataKey:"tokens",fill:"var(--color-tokens)"})]})})})]})]})]}),e.jsx(Ss,{value:"models",className:"space-y-4",children:e.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"ๆจกๅž‹่ฏทๆฑ‚ๅˆ†ๅธƒ"}),e.jsxs(Ns,{children:["ๅ„ๆจกๅž‹ไฝฟ็”จๅ ๆฏ” (ๅ…ฑ ",ge.length," ไธชๆจกๅž‹)"]})]}),e.jsx(ze,{children:e.jsx(Kr,{config:Object.fromEntries(ge.map((A,K)=>[A.model_name,{label:A.model_name,color:Ee[K]}])),className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:e.jsxs(s1,{children:[e.jsx(Qi,{content:e.jsx(Qr,{})}),e.jsx(t1,{data:G,cx:"50%",cy:"50%",labelLine:!1,label:({name:A,percent:K})=>K&&K<.05?"":`${A} ${K?(K*100).toFixed(0):0}%`,outerRadius:100,dataKey:"value",children:G.map((A,K)=>e.jsx(a1,{fill:A.fill},`cell-${K}`))})]})})})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"ๆจกๅž‹่ฏฆ็ป†็ปŸ่ฎก"}),e.jsx(Ns,{children:"่ฏทๆฑ‚ๆ•ฐใ€่Šฑ่ดนๅ’Œๆ€ง่ƒฝ"})]}),e.jsx(ze,{children:e.jsx(ts,{className:"h-[300px] sm:h-[400px]",children:e.jsx("div",{className:"space-y-3",children:ge.map((A,K)=>e.jsxs("div",{className:"p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("h4",{className:"font-semibold text-sm truncate flex-1 min-w-0",children:A.model_name}),e.jsx("div",{className:"w-3 h-3 rounded-full ml-2 flex-shrink-0",style:{backgroundColor:`hsl(var(--chart-${K%5+1}))`}})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"่ฏทๆฑ‚ๆ•ฐ:"}),e.jsx("span",{className:"ml-1 font-medium",children:A.request_count.toLocaleString()})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"่Šฑ่ดน:"}),e.jsxs("span",{className:"ml-1 font-medium",children:["ยฅ",A.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:[(A.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:[A.avg_response_time.toFixed(2),"s"]})]})]})]},K))})})})]})]})}),e.jsx(Ss,{value:"activity",children:e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"ๆœ€่ฟ‘ๆดปๅŠจ"}),e.jsx(Ns,{children:"ๆœ€ๆ–ฐ็š„API่ฐƒ็”จ่ฎฐๅฝ•"})]}),e.jsx(ze,{children:e.jsx(ts,{className:"h-[400px] sm:h-[500px]",children:e.jsx("div",{className:"space-y-2",children:Q.map((A,K)=>e.jsxs("div",{className:"p-3 sm:p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 mb-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium text-sm truncate",children:A.model}),e.jsx("div",{className:"text-xs text-muted-foreground",children:A.request_type})]}),e.jsx("div",{className:"text-xs text-muted-foreground flex-shrink-0",children:fe(A.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:A.tokens})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"่Šฑ่ดน:"}),e.jsxs("span",{className:"ml-1",children:["ยฅ",A.cost.toFixed(4)]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"่€—ๆ—ถ:"}),e.jsxs("span",{className:"ml-1",children:[A.time_cost.toFixed(2),"s"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"็Šถๆ€:"}),e.jsx("span",{className:`ml-1 ${A.status==="success"?"text-green-600":"text-red-600"}`,children:A.status})]})]})]},K))})})})]})}),e.jsx(Ss,{value:"daily",children:e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"ๆฏๆ—ฅ็ปŸ่ฎก"}),e.jsx(Ns,{children:"ๆœ€่ฟ‘7ๅคฉ็š„ๆ•ฐๆฎๆฑ‡ๆ€ป"})]}),e.jsx(ze,{children:e.jsx(Kr,{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(Bo,{data:D,children:[e.jsx(Ji,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Xi,{dataKey:"timestamp",tickFormatter:A=>{const K=new Date(A);return`${K.getMonth()+1}/${K.getDate()}`},stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Gr,{yAxisId:"left",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Gr,{yAxisId:"right",orientation:"right",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Qi,{content:e.jsx(Qr,{labelFormatter:A=>new Date(A).toLocaleDateString("zh-CN")})}),e.jsx(F_,{content:e.jsx(zv,{})}),e.jsx(Zi,{yAxisId:"left",dataKey:"requests",fill:"var(--color-requests)"}),e.jsx(Zi,{yAxisId:"right",dataKey:"cost",fill:"var(--color-cost)"})]})})})]})})]}),e.jsx(nr,{}),e.jsx(Pv,{open:M,onOpenChange:A=>{S(A),A||X()}})]})})}const x2={theme:"system",setTheme:()=>null},Fv=u.createContext(x2),vx=()=>{const a=u.useContext(Fv);if(a===void 0)throw new Error("useTheme must be used within a ThemeProvider");return a},h2=(a,l,r)=>{const c=document.documentElement.classList.contains("no-animations");if(!document.startViewTransition||c){l(a);return}const d=r.clientX,m=r.clientY,h=Math.hypot(Math.max(d,innerWidth-d),Math.max(m,innerHeight-m));document.startViewTransition(()=>{l(a)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${d}px ${m}px)`,`circle(${h}px at ${d}px ${m}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},Hv=u.createContext(void 0),qv=()=>{const a=u.useContext(Hv);if(a===void 0)throw new Error("useAnimation must be used within an AnimationProvider");return a},Ge=u.forwardRef(({className:a,...l},r)=>e.jsx(Nj,{className:P("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",a),...l,ref:r,children:e.jsx(bw,{className:P("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Ge.displayName=Nj.displayName;const f2=ti("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),T=u.forwardRef(({className:a,...l},r)=>e.jsx(Xj,{ref:r,className:P(f2(),a),...l}));T.displayName=Xj.displayName;const p2=[{id:"minLength",label:"้•ฟๅบฆ่‡ณๅฐ‘ 10 ไฝ",description:"Token ้•ฟๅบฆๅฟ…้กปๅคงไบŽ็ญ‰ไบŽ 10 ไธชๅญ—็ฌฆ",validate:a=>a.length>=10},{id:"hasUppercase",label:"ๅŒ…ๅซๅคงๅ†™ๅญ—ๆฏ",description:"่‡ณๅฐ‘ๅŒ…ๅซไธ€ไธชๅคงๅ†™ๅญ—ๆฏ (A-Z)",validate:a=>/[A-Z]/.test(a)},{id:"hasLowercase",label:"ๅŒ…ๅซๅฐๅ†™ๅญ—ๆฏ",description:"่‡ณๅฐ‘ๅŒ…ๅซไธ€ไธชๅฐๅ†™ๅญ—ๆฏ (a-z)",validate:a=>/[a-z]/.test(a)},{id:"hasSpecialChar",label:"ๅŒ…ๅซ็‰นๆฎŠ็ฌฆๅท",description:"่‡ณๅฐ‘ๅŒ…ๅซไธ€ไธช็‰นๆฎŠ็ฌฆๅท (!@#$%^&*()_+-=[]{}|;:,.<>?/)",validate:a=>/[!@#$%^&*()_+\-=[\]{}|;:,.<>?/]/.test(a)}];function g2(a){const l=p2.map(c=>({id:c.id,label:c.label,description:c.description,passed:c.validate(a)}));return{isValid:l.every(c=>c.passed),rules:l}}const ud="0.12.2",Nx="MaiBot Dashboard",j2=`${Nx} v${ud}`,v2=(a="v")=>`${a}${ud}`,wa={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"},jl={theme:"system",accentColor:"blue",enableAnimations:!0,enableWavesBackground:!0,logCacheSize:1e3,logAutoScroll:!0,logFontSize:"xs",logLineSpacing:4,dataSyncInterval:30,wsReconnectInterval:3e3,wsMaxReconnectAttempts:10};function zt(a){const l=Vv(a),r=localStorage.getItem(l);if(r===null)return jl[a];const c=jl[a];if(typeof c=="boolean")return r==="true";if(typeof c=="number"){const d=parseFloat(r);return isNaN(d)?c:d}return r}function Yr(a,l){const r=Vv(a);localStorage.setItem(r,String(l)),window.dispatchEvent(new CustomEvent("maibot-settings-change",{detail:{key:a,value:l}}))}function N2(){return{theme:zt("theme"),accentColor:zt("accentColor"),enableAnimations:zt("enableAnimations"),enableWavesBackground:zt("enableWavesBackground"),logCacheSize:zt("logCacheSize"),logAutoScroll:zt("logAutoScroll"),logFontSize:zt("logFontSize"),logLineSpacing:zt("logLineSpacing"),dataSyncInterval:zt("dataSyncInterval"),wsReconnectInterval:zt("wsReconnectInterval"),wsMaxReconnectAttempts:zt("wsMaxReconnectAttempts")}}function b2(){const a=N2(),l=localStorage.getItem(wa.COMPLETED_TOURS),r=l?JSON.parse(l):[];return{...a,completedTours:r}}function y2(a){const l=[],r=[];for(const[c,d]of Object.entries(a)){if(c==="completedTours"){Array.isArray(d)?(localStorage.setItem(wa.COMPLETED_TOURS,JSON.stringify(d)),l.push("completedTours")):r.push("completedTours");continue}if(c in jl){const m=c,h=jl[m];if(typeof d==typeof h){if(m==="theme"&&!["light","dark","system"].includes(d)){r.push(c);continue}if(m==="logFontSize"&&!["xs","sm","base"].includes(d)){r.push(c);continue}Yr(m,d),l.push(c)}else r.push(c)}else r.push(c)}return{success:l.length>0,imported:l,skipped:r}}function w2(){for(const a of Object.keys(jl))Yr(a,jl[a]);localStorage.removeItem(wa.COMPLETED_TOURS),window.dispatchEvent(new CustomEvent("maibot-settings-reset"))}function _2(){const a=[],l=[],r=[];for(let c=0;cc.size-r.size),{used:a,items:localStorage.length,details:l}}function S2(a){if(a===0)return"0 B";const l=1024,r=["B","KB","MB"],c=Math.floor(Math.log(a)/Math.log(l));return parseFloat((a/Math.pow(l,c)).toFixed(2))+" "+r[c]}function Vv(a){return{theme:wa.THEME,accentColor:wa.ACCENT_COLOR,enableAnimations:wa.ENABLE_ANIMATIONS,enableWavesBackground:wa.ENABLE_WAVES_BACKGROUND,logCacheSize:wa.LOG_CACHE_SIZE,logAutoScroll:wa.LOG_AUTO_SCROLL,logFontSize:wa.LOG_FONT_SIZE,logLineSpacing:wa.LOG_LINE_SPACING,dataSyncInterval:wa.DATA_SYNC_INTERVAL,wsReconnectInterval:wa.WS_RECONNECT_INTERVAL,wsMaxReconnectAttempts:wa.WS_MAX_RECONNECT_ATTEMPTS}[a]}const el=u.forwardRef(({className:a,...l},r)=>e.jsxs(bj,{ref:r,className:P("relative flex w-full touch-none select-none items-center",a),...l,children:[e.jsx(yw,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:e.jsx(ww,{className:"absolute h-full bg-primary"})}),e.jsx(_w,{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"})]}));el.displayName=bj.displayName;class k2{ws=null;reconnectTimeout=null;reconnectAttempts=0;heartbeatInterval=null;logCallbacks=new Set;connectionCallbacks=new Set;isConnected=!1;logCache=[];getMaxCacheSize(){return zt("logCacheSize")}getMaxReconnectAttempts(){return zt("wsMaxReconnectAttempts")}getReconnectInterval(){return zt("wsReconnectInterval")}getWebSocketUrl(l){let r;{const c=window.location.protocol==="https:"?"wss:":"ws:",d=window.location.host;r=`${c}//${d}/ws/logs`}return l?`${r}?token=${encodeURIComponent(l)}`:r}async getWsToken(){try{const l=await ke("/api/webui/ws-token",{method:"GET",credentials:"include"});if(!l.ok)return console.error("่Žทๅ– WebSocket token ๅคฑ่ดฅ:",l.status),null;const r=await l.json();return r.success&&r.token?r.token:null}catch(l){return console.error("่Žทๅ– WebSocket token ๅคฑ่ดฅ:",l),null}}async connect(){if(this.ws?.readyState===WebSocket.OPEN||this.ws?.readyState===WebSocket.CONNECTING)return;if(window.location.pathname==="/auth"){console.log("๐Ÿ“ก ๅœจ็™ปๅฝ•้กต้ข๏ผŒ่ทณ่ฟ‡ WebSocket ่ฟžๆŽฅ");return}if(!await dc()){console.log("๐Ÿ“ก ๆœช็™ปๅฝ•๏ผŒ่ทณ่ฟ‡ WebSocket ่ฟžๆŽฅ");return}const r=await this.getWsToken();if(!r){console.log("๐Ÿ“ก ๆ— ๆณ•่Žทๅ– WebSocket token๏ผŒ่ทณ่ฟ‡่ฟžๆŽฅ");return}const c=this.getWebSocketUrl(r);try{this.ws=new WebSocket(c),this.ws.onopen=()=>{this.isConnected=!0,this.reconnectAttempts=0,this.notifyConnection(!0),this.startHeartbeat()},this.ws.onmessage=d=>{try{if(d.data==="pong")return;const m=JSON.parse(d.data);this.notifyLog(m)}catch(m){console.error("่งฃๆžๆ—ฅๅฟ—ๆถˆๆฏๅคฑ่ดฅ:",m)}},this.ws.onerror=d=>{console.error("โŒ WebSocket ้”™่ฏฏ:",d),this.isConnected=!1,this.notifyConnection(!1)},this.ws.onclose=()=>{this.isConnected=!1,this.notifyConnection(!1),this.stopHeartbeat(),this.attemptReconnect()}}catch(d){console.error("ๅˆ›ๅปบ WebSocket ่ฟžๆŽฅๅคฑ่ดฅ:",d),this.attemptReconnect()}}attemptReconnect(){const l=this.getMaxReconnectAttempts();if(this.reconnectAttempts>=l)return;this.reconnectAttempts+=1;const r=this.getReconnectInterval(),c=Math.min(r*this.reconnectAttempts,3e4);this.reconnectTimeout=window.setTimeout(()=>{this.connect()},c)}startHeartbeat(){this.heartbeatInterval=window.setInterval(()=>{this.ws?.readyState===WebSocket.OPEN&&this.ws.send("ping")},3e4)}stopHeartbeat(){this.heartbeatInterval!==null&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null)}disconnect(){this.reconnectTimeout!==null&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),this.stopHeartbeat(),this.ws&&(this.ws.close(),this.ws=null),this.isConnected=!1,this.reconnectAttempts=0}onLog(l){return this.logCallbacks.add(l),()=>this.logCallbacks.delete(l)}onConnectionChange(l){return this.connectionCallbacks.add(l),l(this.isConnected),()=>this.connectionCallbacks.delete(l)}notifyLog(l){if(!this.logCache.some(c=>c.id===l.id)){this.logCache.push(l);const c=this.getMaxCacheSize();this.logCache.length>c&&(this.logCache=this.logCache.slice(-c)),this.logCallbacks.forEach(d=>{try{d(l)}catch(m){console.error("ๆ—ฅๅฟ—ๅ›ž่ฐƒๆ‰ง่กŒๅคฑ่ดฅ:",m)}})}}notifyConnection(l){this.connectionCallbacks.forEach(r=>{try{r(l)}catch(c){console.error("่ฟžๆŽฅ็Šถๆ€ๅ›ž่ฐƒๆ‰ง่กŒๅคฑ่ดฅ:",c)}})}getAllLogs(){return[...this.logCache]}clearLogs(){this.logCache=[]}getConnectionStatus(){return this.isConnected}}const Qn=new k2;typeof window<"u"&&setTimeout(()=>{Qn.connect()},100);const bs=kw,wt=Cw,C2=Sw,Gv=u.forwardRef(({className:a,...l},r)=>e.jsx(yj,{className:P("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),...l,ref:r}));Gv.displayName=yj.displayName;const xs=u.forwardRef(({className:a,...l},r)=>e.jsxs(C2,{children:[e.jsx(Gv,{}),e.jsx(wj,{ref:r,className:P("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",a),...l})]}));xs.displayName=wj.displayName;const hs=({className:a,...l})=>e.jsx("div",{className:P("flex flex-col space-y-2 text-center sm:text-left",a),...l});hs.displayName="AlertDialogHeader";const fs=({className:a,...l})=>e.jsx("div",{className:P("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",a),...l});fs.displayName="AlertDialogFooter";const ps=u.forwardRef(({className:a,...l},r)=>e.jsx(_j,{ref:r,className:P("text-lg font-semibold",a),...l}));ps.displayName=_j.displayName;const gs=u.forwardRef(({className:a,...l},r)=>e.jsx(Sj,{ref:r,className:P("text-sm text-muted-foreground",a),...l}));gs.displayName=Sj.displayName;const js=u.forwardRef(({className:a,variant:l,...r},c)=>e.jsx(kj,{ref:c,className:P(si({variant:l}),a),...r}));js.displayName=kj.displayName;const vs=u.forwardRef(({className:a,...l},r)=>e.jsx(Cj,{ref:r,className:P(si({variant:"outline"}),"mt-2 sm:mt-0",a),...l}));vs.displayName=Cj.displayName;function T2(){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(Jt,{defaultValue:"appearance",className:"w-full",children:[e.jsxs(Gt,{className:"grid w-full grid-cols-2 sm:grid-cols-4 gap-0.5 sm:gap-1 h-auto p-1",children:[e.jsxs(Xe,{value:"appearance",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(A1,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"ๅค–่ง‚"})]}),e.jsxs(Xe,{value:"security",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(ov,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"ๅฎ‰ๅ…จ"})]}),e.jsxs(Xe,{value:"other",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(Sn,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"ๅ…ถไป–"})]}),e.jsxs(Xe,{value:"about",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(Yt,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"ๅ…ณไบŽ"})]})]}),e.jsxs(ts,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[e.jsx(Ss,{value:"appearance",className:"mt-0",children:e.jsx(E2,{})}),e.jsx(Ss,{value:"security",className:"mt-0",children:e.jsx(M2,{})}),e.jsx(Ss,{value:"other",className:"mt-0",children:e.jsx(A2,{})}),e.jsx(Ss,{value:"about",className:"mt-0",children:e.jsx(z2,{})})]})]})]})}function Ig(a){const l=document.documentElement,c={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[a];if(c)l.style.setProperty("--primary",c.hsl),c.gradient?(l.style.setProperty("--primary-gradient",c.gradient),l.classList.add("has-gradient")):(l.style.removeProperty("--primary-gradient"),l.classList.remove("has-gradient"));else if(a.startsWith("#")){const d=m=>{m=m.replace("#","");const h=parseInt(m.substring(0,2),16)/255,f=parseInt(m.substring(2,4),16)/255,p=parseInt(m.substring(4,6),16)/255,g=Math.max(h,f,p),N=Math.min(h,f,p);let j=0,b=0;const y=(g+N)/2;if(g!==N){const w=g-N;switch(b=y>.5?w/(2-g-N):w/(g+N),g){case h:j=((f-p)/w+(flocalStorage.getItem("accent-color")||"blue");u.useEffect(()=>{const g=localStorage.getItem("accent-color")||"blue";Ig(g)},[]);const p=g=>{f(g),localStorage.setItem("accent-color",g),Ig(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(Bm,{value:"light",current:a,onChange:l,label:"ๆต…่‰ฒ",description:"ๅง‹็ปˆไฝฟ็”จๆต…่‰ฒไธป้ข˜"}),e.jsx(Bm,{value:"dark",current:a,onChange:l,label:"ๆทฑ่‰ฒ",description:"ๅง‹็ปˆไฝฟ็”จๆทฑ่‰ฒไธป้ข˜"}),e.jsx(Bm,{value:"system",current:a,onChange:l,label:"่ทŸ้š็ณป็ปŸ",description:"ๆ นๆฎ็ณป็ปŸ่ฎพ็ฝฎ่‡ชๅŠจๅˆ‡ๆข"})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"ไธป้ข˜่‰ฒ"}),e.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"ๅ•่‰ฒ"}),e.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[e.jsx(Wa,{value:"blue",current:h,onChange:p,label:"่“่‰ฒ",colorClass:"bg-blue-500"}),e.jsx(Wa,{value:"purple",current:h,onChange:p,label:"็ดซ่‰ฒ",colorClass:"bg-purple-500"}),e.jsx(Wa,{value:"green",current:h,onChange:p,label:"็ปฟ่‰ฒ",colorClass:"bg-green-500"}),e.jsx(Wa,{value:"orange",current:h,onChange:p,label:"ๆฉ™่‰ฒ",colorClass:"bg-orange-500"}),e.jsx(Wa,{value:"pink",current:h,onChange:p,label:"็ฒ‰่‰ฒ",colorClass:"bg-pink-500"}),e.jsx(Wa,{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(Wa,{value:"gradient-sunset",current:h,onChange:p,label:"ๆ—ฅ่ฝ",colorClass:"bg-gradient-to-r from-orange-500 to-pink-500"}),e.jsx(Wa,{value:"gradient-ocean",current:h,onChange:p,label:"ๆตทๆด‹",colorClass:"bg-gradient-to-r from-blue-500 to-cyan-500"}),e.jsx(Wa,{value:"gradient-forest",current:h,onChange:p,label:"ๆฃฎๆž—",colorClass:"bg-gradient-to-r from-green-500 to-emerald-500"}),e.jsx(Wa,{value:"gradient-aurora",current:h,onChange:p,label:"ๆžๅ…‰",colorClass:"bg-gradient-to-r from-purple-500 to-pink-500"}),e.jsx(Wa,{value:"gradient-fire",current:h,onChange:p,label:"็ƒˆ็„ฐ",colorClass:"bg-gradient-to-r from-red-500 to-orange-500"}),e.jsx(Wa,{value:"gradient-twilight",current:h,onChange:p,label:"ๆšฎๅ…‰",colorClass:"bg-gradient-to-r from-indigo-500 to-purple-500"})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"่‡ชๅฎšไน‰้ขœ่‰ฒ"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 sm:gap-4",children:[e.jsx("div",{className:"flex-1",children:e.jsx("input",{type:"color",value:h.startsWith("#")?h:"#3b82f6",onChange:g=>p(g.target.value),className:"h-10 sm:h-12 w-full rounded-lg border-2 border-border cursor-pointer",title:"้€‰ๆ‹ฉ่‡ชๅฎšไน‰้ขœ่‰ฒ"})}),e.jsx("div",{className:"flex-1",children:e.jsx(ne,{type:"text",value:h,onChange:g=>p(g.target.value),placeholder:"#3b82f6",className:"font-mono text-sm"})})]}),e.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground mt-2",children:"็‚นๅ‡ป่‰ฒๅ—้€‰ๆ‹ฉ้ขœ่‰ฒ๏ผŒๆˆ–ๆ‰‹ๅŠจ่พ“ๅ…ฅ HEX ้ขœ่‰ฒไปฃ็ "})]})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"ๅŠจ็”ปๆ•ˆๆžœ"}),e.jsxs("div",{className:"space-y-2 sm:space-y-3",children:[e.jsx("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5 flex-1",children:[e.jsx(T,{htmlFor:"animations",className:"text-base font-medium cursor-pointer",children:"ๅฏ็”จๅŠจ็”ปๆ•ˆๆžœ"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๅ…ณ้—ญๅŽๅฐ†็ฆ็”จๆ‰€ๆœ‰่ฟ‡ๆธกๅŠจ็”ปๅ’Œ็‰นๆ•ˆ๏ผŒๆๅ‡ๆ€ง่ƒฝ"})]}),e.jsx(Ge,{id:"animations",checked:r,onCheckedChange:c})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5 flex-1",children:[e.jsx(T,{htmlFor:"waves-background",className:"text-base font-medium cursor-pointer",children:"็™ปๅฝ•้กตๆณขๆตช่ƒŒๆ™ฏ"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๅ…ณ้—ญๅŽ็™ปๅฝ•้กตๅฐ†ไฝฟ็”จ็บฏ่‰ฒ่ƒŒๆ™ฏ๏ผŒ้€‚ๅˆไฝŽๆ€ง่ƒฝ่ฎพๅค‡"})]}),e.jsx(Ge,{id:"waves-background",checked:d,onCheckedChange:m})]})})]})]})]})}function M2(){const a=ha(),[l,r]=u.useState(""),[c,d]=u.useState(""),[m,h]=u.useState(!1),[f,p]=u.useState(!1),[g,N]=u.useState(!1),[j,b]=u.useState(!1),[y,w]=u.useState(!1),[z,M]=u.useState(!1),[S,F]=u.useState(""),[E,C]=u.useState(!1),{toast:R}=nt(),H=u.useMemo(()=>g2(c),[c]),O=async ce=>{if(!l){R({title:"ๆ— ๆณ•ๅคๅˆถ",description:"Token ๅญ˜ๅ‚จๅœจๅฎ‰ๅ…จ Cookie ไธญ๏ผŒ่ฏท้‡ๆ–ฐ็”Ÿๆˆไปฅ่Žทๅ–ๆ–ฐ Token",variant:"destructive"});return}try{await navigator.clipboard.writeText(ce),w(!0),R({title:"ๅคๅˆถๆˆๅŠŸ",description:"Token ๅทฒๅคๅˆถๅˆฐๅ‰ช่ดดๆฟ"}),setTimeout(()=>w(!1),2e3)}catch{R({title:"ๅคๅˆถๅคฑ่ดฅ",description:"่ฏทๆ‰‹ๅŠจๅคๅˆถ Token",variant:"destructive"})}},X=async()=>{if(!c.trim()){R({title:"่พ“ๅ…ฅ้”™่ฏฏ",description:"่ฏท่พ“ๅ…ฅๆ–ฐ็š„ Token",variant:"destructive"});return}if(!H.isValid){const ce=H.rules.filter(ge=>!ge.passed).map(ge=>ge.label).join(", ");R({title:"ๆ ผๅผ้”™่ฏฏ",description:`Token ไธ็ฌฆๅˆ่ฆๆฑ‚: ${ce}`,variant:"destructive"});return}N(!0);try{const ce=await fetch("/api/webui/auth/update",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({new_token:c.trim()})}),ge=await ce.json();ce.ok&&ge.success?(d(""),r(c.trim()),R({title:"ๆ›ดๆ–ฐๆˆๅŠŸ",description:"Access Token ๅทฒๆ›ดๆ–ฐ๏ผŒๅณๅฐ†่ทณ่ฝฌๅˆฐ็™ปๅฝ•้กต"}),setTimeout(()=>{a({to:"/auth"})},1500)):R({title:"ๆ›ดๆ–ฐๅคฑ่ดฅ",description:ge.message||"ๆ— ๆณ•ๆ›ดๆ–ฐ Token",variant:"destructive"})}catch(ce){console.error("ๆ›ดๆ–ฐ Token ้”™่ฏฏ:",ce),R({title:"ๆ›ดๆ–ฐๅคฑ่ดฅ",description:"่ฟžๆŽฅๆœๅŠกๅ™จๅคฑ่ดฅ",variant:"destructive"})}finally{N(!1)}},L=async()=>{b(!0);try{const ce=await fetch("/api/webui/auth/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"}),ge=await ce.json();ce.ok&&ge.success?(r(ge.token),F(ge.token),M(!0),C(!1),R({title:"็”ŸๆˆๆˆๅŠŸ",description:"ๆ–ฐ็š„ Access Token ๅทฒ็”Ÿๆˆ๏ผŒ่ฏทๅŠๆ—ถไฟๅญ˜"})):R({title:"็”Ÿๆˆๅคฑ่ดฅ",description:ge.message||"ๆ— ๆณ•็”Ÿๆˆๆ–ฐ Token",variant:"destructive"})}catch(ce){console.error("็”Ÿๆˆ Token ้”™่ฏฏ:",ce),R({title:"็”Ÿๆˆๅคฑ่ดฅ",description:"่ฟžๆŽฅๆœๅŠกๅ™จๅคฑ่ดฅ",variant:"destructive"})}finally{b(!1)}},me=async()=>{try{await navigator.clipboard.writeText(S),C(!0),R({title:"ๅคๅˆถๆˆๅŠŸ",description:"Token ๅทฒๅคๅˆถๅˆฐๅ‰ช่ดดๆฟ"})}catch{R({title:"ๅคๅˆถๅคฑ่ดฅ",description:"่ฏทๆ‰‹ๅŠจๅคๅˆถ Token",variant:"destructive"})}},Ne=()=>{M(!1),setTimeout(()=>{F(""),C(!1)},300),setTimeout(()=>{a({to:"/auth"})},500)},je=ce=>{ce||Ne()};return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsx(Qs,{open:z,onOpenChange:je,children:e.jsxs(Hs,{className:"sm:max-w-md",children:[e.jsxs(qs,{children:[e.jsxs(Vs,{className:"flex items-center gap-2",children:[e.jsx(Lt,{className:"h-5 w-5 text-yellow-500"}),"ๆ–ฐ็š„ Access Token"]}),e.jsx(at,{children:"่ฟ™ๆ˜ฏๆ‚จ็š„ๆ–ฐ Token๏ผŒ่ฏท็ซ‹ๅณไฟๅญ˜ใ€‚ๅ…ณ้—ญๆญค็ช—ๅฃๅŽๅฐ†่ทณ่ฝฌๅˆฐ็™ปๅฝ•้กต้ขใ€‚"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-lg border-2 border-primary/20 bg-primary/5 p-4",children:[e.jsx(T,{className:"text-xs text-muted-foreground mb-2 block",children:"ๆ‚จ็š„ๆ–ฐ Token (64ไฝๅฎ‰ๅ…จไปค็‰Œ)"}),e.jsx("div",{className:"font-mono text-sm break-all select-all bg-background p-3 rounded border",children:S})]}),e.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Lt,{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(gt,{className:"gap-2 sm:gap-0",children:[e.jsx(_,{variant:"outline",onClick:me,className:"gap-2",children:E?e.jsxs(e.Fragment,{children:[e.jsx(Ot,{className:"h-4 w-4 text-green-500"}),"ๅทฒๅคๅˆถ"]}):e.jsxs(e.Fragment,{children:[e.jsx(qo,{className:"h-4 w-4"}),"ๅคๅˆถ Token"]})}),e.jsx(_,{onClick:Ne,children:"ๆˆ‘ๅทฒไฟๅญ˜๏ผŒๅ…ณ้—ญ"})]})]})}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"ๅฝ“ๅ‰ Access Token"}),e.jsx("div",{className:"space-y-3 sm:space-y-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"current-token",className:"text-sm",children:"ๆ‚จ็š„่ฎฟ้—ฎไปค็‰Œ"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(ne,{id:"current-token",type:m?"text":"password",value:l||"โ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ข",readOnly:!0,className:"pr-10 font-mono text-sm",placeholder:"Token ๅญ˜ๅ‚จๅœจๅฎ‰ๅ…จ Cookie ไธญ"}),e.jsx("button",{onClick:()=>{l?h(!m):R({title:"ๆ— ๆณ•ๆŸฅ็œ‹",description:'Token ๅญ˜ๅ‚จๅœจๅฎ‰ๅ…จ Cookie ไธญ๏ผŒๅฆ‚้œ€ๆ–ฐ Token ่ฏท็‚นๅ‡ป"้‡ๆ–ฐ็”Ÿๆˆ"'})},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:m?"้š่—":"ๆ˜พ็คบ",children:m?e.jsx(ic,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(ua,{className:"h-4 w-4 text-muted-foreground"})})]}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[e.jsx(_,{variant:"outline",size:"icon",onClick:()=>O(l),title:"ๅคๅˆถๅˆฐๅ‰ช่ดดๆฟ",className:"flex-shrink-0",disabled:!l,children:y?e.jsx(Ot,{className:"h-4 w-4 text-green-500"}):e.jsx(qo,{className:"h-4 w-4"})}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{variant:"outline",disabled:j,className:"gap-2 flex-1 sm:flex-none",children:[e.jsx(dt,{className:P("h-4 w-4",j&&"animate-spin")}),e.jsx("span",{className:"hidden sm:inline",children:"้‡ๆ–ฐ็”Ÿๆˆ"}),e.jsx("span",{className:"sm:hidden",children:"็”Ÿๆˆ"})]})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎค้‡ๆ–ฐ็”Ÿๆˆ Token"}),e.jsx(gs,{children:"่ฟ™ๅฐ†็”Ÿๆˆไธ€ไธชๆ–ฐ็š„ 64 ไฝๅฎ‰ๅ…จไปค็‰Œ๏ผŒๅนถไฝฟๅฝ“ๅ‰ Token ็ซ‹ๅณๅคฑๆ•ˆใ€‚ ๆ‚จ้œ€่ฆไฝฟ็”จๆ–ฐ Token ้‡ๆ–ฐ็™ปๅฝ•็ณป็ปŸใ€‚ๆญคๆ“ไฝœไธๅฏๆ’ค้”€๏ผŒ็กฎๅฎš่ฆ็ปง็ปญๅ—๏ผŸ"})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:L,children:"็กฎ่ฎค็”Ÿๆˆ"})]})]})]})]})]}),e.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground",children:"่ฏทๅฆฅๅ–„ไฟ็ฎกๆ‚จ็š„ Access Token๏ผŒไธ่ฆๆณ„้œฒ็ป™ไป–ไบบ"})]})})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"่‡ชๅฎšไน‰ Access Token"}),e.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"new-token",className:"text-sm",children:"ๆ–ฐ็š„่ฎฟ้—ฎไปค็‰Œ"}),e.jsxs("div",{className:"relative",children:[e.jsx(ne,{id:"new-token",type:f?"text":"password",value:c,onChange:ce=>d(ce.target.value),className:"pr-10 font-mono text-sm",placeholder:"่พ“ๅ…ฅ่‡ชๅฎšไน‰ Token"}),e.jsx("button",{onClick:()=>p(!f),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:f?"้š่—":"ๆ˜พ็คบ",children:f?e.jsx(ic,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(ua,{className:"h-4 w-4 text-muted-foreground"})})]}),c&&e.jsxs("div",{className:"mt-3 space-y-2 p-3 rounded-lg bg-muted/50",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Token ๅฎ‰ๅ…จ่ฆๆฑ‚:"}),e.jsx("div",{className:"space-y-1.5",children:H.rules.map(ce=>e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[ce.passed?e.jsx(st,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):e.jsx(ta,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:P(ce.passed?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:ce.label})]},ce.id))}),H.isValid&&e.jsx("div",{className:"mt-2 pt-2 border-t border-border",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-400",children:[e.jsx(Ot,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:"Token ๆ ผๅผๆญฃ็กฎ๏ผŒๅฏไปฅไฝฟ็”จ"})]})})]})]}),e.jsx(_,{onClick:X,disabled:g||!H.isValid||!c,className:"w-full sm:w-auto",children:g?"ๆ›ดๆ–ฐไธญ...":"ๆ›ดๆ–ฐ่‡ชๅฎšไน‰ Token"})]})]}),e.jsxs("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3 sm:p-4",children:[e.jsx("h4",{className:"text-sm sm:text-base font-semibold text-yellow-900 dark:text-yellow-200 mb-2",children:"ๅฎ‰ๅ…จๆ็คบ"}),e.jsxs("ul",{className:"text-xs sm:text-sm text-yellow-800 dark:text-yellow-300 space-y-1 list-disc list-inside",children:[e.jsx("li",{children:"้‡ๆ–ฐ็”Ÿๆˆ Token ไผšๅˆ›ๅปบ็ณป็ปŸ้šๆœบ็”Ÿๆˆ็š„ 64 ไฝๅฎ‰ๅ…จไปค็‰Œ"}),e.jsx("li",{children:"่‡ชๅฎšไน‰ Token ๅฟ…้กปๆปก่ถณๆ‰€ๆœ‰ๅฎ‰ๅ…จ่ฆๆฑ‚ๆ‰่ƒฝไฝฟ็”จ"}),e.jsx("li",{children:"ๆ›ดๆ–ฐ Token ๅŽ๏ผŒๆ—ง็š„ Token ๅฐ†็ซ‹ๅณๅคฑๆ•ˆ"}),e.jsx("li",{children:"่ฏทๅœจๅฎ‰ๅ…จ็š„็Žฏๅขƒไธ‹ๆŸฅ็œ‹ๅ’Œๅคๅˆถ Token"}),e.jsx("li",{children:"ๅฆ‚ๆžœๆ€€็–‘ Token ๆณ„้œฒ๏ผŒ่ฏท็ซ‹ๅณ้‡ๆ–ฐ็”Ÿๆˆๆˆ–ๆ›ดๆ–ฐ"}),e.jsx("li",{children:"ๅปบ่ฎฎไฝฟ็”จ็ณป็ปŸ็”Ÿๆˆ็š„ Token ไปฅ่Žทๅพ—ๆœ€้ซ˜ๅฎ‰ๅ…จๆ€ง"})]})]})]})}function A2(){const a=ha(),{toast:l}=nt(),[r,c]=u.useState(!1),[d,m]=u.useState(!1),[h,f]=u.useState(()=>zt("logCacheSize")),[p,g]=u.useState(()=>zt("wsReconnectInterval")),[N,j]=u.useState(()=>zt("wsMaxReconnectAttempts")),[b,y]=u.useState(()=>zt("dataSyncInterval")),[w,z]=u.useState(()=>Bg()),[M,S]=u.useState(!1),[F,E]=u.useState(!1),C=u.useRef(null);if(d)throw new Error("่ฟ™ๆ˜ฏไธ€ไธชๆ‰‹ๅŠจ่งฆๅ‘็š„ๆต‹่ฏ•้”™่ฏฏ๏ผŒ็”จไบŽ้ชŒ่ฏ้”™่ฏฏ่พน็•Œ็ป„ไปถๆ˜ฏๅฆๆญฃๅธธๅทฅไฝœใ€‚");const R=()=>{z(Bg())},H=D=>{const Q=D[0];f(Q),Yr("logCacheSize",Q)},O=D=>{const Q=D[0];g(Q),Yr("wsReconnectInterval",Q)},X=D=>{const Q=D[0];j(Q),Yr("wsMaxReconnectAttempts",Q)},L=D=>{const Q=D[0];y(Q),Yr("dataSyncInterval",Q)},me=()=>{Qn.clearLogs(),l({title:"ๆ—ฅๅฟ—ๅทฒๆธ…้™ค",description:"ๆ—ฅๅฟ—็ผ“ๅญ˜ๅทฒๆธ…็ฉบ"})},Ne=()=>{const D=_2();R(),l({title:"็ผ“ๅญ˜ๅทฒๆธ…้™ค",description:`ๅทฒๆธ…้™ค ${D.clearedKeys.length} ้กน็ผ“ๅญ˜ๆ•ฐๆฎ`})},je=()=>{S(!0);try{const D=b2(),Q=JSON.stringify(D,null,2),B=new Blob([Q],{type:"application/json"}),ue=URL.createObjectURL(B),Y=document.createElement("a");Y.href=ue,Y.download=`maibot-webui-settings-${new Date().toISOString().slice(0,10)}.json`,document.body.appendChild(Y),Y.click(),document.body.removeChild(Y),URL.revokeObjectURL(ue),l({title:"ๅฏผๅ‡บๆˆๅŠŸ",description:"่ฎพ็ฝฎๅทฒๅฏผๅ‡บไธบ JSON ๆ–‡ไปถ"})}catch(D){console.error("ๅฏผๅ‡บ่ฎพ็ฝฎๅคฑ่ดฅ:",D),l({title:"ๅฏผๅ‡บๅคฑ่ดฅ",description:"ๆ— ๆณ•ๅฏผๅ‡บ่ฎพ็ฝฎ",variant:"destructive"})}finally{S(!1)}},ce=D=>{const Q=D.target.files?.[0];if(!Q)return;E(!0);const B=new FileReader;B.onload=ue=>{try{const Y=ue.target?.result,we=JSON.parse(Y),fe=y2(we);fe.success?(f(zt("logCacheSize")),g(zt("wsReconnectInterval")),j(zt("wsMaxReconnectAttempts")),y(zt("dataSyncInterval")),R(),l({title:"ๅฏผๅ…ฅๆˆๅŠŸ",description:`ๆˆๅŠŸๅฏผๅ…ฅ ${fe.imported.length} ้กน่ฎพ็ฝฎ${fe.skipped.length>0?`๏ผŒ่ทณ่ฟ‡ ${fe.skipped.length} ้กน`:""}`}),(fe.imported.includes("theme")||fe.imported.includes("accentColor"))&&l({title:"ๆ็คบ",description:"้ƒจๅˆ†่ฎพ็ฝฎ้œ€่ฆๅˆทๆ–ฐ้กต้ขๆ‰่ƒฝๅฎŒๅ…จ็”Ÿๆ•ˆ"})):l({title:"ๅฏผๅ…ฅๅคฑ่ดฅ",description:"ๆฒกๆœ‰ๆœ‰ๆ•ˆ็š„่ฎพ็ฝฎ้กนๅฏๅฏผๅ…ฅ",variant:"destructive"})}catch(Y){console.error("ๅฏผๅ…ฅ่ฎพ็ฝฎๅคฑ่ดฅ:",Y),l({title:"ๅฏผๅ…ฅๅคฑ่ดฅ",description:"ๆ–‡ไปถๆ ผๅผๆ— ๆ•ˆ",variant:"destructive"})}finally{E(!1),C.current&&(C.current.value="")}},B.readAsText(Q)},ge=()=>{w2(),f(jl.logCacheSize),g(jl.wsReconnectInterval),j(jl.wsMaxReconnectAttempts),y(jl.dataSyncInterval),R(),l({title:"ๅทฒ้‡็ฝฎ",description:"ๆ‰€ๆœ‰่ฎพ็ฝฎๅทฒๆขๅคไธบ้ป˜่ฎคๅ€ผ๏ผŒๅˆทๆ–ฐ้กต้ขไปฅๅบ”็”จๆ›ดๆ”น"})},pe=async()=>{c(!0);try{const D=await ke("/api/webui/setup/reset",{method:"POST"}),Q=await D.json();D.ok&&Q.success?(l({title:"้‡็ฝฎๆˆๅŠŸ",description:"ๅณๅฐ†่ฟ›ๅ…ฅๅˆๆฌก้…็ฝฎๅ‘ๅฏผ"}),setTimeout(()=>{a({to:"/setup"})},1e3)):l({title:"้‡็ฝฎๅคฑ่ดฅ",description:Q.message||"ๆ— ๆณ•้‡็ฝฎ้…็ฝฎ็Šถๆ€",variant:"destructive"})}catch(D){console.error("้‡็ฝฎ้…็ฝฎ็Šถๆ€้”™่ฏฏ:",D),l({title:"้‡็ฝฎๅคฑ่ดฅ",description:"่ฟžๆŽฅๆœๅŠกๅ™จๅคฑ่ดฅ",variant:"destructive"})}finally{c(!1)}};return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4 flex items-center gap-2",children:[e.jsx(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(z1,{className:"h-4 w-4"}),"ๆœฌๅœฐๅญ˜ๅ‚จไฝฟ็”จ"]}),e.jsx(_,{variant:"ghost",size:"sm",onClick:R,className:"h-7 px-2",children:e.jsx(dt,{className:"h-3 w-3"})})]}),e.jsx("div",{className:"text-2xl font-bold text-primary",children:S2(w.used)}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[w.items," ไธชๅญ˜ๅ‚จ้กน"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-sm font-medium",children:"ๆ—ฅๅฟ—็ผ“ๅญ˜ๅคงๅฐ"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[h," ๆก"]})]}),e.jsx(el,{value:[h],onValueChange:H,min:100,max:5e3,step:100,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆŽงๅˆถๆ—ฅๅฟ—ๆŸฅ็œ‹ๅ™จๆœ€ๅคš็ผ“ๅญ˜็š„ๆ—ฅๅฟ—ๆกๆ•ฐ๏ผŒ่พƒๅคง็š„ๅ€ผไผšๅ ็”จๆ›ดๅคšๅ†…ๅญ˜"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-sm font-medium",children:"้ฆ–้กตๆ•ฐๆฎๅˆทๆ–ฐ้—ด้š”"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[b," ็ง’"]})]}),e.jsx(el,{value:[b],onValueChange:L,min:10,max:120,step:5,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆŽงๅˆถ้ฆ–้กต็ปŸ่ฎกๆ•ฐๆฎ็š„่‡ชๅŠจๅˆทๆ–ฐ้—ด้š”"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-sm font-medium",children:"WebSocket ้‡่ฟž้—ด้š”"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[p/1e3," ็ง’"]})]}),e.jsx(el,{value:[p],onValueChange:O,min:1e3,max:1e4,step:500,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆ—ฅๅฟ— WebSocket ่ฟžๆŽฅๆ–ญๅผ€ๅŽ็š„้‡่ฟžๅŸบ็ก€้—ด้š”"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-sm font-medium",children:"WebSocket ๆœ€ๅคง้‡่ฟžๆฌกๆ•ฐ"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[N," ๆฌก"]})]}),e.jsx(el,{value:[N],onValueChange:X,min:3,max:30,step:1,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"่ฟžๆŽฅๅคฑ่ดฅๅŽ็š„ๆœ€ๅคง้‡่ฟžๅฐ่ฏ•ๆฌกๆ•ฐ"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 pt-2",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:me,className:"gap-2",children:[e.jsx(os,{className:"h-4 w-4"}),"ๆธ…้™คๆ—ฅๅฟ—็ผ“ๅญ˜"]}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:"gap-2",children:[e.jsx(os,{className:"h-4 w-4"}),"ๆธ…้™คๆœฌๅœฐ็ผ“ๅญ˜"]})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๆธ…้™คๆœฌๅœฐ็ผ“ๅญ˜"}),e.jsx(gs,{children:"่ฟ™ๅฐ†ๆธ…้™คๆ‰€ๆœ‰ๆœฌๅœฐ็ผ“ๅญ˜็š„่ฎพ็ฝฎๅ’Œๆ•ฐๆฎ๏ผˆไธๅŒ…ๆ‹ฌ็™ปๅฝ•ๅ‡ญ่ฏ๏ผ‰ใ€‚ ๆ‚จๅฏ่ƒฝ้œ€่ฆ้‡ๆ–ฐ้…็ฝฎ้ƒจๅˆ†ๅๅฅฝ่ฎพ็ฝฎใ€‚็กฎๅฎš่ฆ็ปง็ปญๅ—๏ผŸ"})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:Ne,children:"็กฎ่ฎคๆธ…้™ค"})]})]})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4 flex items-center gap-2",children:[e.jsx(na,{className:"h-5 w-5"}),"ๅฏผๅ…ฅ/ๅฏผๅ‡บ่ฎพ็ฝฎ"]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"ๅฏผๅ‡บๅฝ“ๅ‰็š„็•Œ้ข่ฎพ็ฝฎไปฅไพฟๅค‡ไปฝ๏ผŒๆˆ–ไปŽไน‹ๅ‰ๅฏผๅ‡บ็š„ๆ–‡ไปถไธญๆขๅค่ฎพ็ฝฎใ€‚"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(_,{variant:"outline",onClick:je,disabled:M,className:"gap-2",children:[e.jsx(na,{className:"h-4 w-4"}),M?"ๅฏผๅ‡บไธญ...":"ๅฏผๅ‡บ่ฎพ็ฝฎ"]}),e.jsx("input",{ref:C,type:"file",accept:".json",onChange:ce,className:"hidden"}),e.jsxs(_,{variant:"outline",onClick:()=>C.current?.click(),disabled:F,className:"gap-2",children:[e.jsx(cc,{className:"h-4 w-4"}),F?"ๅฏผๅ…ฅไธญ...":"ๅฏผๅ…ฅ่ฎพ็ฝฎ"]})]}),e.jsx("div",{className:"pt-2 border-t",children:e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:"gap-2 text-destructive hover:text-destructive",children:[e.jsx(rc,{className:"h-4 w-4"}),"้‡็ฝฎๆ‰€ๆœ‰่ฎพ็ฝฎไธบ้ป˜่ฎคๅ€ผ"]})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎค้‡็ฝฎๆ‰€ๆœ‰่ฎพ็ฝฎ"}),e.jsx(gs,{children:"่ฟ™ๅฐ†ๆŠŠๆ‰€ๆœ‰็•Œ้ข่ฎพ็ฝฎๆขๅคไธบ้ป˜่ฎคๅ€ผ๏ผŒๅŒ…ๆ‹ฌไธป้ข˜ใ€้ขœ่‰ฒใ€ๅŠจ็”ป็ญ‰ๅๅฅฝ่ฎพ็ฝฎใ€‚ ๆญคๆ“ไฝœไธไผšๅฝฑๅ“ๆ‚จ็š„็™ปๅฝ•็Šถๆ€ใ€‚็กฎๅฎš่ฆ็ปง็ปญๅ—๏ผŸ"})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{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(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{variant:"outline",disabled:r,className:"gap-2",children:[e.jsx(rc,{className:P("h-4 w-4",r&&"animate-spin")}),"้‡ๆ–ฐ่ฟ›่กŒๅˆๆฌก้…็ฝฎ"]})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎค้‡ๆ–ฐ้…็ฝฎ"}),e.jsx(gs,{children:"่ฟ™ๅฐ†ๅธฆๆ‚จ้‡ๆ–ฐ่ฟ›ๅ…ฅๅˆๆฌก้…็ฝฎๅ‘ๅฏผใ€‚ๆ‚จๅฏไปฅ้‡ๆ–ฐ่ฎพ็ฝฎ็ณป็ปŸ็š„ๅŸบ็ก€้…็ฝฎ้กนใ€‚็กฎๅฎš่ฆ็ปง็ปญๅ—๏ผŸ"})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:pe,children:"็กฎ่ฎค้‡็ฝฎ"})]})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border border-dashed border-yellow-500/50 bg-yellow-500/5 p-4 sm:p-6",children:[e.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4 flex items-center gap-2",children:[e.jsx(Lt,{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(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{variant:"destructive",className:"gap-2",children:[e.jsx(Lt,{className:"h-4 w-4"}),"่งฆๅ‘ๆต‹่ฏ•้”™่ฏฏ"]})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎค่งฆๅ‘้”™่ฏฏ"}),e.jsx(gs,{children:"่ฟ™ๅฐ†ๆ‰‹ๅŠจ่งฆๅ‘ไธ€ไธช React ้”™่ฏฏ๏ผŒ็”จไบŽๆต‹่ฏ•้”™่ฏฏ่พน็•Œ็ป„ไปถ็š„ๆ˜พ็คบๆ•ˆๆžœใ€‚ ้กต้ขๅฐ†ๆ˜พ็คบ้”™่ฏฏ็•Œ้ข๏ผŒๆ‚จๅฏไปฅ้€š่ฟ‡ๅˆทๆ–ฐ้กต้ขๆˆ–็‚นๅ‡ป่ฟ”ๅ›ž้ฆ–้กตๆฅๆขๅคใ€‚"})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:()=>m(!0),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"็กฎ่ฎค่งฆๅ‘"})]})]})]})]})]})]})}function z2(){return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsx("div",{className:"rounded-lg border-2 border-primary/30 bg-gradient-to-r from-primary/5 to-primary/10 p-4 sm:p-6",children:e.jsxs("div",{className:"flex items-start gap-3 sm:gap-4",children:[e.jsx("div",{className:"flex-shrink-0 rounded-lg bg-primary/10 p-2 sm:p-3",children:e.jsx("svg",{className:"h-6 w-6 sm:h-8 sm:w-8 text-primary",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:e.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-lg sm:text-xl font-bold text-foreground mb-2",children:"ๅผ€ๆบ้กน็›ฎ"}),e.jsx("p",{className:"text-sm sm:text-base text-muted-foreground mb-3",children:"ๆœฌ้กน็›ฎๅœจ GitHub ๅผ€ๆบ๏ผŒๆฌข่ฟŽ Star โญ ๆ”ฏๆŒ๏ผ"}),e.jsxs("a",{href:"https://github.com/Mai-with-u/MaiBot-Dashboard",target:"_blank",rel:"noopener noreferrer",className:P("inline-flex items-center gap-2 px-4 py-2 rounded-lg","bg-primary text-primary-foreground font-medium text-sm","hover:bg-primary/90 transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"),children:[e.jsx("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:e.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})}),"ๅ‰ๅพ€ GitHub",e.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})]})]})}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:["ๅ…ณไบŽ ",Nx]}),e.jsxs("div",{className:"space-y-2 text-xs sm:text-sm text-muted-foreground",children:[e.jsxs("p",{children:["็‰ˆๆœฌ: ",ud]}),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(ts,{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(Et,{name:"React",description:"็”จๆˆท็•Œ้ขๆž„ๅปบๅบ“",license:"MIT"}),e.jsx(Et,{name:"shadcn/ui",description:"ไผ˜้›…็š„ React ็ป„ไปถๅบ“",license:"MIT"}),e.jsx(Et,{name:"Radix UI",description:"ๆ— ๆ ทๅผ็š„ๅฏ่ฎฟ้—ฎ็ป„ไปถๅบ“",license:"MIT"}),e.jsx(Et,{name:"Tailwind CSS",description:"ๅฎž็”จไผ˜ๅ…ˆ็š„ CSS ๆก†ๆžถ",license:"MIT"}),e.jsx(Et,{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(Et,{name:"TanStack Router",description:"็ฑปๅž‹ๅฎ‰ๅ…จ็š„่ทฏ็”ฑๅบ“",license:"MIT"}),e.jsx(Et,{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(Et,{name:"React Hook Form",description:"้ซ˜ๆ€ง่ƒฝ่กจๅ•ๅบ“",license:"MIT"}),e.jsx(Et,{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(Et,{name:"clsx",description:"ๆกไปถ className ๆž„ๅปบๅทฅๅ…ท",license:"MIT"}),e.jsx(Et,{name:"tailwind-merge",description:"Tailwind ็ฑปๅๅˆๅนถๅทฅๅ…ท",license:"MIT"}),e.jsx(Et,{name:"class-variance-authority",description:"็ป„ไปถๅ˜ไฝ“็ฎก็†",license:"Apache-2.0"}),e.jsx(Et,{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(Et,{name:"Framer Motion",description:"React ๅŠจ็”ปๅบ“",license:"MIT"}),e.jsx(Et,{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(Et,{name:"FastAPI",description:"็ŽฐไปฃๅŒ– Python Web ๆก†ๆžถ",license:"MIT"}),e.jsx(Et,{name:"Uvicorn",description:"ASGI ๆœๅŠกๅ™จ",license:"BSD-3-Clause"}),e.jsx(Et,{name:"Pydantic",description:"ๆ•ฐๆฎ้ชŒ่ฏๅบ“",license:"MIT"}),e.jsx(Et,{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(Et,{name:"TypeScript",description:"JavaScript ็š„่ถ…้›†",license:"Apache-2.0"}),e.jsx(Et,{name:"Vite",description:"ไธ‹ไธ€ไปฃๅ‰็ซฏๆž„ๅปบๅทฅๅ…ท",license:"MIT"}),e.jsx(Et,{name:"ESLint",description:"JavaScript ไปฃ็ ๆฃ€ๆŸฅๅทฅๅ…ท",license:"MIT"}),e.jsx(Et,{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 Et({name:a,description:l,license:r}){return e.jsxs("div",{className:"flex items-start justify-between gap-2 rounded-lg border bg-muted/30 p-2.5 sm:p-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium text-foreground truncate",children:a}),e.jsx("p",{className:"text-muted-foreground text-xs mt-0.5",children:l})]}),e.jsx("span",{className:"inline-flex items-center rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary flex-shrink-0",children:r})]})}function Bm({value:a,current:l,onChange:r,label:c,description:d}){const m=l===a;return e.jsxs("button",{onClick:()=>r(a),className:P("relative rounded-lg border-2 p-3 sm:p-4 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",m?"border-primary bg-accent":"border-border"),children:[m&&e.jsx("div",{className:"absolute top-2 right-2 sm:top-3 sm:right-3 h-2 w-2 rounded-full bg-primary"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm sm:text-base font-medium",children:c}),e.jsx("div",{className:"text-[10px] sm:text-xs text-muted-foreground",children:d})]}),e.jsxs("div",{className:"mt-2 sm:mt-3 flex gap-1",children:[a==="light"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-200"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-300"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-400"})]}),a==="dark"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-700"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-800"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-900"})]}),a==="system"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-200 to-slate-700"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-300 to-slate-800"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-400 to-slate-900"})]})]})]})}function Wa({value:a,current:l,onChange:r,label:c,colorClass:d}){const m=l===a;return e.jsxs("button",{onClick:()=>r(a),className:P("relative rounded-lg border-2 p-2 sm:p-3 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",m?"border-primary bg-accent":"border-border"),children:[m&&e.jsx("div",{className:"absolute top-1.5 right-1.5 sm:top-2 sm:right-2 h-1.5 w-1.5 sm:h-2 sm:w-2 rounded-full bg-primary"}),e.jsxs("div",{className:"flex flex-col items-center gap-1.5 sm:gap-2",children:[e.jsx("div",{className:P("h-8 w-8 sm:h-10 sm:w-10 rounded-full",d)}),e.jsx("div",{className:"text-[10px] sm:text-xs font-medium text-center",children:c})]})]})}const R2=Date.now()%1e6;class D2{grad3;p;perm;constructor(l=0){this.grad3=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]],this.p=[];for(let r=0;r<256;r++)this.p[r]=Math.floor(Math.random()*256);this.perm=[];for(let r=0;r<512;r++)this.perm[r]=this.p[r&255]}dot(l,r,c){return l[0]*r+l[1]*c}mix(l,r,c){return(1-c)*l+c*r}fade(l){return l*l*l*(l*(l*6-15)+10)}perlin2(l,r){const c=Math.floor(l)&255,d=Math.floor(r)&255;l-=Math.floor(l),r-=Math.floor(r);const m=this.fade(l),h=this.fade(r),f=this.perm[c]+d,p=this.perm[f],g=this.perm[f+1],N=this.perm[c+1]+d,j=this.perm[N],b=this.perm[N+1];return this.mix(this.mix(this.dot(this.grad3[p%12],l,r),this.dot(this.grad3[j%12],l-1,r),m),this.mix(this.dot(this.grad3[g%12],l,r-1),this.dot(this.grad3[b%12],l-1,r-1),m),h)}}function Pg(){const a=u.useRef(null),l=u.useRef(null),r=u.useRef(void 0),[c]=u.useState(()=>new D2(R2)),d=u.useRef({mouse:{x:-10,y:0,lx:0,ly:0,sx:0,sy:0,v:0,vs:0,a:0,set:!1},lines:[],paths:[],noise:c,bounding:null});return u.useEffect(()=>{const m=l.current,h=a.current;if(!m||!h)return;const f=d.current;f.noise=c;const p=()=>{const M=m.getBoundingClientRect();f.bounding=M,h.style.width=`${M.width}px`,h.style.height=`${M.height}px`},g=()=>{if(!f.bounding)return;const{width:M,height:S}=f.bounding;f.lines=[],f.paths.forEach(me=>me.remove()),f.paths=[];const F=10,E=32,C=M+200,R=S+30,H=Math.ceil(C/F),O=Math.ceil(R/E),X=(M-F*H)/2,L=(S-E*O)/2;for(let me=0;me<=H;me++){const Ne=[];for(let ce=0;ce<=O;ce++){const ge={x:X+F*me,y:L+E*ce,wave:{x:0,y:0},cursor:{x:0,y:0,vx:0,vy:0}};Ne.push(ge)}const je=document.createElementNS("http://www.w3.org/2000/svg","path");h.appendChild(je),f.paths.push(je),f.lines.push(Ne)}},N=M=>{const{lines:S,mouse:F,noise:E}=f;S.forEach(C=>{C.forEach(R=>{const H=E.perlin2((R.x+M*.0125)*.002,(R.y+M*.005)*.0015)*12;R.wave.x=Math.cos(H)*32,R.wave.y=Math.sin(H)*16;const O=R.x-F.sx,X=R.y-F.sy,L=Math.hypot(O,X),me=Math.max(175,F.vs);if(L{const F={x:M.x+M.wave.x+(S?M.cursor.x:0),y:M.y+M.wave.y+(S?M.cursor.y:0)};return F.x=Math.round(F.x*10)/10,F.y=Math.round(F.y*10)/10,F},b=()=>{const{lines:M,paths:S}=f;M.forEach((F,E)=>{let C=j(F[0],!1),R=`M ${C.x} ${C.y}`;F.forEach((H,O)=>{const X=O===F.length-1;C=j(H,!X),R+=`L ${C.x} ${C.y}`}),S[E].setAttribute("d",R)})},y=M=>{const{mouse:S}=f;S.sx+=(S.x-S.sx)*.1,S.sy+=(S.y-S.sy)*.1;const F=S.x-S.lx,E=S.y-S.ly,C=Math.hypot(F,E);S.v=C,S.vs+=(C-S.vs)*.1,S.vs=Math.min(100,S.vs),S.lx=S.x,S.ly=S.y,S.a=Math.atan2(E,F),m&&(m.style.setProperty("--x",`${S.sx}px`),m.style.setProperty("--y",`${S.sy}px`)),N(M),b(),r.current=requestAnimationFrame(y)},w=M=>{if(!f.bounding)return;const{mouse:S}=f;S.x=M.pageX-f.bounding.left,S.y=M.pageY-f.bounding.top+window.scrollY,S.set||(S.sx=S.x,S.sy=S.y,S.lx=S.x,S.ly=S.y,S.set=!0)},z=()=>{p(),g()};return p(),g(),window.addEventListener("resize",z),window.addEventListener("mousemove",w),r.current=requestAnimationFrame(y),()=>{window.removeEventListener("resize",z),window.removeEventListener("mousemove",w),r.current&&cancelAnimationFrame(r.current)}},[c]),e.jsxs("div",{ref:l,className:"waves-background",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"hidden",pointerEvents:"none"},children:[e.jsx("div",{className:"waves-cursor",style:{position:"absolute",top:0,left:0,width:"0.5rem",height:"0.5rem",background:"hsl(var(--primary) / 0.3)",borderRadius:"50%",transform:"translate3d(calc(var(--x, -0.5rem) - 50%), calc(var(--y, 50%) - 50%), 0)",willChange:"transform",pointerEvents:"none"}}),e.jsx("svg",{ref:a,style:{display:"block",width:"100%",height:"100%"},children:e.jsx("style",{children:` +`)}}):null},Qi=$j,Qr=u.forwardRef(({active:a,payload:l,className:r,indicator:c="dot",hideLabel:d=!1,hideIndicator:m=!1,label:h,labelFormatter:f,labelClassName:p,formatter:g,color:N,nameKey:j,labelKey:b},y)=>{const{config:w}=Av(),z=u.useMemo(()=>{if(d||!l?.length)return null;const[S]=l,F=`${b||S?.dataKey||S?.name||"value"}`,E=Zm(w,S,F),C=!b&&typeof h=="string"?w[h]?.label||h:E?.label;return f?e.jsx("div",{className:P("font-medium",p),children:f(C,l)}):C?e.jsx("div",{className:P("font-medium",p),children:C}):null},[h,f,l,d,p,w,b]);if(!a||!l?.length)return null;const M=l.length===1&&c!=="dot";return e.jsxs("div",{ref:y,className:P("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",r),children:[M?null:z,e.jsx("div",{className:"grid gap-1.5",children:l.filter(S=>S.type!=="none").map((S,F)=>{const E=`${j||S.name||S.dataKey||"value"}`,C=Zm(w,S,E),R=N||S.payload.fill||S.color;return e.jsx("div",{className:P("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",c==="dot"&&"items-center"),children:g&&S?.value!==void 0&&S.name?g(S.value,S.name,S,F,S.payload):e.jsxs(e.Fragment,{children:[C?.icon?e.jsx(C.icon,{}):!m&&e.jsx("div",{className:P("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":c==="dot","w-1":c==="line","w-0 border-[1.5px] border-dashed bg-transparent":c==="dashed","my-0.5":M&&c==="dashed"}),style:{"--color-bg":R,"--color-border":R}}),e.jsxs("div",{className:P("flex flex-1 justify-between leading-none",M?"items-end":"items-center"),children:[e.jsxs("div",{className:"grid gap-1.5",children:[M?z:null,e.jsx("span",{className:"text-muted-foreground",children:C?.label||S.name})]}),S.value&&e.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:S.value.toLocaleString()})]})]})},S.dataKey)})})]})});Qr.displayName="ChartTooltip";const F1=Zw,zv=u.forwardRef(({className:a,hideIcon:l=!1,payload:r,verticalAlign:c="bottom",nameKey:d},m)=>{const{config:h}=Av();return r?.length?e.jsx("div",{ref:m,className:P("flex items-center justify-center gap-4",c==="top"?"pb-3":"pt-3",a),children:r.filter(f=>f.type!=="none").map(f=>{const p=`${d||f.dataKey||"value"}`,g=Zm(h,f,p);return e.jsxs("div",{className:P("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[g?.icon&&!l?e.jsx(g.icon,{}):e.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:f.color}}),g?.label]},f.value)})}):null});zv.displayName="ChartLegend";function Zm(a,l,r){if(typeof l!="object"||l===null)return;const c="payload"in l&&typeof l.payload=="object"&&l.payload!==null?l.payload:void 0;let d=r;return r in l&&typeof l[r]=="string"?d=l[r]:c&&r in c&&typeof c[r]=="string"&&(d=c[r]),d in a?a[d]:a[r]}const si=ti("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),_=u.forwardRef(({className:a,variant:l,size:r,asChild:c=!1,...d},m)=>{const h=c?l_:"button";return e.jsx(h,{className:P(si({variant:l,size:r,className:a})),ref:m,...d})});_.displayName="Button";const H1=ti("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Ce({className:a,variant:l,...r}){return e.jsx("div",{className:P(H1({variant:l}),a),...r})}async function q1(){const a=await ke("/api/webui/system/restart",{method:"POST",headers:Zs()});if(!a.ok){const l=await a.json();throw new Error(l.detail||"้‡ๅฏๅคฑ่ดฅ")}return await a.json()}async function V1(){const a=await ke("/api/webui/system/status",{method:"GET",headers:Zs()});if(!a.ok){const l=await a.json();throw new Error(l.detail||"่Žทๅ–็Šถๆ€ๅคฑ่ดฅ")}return await a.json()}const Hr={INITIAL_DELAY:3e3,CHECK_INTERVAL:2e3,CHECK_TIMEOUT:3e3,MAX_ATTEMPTS:60,PROGRESS_INTERVAL:200,SUCCESS_REDIRECT_DELAY:1500},Rv=u.createContext(null);function lr({children:a,onRestartComplete:l,onRestartFailed:r,healthCheckUrl:c="/api/webui/system/status",maxAttempts:d=Hr.MAX_ATTEMPTS}){const[m,h]=u.useState({status:"idle",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:d}),f=u.useRef({}),p=u.useCallback(()=>{const z=f.current;z.progress&&(clearInterval(z.progress),z.progress=void 0),z.elapsed&&(clearInterval(z.elapsed),z.elapsed=void 0),z.check&&(clearTimeout(z.check),z.check=void 0)},[]),g=u.useCallback(()=>{p(),h({status:"idle",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:d})},[p,d]),N=u.useCallback(async()=>{try{const z=new AbortController,M=setTimeout(()=>z.abort(),Hr.CHECK_TIMEOUT),S=await fetch(c,{method:"GET",headers:{"Content-Type":"application/json"},credentials:"include",signal:z.signal});return clearTimeout(M),S.ok}catch{return!1}},[c]),j=u.useCallback(()=>{let z=0;const M=async()=>{if(z++,h(F=>({...F,status:"checking",checkAttempts:z})),await N())p(),h(F=>({...F,status:"success",progress:100})),setTimeout(()=>{l?.(),window.location.href="/auth"},Hr.SUCCESS_REDIRECT_DELAY);else if(z>=d){p();const F=`ๅฅๅบทๆฃ€ๆŸฅ่ถ…ๆ—ถ (${z}/${d})`;h(E=>({...E,status:"failed",error:F})),r?.(F)}else{const F=setTimeout(M,Hr.CHECK_INTERVAL);f.current.check=F}};M()},[N,p,d,l,r]),b=u.useCallback(()=>{h(z=>({...z,status:"checking",checkAttempts:0,error:void 0})),j()},[j]),y=u.useCallback(async z=>{const{delay:M=0,skipApiCall:S=!1}=z??{};if(m.status!=="idle"&&m.status!=="failed")return;if(p(),h({status:"requesting",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:d}),M>0&&await new Promise(C=>setTimeout(C,M)),S)h(C=>({...C,status:"restarting"}));else try{h(C=>({...C,status:"restarting"})),await Promise.race([q1(),new Promise(C=>setTimeout(C,5e3))])}catch{}const F=setInterval(()=>{h(C=>({...C,progress:C.progress>=90?C.progress:C.progress+1}))},Hr.PROGRESS_INTERVAL),E=setInterval(()=>{h(C=>({...C,elapsedTime:C.elapsedTime+1}))},1e3);f.current.progress=F,f.current.elapsed=E,setTimeout(()=>{j()},Hr.INITIAL_DELAY)},[m.status,p,d,j]),w={state:m,isRestarting:m.status!=="idle",triggerRestart:y,resetState:g,retryHealthCheck:b};return e.jsx(Rv.Provider,{value:w,children:a})}function Tn(){const a=u.useContext(Rv);if(!a)throw new Error("useRestart must be used within a RestartProvider");return a}function G1(){try{return Tn()}catch{return null}}const K1=(a,l,r,c,d)=>({idle:{icon:null,title:"",description:"",tip:""},requesting:{icon:e.jsx(Fs,{className:"h-16 w-16 text-primary animate-spin"}),title:c??"ๅ‡†ๅค‡้‡ๅฏ",description:d??"ๆญฃๅœจๅ‘้€้‡ๅฏ่ฏทๆฑ‚...",tip:"๐Ÿ”„ ๆญฃๅœจๅ‡†ๅค‡้‡ๅฏ้บฆ้บฆ..."},restarting:{icon:e.jsx(Fs,{className:"h-16 w-16 text-primary animate-spin"}),title:c??"ๆญฃๅœจ้‡ๅฏ้บฆ้บฆ",description:d??"่ฏท็จๅ€™๏ผŒ้บฆ้บฆๆญฃๅœจ้‡ๅฏไธญ...",tip:"๐Ÿ”„ ้…็ฝฎๅทฒไฟๅญ˜๏ผŒๆญฃๅœจ้‡ๅฏไธป็จ‹ๅบ..."},checking:{icon:e.jsx(Fs,{className:"h-16 w-16 text-primary animate-spin"}),title:"ๆฃ€ๆŸฅๆœๅŠก็Šถๆ€",description:`็ญ‰ๅพ…ๆœๅŠกๆขๅค... (${l}/${r})`,tip:"โณ ๆญฃๅœจ็ญ‰ๅพ…ๆœๅŠกๆขๅค๏ผŒ่ฏทๅ‹ฟๅ…ณ้—ญ้กต้ข..."},success:{icon:e.jsx(st,{className:"h-16 w-16 text-green-500"}),title:"้‡ๅฏๆˆๅŠŸ",description:"ๆญฃๅœจ่ทณ่ฝฌๅˆฐ็™ปๅฝ•้กต้ข...",tip:"โœ… ้…็ฝฎๅทฒ็”Ÿๆ•ˆ๏ผŒๆœๅŠก่ฟ่กŒๆญฃๅธธ"},failed:{icon:e.jsx(Ut,{className:"h-16 w-16 text-destructive"}),title:"้‡ๅฏ่ถ…ๆ—ถ",description:"ๆœๅŠกๆœช่ƒฝๅœจ้ข„ๆœŸๆ—ถ้—ดๅ†…ๆขๅค",tip:"โš ๏ธ ๅฆ‚ๆžœ้•ฟๆ—ถ้—ดๆ— ๅ“ๅบ”๏ผŒ่ฏทๅฐ่ฏ•ๆ‰‹ๅŠจ้‡ๅฏ"}})[a];function nr({visible:a,onComplete:l,onFailed:r,title:c,description:d,showAnimation:m=!0,className:h}){const f=G1();return(f?f.isRestarting:a)?f?e.jsx(Dv,{state:f.state,onRetry:f.retryHealthCheck,onComplete:l,onFailed:r,title:c,description:d,showAnimation:m,className:h}):e.jsx(Q1,{onComplete:l,onFailed:r,title:c,description:d,showAnimation:m,className:h}):null}function Dv({state:a,onRetry:l,onComplete:r,onFailed:c,title:d,description:m,showAnimation:h,className:f}){const{status:p,progress:g,elapsedTime:N,checkAttempts:j,maxAttempts:b}=a;u.useEffect(()=>{p==="success"&&r?r():p==="failed"&&c&&c()},[p,r,c]);const y=K1(p,j,b,d,m),w=z=>{const M=Math.floor(z/60),S=z%60;return`${M}:${S.toString().padStart(2,"0")}`};return e.jsxs("div",{className:P("fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center",f),children:[h&&e.jsx(Y1,{}),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:[y.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:y.title}),e.jsx("p",{className:"text-muted-foreground text-center",children:y.description})]}),p!=="failed"&&p!=="idle"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(tr,{value:g,className:"h-2"}),e.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[e.jsxs("span",{children:[g,"%"]}),e.jsxs("span",{children:["ๅทฒ็”จๆ—ถ: ",w(N)]})]})]}),e.jsx("div",{className:"bg-muted/50 rounded-lg p-4",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:y.tip})}),p==="failed"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(_,{onClick:()=>window.location.reload(),variant:"default",className:"flex-1",children:[e.jsx(dt,{className:"mr-2 h-4 w-4"}),"ๅˆทๆ–ฐ้กต้ข"]}),e.jsxs(_,{onClick:l,variant:"secondary",className:"flex-1",children:[e.jsx(rc,{className:"mr-2 h-4 w-4"}),"้‡่ฏ•ๆฃ€ๆต‹"]})]})]})]})}function Q1({onComplete:a,onFailed:l,title:r,description:c,showAnimation:d,className:m}){const[h,f]=u.useState({status:"restarting",progress:0,elapsedTime:0,checkAttempts:0,maxAttempts:60}),p=u.useCallback(()=>{let g=0;const N=60,j=async()=>{g++,f(b=>({...b,status:"checking",checkAttempts:g}));try{if((await fetch("/api/webui/system/status",{method:"GET",signal:AbortSignal.timeout(3e3)})).ok){f(y=>({...y,status:"success",progress:100})),setTimeout(()=>{a?.(),window.location.href="/auth"},1500);return}}catch{}g>=N?(f(b=>({...b,status:"failed"})),l?.()):setTimeout(j,2e3)};j()},[a,l]);return u.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),j=setTimeout(()=>{p()},3e3);return()=>{clearInterval(g),clearInterval(N),clearTimeout(j)}},[p]),e.jsx(Dv,{state:h,onRetry:p,onComplete:a,onFailed:l,title:r,description:c,showAnimation:d,className:m})}function Y1(){return e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsxs("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[600px] h-[600px]",children:[e.jsx("div",{className:"absolute inset-0 rounded-full border border-primary/10 animate-[ping_3s_ease-in-out_infinite]"}),e.jsx("div",{className:"absolute inset-8 rounded-full border border-primary/10 animate-[ping_3s_ease-in-out_infinite_0.5s]"}),e.jsx("div",{className:"absolute inset-16 rounded-full border border-primary/10 animate-[ping_3s_ease-in-out_infinite_1s]"})]}),e.jsx("div",{className:"absolute top-1/4 left-1/4 w-2 h-2 bg-primary/20 rounded-full animate-bounce"}),e.jsx("div",{className:"absolute top-3/4 right-1/4 w-3 h-3 bg-primary/15 rounded-full animate-bounce delay-150"}),e.jsx("div",{className:"absolute top-1/2 right-1/3 w-2 h-2 bg-primary/20 rounded-full animate-bounce delay-300"})]})}const Qs=i_,dd=c_,J1=n_,Ov=u.forwardRef(({className:a,...l},r)=>e.jsx(Ij,{ref:r,className:P("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),...l}));Ov.displayName=Ij.displayName;const Hs=u.forwardRef(({className:a,children:l,preventOutsideClose:r=!1,hideCloseButton:c=!1,...d},m)=>e.jsxs(J1,{children:[e.jsx(Ov,{}),e.jsxs(Bj,{ref:m,className:P("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",a),onPointerDownOutside:r?h=>h.preventDefault():void 0,onInteractOutside:r?h=>h.preventDefault():void 0,...d,children:[l,!c&&e.jsxs(r_,{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(Sa,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Hs.displayName=Bj.displayName;const qs=({className:a,...l})=>e.jsx("div",{className:P("flex flex-col space-y-1.5 text-center sm:text-left",a),...l});qs.displayName="DialogHeader";const gt=({className:a,...l})=>e.jsx("div",{className:P("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",a),...l});gt.displayName="DialogFooter";const Vs=u.forwardRef(({className:a,...l},r)=>e.jsx(Pj,{ref:r,className:P("text-lg font-semibold leading-none tracking-tight",a),...l}));Vs.displayName=Pj.displayName;const at=u.forwardRef(({className:a,...l},r)=>e.jsx(Fj,{ref:r,className:P("text-sm text-muted-foreground",a),...l}));at.displayName=Fj.displayName;const ae=u.forwardRef(({className:a,type:l,...r},c)=>e.jsx("input",{type:l,className:P("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",a),ref:c,...r}));ae.displayName="Input";const tt=u.forwardRef(({className:a,...l},r)=>e.jsx(Hj,{ref:r,className:P("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",a),...l,children:e.jsx(o_,{className:P("grid place-content-center text-current"),children:e.jsx(Ot,{className:"h-4 w-4"})})}));tt.displayName=Hj.displayName;const Pe=f_,Fe=p_,Ie=u.forwardRef(({className:a,children:l,...r},c)=>e.jsxs(qj,{ref:c,className:P("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",a),...r,children:[l,e.jsx(d_,{asChild:!0,children:e.jsx(Ia,{className:"h-4 w-4 opacity-50"})})]}));Ie.displayName=qj.displayName;const Lv=u.forwardRef(({className:a,...l},r)=>e.jsx(Vj,{ref:r,className:P("flex cursor-default items-center justify-center py-1",a),...l,children:e.jsx(Xr,{className:"h-4 w-4"})}));Lv.displayName=Vj.displayName;const Uv=u.forwardRef(({className:a,...l},r)=>e.jsx(Gj,{ref:r,className:P("flex cursor-default items-center justify-center py-1",a),...l,children:e.jsx(Ia,{className:"h-4 w-4"})}));Uv.displayName=Gj.displayName;const Be=u.forwardRef(({className:a,children:l,position:r="popper",...c},d)=>e.jsx(u_,{children:e.jsxs(Kj,{ref:d,className:P("relative z-[100] max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-hidden rounded-md border border-border bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",a),position:r,...c,children:[e.jsx(Lv,{}),e.jsx(m_,{className:P("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:l}),e.jsx(Uv,{})]})}));Be.displayName=Kj.displayName;const X1=u.forwardRef(({className:a,...l},r)=>e.jsx(Qj,{ref:r,className:P("px-2 py-1.5 text-sm font-semibold",a),...l}));X1.displayName=Qj.displayName;const W=u.forwardRef(({className:a,children:l,...r},c)=>e.jsxs(Yj,{ref:c,className:P("relative flex w-full cursor-default select-none items-center rounded-sm py-2 pl-2 pr-8 text-sm outline-none bg-white dark:bg-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 focus:bg-gray-100 dark:focus:bg-gray-800 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),...r,children:[e.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(x_,{children:e.jsx(Ot,{className:"h-4 w-4"})})}),e.jsx(h_,{children:l})]}));W.displayName=Yj.displayName;const Z1=u.forwardRef(({className:a,...l},r)=>e.jsx(Jj,{ref:r,className:P("-mx-1 my-1 h-px bg-muted",a),...l}));Z1.displayName=Jj.displayName;const fx=({className:a,...l})=>e.jsx("nav",{role:"navigation","aria-label":"pagination",className:P("mx-auto flex w-full justify-center",a),...l});fx.displayName="Pagination";const px=u.forwardRef(({className:a,...l},r)=>e.jsx("ul",{ref:r,className:P("flex flex-row items-center gap-1",a),...l}));px.displayName="PaginationContent";const Xn=u.forwardRef(({className:a,...l},r)=>e.jsx("li",{ref:r,className:P("",a),...l}));Xn.displayName="PaginationItem";const jc=({className:a,isActive:l,size:r="icon",...c})=>e.jsx("a",{"aria-current":l?"page":void 0,className:P(si({variant:l?"outline":"ghost",size:r}),a),...c});jc.displayName="PaginationLink";const $v=({className:a,...l})=>e.jsxs(jc,{"aria-label":"Go to previous page",size:"default",className:P("gap-1 pl-2.5",a),...l,children:[e.jsx(Pa,{className:"h-4 w-4"}),e.jsx("span",{children:"ไธŠไธ€้กต"})]});$v.displayName="PaginationPrevious";const Iv=({className:a,...l})=>e.jsxs(jc,{"aria-label":"Go to next page",size:"default",className:P("gap-1 pr-2.5",a),...l,children:[e.jsx("span",{children:"ไธ‹ไธ€้กต"}),e.jsx(ra,{className:"h-4 w-4"})]});Iv.displayName="PaginationNext";const Bv=({className:a,...l})=>e.jsxs("span",{"aria-hidden":!0,className:P("flex h-9 w-9 items-center justify-center",a),...l,children:[e.jsx(C_,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"More pages"})]});Bv.displayName="PaginationEllipsis";const W1=5,e2=5e3;let Lm=0;function s2(){return Lm=(Lm+1)%Number.MAX_SAFE_INTEGER,Lm.toString()}const Um=new Map,Ug=a=>{if(Um.has(a))return;const l=setTimeout(()=>{Um.delete(a),ac({type:"REMOVE_TOAST",toastId:a})},e2);Um.set(a,l)},t2=(a,l)=>{switch(l.type){case"ADD_TOAST":return{...a,toasts:[l.toast,...a.toasts].slice(0,W1)};case"UPDATE_TOAST":return{...a,toasts:a.toasts.map(r=>r.id===l.toast.id?{...r,...l.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=l;return r?Ug(r):a.toasts.forEach(c=>{Ug(c.id)}),{...a,toasts:a.toasts.map(c=>c.id===r||r===void 0?{...c,open:!1}:c)}}case"REMOVE_TOAST":return l.toastId===void 0?{...a,toasts:[]}:{...a,toasts:a.toasts.filter(r=>r.id!==l.toastId)}}},Fo=[];let Ho={toasts:[]};function ac(a){Ho=t2(Ho,a),Fo.forEach(l=>{l(Ho)})}function aa({...a}){const l=s2(),r=d=>ac({type:"UPDATE_TOAST",toast:{...d,id:l}}),c=()=>ac({type:"DISMISS_TOAST",toastId:l});return ac({type:"ADD_TOAST",toast:{...a,id:l,open:!0,onOpenChange:d=>{d||c()}}}),{id:l,dismiss:c,update:r}}function nt(){const[a,l]=u.useState(Ho);return u.useEffect(()=>(Fo.push(l),()=>{const r=Fo.indexOf(l);r>-1&&Fo.splice(r,1)}),[a]),{...a,toast:aa,dismiss:r=>ac({type:"DISMISS_TOAST",toastId:r})}}const dl="/api/webui/expression";async function gx(){const a=await ke(`${dl}/chats`,{});if(!a.ok){const l=await a.json();throw new Error(l.detail||"่Žทๅ–่Šๅคฉๅˆ—่กจๅคฑ่ดฅ")}return a.json()}async function a2(a){const l=new URLSearchParams;a.page&&l.append("page",a.page.toString()),a.page_size&&l.append("page_size",a.page_size.toString()),a.search&&l.append("search",a.search),a.chat_id&&l.append("chat_id",a.chat_id);const r=await ke(`${dl}/list?${l}`,{});if(!r.ok){const c=await r.json();throw new Error(c.detail||"่Žทๅ–่กจ่พพๆ–นๅผๅˆ—่กจๅคฑ่ดฅ")}return r.json()}async function l2(a){const l=await ke(`${dl}/${a}`,{});if(!l.ok){const r=await l.json();throw new Error(r.detail||"่Žทๅ–่กจ่พพๆ–นๅผ่ฏฆๆƒ…ๅคฑ่ดฅ")}return l.json()}async function n2(a){const l=await ke(`${dl}/`,{method:"POST",body:JSON.stringify(a)});if(!l.ok){const r=await l.json();throw new Error(r.detail||"ๅˆ›ๅปบ่กจ่พพๆ–นๅผๅคฑ่ดฅ")}return l.json()}async function r2(a,l){const r=await ke(`${dl}/${a}`,{method:"PATCH",body:JSON.stringify(l)});if(!r.ok){const c=await r.json();throw new Error(c.detail||"ๆ›ดๆ–ฐ่กจ่พพๆ–นๅผๅคฑ่ดฅ")}return r.json()}async function i2(a){const l=await ke(`${dl}/${a}`,{method:"DELETE"});if(!l.ok){const r=await l.json();throw new Error(r.detail||"ๅˆ ้™ค่กจ่พพๆ–นๅผๅคฑ่ดฅ")}return l.json()}async function c2(a){const l=await ke(`${dl}/batch/delete`,{method:"POST",body:JSON.stringify({ids:a})});if(!l.ok){const r=await l.json();throw new Error(r.detail||"ๆ‰น้‡ๅˆ ้™ค่กจ่พพๆ–นๅผๅคฑ่ดฅ")}return l.json()}async function o2(){const a=await ke(`${dl}/stats/summary`,{});if(!a.ok){const l=await a.json();throw new Error(l.detail||"่Žทๅ–็ปŸ่ฎกๆ•ฐๆฎๅคฑ่ดฅ")}return a.json()}async function jx(){const a=await ke(`${dl}/review/stats`);if(!a.ok){const l=await a.json();throw new Error(l.detail||"่Žทๅ–ๅฎกๆ ธ็ปŸ่ฎกๅคฑ่ดฅ")}return a.json()}async function $g(a){const l=new URLSearchParams;a.page&&l.append("page",a.page.toString()),a.page_size&&l.append("page_size",a.page_size.toString()),a.filter_type&&l.append("filter_type",a.filter_type),a.search&&l.append("search",a.search),a.chat_id&&l.append("chat_id",a.chat_id);const r=await ke(`${dl}/review/list?${l}`);if(!r.ok){const c=await r.json();throw new Error(c.detail||"่Žทๅ–ๅฎกๆ ธๅˆ—่กจๅคฑ่ดฅ")}return r.json()}async function $m(a){const l=await ke(`${dl}/review/batch`,{method:"POST",body:JSON.stringify({items:a})});if(!l.ok){const r=await l.json();throw new Error(r.detail||"ๆ‰น้‡ๅฎกๆ ธๅคฑ่ดฅ")}return l.json()}function Pv({open:a,onOpenChange:l}){const[r,c]=u.useState("list"),[d,m]=u.useState(null),[h,f]=u.useState([]),[p,g]=u.useState("unchecked"),[N,j]=u.useState([]),[b,y]=u.useState(0),[w,z]=u.useState(!1),[M,S]=u.useState(0),[F,E]=u.useState(1),[C,R]=u.useState(null),[H,O]=u.useState(0),[X,L]=u.useState(!1),[me,Ne]=u.useState(null),je=u.useRef(null),re=u.useRef(null),ge=u.useRef(!1),[pe,D]=u.useState(!1),[Q,I]=u.useState(!1),[ue,Y]=u.useState(0),[we,fe]=u.useState(1),[Ee,G]=u.useState(20),[$,A]=u.useState(""),[K,Re]=u.useState("unchecked"),[se,$e]=u.useState(""),[cs,J]=u.useState(""),[Z,Le]=u.useState(new Set),[ne,De]=u.useState(new Set),[xe,Me]=u.useState(new Map),{toast:ds}=nt(),Ts=u.useCallback(async()=>{try{I(!0);const U=await jx();m(U)}catch(U){console.error("ๅŠ ่ฝฝ็ปŸ่ฎกๅคฑ่ดฅ:",U)}finally{I(!1)}},[]),Ct=u.useCallback(async()=>{try{D(!0);const U=await $g({page:we,page_size:Ee,filter_type:K,search:se||void 0});f(U.data),Y(U.total)}catch(U){ds({title:"ๅŠ ่ฝฝๅคฑ่ดฅ",description:U instanceof Error?U.message:"ๆ— ๆณ•ๅŠ ่ฝฝๅˆ—่กจ",variant:"destructive"})}finally{D(!1)}},[we,Ee,K,se,ds]),ia=u.useCallback(async()=>{try{const U=await gx();if(U?.data){const Se=new Map;U.data.forEach(as=>{Se.set(as.chat_id,as.chat_name)}),Me(Se)}}catch(U){console.error("ๅŠ ่ฝฝ่Šๅคฉๅ็งฐๅคฑ่ดฅ:",U)}},[]),ut=u.useCallback(async(U=!0,Se=!1)=>{try{z(!0);const as=Se?F+1:F,us=await $g({page:as,page_size:20,filter_type:p});Se?(j(es=>[...es,...us.data]),E(as)):j(us.data),S(us.total),U&&y(0)}catch(as){ds({title:"ๅŠ ่ฝฝๅคฑ่ดฅ",description:as instanceof Error?as.message:"ๆ— ๆณ•ๅŠ ่ฝฝๅˆ—่กจ",variant:"destructive"})}finally{z(!1)}},[F,p,ds]);u.useEffect(()=>{r==="quick"&&(E(1),y(0))},[p,r]),u.useEffect(()=>{a&&r==="quick"&&(ut(),Ts())},[a,r,F,p,ut,Ts]);const Bs=u.useCallback(U=>U?p==="unchecked"?{left:!0,right:!0}:p==="passed"?{left:!0,right:!1}:p==="rejected"?{left:!1,right:!0}:U.checked?U.rejected?{left:!1,right:!0}:{left:!0,right:!1}:{left:!0,right:!0}:{left:!1,right:!1},[p]),V=u.useCallback(async U=>{const Se=N[b];if(!Se||X)return;const as=Bs(Se);if(!(U&&!as.left||!U&&!as.right)){L(!0),R(U?"left":"right"),O(U?-400:400);try{(await $m([{id:Se.id,rejected:U,require_unchecked:p==="unchecked"}])).results[0]?.success?(ds({title:U?"ๅทฒๆ‹’็ป":"ๅทฒ้€š่ฟ‡",description:`่กจ่พพๆ–นๅผ #${Se.id} ${U?"ๅทฒๆ‹’็ป":"ๅทฒ้€š่ฟ‡"}`}),setTimeout(()=>{j(es=>es.filter((Tt,$s)=>$s!==b)),S(es=>es-1),b>=N.length-1&&y(Math.max(0,b-1)),R(null),O(0),L(!1),Ts(),N.length<=1&&M>1&&ut(!1)},300)):(Ne(Se.id),ds({title:"ๆ•ฐๆฎๅ†ฒ็ช",description:"่ฏฅๆก็›ฎๅทฒ่ขซๅŽๅฐไปปๅŠกๅค„็†๏ผŒๆญฃๅœจๅˆทๆ–ฐๆ•ฐๆฎ...",variant:"destructive"}),setTimeout(()=>{Ne(null),R(null),O(0),L(!1),ut(!1),Ts()},1500))}catch(us){ds({title:"ๆ“ไฝœๅคฑ่ดฅ",description:us instanceof Error?us.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"}),R(null),O(0),L(!1)}}},[N,b,X,Bs,p,ds,Ts,M,ut]),Ke=u.useCallback((U,Se)=>{X||(re.current={x:U,y:Se},ge.current=!1)},[X]),He=u.useCallback(U=>{X||(L(!0),O(U==="left"?-30:30),setTimeout(()=>{O(0),setTimeout(()=>L(!1),300)},150))},[X]),Je=u.useCallback(U=>{if(!re.current||X)return;const Se=U-re.current.x,as=N[b],us=Bs(as);if(Se<0&&!us.left){O(Se*.2),R(null);return}if(Se>0&&!us.right){O(Se*.2),R(null);return}ge.current=!0,O(Se),Math.abs(Se)>50?R(Se>0?"right":"left"):R(null)},[N,b,Bs,X]),Es=u.useCallback(()=>{if(!re.current)return;Math.abs(H)>100&&C?V(C==="left"):(O(0),R(null)),re.current=null,ge.current=!1},[H,C,V]),ms=u.useCallback(U=>{Ke(U.clientX,U.clientY)},[Ke]),Ms=u.useCallback(U=>{re.current&&(U.preventDefault(),Je(U.clientX))},[Je]),We=u.useCallback(()=>{Es()},[Es]),Cs=u.useCallback(()=>{re.current&&Es()},[Es]),rs=u.useCallback(U=>{const Se=U.touches[0];Ke(Se.clientX,Se.clientY)},[Ke]),is=u.useCallback(U=>{const Se=U.touches[0];Je(Se.clientX)},[Je]),ys=u.useCallback(()=>{Es()},[Es]);u.useEffect(()=>{if(!a||r!=="quick")return;const U=Se=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(Se.key)||(Se.preventDefault(),Se.stopPropagation(),Se.stopImmediatePropagation(),X||w))return;const as=N[b],us=Bs(as);Se.key==="ArrowLeft"?us.left?V(!0):He("left"):Se.key==="ArrowRight"?us.right?V(!1):He("right"):Se.key==="ArrowDown"?bes+1):Se.key==="ArrowUp"&&b>0&&y(es=>es-1)};return window.addEventListener("keydown",U,!0),()=>window.removeEventListener("keydown",U,!0)},[a,r,N,b,X,w,Bs,V,He]),u.useEffect(()=>{if(!a||r!=="quick"||w)return;const U=N.length-b-1,Se=N.length{a&&(Ts(),Ct(),ia())},[a,Ts,Ct,ia]),u.useEffect(()=>{fe(1),Le(new Set)},[K,se]),u.useEffect(()=>{Le(new Set)},[h]);const rt=()=>{$e(cs),fe(1)},jt=U=>xe.get(U)||U,Ae=async(U,Se)=>{try{De(us=>new Set(us).add(U));const as=await $m([{id:U,rejected:Se,require_unchecked:K==="unchecked"}]);as.results[0]?.success?(ds({title:Se?"ๅทฒๆ‹’็ป":"ๅทฒ้€š่ฟ‡",description:`่กจ่พพๆ–นๅผ #${U} ${Se?"ๅทฒๆ‹’็ป":"ๅทฒ้€š่ฟ‡"}`}),Ct(),Ts()):ds({title:"ๆ“ไฝœๅคฑ่ดฅ",description:as.results[0]?.message||"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}catch(as){ds({title:"ๆ“ไฝœๅคฑ่ดฅ",description:as instanceof Error?as.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}finally{De(as=>{const us=new Set(as);return us.delete(U),us})}},Qe=async U=>{if(Z.size===0){ds({title:"่ฏท้€‰ๆ‹ฉ",description:"่ฏทๅ…ˆ้€‰ๆ‹ฉ่ฆๅฎกๆ ธ็š„่กจ่พพๆ–นๅผ",variant:"destructive"});return}try{D(!0);const Se=Array.from(Z).map(us=>({id:us,rejected:U,require_unchecked:K==="unchecked"})),as=await $m(Se);ds({title:"ๆ‰น้‡ๅฎกๆ ธๅฎŒๆˆ",description:`ๆˆๅŠŸ ${as.succeeded} ๆก๏ผŒๅคฑ่ดฅ ${as.failed} ๆก`,variant:as.failed>0?"destructive":"default"}),Le(new Set),Ct(),Ts()}catch(Se){ds({title:"ๆ‰น้‡ๅฎกๆ ธๅคฑ่ดฅ",description:Se instanceof Error?Se.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}finally{D(!1)}},As=()=>{Z.size===h.length?Le(new Set):Le(new Set(h.map(U=>U.id)))},mt=U=>{Le(Se=>{const as=new Set(Se);return as.has(U)?as.delete(U):as.add(U),as})},Ht=U=>U?new Date(U*1e3).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"-",ca=U=>U.checked?U.rejected?e.jsxs(Ce,{variant:"destructive",className:"gap-1",children:[e.jsx(ta,{className:"h-3 w-3"}),"ๅทฒๆ‹’็ป"]}):e.jsxs(Ce,{variant:"default",className:"gap-1 bg-green-600",children:[e.jsx(st,{className:"h-3 w-3"}),"ๅทฒ้€š่ฟ‡"]}):e.jsxs(Ce,{variant:"outline",className:"gap-1",children:[e.jsx(da,{className:"h-3 w-3"}),"ๅพ…ๅฎกๆ ธ"]}),Fa=U=>U?U==="ai"?e.jsxs(Ce,{variant:"secondary",className:"gap-1 text-xs",children:[e.jsx(Yn,{className:"h-3 w-3"}),"AI"]}):e.jsxs(Ce,{variant:"secondary",className:"gap-1 text-xs",children:[e.jsx(Fl,{className:"h-3 w-3"}),"ไบบๅทฅ"]}):null,Xt=Math.ceil(ue/Ee),te=()=>{const U=[];if(Xt<=7)for(let Se=1;Se<=Xt;Se++)U.push(Se);else{U.push(1),we>3&&U.push("ellipsis");const Se=Math.max(2,we-1),as=Math.min(Xt-1,we+1);for(let us=Se;us<=as;us++)U.push(us);we1&&U.push(Xt)}return U},_e=()=>{const U=parseInt($,10);!isNaN(U)&&U>=1&&U<=Xt&&(fe(U),A(""))};return e.jsx(Qs,{open:a,onOpenChange:l,children:e.jsxs(Hs,{className:"max-w-5xl w-[95vw] sm:w-full h-[90vh] sm:h-[85vh] flex flex-col p-0",hideCloseButton:!0,children:[e.jsxs("div",{className:"flex items-end bg-muted/30 px-2 pt-2 shrink-0",children:[e.jsxs("button",{onClick:()=>c("list"),className:P("group relative flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-t-lg transition-all","hover:bg-background/50",r==="list"?"bg-background text-foreground shadow-sm border border-b-0 border-border":"text-muted-foreground hover:text-foreground"),children:[e.jsx(rv,{className:"h-4 w-4"}),e.jsx("span",{children:"ๅˆ—่กจๆจกๅผ"}),r==="list"&&e.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-background"})]}),e.jsxs("button",{onClick:()=>c("quick"),className:P("group relative flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-t-lg transition-all","hover:bg-background/50",r==="quick"?"bg-background text-foreground shadow-sm border border-b-0 border-border":"text-muted-foreground hover:text-foreground"),children:[e.jsx(sl,{className:"h-4 w-4"}),e.jsx("span",{children:"ๅฟซ้€Ÿๅฎกๆ ธ"}),e.jsx(Ce,{variant:"secondary",className:"ml-1 h-5 px-1.5 text-xs",children:"ๆ–ฐ"}),r==="quick"&&e.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-background"})]}),e.jsx("div",{className:"flex-1 border-b border-border"}),e.jsx("button",{onClick:()=>l(!1),className:"mb-[1px] p-2 text-muted-foreground hover:text-foreground hover:bg-muted rounded-lg transition-colors",children:e.jsx(Sa,{className:"h-4 w-4"})})]}),r==="list"&&e.jsxs(e.Fragment,{children:[e.jsxs(qs,{className:"px-4 sm:px-6 pt-4 sm:pt-6 pb-4 border-b shrink-0",children:[e.jsx(Vs,{className:"text-lg sm:text-xl",children:"่กจ่พพๆ–นๅผๅฎกๆ ธ"}),e.jsx(at,{className:"text-xs sm:text-sm",children:"ๅฎกๆ ธ้บฆ้บฆๅญฆไน ๅˆฐ็š„่กจ่พพๆ–นๅผใ€‚้€š่ฟ‡ๅฎกๆ ธ็š„้กน็›ฎๆ‰ไผš่ขซไฝฟ็”จ๏ผˆๅฏๅœจ้…็ฝฎไธญ่ฐƒๆ•ด๏ผ‰๏ผŒ่ขซๆ‹’็ป็š„้กน็›ฎๆฐธ่ฟœไธไผš่ขซไฝฟ็”จใ€‚"}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 sm:gap-3 mt-4",children:[e.jsxs("div",{className:"rounded-lg border p-2 sm:p-3 text-center",children:[e.jsx("div",{className:"text-xl sm:text-2xl font-bold text-orange-500",children:Q?"-":d?.unchecked??0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"ๅพ…ๅฎกๆ ธ"})]}),e.jsxs("div",{className:"rounded-lg border p-2 sm:p-3 text-center",children:[e.jsx("div",{className:"text-xl sm:text-2xl font-bold text-green-500",children:Q?"-":d?.passed??0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"ๅทฒ้€š่ฟ‡"})]}),e.jsxs("div",{className:"rounded-lg border p-2 sm:p-3 text-center",children:[e.jsx("div",{className:"text-xl sm:text-2xl font-bold text-red-500",children:Q?"-":d?.rejected??0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"ๅทฒๆ‹’็ป"})]}),e.jsxs("div",{className:"rounded-lg border p-2 sm:p-3 text-center",children:[e.jsx("div",{className:"text-xl sm:text-2xl font-bold text-blue-500",children:Q?"-":d?.total??0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"ๆ€ป่ฎก"})]})]})]}),e.jsxs("div",{className:"px-4 sm:px-6 py-3 border-b shrink-0 space-y-3",children:[e.jsx(Jt,{value:K,onValueChange:U=>Re(U),className:"w-full",children:e.jsxs(Gt,{className:"grid w-full grid-cols-4",children:[e.jsxs(Xe,{value:"unchecked",className:"gap-1 text-xs sm:text-sm px-1 sm:px-3",children:[e.jsx(da,{className:"h-3 w-3 sm:h-4 sm:w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"ๅพ…ๅฎกๆ ธ"}),e.jsx("span",{className:"sm:hidden",children:"ๅพ…ๅฎก"}),e.jsxs("span",{className:"hidden sm:inline",children:["(",d?.unchecked??0,")"]})]}),e.jsxs(Xe,{value:"passed",className:"gap-1 text-xs sm:text-sm px-1 sm:px-3",children:[e.jsx(st,{className:"h-3 w-3 sm:h-4 sm:w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"ๅทฒ้€š่ฟ‡"}),e.jsx("span",{className:"sm:hidden",children:"้€š่ฟ‡"}),e.jsxs("span",{className:"hidden sm:inline",children:["(",d?.passed??0,")"]})]}),e.jsxs(Xe,{value:"rejected",className:"gap-1 text-xs sm:text-sm px-1 sm:px-3",children:[e.jsx(ta,{className:"h-3 w-3 sm:h-4 sm:w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"ๅทฒๆ‹’็ป"}),e.jsx("span",{className:"sm:hidden",children:"ๆ‹’็ป"}),e.jsxs("span",{className:"hidden sm:inline",children:["(",d?.rejected??0,")"]})]}),e.jsxs(Xe,{value:"all",className:"gap-1 text-xs sm:text-sm px-1 sm:px-3",children:[e.jsx("span",{children:"ๅ…จ้ƒจ"}),e.jsxs("span",{className:"hidden sm:inline",children:["(",d?.total??0,")"]})]})]})}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx($t,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ae,{placeholder:"ๆœ็ดขๆƒ…ๆ™ฏๆˆ–้ฃŽๆ ผ...",value:cs,onChange:U=>J(U.target.value),onKeyDown:U=>U.key==="Enter"&&rt(),className:"pl-9"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"icon",onClick:rt,children:e.jsx($t,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"icon",onClick:()=>{Ct(),Ts()},disabled:pe,children:e.jsx(dt,{className:P("h-4 w-4",pe&&"animate-spin")})})]}),Z.size>0&&e.jsx("div",{className:"flex items-center gap-2 w-full sm:w-auto",children:K==="unchecked"?e.jsxs(e.Fragment,{children:[e.jsxs(_,{variant:"default",size:"sm",className:"bg-green-600 hover:bg-green-700 flex-1 sm:flex-none",onClick:()=>Qe(!1),disabled:pe,children:[e.jsx(st,{className:"h-4 w-4 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"ๆ‰น้‡้€š่ฟ‡"}),e.jsx("span",{className:"sm:hidden",children:"้€š่ฟ‡"}),"(",Z.size,")"]}),e.jsxs(_,{variant:"destructive",size:"sm",className:"flex-1 sm:flex-none",onClick:()=>Qe(!0),disabled:pe,children:[e.jsx(ta,{className:"h-4 w-4 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"ๆ‰น้‡ๆ‹’็ป"}),e.jsx("span",{className:"sm:hidden",children:"ๆ‹’็ป"}),"(",Z.size,")"]})]}):K==="passed"?e.jsxs(_,{variant:"destructive",size:"sm",className:"flex-1 sm:flex-none",onClick:()=>Qe(!0),disabled:pe,children:[e.jsx(ta,{className:"h-4 w-4 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"ๆ‰น้‡ๆ”นไธบๆ‹’็ป"}),e.jsx("span",{className:"sm:hidden",children:"ๆ”นไธบๆ‹’็ป"}),"(",Z.size,")"]}):K==="rejected"?e.jsxs(_,{variant:"default",size:"sm",className:"bg-green-600 hover:bg-green-700 flex-1 sm:flex-none",onClick:()=>Qe(!1),disabled:pe,children:[e.jsx(st,{className:"h-4 w-4 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"ๆ‰น้‡ๆ”นไธบ้€š่ฟ‡"}),e.jsx("span",{className:"sm:hidden",children:"ๆ”นไธบ้€š่ฟ‡"}),"(",Z.size,")"]}):e.jsxs(e.Fragment,{children:[e.jsxs(_,{variant:"default",size:"sm",className:"bg-green-600 hover:bg-green-700 flex-1 sm:flex-none",onClick:()=>Qe(!1),disabled:pe,children:[e.jsx(st,{className:"h-4 w-4 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"ๆ‰น้‡้€š่ฟ‡"}),e.jsx("span",{className:"sm:hidden",children:"้€š่ฟ‡"}),"(",Z.size,")"]}),e.jsxs(_,{variant:"destructive",size:"sm",className:"flex-1 sm:flex-none",onClick:()=>Qe(!0),disabled:pe,children:[e.jsx(ta,{className:"h-4 w-4 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"ๆ‰น้‡ๆ‹’็ป"}),e.jsx("span",{className:"sm:hidden",children:"ๆ‹’็ป"}),"(",Z.size,")"]})]})})]})]}),e.jsx(ts,{className:"flex-1 px-4 sm:px-6",children:pe&&h.length===0?e.jsx("div",{className:"flex items-center justify-center h-40",children:e.jsx(dt,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):h.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-40 text-muted-foreground",children:[e.jsx(Ut,{className:"h-8 w-8 mb-2"}),e.jsx("p",{children:"ๆฒกๆœ‰ๆ‰พๅˆฐ่กจ่พพๆ–นๅผ"})]}):e.jsxs("div",{className:"space-y-2 py-2",children:[h.length>0&&e.jsxs("div",{className:"flex items-center justify-between py-2 px-3 rounded-lg bg-muted/50",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(tt,{checked:Z.size===h.length&&h.length>0,onCheckedChange:As}),e.jsx("span",{className:"text-sm text-muted-foreground",children:Z.size===h.length&&h.length>0?`ๅทฒๅ…จ้€‰ๅฝ“ๅ‰้กต (${h.length} ๆก)`:`ๅ…จ้€‰ๅฝ“ๅ‰้กต (${h.length} ๆก)`})]}),Z.size>0&&e.jsx(_,{variant:"ghost",size:"sm",onClick:()=>Le(new Set),className:"h-7 text-xs",children:"ๅ–ๆถˆ้€‰ๆ‹ฉ"})]}),h.map(U=>e.jsx("div",{className:P("rounded-lg border p-3 sm:p-4 space-y-2 sm:space-y-3 transition-colors",Z.has(U.id)&&"bg-accent border-primary",ne.has(U.id)&&"opacity-50"),children:e.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[e.jsx(tt,{checked:Z.has(U.id),onCheckedChange:()=>mt(U.id),disabled:ne.has(U.id),className:"mt-1"}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"ๆƒ…ๆ™ฏ๏ผš"}),e.jsx("p",{className:"text-sm font-medium break-words",children:U.situation})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"้ฃŽๆ ผ๏ผš"}),e.jsx("p",{className:"text-sm text-muted-foreground break-words",children:U.style})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1 sm:gap-2 text-xs text-muted-foreground",children:[e.jsxs("span",{children:["#",U.id]}),e.jsx("span",{children:"ยท"}),e.jsx("span",{title:jt(U.chat_id),className:"truncate max-w-24 sm:max-w-32",children:jt(U.chat_id)}),e.jsx("span",{children:"ยท"}),e.jsx("span",{children:Ht(U.create_date)}),e.jsxs("div",{className:"flex items-center gap-1",children:[ca(U),Fa(U.modified_by)]})]})]}),e.jsx("div",{className:"flex flex-col gap-1 sm:gap-2 shrink-0",children:K==="unchecked"?e.jsxs(e.Fragment,{children:[e.jsxs(_,{size:"sm",variant:"outline",className:"text-green-600 hover:text-green-700 hover:bg-green-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>Ae(U.id,!1),disabled:ne.has(U.id),children:[e.jsx(st,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"้€š่ฟ‡"})]}),e.jsxs(_,{size:"sm",variant:"outline",className:"text-red-600 hover:text-red-700 hover:bg-red-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>Ae(U.id,!0),disabled:ne.has(U.id),children:[e.jsx(ta,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"ๆ‹’็ป"})]})]}):K==="passed"?e.jsxs(_,{size:"sm",variant:"outline",className:"text-red-600 hover:text-red-700 hover:bg-red-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>Ae(U.id,!0),disabled:ne.has(U.id),children:[e.jsx(ta,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"ๆ”นไธบๆ‹’็ป"})]}):K==="rejected"?e.jsxs(_,{size:"sm",variant:"outline",className:"text-green-600 hover:text-green-700 hover:bg-green-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>Ae(U.id,!1),disabled:ne.has(U.id),children:[e.jsx(st,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"ๆ”นไธบ้€š่ฟ‡"})]}):e.jsx(e.Fragment,{children:U.rejected?e.jsxs(_,{size:"sm",variant:"outline",className:"text-green-600 hover:text-green-700 hover:bg-green-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>Ae(U.id,!1),disabled:ne.has(U.id),children:[e.jsx(st,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"ๆ”นไธบ้€š่ฟ‡"})]}):U.checked?e.jsxs(_,{size:"sm",variant:"outline",className:"text-red-600 hover:text-red-700 hover:bg-red-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>Ae(U.id,!0),disabled:ne.has(U.id),children:[e.jsx(ta,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"ๆ”นไธบๆ‹’็ป"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(_,{size:"sm",variant:"outline",className:"text-green-600 hover:text-green-700 hover:bg-green-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>Ae(U.id,!1),disabled:ne.has(U.id),children:[e.jsx(st,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"้€š่ฟ‡"})]}),e.jsxs(_,{size:"sm",variant:"outline",className:"text-red-600 hover:text-red-700 hover:bg-red-50 h-8 sm:h-9 px-2 sm:px-3",onClick:()=>Ae(U.id,!0),disabled:ne.has(U.id),children:[e.jsx(ta,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"ๆ‹’็ป"})]})]})})})]})},U.id))]})}),e.jsxs("div",{className:"px-4 sm:px-6 py-3 border-t shrink-0 flex flex-col sm:flex-row items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx("span",{className:"hidden sm:inline",children:"ๆฏ้กต"}),e.jsxs(Pe,{value:Ee.toString(),onValueChange:U=>{G(parseInt(U,10)),fe(1)},children:[e.jsx(Ie,{className:"w-[70px] h-8",children:e.jsx(Fe,{})}),e.jsxs(Be,{children:[e.jsx(W,{value:"10",children:"10"}),e.jsx(W,{value:"20",children:"20"}),e.jsx(W,{value:"50",children:"50"}),e.jsx(W,{value:"100",children:"100"})]})]}),e.jsx("span",{className:"hidden sm:inline",children:"ๆก"}),e.jsxs("span",{className:"text-muted-foreground",children:["ๅ…ฑ ",ue," ๆก"]})]}),e.jsx(fx,{className:"mx-0 w-auto",children:e.jsxs(px,{children:[e.jsx(Xn,{children:e.jsx(_,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>fe(U=>Math.max(1,U-1)),disabled:we<=1||pe,children:e.jsx(Pa,{className:"h-4 w-4"})})}),te().map((U,Se)=>e.jsx(Xn,{children:U==="ellipsis"?e.jsx(Bv,{}):e.jsx(jc,{href:"#",isActive:U===we,onClick:as=>{as.preventDefault(),fe(U)},className:"h-8 w-8 cursor-pointer",children:U})},Se)),e.jsx(Xn,{children:e.jsx(_,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>fe(U=>Math.min(Xt,U+1)),disabled:we>=Xt||pe,children:e.jsx(ra,{className:"h-4 w-4"})})})]})}),e.jsxs("div",{className:"hidden sm:flex items-center gap-2 text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"่ทณ่‡ณ"}),e.jsx(ae,{type:"number",min:1,max:Xt,value:$,onChange:U=>A(U.target.value),onKeyDown:U=>U.key==="Enter"&&_e(),className:"w-16 h-8 text-center",placeholder:we.toString()}),e.jsx("span",{className:"text-muted-foreground",children:"้กต"}),e.jsx(_,{variant:"outline",size:"sm",className:"h-8",onClick:_e,disabled:pe,children:"่ทณ่ฝฌ"})]})]})]}),r==="quick"&&e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"px-4 sm:px-6 py-3 border-b shrink-0 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("span",{className:"text-muted-foreground",children:["ๅพ…ๅฎกๆ ธ: ",e.jsx("span",{className:"font-medium text-orange-500",children:d?.unchecked??0})]}),e.jsxs("span",{className:"text-muted-foreground",children:["ๅทฒ้€š่ฟ‡: ",e.jsx("span",{className:"font-medium text-green-500",children:d?.passed??0})]}),e.jsxs("span",{className:"text-muted-foreground",children:["ๅทฒๆ‹’็ป: ",e.jsx("span",{className:"font-medium text-red-500",children:d?.rejected??0})]})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>{ut(),Ts()},disabled:w,children:[e.jsx(dt,{className:P("h-4 w-4 mr-1",w&&"animate-spin")}),"ๅˆทๆ–ฐ"]})]}),e.jsx(Jt,{value:p,onValueChange:U=>g(U),className:"w-full",children:e.jsxs(Gt,{className:"grid w-full grid-cols-4",children:[e.jsxs(Xe,{value:"unchecked",className:"gap-1 text-xs sm:text-sm",children:[e.jsx(da,{className:"h-3 w-3 sm:h-4 sm:w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"ๅพ…ๅฎกๆ ธ"}),e.jsx("span",{className:"sm:hidden",children:"ๅพ…ๅฎก"})]}),e.jsxs(Xe,{value:"passed",className:"gap-1 text-xs sm:text-sm",children:[e.jsx(st,{className:"h-3 w-3 sm:h-4 sm:w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"ๅทฒ้€š่ฟ‡"}),e.jsx("span",{className:"sm:hidden",children:"้€š่ฟ‡"})]}),e.jsxs(Xe,{value:"rejected",className:"gap-1 text-xs sm:text-sm",children:[e.jsx(ta,{className:"h-3 w-3 sm:h-4 sm:w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"ๅทฒๆ‹’็ป"}),e.jsx("span",{className:"sm:hidden",children:"ๆ‹’็ป"})]}),e.jsx(Xe,{value:"all",className:"gap-1 text-xs sm:text-sm",children:"ๅ…จ้ƒจ"})]})})]}),e.jsx("div",{className:"flex-1 flex flex-col items-center justify-center p-4 sm:p-8 relative overflow-hidden",children:w&&N.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center",children:[e.jsx(dt,{className:"h-8 w-8 animate-spin text-muted-foreground mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"ๅŠ ่ฝฝไธญ..."})]}):N.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center text-center",children:[e.jsx("div",{className:"w-20 h-20 rounded-full bg-muted/50 flex items-center justify-center mb-6",children:e.jsx(st,{className:"h-10 w-10 text-green-500"})}),e.jsx("h3",{className:"text-xl font-semibold mb-2",children:"ๅ…จ้ƒจๅฎกๆ ธๅฎŒๆˆ๏ผ"}),e.jsx("p",{className:"text-muted-foreground",children:"ๅฝ“ๅ‰็ญ›้€‰ๆกไปถไธ‹ๆฒกๆœ‰ๅพ…ๅค„็†็š„้กน็›ฎ"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"absolute top-4 left-1/2 -translate-x-1/2 text-sm text-muted-foreground z-50",children:[b+1," / ",N.length,M>N.length&&e.jsxs("span",{className:"ml-1",children:["๏ผˆๅ…ฑ ",M," ๆก๏ผ‰"]})]}),e.jsx("div",{className:"absolute inset-x-4 top-1/2 -translate-y-1/2 flex justify-between pointer-events-none z-40",children:(()=>{const U=N[b],Se=Bs(U);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:P("flex items-center gap-2 px-4 py-2 rounded-lg transition-all duration-300",C==="left"?"bg-red-500/20 text-red-500 scale-110":"bg-muted/50 text-muted-foreground opacity-0",!Se.left&&"invisible"),children:[e.jsx(ta,{className:"h-8 w-8"}),e.jsx("span",{className:"font-bold text-lg hidden sm:inline",children:"ๆ‹’็ป"})]}),e.jsxs("div",{className:P("flex items-center gap-2 px-4 py-2 rounded-lg transition-all duration-300",C==="right"?"bg-green-500/20 text-green-500 scale-110":"bg-muted/50 text-muted-foreground opacity-0",!Se.right&&"invisible"),children:[e.jsx("span",{className:"font-bold text-lg hidden sm:inline",children:"้€š่ฟ‡"}),e.jsx(st,{className:"h-8 w-8"})]})]})})()}),e.jsx("div",{className:"relative w-full max-w-md h-[400px] flex items-center justify-center",children:N.slice(b,b+5).reverse().map((U,Se,as)=>{const us=as.length-1-Se,es=us===0;let Tt={zIndex:5-us,position:"absolute",width:"100%",transition:es&&!ge.current?"all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1)":"none"};if(es)Tt={...Tt,transform:`translateX(${H}px) rotate(${H*.05}deg)`,opacity:Math.max(0,1-Math.abs(H)/500),cursor:"grab"};else{const $s=Math.min(Math.abs(H)/200,1),pa=vt=>{const Ca=vt*7%5,ll=vt*13%7;return{scale:1-vt*.05,translateY:vt*12,rotate:(vt%2===0?1:-1)*(vt*2)+Ca,translateX:(vt%2===0?-1:1)*(vt*4)+ll}},oa=pa(us),le=pa(us-1),oe=oa.scale+(le.scale-oa.scale)*$s,Ve=oa.translateY+(le.translateY-oa.translateY)*$s,Ys=oa.rotate+(le.rotate-oa.rotate)*$s,Ps=oa.translateX+(le.translateX-oa.translateX)*$s;Tt={...Tt,transform:`translate3d(${Ps}px, ${Ve}px, 0) scale(${oe}) rotate(${Ys}deg)`,opacity:1-us*.15,filter:`blur(${Math.max(0,us*1-$s)}px)`,pointerEvents:"none"}}return e.jsxs("div",{ref:es?je:void 0,className:P("bg-card border rounded-xl shadow-xl p-6 select-none h-full flex flex-col",es&&"active:cursor-grabbing shadow-2xl ring-1 ring-border/50",es&&me===U.id&&"ring-4 ring-orange-500/50 bg-orange-50/10"),style:Tt,onMouseDown:es?ms:void 0,onMouseMove:es?Ms:void 0,onMouseUp:es?We:void 0,onMouseLeave:es?Cs:void 0,onTouchStart:es?rs:void 0,onTouchMove:es?is:void 0,onTouchEnd:es?ys:void 0,children:[es&&me===U.id&&e.jsxs("div",{className:"absolute inset-0 z-50 flex flex-col items-center justify-center bg-background/80 backdrop-blur-sm animate-in fade-in duration-300 rounded-xl",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 bg-orange-500/20 rounded-full animate-ping"}),e.jsx(dt,{className:"relative h-16 w-16 text-orange-500 mb-4 animate-spin duration-1000"})]}),e.jsx("h3",{className:"text-xl font-bold text-foreground animate-in slide-in-from-bottom-2 fade-in duration-500",children:"ๆ•ฐๆฎๅทฒๆ›ดๆ–ฐ"}),e.jsx("p",{className:"text-muted-foreground mt-2 animate-in slide-in-from-bottom-3 fade-in duration-700",children:"ๅŽๅฐไปปๅŠกๅทฒๅค„็†ๆญคๆก็›ฎ"})]}),es&&e.jsx("div",{className:P("absolute inset-0 flex items-center justify-center z-20 pointer-events-none transition-opacity duration-200",H<-10&&!Bs(U).left||H>10&&!Bs(U).right?"opacity-100":"opacity-0"),children:e.jsx("div",{className:"bg-background/80 backdrop-blur-sm p-4 rounded-full shadow-lg border border-border",children:e.jsx(iv,{className:"h-12 w-12 text-muted-foreground"})})}),e.jsxs("div",{className:"space-y-4 flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm text-muted-foreground font-mono",children:["#",U.id]}),e.jsxs("div",{className:"flex items-center gap-2",children:[ca(U),Fa(U.modified_by)]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"ๆƒ…ๆ™ฏ"}),e.jsx("div",{className:"p-3 bg-muted/30 rounded-lg border border-border/50",children:e.jsx("p",{className:"text-lg font-medium leading-relaxed",children:U.situation})})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"้ฃŽๆ ผ"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:U.style.split(/[,๏ผŒ]/).map(($s,pa)=>e.jsx(Ce,{variant:"secondary",className:"font-normal",children:$s.trim()},pa))})]})]}),e.jsxs("div",{className:"mt-auto pt-4 border-t flex items-center justify-between text-xs text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-6 h-6 rounded-full bg-primary/10 flex items-center justify-center text-primary",children:e.jsx(Fl,{className:"h-3 w-3"})}),e.jsx("span",{title:jt(U.chat_id),className:"truncate max-w-[120px] font-medium",children:jt(U.chat_id)})]}),e.jsx("span",{className:"font-mono",children:Ht(U.create_date)})]})]},U.id)})}),e.jsx("div",{className:"flex items-center gap-8 mt-8 sm:hidden z-50",children:(()=>{const U=N[b],Se=Bs(U);return e.jsxs(e.Fragment,{children:[e.jsx(_,{variant:"outline",size:"lg",className:P("w-16 h-16 rounded-full border-2 shadow-lg transition-all active:scale-95",Se.left?"hover:bg-red-50 hover:text-red-600 hover:border-red-200":"opacity-30 cursor-not-allowed"),onClick:()=>Se.left&&V(!0),disabled:!Se.left||X,children:e.jsx(ta,{className:"h-8 w-8"})}),e.jsx(_,{variant:"outline",size:"lg",className:P("w-16 h-16 rounded-full border-2 shadow-lg transition-all active:scale-95",Se.right?"hover:bg-green-50 hover:text-green-600 hover:border-green-200":"opacity-30 cursor-not-allowed"),onClick:()=>Se.right&&V(!1),disabled:!Se.right||X,children:e.jsx(st,{className:"h-8 w-8"})})]})})()})]})}),e.jsxs("div",{className:"hidden sm:flex items-center justify-center gap-6 px-6 py-3 border-t text-xs text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-2 py-1 bg-muted rounded text-xs",children:"โ†"}),e.jsx("span",{children:"ๆ‹’็ป"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-2 py-1 bg-muted rounded text-xs",children:"โ†’"}),e.jsx("span",{children:"้€š่ฟ‡"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-2 py-1 bg-muted rounded text-xs",children:"โ†‘"}),e.jsx("span",{children:"ไธŠไธ€ๆก"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-2 py-1 bg-muted rounded text-xs",children:"โ†“"}),e.jsx("span",{children:"ไธ‹ไธ€ๆก"})]}),e.jsx("span",{className:"text-muted-foreground/50",children:"|"}),e.jsx("span",{children:"ๆ‹–ๆ‹ฝๅก็‰‡ๆป‘ๅŠจๅฎกๆ ธ"})]})]})]})})}function d2(){return e.jsx(lr,{children:e.jsx(m2,{})})}const u2=a=>{const l=[];for(let r=0;r(H.current=!0,()=>{H.current=!1,O.current&&(clearInterval(O.current),O.current=null)}),[]);const X=u.useCallback(async()=>{try{const A=await jx();H.current&&E(A.unchecked)}catch(A){console.error("่Žทๅ–ๅฎกๆ ธ็ปŸ่ฎกๅคฑ่ดฅ:",A)}},[]),L=u.useCallback(async()=>{try{y(!0);const A=await fw.get("https://v1.hitokoto.cn/?c=a&c=b&c=c&c=d&c=h&c=i&c=k");H.current&&j({hitokoto:A.data.hitokoto,from:A.data.from||A.data.from_who||"ๆœช็Ÿฅ"})}catch(A){console.error("่Žทๅ–ไธ€่จ€ๅคฑ่ดฅ:",A),H.current&&j({hitokoto:"ไบบ็”Ÿๅฐฑๅƒไธ€็›’ๅทงๅ…‹ๅŠ›๏ผŒไฝ ๆฐธ่ฟœไธ็Ÿฅ้“ไธ‹ไธ€้ข—ๆ˜ฏไป€ไนˆๅ‘ณ้“ใ€‚",from:"้˜ฟ็”˜ๆญฃไผ "})}finally{H.current&&y(!1)}},[]),me=u.useCallback(async()=>{try{const A=await ke("/api/webui/system/status");if(!H.current)return;if(A.ok){const K=await A.json();z(K)}else z(null)}catch(A){console.error("่Žทๅ–ๆœบๅ™จไบบ็Šถๆ€ๅคฑ่ดฅ:",A),H.current&&z(null)}},[]),Ne=async()=>{await C()},je=u.useCallback(async()=>{try{const A=await ke(`/api/webui/statistics/dashboard?hours=${h}`);if(!H.current)return;if(A.ok){const K=await A.json();l(K)}c(!1),m(100)}catch(A){console.error("Failed to fetch dashboard data:",A),H.current&&(c(!1),m(100))}},[h]);if(u.useEffect(()=>{if(!r)return;m(0);const A=setTimeout(()=>m(15),200),K=setTimeout(()=>m(30),800),Re=setTimeout(()=>m(45),2e3),se=setTimeout(()=>m(60),4e3),$e=setTimeout(()=>m(75),6500),cs=setTimeout(()=>m(85),9e3),J=setTimeout(()=>m(92),11e3);return()=>{clearTimeout(A),clearTimeout(K),clearTimeout(Re),clearTimeout(se),clearTimeout($e),clearTimeout(cs),clearTimeout(J)}},[r]),u.useEffect(()=>{je(),L(),me(),X()},[je,L,me,X]),u.useEffect(()=>{if(O.current&&(clearInterval(O.current),O.current=null),!!p)return O.current=setInterval(()=>{H.current&&(je(),me())},3e4),()=>{O.current&&(clearInterval(O.current),O.current=null)}},[p,je,me]),r||!a)return e.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-200px)]",children:e.jsxs("div",{className:"text-center space-y-6 w-full max-w-md px-4",children:[e.jsx(dt,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-lg font-medium",children:"ๅŠ ่ฝฝ็ปŸ่ฎกๆ•ฐๆฎไธญ..."}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๆญฃๅœจ่Žทๅ–้บฆ้บฆ่ฟ่กŒๆ•ฐๆฎ"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(tr,{value:d,className:"h-2"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[d,"%"]})]})]})});const{summary:re,model_stats:ge=[],hourly_data:pe=[],daily_data:D=[],recent_activity:Q=[]}=a,I=re??{total_requests:0,total_cost:0,total_tokens:0,online_time:0,total_messages:0,total_replies:0,avg_response_time:0,cost_per_hour:0,tokens_per_hour:0},ue=A=>{const K=Math.floor(A/3600),Re=Math.floor(A%3600/60);return`${K}ๅฐๆ—ถ${Re}ๅˆ†้’Ÿ`},Y=A=>{const K=A.toLocaleString("zh-CN");return A>=1e9?{display:`${(A/1e9).toFixed(2)}B`,exact:K,needsExact:!0}:A>=1e6?{display:`${(A/1e6).toFixed(2)}M`,exact:K,needsExact:!0}:A>=1e4?{display:`${(A/1e3).toFixed(1)}K`,exact:K,needsExact:!0}:A>=1e3?{display:`${(A/1e3).toFixed(2)}K`,exact:K,needsExact:!0}:{display:K,exact:K,needsExact:!1}},we=A=>{const K=`ยฅ${A.toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2})}`;return A>=1e6?{display:`ยฅ${(A/1e6).toFixed(2)}M`,exact:K,needsExact:!0}:A>=1e4?{display:`ยฅ${(A/1e3).toFixed(1)}K`,exact:K,needsExact:!0}:A>=1e3?{display:`ยฅ${(A/1e3).toFixed(2)}K`,exact:K,needsExact:!0}:{display:K,exact:K,needsExact:!1}},fe=A=>new Date(A).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),Ee=u2(ge.length),G=ge.map((A,K)=>({name:A.model_name,value:A.request_count,fill:Ee[K]})),$={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(ts,{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(Jt,{value:h.toString(),onValueChange:A=>f(Number(A)),children:e.jsxs(Gt,{className:"grid grid-cols-3 w-full sm:w-auto",children:[e.jsx(Xe,{value:"24",children:"24ๅฐๆ—ถ"}),e.jsx(Xe,{value:"168",children:"7ๅคฉ"}),e.jsx(Xe,{value:"720",children:"30ๅคฉ"})]})}),e.jsxs(_,{variant:p?"default":"outline",size:"sm",onClick:()=>g(!p),className:"gap-2",children:[e.jsx(dt,{className:`h-4 w-4 ${p?"animate-spin":""}`}),e.jsx("span",{className:"hidden sm:inline",children:"่‡ชๅŠจๅˆทๆ–ฐ"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:je,children:e.jsx(dt,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 rounded-lg border border-dashed border-muted-foreground/30 bg-muted/20",children:[b?e.jsx(ks,{className:"h-5 flex-1"}):N?e.jsxs("p",{className:"flex-1 text-sm text-muted-foreground italic truncate",children:['"',N.hitokoto,'" โ€”โ€” ',N.from]}):null,e.jsx(_,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:L,disabled:b,children:e.jsx(dt,{className:`h-3.5 w-3.5 ${b?"animate-spin":""}`})})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-3",children:[e.jsxs(Te,{className:"lg:col-span-1",children:[e.jsx(Oe,{className:"pb-3",children:e.jsxs(Ue,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(pc,{className:"h-4 w-4"}),"้บฆ้บฆ็Šถๆ€"]})}),e.jsx(ze,{children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex items-center gap-2",children:w?.running?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-3 w-3 rounded-full bg-green-500 animate-pulse"}),e.jsxs(Ce,{variant:"outline",className:"text-green-600 border-green-300 bg-green-50",children:[e.jsx(st,{className:"h-3 w-3 mr-1"}),"่ฟ่กŒไธญ"]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-3 w-3 rounded-full bg-red-500"}),e.jsxs(Ce,{variant:"outline",className:"text-red-600 border-red-300 bg-red-50",children:[e.jsx(Ut,{className:"h-3 w-3 mr-1"}),"ๅทฒๅœๆญข"]})]})}),w&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:[e.jsxs("span",{children:["v",w.version]}),e.jsx("span",{className:"mx-2",children:"|"}),e.jsxs("span",{children:["่ฟ่กŒ ",ue(w.uptime)]})]})]})})]}),e.jsxs(Te,{children:[e.jsx(Oe,{className:"pb-3",children:e.jsxs(Ue,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(sl,{className:"h-4 w-4"}),"ๅฟซ้€Ÿๆ“ไฝœ"]})}),e.jsx(ze,{children:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:Ne,disabled:R,className:"gap-2",children:[e.jsx(rc,{className:`h-4 w-4 ${R?"animate-spin":""}`}),R?"้‡ๅฏไธญ...":"้‡ๅฏ้บฆ้บฆ"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>S(!0),className:"gap-2",children:[e.jsx(cv,{className:"h-4 w-4"}),"่กจ่พพๅฎกๆ ธ",F>0&&e.jsx("span",{className:"ml-1 px-1.5 py-0.5 text-xs rounded-full bg-orange-500 text-white",children:F>99?"99+":F})]}),e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Kn,{to:"/logs",children:[e.jsx(Ua,{className:"h-4 w-4"}),"ๆŸฅ็œ‹ๆ—ฅๅฟ—"]})}),e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Kn,{to:"/plugins",children:[e.jsx(T_,{className:"h-4 w-4"}),"ๆ’ไปถ็ฎก็†"]})}),e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Kn,{to:"/settings",children:[e.jsx(Sn,{className:"h-4 w-4"}),"็ณป็ปŸ่ฎพ็ฝฎ"]})})]})})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{className:"pb-3",children:[e.jsxs(Ue,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(E_,{className:"h-4 w-4"}),"ๅ้ฆˆ้—ฎๅท"]}),e.jsx(Ns,{className:"text-xs",children:"ๅธฎๅŠฉๆˆ‘ไปฌๆ”น่ฟ›ไบงๅ“ไฝ“้ชŒ"})]}),e.jsx(ze,{children:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Kn,{to:"/survey/webui-feedback",children:[e.jsx(Ua,{className:"h-4 w-4"}),"WebUI ๅ้ฆˆ"]})}),e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(Kn,{to:"/survey/maibot-feedback",children:[e.jsx(Ba,{className:"h-4 w-4"}),"้บฆ้บฆๅ้ฆˆ"]})})]})})]})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"ๆ€ป่ฏทๆฑ‚ๆ•ฐ"}),e.jsx(nx,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(ze,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[Y(I.total_requests).display,Y(I.total_requests).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",Y(I.total_requests).exact,")"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["ๆœ€่ฟ‘",h<48?h+"ๅฐๆ—ถ":Math.floor(h/24)+"ๅคฉ"]})]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"ๆ€ป่Šฑ่ดน"}),e.jsx(M_,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(ze,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[we(I.total_cost).display,we(I.total_cost).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",we(I.total_cost).exact,")"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:I.cost_per_hour>0?`ยฅ${I.cost_per_hour.toFixed(2)}/ๅฐๆ—ถ`:"ๆš‚ๆ— ๆ•ฐๆฎ"})]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"Tokenๆถˆ่€—"}),e.jsx(Zr,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(ze,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[Y(I.total_tokens).display,Y(I.total_tokens).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",Y(I.total_tokens).exact,")"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:I.tokens_per_hour>0?`${Y(I.tokens_per_hour).display}/ๅฐๆ—ถ`:"ๆš‚ๆ— ๆ•ฐๆฎ"})]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"ๅนณๅ‡ๅ“ๅบ”"}),e.jsx(sl,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(ze,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[I.avg_response_time.toFixed(2),"s"]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"APIๅนณๅ‡่€—ๆ—ถ"})]})]})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 sm:grid-cols-3",children:[e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"ๅœจ็บฟๆ—ถ้•ฟ"}),e.jsx(da,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(ze,{children:e.jsxs("div",{className:"text-xl font-bold",children:[ue(I.online_time),e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",I.online_time.toLocaleString(),"็ง’)"]})]})})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"ๆถˆๆฏๅค„็†"}),e.jsx(Ba,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(ze,{children:[e.jsxs("div",{className:"text-xl font-bold",children:[Y(I.total_messages).display,Y(I.total_messages).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",Y(I.total_messages).exact,")"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["ๅ›žๅค ",Y(I.total_replies).display,Y(I.total_replies).needsExact&&e.jsxs("span",{children:["(",Y(I.total_replies).exact,")"]})," ๆก"]})]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"ๆˆๆœฌๆ•ˆ็އ"}),e.jsx(rx,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(ze,{children:[e.jsx("div",{className:"text-xl font-bold",children:I.total_messages>0?`ยฅ${(I.total_cost/I.total_messages*100).toFixed(2)}`:"ยฅ0.00"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"ๆฏ100ๆกๆถˆๆฏ"})]})]})]}),e.jsxs(Jt,{defaultValue:"trends",className:"space-y-4",children:[e.jsxs(Gt,{className:"grid w-full grid-cols-2 sm:grid-cols-4",children:[e.jsx(Xe,{value:"trends",children:"่ถ‹ๅŠฟ"}),e.jsx(Xe,{value:"models",children:"ๆจกๅž‹"}),e.jsx(Xe,{value:"activity",children:"ๆดปๅŠจ"}),e.jsx(Xe,{value:"daily",children:"ๆ—ฅ็ปŸ่ฎก"})]}),e.jsxs(Ss,{value:"trends",className:"space-y-4",children:[e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"่ฏทๆฑ‚่ถ‹ๅŠฟ"}),e.jsxs(Ns,{children:["ๆœ€่ฟ‘",h,"ๅฐๆ—ถ็š„่ฏทๆฑ‚้‡ๅ˜ๅŒ–"]})]}),e.jsx(ze,{children:e.jsx(Kr,{config:$,className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:e.jsxs(Ww,{data:pe,children:[e.jsx(Ji,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Xi,{dataKey:"timestamp",tickFormatter:A=>fe(A),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Gr,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Qi,{content:e.jsx(Qr,{labelFormatter:A=>fe(A)})}),e.jsx(e_,{type:"monotone",dataKey:"requests",stroke:"var(--color-requests)",strokeWidth:2})]})})})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"่Šฑ่ดน่ถ‹ๅŠฟ"}),e.jsx(Ns,{children:"API่ฐƒ็”จๆˆๆœฌๅ˜ๅŒ–"})]}),e.jsx(ze,{children:e.jsx(Kr,{config:$,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:e.jsxs(Io,{data:pe,children:[e.jsx(Ji,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Xi,{dataKey:"timestamp",tickFormatter:A=>fe(A),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Gr,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Qi,{content:e.jsx(Qr,{labelFormatter:A=>fe(A)})}),e.jsx(Zi,{dataKey:"cost",fill:"var(--color-cost)"})]})})})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"Tokenๆถˆ่€—"}),e.jsx(Ns,{children:"Tokenไฝฟ็”จ้‡ๅ˜ๅŒ–"})]}),e.jsx(ze,{children:e.jsx(Kr,{config:$,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:e.jsxs(Io,{data:pe,children:[e.jsx(Ji,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Xi,{dataKey:"timestamp",tickFormatter:A=>fe(A),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Gr,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Qi,{content:e.jsx(Qr,{labelFormatter:A=>fe(A)})}),e.jsx(Zi,{dataKey:"tokens",fill:"var(--color-tokens)"})]})})})]})]})]}),e.jsx(Ss,{value:"models",className:"space-y-4",children:e.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"ๆจกๅž‹่ฏทๆฑ‚ๅˆ†ๅธƒ"}),e.jsxs(Ns,{children:["ๅ„ๆจกๅž‹ไฝฟ็”จๅ ๆฏ” (ๅ…ฑ ",ge.length," ไธชๆจกๅž‹)"]})]}),e.jsx(ze,{children:e.jsx(Kr,{config:Object.fromEntries(ge.map((A,K)=>[A.model_name,{label:A.model_name,color:Ee[K]}])),className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:e.jsxs(s_,{children:[e.jsx(Qi,{content:e.jsx(Qr,{})}),e.jsx(t_,{data:G,cx:"50%",cy:"50%",labelLine:!1,label:({name:A,percent:K})=>K&&K<.05?"":`${A} ${K?(K*100).toFixed(0):0}%`,outerRadius:100,dataKey:"value",children:G.map((A,K)=>e.jsx(a_,{fill:A.fill},`cell-${K}`))})]})})})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"ๆจกๅž‹่ฏฆ็ป†็ปŸ่ฎก"}),e.jsx(Ns,{children:"่ฏทๆฑ‚ๆ•ฐใ€่Šฑ่ดนๅ’Œๆ€ง่ƒฝ"})]}),e.jsx(ze,{children:e.jsx(ts,{className:"h-[300px] sm:h-[400px]",children:e.jsx("div",{className:"space-y-3",children:ge.map((A,K)=>e.jsxs("div",{className:"p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("h4",{className:"font-semibold text-sm truncate flex-1 min-w-0",children:A.model_name}),e.jsx("div",{className:"w-3 h-3 rounded-full ml-2 flex-shrink-0",style:{backgroundColor:`hsl(var(--chart-${K%5+1}))`}})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"่ฏทๆฑ‚ๆ•ฐ:"}),e.jsx("span",{className:"ml-1 font-medium",children:A.request_count.toLocaleString()})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"่Šฑ่ดน:"}),e.jsxs("span",{className:"ml-1 font-medium",children:["ยฅ",A.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:[(A.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:[A.avg_response_time.toFixed(2),"s"]})]})]})]},K))})})})]})]})}),e.jsx(Ss,{value:"activity",children:e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"ๆœ€่ฟ‘ๆดปๅŠจ"}),e.jsx(Ns,{children:"ๆœ€ๆ–ฐ็š„API่ฐƒ็”จ่ฎฐๅฝ•"})]}),e.jsx(ze,{children:e.jsx(ts,{className:"h-[400px] sm:h-[500px]",children:e.jsx("div",{className:"space-y-2",children:Q.map((A,K)=>e.jsxs("div",{className:"p-3 sm:p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 mb-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium text-sm truncate",children:A.model}),e.jsx("div",{className:"text-xs text-muted-foreground",children:A.request_type})]}),e.jsx("div",{className:"text-xs text-muted-foreground flex-shrink-0",children:fe(A.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:A.tokens})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"่Šฑ่ดน:"}),e.jsxs("span",{className:"ml-1",children:["ยฅ",A.cost.toFixed(4)]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"่€—ๆ—ถ:"}),e.jsxs("span",{className:"ml-1",children:[A.time_cost.toFixed(2),"s"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"็Šถๆ€:"}),e.jsx("span",{className:`ml-1 ${A.status==="success"?"text-green-600":"text-red-600"}`,children:A.status})]})]})]},K))})})})]})}),e.jsx(Ss,{value:"daily",children:e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"ๆฏๆ—ฅ็ปŸ่ฎก"}),e.jsx(Ns,{children:"ๆœ€่ฟ‘7ๅคฉ็š„ๆ•ฐๆฎๆฑ‡ๆ€ป"})]}),e.jsx(ze,{children:e.jsx(Kr,{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(Io,{data:D,children:[e.jsx(Ji,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Xi,{dataKey:"timestamp",tickFormatter:A=>{const K=new Date(A);return`${K.getMonth()+1}/${K.getDate()}`},stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Gr,{yAxisId:"left",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Gr,{yAxisId:"right",orientation:"right",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(Qi,{content:e.jsx(Qr,{labelFormatter:A=>new Date(A).toLocaleDateString("zh-CN")})}),e.jsx(F1,{content:e.jsx(zv,{})}),e.jsx(Zi,{yAxisId:"left",dataKey:"requests",fill:"var(--color-requests)"}),e.jsx(Zi,{yAxisId:"right",dataKey:"cost",fill:"var(--color-cost)"})]})})})]})})]}),e.jsx(nr,{}),e.jsx(Pv,{open:M,onOpenChange:A=>{S(A),A||X()}})]})})}const x2={theme:"system",setTheme:()=>null},Fv=u.createContext(x2),vx=()=>{const a=u.useContext(Fv);if(a===void 0)throw new Error("useTheme must be used within a ThemeProvider");return a},h2=(a,l,r)=>{const c=document.documentElement.classList.contains("no-animations");if(!document.startViewTransition||c){l(a);return}const d=r.clientX,m=r.clientY,h=Math.hypot(Math.max(d,innerWidth-d),Math.max(m,innerHeight-m));document.startViewTransition(()=>{l(a)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${d}px ${m}px)`,`circle(${h}px at ${d}px ${m}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},Hv=u.createContext(void 0),qv=()=>{const a=u.useContext(Hv);if(a===void 0)throw new Error("useAnimation must be used within an AnimationProvider");return a},qe=u.forwardRef(({className:a,...l},r)=>e.jsx(Nj,{className:P("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",a),...l,ref:r,children:e.jsx(bw,{className:P("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));qe.displayName=Nj.displayName;const f2=ti("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),T=u.forwardRef(({className:a,...l},r)=>e.jsx(Xj,{ref:r,className:P(f2(),a),...l}));T.displayName=Xj.displayName;const p2=[{id:"minLength",label:"้•ฟๅบฆ่‡ณๅฐ‘ 10 ไฝ",description:"Token ้•ฟๅบฆๅฟ…้กปๅคงไบŽ็ญ‰ไบŽ 10 ไธชๅญ—็ฌฆ",validate:a=>a.length>=10},{id:"hasUppercase",label:"ๅŒ…ๅซๅคงๅ†™ๅญ—ๆฏ",description:"่‡ณๅฐ‘ๅŒ…ๅซไธ€ไธชๅคงๅ†™ๅญ—ๆฏ (A-Z)",validate:a=>/[A-Z]/.test(a)},{id:"hasLowercase",label:"ๅŒ…ๅซๅฐๅ†™ๅญ—ๆฏ",description:"่‡ณๅฐ‘ๅŒ…ๅซไธ€ไธชๅฐๅ†™ๅญ—ๆฏ (a-z)",validate:a=>/[a-z]/.test(a)},{id:"hasSpecialChar",label:"ๅŒ…ๅซ็‰นๆฎŠ็ฌฆๅท",description:"่‡ณๅฐ‘ๅŒ…ๅซไธ€ไธช็‰นๆฎŠ็ฌฆๅท (!@#$%^&*()_+-=[]{}|;:,.<>?/)",validate:a=>/[!@#$%^&*()_+\-=[\]{}|;:,.<>?/]/.test(a)}];function g2(a){const l=p2.map(c=>({id:c.id,label:c.label,description:c.description,passed:c.validate(a)}));return{isValid:l.every(c=>c.passed),rules:l}}const ud="0.12.2",Nx="MaiBot Dashboard",j2=`${Nx} v${ud}`,v2=(a="v")=>`${a}${ud}`,wa={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"},jl={theme:"system",accentColor:"blue",enableAnimations:!0,enableWavesBackground:!0,logCacheSize:1e3,logAutoScroll:!0,logFontSize:"xs",logLineSpacing:4,dataSyncInterval:30,wsReconnectInterval:3e3,wsMaxReconnectAttempts:10};function zt(a){const l=Vv(a),r=localStorage.getItem(l);if(r===null)return jl[a];const c=jl[a];if(typeof c=="boolean")return r==="true";if(typeof c=="number"){const d=parseFloat(r);return isNaN(d)?c:d}return r}function Yr(a,l){const r=Vv(a);localStorage.setItem(r,String(l)),window.dispatchEvent(new CustomEvent("maibot-settings-change",{detail:{key:a,value:l}}))}function N2(){return{theme:zt("theme"),accentColor:zt("accentColor"),enableAnimations:zt("enableAnimations"),enableWavesBackground:zt("enableWavesBackground"),logCacheSize:zt("logCacheSize"),logAutoScroll:zt("logAutoScroll"),logFontSize:zt("logFontSize"),logLineSpacing:zt("logLineSpacing"),dataSyncInterval:zt("dataSyncInterval"),wsReconnectInterval:zt("wsReconnectInterval"),wsMaxReconnectAttempts:zt("wsMaxReconnectAttempts")}}function b2(){const a=N2(),l=localStorage.getItem(wa.COMPLETED_TOURS),r=l?JSON.parse(l):[];return{...a,completedTours:r}}function y2(a){const l=[],r=[];for(const[c,d]of Object.entries(a)){if(c==="completedTours"){Array.isArray(d)?(localStorage.setItem(wa.COMPLETED_TOURS,JSON.stringify(d)),l.push("completedTours")):r.push("completedTours");continue}if(c in jl){const m=c,h=jl[m];if(typeof d==typeof h){if(m==="theme"&&!["light","dark","system"].includes(d)){r.push(c);continue}if(m==="logFontSize"&&!["xs","sm","base"].includes(d)){r.push(c);continue}Yr(m,d),l.push(c)}else r.push(c)}else r.push(c)}return{success:l.length>0,imported:l,skipped:r}}function w2(){for(const a of Object.keys(jl))Yr(a,jl[a]);localStorage.removeItem(wa.COMPLETED_TOURS),window.dispatchEvent(new CustomEvent("maibot-settings-reset"))}function _2(){const a=[],l=[],r=[];for(let c=0;cc.size-r.size),{used:a,items:localStorage.length,details:l}}function S2(a){if(a===0)return"0 B";const l=1024,r=["B","KB","MB"],c=Math.floor(Math.log(a)/Math.log(l));return parseFloat((a/Math.pow(l,c)).toFixed(2))+" "+r[c]}function Vv(a){return{theme:wa.THEME,accentColor:wa.ACCENT_COLOR,enableAnimations:wa.ENABLE_ANIMATIONS,enableWavesBackground:wa.ENABLE_WAVES_BACKGROUND,logCacheSize:wa.LOG_CACHE_SIZE,logAutoScroll:wa.LOG_AUTO_SCROLL,logFontSize:wa.LOG_FONT_SIZE,logLineSpacing:wa.LOG_LINE_SPACING,dataSyncInterval:wa.DATA_SYNC_INTERVAL,wsReconnectInterval:wa.WS_RECONNECT_INTERVAL,wsMaxReconnectAttempts:wa.WS_MAX_RECONNECT_ATTEMPTS}[a]}const el=u.forwardRef(({className:a,...l},r)=>e.jsxs(bj,{ref:r,className:P("relative flex w-full touch-none select-none items-center",a),...l,children:[e.jsx(yw,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:e.jsx(ww,{className:"absolute h-full bg-primary"})}),e.jsx(_w,{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"})]}));el.displayName=bj.displayName;class k2{ws=null;reconnectTimeout=null;reconnectAttempts=0;heartbeatInterval=null;logCallbacks=new Set;connectionCallbacks=new Set;isConnected=!1;logCache=[];getMaxCacheSize(){return zt("logCacheSize")}getMaxReconnectAttempts(){return zt("wsMaxReconnectAttempts")}getReconnectInterval(){return zt("wsReconnectInterval")}getWebSocketUrl(l){let r;{const c=window.location.protocol==="https:"?"wss:":"ws:",d=window.location.host;r=`${c}//${d}/ws/logs`}return l?`${r}?token=${encodeURIComponent(l)}`:r}async getWsToken(){try{const l=await ke("/api/webui/ws-token",{method:"GET",credentials:"include"});if(!l.ok)return console.error("่Žทๅ– WebSocket token ๅคฑ่ดฅ:",l.status),null;const r=await l.json();return r.success&&r.token?r.token:null}catch(l){return console.error("่Žทๅ– WebSocket token ๅคฑ่ดฅ:",l),null}}async connect(){if(this.ws?.readyState===WebSocket.OPEN||this.ws?.readyState===WebSocket.CONNECTING)return;if(window.location.pathname==="/auth"){console.log("๐Ÿ“ก ๅœจ็™ปๅฝ•้กต้ข๏ผŒ่ทณ่ฟ‡ WebSocket ่ฟžๆŽฅ");return}if(!await dc()){console.log("๐Ÿ“ก ๆœช็™ปๅฝ•๏ผŒ่ทณ่ฟ‡ WebSocket ่ฟžๆŽฅ");return}const r=await this.getWsToken();if(!r){console.log("๐Ÿ“ก ๆ— ๆณ•่Žทๅ– WebSocket token๏ผŒ่ทณ่ฟ‡่ฟžๆŽฅ");return}const c=this.getWebSocketUrl(r);try{this.ws=new WebSocket(c),this.ws.onopen=()=>{this.isConnected=!0,this.reconnectAttempts=0,this.notifyConnection(!0),this.startHeartbeat()},this.ws.onmessage=d=>{try{if(d.data==="pong")return;const m=JSON.parse(d.data);this.notifyLog(m)}catch(m){console.error("่งฃๆžๆ—ฅๅฟ—ๆถˆๆฏๅคฑ่ดฅ:",m)}},this.ws.onerror=d=>{console.error("โŒ WebSocket ้”™่ฏฏ:",d),this.isConnected=!1,this.notifyConnection(!1)},this.ws.onclose=()=>{this.isConnected=!1,this.notifyConnection(!1),this.stopHeartbeat(),this.attemptReconnect()}}catch(d){console.error("ๅˆ›ๅปบ WebSocket ่ฟžๆŽฅๅคฑ่ดฅ:",d),this.attemptReconnect()}}attemptReconnect(){const l=this.getMaxReconnectAttempts();if(this.reconnectAttempts>=l)return;this.reconnectAttempts+=1;const r=this.getReconnectInterval(),c=Math.min(r*this.reconnectAttempts,3e4);this.reconnectTimeout=window.setTimeout(()=>{this.connect()},c)}startHeartbeat(){this.heartbeatInterval=window.setInterval(()=>{this.ws?.readyState===WebSocket.OPEN&&this.ws.send("ping")},3e4)}stopHeartbeat(){this.heartbeatInterval!==null&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null)}disconnect(){this.reconnectTimeout!==null&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),this.stopHeartbeat(),this.ws&&(this.ws.close(),this.ws=null),this.isConnected=!1,this.reconnectAttempts=0}onLog(l){return this.logCallbacks.add(l),()=>this.logCallbacks.delete(l)}onConnectionChange(l){return this.connectionCallbacks.add(l),l(this.isConnected),()=>this.connectionCallbacks.delete(l)}notifyLog(l){if(!this.logCache.some(c=>c.id===l.id)){this.logCache.push(l);const c=this.getMaxCacheSize();this.logCache.length>c&&(this.logCache=this.logCache.slice(-c)),this.logCallbacks.forEach(d=>{try{d(l)}catch(m){console.error("ๆ—ฅๅฟ—ๅ›ž่ฐƒๆ‰ง่กŒๅคฑ่ดฅ:",m)}})}}notifyConnection(l){this.connectionCallbacks.forEach(r=>{try{r(l)}catch(c){console.error("่ฟžๆŽฅ็Šถๆ€ๅ›ž่ฐƒๆ‰ง่กŒๅคฑ่ดฅ:",c)}})}getAllLogs(){return[...this.logCache]}clearLogs(){this.logCache=[]}getConnectionStatus(){return this.isConnected}}const Qn=new k2;typeof window<"u"&&setTimeout(()=>{Qn.connect()},100);const bs=kw,wt=Cw,C2=Sw,Gv=u.forwardRef(({className:a,...l},r)=>e.jsx(yj,{className:P("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),...l,ref:r}));Gv.displayName=yj.displayName;const xs=u.forwardRef(({className:a,...l},r)=>e.jsxs(C2,{children:[e.jsx(Gv,{}),e.jsx(wj,{ref:r,className:P("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",a),...l})]}));xs.displayName=wj.displayName;const hs=({className:a,...l})=>e.jsx("div",{className:P("flex flex-col space-y-2 text-center sm:text-left",a),...l});hs.displayName="AlertDialogHeader";const fs=({className:a,...l})=>e.jsx("div",{className:P("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",a),...l});fs.displayName="AlertDialogFooter";const ps=u.forwardRef(({className:a,...l},r)=>e.jsx(_j,{ref:r,className:P("text-lg font-semibold",a),...l}));ps.displayName=_j.displayName;const gs=u.forwardRef(({className:a,...l},r)=>e.jsx(Sj,{ref:r,className:P("text-sm text-muted-foreground",a),...l}));gs.displayName=Sj.displayName;const js=u.forwardRef(({className:a,variant:l,...r},c)=>e.jsx(kj,{ref:c,className:P(si({variant:l}),a),...r}));js.displayName=kj.displayName;const vs=u.forwardRef(({className:a,...l},r)=>e.jsx(Cj,{ref:r,className:P(si({variant:"outline"}),"mt-2 sm:mt-0",a),...l}));vs.displayName=Cj.displayName;function T2(){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(Jt,{defaultValue:"appearance",className:"w-full",children:[e.jsxs(Gt,{className:"grid w-full grid-cols-2 sm:grid-cols-4 gap-0.5 sm:gap-1 h-auto p-1",children:[e.jsxs(Xe,{value:"appearance",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(A_,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"ๅค–่ง‚"})]}),e.jsxs(Xe,{value:"security",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(ov,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"ๅฎ‰ๅ…จ"})]}),e.jsxs(Xe,{value:"other",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(Sn,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"ๅ…ถไป–"})]}),e.jsxs(Xe,{value:"about",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(Yt,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"ๅ…ณไบŽ"})]})]}),e.jsxs(ts,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[e.jsx(Ss,{value:"appearance",className:"mt-0",children:e.jsx(E2,{})}),e.jsx(Ss,{value:"security",className:"mt-0",children:e.jsx(M2,{})}),e.jsx(Ss,{value:"other",className:"mt-0",children:e.jsx(A2,{})}),e.jsx(Ss,{value:"about",className:"mt-0",children:e.jsx(z2,{})})]})]})]})}function Bg(a){const l=document.documentElement,c={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[a];if(c)l.style.setProperty("--primary",c.hsl),c.gradient?(l.style.setProperty("--primary-gradient",c.gradient),l.classList.add("has-gradient")):(l.style.removeProperty("--primary-gradient"),l.classList.remove("has-gradient"));else if(a.startsWith("#")){const d=m=>{m=m.replace("#","");const h=parseInt(m.substring(0,2),16)/255,f=parseInt(m.substring(2,4),16)/255,p=parseInt(m.substring(4,6),16)/255,g=Math.max(h,f,p),N=Math.min(h,f,p);let j=0,b=0;const y=(g+N)/2;if(g!==N){const w=g-N;switch(b=y>.5?w/(2-g-N):w/(g+N),g){case h:j=((f-p)/w+(flocalStorage.getItem("accent-color")||"blue");u.useEffect(()=>{const g=localStorage.getItem("accent-color")||"blue";Bg(g)},[]);const p=g=>{f(g),localStorage.setItem("accent-color",g),Bg(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(Im,{value:"light",current:a,onChange:l,label:"ๆต…่‰ฒ",description:"ๅง‹็ปˆไฝฟ็”จๆต…่‰ฒไธป้ข˜"}),e.jsx(Im,{value:"dark",current:a,onChange:l,label:"ๆทฑ่‰ฒ",description:"ๅง‹็ปˆไฝฟ็”จๆทฑ่‰ฒไธป้ข˜"}),e.jsx(Im,{value:"system",current:a,onChange:l,label:"่ทŸ้š็ณป็ปŸ",description:"ๆ นๆฎ็ณป็ปŸ่ฎพ็ฝฎ่‡ชๅŠจๅˆ‡ๆข"})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"ไธป้ข˜่‰ฒ"}),e.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"ๅ•่‰ฒ"}),e.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[e.jsx(Wa,{value:"blue",current:h,onChange:p,label:"่“่‰ฒ",colorClass:"bg-blue-500"}),e.jsx(Wa,{value:"purple",current:h,onChange:p,label:"็ดซ่‰ฒ",colorClass:"bg-purple-500"}),e.jsx(Wa,{value:"green",current:h,onChange:p,label:"็ปฟ่‰ฒ",colorClass:"bg-green-500"}),e.jsx(Wa,{value:"orange",current:h,onChange:p,label:"ๆฉ™่‰ฒ",colorClass:"bg-orange-500"}),e.jsx(Wa,{value:"pink",current:h,onChange:p,label:"็ฒ‰่‰ฒ",colorClass:"bg-pink-500"}),e.jsx(Wa,{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(Wa,{value:"gradient-sunset",current:h,onChange:p,label:"ๆ—ฅ่ฝ",colorClass:"bg-gradient-to-r from-orange-500 to-pink-500"}),e.jsx(Wa,{value:"gradient-ocean",current:h,onChange:p,label:"ๆตทๆด‹",colorClass:"bg-gradient-to-r from-blue-500 to-cyan-500"}),e.jsx(Wa,{value:"gradient-forest",current:h,onChange:p,label:"ๆฃฎๆž—",colorClass:"bg-gradient-to-r from-green-500 to-emerald-500"}),e.jsx(Wa,{value:"gradient-aurora",current:h,onChange:p,label:"ๆžๅ…‰",colorClass:"bg-gradient-to-r from-purple-500 to-pink-500"}),e.jsx(Wa,{value:"gradient-fire",current:h,onChange:p,label:"็ƒˆ็„ฐ",colorClass:"bg-gradient-to-r from-red-500 to-orange-500"}),e.jsx(Wa,{value:"gradient-twilight",current:h,onChange:p,label:"ๆšฎๅ…‰",colorClass:"bg-gradient-to-r from-indigo-500 to-purple-500"})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"่‡ชๅฎšไน‰้ขœ่‰ฒ"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 sm:gap-4",children:[e.jsx("div",{className:"flex-1",children:e.jsx("input",{type:"color",value:h.startsWith("#")?h:"#3b82f6",onChange:g=>p(g.target.value),className:"h-10 sm:h-12 w-full rounded-lg border-2 border-border cursor-pointer",title:"้€‰ๆ‹ฉ่‡ชๅฎšไน‰้ขœ่‰ฒ"})}),e.jsx("div",{className:"flex-1",children:e.jsx(ae,{type:"text",value:h,onChange:g=>p(g.target.value),placeholder:"#3b82f6",className:"font-mono text-sm"})})]}),e.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground mt-2",children:"็‚นๅ‡ป่‰ฒๅ—้€‰ๆ‹ฉ้ขœ่‰ฒ๏ผŒๆˆ–ๆ‰‹ๅŠจ่พ“ๅ…ฅ HEX ้ขœ่‰ฒไปฃ็ "})]})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"ๅŠจ็”ปๆ•ˆๆžœ"}),e.jsxs("div",{className:"space-y-2 sm:space-y-3",children:[e.jsx("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5 flex-1",children:[e.jsx(T,{htmlFor:"animations",className:"text-base font-medium cursor-pointer",children:"ๅฏ็”จๅŠจ็”ปๆ•ˆๆžœ"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๅ…ณ้—ญๅŽๅฐ†็ฆ็”จๆ‰€ๆœ‰่ฟ‡ๆธกๅŠจ็”ปๅ’Œ็‰นๆ•ˆ๏ผŒๆๅ‡ๆ€ง่ƒฝ"})]}),e.jsx(qe,{id:"animations",checked:r,onCheckedChange:c})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5 flex-1",children:[e.jsx(T,{htmlFor:"waves-background",className:"text-base font-medium cursor-pointer",children:"็™ปๅฝ•้กตๆณขๆตช่ƒŒๆ™ฏ"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๅ…ณ้—ญๅŽ็™ปๅฝ•้กตๅฐ†ไฝฟ็”จ็บฏ่‰ฒ่ƒŒๆ™ฏ๏ผŒ้€‚ๅˆไฝŽๆ€ง่ƒฝ่ฎพๅค‡"})]}),e.jsx(qe,{id:"waves-background",checked:d,onCheckedChange:m})]})})]})]})]})}function M2(){const a=ha(),[l,r]=u.useState(""),[c,d]=u.useState(""),[m,h]=u.useState(!1),[f,p]=u.useState(!1),[g,N]=u.useState(!1),[j,b]=u.useState(!1),[y,w]=u.useState(!1),[z,M]=u.useState(!1),[S,F]=u.useState(""),[E,C]=u.useState(!1),{toast:R}=nt(),H=u.useMemo(()=>g2(c),[c]),O=async re=>{if(!l){R({title:"ๆ— ๆณ•ๅคๅˆถ",description:"Token ๅญ˜ๅ‚จๅœจๅฎ‰ๅ…จ Cookie ไธญ๏ผŒ่ฏท้‡ๆ–ฐ็”Ÿๆˆไปฅ่Žทๅ–ๆ–ฐ Token",variant:"destructive"});return}try{await navigator.clipboard.writeText(re),w(!0),R({title:"ๅคๅˆถๆˆๅŠŸ",description:"Token ๅทฒๅคๅˆถๅˆฐๅ‰ช่ดดๆฟ"}),setTimeout(()=>w(!1),2e3)}catch{R({title:"ๅคๅˆถๅคฑ่ดฅ",description:"่ฏทๆ‰‹ๅŠจๅคๅˆถ Token",variant:"destructive"})}},X=async()=>{if(!c.trim()){R({title:"่พ“ๅ…ฅ้”™่ฏฏ",description:"่ฏท่พ“ๅ…ฅๆ–ฐ็š„ Token",variant:"destructive"});return}if(!H.isValid){const re=H.rules.filter(ge=>!ge.passed).map(ge=>ge.label).join(", ");R({title:"ๆ ผๅผ้”™่ฏฏ",description:`Token ไธ็ฌฆๅˆ่ฆๆฑ‚: ${re}`,variant:"destructive"});return}N(!0);try{const re=await fetch("/api/webui/auth/update",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({new_token:c.trim()})}),ge=await re.json();re.ok&&ge.success?(d(""),r(c.trim()),R({title:"ๆ›ดๆ–ฐๆˆๅŠŸ",description:"Access Token ๅทฒๆ›ดๆ–ฐ๏ผŒๅณๅฐ†่ทณ่ฝฌๅˆฐ็™ปๅฝ•้กต"}),setTimeout(()=>{a({to:"/auth"})},1500)):R({title:"ๆ›ดๆ–ฐๅคฑ่ดฅ",description:ge.message||"ๆ— ๆณ•ๆ›ดๆ–ฐ Token",variant:"destructive"})}catch(re){console.error("ๆ›ดๆ–ฐ Token ้”™่ฏฏ:",re),R({title:"ๆ›ดๆ–ฐๅคฑ่ดฅ",description:"่ฟžๆŽฅๆœๅŠกๅ™จๅคฑ่ดฅ",variant:"destructive"})}finally{N(!1)}},L=async()=>{b(!0);try{const re=await fetch("/api/webui/auth/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"}),ge=await re.json();re.ok&&ge.success?(r(ge.token),F(ge.token),M(!0),C(!1),R({title:"็”ŸๆˆๆˆๅŠŸ",description:"ๆ–ฐ็š„ Access Token ๅทฒ็”Ÿๆˆ๏ผŒ่ฏทๅŠๆ—ถไฟๅญ˜"})):R({title:"็”Ÿๆˆๅคฑ่ดฅ",description:ge.message||"ๆ— ๆณ•็”Ÿๆˆๆ–ฐ Token",variant:"destructive"})}catch(re){console.error("็”Ÿๆˆ Token ้”™่ฏฏ:",re),R({title:"็”Ÿๆˆๅคฑ่ดฅ",description:"่ฟžๆŽฅๆœๅŠกๅ™จๅคฑ่ดฅ",variant:"destructive"})}finally{b(!1)}},me=async()=>{try{await navigator.clipboard.writeText(S),C(!0),R({title:"ๅคๅˆถๆˆๅŠŸ",description:"Token ๅทฒๅคๅˆถๅˆฐๅ‰ช่ดดๆฟ"})}catch{R({title:"ๅคๅˆถๅคฑ่ดฅ",description:"่ฏทๆ‰‹ๅŠจๅคๅˆถ Token",variant:"destructive"})}},Ne=()=>{M(!1),setTimeout(()=>{F(""),C(!1)},300),setTimeout(()=>{a({to:"/auth"})},500)},je=re=>{re||Ne()};return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsx(Qs,{open:z,onOpenChange:je,children:e.jsxs(Hs,{className:"sm:max-w-md",children:[e.jsxs(qs,{children:[e.jsxs(Vs,{className:"flex items-center gap-2",children:[e.jsx(Lt,{className:"h-5 w-5 text-yellow-500"}),"ๆ–ฐ็š„ Access Token"]}),e.jsx(at,{children:"่ฟ™ๆ˜ฏๆ‚จ็š„ๆ–ฐ Token๏ผŒ่ฏท็ซ‹ๅณไฟๅญ˜ใ€‚ๅ…ณ้—ญๆญค็ช—ๅฃๅŽๅฐ†่ทณ่ฝฌๅˆฐ็™ปๅฝ•้กต้ขใ€‚"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-lg border-2 border-primary/20 bg-primary/5 p-4",children:[e.jsx(T,{className:"text-xs text-muted-foreground mb-2 block",children:"ๆ‚จ็š„ๆ–ฐ Token (64ไฝๅฎ‰ๅ…จไปค็‰Œ)"}),e.jsx("div",{className:"font-mono text-sm break-all select-all bg-background p-3 rounded border",children:S})]}),e.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Lt,{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(gt,{className:"gap-2 sm:gap-0",children:[e.jsx(_,{variant:"outline",onClick:me,className:"gap-2",children:E?e.jsxs(e.Fragment,{children:[e.jsx(Ot,{className:"h-4 w-4 text-green-500"}),"ๅทฒๅคๅˆถ"]}):e.jsxs(e.Fragment,{children:[e.jsx(qo,{className:"h-4 w-4"}),"ๅคๅˆถ Token"]})}),e.jsx(_,{onClick:Ne,children:"ๆˆ‘ๅทฒไฟๅญ˜๏ผŒๅ…ณ้—ญ"})]})]})}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"ๅฝ“ๅ‰ Access Token"}),e.jsx("div",{className:"space-y-3 sm:space-y-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"current-token",className:"text-sm",children:"ๆ‚จ็š„่ฎฟ้—ฎไปค็‰Œ"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(ae,{id:"current-token",type:m?"text":"password",value:l||"โ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ขโ€ข",readOnly:!0,className:"pr-10 font-mono text-sm",placeholder:"Token ๅญ˜ๅ‚จๅœจๅฎ‰ๅ…จ Cookie ไธญ"}),e.jsx("button",{onClick:()=>{l?h(!m):R({title:"ๆ— ๆณ•ๆŸฅ็œ‹",description:'Token ๅญ˜ๅ‚จๅœจๅฎ‰ๅ…จ Cookie ไธญ๏ผŒๅฆ‚้œ€ๆ–ฐ Token ่ฏท็‚นๅ‡ป"้‡ๆ–ฐ็”Ÿๆˆ"'})},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:m?"้š่—":"ๆ˜พ็คบ",children:m?e.jsx(ic,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(ua,{className:"h-4 w-4 text-muted-foreground"})})]}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[e.jsx(_,{variant:"outline",size:"icon",onClick:()=>O(l),title:"ๅคๅˆถๅˆฐๅ‰ช่ดดๆฟ",className:"flex-shrink-0",disabled:!l,children:y?e.jsx(Ot,{className:"h-4 w-4 text-green-500"}):e.jsx(qo,{className:"h-4 w-4"})}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{variant:"outline",disabled:j,className:"gap-2 flex-1 sm:flex-none",children:[e.jsx(dt,{className:P("h-4 w-4",j&&"animate-spin")}),e.jsx("span",{className:"hidden sm:inline",children:"้‡ๆ–ฐ็”Ÿๆˆ"}),e.jsx("span",{className:"sm:hidden",children:"็”Ÿๆˆ"})]})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎค้‡ๆ–ฐ็”Ÿๆˆ Token"}),e.jsx(gs,{children:"่ฟ™ๅฐ†็”Ÿๆˆไธ€ไธชๆ–ฐ็š„ 64 ไฝๅฎ‰ๅ…จไปค็‰Œ๏ผŒๅนถไฝฟๅฝ“ๅ‰ Token ็ซ‹ๅณๅคฑๆ•ˆใ€‚ ๆ‚จ้œ€่ฆไฝฟ็”จๆ–ฐ Token ้‡ๆ–ฐ็™ปๅฝ•็ณป็ปŸใ€‚ๆญคๆ“ไฝœไธๅฏๆ’ค้”€๏ผŒ็กฎๅฎš่ฆ็ปง็ปญๅ—๏ผŸ"})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:L,children:"็กฎ่ฎค็”Ÿๆˆ"})]})]})]})]})]}),e.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground",children:"่ฏทๅฆฅๅ–„ไฟ็ฎกๆ‚จ็š„ Access Token๏ผŒไธ่ฆๆณ„้œฒ็ป™ไป–ไบบ"})]})})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"่‡ชๅฎšไน‰ Access Token"}),e.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"new-token",className:"text-sm",children:"ๆ–ฐ็š„่ฎฟ้—ฎไปค็‰Œ"}),e.jsxs("div",{className:"relative",children:[e.jsx(ae,{id:"new-token",type:f?"text":"password",value:c,onChange:re=>d(re.target.value),className:"pr-10 font-mono text-sm",placeholder:"่พ“ๅ…ฅ่‡ชๅฎšไน‰ Token"}),e.jsx("button",{onClick:()=>p(!f),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:f?"้š่—":"ๆ˜พ็คบ",children:f?e.jsx(ic,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(ua,{className:"h-4 w-4 text-muted-foreground"})})]}),c&&e.jsxs("div",{className:"mt-3 space-y-2 p-3 rounded-lg bg-muted/50",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Token ๅฎ‰ๅ…จ่ฆๆฑ‚:"}),e.jsx("div",{className:"space-y-1.5",children:H.rules.map(re=>e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[re.passed?e.jsx(st,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):e.jsx(ta,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:P(re.passed?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:re.label})]},re.id))}),H.isValid&&e.jsx("div",{className:"mt-2 pt-2 border-t border-border",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-400",children:[e.jsx(Ot,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:"Token ๆ ผๅผๆญฃ็กฎ๏ผŒๅฏไปฅไฝฟ็”จ"})]})})]})]}),e.jsx(_,{onClick:X,disabled:g||!H.isValid||!c,className:"w-full sm:w-auto",children:g?"ๆ›ดๆ–ฐไธญ...":"ๆ›ดๆ–ฐ่‡ชๅฎšไน‰ Token"})]})]}),e.jsxs("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3 sm:p-4",children:[e.jsx("h4",{className:"text-sm sm:text-base font-semibold text-yellow-900 dark:text-yellow-200 mb-2",children:"ๅฎ‰ๅ…จๆ็คบ"}),e.jsxs("ul",{className:"text-xs sm:text-sm text-yellow-800 dark:text-yellow-300 space-y-1 list-disc list-inside",children:[e.jsx("li",{children:"้‡ๆ–ฐ็”Ÿๆˆ Token ไผšๅˆ›ๅปบ็ณป็ปŸ้šๆœบ็”Ÿๆˆ็š„ 64 ไฝๅฎ‰ๅ…จไปค็‰Œ"}),e.jsx("li",{children:"่‡ชๅฎšไน‰ Token ๅฟ…้กปๆปก่ถณๆ‰€ๆœ‰ๅฎ‰ๅ…จ่ฆๆฑ‚ๆ‰่ƒฝไฝฟ็”จ"}),e.jsx("li",{children:"ๆ›ดๆ–ฐ Token ๅŽ๏ผŒๆ—ง็š„ Token ๅฐ†็ซ‹ๅณๅคฑๆ•ˆ"}),e.jsx("li",{children:"่ฏทๅœจๅฎ‰ๅ…จ็š„็Žฏๅขƒไธ‹ๆŸฅ็œ‹ๅ’Œๅคๅˆถ Token"}),e.jsx("li",{children:"ๅฆ‚ๆžœๆ€€็–‘ Token ๆณ„้œฒ๏ผŒ่ฏท็ซ‹ๅณ้‡ๆ–ฐ็”Ÿๆˆๆˆ–ๆ›ดๆ–ฐ"}),e.jsx("li",{children:"ๅปบ่ฎฎไฝฟ็”จ็ณป็ปŸ็”Ÿๆˆ็š„ Token ไปฅ่Žทๅพ—ๆœ€้ซ˜ๅฎ‰ๅ…จๆ€ง"})]})]})]})}function A2(){const a=ha(),{toast:l}=nt(),[r,c]=u.useState(!1),[d,m]=u.useState(!1),[h,f]=u.useState(()=>zt("logCacheSize")),[p,g]=u.useState(()=>zt("wsReconnectInterval")),[N,j]=u.useState(()=>zt("wsMaxReconnectAttempts")),[b,y]=u.useState(()=>zt("dataSyncInterval")),[w,z]=u.useState(()=>Ig()),[M,S]=u.useState(!1),[F,E]=u.useState(!1),C=u.useRef(null);if(d)throw new Error("่ฟ™ๆ˜ฏไธ€ไธชๆ‰‹ๅŠจ่งฆๅ‘็š„ๆต‹่ฏ•้”™่ฏฏ๏ผŒ็”จไบŽ้ชŒ่ฏ้”™่ฏฏ่พน็•Œ็ป„ไปถๆ˜ฏๅฆๆญฃๅธธๅทฅไฝœใ€‚");const R=()=>{z(Ig())},H=D=>{const Q=D[0];f(Q),Yr("logCacheSize",Q)},O=D=>{const Q=D[0];g(Q),Yr("wsReconnectInterval",Q)},X=D=>{const Q=D[0];j(Q),Yr("wsMaxReconnectAttempts",Q)},L=D=>{const Q=D[0];y(Q),Yr("dataSyncInterval",Q)},me=()=>{Qn.clearLogs(),l({title:"ๆ—ฅๅฟ—ๅทฒๆธ…้™ค",description:"ๆ—ฅๅฟ—็ผ“ๅญ˜ๅทฒๆธ…็ฉบ"})},Ne=()=>{const D=_2();R(),l({title:"็ผ“ๅญ˜ๅทฒๆธ…้™ค",description:`ๅทฒๆธ…้™ค ${D.clearedKeys.length} ้กน็ผ“ๅญ˜ๆ•ฐๆฎ`})},je=()=>{S(!0);try{const D=b2(),Q=JSON.stringify(D,null,2),I=new Blob([Q],{type:"application/json"}),ue=URL.createObjectURL(I),Y=document.createElement("a");Y.href=ue,Y.download=`maibot-webui-settings-${new Date().toISOString().slice(0,10)}.json`,document.body.appendChild(Y),Y.click(),document.body.removeChild(Y),URL.revokeObjectURL(ue),l({title:"ๅฏผๅ‡บๆˆๅŠŸ",description:"่ฎพ็ฝฎๅทฒๅฏผๅ‡บไธบ JSON ๆ–‡ไปถ"})}catch(D){console.error("ๅฏผๅ‡บ่ฎพ็ฝฎๅคฑ่ดฅ:",D),l({title:"ๅฏผๅ‡บๅคฑ่ดฅ",description:"ๆ— ๆณ•ๅฏผๅ‡บ่ฎพ็ฝฎ",variant:"destructive"})}finally{S(!1)}},re=D=>{const Q=D.target.files?.[0];if(!Q)return;E(!0);const I=new FileReader;I.onload=ue=>{try{const Y=ue.target?.result,we=JSON.parse(Y),fe=y2(we);fe.success?(f(zt("logCacheSize")),g(zt("wsReconnectInterval")),j(zt("wsMaxReconnectAttempts")),y(zt("dataSyncInterval")),R(),l({title:"ๅฏผๅ…ฅๆˆๅŠŸ",description:`ๆˆๅŠŸๅฏผๅ…ฅ ${fe.imported.length} ้กน่ฎพ็ฝฎ${fe.skipped.length>0?`๏ผŒ่ทณ่ฟ‡ ${fe.skipped.length} ้กน`:""}`}),(fe.imported.includes("theme")||fe.imported.includes("accentColor"))&&l({title:"ๆ็คบ",description:"้ƒจๅˆ†่ฎพ็ฝฎ้œ€่ฆๅˆทๆ–ฐ้กต้ขๆ‰่ƒฝๅฎŒๅ…จ็”Ÿๆ•ˆ"})):l({title:"ๅฏผๅ…ฅๅคฑ่ดฅ",description:"ๆฒกๆœ‰ๆœ‰ๆ•ˆ็š„่ฎพ็ฝฎ้กนๅฏๅฏผๅ…ฅ",variant:"destructive"})}catch(Y){console.error("ๅฏผๅ…ฅ่ฎพ็ฝฎๅคฑ่ดฅ:",Y),l({title:"ๅฏผๅ…ฅๅคฑ่ดฅ",description:"ๆ–‡ไปถๆ ผๅผๆ— ๆ•ˆ",variant:"destructive"})}finally{E(!1),C.current&&(C.current.value="")}},I.readAsText(Q)},ge=()=>{w2(),f(jl.logCacheSize),g(jl.wsReconnectInterval),j(jl.wsMaxReconnectAttempts),y(jl.dataSyncInterval),R(),l({title:"ๅทฒ้‡็ฝฎ",description:"ๆ‰€ๆœ‰่ฎพ็ฝฎๅทฒๆขๅคไธบ้ป˜่ฎคๅ€ผ๏ผŒๅˆทๆ–ฐ้กต้ขไปฅๅบ”็”จๆ›ดๆ”น"})},pe=async()=>{c(!0);try{const D=await ke("/api/webui/setup/reset",{method:"POST"}),Q=await D.json();D.ok&&Q.success?(l({title:"้‡็ฝฎๆˆๅŠŸ",description:"ๅณๅฐ†่ฟ›ๅ…ฅๅˆๆฌก้…็ฝฎๅ‘ๅฏผ"}),setTimeout(()=>{a({to:"/setup"})},1e3)):l({title:"้‡็ฝฎๅคฑ่ดฅ",description:Q.message||"ๆ— ๆณ•้‡็ฝฎ้…็ฝฎ็Šถๆ€",variant:"destructive"})}catch(D){console.error("้‡็ฝฎ้…็ฝฎ็Šถๆ€้”™่ฏฏ:",D),l({title:"้‡็ฝฎๅคฑ่ดฅ",description:"่ฟžๆŽฅๆœๅŠกๅ™จๅคฑ่ดฅ",variant:"destructive"})}finally{c(!1)}};return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4 flex items-center gap-2",children:[e.jsx(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(z_,{className:"h-4 w-4"}),"ๆœฌๅœฐๅญ˜ๅ‚จไฝฟ็”จ"]}),e.jsx(_,{variant:"ghost",size:"sm",onClick:R,className:"h-7 px-2",children:e.jsx(dt,{className:"h-3 w-3"})})]}),e.jsx("div",{className:"text-2xl font-bold text-primary",children:S2(w.used)}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[w.items," ไธชๅญ˜ๅ‚จ้กน"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-sm font-medium",children:"ๆ—ฅๅฟ—็ผ“ๅญ˜ๅคงๅฐ"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[h," ๆก"]})]}),e.jsx(el,{value:[h],onValueChange:H,min:100,max:5e3,step:100,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆŽงๅˆถๆ—ฅๅฟ—ๆŸฅ็œ‹ๅ™จๆœ€ๅคš็ผ“ๅญ˜็š„ๆ—ฅๅฟ—ๆกๆ•ฐ๏ผŒ่พƒๅคง็š„ๅ€ผไผšๅ ็”จๆ›ดๅคšๅ†…ๅญ˜"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-sm font-medium",children:"้ฆ–้กตๆ•ฐๆฎๅˆทๆ–ฐ้—ด้š”"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[b," ็ง’"]})]}),e.jsx(el,{value:[b],onValueChange:L,min:10,max:120,step:5,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆŽงๅˆถ้ฆ–้กต็ปŸ่ฎกๆ•ฐๆฎ็š„่‡ชๅŠจๅˆทๆ–ฐ้—ด้š”"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-sm font-medium",children:"WebSocket ้‡่ฟž้—ด้š”"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[p/1e3," ็ง’"]})]}),e.jsx(el,{value:[p],onValueChange:O,min:1e3,max:1e4,step:500,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆ—ฅๅฟ— WebSocket ่ฟžๆŽฅๆ–ญๅผ€ๅŽ็š„้‡่ฟžๅŸบ็ก€้—ด้š”"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-sm font-medium",children:"WebSocket ๆœ€ๅคง้‡่ฟžๆฌกๆ•ฐ"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[N," ๆฌก"]})]}),e.jsx(el,{value:[N],onValueChange:X,min:3,max:30,step:1,className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"่ฟžๆŽฅๅคฑ่ดฅๅŽ็š„ๆœ€ๅคง้‡่ฟžๅฐ่ฏ•ๆฌกๆ•ฐ"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 pt-2",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:me,className:"gap-2",children:[e.jsx(os,{className:"h-4 w-4"}),"ๆธ…้™คๆ—ฅๅฟ—็ผ“ๅญ˜"]}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:"gap-2",children:[e.jsx(os,{className:"h-4 w-4"}),"ๆธ…้™คๆœฌๅœฐ็ผ“ๅญ˜"]})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๆธ…้™คๆœฌๅœฐ็ผ“ๅญ˜"}),e.jsx(gs,{children:"่ฟ™ๅฐ†ๆธ…้™คๆ‰€ๆœ‰ๆœฌๅœฐ็ผ“ๅญ˜็š„่ฎพ็ฝฎๅ’Œๆ•ฐๆฎ๏ผˆไธๅŒ…ๆ‹ฌ็™ปๅฝ•ๅ‡ญ่ฏ๏ผ‰ใ€‚ ๆ‚จๅฏ่ƒฝ้œ€่ฆ้‡ๆ–ฐ้…็ฝฎ้ƒจๅˆ†ๅๅฅฝ่ฎพ็ฝฎใ€‚็กฎๅฎš่ฆ็ปง็ปญๅ—๏ผŸ"})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:Ne,children:"็กฎ่ฎคๆธ…้™ค"})]})]})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4 flex items-center gap-2",children:[e.jsx(na,{className:"h-5 w-5"}),"ๅฏผๅ…ฅ/ๅฏผๅ‡บ่ฎพ็ฝฎ"]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"ๅฏผๅ‡บๅฝ“ๅ‰็š„็•Œ้ข่ฎพ็ฝฎไปฅไพฟๅค‡ไปฝ๏ผŒๆˆ–ไปŽไน‹ๅ‰ๅฏผๅ‡บ็š„ๆ–‡ไปถไธญๆขๅค่ฎพ็ฝฎใ€‚"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(_,{variant:"outline",onClick:je,disabled:M,className:"gap-2",children:[e.jsx(na,{className:"h-4 w-4"}),M?"ๅฏผๅ‡บไธญ...":"ๅฏผๅ‡บ่ฎพ็ฝฎ"]}),e.jsx("input",{ref:C,type:"file",accept:".json",onChange:re,className:"hidden"}),e.jsxs(_,{variant:"outline",onClick:()=>C.current?.click(),disabled:F,className:"gap-2",children:[e.jsx(cc,{className:"h-4 w-4"}),F?"ๅฏผๅ…ฅไธญ...":"ๅฏผๅ…ฅ่ฎพ็ฝฎ"]})]}),e.jsx("div",{className:"pt-2 border-t",children:e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:"gap-2 text-destructive hover:text-destructive",children:[e.jsx(rc,{className:"h-4 w-4"}),"้‡็ฝฎๆ‰€ๆœ‰่ฎพ็ฝฎไธบ้ป˜่ฎคๅ€ผ"]})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎค้‡็ฝฎๆ‰€ๆœ‰่ฎพ็ฝฎ"}),e.jsx(gs,{children:"่ฟ™ๅฐ†ๆŠŠๆ‰€ๆœ‰็•Œ้ข่ฎพ็ฝฎๆขๅคไธบ้ป˜่ฎคๅ€ผ๏ผŒๅŒ…ๆ‹ฌไธป้ข˜ใ€้ขœ่‰ฒใ€ๅŠจ็”ป็ญ‰ๅๅฅฝ่ฎพ็ฝฎใ€‚ ๆญคๆ“ไฝœไธไผšๅฝฑๅ“ๆ‚จ็š„็™ปๅฝ•็Šถๆ€ใ€‚็กฎๅฎš่ฆ็ปง็ปญๅ—๏ผŸ"})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{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(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{variant:"outline",disabled:r,className:"gap-2",children:[e.jsx(rc,{className:P("h-4 w-4",r&&"animate-spin")}),"้‡ๆ–ฐ่ฟ›่กŒๅˆๆฌก้…็ฝฎ"]})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎค้‡ๆ–ฐ้…็ฝฎ"}),e.jsx(gs,{children:"่ฟ™ๅฐ†ๅธฆๆ‚จ้‡ๆ–ฐ่ฟ›ๅ…ฅๅˆๆฌก้…็ฝฎๅ‘ๅฏผใ€‚ๆ‚จๅฏไปฅ้‡ๆ–ฐ่ฎพ็ฝฎ็ณป็ปŸ็š„ๅŸบ็ก€้…็ฝฎ้กนใ€‚็กฎๅฎš่ฆ็ปง็ปญๅ—๏ผŸ"})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:pe,children:"็กฎ่ฎค้‡็ฝฎ"})]})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border border-dashed border-yellow-500/50 bg-yellow-500/5 p-4 sm:p-6",children:[e.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4 flex items-center gap-2",children:[e.jsx(Lt,{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(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{variant:"destructive",className:"gap-2",children:[e.jsx(Lt,{className:"h-4 w-4"}),"่งฆๅ‘ๆต‹่ฏ•้”™่ฏฏ"]})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎค่งฆๅ‘้”™่ฏฏ"}),e.jsx(gs,{children:"่ฟ™ๅฐ†ๆ‰‹ๅŠจ่งฆๅ‘ไธ€ไธช React ้”™่ฏฏ๏ผŒ็”จไบŽๆต‹่ฏ•้”™่ฏฏ่พน็•Œ็ป„ไปถ็š„ๆ˜พ็คบๆ•ˆๆžœใ€‚ ้กต้ขๅฐ†ๆ˜พ็คบ้”™่ฏฏ็•Œ้ข๏ผŒๆ‚จๅฏไปฅ้€š่ฟ‡ๅˆทๆ–ฐ้กต้ขๆˆ–็‚นๅ‡ป่ฟ”ๅ›ž้ฆ–้กตๆฅๆขๅคใ€‚"})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:()=>m(!0),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"็กฎ่ฎค่งฆๅ‘"})]})]})]})]})]})]})}function z2(){return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsx("div",{className:"rounded-lg border-2 border-primary/30 bg-gradient-to-r from-primary/5 to-primary/10 p-4 sm:p-6",children:e.jsxs("div",{className:"flex items-start gap-3 sm:gap-4",children:[e.jsx("div",{className:"flex-shrink-0 rounded-lg bg-primary/10 p-2 sm:p-3",children:e.jsx("svg",{className:"h-6 w-6 sm:h-8 sm:w-8 text-primary",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:e.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-lg sm:text-xl font-bold text-foreground mb-2",children:"ๅผ€ๆบ้กน็›ฎ"}),e.jsx("p",{className:"text-sm sm:text-base text-muted-foreground mb-3",children:"ๆœฌ้กน็›ฎๅœจ GitHub ๅผ€ๆบ๏ผŒๆฌข่ฟŽ Star โญ ๆ”ฏๆŒ๏ผ"}),e.jsxs("a",{href:"https://github.com/Mai-with-u/MaiBot-Dashboard",target:"_blank",rel:"noopener noreferrer",className:P("inline-flex items-center gap-2 px-4 py-2 rounded-lg","bg-primary text-primary-foreground font-medium text-sm","hover:bg-primary/90 transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"),children:[e.jsx("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:e.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})}),"ๅ‰ๅพ€ GitHub",e.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})]})]})}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:["ๅ…ณไบŽ ",Nx]}),e.jsxs("div",{className:"space-y-2 text-xs sm:text-sm text-muted-foreground",children:[e.jsxs("p",{children:["็‰ˆๆœฌ: ",ud]}),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(ts,{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(Et,{name:"React",description:"็”จๆˆท็•Œ้ขๆž„ๅปบๅบ“",license:"MIT"}),e.jsx(Et,{name:"shadcn/ui",description:"ไผ˜้›…็š„ React ็ป„ไปถๅบ“",license:"MIT"}),e.jsx(Et,{name:"Radix UI",description:"ๆ— ๆ ทๅผ็š„ๅฏ่ฎฟ้—ฎ็ป„ไปถๅบ“",license:"MIT"}),e.jsx(Et,{name:"Tailwind CSS",description:"ๅฎž็”จไผ˜ๅ…ˆ็š„ CSS ๆก†ๆžถ",license:"MIT"}),e.jsx(Et,{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(Et,{name:"TanStack Router",description:"็ฑปๅž‹ๅฎ‰ๅ…จ็š„่ทฏ็”ฑๅบ“",license:"MIT"}),e.jsx(Et,{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(Et,{name:"React Hook Form",description:"้ซ˜ๆ€ง่ƒฝ่กจๅ•ๅบ“",license:"MIT"}),e.jsx(Et,{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(Et,{name:"clsx",description:"ๆกไปถ className ๆž„ๅปบๅทฅๅ…ท",license:"MIT"}),e.jsx(Et,{name:"tailwind-merge",description:"Tailwind ็ฑปๅๅˆๅนถๅทฅๅ…ท",license:"MIT"}),e.jsx(Et,{name:"class-variance-authority",description:"็ป„ไปถๅ˜ไฝ“็ฎก็†",license:"Apache-2.0"}),e.jsx(Et,{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(Et,{name:"Framer Motion",description:"React ๅŠจ็”ปๅบ“",license:"MIT"}),e.jsx(Et,{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(Et,{name:"FastAPI",description:"็ŽฐไปฃๅŒ– Python Web ๆก†ๆžถ",license:"MIT"}),e.jsx(Et,{name:"Uvicorn",description:"ASGI ๆœๅŠกๅ™จ",license:"BSD-3-Clause"}),e.jsx(Et,{name:"Pydantic",description:"ๆ•ฐๆฎ้ชŒ่ฏๅบ“",license:"MIT"}),e.jsx(Et,{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(Et,{name:"TypeScript",description:"JavaScript ็š„่ถ…้›†",license:"Apache-2.0"}),e.jsx(Et,{name:"Vite",description:"ไธ‹ไธ€ไปฃๅ‰็ซฏๆž„ๅปบๅทฅๅ…ท",license:"MIT"}),e.jsx(Et,{name:"ESLint",description:"JavaScript ไปฃ็ ๆฃ€ๆŸฅๅทฅๅ…ท",license:"MIT"}),e.jsx(Et,{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 Et({name:a,description:l,license:r}){return e.jsxs("div",{className:"flex items-start justify-between gap-2 rounded-lg border bg-muted/30 p-2.5 sm:p-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium text-foreground truncate",children:a}),e.jsx("p",{className:"text-muted-foreground text-xs mt-0.5",children:l})]}),e.jsx("span",{className:"inline-flex items-center rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary flex-shrink-0",children:r})]})}function Im({value:a,current:l,onChange:r,label:c,description:d}){const m=l===a;return e.jsxs("button",{onClick:()=>r(a),className:P("relative rounded-lg border-2 p-3 sm:p-4 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",m?"border-primary bg-accent":"border-border"),children:[m&&e.jsx("div",{className:"absolute top-2 right-2 sm:top-3 sm:right-3 h-2 w-2 rounded-full bg-primary"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm sm:text-base font-medium",children:c}),e.jsx("div",{className:"text-[10px] sm:text-xs text-muted-foreground",children:d})]}),e.jsxs("div",{className:"mt-2 sm:mt-3 flex gap-1",children:[a==="light"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-200"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-300"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-400"})]}),a==="dark"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-700"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-800"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-900"})]}),a==="system"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-200 to-slate-700"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-300 to-slate-800"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-400 to-slate-900"})]})]})]})}function Wa({value:a,current:l,onChange:r,label:c,colorClass:d}){const m=l===a;return e.jsxs("button",{onClick:()=>r(a),className:P("relative rounded-lg border-2 p-2 sm:p-3 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",m?"border-primary bg-accent":"border-border"),children:[m&&e.jsx("div",{className:"absolute top-1.5 right-1.5 sm:top-2 sm:right-2 h-1.5 w-1.5 sm:h-2 sm:w-2 rounded-full bg-primary"}),e.jsxs("div",{className:"flex flex-col items-center gap-1.5 sm:gap-2",children:[e.jsx("div",{className:P("h-8 w-8 sm:h-10 sm:w-10 rounded-full",d)}),e.jsx("div",{className:"text-[10px] sm:text-xs font-medium text-center",children:c})]})]})}const R2=Date.now()%1e6;class D2{grad3;p;perm;constructor(l=0){this.grad3=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]],this.p=[];for(let r=0;r<256;r++)this.p[r]=Math.floor(Math.random()*256);this.perm=[];for(let r=0;r<512;r++)this.perm[r]=this.p[r&255]}dot(l,r,c){return l[0]*r+l[1]*c}mix(l,r,c){return(1-c)*l+c*r}fade(l){return l*l*l*(l*(l*6-15)+10)}perlin2(l,r){const c=Math.floor(l)&255,d=Math.floor(r)&255;l-=Math.floor(l),r-=Math.floor(r);const m=this.fade(l),h=this.fade(r),f=this.perm[c]+d,p=this.perm[f],g=this.perm[f+1],N=this.perm[c+1]+d,j=this.perm[N],b=this.perm[N+1];return this.mix(this.mix(this.dot(this.grad3[p%12],l,r),this.dot(this.grad3[j%12],l-1,r),m),this.mix(this.dot(this.grad3[g%12],l,r-1),this.dot(this.grad3[b%12],l-1,r-1),m),h)}}function Pg(){const a=u.useRef(null),l=u.useRef(null),r=u.useRef(void 0),[c]=u.useState(()=>new D2(R2)),d=u.useRef({mouse:{x:-10,y:0,lx:0,ly:0,sx:0,sy:0,v:0,vs:0,a:0,set:!1},lines:[],paths:[],noise:c,bounding:null});return u.useEffect(()=>{const m=l.current,h=a.current;if(!m||!h)return;const f=d.current;f.noise=c;const p=()=>{const M=m.getBoundingClientRect();f.bounding=M,h.style.width=`${M.width}px`,h.style.height=`${M.height}px`},g=()=>{if(!f.bounding)return;const{width:M,height:S}=f.bounding;f.lines=[],f.paths.forEach(me=>me.remove()),f.paths=[];const F=10,E=32,C=M+200,R=S+30,H=Math.ceil(C/F),O=Math.ceil(R/E),X=(M-F*H)/2,L=(S-E*O)/2;for(let me=0;me<=H;me++){const Ne=[];for(let re=0;re<=O;re++){const ge={x:X+F*me,y:L+E*re,wave:{x:0,y:0},cursor:{x:0,y:0,vx:0,vy:0}};Ne.push(ge)}const je=document.createElementNS("http://www.w3.org/2000/svg","path");h.appendChild(je),f.paths.push(je),f.lines.push(Ne)}},N=M=>{const{lines:S,mouse:F,noise:E}=f;S.forEach(C=>{C.forEach(R=>{const H=E.perlin2((R.x+M*.0125)*.002,(R.y+M*.005)*.0015)*12;R.wave.x=Math.cos(H)*32,R.wave.y=Math.sin(H)*16;const O=R.x-F.sx,X=R.y-F.sy,L=Math.hypot(O,X),me=Math.max(175,F.vs);if(L{const F={x:M.x+M.wave.x+(S?M.cursor.x:0),y:M.y+M.wave.y+(S?M.cursor.y:0)};return F.x=Math.round(F.x*10)/10,F.y=Math.round(F.y*10)/10,F},b=()=>{const{lines:M,paths:S}=f;M.forEach((F,E)=>{let C=j(F[0],!1),R=`M ${C.x} ${C.y}`;F.forEach((H,O)=>{const X=O===F.length-1;C=j(H,!X),R+=`L ${C.x} ${C.y}`}),S[E].setAttribute("d",R)})},y=M=>{const{mouse:S}=f;S.sx+=(S.x-S.sx)*.1,S.sy+=(S.y-S.sy)*.1;const F=S.x-S.lx,E=S.y-S.ly,C=Math.hypot(F,E);S.v=C,S.vs+=(C-S.vs)*.1,S.vs=Math.min(100,S.vs),S.lx=S.x,S.ly=S.y,S.a=Math.atan2(E,F),m&&(m.style.setProperty("--x",`${S.sx}px`),m.style.setProperty("--y",`${S.sy}px`)),N(M),b(),r.current=requestAnimationFrame(y)},w=M=>{if(!f.bounding)return;const{mouse:S}=f;S.x=M.pageX-f.bounding.left,S.y=M.pageY-f.bounding.top+window.scrollY,S.set||(S.sx=S.x,S.sy=S.y,S.lx=S.x,S.ly=S.y,S.set=!0)},z=()=>{p(),g()};return p(),g(),window.addEventListener("resize",z),window.addEventListener("mousemove",w),r.current=requestAnimationFrame(y),()=>{window.removeEventListener("resize",z),window.removeEventListener("mousemove",w),r.current&&cancelAnimationFrame(r.current)}},[c]),e.jsxs("div",{ref:l,className:"waves-background",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"hidden",pointerEvents:"none"},children:[e.jsx("div",{className:"waves-cursor",style:{position:"absolute",top:0,left:0,width:"0.5rem",height:"0.5rem",background:"hsl(var(--primary) / 0.3)",borderRadius:"50%",transform:"translate3d(calc(var(--x, -0.5rem) - 50%), calc(var(--y, 50%) - 50%), 0)",willChange:"transform",pointerEvents:"none"}}),e.jsx("svg",{ref:a,style:{display:"block",width:"100%",height:"100%"},children:e.jsx("style",{children:` path { fill: none; stroke: hsl(var(--primary) / 0.20); stroke-width: 1px; } - `})})]})}function O2(){const[a,l]=u.useState(""),[r,c]=u.useState(!1),[d,m]=u.useState(""),[h,f]=u.useState(!0),p=ha(),{enableWavesBackground:g,setEnableWavesBackground:N}=qv(),{theme:j,setTheme:b}=vx();u.useEffect(()=>{(async()=>{try{await dc()&&p({to:"/"})}catch{}finally{f(!1)}})()},[p]);const w=j==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":j,z=()=>{b(w==="dark"?"light":"dark")},M=async S=>{if(S.preventDefault(),m(""),!a.trim()){m("่ฏท่พ“ๅ…ฅ Access Token");return}c(!0),console.log("ๅผ€ๅง‹้ชŒ่ฏ token...");try{const F=await fetch("/api/webui/auth/verify",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({token:a.trim()})});console.log("Token ้ชŒ่ฏๅ“ๅบ”็Šถๆ€:",F.status);const E=await F.json();if(console.log("Token ้ชŒ่ฏๅ“ๅบ”ๆ•ฐๆฎ:",E),F.ok&&E.valid){console.log("Token ้ชŒ่ฏๆˆๅŠŸ๏ผŒๅ‡†ๅค‡่ทณ่ฝฌ..."),console.log("is_first_setup:",E.is_first_setup),await new Promise(R=>setTimeout(R,100));const C=await dc();console.log("่ทณ่ฝฌๅ‰่ฎค่ฏ็Šถๆ€ๆฃ€ๆŸฅ:",C),E.is_first_setup?(console.log("่ทณ่ฝฌๅˆฐ้ฆ–ๆฌก้…็ฝฎ้กต้ข"),p({to:"/setup"})):(console.log("่ทณ่ฝฌๅˆฐ้ฆ–้กต"),p({to:"/"}))}else console.error("Token ้ชŒ่ฏๅคฑ่ดฅ:",E.message),m(E.message||"Token ้ชŒ่ฏๅคฑ่ดฅ๏ผŒ่ฏทๆฃ€ๆŸฅๅŽ้‡่ฏ•")}catch(F){console.error("Token ้ชŒ่ฏ้”™่ฏฏ:",F),m("่ฟžๆŽฅๆœๅŠกๅ™จๅคฑ่ดฅ๏ผŒ่ฏทๆฃ€ๆŸฅ็ฝ‘็ปœ่ฟžๆŽฅ")}finally{c(!1)}};return h?e.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[g&&e.jsx(Pg,{}),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(Pg,{}),e.jsxs(Te,{className:"relative z-10 w-full max-w-md shadow-2xl backdrop-blur-xl bg-card/80 border-border/50",children:[e.jsx("button",{onClick:z,className:"absolute right-4 top-4 rounded-lg p-2 hover:bg-accent transition-colors z-10 text-foreground",title:w==="dark"?"ๅˆ‡ๆขๅˆฐๆต…่‰ฒๆจกๅผ":"ๅˆ‡ๆขๅˆฐๆทฑ่‰ฒๆจกๅผ",children:w==="dark"?e.jsx(ix,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"}):e.jsx(tc,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"})}),e.jsxs(Oe,{className:"space-y-4 text-center",children:[e.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-primary/10",children:e.jsx(Jm,{className:"h-8 w-8 text-primary",strokeWidth:2,fill:"none"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ue,{className:"text-2xl font-bold",children:"ๆฌข่ฟŽไฝฟ็”จ MaiBot"}),e.jsx(Ns,{className:"text-base",children:"่ฏท่พ“ๅ…ฅๆ‚จ็š„ Access Token ไปฅ็ปง็ปญ่ฎฟ้—ฎ็ณป็ปŸ"})]})]}),e.jsx(ze,{children:e.jsxs("form",{onSubmit:M,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"token",className:"text-sm font-medium",children:"Access Token"}),e.jsxs("div",{className:"relative",children:[e.jsx(cx,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground",strokeWidth:2,fill:"none"}),e.jsx(ne,{id:"token",type:"password",placeholder:"่ฏท่พ“ๅ…ฅๆ‚จ็š„ Access Token",value:a,onChange:S=>l(S.target.value),className:P("pl-10",d&&"border-red-500 focus-visible:ring-red-500"),disabled:r,autoFocus:!0,autoComplete:"off"})]})]}),d&&e.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-red-50 p-3 text-sm text-red-600 dark:bg-red-950/50 dark:text-red-400",children:[e.jsx(Ut,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),e.jsx("span",{children:d})]}),e.jsx(_,{type:"submit",className:"w-full",disabled:r,children:r?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"้ชŒ่ฏไธญ..."]}):"้ชŒ่ฏๅนถ่ฟ›ๅ…ฅ"}),e.jsxs(Qs,{children:[e.jsx(dd,{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(ox,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"ๆˆ‘ๆฒกๆœ‰ Token๏ผŒๆˆ‘่ฏฅๅŽปๅ“ช้‡Œ่Žทๅพ— Token๏ผŸ"]})}),e.jsxs(Hs,{className:"sm:max-w-md",children:[e.jsxs(qs,{children:[e.jsxs(Vs,{className:"flex items-center gap-2",children:[e.jsx(Jm,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"ๅฆ‚ไฝ•่Žทๅ– Access Token"]}),e.jsx(at,{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(R1,{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(Ua,{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(Ut,{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(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs("button",{className:"w-full text-center text-sm text-muted-foreground hover:text-foreground transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[e.jsx(sl,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"ๆˆ‘่ง‰ๅพ—่ฟ™ไธช็•Œ้ขๅพˆๅกๆ€ŽไนˆๅŠž๏ผŸ"]})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsxs(ps,{className:"flex items-center gap-2",children:[e.jsx(sl,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"ๅ…ณ้—ญ่ƒŒๆ™ฏๅŠจ็”ป"]}),e.jsx(gs,{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(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{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:j2})})]})}const pt=u.forwardRef(({className:a,autoResize:l=!0,minHeight:r=60,maxHeight:c,value:d,onChange:m,...h},f)=>{const p=u.useRef(null),[g,N]=u.useState(!1);u.useImperativeHandle(f,()=>p.current),u.useEffect(()=>{if(a){const y=/\b(h-\d+|h-\[[\d.]+(?:px|rem|em)\]|min-h-\[[\d.]+(?:px|rem|em)\])\b/.test(a);N(y)}},[a]);const j=u.useCallback(()=>{const y=p.current;if(!y||!l||g)return;y.style.height="auto";const w=y.scrollHeight;let z=Math.max(w,r);c&&c>0&&(z=Math.min(z,c)),y.style.height=`${z}px`,c&&c>0&&w>c?y.style.overflowY="auto":y.style.overflowY="hidden"},[l,g,r,c]);u.useEffect(()=>{j()},[d,j]),u.useEffect(()=>{j()},[j]);const b=u.useCallback(y=>{m?.(y),requestAnimationFrame(()=>{j()})},[m,j]);return e.jsx("textarea",{className:P("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","custom-scrollbar",l&&!g&&"resize-none overflow-hidden",a),ref:p,value:d,onChange:b,style:{minHeight:l&&!g?`${r}px`:void 0},...h})});pt.displayName="Textarea";const la=u.forwardRef(({className:a,orientation:l="horizontal",decorative:r=!0,...c},d)=>e.jsx(Tj,{ref:d,decorative:r,orientation:l,className:P("shrink-0 bg-border",l==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",a),...c}));la.displayName=Tj.displayName;function L2({config:a,onChange:l}){const r=d=>{d.trim()&&!a.alias_names.includes(d.trim())&&l({...a,alias_names:[...a.alias_names,d.trim()]})},c=d=>{l({...a,alias_names:a.alias_names.filter((m,h)=>h!==d)})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"qq_account",children:"QQ่ดฆๅท *"}),e.jsx(ne,{id:"qq_account",type:"number",placeholder:"่ฏท่พ“ๅ…ฅๆœบๅ™จไบบ็š„QQ่ดฆๅท",value:a.qq_account||"",onChange:d=>l({...a,qq_account:Number(d.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆœบๅ™จไบบ็™ปๅฝ•ไฝฟ็”จ็š„QQ่ดฆๅท"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"nickname",children:"ๆ˜ต็งฐ *"}),e.jsx(ne,{id:"nickname",placeholder:"่ฏท่พ“ๅ…ฅๆœบๅ™จไบบ็š„ๆ˜ต็งฐ",value:a.nickname,onChange:d=>l({...a,nickname:d.target.value})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆœบๅ™จไบบ็š„ไธป่ฆ็งฐๅ‘ผๅ็งฐ"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{children:"ๅˆซๅ"}),e.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:a.alias_names.map((d,m)=>e.jsxs(Ce,{variant:"secondary",className:"gap-1",children:[d,e.jsx("button",{type:"button",onClick:()=>c(m),className:"ml-1 hover:text-destructive",children:e.jsx(Sa,{className:"h-3 w-3"})})]},m))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{id:"alias_input",placeholder:"่พ“ๅ…ฅๅˆซๅๅŽๆŒ‰ๅ›ž่ฝฆๆทปๅŠ ",onKeyPress:d=>{d.key==="Enter"&&(r(d.target.value),d.target.value="")}}),e.jsx(_,{type:"button",variant:"outline",onClick:()=>{const d=document.getElementById("alias_input");d&&(r(d.value),d.value="")},children:"ๆทปๅŠ "})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆœบๅ™จไบบ็š„ๅ…ถไป–็งฐๅ‘ผ๏ผŒๅฏไปฅๆทปๅŠ ๅคšไธช"})]})]})}function U2({config:a,onChange:l}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"personality",children:"ไบบๆ ผ็‰นๅพ *"}),e.jsx(pt,{id:"personality",placeholder:"ๆ่ฟฐๆœบๅ™จไบบ็š„ไบบๆ ผ็‰น่ดจๅ’Œ่บซไปฝ็‰นๅพ๏ผˆๅปบ่ฎฎ120ๅญ—ไปฅๅ†…๏ผ‰",value:a.personality,onChange:r=>l({...a,personality:r.target.value}),rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ไพ‹ๅฆ‚๏ผšๆ˜ฏไธ€ไธชๅฅณๅคงๅญฆ็”Ÿ๏ผŒ็Žฐๅœจๅœจ่ฏปๅคงไบŒ๏ผŒไผšๅˆท่ดดๅง"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"reply_style",children:"่กจ่พพ้ฃŽๆ ผ *"}),e.jsx(pt,{id:"reply_style",placeholder:"ๆ่ฟฐๆœบๅ™จไบบ่ฏด่ฏ็š„่กจ่พพ้ฃŽๆ ผใ€่กจ่พพไน ๆƒฏ",value:a.reply_style,onChange:r=>l({...a,reply_style:r.target.value}),rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ไพ‹ๅฆ‚๏ผšๅ›žๅคๅนณๆทกไธ€ไบ›๏ผŒ็ฎ€็Ÿญไธ€ไบ›๏ผŒ่ฏดไธญๆ–‡๏ผŒๅ‚่€ƒ่ดดๅงใ€็ŸฅไนŽๅ’Œๅพฎๅš็š„ๅ›žๅค้ฃŽๆ ผ"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"interest",children:"ๅ…ด่ถฃ *"}),e.jsx(pt,{id:"interest",placeholder:"ๆ่ฟฐๆœบๅ™จไบบๆ„Ÿๅ…ด่ถฃ็š„่ฏ้ข˜",value:a.interest,onChange:r=>l({...a,interest:r.target.value}),rows:2}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ไผšๅฝฑๅ“ๆœบๅ™จไบบๅฏนไป€ไนˆ่ฏ้ข˜่ฟ›่กŒๅ›žๅค"})]}),e.jsx(la,{}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"plan_style",children:"็พค่Š่ฏด่ฏ่ง„ๅˆ™ *"}),e.jsx(pt,{id:"plan_style",placeholder:"ๆœบๅ™จไบบๅœจ็พค่Šไธญ็š„่กŒไธบ้ฃŽๆ ผๅ’Œ่ง„ๅˆ™",value:a.plan_style,onChange:r=>l({...a,plan_style:r.target.value}),rows:4}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅฎšไน‰ๆœบๅ™จไบบๅœจ็พค่Šไธญๅฆ‚ไฝ•่กŒๅŠจ๏ผŒไพ‹ๅฆ‚ๅ›žๅค้ข‘็އใ€ๆกไปถ็ญ‰"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"private_plan_style",children:"็ง่Š่ฏด่ฏ่ง„ๅˆ™ *"}),e.jsx(pt,{id:"private_plan_style",placeholder:"ๆœบๅ™จไบบๅœจ็ง่Šไธญ็š„่กŒไธบ้ฃŽๆ ผๅ’Œ่ง„ๅˆ™",value:a.private_plan_style,onChange:r=>l({...a,private_plan_style:r.target.value}),rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅฎšไน‰ๆœบๅ™จไบบๅœจ็ง่Šไธญ็š„่กŒไธบๆ–นๅผ"})]})]})}function $2({config:a,onChange:l}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{htmlFor:"emoji_chance",children:"่กจๆƒ…ๅŒ…ๆฟ€ๆดปๆฆ‚็އ"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[(a.emoji_chance*100).toFixed(0),"%"]})]}),e.jsx(ne,{id:"emoji_chance",type:"range",min:"0",max:"1",step:"0.1",value:a.emoji_chance,onChange:r=>l({...a,emoji_chance:Number(r.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆœบๅ™จไบบๅ‘้€่กจๆƒ…ๅŒ…็š„ๆฆ‚็އ"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"max_reg_num",children:"ๆœ€ๅคง่กจๆƒ…ๅŒ…ๆ•ฐ้‡"}),e.jsx(ne,{id:"max_reg_num",type:"number",min:"1",max:"200",value:a.max_reg_num,onChange:r=>l({...a,max_reg_num:Number(r.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆœบๅ™จไบบๆœ€ๅคšไฟๅญ˜็š„่กจๆƒ…ๅŒ…ๆ•ฐ้‡"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"do_replace",children:"่พพๅˆฐๆœ€ๅคงๆ•ฐ้‡ๆ—ถๆ›ฟๆข"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅผ€ๅฏๅŽไผšๅˆ ้™คๆ—ง่กจๆƒ…ๅŒ…๏ผŒๅ…ณ้—ญๅˆ™ไธๅ†ๆ”ถ้›†ๆ–ฐ่กจๆƒ…ๅŒ…"})]}),e.jsx(Ge,{id:"do_replace",checked:a.do_replace,onCheckedChange:r=>l({...a,do_replace:r})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"check_interval",children:"ๆฃ€ๆŸฅ้—ด้š”๏ผˆๅˆ†้’Ÿ๏ผ‰"}),e.jsx(ne,{id:"check_interval",type:"number",min:"1",max:"120",value:a.check_interval,onChange:r=>l({...a,check_interval:Number(r.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆฃ€ๆŸฅ่กจๆƒ…ๅŒ…ๆณจๅ†Œใ€็ ดๆŸใ€ๅˆ ้™ค็š„ๆ—ถ้—ด้—ด้š”"})]}),e.jsx(la,{}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"steal_emoji",children:"ๅทๅ–่กจๆƒ…ๅŒ…"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅ…่ฎธๆœบๅ™จไบบๅฐ†ไธ€ไบ›่กจๆƒ…ๅŒ…ๆฎไธบๅทฑๆœ‰"})]}),e.jsx(Ge,{id:"steal_emoji",checked:a.steal_emoji,onCheckedChange:r=>l({...a,steal_emoji:r})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"content_filtration",children:"ๅฏ็”จ่กจๆƒ…ๅŒ…่ฟ‡ๆปค"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅชไฟๅญ˜็ฌฆๅˆ่ฆๆฑ‚็š„่กจๆƒ…ๅŒ…"})]}),e.jsx(Ge,{id:"content_filtration",checked:a.content_filtration,onCheckedChange:r=>l({...a,content_filtration:r})})]}),a.content_filtration&&e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"filtration_prompt",children:"่ฟ‡ๆปค่ฆๆฑ‚"}),e.jsx(ne,{id:"filtration_prompt",placeholder:"ไพ‹ๅฆ‚๏ผš็ฌฆๅˆๅ…ฌๅบ่‰ฏไฟ—",value:a.filtration_prompt,onChange:r=>l({...a,filtration_prompt:r.target.value})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆ่ฟฐ่กจๆƒ…ๅŒ…ๅบ”่ฏฅ็ฌฆๅˆ็š„่ฆๆฑ‚"})]})]})}function B2({config:a,onChange:l}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"enable_tool",children:"ๅฏ็”จๅทฅๅ…ท็ณป็ปŸ"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅ…่ฎธๆœบๅ™จไบบไฝฟ็”จๅ„็งๅทฅๅ…ทๅขžๅผบๅŠŸ่ƒฝ"})]}),e.jsx(Ge,{id:"enable_tool",checked:a.enable_tool,onCheckedChange:r=>l({...a,enable_tool:r})})]}),e.jsx(la,{}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"all_global",children:"ๅฏ็”จๅ…จๅฑ€้ป‘่ฏๆจกๅผ"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅ…่ฎธๆœบๅ™จไบบๅญฆไน ๅ’Œไฝฟ็”จ็พค็ป„้ป‘่ฏ"})]}),e.jsx(Ge,{id:"all_global",checked:a.all_global,onCheckedChange:r=>l({...a,all_global:r})})]})]})}function I2({config:a,onChange:l}){const[r,c]=u.useState(!1);return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"rounded-lg bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"mt-0.5",children:e.jsx("svg",{className:"h-5 w-5 text-blue-600 dark:text-blue-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),e.jsxs("div",{className:"flex-1 text-sm",children:[e.jsx("p",{className:"font-medium text-blue-900 dark:text-blue-100 mb-1",children:"ๅ…ณไบŽ็ก…ๅŸบๆตๅŠจ (SiliconFlow)"}),e.jsx("p",{className:"text-blue-700 dark:text-blue-300 mb-2",children:"็ก…ๅŸบๆตๅŠจๆไพ›ไบ†ๅฎŒๆ•ด็š„ๆจกๅž‹่ฆ†็›–๏ผŒๅŒ…ๆ‹ฌ DeepSeek V3ใ€Qwenใ€่ง†่ง‰ๆจกๅž‹ใ€่ฏญ้Ÿณ่ฏ†ๅˆซๅ’ŒๅตŒๅ…ฅๆจกๅž‹ใ€‚ ๅช้œ€ไธ€ไธช API Key ๅณๅฏไฝฟ็”จ้บฆ้บฆ็š„ๆ‰€ๆœ‰ๅŠŸ่ƒฝ๏ผ"}),e.jsxs("a",{href:"https://cloud.siliconflow.cn",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-blue-600 dark:text-blue-400 hover:underline font-medium",children:["ๅ‰ๅพ€็ก…ๅŸบๆตๅŠจ่Žทๅ– API Key",e.jsx(Io,{className:"h-3 w-3"})]})]})]})}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"siliconflow_api_key",children:"SiliconFlow API Key *"}),e.jsxs("div",{className:"relative",children:[e.jsx(ne,{id:"siliconflow_api_key",type:r?"text":"password",placeholder:"sk-...",value:a.api_key,onChange:d=>l({api_key:d.target.value}),className:"font-mono pr-10"}),e.jsx(_,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent",onClick:()=>c(!r),children:r?e.jsx(ic,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(ua,{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 P2(){const a=await ke("/api/webui/config/bot",{method:"GET",headers:Zs()});if(!a.ok)throw new Error("่ฏปๅ–Bot้…็ฝฎๅคฑ่ดฅ");const r=(await a.json()).config.bot||{};return{qq_account:r.qq_account||0,nickname:r.nickname||"",alias_names:r.alias_names||[]}}async function F2(){const a=await ke("/api/webui/config/bot",{method:"GET",headers:Zs()});if(!a.ok)throw new Error("่ฏปๅ–ไบบๆ ผ้…็ฝฎๅคฑ่ดฅ");const r=(await a.json()).config.personality||{};return{personality:r.personality||"",reply_style:r.reply_style||"",interest:r.interest||"",plan_style:r.plan_style||"",private_plan_style:r.private_plan_style||""}}async function H2(){const a=await ke("/api/webui/config/bot",{method:"GET",headers:Zs()});if(!a.ok)throw new Error("่ฏปๅ–่กจๆƒ…ๅŒ…้…็ฝฎๅคฑ่ดฅ");const r=(await a.json()).config.emoji||{};return{emoji_chance:r.emoji_chance??.4,max_reg_num:r.max_reg_num??40,do_replace:r.do_replace??!0,check_interval:r.check_interval??10,steal_emoji:r.steal_emoji??!0,content_filtration:r.content_filtration??!1,filtration_prompt:r.filtration_prompt||""}}async function q2(){const a=await ke("/api/webui/config/bot",{method:"GET",headers:Zs()});if(!a.ok)throw new Error("่ฏปๅ–ๅ…ถไป–้…็ฝฎๅคฑ่ดฅ");const r=(await a.json()).config,c=r.tool||{},d=r.expression||{};return{enable_tool:c.enable_tool??!0,all_global:d.all_global_jargon??!0}}async function V2(){const a=await ke("/api/webui/config/model",{method:"GET",headers:Zs()});if(!a.ok)throw new Error("่ฏปๅ–ๆจกๅž‹้…็ฝฎๅคฑ่ดฅ");return{api_key:((await a.json()).config.api_providers||[]).find(m=>m.name==="SiliconFlow")?.api_key||""}}async function G2(a){const l=await ke("/api/webui/config/bot/section/bot",{method:"POST",headers:Zs(),body:JSON.stringify(a)});if(!l.ok){const r=await l.json();throw new Error(r.detail||"ไฟๅญ˜BotๅŸบ็ก€้…็ฝฎๅคฑ่ดฅ")}return await l.json()}async function K2(a){const l=await ke("/api/webui/config/bot/section/personality",{method:"POST",headers:Zs(),body:JSON.stringify(a)});if(!l.ok){const r=await l.json();throw new Error(r.detail||"ไฟๅญ˜ไบบๆ ผ้…็ฝฎๅคฑ่ดฅ")}return await l.json()}async function Q2(a){const l=await ke("/api/webui/config/bot/section/emoji",{method:"POST",headers:Zs(),body:JSON.stringify(a)});if(!l.ok){const r=await l.json();throw new Error(r.detail||"ไฟๅญ˜่กจๆƒ…ๅŒ…้…็ฝฎๅคฑ่ดฅ")}return await l.json()}async function Y2(a){const l=[];l.push(ke("/api/webui/config/bot/section/tool",{method:"POST",headers:Zs(),body:JSON.stringify({enable_tool:a.enable_tool})})),l.push(ke("/api/webui/config/bot/section/expression",{method:"POST",headers:Zs(),body:JSON.stringify({all_global_jargon:a.all_global})}));const r=await Promise.all(l);for(const c of r)if(!c.ok){const d=await c.json();throw new Error(d.detail||"ไฟๅญ˜ๅ…ถไป–้…็ฝฎๅคฑ่ดฅ")}return{success:!0}}async function J2(a){const l=await ke("/api/webui/config/model",{method:"GET",headers:Zs()});if(!l.ok)throw new Error("่ฏปๅ–ๆจกๅž‹้…็ฝฎๅคฑ่ดฅ");const c=(await l.json()).config,d=c.api_providers||[],m=d.findIndex(p=>p.name==="SiliconFlow");m>=0?d[m]={...d[m],api_key:a.api_key}:d.push({name:"SiliconFlow",base_url:"https://api.siliconflow.cn/v1",api_key:a.api_key,client_type:"openai",max_retry:3,timeout:120,retry_interval:5});const h={...c,api_providers:d},f=await ke("/api/webui/config/model",{method:"POST",headers:Zs(),body:JSON.stringify(h)});if(!f.ok){const p=await f.json();throw new Error(p.detail||"ไฟๅญ˜ๆจกๅž‹้…็ฝฎๅคฑ่ดฅ")}return await f.json()}async function Fg(){const a=await ke("/api/webui/setup/complete",{method:"POST"});if(!a.ok){const l=await a.json();throw new Error(l.message||"ๆ ‡่ฎฐ้…็ฝฎๅฎŒๆˆๅคฑ่ดฅ")}return await a.json()}function X2(){return e.jsx(lr,{children:e.jsx(Z2,{})})}function Z2(){const a=ha(),{toast:l}=nt(),{triggerRestart:r}=Tn(),[c,d]=u.useState(0),[m,h]=u.useState(!1),[f,p]=u.useState(!1),[g,N]=u.useState(!0),[j,b]=u.useState({qq_account:0,nickname:"",alias_names:[]}),[y,w]=u.useState({personality:"ๆ˜ฏไธ€ไธชๅฅณๅคงๅญฆ็”Ÿ๏ผŒ็Žฐๅœจๅœจ่ฏปๅคงไบŒ๏ผŒไผšๅˆท่ดดๅงใ€‚",reply_style:"่ฏทๅ›žๅค็š„ๅนณๆทกไธ€ไบ›๏ผŒ็ฎ€็Ÿญไธ€ไบ›๏ผŒ่ฏดไธญๆ–‡๏ผŒไธ่ฆๅˆปๆ„็ชๅ‡บ่‡ช่บซๅญฆ็ง‘่ƒŒๆ™ฏใ€‚ๅฏไปฅๅ‚่€ƒ่ดดๅง๏ผŒ็ŸฅไนŽๅ’Œๅพฎๅš็š„ๅ›žๅค้ฃŽๆ ผใ€‚",interest:"ๅฏนๆŠ€ๆœฏ็›ธๅ…ณ่ฏ้ข˜๏ผŒๆธธๆˆๅ’ŒๅŠจๆผซ็›ธๅ…ณ่ฏ้ข˜ๆ„Ÿๅ…ด่ถฃ๏ผŒไนŸๅฏนๆ—ฅๅธธ่ฏ้ข˜ๆ„Ÿๅ…ด่ถฃ๏ผŒไธๅ–œๆฌขๅคช่ฟ‡ๆฒ‰้‡ไธฅ่‚ƒ็š„่ฏ้ข˜",plan_style:`1.ๆ€่€ƒ**ๆ‰€ๆœ‰**็š„ๅฏ็”จ็š„actionไธญ็š„**ๆฏไธชๅŠจไฝœ**ๆ˜ฏๅฆ็ฌฆๅˆๅฝ“ไธ‹ๆกไปถ๏ผŒๅฆ‚ๆžœๅŠจไฝœไฝฟ็”จๆกไปถ็ฌฆๅˆ่Šๅคฉๅ†…ๅฎนๅฐฑไฝฟ็”จ + `})})]})}function O2(){const[a,l]=u.useState(""),[r,c]=u.useState(!1),[d,m]=u.useState(""),[h,f]=u.useState(!0),p=ha(),{enableWavesBackground:g,setEnableWavesBackground:N}=qv(),{theme:j,setTheme:b}=vx();u.useEffect(()=>{(async()=>{try{await dc()&&p({to:"/"})}catch{}finally{f(!1)}})()},[p]);const w=j==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":j,z=()=>{b(w==="dark"?"light":"dark")},M=async S=>{if(S.preventDefault(),m(""),!a.trim()){m("่ฏท่พ“ๅ…ฅ Access Token");return}c(!0),console.log("ๅผ€ๅง‹้ชŒ่ฏ token...");try{const F=await fetch("/api/webui/auth/verify",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({token:a.trim()})});console.log("Token ้ชŒ่ฏๅ“ๅบ”็Šถๆ€:",F.status);const E=await F.json();if(console.log("Token ้ชŒ่ฏๅ“ๅบ”ๆ•ฐๆฎ:",E),F.ok&&E.valid){console.log("Token ้ชŒ่ฏๆˆๅŠŸ๏ผŒๅ‡†ๅค‡่ทณ่ฝฌ..."),console.log("is_first_setup:",E.is_first_setup),await new Promise(R=>setTimeout(R,100));const C=await dc();console.log("่ทณ่ฝฌๅ‰่ฎค่ฏ็Šถๆ€ๆฃ€ๆŸฅ:",C),E.is_first_setup?(console.log("่ทณ่ฝฌๅˆฐ้ฆ–ๆฌก้…็ฝฎ้กต้ข"),p({to:"/setup"})):(console.log("่ทณ่ฝฌๅˆฐ้ฆ–้กต"),p({to:"/"}))}else console.error("Token ้ชŒ่ฏๅคฑ่ดฅ:",E.message),m(E.message||"Token ้ชŒ่ฏๅคฑ่ดฅ๏ผŒ่ฏทๆฃ€ๆŸฅๅŽ้‡่ฏ•")}catch(F){console.error("Token ้ชŒ่ฏ้”™่ฏฏ:",F),m("่ฟžๆŽฅๆœๅŠกๅ™จๅคฑ่ดฅ๏ผŒ่ฏทๆฃ€ๆŸฅ็ฝ‘็ปœ่ฟžๆŽฅ")}finally{c(!1)}};return h?e.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[g&&e.jsx(Pg,{}),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(Pg,{}),e.jsxs(Te,{className:"relative z-10 w-full max-w-md shadow-2xl backdrop-blur-xl bg-card/80 border-border/50",children:[e.jsx("button",{onClick:z,className:"absolute right-4 top-4 rounded-lg p-2 hover:bg-accent transition-colors z-10 text-foreground",title:w==="dark"?"ๅˆ‡ๆขๅˆฐๆต…่‰ฒๆจกๅผ":"ๅˆ‡ๆขๅˆฐๆทฑ่‰ฒๆจกๅผ",children:w==="dark"?e.jsx(ix,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"}):e.jsx(tc,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"})}),e.jsxs(Oe,{className:"space-y-4 text-center",children:[e.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-primary/10",children:e.jsx(Jm,{className:"h-8 w-8 text-primary",strokeWidth:2,fill:"none"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ue,{className:"text-2xl font-bold",children:"ๆฌข่ฟŽไฝฟ็”จ MaiBot"}),e.jsx(Ns,{className:"text-base",children:"่ฏท่พ“ๅ…ฅๆ‚จ็š„ Access Token ไปฅ็ปง็ปญ่ฎฟ้—ฎ็ณป็ปŸ"})]})]}),e.jsx(ze,{children:e.jsxs("form",{onSubmit:M,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"token",className:"text-sm font-medium",children:"Access Token"}),e.jsxs("div",{className:"relative",children:[e.jsx(cx,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground",strokeWidth:2,fill:"none"}),e.jsx(ae,{id:"token",type:"password",placeholder:"่ฏท่พ“ๅ…ฅๆ‚จ็š„ Access Token",value:a,onChange:S=>l(S.target.value),className:P("pl-10",d&&"border-red-500 focus-visible:ring-red-500"),disabled:r,autoFocus:!0,autoComplete:"off"})]})]}),d&&e.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-red-50 p-3 text-sm text-red-600 dark:bg-red-950/50 dark:text-red-400",children:[e.jsx(Ut,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),e.jsx("span",{children:d})]}),e.jsx(_,{type:"submit",className:"w-full",disabled:r,children:r?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"้ชŒ่ฏไธญ..."]}):"้ชŒ่ฏๅนถ่ฟ›ๅ…ฅ"}),e.jsxs(Qs,{children:[e.jsx(dd,{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(ox,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"ๆˆ‘ๆฒกๆœ‰ Token๏ผŒๆˆ‘่ฏฅๅŽปๅ“ช้‡Œ่Žทๅพ— Token๏ผŸ"]})}),e.jsxs(Hs,{className:"sm:max-w-md",children:[e.jsxs(qs,{children:[e.jsxs(Vs,{className:"flex items-center gap-2",children:[e.jsx(Jm,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"ๅฆ‚ไฝ•่Žทๅ– Access Token"]}),e.jsx(at,{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(R_,{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(Ua,{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(Ut,{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(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs("button",{className:"w-full text-center text-sm text-muted-foreground hover:text-foreground transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[e.jsx(sl,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"ๆˆ‘่ง‰ๅพ—่ฟ™ไธช็•Œ้ขๅพˆๅกๆ€ŽไนˆๅŠž๏ผŸ"]})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsxs(ps,{className:"flex items-center gap-2",children:[e.jsx(sl,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"ๅ…ณ้—ญ่ƒŒๆ™ฏๅŠจ็”ป"]}),e.jsx(gs,{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(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{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:j2})})]})}const pt=u.forwardRef(({className:a,autoResize:l=!0,minHeight:r=60,maxHeight:c,value:d,onChange:m,...h},f)=>{const p=u.useRef(null),[g,N]=u.useState(!1);u.useImperativeHandle(f,()=>p.current),u.useEffect(()=>{if(a){const y=/\b(h-\d+|h-\[[\d.]+(?:px|rem|em)\]|min-h-\[[\d.]+(?:px|rem|em)\])\b/.test(a);N(y)}},[a]);const j=u.useCallback(()=>{const y=p.current;if(!y||!l||g)return;y.style.height="auto";const w=y.scrollHeight;let z=Math.max(w,r);c&&c>0&&(z=Math.min(z,c)),y.style.height=`${z}px`,c&&c>0&&w>c?y.style.overflowY="auto":y.style.overflowY="hidden"},[l,g,r,c]);u.useEffect(()=>{j()},[d,j]),u.useEffect(()=>{j()},[j]);const b=u.useCallback(y=>{m?.(y),requestAnimationFrame(()=>{j()})},[m,j]);return e.jsx("textarea",{className:P("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","custom-scrollbar",l&&!g&&"resize-none overflow-hidden",a),ref:p,value:d,onChange:b,style:{minHeight:l&&!g?`${r}px`:void 0},...h})});pt.displayName="Textarea";const la=u.forwardRef(({className:a,orientation:l="horizontal",decorative:r=!0,...c},d)=>e.jsx(Tj,{ref:d,decorative:r,orientation:l,className:P("shrink-0 bg-border",l==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",a),...c}));la.displayName=Tj.displayName;function L2({config:a,onChange:l}){const r=d=>{d.trim()&&!a.alias_names.includes(d.trim())&&l({...a,alias_names:[...a.alias_names,d.trim()]})},c=d=>{l({...a,alias_names:a.alias_names.filter((m,h)=>h!==d)})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"qq_account",children:"QQ่ดฆๅท *"}),e.jsx(ae,{id:"qq_account",type:"number",placeholder:"่ฏท่พ“ๅ…ฅๆœบๅ™จไบบ็š„QQ่ดฆๅท",value:a.qq_account||"",onChange:d=>l({...a,qq_account:Number(d.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆœบๅ™จไบบ็™ปๅฝ•ไฝฟ็”จ็š„QQ่ดฆๅท"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"nickname",children:"ๆ˜ต็งฐ *"}),e.jsx(ae,{id:"nickname",placeholder:"่ฏท่พ“ๅ…ฅๆœบๅ™จไบบ็š„ๆ˜ต็งฐ",value:a.nickname,onChange:d=>l({...a,nickname:d.target.value})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆœบๅ™จไบบ็š„ไธป่ฆ็งฐๅ‘ผๅ็งฐ"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{children:"ๅˆซๅ"}),e.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:a.alias_names.map((d,m)=>e.jsxs(Ce,{variant:"secondary",className:"gap-1",children:[d,e.jsx("button",{type:"button",onClick:()=>c(m),className:"ml-1 hover:text-destructive",children:e.jsx(Sa,{className:"h-3 w-3"})})]},m))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{id:"alias_input",placeholder:"่พ“ๅ…ฅๅˆซๅๅŽๆŒ‰ๅ›ž่ฝฆๆทปๅŠ ",onKeyPress:d=>{d.key==="Enter"&&(r(d.target.value),d.target.value="")}}),e.jsx(_,{type:"button",variant:"outline",onClick:()=>{const d=document.getElementById("alias_input");d&&(r(d.value),d.value="")},children:"ๆทปๅŠ "})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆœบๅ™จไบบ็š„ๅ…ถไป–็งฐๅ‘ผ๏ผŒๅฏไปฅๆทปๅŠ ๅคšไธช"})]})]})}function U2({config:a,onChange:l}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"personality",children:"ไบบๆ ผ็‰นๅพ *"}),e.jsx(pt,{id:"personality",placeholder:"ๆ่ฟฐๆœบๅ™จไบบ็š„ไบบๆ ผ็‰น่ดจๅ’Œ่บซไปฝ็‰นๅพ๏ผˆๅปบ่ฎฎ120ๅญ—ไปฅๅ†…๏ผ‰",value:a.personality,onChange:r=>l({...a,personality:r.target.value}),rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ไพ‹ๅฆ‚๏ผšๆ˜ฏไธ€ไธชๅฅณๅคงๅญฆ็”Ÿ๏ผŒ็Žฐๅœจๅœจ่ฏปๅคงไบŒ๏ผŒไผšๅˆท่ดดๅง"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"reply_style",children:"่กจ่พพ้ฃŽๆ ผ *"}),e.jsx(pt,{id:"reply_style",placeholder:"ๆ่ฟฐๆœบๅ™จไบบ่ฏด่ฏ็š„่กจ่พพ้ฃŽๆ ผใ€่กจ่พพไน ๆƒฏ",value:a.reply_style,onChange:r=>l({...a,reply_style:r.target.value}),rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ไพ‹ๅฆ‚๏ผšๅ›žๅคๅนณๆทกไธ€ไบ›๏ผŒ็ฎ€็Ÿญไธ€ไบ›๏ผŒ่ฏดไธญๆ–‡๏ผŒๅ‚่€ƒ่ดดๅงใ€็ŸฅไนŽๅ’Œๅพฎๅš็š„ๅ›žๅค้ฃŽๆ ผ"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"interest",children:"ๅ…ด่ถฃ *"}),e.jsx(pt,{id:"interest",placeholder:"ๆ่ฟฐๆœบๅ™จไบบๆ„Ÿๅ…ด่ถฃ็š„่ฏ้ข˜",value:a.interest,onChange:r=>l({...a,interest:r.target.value}),rows:2}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ไผšๅฝฑๅ“ๆœบๅ™จไบบๅฏนไป€ไนˆ่ฏ้ข˜่ฟ›่กŒๅ›žๅค"})]}),e.jsx(la,{}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"plan_style",children:"็พค่Š่ฏด่ฏ่ง„ๅˆ™ *"}),e.jsx(pt,{id:"plan_style",placeholder:"ๆœบๅ™จไบบๅœจ็พค่Šไธญ็š„่กŒไธบ้ฃŽๆ ผๅ’Œ่ง„ๅˆ™",value:a.plan_style,onChange:r=>l({...a,plan_style:r.target.value}),rows:4}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅฎšไน‰ๆœบๅ™จไบบๅœจ็พค่Šไธญๅฆ‚ไฝ•่กŒๅŠจ๏ผŒไพ‹ๅฆ‚ๅ›žๅค้ข‘็އใ€ๆกไปถ็ญ‰"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"private_plan_style",children:"็ง่Š่ฏด่ฏ่ง„ๅˆ™ *"}),e.jsx(pt,{id:"private_plan_style",placeholder:"ๆœบๅ™จไบบๅœจ็ง่Šไธญ็š„่กŒไธบ้ฃŽๆ ผๅ’Œ่ง„ๅˆ™",value:a.private_plan_style,onChange:r=>l({...a,private_plan_style:r.target.value}),rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅฎšไน‰ๆœบๅ™จไบบๅœจ็ง่Šไธญ็š„่กŒไธบๆ–นๅผ"})]})]})}function $2({config:a,onChange:l}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{htmlFor:"emoji_chance",children:"่กจๆƒ…ๅŒ…ๆฟ€ๆดปๆฆ‚็އ"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[(a.emoji_chance*100).toFixed(0),"%"]})]}),e.jsx(ae,{id:"emoji_chance",type:"range",min:"0",max:"1",step:"0.1",value:a.emoji_chance,onChange:r=>l({...a,emoji_chance:Number(r.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆœบๅ™จไบบๅ‘้€่กจๆƒ…ๅŒ…็š„ๆฆ‚็އ"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"max_reg_num",children:"ๆœ€ๅคง่กจๆƒ…ๅŒ…ๆ•ฐ้‡"}),e.jsx(ae,{id:"max_reg_num",type:"number",min:"1",max:"200",value:a.max_reg_num,onChange:r=>l({...a,max_reg_num:Number(r.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆœบๅ™จไบบๆœ€ๅคšไฟๅญ˜็š„่กจๆƒ…ๅŒ…ๆ•ฐ้‡"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"do_replace",children:"่พพๅˆฐๆœ€ๅคงๆ•ฐ้‡ๆ—ถๆ›ฟๆข"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅผ€ๅฏๅŽไผšๅˆ ้™คๆ—ง่กจๆƒ…ๅŒ…๏ผŒๅ…ณ้—ญๅˆ™ไธๅ†ๆ”ถ้›†ๆ–ฐ่กจๆƒ…ๅŒ…"})]}),e.jsx(qe,{id:"do_replace",checked:a.do_replace,onCheckedChange:r=>l({...a,do_replace:r})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"check_interval",children:"ๆฃ€ๆŸฅ้—ด้š”๏ผˆๅˆ†้’Ÿ๏ผ‰"}),e.jsx(ae,{id:"check_interval",type:"number",min:"1",max:"120",value:a.check_interval,onChange:r=>l({...a,check_interval:Number(r.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆฃ€ๆŸฅ่กจๆƒ…ๅŒ…ๆณจๅ†Œใ€็ ดๆŸใ€ๅˆ ้™ค็š„ๆ—ถ้—ด้—ด้š”"})]}),e.jsx(la,{}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"steal_emoji",children:"ๅทๅ–่กจๆƒ…ๅŒ…"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅ…่ฎธๆœบๅ™จไบบๅฐ†ไธ€ไบ›่กจๆƒ…ๅŒ…ๆฎไธบๅทฑๆœ‰"})]}),e.jsx(qe,{id:"steal_emoji",checked:a.steal_emoji,onCheckedChange:r=>l({...a,steal_emoji:r})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"content_filtration",children:"ๅฏ็”จ่กจๆƒ…ๅŒ…่ฟ‡ๆปค"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅชไฟๅญ˜็ฌฆๅˆ่ฆๆฑ‚็š„่กจๆƒ…ๅŒ…"})]}),e.jsx(qe,{id:"content_filtration",checked:a.content_filtration,onCheckedChange:r=>l({...a,content_filtration:r})})]}),a.content_filtration&&e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"filtration_prompt",children:"่ฟ‡ๆปค่ฆๆฑ‚"}),e.jsx(ae,{id:"filtration_prompt",placeholder:"ไพ‹ๅฆ‚๏ผš็ฌฆๅˆๅ…ฌๅบ่‰ฏไฟ—",value:a.filtration_prompt,onChange:r=>l({...a,filtration_prompt:r.target.value})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆ่ฟฐ่กจๆƒ…ๅŒ…ๅบ”่ฏฅ็ฌฆๅˆ็š„่ฆๆฑ‚"})]})]})}function I2({config:a,onChange:l}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"enable_tool",children:"ๅฏ็”จๅทฅๅ…ท็ณป็ปŸ"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅ…่ฎธๆœบๅ™จไบบไฝฟ็”จๅ„็งๅทฅๅ…ทๅขžๅผบๅŠŸ่ƒฝ"})]}),e.jsx(qe,{id:"enable_tool",checked:a.enable_tool,onCheckedChange:r=>l({...a,enable_tool:r})})]}),e.jsx(la,{}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"all_global",children:"ๅฏ็”จๅ…จๅฑ€้ป‘่ฏๆจกๅผ"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅ…่ฎธๆœบๅ™จไบบๅญฆไน ๅ’Œไฝฟ็”จ็พค็ป„้ป‘่ฏ"})]}),e.jsx(qe,{id:"all_global",checked:a.all_global,onCheckedChange:r=>l({...a,all_global:r})})]})]})}function B2({config:a,onChange:l}){const[r,c]=u.useState(!1);return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"rounded-lg bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"mt-0.5",children:e.jsx("svg",{className:"h-5 w-5 text-blue-600 dark:text-blue-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),e.jsxs("div",{className:"flex-1 text-sm",children:[e.jsx("p",{className:"font-medium text-blue-900 dark:text-blue-100 mb-1",children:"ๅ…ณไบŽ็ก…ๅŸบๆตๅŠจ (SiliconFlow)"}),e.jsx("p",{className:"text-blue-700 dark:text-blue-300 mb-2",children:"็ก…ๅŸบๆตๅŠจๆไพ›ไบ†ๅฎŒๆ•ด็š„ๆจกๅž‹่ฆ†็›–๏ผŒๅŒ…ๆ‹ฌ DeepSeek V3ใ€Qwenใ€่ง†่ง‰ๆจกๅž‹ใ€่ฏญ้Ÿณ่ฏ†ๅˆซๅ’ŒๅตŒๅ…ฅๆจกๅž‹ใ€‚ ๅช้œ€ไธ€ไธช API Key ๅณๅฏไฝฟ็”จ้บฆ้บฆ็š„ๆ‰€ๆœ‰ๅŠŸ่ƒฝ๏ผ"}),e.jsxs("a",{href:"https://cloud.siliconflow.cn",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-blue-600 dark:text-blue-400 hover:underline font-medium",children:["ๅ‰ๅพ€็ก…ๅŸบๆตๅŠจ่Žทๅ– API Key",e.jsx(Bo,{className:"h-3 w-3"})]})]})]})}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{htmlFor:"siliconflow_api_key",children:"SiliconFlow API Key *"}),e.jsxs("div",{className:"relative",children:[e.jsx(ae,{id:"siliconflow_api_key",type:r?"text":"password",placeholder:"sk-...",value:a.api_key,onChange:d=>l({api_key:d.target.value}),className:"font-mono pr-10"}),e.jsx(_,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent",onClick:()=>c(!r),children:r?e.jsx(ic,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(ua,{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 P2(){const a=await ke("/api/webui/config/bot",{method:"GET",headers:Zs()});if(!a.ok)throw new Error("่ฏปๅ–Bot้…็ฝฎๅคฑ่ดฅ");const r=(await a.json()).config.bot||{};return{qq_account:r.qq_account||0,nickname:r.nickname||"",alias_names:r.alias_names||[]}}async function F2(){const a=await ke("/api/webui/config/bot",{method:"GET",headers:Zs()});if(!a.ok)throw new Error("่ฏปๅ–ไบบๆ ผ้…็ฝฎๅคฑ่ดฅ");const r=(await a.json()).config.personality||{};return{personality:r.personality||"",reply_style:r.reply_style||"",interest:r.interest||"",plan_style:r.plan_style||"",private_plan_style:r.private_plan_style||""}}async function H2(){const a=await ke("/api/webui/config/bot",{method:"GET",headers:Zs()});if(!a.ok)throw new Error("่ฏปๅ–่กจๆƒ…ๅŒ…้…็ฝฎๅคฑ่ดฅ");const r=(await a.json()).config.emoji||{};return{emoji_chance:r.emoji_chance??.4,max_reg_num:r.max_reg_num??40,do_replace:r.do_replace??!0,check_interval:r.check_interval??10,steal_emoji:r.steal_emoji??!0,content_filtration:r.content_filtration??!1,filtration_prompt:r.filtration_prompt||""}}async function q2(){const a=await ke("/api/webui/config/bot",{method:"GET",headers:Zs()});if(!a.ok)throw new Error("่ฏปๅ–ๅ…ถไป–้…็ฝฎๅคฑ่ดฅ");const r=(await a.json()).config,c=r.tool||{},d=r.expression||{};return{enable_tool:c.enable_tool??!0,all_global:d.all_global_jargon??!0}}async function V2(){const a=await ke("/api/webui/config/model",{method:"GET",headers:Zs()});if(!a.ok)throw new Error("่ฏปๅ–ๆจกๅž‹้…็ฝฎๅคฑ่ดฅ");return{api_key:((await a.json()).config.api_providers||[]).find(m=>m.name==="SiliconFlow")?.api_key||""}}async function G2(a){const l=await ke("/api/webui/config/bot/section/bot",{method:"POST",headers:Zs(),body:JSON.stringify(a)});if(!l.ok){const r=await l.json();throw new Error(r.detail||"ไฟๅญ˜BotๅŸบ็ก€้…็ฝฎๅคฑ่ดฅ")}return await l.json()}async function K2(a){const l=await ke("/api/webui/config/bot/section/personality",{method:"POST",headers:Zs(),body:JSON.stringify(a)});if(!l.ok){const r=await l.json();throw new Error(r.detail||"ไฟๅญ˜ไบบๆ ผ้…็ฝฎๅคฑ่ดฅ")}return await l.json()}async function Q2(a){const l=await ke("/api/webui/config/bot/section/emoji",{method:"POST",headers:Zs(),body:JSON.stringify(a)});if(!l.ok){const r=await l.json();throw new Error(r.detail||"ไฟๅญ˜่กจๆƒ…ๅŒ…้…็ฝฎๅคฑ่ดฅ")}return await l.json()}async function Y2(a){const l=[];l.push(ke("/api/webui/config/bot/section/tool",{method:"POST",headers:Zs(),body:JSON.stringify({enable_tool:a.enable_tool})})),l.push(ke("/api/webui/config/bot/section/expression",{method:"POST",headers:Zs(),body:JSON.stringify({all_global_jargon:a.all_global})}));const r=await Promise.all(l);for(const c of r)if(!c.ok){const d=await c.json();throw new Error(d.detail||"ไฟๅญ˜ๅ…ถไป–้…็ฝฎๅคฑ่ดฅ")}return{success:!0}}async function J2(a){const l=await ke("/api/webui/config/model",{method:"GET",headers:Zs()});if(!l.ok)throw new Error("่ฏปๅ–ๆจกๅž‹้…็ฝฎๅคฑ่ดฅ");const c=(await l.json()).config,d=c.api_providers||[],m=d.findIndex(p=>p.name==="SiliconFlow");m>=0?d[m]={...d[m],api_key:a.api_key}:d.push({name:"SiliconFlow",base_url:"https://api.siliconflow.cn/v1",api_key:a.api_key,client_type:"openai",max_retry:3,timeout:120,retry_interval:5});const h={...c,api_providers:d},f=await ke("/api/webui/config/model",{method:"POST",headers:Zs(),body:JSON.stringify(h)});if(!f.ok){const p=await f.json();throw new Error(p.detail||"ไฟๅญ˜ๆจกๅž‹้…็ฝฎๅคฑ่ดฅ")}return await f.json()}async function Fg(){const a=await ke("/api/webui/setup/complete",{method:"POST"});if(!a.ok){const l=await a.json();throw new Error(l.message||"ๆ ‡่ฎฐ้…็ฝฎๅฎŒๆˆๅคฑ่ดฅ")}return await a.json()}function X2(){return e.jsx(lr,{children:e.jsx(Z2,{})})}function Z2(){const a=ha(),{toast:l}=nt(),{triggerRestart:r}=Tn(),[c,d]=u.useState(0),[m,h]=u.useState(!1),[f,p]=u.useState(!1),[g,N]=u.useState(!0),[j,b]=u.useState({qq_account:0,nickname:"",alias_names:[]}),[y,w]=u.useState({personality:"ๆ˜ฏไธ€ไธชๅฅณๅคงๅญฆ็”Ÿ๏ผŒ็Žฐๅœจๅœจ่ฏปๅคงไบŒ๏ผŒไผšๅˆท่ดดๅงใ€‚",reply_style:"่ฏทๅ›žๅค็š„ๅนณๆทกไธ€ไบ›๏ผŒ็ฎ€็Ÿญไธ€ไบ›๏ผŒ่ฏดไธญๆ–‡๏ผŒไธ่ฆๅˆปๆ„็ชๅ‡บ่‡ช่บซๅญฆ็ง‘่ƒŒๆ™ฏใ€‚ๅฏไปฅๅ‚่€ƒ่ดดๅง๏ผŒ็ŸฅไนŽๅ’Œๅพฎๅš็š„ๅ›žๅค้ฃŽๆ ผใ€‚",interest:"ๅฏนๆŠ€ๆœฏ็›ธๅ…ณ่ฏ้ข˜๏ผŒๆธธๆˆๅ’ŒๅŠจๆผซ็›ธๅ…ณ่ฏ้ข˜ๆ„Ÿๅ…ด่ถฃ๏ผŒไนŸๅฏนๆ—ฅๅธธ่ฏ้ข˜ๆ„Ÿๅ…ด่ถฃ๏ผŒไธๅ–œๆฌขๅคช่ฟ‡ๆฒ‰้‡ไธฅ่‚ƒ็š„่ฏ้ข˜",plan_style:`1.ๆ€่€ƒ**ๆ‰€ๆœ‰**็š„ๅฏ็”จ็š„actionไธญ็š„**ๆฏไธชๅŠจไฝœ**ๆ˜ฏๅฆ็ฌฆๅˆๅฝ“ไธ‹ๆกไปถ๏ผŒๅฆ‚ๆžœๅŠจไฝœไฝฟ็”จๆกไปถ็ฌฆๅˆ่Šๅคฉๅ†…ๅฎนๅฐฑไฝฟ็”จ 2.ๅฆ‚ๆžœ็›ธๅŒ็š„ๅ†…ๅฎนๅทฒ็ป่ขซๆ‰ง่กŒ๏ผŒ่ฏทไธ่ฆ้‡ๅคๆ‰ง่กŒ 3.่ฏทๆŽงๅˆถไฝ ็š„ๅ‘่จ€้ข‘็އ๏ผŒไธ่ฆๅคช่ฟ‡้ข‘็น็š„ๅ‘่จ€ 4.ๅฆ‚ๆžœๆœ‰ไบบๅฏนไฝ ๆ„ŸๅˆฐๅŽŒ็ƒฆ๏ผŒ่ฏทๅ‡ๅฐ‘ๅ›žๅค 5.ๅฆ‚ๆžœๆœ‰ไบบๅฏนไฝ ่ฟ›่กŒๆ”ปๅ‡ป๏ผŒๆˆ–่€…ๆƒ…็ปชๆฟ€ๅŠจ๏ผŒ่ฏทไฝ ไปฅๅˆ้€‚็š„ๆ–นๆณ•ๅบ”ๅฏน`,private_plan_style:`1.ๆ€่€ƒ**ๆ‰€ๆœ‰**็š„ๅฏ็”จ็š„actionไธญ็š„**ๆฏไธชๅŠจไฝœ**ๆ˜ฏๅฆ็ฌฆๅˆๅฝ“ไธ‹ๆกไปถ๏ผŒๅฆ‚ๆžœๅŠจไฝœไฝฟ็”จๆกไปถ็ฌฆๅˆ่Šๅคฉๅ†…ๅฎนๅฐฑไฝฟ็”จ 2.ๅฆ‚ๆžœ็›ธๅŒ็š„ๅ†…ๅฎนๅทฒ็ป่ขซๆ‰ง่กŒ๏ผŒ่ฏทไธ่ฆ้‡ๅคๆ‰ง่กŒ -3.ๆŸๅฅ่ฏๅฆ‚ๆžœๅทฒ็ป่ขซๅ›žๅค่ฟ‡๏ผŒไธ่ฆ้‡ๅคๅ›žๅค`}),[z,M]=u.useState({emoji_chance:.4,max_reg_num:40,do_replace:!0,check_interval:10,steal_emoji:!0,content_filtration:!1,filtration_prompt:"็ฌฆๅˆๅ…ฌๅบ่‰ฏไฟ—"}),[S,F]=u.useState({enable_tool:!0,all_global:!0}),[E,C]=u.useState({api_key:""}),R=[{id:"bot-basic",title:"BotๅŸบ็ก€",description:"้…็ฝฎๆœบๅ™จไบบ็š„ๅŸบๆœฌไฟกๆฏ",icon:Yn},{id:"personality",title:"ไบบๆ ผ้…็ฝฎ",description:"ๅฎšไน‰ๆœบๅ™จไบบ็š„ๆ€งๆ ผๅ’Œ่ฏด่ฏ้ฃŽๆ ผ",icon:Fl},{id:"emoji",title:"่กจๆƒ…ๅŒ…",description:"้…็ฝฎ่กจๆƒ…ๅŒ…็›ธๅ…ณ่ฎพ็ฝฎ",icon:rd},{id:"other",title:"ๅ…ถไป–่ฎพ็ฝฎ",description:"ๅทฅๅ…ทใ€ๆƒ…็ปช็ณป็ปŸ็ญ‰้…็ฝฎ",icon:Sn},{id:"siliconflow",title:"API้…็ฝฎ",description:"้…็ฝฎ็ก…ๅŸบๆตๅŠจAPIๅฏ†้’ฅ",icon:cx}],H=(c+1)/R.length*100;u.useEffect(()=>{(async()=>{try{N(!0);const[ge,pe,D,Q,B]=await Promise.all([P2(),F2(),H2(),q2(),V2()]);b(ge),w(pe),M(D),F(Q),C(B)}catch(ge){l({title:"ๅŠ ่ฝฝ้…็ฝฎๅคฑ่ดฅ",description:ge instanceof Error?ge.message:"ๆ— ๆณ•ๅŠ ่ฝฝ็Žฐๆœ‰้…็ฝฎ๏ผŒๅฐ†ไฝฟ็”จ้ป˜่ฎคๅ€ผ",variant:"destructive"})}finally{N(!1)}})()},[l]);const O=async()=>{p(!0);try{switch(c){case 0:await G2(j);break;case 1:await K2(y);break;case 2:await Q2(z);break;case 3:await Y2(S);break;case 4:await J2(E);break}return l({title:"ไฟๅญ˜ๆˆๅŠŸ",description:`${R[c].title}้…็ฝฎๅทฒไฟๅญ˜`}),!0}catch(ce){return l({title:"ไฟๅญ˜ๅคฑ่ดฅ",description:ce instanceof Error?ce.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"}),!1}finally{p(!1)}},X=async()=>{await O()&&c{c>0&&d(c-1)},me=async()=>{h(!0);try{if(!await O()){h(!1);return}await Fg(),l({title:"้…็ฝฎๅฎŒๆˆ",description:"้บฆ้บฆๆญฃๅœจ้‡ๅฏไปฅๅบ”็”จๆ–ฐ้…็ฝฎ..."}),await r()}catch(ce){l({title:"้…็ฝฎๅคฑ่ดฅ",description:ce instanceof Error?ce.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}finally{h(!1)}},Ne=async()=>{try{await Fg(),a({to:"/"})}catch(ce){l({title:"่ทณ่ฟ‡ๅคฑ่ดฅ",description:ce instanceof Error?ce.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}},je=()=>{switch(c){case 0:return e.jsx(L2,{config:j,onChange:b});case 1:return e.jsx(U2,{config:y,onChange:w});case 2:return e.jsx($2,{config:z,onChange:M});case 3:return e.jsx(B2,{config:S,onChange:F});case 4:return e.jsx(I2,{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(nr,{}),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(D1,{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:["่ฎฉๆˆ‘ไปฌไธ€่ตทๅฎŒๆˆ ",Nx," ็š„ๅˆๅง‹้…็ฝฎ"]})]}),e.jsxs("div",{className:"mb-6 md:mb-8",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between text-xs md:text-sm",children:[e.jsxs("span",{className:"text-muted-foreground",children:["ๆญฅ้ชค ",c+1," / ",R.length]}),e.jsxs("span",{className:"font-medium text-primary",children:[Math.round(H),"%"]})]}),e.jsx(tr,{value:H,className:"h-2"})]}),e.jsx("div",{className:"mb-6 md:mb-8 flex justify-between",children:R.map((ce,ge)=>{const pe=ce.icon;return e.jsxs("div",{className:P("flex flex-1 flex-col items-center gap-1 md:gap-2",gea({to:"/"}),className:"gap-2 w-full sm:w-auto",children:[e.jsx(id,{className:"h-4 w-4"}),"่ฟ”ๅ›ž้ฆ–้กต"]}),e.jsxs(_,{size:"lg",variant:"outline",onClick:()=>window.history.back(),className:"gap-2 w-full sm:w-auto",children:[e.jsx($a,{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 W2=Bs.memo(function({config:l,onChange:r}){const c=l.platforms||[],d=l.alias_names||[],m=()=>{r({...l,platforms:[...c,""]})},h=j=>{r({...l,platforms:c.filter((b,y)=>y!==j)})},f=(j,b)=>{const y=[...c];y[j]=b,r({...l,platforms:y})},p=()=>{r({...l,alias_names:[...d,""]})},g=j=>{r({...l,alias_names:d.filter((b,y)=>y!==j)})},N=(j,b)=>{const y=[...d];y[j]=b,r({...l,alias_names:y})};return e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"ๅŸบๆœฌไฟกๆฏ"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"platform",children:"ๅนณๅฐ"}),e.jsx(ne,{id:"platform",value:l.platform,onChange:j=>r({...l,platform:j.target.value}),placeholder:"qq"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"qq_account",children:"QQ่ดฆๅท"}),e.jsx(ne,{id:"qq_account",value:l.qq_account,onChange:j=>r({...l,qq_account:j.target.value}),placeholder:"123456789"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"nickname",children:"ๆ˜ต็งฐ"}),e.jsx(ne,{id:"nickname",value:l.nickname,onChange:j=>r({...l,nickname:j.target.value}),placeholder:"้บฆ้บฆ"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"ๅˆซๅ"}),e.jsxs(_,{onClick:p,size:"sm",variant:"outline",children:[e.jsx(Xs,{className:"h-4 w-4 mr-1"}),"ๆทปๅŠ "]})]}),e.jsxs("div",{className:"space-y-2",children:[d.map((j,b)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{value:j,onChange:y=>N(b,y.target.value),placeholder:"ๅฐ้บฆ"}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(os,{className:"h-4 w-4"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsxs(gs,{children:['็กฎๅฎš่ฆๅˆ ้™คๅˆซๅ "',j||"(็ฉบ)",'" ๅ—๏ผŸๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚']})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:()=>g(b),children:"ๅˆ ้™ค"})]})]})]})]},b)),d.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๆš‚ๆ— ๅˆซๅ"})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"ๅ…ถไป–ๅนณๅฐ่ดฆๅท"}),e.jsxs(_,{onClick:m,size:"sm",variant:"outline",children:[e.jsx(Xs,{className:"h-4 w-4 mr-1"}),"ๆทปๅŠ "]})]}),e.jsxs("div",{className:"space-y-2",children:[c.map((j,b)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{value:j,onChange:y=>f(b,y.target.value),placeholder:"wx:114514"}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(os,{className:"h-4 w-4"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsxs(gs,{children:['็กฎๅฎš่ฆๅˆ ้™คๅนณๅฐ่ดฆๅท "',j||"(็ฉบ)",'" ๅ—๏ผŸๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚']})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:()=>h(b),children:"ๅˆ ้™ค"})]})]})]})]},b)),c.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๆš‚ๆ— ๅ…ถไป–ๅนณๅฐ่ดฆๅท"})]})]})]})]})})}),eS=Bs.memo(function({config:l,onChange:r}){const c=()=>{r({...l,states:[...l.states,""]})},d=h=>{r({...l,states:l.states.filter((f,p)=>p!==h)})},m=(h,f)=>{const p=[...l.states];p[h]=f,r({...l,states:p})};return e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"ไบบๆ ผ่ฎพ็ฝฎ"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"personality",children:"ไบบๆ ผ็‰น่ดจ"}),e.jsx(pt,{id:"personality",value:l.personality,onChange:h=>r({...l,personality:h.target.value}),placeholder:"ๆ่ฟฐไบบๆ ผ็‰น่ดจๅ’Œ่บซไปฝ็‰นๅพ๏ผˆๅปบ่ฎฎ120ๅญ—ไปฅๅ†…๏ผ‰",rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅปบ่ฎฎ120ๅญ—ไปฅๅ†…๏ผŒๆ่ฟฐไบบๆ ผ็‰น่ดจๅ’Œ่บซไปฝ็‰นๅพ"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"ๅคš้‡ไบบๆ ผ"}),e.jsxs(_,{onClick:c,size:"sm",variant:"outline",children:[e.jsx(Xs,{className:"h-4 w-4 mr-1"}),"ๆทปๅŠ ไบบๆ ผ"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅฏไปฅๅฎšไน‰ๅคšไธชไธๅŒ็š„ไบบๆ ผ็Šถๆ€๏ผŒ้บฆ้บฆไผš้šๆœบๅˆ‡ๆข"}),e.jsx("div",{className:"space-y-2",children:l.states.map((h,f)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(pt,{value:h,onChange:p=>m(f,p.target.value),placeholder:"ๆ่ฟฐไธ€ไธชไบบๆ ผ็Šถๆ€",rows:2}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(os,{className:"h-4 w-4"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsx(gs,{children:"็กฎๅฎš่ฆๅˆ ้™ค่ฟ™ไธชไบบๆ ผ็Šถๆ€ๅ—๏ผŸๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚"})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:()=>d(f),children:"ๅˆ ้™ค"})]})]})]})]},f))})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"state_probability",children:"ๆ›ฟๆขไธบๅคš้‡ไบบๆ ผๆฆ‚็އ"}),e.jsx(ne,{id:"state_probability",type:"number",step:"0.1",min:"0",max:"1",value:l.state_probability,onChange:h=>r({...l,state_probability:parseFloat(h.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆฏๆฌกๆž„ๅปบไบบๆ ผๆ—ถ๏ผŒ็”จๅคš้‡ไบบๆ ผๆ›ฟๆขไธปไบบๆ ผ็š„ๆฆ‚็އ๏ผˆ0.0-1.0๏ผ‰"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"reply_style",children:"่กจ่พพ้ฃŽๆ ผ"}),e.jsx(pt,{id:"reply_style",value:l.reply_style,onChange:h=>r({...l,reply_style:h.target.value}),placeholder:"ๆ่ฟฐ่ฏด่ฏ็š„่กจ่พพ้ฃŽๆ ผๅ’Œไน ๆƒฏ",rows:3})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"plan_style",children:"่ฏด่ฏ่ง„ๅˆ™ไธŽ่กŒไธบ้ฃŽๆ ผ"}),e.jsx(pt,{id:"plan_style",value:l.plan_style,onChange:h=>r({...l,plan_style:h.target.value}),placeholder:"้บฆ้บฆ็š„่ฏด่ฏ่ง„ๅˆ™ๅ’Œ่กŒไธบ้ฃŽๆ ผ",rows:5})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"visual_style",children:"่ฏ†ๅ›พ่ง„ๅˆ™"}),e.jsx(pt,{id:"visual_style",value:l.visual_style,onChange:h=>r({...l,visual_style:h.target.value}),placeholder:"่ฏ†ๅ›พๆ—ถ็š„ๅค„็†่ง„ๅˆ™",rows:3})]})]})]})})}),cl=Ew,ol=Mw,tl=u.forwardRef(({className:a,align:l="center",sideOffset:r=4,...c},d)=>e.jsx(Tw,{children:e.jsx(Ej,{ref:d,align:l,sideOffset:r,className:P("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]",a),...c})}));tl.displayName=Ej.displayName;const sS=Bs.memo(function({value:l,onChange:r}){const c=u.useMemo(()=>{const y=l.split("-");if(y.length===2){const[w,z]=y,[M,S]=w.split(":"),[F,E]=z.split(":");return{startHour:M?M.padStart(2,"0"):"00",startMinute:S?S.padStart(2,"0"):"00",endHour:F?F.padStart(2,"0"):"23",endMinute:E?E.padStart(2,"0"):"59"}}return{startHour:"00",startMinute:"00",endHour:"23",endMinute:"59"}},[l]),[d,m]=u.useState(c.startHour),[h,f]=u.useState(c.startMinute),[p,g]=u.useState(c.endHour),[N,j]=u.useState(c.endMinute);u.useEffect(()=>{m(c.startHour),f(c.startMinute),g(c.endHour),j(c.endMinute)},[c]);const b=(y,w,z,M)=>{const S=`${y}:${w}-${z}:${M}`;r(S)};return e.jsxs(cl,{children:[e.jsx(ol,{asChild:!0,children:e.jsxs(_,{variant:"outline",className:"w-full justify-start font-mono text-sm",children:[e.jsx(da,{className:"h-4 w-4 mr-2"}),l||"้€‰ๆ‹ฉๆ—ถ้—ดๆฎต"]})}),e.jsx(tl,{className:"w-72 sm:w-80",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-sm mb-3",children:"ๅผ€ๅง‹ๆ—ถ้—ด"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-xs",children:"ๅฐๆ—ถ"}),e.jsxs(Pe,{value:d,onValueChange:y=>{m(y),b(y,h,p,N)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsx(Ie,{children:Array.from({length:24},(y,w)=>w).map(y=>e.jsx(W,{value:y.toString().padStart(2,"0"),children:y.toString().padStart(2,"0")},y))})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-xs",children:"ๅˆ†้’Ÿ"}),e.jsxs(Pe,{value:h,onValueChange:y=>{f(y),b(d,y,p,N)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsx(Ie,{children:Array.from({length:60},(y,w)=>w).map(y=>e.jsx(W,{value:y.toString().padStart(2,"0"),children:y.toString().padStart(2,"0")},y))})]})]})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-sm mb-3",children:"็ป“ๆŸๆ—ถ้—ด"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-xs",children:"ๅฐๆ—ถ"}),e.jsxs(Pe,{value:p,onValueChange:y=>{g(y),b(d,h,y,N)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsx(Ie,{children:Array.from({length:24},(y,w)=>w).map(y=>e.jsx(W,{value:y.toString().padStart(2,"0"),children:y.toString().padStart(2,"0")},y))})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-xs",children:"ๅˆ†้’Ÿ"}),e.jsxs(Pe,{value:N,onValueChange:y=>{j(y),b(d,h,p,y)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsx(Ie,{children:Array.from({length:60},(y,w)=>w).map(y=>e.jsx(W,{value:y.toString().padStart(2,"0"),children:y.toString().padStart(2,"0")},y))})]})]})]})]})]})})]})}),tS=Bs.memo(function({rule:l}){const r=`{ target = "${l.target}", time = "${l.time}", value = ${l.value.toFixed(1)} }`;return e.jsxs(cl,{children:[e.jsx(ol,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(ua,{className:"h-4 w-4 mr-1"}),"้ข„่งˆ"]})}),e.jsx(tl,{className:"w-80 sm:w-96",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-sm",children:"้…็ฝฎ้ข„่งˆ"}),e.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:r}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"่ฟ™ๆ˜ฏไฟๅญ˜ๅˆฐ bot_config.toml ๆ–‡ไปถไธญ็š„ๆ ผๅผ"})]})})]})}),aS=Bs.memo(function({config:l,onChange:r}){const c=()=>{r({...l,talk_value_rules:[...l.talk_value_rules,{target:"",time:"00:00-23:59",value:1}]})},d=h=>{r({...l,talk_value_rules:l.talk_value_rules.filter((f,p)=>p!==h)})},m=(h,f,p)=>{const g=[...l.talk_value_rules];g[h]={...g[h],[f]:p},r({...l,talk_value_rules:g})};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"่Šๅคฉ่ฎพ็ฝฎ"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"talk_value",children:"่Šๅคฉ้ข‘็އ๏ผˆๅŸบ็ก€ๅ€ผ๏ผ‰"}),e.jsx(ne,{id:"talk_value",type:"number",step:"0.1",min:"0",max:"1",value:l.talk_value,onChange:h=>r({...l,talk_value:parseFloat(h.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"่ถŠๅฐ่ถŠๆฒ‰้ป˜๏ผŒ่Œƒๅ›ด 0-1"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"think_mode",children:"ๆ€่€ƒๆจกๅผ"}),e.jsxs(Pe,{value:l.think_mode||"classic",onValueChange:h=>r({...l,think_mode:h}),children:[e.jsx(Be,{id:"think_mode",children:e.jsx(Fe,{placeholder:"้€‰ๆ‹ฉๆ€่€ƒๆจกๅผ"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"classic",children:"็ปๅ…ธๆจกๅผ - ๆต…ๅบฆๆ€่€ƒๅ’Œๅ›žๅค"}),e.jsx(W,{value:"deep",children:"ๆทฑๅบฆๆจกๅผ - ่ฟ›่กŒๆทฑๅบฆๆ€่€ƒๅ’Œๅ›žๅค"}),e.jsx(W,{value:"dynamic",children:"ๅŠจๆ€ๆจกๅผ - ่‡ชๅŠจ้€‰ๆ‹ฉๆ€่€ƒๆทฑๅบฆ"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆŽงๅˆถ้บฆ้บฆ็š„ๆ€่€ƒๆทฑๅบฆใ€‚็ปๅ…ธๆจกๅผๅ›žๅคๅฟซไฝ†็ฎ€ๅ•๏ผ›ๆทฑๅบฆๆจกๅผๆ›ดๆทฑๅ…ฅไฝ†่พƒๆ…ข๏ผ›ๅŠจๆ€ๆจกๅผๆ นๆฎๆƒ…ๅ†ต่‡ชๅŠจ้€‰ๆ‹ฉ"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"mentioned_bot_reply",checked:l.mentioned_bot_reply,onCheckedChange:h=>r({...l,mentioned_bot_reply:h})}),e.jsx(T,{htmlFor:"mentioned_bot_reply",className:"cursor-pointer",children:"ๅฏ็”จๆๅŠๅฟ…ๅ›žๅค"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"max_context_size",children:"ไธŠไธ‹ๆ–‡้•ฟๅบฆ"}),e.jsx(ne,{id:"max_context_size",type:"number",min:"1",value:l.max_context_size,onChange:h=>r({...l,max_context_size:parseInt(h.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"planner_smooth",children:"่ง„ๅˆ’ๅ™จๅนณๆป‘"}),e.jsx(ne,{id:"planner_smooth",type:"number",step:"1",min:"0",value:l.planner_smooth,onChange:h=>r({...l,planner_smooth:parseFloat(h.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅขžๅคงๆ•ฐๅ€ผไผšๅ‡ๅฐ planner ่ดŸ่ท๏ผŒๆŽจ่ 1-5๏ผŒ0 ไธบๅ…ณ้—ญ"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"plan_reply_log_max_per_chat",children:"ๆฏไธช่Šๅคฉๆตๆœ€ๅคงๆ—ฅๅฟ—ๆ•ฐ้‡"}),e.jsx(ne,{id:"plan_reply_log_max_per_chat",type:"number",step:"1",min:"100",value:l.plan_reply_log_max_per_chat??1024,onChange:h=>r({...l,plan_reply_log_max_per_chat:parseInt(h.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆฏไธช่Šๅคฉๆตไฟๅญ˜็š„ Plan/Reply ๆ—ฅๅฟ—ๆœ€ๅคงๆ•ฐ้‡๏ผŒ่ถ…่ฟ‡ๆญคๆ•ฐ้‡ๆ—ถไผš่‡ชๅŠจๅˆ ้™คๆœ€่€็š„ๆ—ฅๅฟ—"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"llm_quote",checked:l.llm_quote??!1,onCheckedChange:h=>r({...l,llm_quote:h})}),e.jsx(T,{htmlFor:"llm_quote",className:"cursor-pointer",children:"ๅฏ็”จ LLM ๆŽงๅˆถๅผ•็”จ"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2 ml-10",children:"ๅฏ็”จๅŽ๏ผŒLLM ๅฏไปฅๅ†ณๅฎšๆ˜ฏๅฆๅœจๅ›žๅคๆ—ถๅผ•็”จๆถˆๆฏ"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"enable_talk_value_rules",checked:l.enable_talk_value_rules,onCheckedChange:h=>r({...l,enable_talk_value_rules:h})}),e.jsx(T,{htmlFor:"enable_talk_value_rules",className:"cursor-pointer",children:"ๅฏ็”จๅŠจๆ€ๅ‘่จ€้ข‘็އ่ง„ๅˆ™"})]})]})]}),l.enable_talk_value_rules&&e.jsxs("div",{className:"border-t pt-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-base font-semibold",children:"ๅŠจๆ€ๅ‘่จ€้ข‘็އ่ง„ๅˆ™"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"ๆŒ‰ๆ—ถๆฎตๆˆ–่ŠๅคฉๆตID่ฐƒๆ•ดๅ‘่จ€้ข‘็އ๏ผŒไผ˜ๅ…ˆๅŒน้…ๅ…ทไฝ“่Šๅคฉ๏ผŒๅ†ๅŒน้…ๅ…จๅฑ€่ง„ๅˆ™"})]}),e.jsxs(_,{onClick:c,size:"sm",children:[e.jsx(Xs,{className:"h-4 w-4 mr-1"}),"ๆทปๅŠ ่ง„ๅˆ™"]})]}),l.talk_value_rules&&l.talk_value_rules.length>0?e.jsx("div",{className:"space-y-4",children:l.talk_value_rules.map((h,f)=>e.jsxs("div",{className:"rounded-lg border p-4 bg-muted/50 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["่ง„ๅˆ™ #",f+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(tS,{rule:h}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{variant:"ghost",size:"sm",children:e.jsx(os,{className:"h-4 w-4 text-destructive"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsxs(gs,{children:["็กฎๅฎš่ฆๅˆ ้™ค่ง„ๅˆ™ #",f+1," ๅ—๏ผŸๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:()=>d(f),children:"ๅˆ ้™ค"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"้…็ฝฎ็ฑปๅž‹"}),e.jsxs(Pe,{value:h.target===""?"global":"specific",onValueChange:p=>{p==="global"?m(f,"target",""):m(f,"target","qq::group")},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"global",children:"ๅ…จๅฑ€้…็ฝฎ"}),e.jsx(W,{value:"specific",children:"่ฏฆ็ป†้…็ฝฎ"})]})]})]}),h.target!==""&&(()=>{const p=h.target.split(":"),g=p[0]||"qq",N=p[1]||"",j=p[2]||"group";return e.jsxs("div",{className:"grid gap-4 p-3 sm:p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"ๅนณๅฐ"}),e.jsxs(Pe,{value:g,onValueChange:b=>{m(f,"target",`${b}:${N}:${j}`)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"qq",children:"QQ"}),e.jsx(W,{value:"wx",children:"ๅพฎไฟก"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"็พค ID"}),e.jsx(ne,{value:N,onChange:b=>{m(f,"target",`${g}:${b.target.value}:${j}`)},placeholder:"่พ“ๅ…ฅ็พค ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"็ฑปๅž‹"}),e.jsxs(Pe,{value:j,onValueChange:b=>{m(f,"target",`${g}:${N}:${b}`)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"group",children:"็พค็ป„๏ผˆgroup๏ผ‰"}),e.jsx(W,{value:"private",children:"็ง่Š๏ผˆprivate๏ผ‰"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["ๅฝ“ๅ‰่Šๅคฉๆต ID๏ผš",h.target||"๏ผˆๆœช่ฎพ็ฝฎ๏ผ‰"]})]})})(),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"ๆ—ถ้—ดๆฎต (Time)"}),e.jsx(sS,{value:h.time,onChange:p=>m(f,"time",p)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆ”ฏๆŒ่ทจๅคœๅŒบ้—ด๏ผŒไพ‹ๅฆ‚ 23:00-02:00"})]}),e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{htmlFor:`rule-value-${f}`,className:"text-xs font-medium",children:"ๅ‘่จ€้ข‘็އๅ€ผ (Value)"}),e.jsx(ne,{id:`rule-value-${f}`,type:"number",step:"0.01",min:"0.01",max:"1",value:h.value,onChange:p=>{const g=parseFloat(p.target.value);isNaN(g)||m(f,"value",Math.max(.01,Math.min(1,g)))},className:"w-20 h-8 text-xs"})]}),e.jsx(el,{value:[h.value],onValueChange:p=>m(f,"value",p[0]),min:.01,max:1,step:.01,className:"w-full"}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"0.01 (ๆžๅฐ‘ๅ‘่จ€)"}),e.jsx("span",{children:"0.5"}),e.jsx("span",{children:"1.0 (ๆญฃๅธธ)"})]})]})]})]},f))}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:e.jsx("p",{className:"text-sm",children:'ๆš‚ๆ— ่ง„ๅˆ™๏ผŒ็‚นๅ‡ป"ๆทปๅŠ ่ง„ๅˆ™"ๆŒ‰้’ฎๅˆ›ๅปบ'})}),e.jsxs("div",{className:"mt-4 p-4 bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[e.jsx("h5",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"๐Ÿ“ ่ง„ๅˆ™่ฏดๆ˜Ž"}),e.jsxs("ul",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[e.jsxs("li",{children:["โ€ข ",e.jsx("strong",{children:"Target ไธบ็ฉบ"}),"๏ผšๅ…จๅฑ€่ง„ๅˆ™๏ผŒๅฏนๆ‰€ๆœ‰่Šๅคฉ็”Ÿๆ•ˆ"]}),e.jsxs("li",{children:["โ€ข ",e.jsx("strong",{children:"Target ๆŒ‡ๅฎš"}),"๏ผšไป…ๅฏน็‰นๅฎš่Šๅคฉๆต็”Ÿๆ•ˆ๏ผˆๆ ผๅผ๏ผšplatform:id:type๏ผ‰"]}),e.jsxs("li",{children:["โ€ข ",e.jsx("strong",{children:"ไผ˜ๅ…ˆ็บง"}),"๏ผšๅ…ˆๅŒน้…ๅ…ทไฝ“่Šๅคฉๆต่ง„ๅˆ™๏ผŒๅ†ๅŒน้…ๅ…จๅฑ€่ง„ๅˆ™"]}),e.jsxs("li",{children:["โ€ข ",e.jsx("strong",{children:"ๆ—ถ้—ดๆ”ฏๆŒ่ทจๅคœ"}),"๏ผšไพ‹ๅฆ‚ 23:00-02:00 ่กจ็คบๆ™šไธŠ11็‚นๅˆฐๆฌกๆ—ฅๅ‡Œๆ™จ2็‚น"]}),e.jsxs("li",{children:["โ€ข ",e.jsx("strong",{children:"ๆ•ฐๅ€ผ่Œƒๅ›ด"}),"๏ผšๅปบ่ฎฎ 0-1๏ผŒ0 ่กจ็คบๅฎŒๅ…จๆฒ‰้ป˜๏ผŒ1 ่กจ็คบๆญฃๅธธๅ‘่จ€"]})]})]})]})]})}),lS=Bs.memo(function({config:l,onChange:r}){const c=S=>{if(!S||!S.includes(":"))return{platform:"qq",userId:""};const[F,E]=S.split(":");return{platform:F,userId:E}},{platform:d,userId:m}=c(l.dream_send),[h,f]=u.useState(d),[p,g]=u.useState(m),N=S=>{const[F,E]=S.split("-");return{startTime:F||"09:00",endTime:E||"22:00"}},j=(S,F)=>{const E=F?`${S}:${F}`:"";r({...l,dream_send:E})},b=S=>{f(S),j(S,p)},y=S=>{g(S),j(h,S)},w=()=>{r({...l,dream_time_ranges:[...l.dream_time_ranges,"09:00-22:00"]})},z=S=>{r({...l,dream_time_ranges:l.dream_time_ranges.filter((F,E)=>E!==S)})},M=(S,F,E)=>{const C=[...l.dream_time_ranges],R=N(C[S]);F==="startTime"?R.startTime=E:R.endTime=E,C[S]=`${R.startTime}-${R.endTime}`,r({...l,dream_time_ranges:C})};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"ๅšๆขฆ้…็ฝฎ"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"interval_minutes",children:"ๅšๆขฆๆ—ถ้—ด้—ด้š”๏ผˆๅˆ†้’Ÿ๏ผ‰"}),e.jsx(ne,{id:"interval_minutes",type:"number",min:"1",value:l.interval_minutes,onChange:S=>r({...l,interval_minutes:Number(S.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"้ป˜่ฎค30ๅˆ†้’Ÿ"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"max_iterations",children:"ๅšๆขฆๆœ€ๅคง่ฝฎๆฌก"}),e.jsx(ne,{id:"max_iterations",type:"number",min:"1",value:l.max_iterations,onChange:S=>r({...l,max_iterations:Number(S.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"้ป˜่ฎค20่ฝฎ"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"first_delay_seconds",children:"้ฆ–ๆฌกๅšๆขฆๅปถ่ฟŸ๏ผˆ็ง’๏ผ‰"}),e.jsx(ne,{id:"first_delay_seconds",type:"number",min:"0",value:l.first_delay_seconds,onChange:S=>r({...l,first_delay_seconds:Number(S.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"็จ‹ๅบๅฏๅŠจๅŽ้ฆ–ๆฌกๅšๆขฆๅ‰็š„ๅปถ่ฟŸๆ—ถ้—ด๏ผŒ้ป˜่ฎค60็ง’"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"ๅšๆขฆ็ป“ๆžœๆŽจ้€็›ฎๆ ‡"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(Pe,{value:h,onValueChange:b,children:[e.jsx(Be,{className:"w-[120px]",children:e.jsx(Fe,{placeholder:"้€‰ๆ‹ฉๅนณๅฐ"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"qq",children:"QQ"}),e.jsx(W,{value:"wx",children:"ๅพฎไฟก"}),e.jsx(W,{value:"webui",children:"WebUI"})]})]}),e.jsx(ne,{type:"text",placeholder:"่พ“ๅ…ฅ็”จๆˆทID (ไพ‹ๅฆ‚: 123456)",value:p,onChange:S=>y(S.target.value),className:"flex-1"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"้€‰ๆ‹ฉๅนณๅฐๅนถ่พ“ๅ…ฅ็”จๆˆทID๏ผŒๅšๆขฆ็ป“ๆŸๅŽๅฐ†ๆขฆๅขƒๅ‘้€็ป™่ฏฅ็”จๆˆทใ€‚็”จๆˆทIDไธบ็ฉบๅˆ™ไธๆŽจ้€"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"ๅšๆขฆๆ—ถ้—ดๆฎต้…็ฝฎ"}),e.jsx(_,{type:"button",size:"sm",onClick:w,children:"ๆทปๅŠ ๆ—ถ้—ดๆฎต"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"่ฎพ็ฝฎๅ…่ฎธๅšๆขฆ็š„ๆ—ถ้—ดๆฎต๏ผŒๆ”ฏๆŒ่ทจๅคœๅŒบ้—ด๏ผˆๅฆ‚ 23:00 ๅˆฐๆฌกๆ—ฅ 02:00๏ผ‰ใ€‚ๅˆ—่กจไธบ็ฉบๅˆ™ๅ…จๅคฉๅ…่ฎธๅšๆขฆ"}),e.jsxs("div",{className:"space-y-2",children:[l.dream_time_ranges.map((S,F)=>{const{startTime:E,endTime:C}=N(S);return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{type:"time",value:E,onChange:R=>M(F,"startTime",R.target.value),className:"w-[140px]"}),e.jsx("span",{className:"text-muted-foreground",children:"่‡ณ"}),e.jsx(ne,{type:"time",value:C,onChange:R=>M(F,"endTime",R.target.value),className:"w-[140px]"}),e.jsx(_,{type:"button",variant:"ghost",size:"icon",onClick:()=>z(F),children:e.jsx(Sa,{className:"h-4 w-4"})})]},F)}),l.dream_time_ranges.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 items-center space-x-2",children:[e.jsx(Ge,{id:"dream_visible",checked:l.dream_visible,onCheckedChange:S=>r({...l,dream_visible:S})}),e.jsx(T,{htmlFor:"dream_visible",className:"cursor-pointer",children:"ๆขฆๅขƒ็ป“ๆžœๅญ˜ๅ‚จๅˆฐไธŠไธ‹ๆ–‡"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅผ€ๅฏๅŽ๏ผŒๆขฆๅขƒๅ‘้€็ป™้…็ฝฎ็š„็”จๆˆทๅŽ๏ผŒไนŸไผšๅญ˜ๅ‚จๅˆฐ่ŠๅคฉไธŠไธ‹ๆ–‡ไธญ๏ผŒๅœจๅŽ็ปญๅฏน่ฏไธญๅฏ่ง"})]})]})}),nS=Bs.memo(function({config:l,onChange:r}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"LPMM ็Ÿฅ่ฏ†ๅบ“่ฎพ็ฝฎ"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{checked:l.enable,onCheckedChange:c=>r({...l,enable:c})}),e.jsx(T,{className:"cursor-pointer",children:"ๅฏ็”จ LPMM ็Ÿฅ่ฏ†ๅบ“"})]}),l.enable&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"LPMM ๆจกๅผ"}),e.jsxs(Pe,{value:l.lpmm_mode,onValueChange:c=>r({...l,lpmm_mode:c}),children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"้€‰ๆ‹ฉ LPMM ๆจกๅผ"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"classic",children:"็ปๅ…ธๆจกๅผ"}),e.jsx(W,{value:"agent",children:"Agent ๆจกๅผ"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"ๅŒไน‰่ฏๆœ็ดข TopK"}),e.jsx(ne,{type:"number",min:"1",value:l.rag_synonym_search_top_k,onChange:c=>r({...l,rag_synonym_search_top_k:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"ๅŒไน‰่ฏ้˜ˆๅ€ผ"}),e.jsx(ne,{type:"number",step:"0.1",min:"0",max:"1",value:l.rag_synonym_threshold,onChange:c=>r({...l,rag_synonym_threshold:parseFloat(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"ๅฎžไฝ“ๆๅ–็บฟ็จ‹ๆ•ฐ"}),e.jsx(ne,{type:"number",min:"1",value:l.info_extraction_workers,onChange:c=>r({...l,info_extraction_workers:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"ๅตŒๅ…ฅๅ‘้‡็ปดๅบฆ"}),e.jsx(ne,{type:"number",min:"1",value:l.embedding_dimension,onChange:c=>r({...l,embedding_dimension:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"ๅตŒๅ…ฅๅนถๅ‘็บฟ็จ‹ๆ•ฐ"}),e.jsx(ne,{type:"number",min:"1",value:l.max_embedding_workers,onChange:c=>r({...l,max_embedding_workers:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"ๆฏๆ‰นๅตŒๅ…ฅๆกๆ•ฐ"}),e.jsx(ne,{type:"number",min:"1",value:l.embedding_chunk_size,onChange:c=>r({...l,embedding_chunk_size:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"ๅŒไน‰ๅฎžไฝ“ๆ•ฐไธŠ้™"}),e.jsx(ne,{type:"number",min:"1",value:l.max_synonym_entities,onChange:c=>r({...l,max_synonym_entities:parseInt(c.target.value)})})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{checked:l.enable_ppr,onCheckedChange:c=>r({...l,enable_ppr:c})}),e.jsx(T,{className:"cursor-pointer",children:"ๅฏ็”จ PPR (ไฝŽ้…ๆœบๅ™จๅฏๅ…ณ้—ญ)"})]})]})]})]})}),rS=Bs.memo(function({config:l,onChange:r}){const[c,d]=u.useState(""),[m,h]=u.useState("WARNING"),f=()=>{c&&!l.suppress_libraries.includes(c)&&(r({...l,suppress_libraries:[...l.suppress_libraries,c]}),d(""))},p=w=>{r({...l,suppress_libraries:l.suppress_libraries.filter(z=>z!==w)})},g=()=>{c&&!l.library_log_levels[c]&&(r({...l,library_log_levels:{...l.library_log_levels,[c]:m}}),d(""),h("WARNING"))},N=w=>{const z={...l.library_log_levels};delete z[w],r({...l,library_log_levels:z})},j=["DEBUG","INFO","WARNING","ERROR","CRITICAL"],b=["FULL","compact","lite"],y=["none","title","full"];return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"ๆ—ฅๅฟ—้…็ฝฎ"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"ๆ—ฅๆœŸๆ ผๅผ"}),e.jsx(ne,{value:l.date_style,onChange:w=>r({...l,date_style:w.target.value}),placeholder:"ไพ‹ๅฆ‚: m-d H:i:s"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"m=ๆœˆ, d=ๆ—ฅ, H=ๆ—ถ, i=ๅˆ†, s=็ง’"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"ๆ—ฅๅฟ—็บงๅˆซๆ ทๅผ"}),e.jsxs(Pe,{value:l.log_level_style,onValueChange:w=>r({...l,log_level_style:w}),children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsx(Ie,{children:b.map(w=>e.jsx(W,{value:w,children:w},w))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"ๆ—ฅๅฟ—ๆ–‡ๆœฌ้ขœ่‰ฒ"}),e.jsxs(Pe,{value:l.color_text,onValueChange:w=>r({...l,color_text:w}),children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsx(Ie,{children:y.map(w=>e.jsx(W,{value:w,children:w},w))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"ๅ…จๅฑ€ๆ—ฅๅฟ—็บงๅˆซ"}),e.jsxs(Pe,{value:l.log_level,onValueChange:w=>r({...l,log_level:w}),children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsx(Ie,{children:j.map(w=>e.jsx(W,{value:w,children:w},w))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"ๆŽงๅˆถๅฐๆ—ฅๅฟ—็บงๅˆซ"}),e.jsxs(Pe,{value:l.console_log_level,onValueChange:w=>r({...l,console_log_level:w}),children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsx(Ie,{children:j.map(w=>e.jsx(W,{value:w,children:w},w))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"ๆ–‡ไปถๆ—ฅๅฟ—็บงๅˆซ"}),e.jsxs(Pe,{value:l.file_log_level,onValueChange:w=>r({...l,file_log_level:w}),children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsx(Ie,{children:j.map(w=>e.jsx(W,{value:w,children:w},w))})]})]})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"mb-2 block",children:"ๅฎŒๅ…จๅฑ่”ฝ็š„ๅบ“"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(ne,{value:c,onChange:w=>d(w.target.value),placeholder:"่พ“ๅ…ฅๅบ“ๅ",className:"flex-1",onKeyDown:w=>{w.key==="Enter"&&(w.preventDefault(),f())}}),e.jsx(_,{onClick:f,size:"sm",className:"flex-shrink-0",children:e.jsx(Xs,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:l.suppress_libraries.map(w=>e.jsxs("div",{className:"flex items-center gap-1 bg-secondary px-3 py-1 rounded-md",children:[e.jsx("span",{className:"text-sm",children:w}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onClick:()=>p(w),children:e.jsx(os,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},w))})]}),e.jsxs("div",{children:[e.jsx(T,{className:"mb-2 block",children:"็‰นๅฎšๅบ“็š„ๆ—ฅๅฟ—็บงๅˆซ"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(ne,{value:c,onChange:w=>d(w.target.value),placeholder:"่พ“ๅ…ฅๅบ“ๅ",className:"flex-1"}),e.jsxs(Pe,{value:m,onValueChange:h,children:[e.jsx(Be,{className:"w-32",children:e.jsx(Fe,{})}),e.jsx(Ie,{children:j.map(w=>e.jsx(W,{value:w,children:w},w))})]}),e.jsx(_,{onClick:g,size:"sm",children:e.jsx(Xs,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"space-y-2",children:Object.entries(l.library_log_levels).map(([w,z])=>e.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[e.jsx("span",{className:"text-sm font-medium",children:w}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:z}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>N(w),children:e.jsx(os,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]})]},w))})]})]})}),iS=Bs.memo(function({config:l,onChange:r}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"่ฐƒ่ฏ•้…็ฝฎ"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"ๆ˜พ็คบ Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๆ˜ฏๅฆๅœจๆ—ฅๅฟ—ไธญๆ˜พ็คบๆ็คบ่ฏ"})]}),e.jsx(Ge,{checked:l.show_prompt,onCheckedChange:c=>r({...l,show_prompt:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"ๆ˜พ็คบๅ›žๅคๅ™จ Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๆ˜ฏๅฆๆ˜พ็คบๅ›žๅคๅ™จ็š„ๆ็คบ่ฏ"})]}),e.jsx(Ge,{checked:l.show_replyer_prompt,onCheckedChange:c=>r({...l,show_replyer_prompt:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"ๆ˜พ็คบๅ›žๅคๅ™จๆŽจ็†"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๆ˜ฏๅฆๆ˜พ็คบๅ›žๅคๅ™จ็š„ๆŽจ็†่ฟ‡็จ‹"})]}),e.jsx(Ge,{checked:l.show_replyer_reasoning,onCheckedChange:c=>r({...l,show_replyer_reasoning:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"ๆ˜พ็คบ Jargon Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๆ˜ฏๅฆๆ˜พ็คบๆœฏ่ฏญ็›ธๅ…ณ็š„ๆ็คบ่ฏ"})]}),e.jsx(Ge,{checked:l.show_jargon_prompt,onCheckedChange:c=>r({...l,show_jargon_prompt:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"ๆ˜พ็คบ่ฎฐๅฟ†ๆฃ€็ดข Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๆ˜ฏๅฆๆ˜พ็คบ่ฎฐๅฟ†ๆฃ€็ดข็›ธๅ…ณ็š„ๆ็คบ่ฏ"})]}),e.jsx(Ge,{checked:l.show_memory_prompt,onCheckedChange:c=>r({...l,show_memory_prompt:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"ๆ˜พ็คบ Planner Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๆ˜ฏๅฆๆ˜พ็คบ Planner ็š„ๆ็คบ่ฏๅ’ŒๅŽŸๅง‹่ฟ”ๅ›ž็ป“ๆžœ"})]}),e.jsx(Ge,{checked:l.show_planner_prompt,onCheckedChange:c=>r({...l,show_planner_prompt:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"ๆ˜พ็คบ LPMM ็›ธๅ…ณๆ–‡ๆฎต"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๆ˜ฏๅฆๆ˜พ็คบ LPMM ็Ÿฅ่ฏ†ๅบ“ๆ‰พๅˆฐ็š„็›ธๅ…ณๆ–‡ๆฎตๆ—ฅๅฟ—"})]}),e.jsx(Ge,{checked:l.show_lpmm_paragraph,onCheckedChange:c=>r({...l,show_lpmm_paragraph:c})})]})]})]})}),cS=Bs.memo(function({config:l,onChange:r}){const c=g=>{const N=g.split(":");if(N.length>=4){const j=N[0],b=N[1],y=N[2],w=N.slice(3).join(":");return{platform:j,id:b,type:y,prompt:w}}return{platform:"qq",id:"",type:"group",prompt:""}},d=g=>`${g.platform}:${g.id}:${g.type}:${g.prompt}`,m=()=>{r({...l,chat_prompts:[...l.chat_prompts,"qq::group:"]})},h=g=>{r({...l,chat_prompts:l.chat_prompts.filter((N,j)=>j!==g)})},f=(g,N)=>{const b={...c(l.chat_prompts[g]),...N},y=[...l.chat_prompts];y[g]=d(b),r({...l,chat_prompts:y})},p=({promptStr:g})=>e.jsxs(cl,{children:[e.jsx(ol,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(ua,{className:"h-4 w-4 mr-1"}),"้ข„่งˆ"]})}),e.jsx(tl,{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.jsxs("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:['"',g,'"']}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"่ฟ™ๆ˜ฏไฟๅญ˜ๅˆฐ bot_config.toml ๆ–‡ไปถไธญ็š„ๆ ผๅผ"})]})})]});return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg bg-orange-500/10 border border-orange-500/20",children:[e.jsx(Lt,{className:"h-5 w-5 text-orange-500 shrink-0 mt-0.5"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("h4",{className:"font-medium text-orange-500",children:"ๅฎž้ชŒๆ€งๅŠŸ่ƒฝ"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๆญค้ƒจๅˆ†ๅŒ…ๅซๅฎž้ชŒๆ€งๅŠŸ่ƒฝ๏ผŒๅฏ่ƒฝไธ็จณๅฎšๆˆ–ๅœจๆœชๆฅ็‰ˆๆœฌไธญๅ‘็”Ÿๅ˜ๅŒ–ใ€‚่ฏท่ฐจๆ…Žไฝฟ็”จ๏ผŒๅนถๆณจๆ„ไธๆŽจ่ๅœจ็”Ÿไบง็Žฏๅขƒไธญไฟฎๆ”น็ง่Š่ง„ๅˆ™ใ€‚"})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"ๅฎž้ชŒๆ€ง่ฎพ็ฝฎ"}),e.jsxs("div",{className:"grid gap-6",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"private_plan_style",children:"็ง่Š่ง„ๅˆ™๏ผˆๅฎž้ชŒๆ€ง๏ผ‰"}),e.jsx(pt,{id:"private_plan_style",value:l.private_plan_style,onChange:g=>r({...l,private_plan_style:g.target.value}),placeholder:"็ง่Š็š„่ฏด่ฏ่ง„ๅˆ™ๅ’Œ่กŒไธบ้ฃŽๆ ผ๏ผˆไธๆŽจ่ไฟฎๆ”น๏ผ‰",rows:4}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"โš ๏ธ ไธๆŽจ่ไฟฎๆ”นๆญค้กน๏ผŒๅฏ่ƒฝไผšๅฝฑๅ“็ง่Šๅฏน่ฏ็š„็จณๅฎšๆ€ง"})]}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(T,{children:"็‰นๅฎš่Šๅคฉ Prompt ้…็ฝฎ"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"ไธบๆŒ‡ๅฎš่ŠๅคฉๆทปๅŠ ้ขๅค–็š„ prompt๏ผŒ็”จไบŽๅฎšๅˆถ็‰นๅฎšๅœบๆ™ฏ็š„ๅฏน่ฏ่กŒไธบ"})]}),e.jsxs(_,{onClick:m,size:"sm",variant:"outline",children:[e.jsx(Xs,{className:"h-4 w-4 mr-1"}),"ๆทปๅŠ ้…็ฝฎ"]})]}),e.jsxs("div",{className:"space-y-4",children:[l.chat_prompts.map((g,N)=>{const j=c(g);return e.jsxs("div",{className:"rounded-lg border p-4 space-y-4 bg-card",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["Prompt ้…็ฝฎ ",N+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(p,{promptStr:g}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"sm",variant:"ghost",children:e.jsx(os,{className:"h-4 w-4"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsx(gs,{children:"็กฎๅฎš่ฆๅˆ ้™ค่ฟ™ไธช prompt ้…็ฝฎๅ—๏ผŸๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚"})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:()=>h(N),children:"ๅˆ ้™ค"})]})]})]})]})]}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"ๅนณๅฐ"}),e.jsxs(Pe,{value:j.platform,onValueChange:b=>f(N,{platform:b}),children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"้€‰ๆ‹ฉๅนณๅฐ"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"qq",children:"QQ"}),e.jsx(W,{value:"wx",children:"ๅพฎไฟก"}),e.jsx(W,{value:"webui",children:"WebUI"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:j.type==="group"?"็พคๅท":"็”จๆˆทID"}),e.jsx(ne,{value:j.id,onChange:b=>f(N,{id:b.target.value}),placeholder:j.type==="group"?"่พ“ๅ…ฅ็พคๅท":"่พ“ๅ…ฅ็”จๆˆทID",className:"font-mono"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"็ฑปๅž‹"}),e.jsxs(Pe,{value:j.type,onValueChange:b=>f(N,{type:b}),children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"group",children:"็พค่Š (group)"}),e.jsx(W,{value:"private",children:"็ง่Š (private)"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"Prompt ๅ†…ๅฎน"}),e.jsx(pt,{value:j.prompt,onChange:b=>f(N,{prompt:b.target.value}),placeholder:"่พ“ๅ…ฅ้ขๅค–็š„ prompt ๅ†…ๅฎน๏ผŒไพ‹ๅฆ‚๏ผš่ฟ™ๆ˜ฏไธ€ไธชๆ‘„ๅฝฑ็พค๏ผŒไฝ ็ฒพ้€šๆ‘„ๅฝฑ็Ÿฅ่ฏ†",rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"่ฟ™ๆฎตๆ–‡ๆœฌไผšไฝœไธบ็ณป็ปŸๆ็คบๆทปๅŠ ๅˆฐ่ฏฅ่Šๅคฉ็š„ไธŠไธ‹ๆ–‡ไธญ"})]}),e.jsxs("div",{className:"rounded-md bg-muted/50 p-3",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(dx,{className:"h-3 w-3 text-muted-foreground"}),e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"ๅŽŸๅง‹ๆ ผๅผ"})]}),e.jsx("code",{className:"text-xs font-mono text-muted-foreground break-all",children:g||"(ๆœช้…็ฝฎ)"})]})]})]},N)}),l.chat_prompts.length===0&&e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx("p",{className:"text-sm",children:"ๆš‚ๆ— ็‰นๅฎš่Šๅคฉ prompt ้…็ฝฎ"}),e.jsx("p",{className:"text-xs mt-1",children:'็‚นๅ‡ปไธŠๆ–น"ๆทปๅŠ ้…็ฝฎ"ๆŒ‰้’ฎๅˆ›ๅปบๆ–ฐ้…็ฝฎ'})]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 p-4 rounded-lg bg-muted/30 border",children:[e.jsx("p",{className:"font-medium text-foreground",children:"๐Ÿ’ก ไฝฟ็”จ่ฏดๆ˜Ž"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 pl-2",children:[e.jsx("li",{children:"ไธบไธๅŒ็š„่Šๅคฉ็Žฏๅขƒ้…็ฝฎไธ“ๅฑž็š„่กŒไธบๆ็คบ"}),e.jsx("li",{children:"ๆ”ฏๆŒๅคšไธชๅนณๅฐ๏ผšQQใ€ๅพฎไฟกใ€WebUI"}),e.jsx("li",{children:"ๅฏไธบ็พค่Šๆˆ–็ง่Šๅˆ†ๅˆซ้…็ฝฎ"}),e.jsx("li",{children:"Prompt ไผš่‡ชๅŠจๆณจๅ…ฅๅˆฐ่ฏฅ่Šๅคฉ็š„ไธŠไธ‹ๆ–‡ไธญ"})]}),e.jsx("p",{className:"font-medium text-foreground mt-3",children:"๐Ÿ“ ้…็ฝฎ็คบไพ‹"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 pl-2",children:[e.jsxs("li",{children:["ๆ‘„ๅฝฑ็พค๏ผš",e.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:"่ฟ™ๆ˜ฏไธ€ไธชๆ‘„ๅฝฑ็พค๏ผŒไฝ ็ฒพ้€šๆ‘„ๅฝฑ็Ÿฅ่ฏ†"})]}),e.jsxs("li",{children:["ไบŒๆฌกๅ…ƒ็พค๏ผš",e.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:"่ฟ™ๆ˜ฏไธ€ไธชไบŒๆฌกๅ…ƒไบคๆต็พค"})]}),e.jsxs("li",{children:["ๅฅฝๅ‹็ง่Š๏ผš",e.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:"่ฟ™ๆ˜ฏไฝ ไธŽๅฅฝๆœ‹ๅ‹็š„็ง่Š"})]})]})]})]})]})]})]})}),oS=Bs.memo(function({config:l,onChange:r}){const[c,d]=u.useState(""),[m,h]=u.useState(""),f=()=>{c&&!l.auth_token.includes(c)&&(r({...l,auth_token:[...l.auth_token,c]}),d(""))},p=j=>{r({...l,auth_token:l.auth_token.filter((b,y)=>y!==j)})},g=()=>{m&&!l.api_server_allowed_api_keys.includes(m)&&(r({...l,api_server_allowed_api_keys:[...l.api_server_allowed_api_keys,m]}),h(""))},N=j=>{r({...l,api_server_allowed_api_keys:l.api_server_allowed_api_keys.filter((b,y)=>y!==j)})};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"ๆ—ง็‰ˆ API ่ฎค่ฏไปค็‰Œ"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"็”จไบŽๆ—ง็‰ˆ API ้ชŒ่ฏ๏ผŒไธบ็ฉบๅˆ™ไธๅฏ็”จ้ชŒ่ฏ"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(ne,{value:c,onChange:j=>d(j.target.value),placeholder:"่พ“ๅ…ฅ่ฎค่ฏไปค็‰Œ",onKeyDown:j=>{j.key==="Enter"&&(j.preventDefault(),f())}}),e.jsx(_,{onClick:f,size:"sm",children:e.jsx(Xs,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"space-y-2",children:l.auth_token.map((j,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:j}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>p(b),children:e.jsx(os,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},b))})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"ๆ–ฐ็‰ˆ API Server ้…็ฝฎ"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"ๅฏ็”จๆ–ฐ็‰ˆ API Server"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๆ˜ฏๅฆๅฏ็”จ้ขๅค–็š„ๆ–ฐ็‰ˆ API Server๏ผˆ้ขๅค–็›‘ๅฌ็ซฏๅฃ๏ผ‰"})]}),e.jsx(Ge,{checked:l.enable_api_server,onCheckedChange:j=>r({...l,enable_api_server:j})})]}),l.enable_api_server&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"ไธปๆœบๅœฐๅ€"}),e.jsx(ne,{value:l.api_server_host,onChange:j=>r({...l,api_server_host:j.target.value}),placeholder:"0.0.0.0"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"็ซฏๅฃๅท"}),e.jsx(ne,{type:"number",value:l.api_server_port,onChange:j=>r({...l,api_server_port:parseInt(j.target.value)}),placeholder:"8090"})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{checked:l.api_server_use_wss,onCheckedChange:j=>r({...l,api_server_use_wss:j})}),e.jsx(T,{children:"ๅฏ็”จ WSS ๅฎ‰ๅ…จ่ฟžๆŽฅ"})]}),l.api_server_use_wss&&e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"SSL ่ฏไนฆๆ–‡ไปถ่ทฏๅพ„"}),e.jsx(ne,{value:l.api_server_cert_file,onChange:j=>r({...l,api_server_cert_file:j.target.value}),placeholder:"cert.pem"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"SSL ๅฏ†้’ฅๆ–‡ไปถ่ทฏๅพ„"}),e.jsx(ne,{value:l.api_server_key_file,onChange:j=>r({...l,api_server_key_file:j.target.value}),placeholder:"key.pem"})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"mb-2 block",children:"ๅ…่ฎธ็š„ API Key ๅˆ—่กจ"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"ไธบ็ฉบๅˆ™ๅ…่ฎธๆ‰€ๆœ‰่ฟžๆŽฅ"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(ne,{value:m,onChange:j=>h(j.target.value),placeholder:"่พ“ๅ…ฅ API Key",onKeyDown:j=>{j.key==="Enter"&&(j.preventDefault(),g())}}),e.jsx(_,{onClick:g,size:"sm",children:e.jsx(Xs,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"space-y-2",children:l.api_server_allowed_api_keys.map((j,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:j}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>N(b),children:e.jsx(os,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},b))})]})]})]})]})]})}),dS=Bs.memo(function({config:l,onChange:r}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"็ปŸ่ฎกไฟกๆฏ"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"ๅฏ็”จ็ปŸ่ฎกไฟกๆฏๅ‘้€"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๅ‘้€ๅŒฟๅ็ปŸ่ฎกไฟกๆฏ๏ผŒๅธฎๅŠฉๆˆ‘ไปฌไบ†่งฃๅ…จ็ƒๆœ‰ๅคšๅฐ‘ๅช้บฆ้บฆๅœจ่ฟ่กŒ"})]}),e.jsx(Ge,{checked:l.enable,onCheckedChange:c=>r({...l,enable:c})})]})]})}),uS=Bs.memo(function({emojiConfig:l,memoryConfig:r,toolConfig:c,voiceConfig:d,onEmojiChange:m,onMemoryChange:h,onToolChange:f,onVoiceChange:p}){return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"ๅทฅๅ…ท่ฎพ็ฝฎ"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"enable_tool",checked:c.enable_tool,onCheckedChange:g=>f({...c,enable_tool:g})}),e.jsx(T,{htmlFor:"enable_tool",className:"cursor-pointer",children:"ๅฏ็”จๅทฅๅ…ท็ณป็ปŸ"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"ๅ…่ฎธ้บฆ้บฆไฝฟ็”จๅ„็งๅทฅๅ…ทๆฅๅขžๅผบๅŠŸ่ƒฝ"}),e.jsxs("div",{className:"flex items-center space-x-2 pt-2",children:[e.jsx(Ge,{id:"enable_asr",checked:d.enable_asr,onCheckedChange:g=>p({...d,enable_asr:g})}),e.jsx(T,{htmlFor:"enable_asr",className:"cursor-pointer",children:"ๅฏ็”จ่ฏญ้Ÿณ่ฏ†ๅˆซ"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"ๅฏ็”จๅŽ้บฆ้บฆๅฏไปฅ่ฏ†ๅˆซ่ฏญ้Ÿณๆถˆๆฏ๏ผŒ้œ€่ฆ้…็ฝฎ่ฏญ้Ÿณ่ฏ†ๅˆซๆจกๅž‹"})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"่ฎฐๅฟ†่ฎพ็ฝฎ"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"max_agent_iterations",children:"่ฎฐๅฟ†ๆ€่€ƒๆทฑๅบฆ"}),e.jsx(ne,{id:"max_agent_iterations",type:"number",min:"1",value:r.max_agent_iterations,onChange:g=>h({...r,max_agent_iterations:parseInt(g.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆœ€ไฝŽไธบ 1๏ผˆไธๆทฑๅ…ฅๆ€่€ƒ๏ผ‰"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"agent_timeout_seconds",children:"ๆœ€้•ฟๅ›žๅฟ†ๆ—ถ้—ด๏ผˆ็ง’๏ผ‰"}),e.jsx(ne,{id:"agent_timeout_seconds",type:"number",min:"1",step:"0.1",value:r.agent_timeout_seconds??120,onChange:g=>h({...r,agent_timeout_seconds:parseFloat(g.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"่ฎฐๅฟ†ๆฃ€็ดข็š„่ถ…ๆ—ถๆ—ถ้—ด๏ผŒ้ฟๅ…่ฟ‡้•ฟ็š„็ญ‰ๅพ…"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"enable_jargon_detection",checked:r.enable_jargon_detection??!0,onCheckedChange:g=>h({...r,enable_jargon_detection:g})}),e.jsx(T,{htmlFor:"enable_jargon_detection",className:"cursor-pointer",children:"ๅฏ็”จ้ป‘่ฏ่ฏ†ๅˆซ"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"่ฎฐๅฟ†ๆฃ€็ดข่ฟ‡็จ‹ไธญๆ˜ฏๅฆๅฏ็”จ้ป‘่ฏ่ฏ†ๅˆซ"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"global_memory",checked:r.global_memory??!1,onCheckedChange:g=>h({...r,global_memory:g})}),e.jsx(T,{htmlFor:"global_memory",className:"cursor-pointer",children:"ๅ…จๅฑ€่ฎฐๅฟ†ๆŸฅ่ฏข"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"ๅ…่ฎธ่ฎฐๅฟ†ๆฃ€็ดขๅœจๆ‰€ๆœ‰่Šๅคฉ่ฎฐๅฝ•ไธญ่ฟ›่กŒๅ…จๅฑ€ๆŸฅ่ฏข๏ผˆๅฟฝ็•ฅๅฝ“ๅ‰่Šๅคฉๆต๏ผ‰"})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"่กจๆƒ…ๅŒ…่ฎพ็ฝฎ"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"emoji_chance",children:"่กจๆƒ…ๅŒ…ๆฟ€ๆดปๆฆ‚็އ"}),e.jsx(ne,{id:"emoji_chance",type:"number",step:"0.1",min:"0",max:"1",value:l.emoji_chance,onChange:g=>m({...l,emoji_chance:parseFloat(g.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"่Œƒๅ›ด 0-1๏ผŒ่ถŠๅคง่ถŠๅฎนๆ˜“ๅ‘้€่กจๆƒ…ๅŒ…"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"max_reg_num",children:"ๆœ€ๅคงๆณจๅ†Œๆ•ฐ้‡"}),e.jsx(ne,{id:"max_reg_num",type:"number",min:"1",value:l.max_reg_num,onChange:g=>m({...l,max_reg_num:parseInt(g.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"้บฆ้บฆๆœ€ๅคšๅฏไปฅๆณจๅ†Œ็š„่กจๆƒ…ๅŒ…ๆ•ฐ้‡"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"check_interval",children:"ๆฃ€ๆŸฅ้—ด้š”๏ผˆๅˆ†้’Ÿ๏ผ‰"}),e.jsx(ne,{id:"check_interval",type:"number",min:"1",value:l.check_interval,onChange:g=>m({...l,check_interval:parseInt(g.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆฃ€ๆŸฅ่กจๆƒ…ๅŒ…๏ผˆๆณจๅ†Œใ€็ ดๆŸใ€ๅˆ ้™ค๏ผ‰็š„ๆ—ถ้—ด้—ด้š”"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"do_replace",checked:l.do_replace,onCheckedChange:g=>m({...l,do_replace:g})}),e.jsx(T,{htmlFor:"do_replace",className:"cursor-pointer",children:"่พพๅˆฐๆœ€ๅคงๆ•ฐ้‡ๆ—ถๆ›ฟๆข่กจๆƒ…ๅŒ…"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"steal_emoji",checked:l.steal_emoji,onCheckedChange:g=>m({...l,steal_emoji:g})}),e.jsx(T,{htmlFor:"steal_emoji",className:"cursor-pointer",children:"ๅทๅ–่กจๆƒ…ๅŒ…"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"ๅ…่ฎธ้บฆ้บฆๅฐ†็œ‹ๅˆฐ็š„่กจๆƒ…ๅŒ…ๆฎไธบๅทฑๆœ‰"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"content_filtration",checked:l.content_filtration,onCheckedChange:g=>m({...l,content_filtration:g})}),e.jsx(T,{htmlFor:"content_filtration",className:"cursor-pointer",children:"ๅฏ็”จ่กจๆƒ…ๅŒ…่ฟ‡ๆปค"})]}),l.content_filtration&&e.jsxs("div",{className:"grid gap-2 pl-6 border-l-2 border-primary/20",children:[e.jsx(T,{htmlFor:"filtration_prompt",children:"่ฟ‡ๆปค่ฆๆฑ‚"}),e.jsx(ne,{id:"filtration_prompt",value:l.filtration_prompt,onChange:g=>m({...l,filtration_prompt:g.target.value}),placeholder:"็ฌฆๅˆๅ…ฌๅบ่‰ฏไฟ—"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅชๆœ‰็ฌฆๅˆๆญค่ฆๆฑ‚็š„่กจๆƒ…ๅŒ…ๆ‰ไผš่ขซไฟๅญ˜"})]})]})]})})]})}),mS=Bs.memo(function({member:l,groupIndex:r,memberIndex:c,availableChatIds:d,onUpdate:m,onRemove:h}){const f=d.includes(l)||l==="*",[p,g]=u.useState(!f);return e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:"flex-1 flex gap-2",children:p?e.jsxs(e.Fragment,{children:[e.jsx(ne,{value:l,onChange:N=>m(r,c,N.target.value),placeholder:'่พ“ๅ…ฅ "*" ๆˆ– "qq:123456:group"',className:"flex-1"}),d.length>0&&e.jsx(_,{size:"sm",variant:"outline",onClick:()=>g(!1),title:"ๅˆ‡ๆขๅˆฐไธ‹ๆ‹‰้€‰ๆ‹ฉ",children:"ไธ‹ๆ‹‰"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(Pe,{value:l,onValueChange:N=>m(r,c,N),children:[e.jsx(Be,{className:"flex-1",children:e.jsx(Fe,{placeholder:"้€‰ๆ‹ฉ่Šๅคฉๆต"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"*",children:"* (ๅ…จๅฑ€ๅ…ฑไบซ)"}),d.map((N,j)=>e.jsx(W,{value:N,children:N},j))]})]}),e.jsx(_,{size:"sm",variant:"outline",onClick:()=>g(!0),title:"ๅˆ‡ๆขๅˆฐๆ‰‹ๅŠจ่พ“ๅ…ฅ",children:"่พ“ๅ…ฅ"})]})}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(os,{className:"h-4 w-4"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsxs(gs,{children:['็กฎๅฎš่ฆๅˆ ้™ค็ป„ๆˆๅ‘˜ "',l||"(็ฉบ)",'" ๅ—๏ผŸๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚']})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:()=>h(r,c),children:"ๅˆ ้™ค"})]})]})]})]})}),xS=Bs.memo(function({config:l,onChange:r}){const c=()=>{r({...l,learning_list:[...l.learning_list,["","enable","enable","1.0"]]})},d=b=>{r({...l,learning_list:l.learning_list.filter((y,w)=>w!==b)})},m=(b,y,w)=>{const z=[...l.learning_list];z[b][y]=w,r({...l,learning_list:z})},h=({rule:b})=>{const y=`["${b[0]}", "${b[1]}", "${b[2]}", "${b[3]}"]`;return e.jsxs(cl,{children:[e.jsx(ol,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(ua,{className:"h-4 w-4 mr-1"}),"้ข„่งˆ"]})}),e.jsx(tl,{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:y}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"่ฟ™ๆ˜ฏไฟๅญ˜ๅˆฐ bot_config.toml ๆ–‡ไปถไธญ็š„ๆ ผๅผ"})]})})]})},f=()=>{r({...l,expression_groups:[...l.expression_groups,[]]})},p=b=>{r({...l,expression_groups:l.expression_groups.filter((y,w)=>w!==b)})},g=b=>{const y=[...l.expression_groups];y[b]=[...y[b],""],r({...l,expression_groups:y})},N=(b,y)=>{const w=[...l.expression_groups];w[b]=w[b].filter((z,M)=>M!==y),r({...l,expression_groups:w})},j=(b,y,w)=>{const z=[...l.expression_groups];z[b][y]=w,r({...l,expression_groups:z})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"้ป‘่ฏ่ฎพ็ฝฎ"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"all_global_jargon",checked:l.all_global_jargon??!1,onCheckedChange:b=>r({...l,all_global_jargon:b})}),e.jsx(T,{htmlFor:"all_global_jargon",className:"cursor-pointer",children:"ๅ…จๅฑ€้ป‘่ฏๆจกๅผ"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"ๅผ€ๅฏๅŽ๏ผŒๆ–ฐๅขž็š„้ป‘่ฏๅฐ†้ป˜่ฎค่ฎพไธบๅ…จๅฑ€๏ผˆๆ‰€ๆœ‰่Šๅคฉๆตๅ…ฑไบซ๏ผ‰ใ€‚ๅ…ณ้—ญๅŽ๏ผŒๅทฒ่ฎฐๅฝ•็š„ๅ…จๅฑ€้ป‘่ฏไธไผšๆ”นๅ˜๏ผŒ้œ€่ฆๆ‰‹ๅŠจๅˆ ้™คใ€‚"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"enable_jargon_explanation",checked:l.enable_jargon_explanation??!0,onCheckedChange:b=>r({...l,enable_jargon_explanation:b})}),e.jsx(T,{htmlFor:"enable_jargon_explanation",className:"cursor-pointer",children:"ๅฏ็”จ้ป‘่ฏ่งฃ้‡Š"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"ๅœจๅ›žๅคๅ‰ๅฐ่ฏ•ๅฏนไธŠไธ‹ๆ–‡ไธญ็š„้ป‘่ฏ่ฟ›่กŒ่งฃ้‡Šใ€‚ๅ…ณ้—ญๅฏๅ‡ๅฐ‘ไธ€ๆฌกLLM่ฐƒ็”จ๏ผŒไป…ๅฝฑๅ“ๅ›žๅคๅ‰็š„้ป‘่ฏๅŒน้…ไธŽ่งฃ้‡Š๏ผŒไธๅฝฑๅ“้ป‘่ฏๅญฆไน ใ€‚"})]}),e.jsxs("div",{children:[e.jsx(T,{htmlFor:"jargon_mode",children:"้ป‘่ฏ่งฃ้‡Šๆฅๆบๆจกๅผ"}),e.jsxs(Pe,{value:l.jargon_mode??"context",onValueChange:b=>r({...l,jargon_mode:b}),children:[e.jsx(Be,{id:"jargon_mode",className:"mt-2",children:e.jsx(Fe,{placeholder:"้€‰ๆ‹ฉ้ป‘่ฏ่งฃ้‡Šๆฅๆบ"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"context",children:"ไธŠไธ‹ๆ–‡ๆจกๅผ๏ผˆ่‡ชๅŠจๅŒน้…้ป‘่ฏ๏ผ‰"}),e.jsx(W,{value:"planner",children:"Plannerๆจกๅผ๏ผˆไฝฟ็”จunknown_wordsๅˆ—่กจ๏ผ‰"})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["ไธŠไธ‹ๆ–‡ๆจกๅผ๏ผšไฝฟ็”จไธŠไธ‹ๆ–‡่‡ชๅŠจๅŒน้…้ป‘่ฏๅนถ่งฃ้‡Š",e.jsx("br",{}),"Plannerๆจกๅผ๏ผšไป…ไฝฟ็”จPlannerๅœจreplyๅŠจไฝœไธญ็ป™ๅ‡บ็š„unknown_wordsๅˆ—่กจ่ฟ›่กŒ้ป‘่ฏๆฃ€็ดข"]})]})]}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"่กจ่พพๅญฆไน ้…็ฝฎ"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"้…็ฝฎ้บฆ้บฆๅฆ‚ไฝ•ๅญฆไน ๅ’Œไฝฟ็”จ่กจ่พพๆ–นๅผ"})]}),e.jsxs(_,{onClick:c,size:"sm",variant:"outline",children:[e.jsx(Xs,{className:"h-4 w-4 mr-1"}),"ๆทปๅŠ ่ง„ๅˆ™"]})]}),e.jsxs("div",{className:"space-y-4",children:[l.learning_list.map((b,y)=>{const w=l.learning_list.some((C,R)=>R!==y&&C[0]===""),z=b[0]==="",M=b[0].split(":"),S=M[0]||"qq",F=M[1]||"",E=M[2]||"group";return e.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["่ง„ๅˆ™ ",y+1," ",z&&"๏ผˆๅ…จๅฑ€้…็ฝฎ๏ผ‰"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{rule:b}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"sm",variant:"ghost",children:e.jsx(os,{className:"h-4 w-4"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsxs(gs,{children:["็กฎๅฎš่ฆๅˆ ้™คๅญฆไน ่ง„ๅˆ™ ",y+1," ๅ—๏ผŸๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:()=>d(y),children:"ๅˆ ้™ค"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"้…็ฝฎ็ฑปๅž‹"}),e.jsxs(Pe,{value:z?"global":"specific",onValueChange:C=>{C==="global"?m(y,0,""):m(y,0,"qq::group")},disabled:w&&!z,children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"global",children:"ๅ…จๅฑ€้…็ฝฎ"}),e.jsx(W,{value:"specific",disabled:w&&!z,children:"่ฏฆ็ป†้…็ฝฎ"})]})]}),w&&!z&&e.jsx("p",{className:"text-xs text-amber-600",children:"ๅทฒๅญ˜ๅœจๅ…จๅฑ€้…็ฝฎ๏ผŒๆ— ๆณ•ๅˆ›ๅปบๆ–ฐ็š„ๅ…จๅฑ€้…็ฝฎ"})]}),!z&&e.jsxs("div",{className:"grid gap-4 p-3 sm:p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"ๅนณๅฐ"}),e.jsxs(Pe,{value:S,onValueChange:C=>{m(y,0,`${C}:${F}:${E}`)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"qq",children:"QQ"}),e.jsx(W,{value:"wx",children:"ๅพฎไฟก"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"็พค ID"}),e.jsx(ne,{value:F,onChange:C=>{m(y,0,`${S}:${C.target.value}:${E}`)},placeholder:"่พ“ๅ…ฅ็พค ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"็ฑปๅž‹"}),e.jsxs(Pe,{value:E,onValueChange:C=>{m(y,0,`${S}:${F}:${C}`)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"group",children:"็พค็ป„๏ผˆgroup๏ผ‰"}),e.jsx(W,{value:"private",children:"็ง่Š๏ผˆprivate๏ผ‰"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["ๅฝ“ๅ‰่Šๅคฉๆต ID๏ผš",b[0]||"๏ผˆๆœช่ฎพ็ฝฎ๏ผ‰"]})]}),e.jsx("div",{className:"grid gap-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-xs font-medium",children:"ไฝฟ็”จๅญฆๅˆฐ็š„่กจ่พพ"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"ๅ…่ฎธ้บฆ้บฆไฝฟ็”จไปŽ่Šๅคฉไธญๅญฆๅˆฐ็š„่กจ่พพๆ–นๅผ"})]}),e.jsx(Ge,{checked:b[1]==="enable",onCheckedChange:C=>m(y,1,C?"enable":"disable")})]})}),e.jsx("div",{className:"grid gap-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-xs font-medium",children:"ๅญฆไน ่กจ่พพ"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"ๅ…่ฎธ้บฆ้บฆไปŽ่Šๅคฉไธญๅญฆไน ๆ–ฐ็š„่กจ่พพๆ–นๅผ"})]}),e.jsx(Ge,{checked:b[2]==="enable",onCheckedChange:C=>m(y,2,C?"enable":"disable")})]})}),e.jsx("div",{className:"grid gap-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-xs font-medium",children:"ๅฏ็”จ้ป‘่ฏๅญฆไน "}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"ๅ…่ฎธ้บฆ้บฆๅœจๆญค่Šๅคฉๆตไธญๅญฆไน ๅ’Œ่ฎฐๅฝ•้ป‘่ฏ"})]}),e.jsx(Ge,{checked:b[3]==="true"||b[3]==="enable",onCheckedChange:C=>m(y,3,C?"true":"false")})]})})]})]},y)}),l.learning_list.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'ๆš‚ๆ— ๅญฆไน ่ง„ๅˆ™๏ผŒ็‚นๅ‡ป"ๆทปๅŠ ่ง„ๅˆ™"ๅผ€ๅง‹้…็ฝฎ'})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"่กจ่พพไผ˜ๅŒ–้…็ฝฎ"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"้…็ฝฎ้บฆ้บฆๅฆ‚ไฝ•ไผ˜ๅŒ–ๅ’Œๆ”น่ฟ›่กจ่พพๆ–นๅผ"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"expression_self_reflect",className:"cursor-pointer font-medium",children:"่‡ชๅŠจ่กจ่พพไผ˜ๅŒ–"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅฏ็”จๅŽ๏ผŒ้บฆ้บฆไผš่‡ชๅŠจๆฃ€ๆŸฅๅนถไผ˜ๅŒ–่กจ่พพๆ–นๅผ๏ผŒๆ— ้œ€็ฎก็†ๅ‘˜ๆ‰‹ๅŠจๅนฒ้ข„"})]}),e.jsx(Ge,{id:"expression_self_reflect",checked:l.expression_self_reflect??!1,onCheckedChange:b=>r({...l,expression_self_reflect:b})})]}),l.expression_self_reflect&&e.jsxs("div",{className:"space-y-4 pl-4 border-l-2 border-primary/20",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"expression_auto_check_interval",children:"่‡ชๅŠจๆฃ€ๆŸฅ้—ด้š”๏ผˆ็ง’๏ผ‰"}),e.jsx(ne,{id:"expression_auto_check_interval",type:"number",min:"60",value:l.expression_auto_check_interval??3600,onChange:b=>r({...l,expression_auto_check_interval:parseInt(b.target.value)||3600})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"่กจ่พพๆ–นๅผ่‡ชๅŠจๆฃ€ๆŸฅ็š„้—ด้š”ๆ—ถ้—ด๏ผˆๅ•ไฝ๏ผš็ง’๏ผ‰๏ผŒ้ป˜่ฎคๅ€ผ๏ผš3600็ง’๏ผˆ1ๅฐๆ—ถ๏ผ‰"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"expression_auto_check_count",children:"ๆฏๆฌกๆฃ€ๆŸฅๆ•ฐ้‡"}),e.jsx(ne,{id:"expression_auto_check_count",type:"number",min:"1",max:"100",value:l.expression_auto_check_count??10,onChange:b=>r({...l,expression_auto_check_count:parseInt(b.target.value)||10})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆฏๆฌก่‡ชๅŠจๆฃ€ๆŸฅๆ—ถ้šๆœบ้€‰ๅ–็š„่กจ่พพๆ–นๅผๆ•ฐ้‡๏ผŒ้ป˜่ฎคๅ€ผ๏ผš10ๆก"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"่‡ชๅฎšไน‰่ฏ„ไผฐๆ ‡ๅ‡†"}),e.jsxs(_,{onClick:()=>{r({...l,expression_auto_check_custom_criteria:[...l.expression_auto_check_custom_criteria||[],""]})},size:"sm",variant:"outline",children:[e.jsx(Xs,{className:"h-4 w-4 mr-1"}),"ๆทปๅŠ ๆ ‡ๅ‡†"]})]}),e.jsxs("div",{className:"space-y-2",children:[(l.expression_auto_check_custom_criteria||[]).map((b,y)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{value:b,onChange:w=>{const z=[...l.expression_auto_check_custom_criteria||[]];z[y]=w.target.value,r({...l,expression_auto_check_custom_criteria:z})},placeholder:"่พ“ๅ…ฅ่ฏ„ไผฐๆ ‡ๅ‡†๏ผŒไพ‹ๅฆ‚๏ผšๆ˜ฏๅฆ็ฌฆๅˆ่ง’่‰ฒไบบ่ฎพ",className:"flex-1"}),e.jsx(_,{onClick:()=>{r({...l,expression_auto_check_custom_criteria:(l.expression_auto_check_custom_criteria||[]).filter((w,z)=>z!==y)})},size:"icon",variant:"ghost",children:e.jsx(os,{className:"h-4 w-4"})})]},y)),(!l.expression_auto_check_custom_criteria||l.expression_auto_check_custom_criteria.length===0)&&e.jsx("div",{className:"text-center py-4 text-muted-foreground text-sm",children:'ๆš‚ๆ— ่‡ชๅฎšไน‰ๆ ‡ๅ‡†๏ผŒ็‚นๅ‡ป"ๆทปๅŠ ๆ ‡ๅ‡†"ๅผ€ๅง‹้…็ฝฎ'})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"่ฟ™ไบ›ๆ ‡ๅ‡†ไผš่ขซๆทปๅŠ ๅˆฐ่ฏ„ไผฐๆ็คบ่ฏไธญ๏ผŒไฝœไธบ้ขๅค–็š„่ฏ„ไผฐ่ฆๆฑ‚"})]})]})]}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"expression_checked_only",className:"cursor-pointer font-medium",children:"ไป…ไฝฟ็”จๅทฒๅฎกๆ ธ้€š่ฟ‡็š„่กจ่พพๆ–นๅผ"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅผ€ๅฏๅŽ๏ผŒๅชๆœ‰้€š่ฟ‡ๅฎกๆ ธ๏ผˆๅทฒๆฃ€ๆŸฅ๏ผ‰็š„้กน็›ฎไผš่ขซไฝฟ็”จ๏ผ›ๅ…ณ้—ญๆ—ถ๏ผŒๆœชๅฎกๆ ธ็š„้กน็›ฎไนŸไผš่ขซไฝฟ็”จใ€‚ๆ— ่ฎบๅผ€ๅ…ณ็Šถๆ€๏ผŒ่ขซๆ‹’็ป็š„้กน็›ฎๆฐธ่ฟœไธไผš่ขซไฝฟ็”จใ€‚"})]}),e.jsx(Ge,{id:"expression_checked_only",checked:l.expression_checked_only??!1,onCheckedChange:b=>r({...l,expression_checked_only:b})})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"expression_manual_reflect",className:"cursor-pointer font-medium",children:"ๆ‰‹ๅŠจ่กจ่พพไผ˜ๅŒ–"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅฏ็”จๅŽ๏ผŒ้บฆ้บฆไผšไธปๅŠจๅ‘็ฎก็†ๅ‘˜่ฏข้—ฎ่กจ่พพๆ–นๅผๆ˜ฏๅฆๅˆ้€‚"})]}),e.jsx(Ge,{id:"expression_manual_reflect",checked:l.expression_manual_reflect??!1,onCheckedChange:b=>r({...l,expression_manual_reflect:b})})]}),l.expression_manual_reflect&&e.jsxs("div",{className:"space-y-4 pl-4 border-l-2 border-primary/20",children:[e.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsx("span",{className:"text-sm font-medium",children:"ๅๆ€ๆ“ไฝœๅ‘˜"})}),e.jsx("div",{className:"space-y-4",children:(()=>{const y=(l.manual_reflect_operator_id||"").split(":"),w=y[0]||"qq",z=y[1]||"",M=y[2]||"private";return e.jsxs("div",{className:"grid gap-4 p-3 sm:p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"ๅนณๅฐ"}),e.jsxs(Pe,{value:w,onValueChange:S=>{r({...l,manual_reflect_operator_id:`${S}:${z}:${M}`})},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"qq",children:"QQ"}),e.jsx(W,{value:"wx",children:"ๅพฎไฟก"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"็”จๆˆท/็พค ID"}),e.jsx(ne,{value:z,onChange:S=>{r({...l,manual_reflect_operator_id:`${w}:${S.target.value}:${M}`})},placeholder:"่พ“ๅ…ฅ ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"็ฑปๅž‹"}),e.jsxs(Pe,{value:M,onValueChange:S=>{r({...l,manual_reflect_operator_id:`${w}:${z}:${S}`})},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"private",children:"็ง่Š๏ผˆprivate๏ผ‰"}),e.jsx(W,{value:"group",children:"็พค็ป„๏ผˆgroup๏ผ‰"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["ๅฝ“ๅ‰ๆ“ไฝœๅ‘˜ ID๏ผš",l.manual_reflect_operator_id||"๏ผˆๆœช่ฎพ็ฝฎ๏ผ‰"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:'ๆ‰‹ๅŠจ่กจ่พพไผ˜ๅŒ–ๆ“ไฝœๅ‘˜ID๏ผŒๆ ผๅผ๏ผšplatform:id:type (ไพ‹ๅฆ‚ "qq:123456:private" ๆˆ– "qq:654321:group")'})]})})()})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-medium",children:"ๅ…่ฎธ่ฟ›่กŒ่กจ่พพๅๆ€็š„่Šๅคฉๆต"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"ๅชๆœ‰ๅœจๆญคๅˆ—่กจไธญ็š„่Šๅคฉๆตๆ‰ไผšๆๅ‡บ้—ฎ้ข˜ๅนถ่ทŸ่ธชใ€‚ๅฆ‚ๆžœๅˆ—่กจไธบ็ฉบ๏ผŒๅˆ™ๆ‰€ๆœ‰่Šๅคฉๆต้ƒฝๅฏไปฅ่ฟ›่กŒ่กจ่พพๅๆ€๏ผˆๅ‰ๆๆ˜ฏๅฏ็”จไบ†ๆ‰‹ๅŠจ่กจ่พพไผ˜ๅŒ–๏ผ‰"})]}),e.jsxs(_,{onClick:()=>{r({...l,allow_reflect:[...l.allow_reflect||[],"qq::group"]})},size:"sm",variant:"outline",children:[e.jsx(Xs,{className:"h-4 w-4 mr-1"}),"ๆทปๅŠ ่Šๅคฉๆต"]})]}),e.jsxs("div",{className:"space-y-2",children:[(l.allow_reflect||[]).map((b,y)=>{const w=b.split(":"),z=w[0]||"qq",M=w[1]||"",S=w[2]||"group";return e.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg bg-muted/50",children:[e.jsxs(Pe,{value:z,onValueChange:F=>{const E=[...l.allow_reflect];E[y]=`${F}:${M}:${S}`,r({...l,allow_reflect:E})},children:[e.jsx(Be,{className:"w-24",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"qq",children:"QQ"}),e.jsx(W,{value:"wx",children:"ๅพฎไฟก"})]})]}),e.jsx(ne,{value:M,onChange:F=>{const E=[...l.allow_reflect];E[y]=`${z}:${F.target.value}:${S}`,r({...l,allow_reflect:E})},placeholder:"ID",className:"flex-1 font-mono text-sm"}),e.jsxs(Pe,{value:S,onValueChange:F=>{const E=[...l.allow_reflect];E[y]=`${z}:${M}:${F}`,r({...l,allow_reflect:E})},children:[e.jsx(Be,{className:"w-32",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"group",children:"็พค็ป„"}),e.jsx(W,{value:"private",children:"็ง่Š"})]})]}),e.jsx(_,{onClick:()=>{r({...l,allow_reflect:l.allow_reflect.filter((F,E)=>E!==y)})},size:"sm",variant:"ghost",children:e.jsx(os,{className:"h-4 w-4"})})]},y)}),(!l.allow_reflect||l.allow_reflect.length===0)&&e.jsx("div",{className:"text-center py-4 text-muted-foreground text-sm",children:"ๅˆ—่กจไธบ็ฉบ๏ผŒๆ‰€ๆœ‰่Šๅคฉๆต้ƒฝๅฏไปฅ่ฟ›่กŒ่กจ่พพๅๆ€"})]})]})]})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"่กจ่พพๅ…ฑไบซ็ป„้…็ฝฎ"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"้…็ฝฎไธๅŒ่Šๅคฉๆตไน‹้—ดๅฆ‚ไฝ•ๅ…ฑไบซๅญฆๅˆฐ็š„่กจ่พพๆ–นๅผ"})]}),e.jsxs(_,{onClick:f,size:"sm",variant:"outline",children:[e.jsx(Xs,{className:"h-4 w-4 mr-1"}),"ๆทปๅŠ ๅ…ฑไบซ็ป„"]})]}),e.jsxs("div",{className:"space-y-4",children:[l.expression_groups.map((b,y)=>{const w=l.learning_list.map(z=>z[0]).filter(z=>z!=="");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:["ๅ…ฑไบซ็ป„ ",y+1,b.length===1&&b[0]==="*"&&"๏ผˆๅ…จๅฑ€ๅ…ฑไบซ๏ผ‰"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(_,{onClick:()=>g(y),size:"sm",variant:"outline",children:e.jsx(Xs,{className:"h-4 w-4"})}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"sm",variant:"ghost",children:e.jsx(os,{className:"h-4 w-4"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsxs(gs,{children:["็กฎๅฎš่ฆๅˆ ้™คๅ…ฑไบซ็ป„ ",y+1," ๅ—๏ผŸๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:()=>p(y),children:"ๅˆ ้™ค"})]})]})]})]})]}),e.jsx("div",{className:"space-y-2",children:b.map((z,M)=>e.jsx(mS,{member:z,groupIndex:y,memberIndex:M,availableChatIds:w,onUpdate:j,onRemove:N},`${y}-${M}`))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:'ๆ็คบ๏ผšๅฏไปฅไปŽไธ‹ๆ‹‰ๆก†้€‰ๆ‹ฉๅทฒ้…็ฝฎ็š„่Šๅคฉๆต๏ผŒๆˆ–ๆ‰‹ๅŠจ่พ“ๅ…ฅใ€‚่พ“ๅ…ฅ "*" ๅฏ็”จๅ…จๅฑ€ๅ…ฑไบซ'})]},y)}),l.expression_groups.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'ๆš‚ๆ— ๅ…ฑไบซ็ป„๏ผŒ็‚นๅ‡ป"ๆทปๅŠ ๅ…ฑไบซ็ป„"ๅผ€ๅง‹้…็ฝฎ'})]})]})})]})});function hS({regex:a,reaction:l,onRegexChange:r,onReactionChange:c}){const[d,m]=u.useState(!1),[h,f]=u.useState(""),[p,g]=u.useState(null),[N,j]=u.useState(""),[b,y]=u.useState({}),[w,z]=u.useState(""),M=u.useRef(null),[S,F]=u.useState("build"),E=O=>O.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),C=(O,X=0)=>{const L=M.current;if(!L)return;const me=L.selectionStart||0,Ne=L.selectionEnd||0,je=a.substring(0,me)+O+a.substring(Ne);r(je),setTimeout(()=>{const ce=me+O.length+X;L.setSelectionRange(ce,ce),L.focus()},0)};u.useEffect(()=>{if(!a||!h){p!==null&&g(null),Object.keys(b).length>0&&y({}),w!==l&&z(l),N!==""&&j("");return}try{const O=E(a),X=new RegExp(O,"g"),L=h.match(X);g(L),j("");const Ne=new RegExp(O).exec(h);if(Ne&&Ne.groups){y(Ne.groups);let je=l;Object.entries(Ne.groups).forEach(([ce,ge])=>{je=je.replace(new RegExp(`\\[${ce}\\]`,"g"),ge||"")}),z(je)}else y({}),z(l)}catch(O){j(O.message),g(null),y({}),z(l)}},[a,h,l,p,b,w,N]);const R=()=>{if(!h||!p||p.length===0)return e.jsx("span",{className:"text-muted-foreground",children:h||"่ฏท่พ“ๅ…ฅๆต‹่ฏ•ๆ–‡ๆœฌ"});try{const O=E(a),X=new RegExp(O,"g");let L=0;const me=[];let Ne;for(;(Ne=X.exec(h))!==null;)Ne.index>L&&me.push(e.jsx("span",{children:h.substring(L,Ne.index)},`text-${L}`)),me.push(e.jsx("span",{className:"bg-yellow-200 dark:bg-yellow-900 font-semibold",children:Ne[0]},`match-${Ne.index}`)),L=Ne.index+Ne[0].length;return L)",desc:"Python้ฃŽๆ ผๅ‘ฝๅๆ•่Žท็ป„",moveCursor:-1},{label:"้žๆ•่Žท็ป„",pattern:"(?:)",desc:"ๅˆ†็ป„ไฝ†ไธไฟๅญ˜ๅŒน้…็ป“ๆžœ",moveCursor:-1}]},{category:"ๅญ—็ฌฆ็ฑป",items:[{label:"ๅญ—็ฌฆ้›†",pattern:"[]",desc:"ๅŒน้…ๆ‹ฌๅทๅ†…็š„ไปปๆ„ๅญ—็ฌฆ",moveCursor:-1},{label:"ๆŽ’้™คๅญ—็ฌฆ",pattern:"[^]",desc:"ๅŒน้…ไธๅœจๆ‹ฌๅทๅ†…็š„ๅญ—็ฌฆ",moveCursor:-1},{label:"่Œƒๅ›ด",pattern:"[a-z]",desc:"ๅŒน้…aๅˆฐz็š„ๅญ—็ฌฆ"},{label:"ไธญๆ–‡ๅญ—็ฌฆ",pattern:"[\\u4e00-\\u9fa5]",desc:"ๅŒน้…ไธญๆ–‡ๆฑ‰ๅญ—"}]},{category:"ๅธธ็”จๆจกๆฟ",items:[{label:"ๆ•่Žท่ฏ่ฏญ",pattern:"(?P\\S+)",desc:"ๆ•่Žทไธ€ไธช่ฏ่ฏญ"},{label:"ๆ•่Žทๅฅๅญ",pattern:"(?P.+)",desc:"ๆ•่Žทๆ•ดไธชๅฅๅญ"},{label:"ๆ•่Žทๆ•ฐๅญ—",pattern:"(?P\\d+)",desc:"ๆ•่Žทไธ€ไธชๆˆ–ๅคšไธชๆ•ฐๅญ—"},{label:"ๅฏ้€‰่ฏ่ฏญ",pattern:"(?:่ฏ่ฏญ1|่ฏ่ฏญ2)",desc:"ๅŒน้…ๅคšไธชๅฏ้€‰้กนไน‹ไธ€"}]}];return e.jsxs(Qs,{open:d,onOpenChange:m,children:[e.jsx(dd,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(ux,{className:"h-4 w-4 mr-1"}),"ๆญฃๅˆ™็ผ–่พ‘ๅ™จ"]})}),e.jsxs(Hs,{className:"max-w-[95vw] sm:max-w-[900px] max-h-[90vh]",children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"ๆญฃๅˆ™่กจ่พพๅผ็ผ–่พ‘ๅ™จ"}),e.jsx(at,{className:"text-sm",children:"ไฝฟ็”จๅฏ่ง†ๅŒ–ๅทฅๅ…ทๆž„ๅปบๆญฃๅˆ™่กจ่พพๅผ๏ผŒๅนถๅฎžๆ—ถๆต‹่ฏ•ๆ•ˆๆžœ"})]}),e.jsx(ts,{className:"max-h-[calc(90vh-120px)]",children:e.jsxs(Jt,{value:S,onValueChange:O=>F(O),className:"w-full",children:[e.jsxs(Gt,{className:"grid w-full grid-cols-2",children:[e.jsx(Xe,{value:"build",children:"๐Ÿ”ง ๆž„ๅปบๅ™จ"}),e.jsx(Xe,{value:"test",children:"๐Ÿงช ๆต‹่ฏ•ๅ™จ"})]}),e.jsxs(Ss,{value:"build",className:"space-y-4 mt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"ๆญฃๅˆ™่กจ่พพๅผ"}),e.jsx(ne,{ref:M,value:a,onChange:O=>r(O.target.value),className:"font-mono text-sm",placeholder:"็‚นๅ‡ปไธ‹ๆ–นๆŒ‰้’ฎๆž„ๅปบๆญฃๅˆ™่กจ่พพๅผ..."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"Reaction ๅ†…ๅฎน"}),e.jsx(pt,{value:l,onChange:O=>c(O.target.value),placeholder:"ไฝฟ็”จ [ๆ•่Žท็ป„ๅ] ๅผ•็”จๆ•่Žท็š„ๅ†…ๅฎน...",rows:3,className:"text-sm"})]}),e.jsxs("div",{className:"space-y-4 border-t pt-4",children:[H.map(O=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("h5",{className:"text-xs font-semibold text-primary",children:O.category}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:O.items.map(X=>e.jsx(_,{variant:"outline",size:"sm",className:"justify-start h-auto py-2 px-3",onClick:()=>C(X.pattern,X.moveCursor||0),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsxs("div",{className:"flex items-center gap-2 w-full",children:[e.jsx("span",{className:"text-xs font-medium",children:X.label}),e.jsx("code",{className:"ml-auto text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:X.pattern})]}),e.jsx("span",{className:"text-xs text-muted-foreground mt-0.5",children:X.desc})]})},X.label))})]},O.category)),e.jsxs("div",{className:"space-y-2 border-t pt-4",children:[e.jsx("h5",{className:"text-xs font-semibold text-primary",children:"ๅฎŒๆ•ด็คบไพ‹ๆจกๆฟ"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(_,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>r("^(?P\\S{1,20})ๆ˜ฏ่ฟ™ๆ ท็š„$"),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsxs("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:["^(?P\\S","{1,20}",")ๆ˜ฏ่ฟ™ๆ ท็š„$"]}),e.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"ๅŒน้…ใ€ŒๆŸไบ‹็‰ฉๆ˜ฏ่ฟ™ๆ ท็š„ใ€ๅนถๆ•่Žทไบ‹็‰ฉๅ็งฐ"})]})}),e.jsx(_,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>r("(?:[^๏ผŒใ€‚.\\s]+๏ผŒ\\s*)?ๆˆ‘(?:ไนŸ)?[ๆฒกๆฒ’]่ฆๆฑ‚ไฝ \\s*(?P.+?)[.ใ€‚,๏ผŒ]?$"),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?:[^๏ผŒใ€‚.\\s]+๏ผŒ\\s*)?ๆˆ‘(?:ไนŸ)?[ๆฒกๆฒ’]่ฆๆฑ‚ไฝ \\s*(?P.+?)[.ใ€‚,๏ผŒ]?$"}),e.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"ๅŒน้…ใ€Œๆˆ‘ๆฒก่ฆๆฑ‚ไฝ ๅšๆŸไบ‹ใ€ๅนถๆ•่Žทๅ…ทไฝ“่กŒไธบ"})]})}),e.jsx(_,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>r("(?P.+?)(?:ๆ˜ฏ|ไธบไป€ไนˆ|ๆ€Žไนˆ)"),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?P.+?)(?:ๆ˜ฏ|ไธบไป€ไนˆ|ๆ€Žไนˆ)"}),e.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"ๆ•่Žท้—ฎ้ข˜ไธป้ข˜่ฏ"})]})})]})]})]}),e.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[e.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"๐Ÿ’ก ไฝฟ็”จๆ็คบ"}),e.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[e.jsx("li",{children:"็‚นๅ‡ป่พ“ๅ…ฅๆก†่ฎพ็ฝฎๅ…‰ๆ ‡ไฝ็ฝฎ๏ผŒ็„ถๅŽ็‚นๅ‡ปๆŒ‰้’ฎๆ’ๅ…ฅๆจกๅผ"}),e.jsxs("li",{children:["ๅ‘ฝๅๆ•่Žท็ป„ๆ ผๅผ๏ผš",e.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"(?P<ๅ็งฐ>ๆจกๅผ)"})]}),e.jsxs("li",{children:["ๅœจ reaction ไธญไฝฟ็”จ ",e.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"[ๅ็งฐ]"})," ๅผ•็”จๆ•่Žท็š„ๅ†…ๅฎน"]}),e.jsx("li",{children:"ๅˆ‡ๆขๅˆฐๆต‹่ฏ•ๅ™จๆ ‡็ญพ้กต้ชŒ่ฏๆญฃๅˆ™่กจ่พพๅผๆ•ˆๆžœ"})]})]})]}),e.jsxs(Ss,{value:"test",className:"space-y-4 mt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"ๅฝ“ๅ‰ๆญฃๅˆ™่กจ่พพๅผ"}),e.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:a||"(ๆœช่ฎพ็ฝฎ)"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"test-text",className:"text-sm font-medium",children:"ๆต‹่ฏ•ๆ–‡ๆœฌ"}),e.jsx(pt,{id:"test-text",value:h,onChange:O=>f(O.target.value),placeholder:`ๅœจๆญค่พ“ๅ…ฅ่ฆๆต‹่ฏ•็š„ๆ–‡ๆœฌ... -ไพ‹ๅฆ‚๏ผšๆ‰“ๆธธๆˆๆ˜ฏ่ฟ™ๆ ท็š„`,className:"min-h-[100px] text-sm"})]}),N&&e.jsxs("div",{className:"rounded-md bg-destructive/10 border border-destructive/20 p-3",children:[e.jsx("p",{className:"text-sm text-destructive font-medium",children:"ๆญฃๅˆ™่กจ่พพๅผ้”™่ฏฏ"}),e.jsx("p",{className:"text-xs text-destructive/80 mt-1",children:N})]}),!N&&h&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"flex items-center gap-2",children:p&&p.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-green-500"}),e.jsxs("span",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:["ๅŒน้…ๆˆๅŠŸ (",p.length," ๅค„)"]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-gray-400"}),e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"ๆ— ๅŒน้…"})]})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"ๅŒน้…้ซ˜ไบฎ"}),e.jsx(ts,{className:"h-40 rounded-md bg-muted p-3",children:e.jsx("div",{className:"text-sm break-words",children:R()})})]}),Object.keys(b).length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"ๅ‘ฝๅๆ•่Žท็ป„"}),e.jsx(ts,{className:"h-32 rounded-md border p-3",children:e.jsx("div",{className:"space-y-2",children:Object.entries(b).map(([O,X])=>e.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[e.jsxs("span",{className:"font-mono font-semibold text-primary min-w-[80px]",children:["[",O,"]"]}),e.jsx("span",{className:"text-muted-foreground",children:"="}),e.jsx("span",{className:"font-mono bg-muted px-2 py-0.5 rounded",children:X})]},O))})})]}),Object.keys(b).length>0&&l&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"Reaction ๆ›ฟๆข้ข„่งˆ"}),e.jsx(ts,{className:"h-48 rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3",children:e.jsx("div",{className:"text-sm break-words",children:w})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"reaction ไธญ็š„ [name] ๅทฒ่ขซๆ›ฟๆขไธบๅฏนๅบ”็š„ๆ•่Žท็ป„ๅ€ผ"})]})]}),e.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[e.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"๐Ÿ’ก ๆต‹่ฏ•่ฏดๆ˜Ž"}),e.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[e.jsx("li",{children:"ๅŒน้…็š„ๆ–‡ๆœฌไผšไปฅ้ป„่‰ฒ่ƒŒๆ™ฏ้ซ˜ไบฎๆ˜พ็คบ"}),e.jsx("li",{children:"ๅ‘ฝๅๆ•่Žท็ป„็š„ๅ€ผไผšๆ˜พ็คบๅœจไธ‹ๆ–นๅˆ—่กจไธญ"}),e.jsx("li",{children:"Reaction ๆ›ฟๆข้ข„่งˆๆ˜พ็คบๆœ€็ปˆ็”Ÿๆˆ็š„ๅๅบ”ๅ†…ๅฎน"}),e.jsx("li",{children:"ๅฆ‚้œ€ไฟฎๆ”นๆญฃๅˆ™๏ผŒๅˆ‡ๆขๅ›žๆž„ๅปบๅ™จๆ ‡็ญพ้กต"})]})]})]})]})})]})]})}const fS=Bs.memo(function({keywordReactionConfig:l,responsePostProcessConfig:r,chineseTypoConfig:c,responseSplitterConfig:d,onKeywordReactionChange:m,onResponsePostProcessChange:h,onChineseTypoChange:f,onResponseSplitterChange:p}){const g=()=>{m({...l,regex_rules:[...l.regex_rules,{regex:[""],reaction:""}]})},N=C=>{m({...l,regex_rules:l.regex_rules.filter((R,H)=>H!==C)})},j=(C,R,H)=>{const O=[...l.regex_rules];R==="regex"&&typeof H=="string"?O[C]={...O[C],regex:[H]}:R==="reaction"&&typeof H=="string"&&(O[C]={...O[C],reaction:H}),m({...l,regex_rules:O})},b=()=>{m({...l,keyword_rules:[...l.keyword_rules,{keywords:[],reaction:""}]})},y=C=>{m({...l,keyword_rules:l.keyword_rules.filter((R,H)=>H!==C)})},w=(C,R,H)=>{const O=[...l.keyword_rules];typeof H=="string"&&(O[C]={...O[C],reaction:H}),m({...l,keyword_rules:O})},z=C=>{const R=[...l.keyword_rules];R[C]={...R[C],keywords:[...R[C].keywords||[],""]},m({...l,keyword_rules:R})},M=(C,R)=>{const H=[...l.keyword_rules];H[C]={...H[C],keywords:(H[C].keywords||[]).filter((O,X)=>X!==R)},m({...l,keyword_rules:H})},S=(C,R,H)=>{const O=[...l.keyword_rules],X=[...O[C].keywords||[]];X[R]=H,O[C]={...O[C],keywords:X},m({...l,keyword_rules:O})},F=({rule:C})=>{const R=`{ regex = [${(C.regex||[]).map(H=>`"${H}"`).join(", ")}], reaction = "${C.reaction}" }`;return e.jsxs(cl,{children:[e.jsx(ol,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(ua,{className:"h-4 w-4 mr-1"}),"้ข„่งˆ"]})}),e.jsx(tl,{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(ts,{className:"h-60 rounded-md bg-muted p-3",children:e.jsx("pre",{className:"font-mono text-xs break-all",children:R})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"่ฟ™ๆ˜ฏไฟๅญ˜ๅˆฐ bot_config.toml ๆ–‡ไปถไธญ็š„ๆ ผๅผ"})]})})]})},E=({rule:C})=>{const R=`[[keyword_reaction.keyword_rules]] +3.ๆŸๅฅ่ฏๅฆ‚ๆžœๅทฒ็ป่ขซๅ›žๅค่ฟ‡๏ผŒไธ่ฆ้‡ๅคๅ›žๅค`}),[z,M]=u.useState({emoji_chance:.4,max_reg_num:40,do_replace:!0,check_interval:10,steal_emoji:!0,content_filtration:!1,filtration_prompt:"็ฌฆๅˆๅ…ฌๅบ่‰ฏไฟ—"}),[S,F]=u.useState({enable_tool:!0,all_global:!0}),[E,C]=u.useState({api_key:""}),R=[{id:"bot-basic",title:"BotๅŸบ็ก€",description:"้…็ฝฎๆœบๅ™จไบบ็š„ๅŸบๆœฌไฟกๆฏ",icon:Yn},{id:"personality",title:"ไบบๆ ผ้…็ฝฎ",description:"ๅฎšไน‰ๆœบๅ™จไบบ็š„ๆ€งๆ ผๅ’Œ่ฏด่ฏ้ฃŽๆ ผ",icon:Fl},{id:"emoji",title:"่กจๆƒ…ๅŒ…",description:"้…็ฝฎ่กจๆƒ…ๅŒ…็›ธๅ…ณ่ฎพ็ฝฎ",icon:rd},{id:"other",title:"ๅ…ถไป–่ฎพ็ฝฎ",description:"ๅทฅๅ…ทใ€ๆƒ…็ปช็ณป็ปŸ็ญ‰้…็ฝฎ",icon:Sn},{id:"siliconflow",title:"API้…็ฝฎ",description:"้…็ฝฎ็ก…ๅŸบๆตๅŠจAPIๅฏ†้’ฅ",icon:cx}],H=(c+1)/R.length*100;u.useEffect(()=>{(async()=>{try{N(!0);const[ge,pe,D,Q,I]=await Promise.all([P2(),F2(),H2(),q2(),V2()]);b(ge),w(pe),M(D),F(Q),C(I)}catch(ge){l({title:"ๅŠ ่ฝฝ้…็ฝฎๅคฑ่ดฅ",description:ge instanceof Error?ge.message:"ๆ— ๆณ•ๅŠ ่ฝฝ็Žฐๆœ‰้…็ฝฎ๏ผŒๅฐ†ไฝฟ็”จ้ป˜่ฎคๅ€ผ",variant:"destructive"})}finally{N(!1)}})()},[l]);const O=async()=>{p(!0);try{switch(c){case 0:await G2(j);break;case 1:await K2(y);break;case 2:await Q2(z);break;case 3:await Y2(S);break;case 4:await J2(E);break}return l({title:"ไฟๅญ˜ๆˆๅŠŸ",description:`${R[c].title}้…็ฝฎๅทฒไฟๅญ˜`}),!0}catch(re){return l({title:"ไฟๅญ˜ๅคฑ่ดฅ",description:re instanceof Error?re.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"}),!1}finally{p(!1)}},X=async()=>{await O()&&c{c>0&&d(c-1)},me=async()=>{h(!0);try{if(!await O()){h(!1);return}await Fg(),l({title:"้…็ฝฎๅฎŒๆˆ",description:"้บฆ้บฆๆญฃๅœจ้‡ๅฏไปฅๅบ”็”จๆ–ฐ้…็ฝฎ..."}),await r()}catch(re){l({title:"้…็ฝฎๅคฑ่ดฅ",description:re instanceof Error?re.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}finally{h(!1)}},Ne=async()=>{try{await Fg(),a({to:"/"})}catch(re){l({title:"่ทณ่ฟ‡ๅคฑ่ดฅ",description:re instanceof Error?re.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}},je=()=>{switch(c){case 0:return e.jsx(L2,{config:j,onChange:b});case 1:return e.jsx(U2,{config:y,onChange:w});case 2:return e.jsx($2,{config:z,onChange:M});case 3:return e.jsx(I2,{config:S,onChange:F});case 4:return e.jsx(B2,{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(nr,{}),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(D_,{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:["่ฎฉๆˆ‘ไปฌไธ€่ตทๅฎŒๆˆ ",Nx," ็š„ๅˆๅง‹้…็ฝฎ"]})]}),e.jsxs("div",{className:"mb-6 md:mb-8",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between text-xs md:text-sm",children:[e.jsxs("span",{className:"text-muted-foreground",children:["ๆญฅ้ชค ",c+1," / ",R.length]}),e.jsxs("span",{className:"font-medium text-primary",children:[Math.round(H),"%"]})]}),e.jsx(tr,{value:H,className:"h-2"})]}),e.jsx("div",{className:"mb-6 md:mb-8 flex justify-between",children:R.map((re,ge)=>{const pe=re.icon;return e.jsxs("div",{className:P("flex flex-1 flex-col items-center gap-1 md:gap-2",gea({to:"/"}),className:"gap-2 w-full sm:w-auto",children:[e.jsx(id,{className:"h-4 w-4"}),"่ฟ”ๅ›ž้ฆ–้กต"]}),e.jsxs(_,{size:"lg",variant:"outline",onClick:()=>window.history.back(),className:"gap-2 w-full sm:w-auto",children:[e.jsx($a,{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 W2=Is.memo(function({config:l,onChange:r}){const c=l.platforms||[],d=l.alias_names||[],m=()=>{r({...l,platforms:[...c,""]})},h=j=>{r({...l,platforms:c.filter((b,y)=>y!==j)})},f=(j,b)=>{const y=[...c];y[j]=b,r({...l,platforms:y})},p=()=>{r({...l,alias_names:[...d,""]})},g=j=>{r({...l,alias_names:d.filter((b,y)=>y!==j)})},N=(j,b)=>{const y=[...d];y[j]=b,r({...l,alias_names:y})};return e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"ๅŸบๆœฌไฟกๆฏ"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"platform",children:"ๅนณๅฐ"}),e.jsx(ae,{id:"platform",value:l.platform,onChange:j=>r({...l,platform:j.target.value}),placeholder:"qq"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"qq_account",children:"QQ่ดฆๅท"}),e.jsx(ae,{id:"qq_account",value:l.qq_account,onChange:j=>r({...l,qq_account:j.target.value}),placeholder:"123456789"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"nickname",children:"ๆ˜ต็งฐ"}),e.jsx(ae,{id:"nickname",value:l.nickname,onChange:j=>r({...l,nickname:j.target.value}),placeholder:"้บฆ้บฆ"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"ๅˆซๅ"}),e.jsxs(_,{onClick:p,size:"sm",variant:"outline",children:[e.jsx(Xs,{className:"h-4 w-4 mr-1"}),"ๆทปๅŠ "]})]}),e.jsxs("div",{className:"space-y-2",children:[d.map((j,b)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{value:j,onChange:y=>N(b,y.target.value),placeholder:"ๅฐ้บฆ"}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(os,{className:"h-4 w-4"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsxs(gs,{children:['็กฎๅฎš่ฆๅˆ ้™คๅˆซๅ "',j||"(็ฉบ)",'" ๅ—๏ผŸๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚']})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:()=>g(b),children:"ๅˆ ้™ค"})]})]})]})]},b)),d.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๆš‚ๆ— ๅˆซๅ"})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"ๅ…ถไป–ๅนณๅฐ่ดฆๅท"}),e.jsxs(_,{onClick:m,size:"sm",variant:"outline",children:[e.jsx(Xs,{className:"h-4 w-4 mr-1"}),"ๆทปๅŠ "]})]}),e.jsxs("div",{className:"space-y-2",children:[c.map((j,b)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{value:j,onChange:y=>f(b,y.target.value),placeholder:"wx:114514"}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(os,{className:"h-4 w-4"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsxs(gs,{children:['็กฎๅฎš่ฆๅˆ ้™คๅนณๅฐ่ดฆๅท "',j||"(็ฉบ)",'" ๅ—๏ผŸๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚']})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:()=>h(b),children:"ๅˆ ้™ค"})]})]})]})]},b)),c.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๆš‚ๆ— ๅ…ถไป–ๅนณๅฐ่ดฆๅท"})]})]})]})]})})}),eS=Is.memo(function({config:l,onChange:r}){const c=()=>{r({...l,states:[...l.states,""]})},d=h=>{r({...l,states:l.states.filter((f,p)=>p!==h)})},m=(h,f)=>{const p=[...l.states];p[h]=f,r({...l,states:p})};return e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"ไบบๆ ผ่ฎพ็ฝฎ"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"personality",children:"ไบบๆ ผ็‰น่ดจ"}),e.jsx(pt,{id:"personality",value:l.personality,onChange:h=>r({...l,personality:h.target.value}),placeholder:"ๆ่ฟฐไบบๆ ผ็‰น่ดจๅ’Œ่บซไปฝ็‰นๅพ๏ผˆๅปบ่ฎฎ120ๅญ—ไปฅๅ†…๏ผ‰",rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅปบ่ฎฎ120ๅญ—ไปฅๅ†…๏ผŒๆ่ฟฐไบบๆ ผ็‰น่ดจๅ’Œ่บซไปฝ็‰นๅพ"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"ๅคš้‡ไบบๆ ผ"}),e.jsxs(_,{onClick:c,size:"sm",variant:"outline",children:[e.jsx(Xs,{className:"h-4 w-4 mr-1"}),"ๆทปๅŠ ไบบๆ ผ"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅฏไปฅๅฎšไน‰ๅคšไธชไธๅŒ็š„ไบบๆ ผ็Šถๆ€๏ผŒ้บฆ้บฆไผš้šๆœบๅˆ‡ๆข"}),e.jsx("div",{className:"space-y-2",children:l.states.map((h,f)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(pt,{value:h,onChange:p=>m(f,p.target.value),placeholder:"ๆ่ฟฐไธ€ไธชไบบๆ ผ็Šถๆ€",rows:2}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(os,{className:"h-4 w-4"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsx(gs,{children:"็กฎๅฎš่ฆๅˆ ้™ค่ฟ™ไธชไบบๆ ผ็Šถๆ€ๅ—๏ผŸๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚"})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:()=>d(f),children:"ๅˆ ้™ค"})]})]})]})]},f))})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"state_probability",children:"ๆ›ฟๆขไธบๅคš้‡ไบบๆ ผๆฆ‚็އ"}),e.jsx(ae,{id:"state_probability",type:"number",step:"0.1",min:"0",max:"1",value:l.state_probability,onChange:h=>r({...l,state_probability:parseFloat(h.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆฏๆฌกๆž„ๅปบไบบๆ ผๆ—ถ๏ผŒ็”จๅคš้‡ไบบๆ ผๆ›ฟๆขไธปไบบๆ ผ็š„ๆฆ‚็އ๏ผˆ0.0-1.0๏ผ‰"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"reply_style",children:"่กจ่พพ้ฃŽๆ ผ"}),e.jsx(pt,{id:"reply_style",value:l.reply_style,onChange:h=>r({...l,reply_style:h.target.value}),placeholder:"ๆ่ฟฐ่ฏด่ฏ็š„่กจ่พพ้ฃŽๆ ผๅ’Œไน ๆƒฏ",rows:3})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"plan_style",children:"่ฏด่ฏ่ง„ๅˆ™ไธŽ่กŒไธบ้ฃŽๆ ผ"}),e.jsx(pt,{id:"plan_style",value:l.plan_style,onChange:h=>r({...l,plan_style:h.target.value}),placeholder:"้บฆ้บฆ็š„่ฏด่ฏ่ง„ๅˆ™ๅ’Œ่กŒไธบ้ฃŽๆ ผ",rows:5})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"visual_style",children:"่ฏ†ๅ›พ่ง„ๅˆ™"}),e.jsx(pt,{id:"visual_style",value:l.visual_style,onChange:h=>r({...l,visual_style:h.target.value}),placeholder:"่ฏ†ๅ›พๆ—ถ็š„ๅค„็†่ง„ๅˆ™",rows:3})]})]})]})})}),cl=Ew,ol=Mw,tl=u.forwardRef(({className:a,align:l="center",sideOffset:r=4,...c},d)=>e.jsx(Tw,{children:e.jsx(Ej,{ref:d,align:l,sideOffset:r,className:P("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]",a),...c})}));tl.displayName=Ej.displayName;const sS=Is.memo(function({value:l,onChange:r}){const c=u.useMemo(()=>{const y=l.split("-");if(y.length===2){const[w,z]=y,[M,S]=w.split(":"),[F,E]=z.split(":");return{startHour:M?M.padStart(2,"0"):"00",startMinute:S?S.padStart(2,"0"):"00",endHour:F?F.padStart(2,"0"):"23",endMinute:E?E.padStart(2,"0"):"59"}}return{startHour:"00",startMinute:"00",endHour:"23",endMinute:"59"}},[l]),[d,m]=u.useState(c.startHour),[h,f]=u.useState(c.startMinute),[p,g]=u.useState(c.endHour),[N,j]=u.useState(c.endMinute);u.useEffect(()=>{m(c.startHour),f(c.startMinute),g(c.endHour),j(c.endMinute)},[c]);const b=(y,w,z,M)=>{const S=`${y}:${w}-${z}:${M}`;r(S)};return e.jsxs(cl,{children:[e.jsx(ol,{asChild:!0,children:e.jsxs(_,{variant:"outline",className:"w-full justify-start font-mono text-sm",children:[e.jsx(da,{className:"h-4 w-4 mr-2"}),l||"้€‰ๆ‹ฉๆ—ถ้—ดๆฎต"]})}),e.jsx(tl,{className:"w-72 sm:w-80",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-sm mb-3",children:"ๅผ€ๅง‹ๆ—ถ้—ด"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-xs",children:"ๅฐๆ—ถ"}),e.jsxs(Pe,{value:d,onValueChange:y=>{m(y),b(y,h,p,N)},children:[e.jsx(Ie,{children:e.jsx(Fe,{})}),e.jsx(Be,{children:Array.from({length:24},(y,w)=>w).map(y=>e.jsx(W,{value:y.toString().padStart(2,"0"),children:y.toString().padStart(2,"0")},y))})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-xs",children:"ๅˆ†้’Ÿ"}),e.jsxs(Pe,{value:h,onValueChange:y=>{f(y),b(d,y,p,N)},children:[e.jsx(Ie,{children:e.jsx(Fe,{})}),e.jsx(Be,{children:Array.from({length:60},(y,w)=>w).map(y=>e.jsx(W,{value:y.toString().padStart(2,"0"),children:y.toString().padStart(2,"0")},y))})]})]})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-sm mb-3",children:"็ป“ๆŸๆ—ถ้—ด"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-xs",children:"ๅฐๆ—ถ"}),e.jsxs(Pe,{value:p,onValueChange:y=>{g(y),b(d,h,y,N)},children:[e.jsx(Ie,{children:e.jsx(Fe,{})}),e.jsx(Be,{children:Array.from({length:24},(y,w)=>w).map(y=>e.jsx(W,{value:y.toString().padStart(2,"0"),children:y.toString().padStart(2,"0")},y))})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-xs",children:"ๅˆ†้’Ÿ"}),e.jsxs(Pe,{value:N,onValueChange:y=>{j(y),b(d,h,p,y)},children:[e.jsx(Ie,{children:e.jsx(Fe,{})}),e.jsx(Be,{children:Array.from({length:60},(y,w)=>w).map(y=>e.jsx(W,{value:y.toString().padStart(2,"0"),children:y.toString().padStart(2,"0")},y))})]})]})]})]})]})})]})}),tS=Is.memo(function({rule:l}){const r=`{ target = "${l.target}", time = "${l.time}", value = ${l.value.toFixed(1)} }`;return e.jsxs(cl,{children:[e.jsx(ol,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(ua,{className:"h-4 w-4 mr-1"}),"้ข„่งˆ"]})}),e.jsx(tl,{className:"w-80 sm:w-96",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-sm",children:"้…็ฝฎ้ข„่งˆ"}),e.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:r}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"่ฟ™ๆ˜ฏไฟๅญ˜ๅˆฐ bot_config.toml ๆ–‡ไปถไธญ็š„ๆ ผๅผ"})]})})]})}),aS=Is.memo(function({config:l,onChange:r}){const c=()=>{r({...l,talk_value_rules:[...l.talk_value_rules,{target:"",time:"00:00-23:59",value:1}]})},d=h=>{r({...l,talk_value_rules:l.talk_value_rules.filter((f,p)=>p!==h)})},m=(h,f,p)=>{const g=[...l.talk_value_rules];g[h]={...g[h],[f]:p},r({...l,talk_value_rules:g})};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"่Šๅคฉ่ฎพ็ฝฎ"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"talk_value",children:"่Šๅคฉ้ข‘็އ๏ผˆๅŸบ็ก€ๅ€ผ๏ผ‰"}),e.jsx(ae,{id:"talk_value",type:"number",step:"0.1",min:"0",max:"1",value:l.talk_value,onChange:h=>r({...l,talk_value:parseFloat(h.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"่ถŠๅฐ่ถŠๆฒ‰้ป˜๏ผŒ่Œƒๅ›ด 0-1"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"think_mode",children:"ๆ€่€ƒๆจกๅผ"}),e.jsxs(Pe,{value:l.think_mode||"classic",onValueChange:h=>r({...l,think_mode:h}),children:[e.jsx(Ie,{id:"think_mode",children:e.jsx(Fe,{placeholder:"้€‰ๆ‹ฉๆ€่€ƒๆจกๅผ"})}),e.jsxs(Be,{children:[e.jsx(W,{value:"classic",children:"็ปๅ…ธๆจกๅผ - ๆต…ๅบฆๆ€่€ƒๅ’Œๅ›žๅค"}),e.jsx(W,{value:"deep",children:"ๆทฑๅบฆๆจกๅผ - ่ฟ›่กŒๆทฑๅบฆๆ€่€ƒๅ’Œๅ›žๅค"}),e.jsx(W,{value:"dynamic",children:"ๅŠจๆ€ๆจกๅผ - ่‡ชๅŠจ้€‰ๆ‹ฉๆ€่€ƒๆทฑๅบฆ"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆŽงๅˆถ้บฆ้บฆ็š„ๆ€่€ƒๆทฑๅบฆใ€‚็ปๅ…ธๆจกๅผๅ›žๅคๅฟซไฝ†็ฎ€ๅ•๏ผ›ๆทฑๅบฆๆจกๅผๆ›ดๆทฑๅ…ฅไฝ†่พƒๆ…ข๏ผ›ๅŠจๆ€ๆจกๅผๆ นๆฎๆƒ…ๅ†ต่‡ชๅŠจ้€‰ๆ‹ฉ"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qe,{id:"mentioned_bot_reply",checked:l.mentioned_bot_reply,onCheckedChange:h=>r({...l,mentioned_bot_reply:h})}),e.jsx(T,{htmlFor:"mentioned_bot_reply",className:"cursor-pointer",children:"ๅฏ็”จๆๅŠๅฟ…ๅ›žๅค"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"max_context_size",children:"ไธŠไธ‹ๆ–‡้•ฟๅบฆ"}),e.jsx(ae,{id:"max_context_size",type:"number",min:"1",value:l.max_context_size,onChange:h=>r({...l,max_context_size:parseInt(h.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"planner_smooth",children:"่ง„ๅˆ’ๅ™จๅนณๆป‘"}),e.jsx(ae,{id:"planner_smooth",type:"number",step:"1",min:"0",value:l.planner_smooth,onChange:h=>r({...l,planner_smooth:parseFloat(h.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅขžๅคงๆ•ฐๅ€ผไผšๅ‡ๅฐ planner ่ดŸ่ท๏ผŒๆŽจ่ 1-5๏ผŒ0 ไธบๅ…ณ้—ญ"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"plan_reply_log_max_per_chat",children:"ๆฏไธช่Šๅคฉๆตๆœ€ๅคงๆ—ฅๅฟ—ๆ•ฐ้‡"}),e.jsx(ae,{id:"plan_reply_log_max_per_chat",type:"number",step:"1",min:"100",value:l.plan_reply_log_max_per_chat??1024,onChange:h=>r({...l,plan_reply_log_max_per_chat:parseInt(h.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆฏไธช่Šๅคฉๆตไฟๅญ˜็š„ Plan/Reply ๆ—ฅๅฟ—ๆœ€ๅคงๆ•ฐ้‡๏ผŒ่ถ…่ฟ‡ๆญคๆ•ฐ้‡ๆ—ถไผš่‡ชๅŠจๅˆ ้™คๆœ€่€็š„ๆ—ฅๅฟ—"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qe,{id:"llm_quote",checked:l.llm_quote??!1,onCheckedChange:h=>r({...l,llm_quote:h})}),e.jsx(T,{htmlFor:"llm_quote",className:"cursor-pointer",children:"ๅฏ็”จ LLM ๆŽงๅˆถๅผ•็”จ"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2 ml-10",children:"ๅฏ็”จๅŽ๏ผŒLLM ๅฏไปฅๅ†ณๅฎšๆ˜ฏๅฆๅœจๅ›žๅคๆ—ถๅผ•็”จๆถˆๆฏ"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qe,{id:"enable_talk_value_rules",checked:l.enable_talk_value_rules,onCheckedChange:h=>r({...l,enable_talk_value_rules:h})}),e.jsx(T,{htmlFor:"enable_talk_value_rules",className:"cursor-pointer",children:"ๅฏ็”จๅŠจๆ€ๅ‘่จ€้ข‘็އ่ง„ๅˆ™"})]})]})]}),l.enable_talk_value_rules&&e.jsxs("div",{className:"border-t pt-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-base font-semibold",children:"ๅŠจๆ€ๅ‘่จ€้ข‘็އ่ง„ๅˆ™"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"ๆŒ‰ๆ—ถๆฎตๆˆ–่ŠๅคฉๆตID่ฐƒๆ•ดๅ‘่จ€้ข‘็އ๏ผŒไผ˜ๅ…ˆๅŒน้…ๅ…ทไฝ“่Šๅคฉ๏ผŒๅ†ๅŒน้…ๅ…จๅฑ€่ง„ๅˆ™"})]}),e.jsxs(_,{onClick:c,size:"sm",children:[e.jsx(Xs,{className:"h-4 w-4 mr-1"}),"ๆทปๅŠ ่ง„ๅˆ™"]})]}),l.talk_value_rules&&l.talk_value_rules.length>0?e.jsx("div",{className:"space-y-4",children:l.talk_value_rules.map((h,f)=>e.jsxs("div",{className:"rounded-lg border p-4 bg-muted/50 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["่ง„ๅˆ™ #",f+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(tS,{rule:h}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{variant:"ghost",size:"sm",children:e.jsx(os,{className:"h-4 w-4 text-destructive"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsxs(gs,{children:["็กฎๅฎš่ฆๅˆ ้™ค่ง„ๅˆ™ #",f+1," ๅ—๏ผŸๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:()=>d(f),children:"ๅˆ ้™ค"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"้…็ฝฎ็ฑปๅž‹"}),e.jsxs(Pe,{value:h.target===""?"global":"specific",onValueChange:p=>{p==="global"?m(f,"target",""):m(f,"target","qq::group")},children:[e.jsx(Ie,{children:e.jsx(Fe,{})}),e.jsxs(Be,{children:[e.jsx(W,{value:"global",children:"ๅ…จๅฑ€้…็ฝฎ"}),e.jsx(W,{value:"specific",children:"่ฏฆ็ป†้…็ฝฎ"})]})]})]}),h.target!==""&&(()=>{const p=h.target.split(":"),g=p[0]||"qq",N=p[1]||"",j=p[2]||"group";return e.jsxs("div",{className:"grid gap-4 p-3 sm:p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"ๅนณๅฐ"}),e.jsxs(Pe,{value:g,onValueChange:b=>{m(f,"target",`${b}:${N}:${j}`)},children:[e.jsx(Ie,{children:e.jsx(Fe,{})}),e.jsxs(Be,{children:[e.jsx(W,{value:"qq",children:"QQ"}),e.jsx(W,{value:"wx",children:"ๅพฎไฟก"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"็พค ID"}),e.jsx(ae,{value:N,onChange:b=>{m(f,"target",`${g}:${b.target.value}:${j}`)},placeholder:"่พ“ๅ…ฅ็พค ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"็ฑปๅž‹"}),e.jsxs(Pe,{value:j,onValueChange:b=>{m(f,"target",`${g}:${N}:${b}`)},children:[e.jsx(Ie,{children:e.jsx(Fe,{})}),e.jsxs(Be,{children:[e.jsx(W,{value:"group",children:"็พค็ป„๏ผˆgroup๏ผ‰"}),e.jsx(W,{value:"private",children:"็ง่Š๏ผˆprivate๏ผ‰"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["ๅฝ“ๅ‰่Šๅคฉๆต ID๏ผš",h.target||"๏ผˆๆœช่ฎพ็ฝฎ๏ผ‰"]})]})})(),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"ๆ—ถ้—ดๆฎต (Time)"}),e.jsx(sS,{value:h.time,onChange:p=>m(f,"time",p)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆ”ฏๆŒ่ทจๅคœๅŒบ้—ด๏ผŒไพ‹ๅฆ‚ 23:00-02:00"})]}),e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{htmlFor:`rule-value-${f}`,className:"text-xs font-medium",children:"ๅ‘่จ€้ข‘็އๅ€ผ (Value)"}),e.jsx(ae,{id:`rule-value-${f}`,type:"number",step:"0.01",min:"0.01",max:"1",value:h.value,onChange:p=>{const g=parseFloat(p.target.value);isNaN(g)||m(f,"value",Math.max(.01,Math.min(1,g)))},className:"w-20 h-8 text-xs"})]}),e.jsx(el,{value:[h.value],onValueChange:p=>m(f,"value",p[0]),min:.01,max:1,step:.01,className:"w-full"}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"0.01 (ๆžๅฐ‘ๅ‘่จ€)"}),e.jsx("span",{children:"0.5"}),e.jsx("span",{children:"1.0 (ๆญฃๅธธ)"})]})]})]})]},f))}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:e.jsx("p",{className:"text-sm",children:'ๆš‚ๆ— ่ง„ๅˆ™๏ผŒ็‚นๅ‡ป"ๆทปๅŠ ่ง„ๅˆ™"ๆŒ‰้’ฎๅˆ›ๅปบ'})}),e.jsxs("div",{className:"mt-4 p-4 bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[e.jsx("h5",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"๐Ÿ“ ่ง„ๅˆ™่ฏดๆ˜Ž"}),e.jsxs("ul",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[e.jsxs("li",{children:["โ€ข ",e.jsx("strong",{children:"Target ไธบ็ฉบ"}),"๏ผšๅ…จๅฑ€่ง„ๅˆ™๏ผŒๅฏนๆ‰€ๆœ‰่Šๅคฉ็”Ÿๆ•ˆ"]}),e.jsxs("li",{children:["โ€ข ",e.jsx("strong",{children:"Target ๆŒ‡ๅฎš"}),"๏ผšไป…ๅฏน็‰นๅฎš่Šๅคฉๆต็”Ÿๆ•ˆ๏ผˆๆ ผๅผ๏ผšplatform:id:type๏ผ‰"]}),e.jsxs("li",{children:["โ€ข ",e.jsx("strong",{children:"ไผ˜ๅ…ˆ็บง"}),"๏ผšๅ…ˆๅŒน้…ๅ…ทไฝ“่Šๅคฉๆต่ง„ๅˆ™๏ผŒๅ†ๅŒน้…ๅ…จๅฑ€่ง„ๅˆ™"]}),e.jsxs("li",{children:["โ€ข ",e.jsx("strong",{children:"ๆ—ถ้—ดๆ”ฏๆŒ่ทจๅคœ"}),"๏ผšไพ‹ๅฆ‚ 23:00-02:00 ่กจ็คบๆ™šไธŠ11็‚นๅˆฐๆฌกๆ—ฅๅ‡Œๆ™จ2็‚น"]}),e.jsxs("li",{children:["โ€ข ",e.jsx("strong",{children:"ๆ•ฐๅ€ผ่Œƒๅ›ด"}),"๏ผšๅปบ่ฎฎ 0-1๏ผŒ0 ่กจ็คบๅฎŒๅ…จๆฒ‰้ป˜๏ผŒ1 ่กจ็คบๆญฃๅธธๅ‘่จ€"]})]})]})]})]})}),lS=Is.memo(function({config:l,onChange:r}){const c=S=>{if(!S||!S.includes(":"))return{platform:"qq",userId:""};const[F,E]=S.split(":");return{platform:F,userId:E}},{platform:d,userId:m}=c(l.dream_send),[h,f]=u.useState(d),[p,g]=u.useState(m),N=S=>{const[F,E]=S.split("-");return{startTime:F||"09:00",endTime:E||"22:00"}},j=(S,F)=>{const E=F?`${S}:${F}`:"";r({...l,dream_send:E})},b=S=>{f(S),j(S,p)},y=S=>{g(S),j(h,S)},w=()=>{r({...l,dream_time_ranges:[...l.dream_time_ranges,"09:00-22:00"]})},z=S=>{r({...l,dream_time_ranges:l.dream_time_ranges.filter((F,E)=>E!==S)})},M=(S,F,E)=>{const C=[...l.dream_time_ranges],R=N(C[S]);F==="startTime"?R.startTime=E:R.endTime=E,C[S]=`${R.startTime}-${R.endTime}`,r({...l,dream_time_ranges:C})};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"ๅšๆขฆ้…็ฝฎ"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"interval_minutes",children:"ๅšๆขฆๆ—ถ้—ด้—ด้š”๏ผˆๅˆ†้’Ÿ๏ผ‰"}),e.jsx(ae,{id:"interval_minutes",type:"number",min:"1",value:l.interval_minutes,onChange:S=>r({...l,interval_minutes:Number(S.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"้ป˜่ฎค30ๅˆ†้’Ÿ"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"max_iterations",children:"ๅšๆขฆๆœ€ๅคง่ฝฎๆฌก"}),e.jsx(ae,{id:"max_iterations",type:"number",min:"1",value:l.max_iterations,onChange:S=>r({...l,max_iterations:Number(S.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"้ป˜่ฎค20่ฝฎ"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"first_delay_seconds",children:"้ฆ–ๆฌกๅšๆขฆๅปถ่ฟŸ๏ผˆ็ง’๏ผ‰"}),e.jsx(ae,{id:"first_delay_seconds",type:"number",min:"0",value:l.first_delay_seconds,onChange:S=>r({...l,first_delay_seconds:Number(S.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"็จ‹ๅบๅฏๅŠจๅŽ้ฆ–ๆฌกๅšๆขฆๅ‰็š„ๅปถ่ฟŸๆ—ถ้—ด๏ผŒ้ป˜่ฎค60็ง’"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"ๅšๆขฆ็ป“ๆžœๆŽจ้€็›ฎๆ ‡"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(Pe,{value:h,onValueChange:b,children:[e.jsx(Ie,{className:"w-[120px]",children:e.jsx(Fe,{placeholder:"้€‰ๆ‹ฉๅนณๅฐ"})}),e.jsxs(Be,{children:[e.jsx(W,{value:"qq",children:"QQ"}),e.jsx(W,{value:"wx",children:"ๅพฎไฟก"}),e.jsx(W,{value:"webui",children:"WebUI"})]})]}),e.jsx(ae,{type:"text",placeholder:"่พ“ๅ…ฅ็”จๆˆทID (ไพ‹ๅฆ‚: 123456)",value:p,onChange:S=>y(S.target.value),className:"flex-1"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"้€‰ๆ‹ฉๅนณๅฐๅนถ่พ“ๅ…ฅ็”จๆˆทID๏ผŒๅšๆขฆ็ป“ๆŸๅŽๅฐ†ๆขฆๅขƒๅ‘้€็ป™่ฏฅ็”จๆˆทใ€‚็”จๆˆทIDไธบ็ฉบๅˆ™ไธๆŽจ้€"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"ๅšๆขฆๆ—ถ้—ดๆฎต้…็ฝฎ"}),e.jsx(_,{type:"button",size:"sm",onClick:w,children:"ๆทปๅŠ ๆ—ถ้—ดๆฎต"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"่ฎพ็ฝฎๅ…่ฎธๅšๆขฆ็š„ๆ—ถ้—ดๆฎต๏ผŒๆ”ฏๆŒ่ทจๅคœๅŒบ้—ด๏ผˆๅฆ‚ 23:00 ๅˆฐๆฌกๆ—ฅ 02:00๏ผ‰ใ€‚ๅˆ—่กจไธบ็ฉบๅˆ™ๅ…จๅคฉๅ…่ฎธๅšๆขฆ"}),e.jsxs("div",{className:"space-y-2",children:[l.dream_time_ranges.map((S,F)=>{const{startTime:E,endTime:C}=N(S);return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae,{type:"time",value:E,onChange:R=>M(F,"startTime",R.target.value),className:"w-[140px]"}),e.jsx("span",{className:"text-muted-foreground",children:"่‡ณ"}),e.jsx(ae,{type:"time",value:C,onChange:R=>M(F,"endTime",R.target.value),className:"w-[140px]"}),e.jsx(_,{type:"button",variant:"ghost",size:"icon",onClick:()=>z(F),children:e.jsx(Sa,{className:"h-4 w-4"})})]},F)}),l.dream_time_ranges.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 items-center space-x-2",children:[e.jsx(qe,{id:"dream_visible",checked:l.dream_visible,onCheckedChange:S=>r({...l,dream_visible:S})}),e.jsx(T,{htmlFor:"dream_visible",className:"cursor-pointer",children:"ๆขฆๅขƒ็ป“ๆžœๅญ˜ๅ‚จๅˆฐไธŠไธ‹ๆ–‡"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅผ€ๅฏๅŽ๏ผŒๆขฆๅขƒๅ‘้€็ป™้…็ฝฎ็š„็”จๆˆทๅŽ๏ผŒไนŸไผšๅญ˜ๅ‚จๅˆฐ่ŠๅคฉไธŠไธ‹ๆ–‡ไธญ๏ผŒๅœจๅŽ็ปญๅฏน่ฏไธญๅฏ่ง"})]})]})}),nS=Is.memo(function({config:l,onChange:r}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"LPMM ็Ÿฅ่ฏ†ๅบ“่ฎพ็ฝฎ"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qe,{checked:l.enable,onCheckedChange:c=>r({...l,enable:c})}),e.jsx(T,{className:"cursor-pointer",children:"ๅฏ็”จ LPMM ็Ÿฅ่ฏ†ๅบ“"})]}),l.enable&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"LPMM ๆจกๅผ"}),e.jsxs(Pe,{value:l.lpmm_mode,onValueChange:c=>r({...l,lpmm_mode:c}),children:[e.jsx(Ie,{children:e.jsx(Fe,{placeholder:"้€‰ๆ‹ฉ LPMM ๆจกๅผ"})}),e.jsxs(Be,{children:[e.jsx(W,{value:"classic",children:"็ปๅ…ธๆจกๅผ"}),e.jsx(W,{value:"agent",children:"Agent ๆจกๅผ"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"ๅŒไน‰่ฏๆœ็ดข TopK"}),e.jsx(ae,{type:"number",min:"1",value:l.rag_synonym_search_top_k,onChange:c=>r({...l,rag_synonym_search_top_k:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"ๅŒไน‰่ฏ้˜ˆๅ€ผ"}),e.jsx(ae,{type:"number",step:"0.1",min:"0",max:"1",value:l.rag_synonym_threshold,onChange:c=>r({...l,rag_synonym_threshold:parseFloat(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"ๅฎžไฝ“ๆๅ–็บฟ็จ‹ๆ•ฐ"}),e.jsx(ae,{type:"number",min:"1",value:l.info_extraction_workers,onChange:c=>r({...l,info_extraction_workers:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"ๅตŒๅ…ฅๅ‘้‡็ปดๅบฆ"}),e.jsx(ae,{type:"number",min:"1",value:l.embedding_dimension,onChange:c=>r({...l,embedding_dimension:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"ๅตŒๅ…ฅๅนถๅ‘็บฟ็จ‹ๆ•ฐ"}),e.jsx(ae,{type:"number",min:"1",value:l.max_embedding_workers,onChange:c=>r({...l,max_embedding_workers:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"ๆฏๆ‰นๅตŒๅ…ฅๆกๆ•ฐ"}),e.jsx(ae,{type:"number",min:"1",value:l.embedding_chunk_size,onChange:c=>r({...l,embedding_chunk_size:parseInt(c.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"ๅŒไน‰ๅฎžไฝ“ๆ•ฐไธŠ้™"}),e.jsx(ae,{type:"number",min:"1",value:l.max_synonym_entities,onChange:c=>r({...l,max_synonym_entities:parseInt(c.target.value)})})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qe,{checked:l.enable_ppr,onCheckedChange:c=>r({...l,enable_ppr:c})}),e.jsx(T,{className:"cursor-pointer",children:"ๅฏ็”จ PPR (ไฝŽ้…ๆœบๅ™จๅฏๅ…ณ้—ญ)"})]})]})]})]})}),rS=Is.memo(function({config:l,onChange:r}){const[c,d]=u.useState(""),[m,h]=u.useState("WARNING"),f=()=>{c&&!l.suppress_libraries.includes(c)&&(r({...l,suppress_libraries:[...l.suppress_libraries,c]}),d(""))},p=w=>{r({...l,suppress_libraries:l.suppress_libraries.filter(z=>z!==w)})},g=()=>{c&&!l.library_log_levels[c]&&(r({...l,library_log_levels:{...l.library_log_levels,[c]:m}}),d(""),h("WARNING"))},N=w=>{const z={...l.library_log_levels};delete z[w],r({...l,library_log_levels:z})},j=["DEBUG","INFO","WARNING","ERROR","CRITICAL"],b=["FULL","compact","lite"],y=["none","title","full"];return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"ๆ—ฅๅฟ—้…็ฝฎ"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"ๆ—ฅๆœŸๆ ผๅผ"}),e.jsx(ae,{value:l.date_style,onChange:w=>r({...l,date_style:w.target.value}),placeholder:"ไพ‹ๅฆ‚: m-d H:i:s"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"m=ๆœˆ, d=ๆ—ฅ, H=ๆ—ถ, i=ๅˆ†, s=็ง’"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"ๆ—ฅๅฟ—็บงๅˆซๆ ทๅผ"}),e.jsxs(Pe,{value:l.log_level_style,onValueChange:w=>r({...l,log_level_style:w}),children:[e.jsx(Ie,{children:e.jsx(Fe,{})}),e.jsx(Be,{children:b.map(w=>e.jsx(W,{value:w,children:w},w))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"ๆ—ฅๅฟ—ๆ–‡ๆœฌ้ขœ่‰ฒ"}),e.jsxs(Pe,{value:l.color_text,onValueChange:w=>r({...l,color_text:w}),children:[e.jsx(Ie,{children:e.jsx(Fe,{})}),e.jsx(Be,{children:y.map(w=>e.jsx(W,{value:w,children:w},w))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"ๅ…จๅฑ€ๆ—ฅๅฟ—็บงๅˆซ"}),e.jsxs(Pe,{value:l.log_level,onValueChange:w=>r({...l,log_level:w}),children:[e.jsx(Ie,{children:e.jsx(Fe,{})}),e.jsx(Be,{children:j.map(w=>e.jsx(W,{value:w,children:w},w))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"ๆŽงๅˆถๅฐๆ—ฅๅฟ—็บงๅˆซ"}),e.jsxs(Pe,{value:l.console_log_level,onValueChange:w=>r({...l,console_log_level:w}),children:[e.jsx(Ie,{children:e.jsx(Fe,{})}),e.jsx(Be,{children:j.map(w=>e.jsx(W,{value:w,children:w},w))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"ๆ–‡ไปถๆ—ฅๅฟ—็บงๅˆซ"}),e.jsxs(Pe,{value:l.file_log_level,onValueChange:w=>r({...l,file_log_level:w}),children:[e.jsx(Ie,{children:e.jsx(Fe,{})}),e.jsx(Be,{children:j.map(w=>e.jsx(W,{value:w,children:w},w))})]})]})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"mb-2 block",children:"ๅฎŒๅ…จๅฑ่”ฝ็š„ๅบ“"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(ae,{value:c,onChange:w=>d(w.target.value),placeholder:"่พ“ๅ…ฅๅบ“ๅ",className:"flex-1",onKeyDown:w=>{w.key==="Enter"&&(w.preventDefault(),f())}}),e.jsx(_,{onClick:f,size:"sm",className:"flex-shrink-0",children:e.jsx(Xs,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:l.suppress_libraries.map(w=>e.jsxs("div",{className:"flex items-center gap-1 bg-secondary px-3 py-1 rounded-md",children:[e.jsx("span",{className:"text-sm",children:w}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onClick:()=>p(w),children:e.jsx(os,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},w))})]}),e.jsxs("div",{children:[e.jsx(T,{className:"mb-2 block",children:"็‰นๅฎšๅบ“็š„ๆ—ฅๅฟ—็บงๅˆซ"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(ae,{value:c,onChange:w=>d(w.target.value),placeholder:"่พ“ๅ…ฅๅบ“ๅ",className:"flex-1"}),e.jsxs(Pe,{value:m,onValueChange:h,children:[e.jsx(Ie,{className:"w-32",children:e.jsx(Fe,{})}),e.jsx(Be,{children:j.map(w=>e.jsx(W,{value:w,children:w},w))})]}),e.jsx(_,{onClick:g,size:"sm",children:e.jsx(Xs,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"space-y-2",children:Object.entries(l.library_log_levels).map(([w,z])=>e.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[e.jsx("span",{className:"text-sm font-medium",children:w}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:z}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>N(w),children:e.jsx(os,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]})]},w))})]})]})}),iS=Is.memo(function({config:l,onChange:r}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"่ฐƒ่ฏ•้…็ฝฎ"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"ๆ˜พ็คบ Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๆ˜ฏๅฆๅœจๆ—ฅๅฟ—ไธญๆ˜พ็คบๆ็คบ่ฏ"})]}),e.jsx(qe,{checked:l.show_prompt,onCheckedChange:c=>r({...l,show_prompt:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"ๆ˜พ็คบๅ›žๅคๅ™จ Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๆ˜ฏๅฆๆ˜พ็คบๅ›žๅคๅ™จ็š„ๆ็คบ่ฏ"})]}),e.jsx(qe,{checked:l.show_replyer_prompt,onCheckedChange:c=>r({...l,show_replyer_prompt:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"ๆ˜พ็คบๅ›žๅคๅ™จๆŽจ็†"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๆ˜ฏๅฆๆ˜พ็คบๅ›žๅคๅ™จ็š„ๆŽจ็†่ฟ‡็จ‹"})]}),e.jsx(qe,{checked:l.show_replyer_reasoning,onCheckedChange:c=>r({...l,show_replyer_reasoning:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"ๆ˜พ็คบ Jargon Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๆ˜ฏๅฆๆ˜พ็คบๆœฏ่ฏญ็›ธๅ…ณ็š„ๆ็คบ่ฏ"})]}),e.jsx(qe,{checked:l.show_jargon_prompt,onCheckedChange:c=>r({...l,show_jargon_prompt:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"ๆ˜พ็คบ่ฎฐๅฟ†ๆฃ€็ดข Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๆ˜ฏๅฆๆ˜พ็คบ่ฎฐๅฟ†ๆฃ€็ดข็›ธๅ…ณ็š„ๆ็คบ่ฏ"})]}),e.jsx(qe,{checked:l.show_memory_prompt,onCheckedChange:c=>r({...l,show_memory_prompt:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"ๆ˜พ็คบ Planner Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๆ˜ฏๅฆๆ˜พ็คบ Planner ็š„ๆ็คบ่ฏๅ’ŒๅŽŸๅง‹่ฟ”ๅ›ž็ป“ๆžœ"})]}),e.jsx(qe,{checked:l.show_planner_prompt,onCheckedChange:c=>r({...l,show_planner_prompt:c})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"ๆ˜พ็คบ LPMM ็›ธๅ…ณๆ–‡ๆฎต"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๆ˜ฏๅฆๆ˜พ็คบ LPMM ็Ÿฅ่ฏ†ๅบ“ๆ‰พๅˆฐ็š„็›ธๅ…ณๆ–‡ๆฎตๆ—ฅๅฟ—"})]}),e.jsx(qe,{checked:l.show_lpmm_paragraph,onCheckedChange:c=>r({...l,show_lpmm_paragraph:c})})]})]})]})}),cS=Is.memo(function({config:l,onChange:r}){const c=g=>{const N=g.split(":");if(N.length>=4){const j=N[0],b=N[1],y=N[2],w=N.slice(3).join(":");return{platform:j,id:b,type:y,prompt:w}}return{platform:"qq",id:"",type:"group",prompt:""}},d=g=>`${g.platform}:${g.id}:${g.type}:${g.prompt}`,m=()=>{r({...l,chat_prompts:[...l.chat_prompts,"qq::group:"]})},h=g=>{r({...l,chat_prompts:l.chat_prompts.filter((N,j)=>j!==g)})},f=(g,N)=>{const b={...c(l.chat_prompts[g]),...N},y=[...l.chat_prompts];y[g]=d(b),r({...l,chat_prompts:y})},p=({promptStr:g})=>e.jsxs(cl,{children:[e.jsx(ol,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(ua,{className:"h-4 w-4 mr-1"}),"้ข„่งˆ"]})}),e.jsx(tl,{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.jsxs("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:['"',g,'"']}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"่ฟ™ๆ˜ฏไฟๅญ˜ๅˆฐ bot_config.toml ๆ–‡ไปถไธญ็š„ๆ ผๅผ"})]})})]});return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg bg-orange-500/10 border border-orange-500/20",children:[e.jsx(Lt,{className:"h-5 w-5 text-orange-500 shrink-0 mt-0.5"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("h4",{className:"font-medium text-orange-500",children:"ๅฎž้ชŒๆ€งๅŠŸ่ƒฝ"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๆญค้ƒจๅˆ†ๅŒ…ๅซๅฎž้ชŒๆ€งๅŠŸ่ƒฝ๏ผŒๅฏ่ƒฝไธ็จณๅฎšๆˆ–ๅœจๆœชๆฅ็‰ˆๆœฌไธญๅ‘็”Ÿๅ˜ๅŒ–ใ€‚่ฏท่ฐจๆ…Žไฝฟ็”จ๏ผŒๅนถๆณจๆ„ไธๆŽจ่ๅœจ็”Ÿไบง็Žฏๅขƒไธญไฟฎๆ”น็ง่Š่ง„ๅˆ™ใ€‚"})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"ๅฎž้ชŒๆ€ง่ฎพ็ฝฎ"}),e.jsxs("div",{className:"grid gap-6",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qe,{id:"lpmm_memory",checked:l.lpmm_memory??!1,onCheckedChange:g=>r({...l,lpmm_memory:g})}),e.jsx(T,{htmlFor:"lpmm_memory",className:"cursor-pointer",children:"ๅฐ†่Šๅคฉๅކๅฒๆ€ป็ป“ๅฏผๅ…ฅๅˆฐ LPMM ็Ÿฅ่ฏ†ๅบ“"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-4",children:"ๅผ€ๅฏๅŽ๏ผŒchat_history_summarizer ๆ€ป็ป“ๅ‡บ็š„ๅކๅฒ่ฎฐๅฝ•ไผšๅŒๆ—ถๅฏผๅ…ฅๅˆฐ็Ÿฅ่ฏ†ๅบ“"}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"private_plan_style",children:"็ง่Š่ง„ๅˆ™๏ผˆๅฎž้ชŒๆ€ง๏ผ‰"}),e.jsx(pt,{id:"private_plan_style",value:l.private_plan_style,onChange:g=>r({...l,private_plan_style:g.target.value}),placeholder:"็ง่Š็š„่ฏด่ฏ่ง„ๅˆ™ๅ’Œ่กŒไธบ้ฃŽๆ ผ๏ผˆไธๆŽจ่ไฟฎๆ”น๏ผ‰",rows:4}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"โš ๏ธ ไธๆŽจ่ไฟฎๆ”นๆญค้กน๏ผŒๅฏ่ƒฝไผšๅฝฑๅ“็ง่Šๅฏน่ฏ็š„็จณๅฎšๆ€ง"})]}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(T,{children:"็‰นๅฎš่Šๅคฉ Prompt ้…็ฝฎ"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"ไธบๆŒ‡ๅฎš่ŠๅคฉๆทปๅŠ ้ขๅค–็š„ prompt๏ผŒ็”จไบŽๅฎšๅˆถ็‰นๅฎšๅœบๆ™ฏ็š„ๅฏน่ฏ่กŒไธบ"})]}),e.jsxs(_,{onClick:m,size:"sm",variant:"outline",children:[e.jsx(Xs,{className:"h-4 w-4 mr-1"}),"ๆทปๅŠ ้…็ฝฎ"]})]}),e.jsxs("div",{className:"space-y-4",children:[l.chat_prompts.map((g,N)=>{const j=c(g);return e.jsxs("div",{className:"rounded-lg border p-4 space-y-4 bg-card",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["Prompt ้…็ฝฎ ",N+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(p,{promptStr:g}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"sm",variant:"ghost",children:e.jsx(os,{className:"h-4 w-4"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsx(gs,{children:"็กฎๅฎš่ฆๅˆ ้™ค่ฟ™ไธช prompt ้…็ฝฎๅ—๏ผŸๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚"})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:()=>h(N),children:"ๅˆ ้™ค"})]})]})]})]})]}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"ๅนณๅฐ"}),e.jsxs(Pe,{value:j.platform,onValueChange:b=>f(N,{platform:b}),children:[e.jsx(Ie,{children:e.jsx(Fe,{placeholder:"้€‰ๆ‹ฉๅนณๅฐ"})}),e.jsxs(Be,{children:[e.jsx(W,{value:"qq",children:"QQ"}),e.jsx(W,{value:"wx",children:"ๅพฎไฟก"}),e.jsx(W,{value:"webui",children:"WebUI"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:j.type==="group"?"็พคๅท":"็”จๆˆทID"}),e.jsx(ae,{value:j.id,onChange:b=>f(N,{id:b.target.value}),placeholder:j.type==="group"?"่พ“ๅ…ฅ็พคๅท":"่พ“ๅ…ฅ็”จๆˆทID",className:"font-mono"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"็ฑปๅž‹"}),e.jsxs(Pe,{value:j.type,onValueChange:b=>f(N,{type:b}),children:[e.jsx(Ie,{children:e.jsx(Fe,{})}),e.jsxs(Be,{children:[e.jsx(W,{value:"group",children:"็พค่Š (group)"}),e.jsx(W,{value:"private",children:"็ง่Š (private)"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"Prompt ๅ†…ๅฎน"}),e.jsx(pt,{value:j.prompt,onChange:b=>f(N,{prompt:b.target.value}),placeholder:"่พ“ๅ…ฅ้ขๅค–็š„ prompt ๅ†…ๅฎน๏ผŒไพ‹ๅฆ‚๏ผš่ฟ™ๆ˜ฏไธ€ไธชๆ‘„ๅฝฑ็พค๏ผŒไฝ ็ฒพ้€šๆ‘„ๅฝฑ็Ÿฅ่ฏ†",rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"่ฟ™ๆฎตๆ–‡ๆœฌไผšไฝœไธบ็ณป็ปŸๆ็คบๆทปๅŠ ๅˆฐ่ฏฅ่Šๅคฉ็š„ไธŠไธ‹ๆ–‡ไธญ"})]}),e.jsxs("div",{className:"rounded-md bg-muted/50 p-3",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(dx,{className:"h-3 w-3 text-muted-foreground"}),e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"ๅŽŸๅง‹ๆ ผๅผ"})]}),e.jsx("code",{className:"text-xs font-mono text-muted-foreground break-all",children:g||"(ๆœช้…็ฝฎ)"})]})]})]},N)}),l.chat_prompts.length===0&&e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx("p",{className:"text-sm",children:"ๆš‚ๆ— ็‰นๅฎš่Šๅคฉ prompt ้…็ฝฎ"}),e.jsx("p",{className:"text-xs mt-1",children:'็‚นๅ‡ปไธŠๆ–น"ๆทปๅŠ ้…็ฝฎ"ๆŒ‰้’ฎๅˆ›ๅปบๆ–ฐ้…็ฝฎ'})]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground space-y-2 p-4 rounded-lg bg-muted/30 border",children:[e.jsx("p",{className:"font-medium text-foreground",children:"๐Ÿ’ก ไฝฟ็”จ่ฏดๆ˜Ž"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 pl-2",children:[e.jsx("li",{children:"ไธบไธๅŒ็š„่Šๅคฉ็Žฏๅขƒ้…็ฝฎไธ“ๅฑž็š„่กŒไธบๆ็คบ"}),e.jsx("li",{children:"ๆ”ฏๆŒๅคšไธชๅนณๅฐ๏ผšQQใ€ๅพฎไฟกใ€WebUI"}),e.jsx("li",{children:"ๅฏไธบ็พค่Šๆˆ–็ง่Šๅˆ†ๅˆซ้…็ฝฎ"}),e.jsx("li",{children:"Prompt ไผš่‡ชๅŠจๆณจๅ…ฅๅˆฐ่ฏฅ่Šๅคฉ็š„ไธŠไธ‹ๆ–‡ไธญ"})]}),e.jsx("p",{className:"font-medium text-foreground mt-3",children:"๐Ÿ“ ้…็ฝฎ็คบไพ‹"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 pl-2",children:[e.jsxs("li",{children:["ๆ‘„ๅฝฑ็พค๏ผš",e.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:"่ฟ™ๆ˜ฏไธ€ไธชๆ‘„ๅฝฑ็พค๏ผŒไฝ ็ฒพ้€šๆ‘„ๅฝฑ็Ÿฅ่ฏ†"})]}),e.jsxs("li",{children:["ไบŒๆฌกๅ…ƒ็พค๏ผš",e.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:"่ฟ™ๆ˜ฏไธ€ไธชไบŒๆฌกๅ…ƒไบคๆต็พค"})]}),e.jsxs("li",{children:["ๅฅฝๅ‹็ง่Š๏ผš",e.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:"่ฟ™ๆ˜ฏไฝ ไธŽๅฅฝๆœ‹ๅ‹็š„็ง่Š"})]})]})]})]})]})]})]})}),oS=Is.memo(function({config:l,onChange:r}){const[c,d]=u.useState(""),[m,h]=u.useState(""),f=()=>{c&&!l.auth_token.includes(c)&&(r({...l,auth_token:[...l.auth_token,c]}),d(""))},p=j=>{r({...l,auth_token:l.auth_token.filter((b,y)=>y!==j)})},g=()=>{m&&!l.api_server_allowed_api_keys.includes(m)&&(r({...l,api_server_allowed_api_keys:[...l.api_server_allowed_api_keys,m]}),h(""))},N=j=>{r({...l,api_server_allowed_api_keys:l.api_server_allowed_api_keys.filter((b,y)=>y!==j)})};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"ๆ—ง็‰ˆ API ่ฎค่ฏไปค็‰Œ"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"็”จไบŽๆ—ง็‰ˆ API ้ชŒ่ฏ๏ผŒไธบ็ฉบๅˆ™ไธๅฏ็”จ้ชŒ่ฏ"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(ae,{value:c,onChange:j=>d(j.target.value),placeholder:"่พ“ๅ…ฅ่ฎค่ฏไปค็‰Œ",onKeyDown:j=>{j.key==="Enter"&&(j.preventDefault(),f())}}),e.jsx(_,{onClick:f,size:"sm",children:e.jsx(Xs,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"space-y-2",children:l.auth_token.map((j,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:j}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>p(b),children:e.jsx(os,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},b))})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"ๆ–ฐ็‰ˆ API Server ้…็ฝฎ"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"ๅฏ็”จๆ–ฐ็‰ˆ API Server"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๆ˜ฏๅฆๅฏ็”จ้ขๅค–็š„ๆ–ฐ็‰ˆ API Server๏ผˆ้ขๅค–็›‘ๅฌ็ซฏๅฃ๏ผ‰"})]}),e.jsx(qe,{checked:l.enable_api_server,onCheckedChange:j=>r({...l,enable_api_server:j})})]}),l.enable_api_server&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"ไธปๆœบๅœฐๅ€"}),e.jsx(ae,{value:l.api_server_host,onChange:j=>r({...l,api_server_host:j.target.value}),placeholder:"0.0.0.0"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"็ซฏๅฃๅท"}),e.jsx(ae,{type:"number",value:l.api_server_port,onChange:j=>r({...l,api_server_port:parseInt(j.target.value)}),placeholder:"8090"})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qe,{checked:l.api_server_use_wss,onCheckedChange:j=>r({...l,api_server_use_wss:j})}),e.jsx(T,{children:"ๅฏ็”จ WSS ๅฎ‰ๅ…จ่ฟžๆŽฅ"})]}),l.api_server_use_wss&&e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"SSL ่ฏไนฆๆ–‡ไปถ่ทฏๅพ„"}),e.jsx(ae,{value:l.api_server_cert_file,onChange:j=>r({...l,api_server_cert_file:j.target.value}),placeholder:"cert.pem"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"SSL ๅฏ†้’ฅๆ–‡ไปถ่ทฏๅพ„"}),e.jsx(ae,{value:l.api_server_key_file,onChange:j=>r({...l,api_server_key_file:j.target.value}),placeholder:"key.pem"})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"mb-2 block",children:"ๅ…่ฎธ็š„ API Key ๅˆ—่กจ"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"ไธบ็ฉบๅˆ™ๅ…่ฎธๆ‰€ๆœ‰่ฟžๆŽฅ"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(ae,{value:m,onChange:j=>h(j.target.value),placeholder:"่พ“ๅ…ฅ API Key",onKeyDown:j=>{j.key==="Enter"&&(j.preventDefault(),g())}}),e.jsx(_,{onClick:g,size:"sm",children:e.jsx(Xs,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"space-y-2",children:l.api_server_allowed_api_keys.map((j,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:j}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>N(b),children:e.jsx(os,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},b))})]})]})]})]})]})}),dS=Is.memo(function({config:l,onChange:r}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"็ปŸ่ฎกไฟกๆฏ"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:"ๅฏ็”จ็ปŸ่ฎกไฟกๆฏๅ‘้€"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๅ‘้€ๅŒฟๅ็ปŸ่ฎกไฟกๆฏ๏ผŒๅธฎๅŠฉๆˆ‘ไปฌไบ†่งฃๅ…จ็ƒๆœ‰ๅคšๅฐ‘ๅช้บฆ้บฆๅœจ่ฟ่กŒ"})]}),e.jsx(qe,{checked:l.enable,onCheckedChange:c=>r({...l,enable:c})})]})]})}),uS=Is.memo(function({emojiConfig:l,memoryConfig:r,toolConfig:c,voiceConfig:d,onEmojiChange:m,onMemoryChange:h,onToolChange:f,onVoiceChange:p}){return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"ๅทฅๅ…ท่ฎพ็ฝฎ"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qe,{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(qe,{id:"enable_asr",checked:d.enable_asr,onCheckedChange:g=>p({...d,enable_asr:g})}),e.jsx(T,{htmlFor:"enable_asr",className:"cursor-pointer",children:"ๅฏ็”จ่ฏญ้Ÿณ่ฏ†ๅˆซ"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"ๅฏ็”จๅŽ้บฆ้บฆๅฏไปฅ่ฏ†ๅˆซ่ฏญ้Ÿณๆถˆๆฏ๏ผŒ้œ€่ฆ้…็ฝฎ่ฏญ้Ÿณ่ฏ†ๅˆซๆจกๅž‹"})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"่ฎฐๅฟ†่ฎพ็ฝฎ"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"max_agent_iterations",children:"่ฎฐๅฟ†ๆ€่€ƒๆทฑๅบฆ"}),e.jsx(ae,{id:"max_agent_iterations",type:"number",min:"1",value:r.max_agent_iterations,onChange:g=>h({...r,max_agent_iterations:parseInt(g.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆœ€ไฝŽไธบ 1๏ผˆไธๆทฑๅ…ฅๆ€่€ƒ๏ผ‰"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"agent_timeout_seconds",children:"ๆœ€้•ฟๅ›žๅฟ†ๆ—ถ้—ด๏ผˆ็ง’๏ผ‰"}),e.jsx(ae,{id:"agent_timeout_seconds",type:"number",min:"1",step:"0.1",value:r.agent_timeout_seconds??120,onChange:g=>h({...r,agent_timeout_seconds:parseFloat(g.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"่ฎฐๅฟ†ๆฃ€็ดข็š„่ถ…ๆ—ถๆ—ถ้—ด๏ผŒ้ฟๅ…่ฟ‡้•ฟ็š„็ญ‰ๅพ…"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qe,{id:"enable_jargon_detection",checked:r.enable_jargon_detection??!0,onCheckedChange:g=>h({...r,enable_jargon_detection:g})}),e.jsx(T,{htmlFor:"enable_jargon_detection",className:"cursor-pointer",children:"ๅฏ็”จ้ป‘่ฏ่ฏ†ๅˆซ"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"่ฎฐๅฟ†ๆฃ€็ดข่ฟ‡็จ‹ไธญๆ˜ฏๅฆๅฏ็”จ้ป‘่ฏ่ฏ†ๅˆซ"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qe,{id:"global_memory",checked:r.global_memory??!1,onCheckedChange:g=>h({...r,global_memory:g})}),e.jsx(T,{htmlFor:"global_memory",className:"cursor-pointer",children:"ๅ…จๅฑ€่ฎฐๅฟ†ๆŸฅ่ฏข"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"ๅ…่ฎธ่ฎฐๅฟ†ๆฃ€็ดขๅœจๆ‰€ๆœ‰่Šๅคฉ่ฎฐๅฝ•ไธญ่ฟ›่กŒๅ…จๅฑ€ๆŸฅ่ฏข๏ผˆๅฟฝ็•ฅๅฝ“ๅ‰่Šๅคฉๆต๏ผ‰"}),e.jsxs("div",{className:"border-t pt-4 mt-4",children:[e.jsx("h4",{className:"text-sm font-semibold mb-3",children:"่Šๅคฉๅކๅฒๆ€ป็ป“้…็ฝฎ"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"chat_history_topic_check_message_threshold",children:"่ฏ้ข˜ๆฃ€ๆŸฅๆถˆๆฏๆ•ฐ้˜ˆๅ€ผ"}),e.jsx(ae,{id:"chat_history_topic_check_message_threshold",type:"number",min:"1",value:r.chat_history_topic_check_message_threshold??80,onChange:g=>h({...r,chat_history_topic_check_message_threshold: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:"chat_history_topic_check_time_hours",children:"่ฏ้ข˜ๆฃ€ๆŸฅๆ—ถ้—ด้˜ˆๅ€ผ๏ผˆๅฐๆ—ถ๏ผ‰"}),e.jsx(ae,{id:"chat_history_topic_check_time_hours",type:"number",min:"0.1",step:"0.1",value:r.chat_history_topic_check_time_hours??8,onChange:g=>h({...r,chat_history_topic_check_time_hours:parseFloat(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:"chat_history_topic_check_min_messages",children:"ๆ—ถ้—ด่งฆๅ‘ๆœ€ๅฐๆถˆๆฏๆ•ฐ"}),e.jsx(ae,{id:"chat_history_topic_check_min_messages",type:"number",min:"1",value:r.chat_history_topic_check_min_messages??20,onChange:g=>h({...r,chat_history_topic_check_min_messages: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:"chat_history_finalize_no_update_checks",children:"ๆ‰“ๅŒ…ๅญ˜ๅ‚จ่ฟž็ปญๆ— ๆ›ดๆ–ฐๆฌกๆ•ฐ"}),e.jsx(ae,{id:"chat_history_finalize_no_update_checks",type:"number",min:"1",value:r.chat_history_finalize_no_update_checks??3,onChange:g=>h({...r,chat_history_finalize_no_update_checks:parseInt(g.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅฝ“่ฏ้ข˜่ฟž็ปญNๆฌกๆฃ€ๆŸฅๆ— ๆ–ฐๅขžๅ†…ๅฎนๆ—ถ่งฆๅ‘ๆ‰“ๅŒ…ๅญ˜ๅ‚จ"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"chat_history_finalize_message_count",children:"ๆ‰“ๅŒ…ๅญ˜ๅ‚จๆถˆๆฏๆกๆ•ฐ้˜ˆๅ€ผ"}),e.jsx(ae,{id:"chat_history_finalize_message_count",type:"number",min:"1",value:r.chat_history_finalize_message_count??5,onChange:g=>h({...r,chat_history_finalize_message_count:parseInt(g.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅฝ“่ฏ้ข˜็š„ๆถˆๆฏๆกๆ•ฐ่ถ…่ฟ‡ๆญคๅ€ผๆ—ถ่งฆๅ‘ๆ‰“ๅŒ…ๅญ˜ๅ‚จ"})]})]})]})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"่กจๆƒ…ๅŒ…่ฎพ็ฝฎ"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"emoji_chance",children:"่กจๆƒ…ๅŒ…ๆฟ€ๆดปๆฆ‚็އ"}),e.jsx(ae,{id:"emoji_chance",type:"number",step:"0.1",min:"0",max:"1",value:l.emoji_chance,onChange:g=>m({...l,emoji_chance:parseFloat(g.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"่Œƒๅ›ด 0-1๏ผŒ่ถŠๅคง่ถŠๅฎนๆ˜“ๅ‘้€่กจๆƒ…ๅŒ…"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"max_reg_num",children:"ๆœ€ๅคงๆณจๅ†Œๆ•ฐ้‡"}),e.jsx(ae,{id:"max_reg_num",type:"number",min:"1",value:l.max_reg_num,onChange:g=>m({...l,max_reg_num:parseInt(g.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"้บฆ้บฆๆœ€ๅคšๅฏไปฅๆณจๅ†Œ็š„่กจๆƒ…ๅŒ…ๆ•ฐ้‡"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"check_interval",children:"ๆฃ€ๆŸฅ้—ด้š”๏ผˆๅˆ†้’Ÿ๏ผ‰"}),e.jsx(ae,{id:"check_interval",type:"number",min:"1",value:l.check_interval,onChange:g=>m({...l,check_interval:parseInt(g.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆฃ€ๆŸฅ่กจๆƒ…ๅŒ…๏ผˆๆณจๅ†Œใ€็ ดๆŸใ€ๅˆ ้™ค๏ผ‰็š„ๆ—ถ้—ด้—ด้š”"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qe,{id:"do_replace",checked:l.do_replace,onCheckedChange:g=>m({...l,do_replace:g})}),e.jsx(T,{htmlFor:"do_replace",className:"cursor-pointer",children:"่พพๅˆฐๆœ€ๅคงๆ•ฐ้‡ๆ—ถๆ›ฟๆข่กจๆƒ…ๅŒ…"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qe,{id:"steal_emoji",checked:l.steal_emoji,onCheckedChange:g=>m({...l,steal_emoji:g})}),e.jsx(T,{htmlFor:"steal_emoji",className:"cursor-pointer",children:"ๅทๅ–่กจๆƒ…ๅŒ…"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"ๅ…่ฎธ้บฆ้บฆๅฐ†็œ‹ๅˆฐ็š„่กจๆƒ…ๅŒ…ๆฎไธบๅทฑๆœ‰"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qe,{id:"content_filtration",checked:l.content_filtration,onCheckedChange:g=>m({...l,content_filtration:g})}),e.jsx(T,{htmlFor:"content_filtration",className:"cursor-pointer",children:"ๅฏ็”จ่กจๆƒ…ๅŒ…่ฟ‡ๆปค"})]}),l.content_filtration&&e.jsxs("div",{className:"grid gap-2 pl-6 border-l-2 border-primary/20",children:[e.jsx(T,{htmlFor:"filtration_prompt",children:"่ฟ‡ๆปค่ฆๆฑ‚"}),e.jsx(ae,{id:"filtration_prompt",value:l.filtration_prompt,onChange:g=>m({...l,filtration_prompt:g.target.value}),placeholder:"็ฌฆๅˆๅ…ฌๅบ่‰ฏไฟ—"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅชๆœ‰็ฌฆๅˆๆญค่ฆๆฑ‚็š„่กจๆƒ…ๅŒ…ๆ‰ไผš่ขซไฟๅญ˜"})]})]})]})})]})}),mS=Is.memo(function({member:l,groupIndex:r,memberIndex:c,availableChatIds:d,onUpdate:m,onRemove:h}){const f=d.includes(l)||l==="*",[p,g]=u.useState(!f);return e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:"flex-1 flex gap-2",children:p?e.jsxs(e.Fragment,{children:[e.jsx(ae,{value:l,onChange:N=>m(r,c,N.target.value),placeholder:'่พ“ๅ…ฅ "*" ๆˆ– "qq:123456:group"',className:"flex-1"}),d.length>0&&e.jsx(_,{size:"sm",variant:"outline",onClick:()=>g(!1),title:"ๅˆ‡ๆขๅˆฐไธ‹ๆ‹‰้€‰ๆ‹ฉ",children:"ไธ‹ๆ‹‰"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(Pe,{value:l,onValueChange:N=>m(r,c,N),children:[e.jsx(Ie,{className:"flex-1",children:e.jsx(Fe,{placeholder:"้€‰ๆ‹ฉ่Šๅคฉๆต"})}),e.jsxs(Be,{children:[e.jsx(W,{value:"*",children:"* (ๅ…จๅฑ€ๅ…ฑไบซ)"}),d.map((N,j)=>e.jsx(W,{value:N,children:N},j))]})]}),e.jsx(_,{size:"sm",variant:"outline",onClick:()=>g(!0),title:"ๅˆ‡ๆขๅˆฐๆ‰‹ๅŠจ่พ“ๅ…ฅ",children:"่พ“ๅ…ฅ"})]})}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(os,{className:"h-4 w-4"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsxs(gs,{children:['็กฎๅฎš่ฆๅˆ ้™ค็ป„ๆˆๅ‘˜ "',l||"(็ฉบ)",'" ๅ—๏ผŸๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚']})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:()=>h(r,c),children:"ๅˆ ้™ค"})]})]})]})]})}),xS=Is.memo(function({config:l,onChange:r}){const c=()=>{r({...l,learning_list:[...l.learning_list,["","enable","enable","1.0"]]})},d=b=>{r({...l,learning_list:l.learning_list.filter((y,w)=>w!==b)})},m=(b,y,w)=>{const z=[...l.learning_list];z[b][y]=w,r({...l,learning_list:z})},h=({rule:b})=>{const y=`["${b[0]}", "${b[1]}", "${b[2]}", "${b[3]}"]`;return e.jsxs(cl,{children:[e.jsx(ol,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(ua,{className:"h-4 w-4 mr-1"}),"้ข„่งˆ"]})}),e.jsx(tl,{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:y}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"่ฟ™ๆ˜ฏไฟๅญ˜ๅˆฐ bot_config.toml ๆ–‡ไปถไธญ็š„ๆ ผๅผ"})]})})]})},f=()=>{r({...l,expression_groups:[...l.expression_groups,[]]})},p=b=>{r({...l,expression_groups:l.expression_groups.filter((y,w)=>w!==b)})},g=b=>{const y=[...l.expression_groups];y[b]=[...y[b],""],r({...l,expression_groups:y})},N=(b,y)=>{const w=[...l.expression_groups];w[b]=w[b].filter((z,M)=>M!==y),r({...l,expression_groups:w})},j=(b,y,w)=>{const z=[...l.expression_groups];z[b][y]=w,r({...l,expression_groups:z})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"้ป‘่ฏ่ฎพ็ฝฎ"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qe,{id:"all_global_jargon",checked:l.all_global_jargon??!1,onCheckedChange:b=>r({...l,all_global_jargon:b})}),e.jsx(T,{htmlFor:"all_global_jargon",className:"cursor-pointer",children:"ๅ…จๅฑ€้ป‘่ฏๆจกๅผ"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"ๅผ€ๅฏๅŽ๏ผŒๆ–ฐๅขž็š„้ป‘่ฏๅฐ†้ป˜่ฎค่ฎพไธบๅ…จๅฑ€๏ผˆๆ‰€ๆœ‰่Šๅคฉๆตๅ…ฑไบซ๏ผ‰ใ€‚ๅ…ณ้—ญๅŽ๏ผŒๅทฒ่ฎฐๅฝ•็š„ๅ…จๅฑ€้ป‘่ฏไธไผšๆ”นๅ˜๏ผŒ้œ€่ฆๆ‰‹ๅŠจๅˆ ้™คใ€‚"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qe,{id:"enable_jargon_explanation",checked:l.enable_jargon_explanation??!0,onCheckedChange:b=>r({...l,enable_jargon_explanation:b})}),e.jsx(T,{htmlFor:"enable_jargon_explanation",className:"cursor-pointer",children:"ๅฏ็”จ้ป‘่ฏ่งฃ้‡Š"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"ๅœจๅ›žๅคๅ‰ๅฐ่ฏ•ๅฏนไธŠไธ‹ๆ–‡ไธญ็š„้ป‘่ฏ่ฟ›่กŒ่งฃ้‡Šใ€‚ๅ…ณ้—ญๅฏๅ‡ๅฐ‘ไธ€ๆฌกLLM่ฐƒ็”จ๏ผŒไป…ๅฝฑๅ“ๅ›žๅคๅ‰็š„้ป‘่ฏๅŒน้…ไธŽ่งฃ้‡Š๏ผŒไธๅฝฑๅ“้ป‘่ฏๅญฆไน ใ€‚"})]}),e.jsxs("div",{children:[e.jsx(T,{htmlFor:"jargon_mode",children:"้ป‘่ฏ่งฃ้‡Šๆฅๆบๆจกๅผ"}),e.jsxs(Pe,{value:l.jargon_mode??"context",onValueChange:b=>r({...l,jargon_mode:b}),children:[e.jsx(Ie,{id:"jargon_mode",className:"mt-2",children:e.jsx(Fe,{placeholder:"้€‰ๆ‹ฉ้ป‘่ฏ่งฃ้‡Šๆฅๆบ"})}),e.jsxs(Be,{children:[e.jsx(W,{value:"context",children:"ไธŠไธ‹ๆ–‡ๆจกๅผ๏ผˆ่‡ชๅŠจๅŒน้…้ป‘่ฏ๏ผ‰"}),e.jsx(W,{value:"planner",children:"Plannerๆจกๅผ๏ผˆไฝฟ็”จunknown_wordsๅˆ—่กจ๏ผ‰"})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["ไธŠไธ‹ๆ–‡ๆจกๅผ๏ผšไฝฟ็”จไธŠไธ‹ๆ–‡่‡ชๅŠจๅŒน้…้ป‘่ฏๅนถ่งฃ้‡Š",e.jsx("br",{}),"Plannerๆจกๅผ๏ผšไป…ไฝฟ็”จPlannerๅœจreplyๅŠจไฝœไธญ็ป™ๅ‡บ็š„unknown_wordsๅˆ—่กจ่ฟ›่กŒ้ป‘่ฏๆฃ€็ดข"]})]})]}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"่กจ่พพๅญฆไน ้…็ฝฎ"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"้…็ฝฎ้บฆ้บฆๅฆ‚ไฝ•ๅญฆไน ๅ’Œไฝฟ็”จ่กจ่พพๆ–นๅผ"})]}),e.jsxs(_,{onClick:c,size:"sm",variant:"outline",children:[e.jsx(Xs,{className:"h-4 w-4 mr-1"}),"ๆทปๅŠ ่ง„ๅˆ™"]})]}),e.jsxs("div",{className:"space-y-4",children:[l.learning_list.map((b,y)=>{const w=l.learning_list.some((C,R)=>R!==y&&C[0]===""),z=b[0]==="",M=b[0].split(":"),S=M[0]||"qq",F=M[1]||"",E=M[2]||"group";return e.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["่ง„ๅˆ™ ",y+1," ",z&&"๏ผˆๅ…จๅฑ€้…็ฝฎ๏ผ‰"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{rule:b}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"sm",variant:"ghost",children:e.jsx(os,{className:"h-4 w-4"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsxs(gs,{children:["็กฎๅฎš่ฆๅˆ ้™คๅญฆไน ่ง„ๅˆ™ ",y+1," ๅ—๏ผŸๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:()=>d(y),children:"ๅˆ ้™ค"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"้…็ฝฎ็ฑปๅž‹"}),e.jsxs(Pe,{value:z?"global":"specific",onValueChange:C=>{C==="global"?m(y,0,""):m(y,0,"qq::group")},disabled:w&&!z,children:[e.jsx(Ie,{children:e.jsx(Fe,{})}),e.jsxs(Be,{children:[e.jsx(W,{value:"global",children:"ๅ…จๅฑ€้…็ฝฎ"}),e.jsx(W,{value:"specific",disabled:w&&!z,children:"่ฏฆ็ป†้…็ฝฎ"})]})]}),w&&!z&&e.jsx("p",{className:"text-xs text-amber-600",children:"ๅทฒๅญ˜ๅœจๅ…จๅฑ€้…็ฝฎ๏ผŒๆ— ๆณ•ๅˆ›ๅปบๆ–ฐ็š„ๅ…จๅฑ€้…็ฝฎ"})]}),!z&&e.jsxs("div",{className:"grid gap-4 p-3 sm:p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"ๅนณๅฐ"}),e.jsxs(Pe,{value:S,onValueChange:C=>{m(y,0,`${C}:${F}:${E}`)},children:[e.jsx(Ie,{children:e.jsx(Fe,{})}),e.jsxs(Be,{children:[e.jsx(W,{value:"qq",children:"QQ"}),e.jsx(W,{value:"wx",children:"ๅพฎไฟก"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"็พค ID"}),e.jsx(ae,{value:F,onChange:C=>{m(y,0,`${S}:${C.target.value}:${E}`)},placeholder:"่พ“ๅ…ฅ็พค ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"็ฑปๅž‹"}),e.jsxs(Pe,{value:E,onValueChange:C=>{m(y,0,`${S}:${F}:${C}`)},children:[e.jsx(Ie,{children:e.jsx(Fe,{})}),e.jsxs(Be,{children:[e.jsx(W,{value:"group",children:"็พค็ป„๏ผˆgroup๏ผ‰"}),e.jsx(W,{value:"private",children:"็ง่Š๏ผˆprivate๏ผ‰"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["ๅฝ“ๅ‰่Šๅคฉๆต ID๏ผš",b[0]||"๏ผˆๆœช่ฎพ็ฝฎ๏ผ‰"]})]}),e.jsx("div",{className:"grid gap-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-xs font-medium",children:"ไฝฟ็”จๅญฆๅˆฐ็š„่กจ่พพ"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"ๅ…่ฎธ้บฆ้บฆไฝฟ็”จไปŽ่Šๅคฉไธญๅญฆๅˆฐ็š„่กจ่พพๆ–นๅผ"})]}),e.jsx(qe,{checked:b[1]==="enable",onCheckedChange:C=>m(y,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(qe,{checked:b[2]==="enable",onCheckedChange:C=>m(y,2,C?"enable":"disable")})]})}),e.jsx("div",{className:"grid gap-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-xs font-medium",children:"ๅฏ็”จ้ป‘่ฏๅญฆไน "}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"ๅ…่ฎธ้บฆ้บฆๅœจๆญค่Šๅคฉๆตไธญๅญฆไน ๅ’Œ่ฎฐๅฝ•้ป‘่ฏ"})]}),e.jsx(qe,{checked:b[3]==="true"||b[3]==="enable",onCheckedChange:C=>m(y,3,C?"true":"false")})]})})]})]},y)}),l.learning_list.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'ๆš‚ๆ— ๅญฆไน ่ง„ๅˆ™๏ผŒ็‚นๅ‡ป"ๆทปๅŠ ่ง„ๅˆ™"ๅผ€ๅง‹้…็ฝฎ'})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"่กจ่พพไผ˜ๅŒ–้…็ฝฎ"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"้…็ฝฎ้บฆ้บฆๅฆ‚ไฝ•ไผ˜ๅŒ–ๅ’Œๆ”น่ฟ›่กจ่พพๆ–นๅผ"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"expression_self_reflect",className:"cursor-pointer font-medium",children:"่‡ชๅŠจ่กจ่พพไผ˜ๅŒ–"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅฏ็”จๅŽ๏ผŒ้บฆ้บฆไผš่‡ชๅŠจๆฃ€ๆŸฅๅนถไผ˜ๅŒ–่กจ่พพๆ–นๅผ๏ผŒๆ— ้œ€็ฎก็†ๅ‘˜ๆ‰‹ๅŠจๅนฒ้ข„"})]}),e.jsx(qe,{id:"expression_self_reflect",checked:l.expression_self_reflect??!1,onCheckedChange:b=>r({...l,expression_self_reflect:b})})]}),l.expression_self_reflect&&e.jsxs("div",{className:"space-y-4 pl-4 border-l-2 border-primary/20",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"expression_auto_check_interval",children:"่‡ชๅŠจๆฃ€ๆŸฅ้—ด้š”๏ผˆ็ง’๏ผ‰"}),e.jsx(ae,{id:"expression_auto_check_interval",type:"number",min:"60",value:l.expression_auto_check_interval??3600,onChange:b=>r({...l,expression_auto_check_interval:parseInt(b.target.value)||3600})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"่กจ่พพๆ–นๅผ่‡ชๅŠจๆฃ€ๆŸฅ็š„้—ด้š”ๆ—ถ้—ด๏ผˆๅ•ไฝ๏ผš็ง’๏ผ‰๏ผŒ้ป˜่ฎคๅ€ผ๏ผš3600็ง’๏ผˆ1ๅฐๆ—ถ๏ผ‰"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"expression_auto_check_count",children:"ๆฏๆฌกๆฃ€ๆŸฅๆ•ฐ้‡"}),e.jsx(ae,{id:"expression_auto_check_count",type:"number",min:"1",max:"100",value:l.expression_auto_check_count??10,onChange:b=>r({...l,expression_auto_check_count:parseInt(b.target.value)||10})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆฏๆฌก่‡ชๅŠจๆฃ€ๆŸฅๆ—ถ้šๆœบ้€‰ๅ–็š„่กจ่พพๆ–นๅผๆ•ฐ้‡๏ผŒ้ป˜่ฎคๅ€ผ๏ผš10ๆก"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"่‡ชๅฎšไน‰่ฏ„ไผฐๆ ‡ๅ‡†"}),e.jsxs(_,{onClick:()=>{r({...l,expression_auto_check_custom_criteria:[...l.expression_auto_check_custom_criteria||[],""]})},size:"sm",variant:"outline",children:[e.jsx(Xs,{className:"h-4 w-4 mr-1"}),"ๆทปๅŠ ๆ ‡ๅ‡†"]})]}),e.jsxs("div",{className:"space-y-2",children:[(l.expression_auto_check_custom_criteria||[]).map((b,y)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{value:b,onChange:w=>{const z=[...l.expression_auto_check_custom_criteria||[]];z[y]=w.target.value,r({...l,expression_auto_check_custom_criteria:z})},placeholder:"่พ“ๅ…ฅ่ฏ„ไผฐๆ ‡ๅ‡†๏ผŒไพ‹ๅฆ‚๏ผšๆ˜ฏๅฆ็ฌฆๅˆ่ง’่‰ฒไบบ่ฎพ",className:"flex-1"}),e.jsx(_,{onClick:()=>{r({...l,expression_auto_check_custom_criteria:(l.expression_auto_check_custom_criteria||[]).filter((w,z)=>z!==y)})},size:"icon",variant:"ghost",children:e.jsx(os,{className:"h-4 w-4"})})]},y)),(!l.expression_auto_check_custom_criteria||l.expression_auto_check_custom_criteria.length===0)&&e.jsx("div",{className:"text-center py-4 text-muted-foreground text-sm",children:'ๆš‚ๆ— ่‡ชๅฎšไน‰ๆ ‡ๅ‡†๏ผŒ็‚นๅ‡ป"ๆทปๅŠ ๆ ‡ๅ‡†"ๅผ€ๅง‹้…็ฝฎ'})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"่ฟ™ไบ›ๆ ‡ๅ‡†ไผš่ขซๆทปๅŠ ๅˆฐ่ฏ„ไผฐๆ็คบ่ฏไธญ๏ผŒไฝœไธบ้ขๅค–็š„่ฏ„ไผฐ่ฆๆฑ‚"})]})]})]}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"expression_checked_only",className:"cursor-pointer font-medium",children:"ไป…ไฝฟ็”จๅทฒๅฎกๆ ธ้€š่ฟ‡็š„่กจ่พพๆ–นๅผ"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅผ€ๅฏๅŽ๏ผŒๅชๆœ‰้€š่ฟ‡ๅฎกๆ ธ๏ผˆๅทฒๆฃ€ๆŸฅ๏ผ‰็š„้กน็›ฎไผš่ขซไฝฟ็”จ๏ผ›ๅ…ณ้—ญๆ—ถ๏ผŒๆœชๅฎกๆ ธ็š„้กน็›ฎไนŸไผš่ขซไฝฟ็”จใ€‚ๆ— ่ฎบๅผ€ๅ…ณ็Šถๆ€๏ผŒ่ขซๆ‹’็ป็š„้กน็›ฎๆฐธ่ฟœไธไผš่ขซไฝฟ็”จใ€‚"})]}),e.jsx(qe,{id:"expression_checked_only",checked:l.expression_checked_only??!1,onCheckedChange:b=>r({...l,expression_checked_only:b})})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{htmlFor:"expression_manual_reflect",className:"cursor-pointer font-medium",children:"ๆ‰‹ๅŠจ่กจ่พพไผ˜ๅŒ–"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅฏ็”จๅŽ๏ผŒ้บฆ้บฆไผšไธปๅŠจๅ‘็ฎก็†ๅ‘˜่ฏข้—ฎ่กจ่พพๆ–นๅผๆ˜ฏๅฆๅˆ้€‚"})]}),e.jsx(qe,{id:"expression_manual_reflect",checked:l.expression_manual_reflect??!1,onCheckedChange:b=>r({...l,expression_manual_reflect:b})})]}),l.expression_manual_reflect&&e.jsxs("div",{className:"space-y-4 pl-4 border-l-2 border-primary/20",children:[e.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsx("span",{className:"text-sm font-medium",children:"ๅๆ€ๆ“ไฝœๅ‘˜"})}),e.jsx("div",{className:"space-y-4",children:(()=>{const y=(l.manual_reflect_operator_id||"").split(":"),w=y[0]||"qq",z=y[1]||"",M=y[2]||"private";return e.jsxs("div",{className:"grid gap-4 p-3 sm:p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"ๅนณๅฐ"}),e.jsxs(Pe,{value:w,onValueChange:S=>{r({...l,manual_reflect_operator_id:`${S}:${z}:${M}`})},children:[e.jsx(Ie,{children:e.jsx(Fe,{})}),e.jsxs(Be,{children:[e.jsx(W,{value:"qq",children:"QQ"}),e.jsx(W,{value:"wx",children:"ๅพฎไฟก"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"็”จๆˆท/็พค ID"}),e.jsx(ae,{value:z,onChange:S=>{r({...l,manual_reflect_operator_id:`${w}:${S.target.value}:${M}`})},placeholder:"่พ“ๅ…ฅ ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"็ฑปๅž‹"}),e.jsxs(Pe,{value:M,onValueChange:S=>{r({...l,manual_reflect_operator_id:`${w}:${z}:${S}`})},children:[e.jsx(Ie,{children:e.jsx(Fe,{})}),e.jsxs(Be,{children:[e.jsx(W,{value:"private",children:"็ง่Š๏ผˆprivate๏ผ‰"}),e.jsx(W,{value:"group",children:"็พค็ป„๏ผˆgroup๏ผ‰"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["ๅฝ“ๅ‰ๆ“ไฝœๅ‘˜ ID๏ผš",l.manual_reflect_operator_id||"๏ผˆๆœช่ฎพ็ฝฎ๏ผ‰"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:'ๆ‰‹ๅŠจ่กจ่พพไผ˜ๅŒ–ๆ“ไฝœๅ‘˜ID๏ผŒๆ ผๅผ๏ผšplatform:id:type (ไพ‹ๅฆ‚ "qq:123456:private" ๆˆ– "qq:654321:group")'})]})})()})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-medium",children:"ๅ…่ฎธ่ฟ›่กŒ่กจ่พพๅๆ€็š„่Šๅคฉๆต"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"ๅชๆœ‰ๅœจๆญคๅˆ—่กจไธญ็š„่Šๅคฉๆตๆ‰ไผšๆๅ‡บ้—ฎ้ข˜ๅนถ่ทŸ่ธชใ€‚ๅฆ‚ๆžœๅˆ—่กจไธบ็ฉบ๏ผŒๅˆ™ๆ‰€ๆœ‰่Šๅคฉๆต้ƒฝๅฏไปฅ่ฟ›่กŒ่กจ่พพๅๆ€๏ผˆๅ‰ๆๆ˜ฏๅฏ็”จไบ†ๆ‰‹ๅŠจ่กจ่พพไผ˜ๅŒ–๏ผ‰"})]}),e.jsxs(_,{onClick:()=>{r({...l,allow_reflect:[...l.allow_reflect||[],"qq::group"]})},size:"sm",variant:"outline",children:[e.jsx(Xs,{className:"h-4 w-4 mr-1"}),"ๆทปๅŠ ่Šๅคฉๆต"]})]}),e.jsxs("div",{className:"space-y-2",children:[(l.allow_reflect||[]).map((b,y)=>{const w=b.split(":"),z=w[0]||"qq",M=w[1]||"",S=w[2]||"group";return e.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg bg-muted/50",children:[e.jsxs(Pe,{value:z,onValueChange:F=>{const E=[...l.allow_reflect];E[y]=`${F}:${M}:${S}`,r({...l,allow_reflect:E})},children:[e.jsx(Ie,{className:"w-24",children:e.jsx(Fe,{})}),e.jsxs(Be,{children:[e.jsx(W,{value:"qq",children:"QQ"}),e.jsx(W,{value:"wx",children:"ๅพฎไฟก"})]})]}),e.jsx(ae,{value:M,onChange:F=>{const E=[...l.allow_reflect];E[y]=`${z}:${F.target.value}:${S}`,r({...l,allow_reflect:E})},placeholder:"ID",className:"flex-1 font-mono text-sm"}),e.jsxs(Pe,{value:S,onValueChange:F=>{const E=[...l.allow_reflect];E[y]=`${z}:${M}:${F}`,r({...l,allow_reflect:E})},children:[e.jsx(Ie,{className:"w-32",children:e.jsx(Fe,{})}),e.jsxs(Be,{children:[e.jsx(W,{value:"group",children:"็พค็ป„"}),e.jsx(W,{value:"private",children:"็ง่Š"})]})]}),e.jsx(_,{onClick:()=>{r({...l,allow_reflect:l.allow_reflect.filter((F,E)=>E!==y)})},size:"sm",variant:"ghost",children:e.jsx(os,{className:"h-4 w-4"})})]},y)}),(!l.allow_reflect||l.allow_reflect.length===0)&&e.jsx("div",{className:"text-center py-4 text-muted-foreground text-sm",children:"ๅˆ—่กจไธบ็ฉบ๏ผŒๆ‰€ๆœ‰่Šๅคฉๆต้ƒฝๅฏไปฅ่ฟ›่กŒ่กจ่พพๅๆ€"})]})]})]})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"่กจ่พพๅ…ฑไบซ็ป„้…็ฝฎ"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"้…็ฝฎไธๅŒ่Šๅคฉๆตไน‹้—ดๅฆ‚ไฝ•ๅ…ฑไบซๅญฆๅˆฐ็š„่กจ่พพๆ–นๅผ"})]}),e.jsxs(_,{onClick:f,size:"sm",variant:"outline",children:[e.jsx(Xs,{className:"h-4 w-4 mr-1"}),"ๆทปๅŠ ๅ…ฑไบซ็ป„"]})]}),e.jsxs("div",{className:"space-y-4",children:[l.expression_groups.map((b,y)=>{const w=l.learning_list.map(z=>z[0]).filter(z=>z!=="");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:["ๅ…ฑไบซ็ป„ ",y+1,b.length===1&&b[0]==="*"&&"๏ผˆๅ…จๅฑ€ๅ…ฑไบซ๏ผ‰"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(_,{onClick:()=>g(y),size:"sm",variant:"outline",children:e.jsx(Xs,{className:"h-4 w-4"})}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"sm",variant:"ghost",children:e.jsx(os,{className:"h-4 w-4"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsxs(gs,{children:["็กฎๅฎš่ฆๅˆ ้™คๅ…ฑไบซ็ป„ ",y+1," ๅ—๏ผŸๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:()=>p(y),children:"ๅˆ ้™ค"})]})]})]})]})]}),e.jsx("div",{className:"space-y-2",children:b.map((z,M)=>e.jsx(mS,{member:z,groupIndex:y,memberIndex:M,availableChatIds:w,onUpdate:j,onRemove:N},`${y}-${M}`))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:'ๆ็คบ๏ผšๅฏไปฅไปŽไธ‹ๆ‹‰ๆก†้€‰ๆ‹ฉๅทฒ้…็ฝฎ็š„่Šๅคฉๆต๏ผŒๆˆ–ๆ‰‹ๅŠจ่พ“ๅ…ฅใ€‚่พ“ๅ…ฅ "*" ๅฏ็”จๅ…จๅฑ€ๅ…ฑไบซ'})]},y)}),l.expression_groups.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'ๆš‚ๆ— ๅ…ฑไบซ็ป„๏ผŒ็‚นๅ‡ป"ๆทปๅŠ ๅ…ฑไบซ็ป„"ๅผ€ๅง‹้…็ฝฎ'})]})]})})]})});function hS({regex:a,reaction:l,onRegexChange:r,onReactionChange:c}){const[d,m]=u.useState(!1),[h,f]=u.useState(""),[p,g]=u.useState(null),[N,j]=u.useState(""),[b,y]=u.useState({}),[w,z]=u.useState(""),M=u.useRef(null),[S,F]=u.useState("build"),E=O=>O.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),C=(O,X=0)=>{const L=M.current;if(!L)return;const me=L.selectionStart||0,Ne=L.selectionEnd||0,je=a.substring(0,me)+O+a.substring(Ne);r(je),setTimeout(()=>{const re=me+O.length+X;L.setSelectionRange(re,re),L.focus()},0)};u.useEffect(()=>{if(!a||!h){p!==null&&g(null),Object.keys(b).length>0&&y({}),w!==l&&z(l),N!==""&&j("");return}try{const O=E(a),X=new RegExp(O,"g"),L=h.match(X);g(L),j("");const Ne=new RegExp(O).exec(h);if(Ne&&Ne.groups){y(Ne.groups);let je=l;Object.entries(Ne.groups).forEach(([re,ge])=>{je=je.replace(new RegExp(`\\[${re}\\]`,"g"),ge||"")}),z(je)}else y({}),z(l)}catch(O){j(O.message),g(null),y({}),z(l)}},[a,h,l,p,b,w,N]);const R=()=>{if(!h||!p||p.length===0)return e.jsx("span",{className:"text-muted-foreground",children:h||"่ฏท่พ“ๅ…ฅๆต‹่ฏ•ๆ–‡ๆœฌ"});try{const O=E(a),X=new RegExp(O,"g");let L=0;const me=[];let Ne;for(;(Ne=X.exec(h))!==null;)Ne.index>L&&me.push(e.jsx("span",{children:h.substring(L,Ne.index)},`text-${L}`)),me.push(e.jsx("span",{className:"bg-yellow-200 dark:bg-yellow-900 font-semibold",children:Ne[0]},`match-${Ne.index}`)),L=Ne.index+Ne[0].length;return L)",desc:"Python้ฃŽๆ ผๅ‘ฝๅๆ•่Žท็ป„",moveCursor:-1},{label:"้žๆ•่Žท็ป„",pattern:"(?:)",desc:"ๅˆ†็ป„ไฝ†ไธไฟๅญ˜ๅŒน้…็ป“ๆžœ",moveCursor:-1}]},{category:"ๅญ—็ฌฆ็ฑป",items:[{label:"ๅญ—็ฌฆ้›†",pattern:"[]",desc:"ๅŒน้…ๆ‹ฌๅทๅ†…็š„ไปปๆ„ๅญ—็ฌฆ",moveCursor:-1},{label:"ๆŽ’้™คๅญ—็ฌฆ",pattern:"[^]",desc:"ๅŒน้…ไธๅœจๆ‹ฌๅทๅ†…็š„ๅญ—็ฌฆ",moveCursor:-1},{label:"่Œƒๅ›ด",pattern:"[a-z]",desc:"ๅŒน้…aๅˆฐz็š„ๅญ—็ฌฆ"},{label:"ไธญๆ–‡ๅญ—็ฌฆ",pattern:"[\\u4e00-\\u9fa5]",desc:"ๅŒน้…ไธญๆ–‡ๆฑ‰ๅญ—"}]},{category:"ๅธธ็”จๆจกๆฟ",items:[{label:"ๆ•่Žท่ฏ่ฏญ",pattern:"(?P\\S+)",desc:"ๆ•่Žทไธ€ไธช่ฏ่ฏญ"},{label:"ๆ•่Žทๅฅๅญ",pattern:"(?P.+)",desc:"ๆ•่Žทๆ•ดไธชๅฅๅญ"},{label:"ๆ•่Žทๆ•ฐๅญ—",pattern:"(?P\\d+)",desc:"ๆ•่Žทไธ€ไธชๆˆ–ๅคšไธชๆ•ฐๅญ—"},{label:"ๅฏ้€‰่ฏ่ฏญ",pattern:"(?:่ฏ่ฏญ1|่ฏ่ฏญ2)",desc:"ๅŒน้…ๅคšไธชๅฏ้€‰้กนไน‹ไธ€"}]}];return e.jsxs(Qs,{open:d,onOpenChange:m,children:[e.jsx(dd,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(ux,{className:"h-4 w-4 mr-1"}),"ๆญฃๅˆ™็ผ–่พ‘ๅ™จ"]})}),e.jsxs(Hs,{className:"max-w-[95vw] sm:max-w-[900px] max-h-[90vh]",children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"ๆญฃๅˆ™่กจ่พพๅผ็ผ–่พ‘ๅ™จ"}),e.jsx(at,{className:"text-sm",children:"ไฝฟ็”จๅฏ่ง†ๅŒ–ๅทฅๅ…ทๆž„ๅปบๆญฃๅˆ™่กจ่พพๅผ๏ผŒๅนถๅฎžๆ—ถๆต‹่ฏ•ๆ•ˆๆžœ"})]}),e.jsx(ts,{className:"max-h-[calc(90vh-120px)]",children:e.jsxs(Jt,{value:S,onValueChange:O=>F(O),className:"w-full",children:[e.jsxs(Gt,{className:"grid w-full grid-cols-2",children:[e.jsx(Xe,{value:"build",children:"๐Ÿ”ง ๆž„ๅปบๅ™จ"}),e.jsx(Xe,{value:"test",children:"๐Ÿงช ๆต‹่ฏ•ๅ™จ"})]}),e.jsxs(Ss,{value:"build",className:"space-y-4 mt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"ๆญฃๅˆ™่กจ่พพๅผ"}),e.jsx(ae,{ref:M,value:a,onChange:O=>r(O.target.value),className:"font-mono text-sm",placeholder:"็‚นๅ‡ปไธ‹ๆ–นๆŒ‰้’ฎๆž„ๅปบๆญฃๅˆ™่กจ่พพๅผ..."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"Reaction ๅ†…ๅฎน"}),e.jsx(pt,{value:l,onChange:O=>c(O.target.value),placeholder:"ไฝฟ็”จ [ๆ•่Žท็ป„ๅ] ๅผ•็”จๆ•่Žท็š„ๅ†…ๅฎน...",rows:3,className:"text-sm"})]}),e.jsxs("div",{className:"space-y-4 border-t pt-4",children:[H.map(O=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("h5",{className:"text-xs font-semibold text-primary",children:O.category}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:O.items.map(X=>e.jsx(_,{variant:"outline",size:"sm",className:"justify-start h-auto py-2 px-3",onClick:()=>C(X.pattern,X.moveCursor||0),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsxs("div",{className:"flex items-center gap-2 w-full",children:[e.jsx("span",{className:"text-xs font-medium",children:X.label}),e.jsx("code",{className:"ml-auto text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:X.pattern})]}),e.jsx("span",{className:"text-xs text-muted-foreground mt-0.5",children:X.desc})]})},X.label))})]},O.category)),e.jsxs("div",{className:"space-y-2 border-t pt-4",children:[e.jsx("h5",{className:"text-xs font-semibold text-primary",children:"ๅฎŒๆ•ด็คบไพ‹ๆจกๆฟ"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(_,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>r("^(?P\\S{1,20})ๆ˜ฏ่ฟ™ๆ ท็š„$"),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsxs("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:["^(?P\\S","{1,20}",")ๆ˜ฏ่ฟ™ๆ ท็š„$"]}),e.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"ๅŒน้…ใ€ŒๆŸไบ‹็‰ฉๆ˜ฏ่ฟ™ๆ ท็š„ใ€ๅนถๆ•่Žทไบ‹็‰ฉๅ็งฐ"})]})}),e.jsx(_,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>r("(?:[^๏ผŒใ€‚.\\s]+๏ผŒ\\s*)?ๆˆ‘(?:ไนŸ)?[ๆฒกๆฒ’]่ฆๆฑ‚ไฝ \\s*(?P.+?)[.ใ€‚,๏ผŒ]?$"),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?:[^๏ผŒใ€‚.\\s]+๏ผŒ\\s*)?ๆˆ‘(?:ไนŸ)?[ๆฒกๆฒ’]่ฆๆฑ‚ไฝ \\s*(?P.+?)[.ใ€‚,๏ผŒ]?$"}),e.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"ๅŒน้…ใ€Œๆˆ‘ๆฒก่ฆๆฑ‚ไฝ ๅšๆŸไบ‹ใ€ๅนถๆ•่Žทๅ…ทไฝ“่กŒไธบ"})]})}),e.jsx(_,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>r("(?P.+?)(?:ๆ˜ฏ|ไธบไป€ไนˆ|ๆ€Žไนˆ)"),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?P.+?)(?:ๆ˜ฏ|ไธบไป€ไนˆ|ๆ€Žไนˆ)"}),e.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"ๆ•่Žท้—ฎ้ข˜ไธป้ข˜่ฏ"})]})})]})]})]}),e.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[e.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"๐Ÿ’ก ไฝฟ็”จๆ็คบ"}),e.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[e.jsx("li",{children:"็‚นๅ‡ป่พ“ๅ…ฅๆก†่ฎพ็ฝฎๅ…‰ๆ ‡ไฝ็ฝฎ๏ผŒ็„ถๅŽ็‚นๅ‡ปๆŒ‰้’ฎๆ’ๅ…ฅๆจกๅผ"}),e.jsxs("li",{children:["ๅ‘ฝๅๆ•่Žท็ป„ๆ ผๅผ๏ผš",e.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"(?P<ๅ็งฐ>ๆจกๅผ)"})]}),e.jsxs("li",{children:["ๅœจ reaction ไธญไฝฟ็”จ ",e.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"[ๅ็งฐ]"})," ๅผ•็”จๆ•่Žท็š„ๅ†…ๅฎน"]}),e.jsx("li",{children:"ๅˆ‡ๆขๅˆฐๆต‹่ฏ•ๅ™จๆ ‡็ญพ้กต้ชŒ่ฏๆญฃๅˆ™่กจ่พพๅผๆ•ˆๆžœ"})]})]})]}),e.jsxs(Ss,{value:"test",className:"space-y-4 mt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"ๅฝ“ๅ‰ๆญฃๅˆ™่กจ่พพๅผ"}),e.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:a||"(ๆœช่ฎพ็ฝฎ)"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"test-text",className:"text-sm font-medium",children:"ๆต‹่ฏ•ๆ–‡ๆœฌ"}),e.jsx(pt,{id:"test-text",value:h,onChange:O=>f(O.target.value),placeholder:`ๅœจๆญค่พ“ๅ…ฅ่ฆๆต‹่ฏ•็š„ๆ–‡ๆœฌ... +ไพ‹ๅฆ‚๏ผšๆ‰“ๆธธๆˆๆ˜ฏ่ฟ™ๆ ท็š„`,className:"min-h-[100px] text-sm"})]}),N&&e.jsxs("div",{className:"rounded-md bg-destructive/10 border border-destructive/20 p-3",children:[e.jsx("p",{className:"text-sm text-destructive font-medium",children:"ๆญฃๅˆ™่กจ่พพๅผ้”™่ฏฏ"}),e.jsx("p",{className:"text-xs text-destructive/80 mt-1",children:N})]}),!N&&h&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"flex items-center gap-2",children:p&&p.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-green-500"}),e.jsxs("span",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:["ๅŒน้…ๆˆๅŠŸ (",p.length," ๅค„)"]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-gray-400"}),e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"ๆ— ๅŒน้…"})]})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"ๅŒน้…้ซ˜ไบฎ"}),e.jsx(ts,{className:"h-40 rounded-md bg-muted p-3",children:e.jsx("div",{className:"text-sm break-words",children:R()})})]}),Object.keys(b).length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"ๅ‘ฝๅๆ•่Žท็ป„"}),e.jsx(ts,{className:"h-32 rounded-md border p-3",children:e.jsx("div",{className:"space-y-2",children:Object.entries(b).map(([O,X])=>e.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[e.jsxs("span",{className:"font-mono font-semibold text-primary min-w-[80px]",children:["[",O,"]"]}),e.jsx("span",{className:"text-muted-foreground",children:"="}),e.jsx("span",{className:"font-mono bg-muted px-2 py-0.5 rounded",children:X})]},O))})})]}),Object.keys(b).length>0&&l&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"Reaction ๆ›ฟๆข้ข„่งˆ"}),e.jsx(ts,{className:"h-48 rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3",children:e.jsx("div",{className:"text-sm break-words",children:w})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"reaction ไธญ็š„ [name] ๅทฒ่ขซๆ›ฟๆขไธบๅฏนๅบ”็š„ๆ•่Žท็ป„ๅ€ผ"})]})]}),e.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[e.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"๐Ÿ’ก ๆต‹่ฏ•่ฏดๆ˜Ž"}),e.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[e.jsx("li",{children:"ๅŒน้…็š„ๆ–‡ๆœฌไผšไปฅ้ป„่‰ฒ่ƒŒๆ™ฏ้ซ˜ไบฎๆ˜พ็คบ"}),e.jsx("li",{children:"ๅ‘ฝๅๆ•่Žท็ป„็š„ๅ€ผไผšๆ˜พ็คบๅœจไธ‹ๆ–นๅˆ—่กจไธญ"}),e.jsx("li",{children:"Reaction ๆ›ฟๆข้ข„่งˆๆ˜พ็คบๆœ€็ปˆ็”Ÿๆˆ็š„ๅๅบ”ๅ†…ๅฎน"}),e.jsx("li",{children:"ๅฆ‚้œ€ไฟฎๆ”นๆญฃๅˆ™๏ผŒๅˆ‡ๆขๅ›žๆž„ๅปบๅ™จๆ ‡็ญพ้กต"})]})]})]})]})})]})]})}const fS=Is.memo(function({keywordReactionConfig:l,responsePostProcessConfig:r,chineseTypoConfig:c,responseSplitterConfig:d,onKeywordReactionChange:m,onResponsePostProcessChange:h,onChineseTypoChange:f,onResponseSplitterChange:p}){const g=()=>{m({...l,regex_rules:[...l.regex_rules,{regex:[""],reaction:""}]})},N=C=>{m({...l,regex_rules:l.regex_rules.filter((R,H)=>H!==C)})},j=(C,R,H)=>{const O=[...l.regex_rules];R==="regex"&&typeof H=="string"?O[C]={...O[C],regex:[H]}:R==="reaction"&&typeof H=="string"&&(O[C]={...O[C],reaction:H}),m({...l,regex_rules:O})},b=()=>{m({...l,keyword_rules:[...l.keyword_rules,{keywords:[],reaction:""}]})},y=C=>{m({...l,keyword_rules:l.keyword_rules.filter((R,H)=>H!==C)})},w=(C,R,H)=>{const O=[...l.keyword_rules];typeof H=="string"&&(O[C]={...O[C],reaction:H}),m({...l,keyword_rules:O})},z=C=>{const R=[...l.keyword_rules];R[C]={...R[C],keywords:[...R[C].keywords||[],""]},m({...l,keyword_rules:R})},M=(C,R)=>{const H=[...l.keyword_rules];H[C]={...H[C],keywords:(H[C].keywords||[]).filter((O,X)=>X!==R)},m({...l,keyword_rules:H})},S=(C,R,H)=>{const O=[...l.keyword_rules],X=[...O[C].keywords||[]];X[R]=H,O[C]={...O[C],keywords:X},m({...l,keyword_rules:O})},F=({rule:C})=>{const R=`{ regex = [${(C.regex||[]).map(H=>`"${H}"`).join(", ")}], reaction = "${C.reaction}" }`;return e.jsxs(cl,{children:[e.jsx(ol,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(ua,{className:"h-4 w-4 mr-1"}),"้ข„่งˆ"]})}),e.jsx(tl,{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(ts,{className:"h-60 rounded-md bg-muted p-3",children:e.jsx("pre",{className:"font-mono text-xs break-all",children:R})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"่ฟ™ๆ˜ฏไฟๅญ˜ๅˆฐ bot_config.toml ๆ–‡ไปถไธญ็š„ๆ ผๅผ"})]})})]})},E=({rule:C})=>{const R=`[[keyword_reaction.keyword_rules]] keywords = [${(C.keywords||[]).map(H=>`"${H}"`).join(", ")}] -reaction = "${C.reaction}"`;return e.jsxs(cl,{children:[e.jsx(ol,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(ua,{className:"h-4 w-4 mr-1"}),"้ข„่งˆ"]})}),e.jsx(tl,{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(ts,{className:"h-60 rounded-md bg-muted p-3",children:e.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-all",children:R})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"่ฟ™ๆ˜ฏไฟๅญ˜ๅˆฐ bot_config.toml ๆ–‡ไปถไธญ็š„ๆ ผๅผ"})]})})]})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"ๅ…ณ้”ฎ่ฏๅๅบ”้…็ฝฎ"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"้…็ฝฎ่งฆๅ‘็‰นๅฎšๅๅบ”็š„ๅ…ณ้”ฎ่ฏๅ’Œๆญฃๅˆ™่กจ่พพๅผ่ง„ๅˆ™"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-base font-semibold",children:"ๆญฃๅˆ™่กจ่พพๅผ่ง„ๅˆ™"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"ไฝฟ็”จๆญฃๅˆ™่กจ่พพๅผๅŒน้…ๆถˆๆฏๅ†…ๅฎน"})]}),e.jsxs(_,{onClick:g,size:"sm",variant:"outline",children:[e.jsx(Xs,{className:"h-4 w-4 mr-1"}),"ๆทปๅŠ ๆญฃๅˆ™่ง„ๅˆ™"]})]}),e.jsxs("div",{className:"space-y-3",children:[l.regex_rules.map((C,R)=>e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["ๆญฃๅˆ™่ง„ๅˆ™ ",R+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(hS,{regex:C.regex&&C.regex[0]||"",reaction:C.reaction,onRegexChange:H=>j(R,"regex",H),onReactionChange:H=>j(R,"reaction",H)}),e.jsx(F,{rule:C}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"sm",variant:"ghost",children:e.jsx(os,{className:"h-4 w-4"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsxs(gs,{children:["็กฎๅฎš่ฆๅˆ ้™คๆญฃๅˆ™่ง„ๅˆ™ ",R+1," ๅ—๏ผŸๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:()=>N(R),children:"ๅˆ ้™ค"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"ๆญฃๅˆ™่กจ่พพๅผ๏ผˆPython ่ฏญๆณ•๏ผ‰"}),e.jsx(ne,{value:C.regex&&C.regex[0]||"",onChange:H=>j(R,"regex",H.target.value),placeholder:"ไพ‹ๅฆ‚๏ผš^(?P\\\\S{1,20})ๆ˜ฏ่ฟ™ๆ ท็š„$ ๏ผˆ็‚นๅ‡ปๆญฃๅˆ™็ผ–่พ‘ๅ™จๆŒ‰้’ฎๅฏ่ง†ๅŒ–ๆž„ๅปบ๏ผ‰",className:"font-mono text-sm"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:'ๆ”ฏๆŒๅ‘ฝๅๆ•่Žท็ป„ (?Ppattern)๏ผŒๅฏๅœจ reaction ไธญไฝฟ็”จ [name] ๅผ•็”จใ€‚็‚นๅ‡ป"ๆญฃๅˆ™็ผ–่พ‘ๅ™จ"ๅฏ่ง†ๅŒ–ๆž„ๅปบๅ’Œๆต‹่ฏ•๏ผ'})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"ๅๅบ”ๅ†…ๅฎน"}),e.jsx(pt,{value:C.reaction,onChange:H=>j(R,"reaction",H.target.value),placeholder:`่งฆๅ‘ๅŽ้บฆ้บฆ็š„ๅๅบ”... -ๅฏไปฅไฝฟ็”จ [ๆ•่Žท็ป„ๅ] ๆฅๅผ•็”จๆญฃๅˆ™่กจ่พพๅผไธญ็š„ๅ†…ๅฎน`,rows:3,className:"text-sm"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ไฝฟ็”จ [ๆ•่Žท็ป„ๅ] ๅผ•็”จๆญฃๅˆ™่กจ่พพๅผไธญ็š„ๅ‘ฝๅๆ•่Žท็ป„๏ผŒไพ‹ๅฆ‚ [n] ไผš่ขซๆ›ฟๆขไธบๆ•่Žท็š„ๅ†…ๅฎน"})]})]})]},R)),l.regex_rules.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'ๆš‚ๆ— ๆญฃๅˆ™่ง„ๅˆ™๏ผŒ็‚นๅ‡ป"ๆทปๅŠ ๆญฃๅˆ™่ง„ๅˆ™"ๅผ€ๅง‹้…็ฝฎ'})]})]}),e.jsxs("div",{className:"space-y-4 border-t pt-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-base font-semibold",children:"ๅ…ณ้”ฎ่ฏ่ง„ๅˆ™"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"ไฝฟ็”จๅ…ณ้”ฎ่ฏๅˆ—่กจๅŒน้…ๆถˆๆฏๅ†…ๅฎน"})]}),e.jsxs(_,{onClick:b,size:"sm",variant:"outline",children:[e.jsx(Xs,{className:"h-4 w-4 mr-1"}),"ๆทปๅŠ ๅ…ณ้”ฎ่ฏ่ง„ๅˆ™"]})]}),e.jsxs("div",{className:"space-y-3",children:[l.keyword_rules.map((C,R)=>e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["ๅ…ณ้”ฎ่ฏ่ง„ๅˆ™ ",R+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(E,{rule:C}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"sm",variant:"ghost",children:e.jsx(os,{className:"h-4 w-4"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsxs(gs,{children:["็กฎๅฎš่ฆๅˆ ้™คๅ…ณ้”ฎ่ฏ่ง„ๅˆ™ ",R+1," ๅ—๏ผŸๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:()=>y(R),children:"ๅˆ ้™ค"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-xs font-medium",children:"ๅ…ณ้”ฎ่ฏๅˆ—่กจ"}),e.jsxs(_,{onClick:()=>z(R),size:"sm",variant:"ghost",children:[e.jsx(Xs,{className:"h-3 w-3 mr-1"}),"ๆทปๅŠ ๅ…ณ้”ฎ่ฏ"]})]}),e.jsxs("div",{className:"space-y-2",children:[(C.keywords||[]).map((H,O)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{value:H,onChange:X=>S(R,O,X.target.value),placeholder:"ๅ…ณ้”ฎ่ฏ",className:"flex-1"}),e.jsx(_,{onClick:()=>M(R,O),size:"sm",variant:"ghost",children:e.jsx(os,{className:"h-4 w-4"})})]},O)),(!C.keywords||C.keywords.length===0)&&e.jsx("p",{className:"text-xs text-muted-foreground text-center py-2",children:'ๆš‚ๆ— ๅ…ณ้”ฎ่ฏ๏ผŒ็‚นๅ‡ป"ๆทปๅŠ ๅ…ณ้”ฎ่ฏ"ๅผ€ๅง‹้…็ฝฎ'})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"ๅๅบ”ๅ†…ๅฎน"}),e.jsx(pt,{value:C.reaction,onChange:H=>w(R,"reaction",H.target.value),placeholder:"่งฆๅ‘ๅŽ้บฆ้บฆ็š„ๅๅบ”...",rows:3,className:"text-sm"})]})]})]},R)),l.keyword_rules.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'ๆš‚ๆ— ๅ…ณ้”ฎ่ฏ่ง„ๅˆ™๏ผŒ็‚นๅ‡ป"ๆทปๅŠ ๅ…ณ้”ฎ่ฏ่ง„ๅˆ™"ๅผ€ๅง‹้…็ฝฎ'})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"ๅ›žๅคๅŽๅค„็†้…็ฝฎ"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"enable_response_post_process",checked:r.enable_response_post_process,onCheckedChange:C=>h({...r,enable_response_post_process:C})}),e.jsx(T,{htmlFor:"enable_response_post_process",className:"cursor-pointer",children:"ๅฏ็”จๅ›žๅคๅŽๅค„็†"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"ๅŒ…ๆ‹ฌ้”™ๅˆซๅญ—็”Ÿๆˆๅ™จๅ’Œๅ›žๅคๅˆ†ๅ‰ฒๅ™จ"})]}),r.enable_response_post_process&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"border-t pt-6 space-y-4",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[e.jsx(Ge,{id:"enable_chinese_typo",checked:c.enable,onCheckedChange:C=>f({...c,enable:C})}),e.jsx(T,{htmlFor:"enable_chinese_typo",className:"cursor-pointer font-semibold",children:"ไธญๆ–‡้”™ๅˆซๅญ—็”Ÿๆˆๅ™จ"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"ไธบๅ›žๅคๆทปๅŠ ้šๆœบ้”™ๅˆซๅญ—๏ผŒ่ฎฉ้บฆ้บฆ็š„ๅ›žๅคๆ›ด่‡ช็„ถ"}),c.enable&&e.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"error_rate",className:"text-xs font-medium",children:"ๅ•ๅญ—ๆ›ฟๆขๆฆ‚็އ"}),e.jsx(ne,{id:"error_rate",type:"number",step:"0.001",min:"0",max:"1",value:c.error_rate,onChange:C=>f({...c,error_rate:parseFloat(C.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"min_freq",className:"text-xs font-medium",children:"ๆœ€ๅฐๅญ—้ข‘้˜ˆๅ€ผ"}),e.jsx(ne,{id:"min_freq",type:"number",min:"0",value:c.min_freq,onChange:C=>f({...c,min_freq:parseInt(C.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"tone_error_rate",className:"text-xs font-medium",children:"ๅฃฐ่ฐƒ้”™่ฏฏๆฆ‚็އ"}),e.jsx(ne,{id:"tone_error_rate",type:"number",step:"0.01",min:"0",max:"1",value:c.tone_error_rate,onChange:C=>f({...c,tone_error_rate:parseFloat(C.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"word_replace_rate",className:"text-xs font-medium",children:"ๆ•ด่ฏๆ›ฟๆขๆฆ‚็އ"}),e.jsx(ne,{id:"word_replace_rate",type:"number",step:"0.001",min:"0",max:"1",value:c.word_replace_rate,onChange:C=>f({...c,word_replace_rate:parseFloat(C.target.value)})})]})]})]})}),e.jsx("div",{className:"border-t pt-6 space-y-4",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[e.jsx(Ge,{id:"enable_response_splitter",checked:d.enable,onCheckedChange:C=>p({...d,enable:C})}),e.jsx(T,{htmlFor:"enable_response_splitter",className:"cursor-pointer font-semibold",children:"ๅ›žๅคๅˆ†ๅ‰ฒๅ™จ"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"ๆŽงๅˆถๅ›žๅค็š„้•ฟๅบฆๅ’Œๅฅๅญๆ•ฐ้‡"}),d.enable&&e.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"max_length",className:"text-xs font-medium",children:"ๆœ€ๅคง้•ฟๅบฆ"}),e.jsx(ne,{id:"max_length",type:"number",min:"1",value:d.max_length,onChange:C=>p({...d,max_length:parseInt(C.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅ›žๅคๅ…่ฎธ็š„ๆœ€ๅคงๅญ—็ฌฆๆ•ฐ"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"max_sentence_num",className:"text-xs font-medium",children:"ๆœ€ๅคงๅฅๅญๆ•ฐ"}),e.jsx(ne,{id:"max_sentence_num",type:"number",min:"1",value:d.max_sentence_num,onChange:C=>p({...d,max_sentence_num:parseInt(C.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅ›žๅคๅ…่ฎธ็š„ๆœ€ๅคงๅฅๅญๆ•ฐ้‡"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"enable_kaomoji_protection",checked:d.enable_kaomoji_protection,onCheckedChange:C=>p({...d,enable_kaomoji_protection:C})}),e.jsx(T,{htmlFor:"enable_kaomoji_protection",className:"cursor-pointer",children:"ๅฏ็”จ้ขœๆ–‡ๅญ—ไฟๆŠค"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"enable_overflow_return_all",checked:d.enable_overflow_return_all,onCheckedChange:C=>p({...d,enable_overflow_return_all:C})}),e.jsx(T,{htmlFor:"enable_overflow_return_all",className:"cursor-pointer",children:"่ถ…ๅ‡บๆ—ถไธ€ๆฌกๆ€ง่ฟ”ๅ›žๅ…จ้ƒจ"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"ๅฝ“ๅฅๅญๆ•ฐ้‡่ถ…ๅ‡บ้™ๅˆถๆ—ถ๏ผŒๅˆๅนถๅŽไธ€ๆฌกๆ€ง่ฟ”ๅ›žๆ‰€ๆœ‰ๅ†…ๅฎน"})]})]})})]})]})]})});function pS({config:a,onChange:l}){const[r,c]=u.useState(""),[d,m]=u.useState(""),h=()=>{const b=r.trim();b&&!a.ban_words.includes(b)&&(l({...a,ban_words:[...a.ban_words,b]}),c(""))},f=b=>{l({...a,ban_words:a.ban_words.filter((y,w)=>w!==b)})},p=b=>{b.key==="Enter"&&(b.preventDefault(),h())},g=()=>{const b=d.trim();if(b&&!a.ban_msgs_regex.includes(b))try{new RegExp(b),l({...a,ban_msgs_regex:[...a.ban_msgs_regex,b]}),m("")}catch(y){alert(`ๆญฃๅˆ™่กจ่พพๅผ่ฏญๆณ•้”™่ฏฏ๏ผš${y.message}`)}},N=b=>{l({...a,ban_msgs_regex:a.ban_msgs_regex.filter((y,w)=>w!==b)})},j=b=>{b.key==="Enter"&&(b.preventDefault(),g())};return e.jsx("div",{className:"space-y-6",children:e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"ๆถˆๆฏ่ฟ‡ๆปค้…็ฝฎ"}),e.jsx(Ns,{children:"้…็ฝฎๆถˆๆฏ่ฟ‡ๆปค่ง„ๅˆ™๏ผŒ่ฟ‡ๆปค็‰นๅฎšๆถˆๆฏๆˆ–ๅœจ็‰นๅฎš็พค็ป„ๅฏ็”จ้™้ป˜ๆจกๅผ"})]}),e.jsx(ze,{children:e.jsxs(Jt,{defaultValue:"ban_words",className:"w-full",children:[e.jsxs(Gt,{className:"grid w-full grid-cols-2",children:[e.jsx(Xe,{value:"ban_words",children:"็ฆ็”จๅ…ณ้”ฎ่ฏ"}),e.jsx(Xe,{value:"ban_regex",children:"็ฆ็”จๆญฃๅˆ™"})]}),e.jsx(Ss,{value:"ban_words",className:"space-y-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Lt,{className:"h-4 w-4 text-yellow-500 mt-1 flex-shrink-0"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๅŒ…ๅซไปฅไธ‹ๅ…ณ้”ฎ่ฏ็š„ๆถˆๆฏๅฐ†่ขซ่ฟ‡ๆปค๏ผŒBot ไธไผš่ฏปๅ–่ฟ™ไบ›ๆถˆๆฏ"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{placeholder:"่พ“ๅ…ฅ่ฆ็ฆ็”จ็š„ๅ…ณ้”ฎ่ฏ๏ผˆๆŒ‰ๅ›ž่ฝฆๆทปๅŠ ๏ผ‰",value:r,onChange:b=>c(b.target.value),onKeyDown:p}),e.jsx(_,{onClick:h,size:"icon",children:e.jsx(Xs,{className:"h-4 w-4"})})]}),a.ban_words.length===0?e.jsx("div",{className:"rounded-md border border-dashed p-8 text-center",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๆš‚ๆ— ็ฆ็”จๅ…ณ้”ฎ่ฏ๏ผŒ็‚นๅ‡ปไธŠๆ–นๆทปๅŠ "})}):e.jsx("div",{className:"space-y-2",children:a.ban_words.map((b,y)=>e.jsxs("div",{className:"flex items-center justify-between rounded-md border p-3",children:[e.jsx("code",{className:"text-sm",children:b}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{variant:"ghost",size:"icon",children:e.jsx(os,{className:"h-4 w-4 text-destructive"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsxs(gs,{children:["็กฎๅฎš่ฆๅˆ ้™คๅ…ณ้”ฎ่ฏ ",e.jsxs("code",{children:['"',b,'"']})," ๅ—๏ผŸ"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:()=>f(y),children:"ๅˆ ้™ค"})]})]})]})]},y))})]})}),e.jsx(Ss,{value:"ban_regex",className:"space-y-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Lt,{className:"h-4 w-4 text-yellow-500 mt-1 flex-shrink-0"}),e.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[e.jsx("p",{children:"ๅŒน้…ไปฅไธ‹ๆญฃๅˆ™่กจ่พพๅผ็š„ๆถˆๆฏๅฐ†่ขซ่ฟ‡ๆปค"}),e.jsx("p",{className:"text-xs",children:"โš ๏ธ ่‹ฅไธไบ†่งฃๆญฃๅˆ™่กจ่พพๅผ๏ผŒ่ฏทๅ‹ฟ้šๆ„ไฟฎๆ”น"})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(pt,{placeholder:`่พ“ๅ…ฅๆญฃๅˆ™่กจ่พพๅผ๏ผˆๆŒ‰ๅ›ž่ฝฆๆทปๅŠ ๏ผ‰ -็คบไพ‹๏ผšhttps?://[^\\s]+ ๅŒน้…้“พๆŽฅ`,value:d,onChange:b=>m(b.target.value),onKeyDown:j,className:"min-h-[60px] font-mono text-sm"}),e.jsx(_,{onClick:g,size:"icon",children:e.jsx(Xs,{className:"h-4 w-4"})})]}),a.ban_msgs_regex.length===0?e.jsx("div",{className:"rounded-md border border-dashed p-8 text-center",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๆš‚ๆ— ็ฆ็”จๆญฃๅˆ™่กจ่พพๅผ๏ผŒ็‚นๅ‡ปไธŠๆ–นๆทปๅŠ "})}):e.jsx("div",{className:"space-y-2",children:a.ban_msgs_regex.map((b,y)=>e.jsxs("div",{className:"flex items-center justify-between rounded-md border p-3",children:[e.jsx("code",{className:"text-sm font-mono flex-1 break-all",children:b}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{variant:"ghost",size:"icon",className:"ml-2 flex-shrink-0",children:e.jsx(os,{className:"h-4 w-4 text-destructive"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsxs(gs,{children:["็กฎๅฎš่ฆๅˆ ้™คๆญฃๅˆ™่กจ่พพๅผ ",e.jsxs("code",{children:['"',b,'"']})," ๅ—๏ผŸ"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:()=>N(y),children:"ๅˆ ้™ค"})]})]})]})]},y))})]})})]})})]})})}const gS=Bs.memo(function({config:l,onChange:r}){const[c,d]=u.useState(""),[m,h]=u.useState(""),[f,p]=u.useState(!1),g=l.allowed_ips?l.allowed_ips.split(",").map(S=>S.trim()).filter(S=>S):[],N=l.trusted_proxies?l.trusted_proxies.split(",").map(S=>S.trim()).filter(S=>S):[],j=()=>{if(!c.trim())return;const S=[...g,c.trim()];r({...l,allowed_ips:S.join(",")}),d("")},b=S=>{const F=g.filter((E,C)=>C!==S);r({...l,allowed_ips:F.join(",")})},y=()=>{if(!m.trim())return;const S=[...N,m.trim()];r({...l,trusted_proxies:S.join(",")}),h("")},w=S=>{const F=N.filter((E,C)=>C!==S);r({...l,trusted_proxies:F.join(",")})},z=S=>{!S&&l.enabled?p(!0):r({...l,enabled:S})},M=()=>{r({...l,enabled:!1}),p(!1)};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"WebUI ๆœๅŠก้…็ฝฎ"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{checked:l.enabled,onCheckedChange:z}),e.jsx(T,{className:"cursor-pointer",children:"ๅฏ็”จ WebUI"})]}),l.enabled&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"่ฟ่กŒๆจกๅผ"}),e.jsxs(Pe,{value:l.mode,onValueChange:S=>r({...l,mode:S}),children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"้€‰ๆ‹ฉ่ฟ่กŒๆจกๅผ"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"development",children:"ๅผ€ๅ‘ๆจกๅผ"}),e.jsx(W,{value:"production",children:"็”Ÿไบงๆจกๅผ"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆณจๆ„: WebUI ็š„็›‘ๅฌๅœฐๅ€ๅ’Œ็ซฏๅฃ่ฏทๅœจ .env ๆ–‡ไปถไธญ้…็ฝฎ WEBUI_HOST ๅ’Œ WEBUI_PORT"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"้˜ฒ็ˆฌ่™ซๆจกๅผ"}),e.jsxs(Pe,{value:l.anti_crawler_mode,onValueChange:S=>r({...l,anti_crawler_mode:S}),children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"้€‰ๆ‹ฉ้˜ฒ็ˆฌ่™ซๆจกๅผ"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"false",children:"็ฆ็”จ"}),e.jsx(W,{value:"basic",children:"ๅŸบ็ก€๏ผˆๅช่ฎฐๅฝ•ไธ้˜ปๆญข๏ผ‰"}),e.jsx(W,{value:"loose",children:"ๅฎฝๆพ"}),e.jsx(W,{value:"strict",children:"ไธฅๆ ผ"})]})]})]}),e.jsxs("div",{className:"grid gap-2 sm:col-span-2",children:[e.jsx(T,{children:"IP ็™ฝๅๅ•"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{value:c,onChange:S=>d(S.target.value),onKeyDown:S=>{S.key==="Enter"&&(S.preventDefault(),j())},placeholder:"่พ“ๅ…ฅIPๅœฐๅ€ๅŽๆŒ‰ๅ›ž่ฝฆๆˆ–็‚นๅ‡ปๆทปๅŠ "}),e.jsx(_,{type:"button",size:"sm",onClick:j,disabled:!c.trim(),children:e.jsx(Xs,{className:"h-4 w-4"})})]}),g.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:g.map((S,F)=>e.jsxs(Ce,{variant:"secondary",className:"flex items-center gap-1",children:[S,e.jsx("button",{type:"button",onClick:()=>b(F),className:"ml-1 hover:bg-destructive/20 rounded-full p-0.5",children:e.jsx(Sa,{className:"h-3 w-3"})})]},F))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆ”ฏๆŒ็ฒพ็กฎIPใ€CIDRๆ ผๅผๅ’Œ้€š้…็ฌฆ๏ผˆๅฆ‚๏ผš127.0.0.1ใ€192.168.1.0/24๏ผ‰"})]}),e.jsxs("div",{className:"grid gap-2 sm:col-span-2",children:[e.jsx(T,{children:"ไฟกไปป็š„ไปฃ็† IP"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{value:m,onChange:S=>h(S.target.value),onKeyDown:S=>{S.key==="Enter"&&(S.preventDefault(),y())},placeholder:"่พ“ๅ…ฅไปฃ็†IPๅŽๆŒ‰ๅ›ž่ฝฆๆˆ–็‚นๅ‡ปๆทปๅŠ "}),e.jsx(_,{type:"button",size:"sm",onClick:y,disabled:!m.trim(),children:e.jsx(Xs,{className:"h-4 w-4"})})]}),N.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:N.map((S,F)=>e.jsxs(Ce,{variant:"secondary",className:"flex items-center gap-1",children:[S,e.jsx("button",{type:"button",onClick:()=>w(F),className:"ml-1 hover:bg-destructive/20 rounded-full p-0.5",children:e.jsx(Sa,{className:"h-3 w-3"})})]},F))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅชๆœ‰ๆฅ่‡ช่ฟ™ไบ›IP็š„X-Forwarded-Forๅคดๆ‰่ขซไฟกไปป"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{checked:l.trust_xff,onCheckedChange:S=>r({...l,trust_xff:S})}),e.jsx(T,{className:"cursor-pointer",children:"ๅฏ็”จ X-Forwarded-For ไปฃ็†่งฃๆž"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{checked:l.secure_cookie,onCheckedChange:S=>r({...l,secure_cookie:S})}),e.jsx(T,{className:"cursor-pointer",children:"ๅฏ็”จๅฎ‰ๅ…จ Cookie๏ผˆไป… HTTPS๏ผ‰"})]})]})]}),e.jsx(bs,{open:f,onOpenChange:p,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"่ญฆๅ‘Š๏ผšๅณๅฐ†ๅ…ณ้—ญ WebUI"}),e.jsxs(gs,{children:["ๅ…ณ้—ญ WebUI ๅŽ๏ผŒๅœจๆ‚จไธ‹ๆฌก้‡ๅฏ้บฆ้บฆไน‹ๅ‰๏ผŒWebUI ็•Œ้ขๅฐ†ๆ— ๆณ•่ฎฟ้—ฎใ€‚",e.jsx("br",{}),e.jsx("br",{}),"ๆ‚จ้œ€่ฆ้€š่ฟ‡ไฟฎๆ”น้…็ฝฎๆ–‡ไปถๆˆ–ๅ‘ฝไปค่กŒ้‡ๆ–ฐๅฏ็”จ WebUI ๆ‰่ƒฝๅ†ๆฌก่ฎฟ้—ฎๆญค็•Œ้ขใ€‚",e.jsx("br",{}),e.jsx("br",{}),"็กฎๅฎš่ฆๅ…ณ้—ญ WebUI ๅ—๏ผŸ"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{variant:"destructive",onClick:M,children:"็กฎ่ฎคๅ…ณ้—ญ"})]})]})})]})}),En="/api/webui/config";async function Hg(){const l=await(await ke(`${En}/bot`)).json();if(!l.success)throw new Error("่Žทๅ–้…็ฝฎๆ•ฐๆฎๅคฑ่ดฅ");return l.config}async function Nn(){const l=await(await ke(`${En}/model`)).json();if(!l.success)throw new Error("่Žทๅ–ๆจกๅž‹้…็ฝฎๆ•ฐๆฎๅคฑ่ดฅ");return l.config}async function qg(a){const r=await(await ke(`${En}/bot`,{method:"POST",body:JSON.stringify(a)})).json();if(!r.success)throw new Error(r.message||"ไฟๅญ˜้…็ฝฎๅคฑ่ดฅ")}async function jS(){const l=await(await ke(`${En}/bot/raw`)).json();if(!l.success)throw new Error("่Žทๅ–้…็ฝฎๆบไปฃ็ ๅคฑ่ดฅ");return l.content}async function vS(a){const r=await(await ke(`${En}/bot/raw`,{method:"POST",body:JSON.stringify({raw_content:a})})).json();if(!r.success)throw new Error(r.message||"ไฟๅญ˜้…็ฝฎๅคฑ่ดฅ")}async function lc(a){const r=await(await ke(`${En}/model`,{method:"POST",body:JSON.stringify(a)})).json();if(!r.success)throw new Error(r.message||"ไฟๅญ˜้…็ฝฎๅคฑ่ดฅ")}async function NS(a,l){const c=await(await ke(`${En}/bot/section/${a}`,{method:"POST",body:JSON.stringify(l)})).json();if(!c.success)throw new Error(c.message||`ไฟๅญ˜้…็ฝฎ่Š‚ ${a} ๅคฑ่ดฅ`)}async function Wm(a,l){const c=await(await ke(`${En}/model/section/${a}`,{method:"POST",body:JSON.stringify(l)})).json();if(!c.success)throw new Error(c.message||`ไฟๅญ˜้…็ฝฎ่Š‚ ${a} ๅคฑ่ดฅ`)}async function bS(a,l="openai",r="/models"){const c=new URLSearchParams({provider_name:a,parser:l,endpoint:r}),d=await ke(`/api/webui/models/list?${c}`);if(!d.ok){const h=await d.json().catch(()=>({}));throw new Error(h.detail||`่Žทๅ–ๆจกๅž‹ๅˆ—่กจๅคฑ่ดฅ (${d.status})`)}const m=await d.json();if(!m.success)throw new Error("่Žทๅ–ๆจกๅž‹ๅˆ—่กจๅคฑ่ดฅ");return m.models}async function yS(a){const l=new URLSearchParams({provider_name:a}),r=await ke(`/api/webui/models/test-connection-by-name?${l}`,{method:"POST"});if(!r.ok){const c=await r.json().catch(()=>({}));throw new Error(c.detail||`ๆต‹่ฏ•่ฟžๆŽฅๅคฑ่ดฅ (${r.status})`)}return await r.json()}const wS=ti("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"}}),ht=u.forwardRef(({className:a,variant:l,...r},c)=>e.jsx("div",{ref:c,role:"alert",className:P(wS({variant:l}),a),...r}));ht.displayName="Alert";const Jn=u.forwardRef(({className:a,...l},r)=>e.jsx("h5",{ref:r,className:P("mb-1 font-medium leading-none tracking-tight",a),...l}));Jn.displayName="AlertTitle";const ft=u.forwardRef(({className:a,...l},r)=>e.jsx("div",{ref:r,className:P("text-sm [&_p]:leading-relaxed",a),...l}));ft.displayName="AlertDescription";const _S={name:"toml",startState:function(){return{inString:!1,stringType:"",lhs:!0,inArray:0}},token:function(a,l){let r;if(!l.inString&&(r=a.match(/^('''|"""|'|")/))&&(l.stringType=r[0],l.inString=!0),a.sol()&&!l.inString&&l.inArray===0&&(l.lhs=!0),l.inString){for(;l.inString;)if(a.match(l.stringType))l.inString=!1;else if(a.peek()==="\\")a.next(),a.next();else{if(a.eol())break;a.match(/^.[^\\\"\']*/)}return l.lhs?"property":"string"}else{if(l.inArray&&a.peek()==="]")return a.next(),l.inArray--,"bracket";if(l.lhs&&a.peek()==="["&&a.skipTo("]"))return a.next(),a.peek()==="]"&&a.next(),"atom";if(a.peek()==="#")return a.skipToEnd(),"comment";if(a.eatSpace())return null;if(l.lhs&&a.eatWhile(function(c){return c!="="&&c!=" "}))return"property";if(l.lhs&&a.peek()==="=")return a.next(),l.lhs=!1,null;if(!l.lhs&&a.match(/^\d\d\d\d[\d\-\:\.T]*Z/))return"atom";if(!l.lhs&&(a.match("true")||a.match("false")))return"atom";if(!l.lhs&&a.peek()==="[")return l.inArray++,a.next(),"bracket";if(!l.lhs&&a.match(/^\-?\d+(?:\.\d+)?/))return"number";a.eatSpace()||a.next()}return null},languageData:{commentTokens:{line:"#"}}},SS={python:[d_()],json:[u_(),m_()],toml:[o_.define(_S)],text:[]};function Qv({value:a,onChange:l,language:r="text",readOnly:c=!1,height:d="400px",minHeight:m,maxHeight:h,placeholder:f,theme:p="dark",className:g=""}){const[N,j]=u.useState(!1);if(u.useEffect(()=>{j(!0)},[]),!N)return e.jsx("div",{className:`rounded-md border bg-muted animate-pulse ${g}`,style:{height:d,minHeight:m,maxHeight:h}});const b=[...SS[r]||[],zm.lineWrapping,zm.theme({"&":{fontFamily:'"JetBrains Mono", "Fira Code", "Consolas", "Monaco", monospace'},".cm-content":{fontFamily:'"JetBrains Mono", "Fira Code", "Consolas", "Monaco", monospace'},".cm-gutters":{fontFamily:'"JetBrains Mono", "Fira Code", "Consolas", "Monaco", monospace'},".cm-scroller":{fontFamily:'"JetBrains Mono", "Fira Code", "Consolas", "Monaco", monospace'}})];return c&&b.push(zm.editable.of(!1)),e.jsx("div",{className:`rounded-md overflow-hidden border custom-scrollbar ${g}`,children:e.jsx(x_,{value:a,height:d,minHeight:m,maxHeight:h,theme:p==="dark"?h_:void 0,extensions:b,onChange:l,placeholder:f,basicSetup:{lineNumbers:!0,highlightActiveLineGutter:!0,highlightSpecialChars:!0,history:!0,foldGutter:!0,drawSelection:!0,dropCursor:!0,allowMultipleSelections:!0,indentOnInput:!0,syntaxHighlighting:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,rectangularSelection:!0,crosshairCursor:!0,highlightActiveLine:!0,highlightSelectionMatches:!0,closeBracketsKeymap:!0,defaultKeymap:!0,searchKeymap:!0,historyKeymap:!0,foldKeymap:!0,completionKeymap:!0,lintKeymap:!0}})})}function kS({id:a,index:l,itemType:r,itemFields:c,value:d,onChange:m,onRemove:h,disabled:f,canRemove:p,placeholder:g}){const{attributes:N,listeners:j,setNodeRef:b,transform:y,transition:w,isDragging:z}=Cv({id:a,disabled:f}),M={transform:Tv.Transform.toString(y),transition:w};return e.jsxs("div",{ref:b,style:M,className:P("flex items-start gap-2 group",z&&"opacity-50 z-50"),children:[e.jsx("button",{type:"button",className:P("flex-shrink-0 p-2 cursor-grab active:cursor-grabbing","text-muted-foreground hover:text-foreground transition-colors","opacity-0 group-hover:opacity-100 focus:opacity-100",f&&"cursor-not-allowed opacity-30"),...N,...j,children:e.jsx(dv,{className:"h-4 w-4"})}),e.jsx("div",{className:"flex-1 min-w-0",children:r==="object"&&c?e.jsx(CS,{value:d,onChange:m,fields:c,disabled:f}):r==="number"?e.jsx(ne,{type:"number",value:d??"",onChange:S=>m(parseFloat(S.target.value)||0),placeholder:g??`็ฌฌ ${l+1} ้กน`,disabled:f,className:"font-mono"}):e.jsx(ne,{type:"text",value:d??"",onChange:S=>m(S.target.value),placeholder:g??`็ฌฌ ${l+1} ้กน`,disabled:f})}),e.jsx(_,{type:"button",variant:"ghost",size:"icon",onClick:h,disabled:f||!p,className:P("flex-shrink-0 text-muted-foreground hover:text-destructive","opacity-0 group-hover:opacity-100 focus:opacity-100 transition-opacity"),children:e.jsx(os,{className:"h-4 w-4"})})]})}function CS({value:a,onChange:l,fields:r,disabled:c}){const d=u.useCallback((h,f)=>{l({...a,[h]:f})},[a,l]),m=(h,f)=>{const p=a?.[h];if(f.type==="boolean"||f.type==="switch")return e.jsxs("div",{className:"flex items-center justify-between py-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsx(Ge,{checked:!!(p??f.default),onCheckedChange:g=>d(h,g),disabled:c})]});if(f.type==="slider"||f.type==="number"&&f.min!=null&&f.max!=null){const g=p??f.default??f.min??0;return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsx("span",{className:"text-xs text-muted-foreground",children:g})]}),e.jsx(el,{value:[g],onValueChange:N=>d(h,N[0]),min:f.min??0,max:f.max??100,step:f.step??1,disabled:c,className:"py-1"})]})}return f.type==="select"&&f.choices?e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsxs(Pe,{value:String(p??f.default??""),onValueChange:g=>d(h,g),disabled:c,children:[e.jsx(Be,{className:"h-8 text-sm",children:e.jsx(Fe,{placeholder:f.placeholder??"่ฏท้€‰ๆ‹ฉ"})}),e.jsx(Ie,{children:f.choices.map(g=>e.jsx(W,{value:String(g),children:String(g)},String(g)))})]})]}):f.type==="number"?e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsx(ne,{type:"number",value:p??f.default??"",onChange:g=>d(h,parseFloat(g.target.value)||0),placeholder:f.placeholder,disabled:c,className:"h-8 text-sm"})]}):e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsx(ne,{type:"text",value:p??f.default??"",onChange:g=>d(h,g.target.value),placeholder:f.placeholder,disabled:c,className:"h-8 text-sm"})]})};return e.jsx(Te,{className:"p-3 space-y-2 bg-muted/30",children:Object.entries(r).map(([h,f])=>e.jsx("div",{children:m(h,f)},h))})}function TS({value:a,onChange:l,itemType:r="string",itemFields:c,minItems:d,maxItems:m,disabled:h,placeholder:f}){const p=u.useMemo(()=>Array.isArray(a)?a:typeof a=="string"&&a.trim()?a.split(",").map(E=>E.trim()):[],[a]),[g]=u.useState(()=>new Map),N=u.useCallback(E=>(g.has(E)||g.set(E,`item-${Date.now()}-${E}-${Math.random().toString(36).slice(2)}`),g.get(E)),[g]),j=u.useMemo(()=>{const E=[];for(let C=0;C{const{active:C,over:R}=E;if(R&&C.id!==R.id){const H=j.indexOf(C.id),O=j.indexOf(R.id),X=wv(p,H,O);l(X)}},[p,j,l]),w=u.useCallback(()=>{if(m!=null&&p.length>=m)return;let E;r==="object"&&c?E=Object.fromEntries(Object.entries(c).map(([C,R])=>[C,R.default??""])):r==="number"?E=0:E="",l([...p,E])},[p,m,r,c,l]),z=u.useCallback((E,C)=>{const R=[...p];R[E]=C,l(R)},[p,l]),M=u.useCallback(E=>{if(d!=null&&p.length<=d)return;const C=p.filter((R,H)=>H!==E);g.delete(E),l(C)},[p,d,g,l]),S=m==null||p.lengthd;return e.jsxs("div",{className:"space-y-2",children:[p.length===0?e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground py-4 justify-center border border-dashed rounded-md",children:[e.jsx(Ut,{className:"h-4 w-4"}),e.jsx("span",{children:"ๆš‚ๆ— ๆ•ฐๆฎ๏ผŒ็‚นๅ‡ปไธ‹ๆ–นๆŒ‰้’ฎๆทปๅŠ "})]}):e.jsx(_v,{sensors:b,collisionDetection:Sv,onDragEnd:y,children:e.jsx(kv,{items:j,strategy:f_,children:e.jsx("div",{className:"space-y-2",children:p.map((E,C)=>e.jsx(kS,{id:j[C],index:C,itemType:r,itemFields:c,value:E,onChange:R=>z(C,R),onRemove:()=>M(C),disabled:h,canRemove:F,placeholder:f},j[C]))})})}),e.jsxs(_,{type:"button",variant:"outline",size:"sm",onClick:w,disabled:h||!S,className:"w-full",children:[e.jsx(Xs,{className:"h-4 w-4 mr-1"}),"ๆทปๅŠ ้กน็›ฎ",m!==void 0&&e.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(",p.length,"/",m,")"]})]}),(d!=null||m!=null)&&(d!==null||m!==null)&&e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:d!=null&&m!=null?`ๅ…่ฎธ ${d} - ${m} ้กน`:d!=null?`่‡ณๅฐ‘ ${d} ้กน`:`ๆœ€ๅคš ${m} ้กน`})]})}function bx({content:a,className:l=""}){return e.jsx("div",{className:`prose prose-sm dark:prose-invert max-w-none ${l}`,children:e.jsx(b_,{remarkPlugins:[w_,__],rehypePlugins:[y_],components:{code({inline:r,className:c,children:d,...m}){return r?e.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-sm font-mono",...m,children:d}):e.jsx("code",{className:`${c} block bg-muted p-4 rounded-lg overflow-x-auto`,...m,children:d})},table({children:r,...c}){return e.jsx("div",{className:"overflow-x-auto",children:e.jsx("table",{className:"border-collapse border border-border",...c,children:r})})},th({children:r,...c}){return e.jsx("th",{className:"border border-border bg-muted px-4 py-2 text-left font-semibold",...c,children:r})},td({children:r,...c}){return e.jsx("td",{className:"border border-border px-4 py-2",...c,children:r})},a({children:r,...c}){return e.jsx("a",{className:"text-primary hover:underline",target:"_blank",rel:"noopener noreferrer",...c,children:r})},blockquote({children:r,...c}){return e.jsx("blockquote",{className:"border-l-4 border-primary pl-4 italic text-muted-foreground",...c,children:r})},h1({children:r,...c}){return e.jsx("h1",{className:"text-3xl font-bold mt-6 mb-4",...c,children:r})},h2({children:r,...c}){return e.jsx("h2",{className:"text-2xl font-bold mt-5 mb-3",...c,children:r})},h3({children:r,...c}){return e.jsx("h3",{className:"text-xl font-bold mt-4 mb-2",...c,children:r})},h4({children:r,...c}){return e.jsx("h4",{className:"text-lg font-semibold mt-3 mb-2",...c,children:r})},ul({children:r,...c}){return e.jsx("ul",{className:"list-disc list-inside space-y-1 my-2",...c,children:r})},ol({children:r,...c}){return e.jsx("ol",{className:"list-decimal list-inside space-y-1 my-2",...c,children:r})},p({children:r,...c}){return e.jsx("p",{className:"my-2 leading-relaxed",...c,children:r})},hr({...r}){return e.jsx("hr",{className:"my-4 border-border",...r})}},children:a})})}function ES(a,l){let r=a.slice(0,l).split(/\r\n|\n|\r/g);return[r.length,r.pop().length+1]}function MS(a,l,r){let c=a.split(/\r\n|\n|\r/g),d="",m=(Math.log10(l+1)|0)+1;for(let h=l-1;h<=l+1;h++){let f=c[h-1];f&&(d+=h.toString().padEnd(m," "),d+=": ",d+=f,d+=` +reaction = "${C.reaction}"`;return e.jsxs(cl,{children:[e.jsx(ol,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(ua,{className:"h-4 w-4 mr-1"}),"้ข„่งˆ"]})}),e.jsx(tl,{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(ts,{className:"h-60 rounded-md bg-muted p-3",children:e.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-all",children:R})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"่ฟ™ๆ˜ฏไฟๅญ˜ๅˆฐ bot_config.toml ๆ–‡ไปถไธญ็š„ๆ ผๅผ"})]})})]})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"ๅ…ณ้”ฎ่ฏๅๅบ”้…็ฝฎ"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"้…็ฝฎ่งฆๅ‘็‰นๅฎšๅๅบ”็š„ๅ…ณ้”ฎ่ฏๅ’Œๆญฃๅˆ™่กจ่พพๅผ่ง„ๅˆ™"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-base font-semibold",children:"ๆญฃๅˆ™่กจ่พพๅผ่ง„ๅˆ™"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"ไฝฟ็”จๆญฃๅˆ™่กจ่พพๅผๅŒน้…ๆถˆๆฏๅ†…ๅฎน"})]}),e.jsxs(_,{onClick:g,size:"sm",variant:"outline",children:[e.jsx(Xs,{className:"h-4 w-4 mr-1"}),"ๆทปๅŠ ๆญฃๅˆ™่ง„ๅˆ™"]})]}),e.jsxs("div",{className:"space-y-3",children:[l.regex_rules.map((C,R)=>e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["ๆญฃๅˆ™่ง„ๅˆ™ ",R+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(hS,{regex:C.regex&&C.regex[0]||"",reaction:C.reaction,onRegexChange:H=>j(R,"regex",H),onReactionChange:H=>j(R,"reaction",H)}),e.jsx(F,{rule:C}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"sm",variant:"ghost",children:e.jsx(os,{className:"h-4 w-4"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsxs(gs,{children:["็กฎๅฎš่ฆๅˆ ้™คๆญฃๅˆ™่ง„ๅˆ™ ",R+1," ๅ—๏ผŸๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:()=>N(R),children:"ๅˆ ้™ค"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"ๆญฃๅˆ™่กจ่พพๅผ๏ผˆPython ่ฏญๆณ•๏ผ‰"}),e.jsx(ae,{value:C.regex&&C.regex[0]||"",onChange:H=>j(R,"regex",H.target.value),placeholder:"ไพ‹ๅฆ‚๏ผš^(?P\\\\S{1,20})ๆ˜ฏ่ฟ™ๆ ท็š„$ ๏ผˆ็‚นๅ‡ปๆญฃๅˆ™็ผ–่พ‘ๅ™จๆŒ‰้’ฎๅฏ่ง†ๅŒ–ๆž„ๅปบ๏ผ‰",className:"font-mono text-sm"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:'ๆ”ฏๆŒๅ‘ฝๅๆ•่Žท็ป„ (?Ppattern)๏ผŒๅฏๅœจ reaction ไธญไฝฟ็”จ [name] ๅผ•็”จใ€‚็‚นๅ‡ป"ๆญฃๅˆ™็ผ–่พ‘ๅ™จ"ๅฏ่ง†ๅŒ–ๆž„ๅปบๅ’Œๆต‹่ฏ•๏ผ'})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"ๅๅบ”ๅ†…ๅฎน"}),e.jsx(pt,{value:C.reaction,onChange:H=>j(R,"reaction",H.target.value),placeholder:`่งฆๅ‘ๅŽ้บฆ้บฆ็š„ๅๅบ”... +ๅฏไปฅไฝฟ็”จ [ๆ•่Žท็ป„ๅ] ๆฅๅผ•็”จๆญฃๅˆ™่กจ่พพๅผไธญ็š„ๅ†…ๅฎน`,rows:3,className:"text-sm"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ไฝฟ็”จ [ๆ•่Žท็ป„ๅ] ๅผ•็”จๆญฃๅˆ™่กจ่พพๅผไธญ็š„ๅ‘ฝๅๆ•่Žท็ป„๏ผŒไพ‹ๅฆ‚ [n] ไผš่ขซๆ›ฟๆขไธบๆ•่Žท็š„ๅ†…ๅฎน"})]})]})]},R)),l.regex_rules.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'ๆš‚ๆ— ๆญฃๅˆ™่ง„ๅˆ™๏ผŒ็‚นๅ‡ป"ๆทปๅŠ ๆญฃๅˆ™่ง„ๅˆ™"ๅผ€ๅง‹้…็ฝฎ'})]})]}),e.jsxs("div",{className:"space-y-4 border-t pt-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-base font-semibold",children:"ๅ…ณ้”ฎ่ฏ่ง„ๅˆ™"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"ไฝฟ็”จๅ…ณ้”ฎ่ฏๅˆ—่กจๅŒน้…ๆถˆๆฏๅ†…ๅฎน"})]}),e.jsxs(_,{onClick:b,size:"sm",variant:"outline",children:[e.jsx(Xs,{className:"h-4 w-4 mr-1"}),"ๆทปๅŠ ๅ…ณ้”ฎ่ฏ่ง„ๅˆ™"]})]}),e.jsxs("div",{className:"space-y-3",children:[l.keyword_rules.map((C,R)=>e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["ๅ…ณ้”ฎ่ฏ่ง„ๅˆ™ ",R+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(E,{rule:C}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"sm",variant:"ghost",children:e.jsx(os,{className:"h-4 w-4"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsxs(gs,{children:["็กฎๅฎš่ฆๅˆ ้™คๅ…ณ้”ฎ่ฏ่ง„ๅˆ™ ",R+1," ๅ—๏ผŸๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:()=>y(R),children:"ๅˆ ้™ค"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-xs font-medium",children:"ๅ…ณ้”ฎ่ฏๅˆ—่กจ"}),e.jsxs(_,{onClick:()=>z(R),size:"sm",variant:"ghost",children:[e.jsx(Xs,{className:"h-3 w-3 mr-1"}),"ๆทปๅŠ ๅ…ณ้”ฎ่ฏ"]})]}),e.jsxs("div",{className:"space-y-2",children:[(C.keywords||[]).map((H,O)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae,{value:H,onChange:X=>S(R,O,X.target.value),placeholder:"ๅ…ณ้”ฎ่ฏ",className:"flex-1"}),e.jsx(_,{onClick:()=>M(R,O),size:"sm",variant:"ghost",children:e.jsx(os,{className:"h-4 w-4"})})]},O)),(!C.keywords||C.keywords.length===0)&&e.jsx("p",{className:"text-xs text-muted-foreground text-center py-2",children:'ๆš‚ๆ— ๅ…ณ้”ฎ่ฏ๏ผŒ็‚นๅ‡ป"ๆทปๅŠ ๅ…ณ้”ฎ่ฏ"ๅผ€ๅง‹้…็ฝฎ'})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-xs font-medium",children:"ๅๅบ”ๅ†…ๅฎน"}),e.jsx(pt,{value:C.reaction,onChange:H=>w(R,"reaction",H.target.value),placeholder:"่งฆๅ‘ๅŽ้บฆ้บฆ็š„ๅๅบ”...",rows:3,className:"text-sm"})]})]})]},R)),l.keyword_rules.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'ๆš‚ๆ— ๅ…ณ้”ฎ่ฏ่ง„ๅˆ™๏ผŒ็‚นๅ‡ป"ๆทปๅŠ ๅ…ณ้”ฎ่ฏ่ง„ๅˆ™"ๅผ€ๅง‹้…็ฝฎ'})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"ๅ›žๅคๅŽๅค„็†้…็ฝฎ"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qe,{id:"enable_response_post_process",checked:r.enable_response_post_process,onCheckedChange:C=>h({...r,enable_response_post_process:C})}),e.jsx(T,{htmlFor:"enable_response_post_process",className:"cursor-pointer",children:"ๅฏ็”จๅ›žๅคๅŽๅค„็†"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"ๅŒ…ๆ‹ฌ้”™ๅˆซๅญ—็”Ÿๆˆๅ™จๅ’Œๅ›žๅคๅˆ†ๅ‰ฒๅ™จ"})]}),r.enable_response_post_process&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"border-t pt-6 space-y-4",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[e.jsx(qe,{id:"enable_chinese_typo",checked:c.enable,onCheckedChange:C=>f({...c,enable:C})}),e.jsx(T,{htmlFor:"enable_chinese_typo",className:"cursor-pointer font-semibold",children:"ไธญๆ–‡้”™ๅˆซๅญ—็”Ÿๆˆๅ™จ"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"ไธบๅ›žๅคๆทปๅŠ ้šๆœบ้”™ๅˆซๅญ—๏ผŒ่ฎฉ้บฆ้บฆ็š„ๅ›žๅคๆ›ด่‡ช็„ถ"}),c.enable&&e.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"error_rate",className:"text-xs font-medium",children:"ๅ•ๅญ—ๆ›ฟๆขๆฆ‚็އ"}),e.jsx(ae,{id:"error_rate",type:"number",step:"0.001",min:"0",max:"1",value:c.error_rate,onChange:C=>f({...c,error_rate:parseFloat(C.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"min_freq",className:"text-xs font-medium",children:"ๆœ€ๅฐๅญ—้ข‘้˜ˆๅ€ผ"}),e.jsx(ae,{id:"min_freq",type:"number",min:"0",value:c.min_freq,onChange:C=>f({...c,min_freq:parseInt(C.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"tone_error_rate",className:"text-xs font-medium",children:"ๅฃฐ่ฐƒ้”™่ฏฏๆฆ‚็އ"}),e.jsx(ae,{id:"tone_error_rate",type:"number",step:"0.01",min:"0",max:"1",value:c.tone_error_rate,onChange:C=>f({...c,tone_error_rate:parseFloat(C.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"word_replace_rate",className:"text-xs font-medium",children:"ๆ•ด่ฏๆ›ฟๆขๆฆ‚็އ"}),e.jsx(ae,{id:"word_replace_rate",type:"number",step:"0.001",min:"0",max:"1",value:c.word_replace_rate,onChange:C=>f({...c,word_replace_rate:parseFloat(C.target.value)})})]})]})]})}),e.jsx("div",{className:"border-t pt-6 space-y-4",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[e.jsx(qe,{id:"enable_response_splitter",checked:d.enable,onCheckedChange:C=>p({...d,enable:C})}),e.jsx(T,{htmlFor:"enable_response_splitter",className:"cursor-pointer font-semibold",children:"ๅ›žๅคๅˆ†ๅ‰ฒๅ™จ"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"ๆŽงๅˆถๅ›žๅค็š„้•ฟๅบฆๅ’Œๅฅๅญๆ•ฐ้‡"}),d.enable&&e.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"max_length",className:"text-xs font-medium",children:"ๆœ€ๅคง้•ฟๅบฆ"}),e.jsx(ae,{id:"max_length",type:"number",min:"1",value:d.max_length,onChange:C=>p({...d,max_length:parseInt(C.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅ›žๅคๅ…่ฎธ็š„ๆœ€ๅคงๅญ—็ฌฆๆ•ฐ"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"max_sentence_num",className:"text-xs font-medium",children:"ๆœ€ๅคงๅฅๅญๆ•ฐ"}),e.jsx(ae,{id:"max_sentence_num",type:"number",min:"1",value:d.max_sentence_num,onChange:C=>p({...d,max_sentence_num:parseInt(C.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅ›žๅคๅ…่ฎธ็š„ๆœ€ๅคงๅฅๅญๆ•ฐ้‡"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qe,{id:"enable_kaomoji_protection",checked:d.enable_kaomoji_protection,onCheckedChange:C=>p({...d,enable_kaomoji_protection:C})}),e.jsx(T,{htmlFor:"enable_kaomoji_protection",className:"cursor-pointer",children:"ๅฏ็”จ้ขœๆ–‡ๅญ—ไฟๆŠค"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qe,{id:"enable_overflow_return_all",checked:d.enable_overflow_return_all,onCheckedChange:C=>p({...d,enable_overflow_return_all:C})}),e.jsx(T,{htmlFor:"enable_overflow_return_all",className:"cursor-pointer",children:"่ถ…ๅ‡บๆ—ถไธ€ๆฌกๆ€ง่ฟ”ๅ›žๅ…จ้ƒจ"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"ๅฝ“ๅฅๅญๆ•ฐ้‡่ถ…ๅ‡บ้™ๅˆถๆ—ถ๏ผŒๅˆๅนถๅŽไธ€ๆฌกๆ€ง่ฟ”ๅ›žๆ‰€ๆœ‰ๅ†…ๅฎน"})]})]})})]})]})]})});function pS({config:a,onChange:l}){const[r,c]=u.useState(""),[d,m]=u.useState(""),h=()=>{const b=r.trim();b&&!a.ban_words.includes(b)&&(l({...a,ban_words:[...a.ban_words,b]}),c(""))},f=b=>{l({...a,ban_words:a.ban_words.filter((y,w)=>w!==b)})},p=b=>{b.key==="Enter"&&(b.preventDefault(),h())},g=()=>{const b=d.trim();if(b&&!a.ban_msgs_regex.includes(b))try{new RegExp(b),l({...a,ban_msgs_regex:[...a.ban_msgs_regex,b]}),m("")}catch(y){alert(`ๆญฃๅˆ™่กจ่พพๅผ่ฏญๆณ•้”™่ฏฏ๏ผš${y.message}`)}},N=b=>{l({...a,ban_msgs_regex:a.ban_msgs_regex.filter((y,w)=>w!==b)})},j=b=>{b.key==="Enter"&&(b.preventDefault(),g())};return e.jsx("div",{className:"space-y-6",children:e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"ๆถˆๆฏ่ฟ‡ๆปค้…็ฝฎ"}),e.jsx(Ns,{children:"้…็ฝฎๆถˆๆฏ่ฟ‡ๆปค่ง„ๅˆ™๏ผŒ่ฟ‡ๆปค็‰นๅฎšๆถˆๆฏๆˆ–ๅœจ็‰นๅฎš็พค็ป„ๅฏ็”จ้™้ป˜ๆจกๅผ"})]}),e.jsx(ze,{children:e.jsxs(Jt,{defaultValue:"ban_words",className:"w-full",children:[e.jsxs(Gt,{className:"grid w-full grid-cols-2",children:[e.jsx(Xe,{value:"ban_words",children:"็ฆ็”จๅ…ณ้”ฎ่ฏ"}),e.jsx(Xe,{value:"ban_regex",children:"็ฆ็”จๆญฃๅˆ™"})]}),e.jsx(Ss,{value:"ban_words",className:"space-y-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Lt,{className:"h-4 w-4 text-yellow-500 mt-1 flex-shrink-0"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๅŒ…ๅซไปฅไธ‹ๅ…ณ้”ฎ่ฏ็š„ๆถˆๆฏๅฐ†่ขซ่ฟ‡ๆปค๏ผŒBot ไธไผš่ฏปๅ–่ฟ™ไบ›ๆถˆๆฏ"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{placeholder:"่พ“ๅ…ฅ่ฆ็ฆ็”จ็š„ๅ…ณ้”ฎ่ฏ๏ผˆๆŒ‰ๅ›ž่ฝฆๆทปๅŠ ๏ผ‰",value:r,onChange:b=>c(b.target.value),onKeyDown:p}),e.jsx(_,{onClick:h,size:"icon",children:e.jsx(Xs,{className:"h-4 w-4"})})]}),a.ban_words.length===0?e.jsx("div",{className:"rounded-md border border-dashed p-8 text-center",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๆš‚ๆ— ็ฆ็”จๅ…ณ้”ฎ่ฏ๏ผŒ็‚นๅ‡ปไธŠๆ–นๆทปๅŠ "})}):e.jsx("div",{className:"space-y-2",children:a.ban_words.map((b,y)=>e.jsxs("div",{className:"flex items-center justify-between rounded-md border p-3",children:[e.jsx("code",{className:"text-sm",children:b}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{variant:"ghost",size:"icon",children:e.jsx(os,{className:"h-4 w-4 text-destructive"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsxs(gs,{children:["็กฎๅฎš่ฆๅˆ ้™คๅ…ณ้”ฎ่ฏ ",e.jsxs("code",{children:['"',b,'"']})," ๅ—๏ผŸ"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:()=>f(y),children:"ๅˆ ้™ค"})]})]})]})]},y))})]})}),e.jsx(Ss,{value:"ban_regex",className:"space-y-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Lt,{className:"h-4 w-4 text-yellow-500 mt-1 flex-shrink-0"}),e.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[e.jsx("p",{children:"ๅŒน้…ไปฅไธ‹ๆญฃๅˆ™่กจ่พพๅผ็š„ๆถˆๆฏๅฐ†่ขซ่ฟ‡ๆปค"}),e.jsx("p",{className:"text-xs",children:"โš ๏ธ ่‹ฅไธไบ†่งฃๆญฃๅˆ™่กจ่พพๅผ๏ผŒ่ฏทๅ‹ฟ้šๆ„ไฟฎๆ”น"})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(pt,{placeholder:`่พ“ๅ…ฅๆญฃๅˆ™่กจ่พพๅผ๏ผˆๆŒ‰ๅ›ž่ฝฆๆทปๅŠ ๏ผ‰ +็คบไพ‹๏ผšhttps?://[^\\s]+ ๅŒน้…้“พๆŽฅ`,value:d,onChange:b=>m(b.target.value),onKeyDown:j,className:"min-h-[60px] font-mono text-sm"}),e.jsx(_,{onClick:g,size:"icon",children:e.jsx(Xs,{className:"h-4 w-4"})})]}),a.ban_msgs_regex.length===0?e.jsx("div",{className:"rounded-md border border-dashed p-8 text-center",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๆš‚ๆ— ็ฆ็”จๆญฃๅˆ™่กจ่พพๅผ๏ผŒ็‚นๅ‡ปไธŠๆ–นๆทปๅŠ "})}):e.jsx("div",{className:"space-y-2",children:a.ban_msgs_regex.map((b,y)=>e.jsxs("div",{className:"flex items-center justify-between rounded-md border p-3",children:[e.jsx("code",{className:"text-sm font-mono flex-1 break-all",children:b}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{variant:"ghost",size:"icon",className:"ml-2 flex-shrink-0",children:e.jsx(os,{className:"h-4 w-4 text-destructive"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsxs(gs,{children:["็กฎๅฎš่ฆๅˆ ้™คๆญฃๅˆ™่กจ่พพๅผ ",e.jsxs("code",{children:['"',b,'"']})," ๅ—๏ผŸ"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:()=>N(y),children:"ๅˆ ้™ค"})]})]})]})]},y))})]})})]})})]})})}const gS=Is.memo(function({config:l,onChange:r}){const[c,d]=u.useState(""),[m,h]=u.useState(""),[f,p]=u.useState(!1),g=l.allowed_ips?l.allowed_ips.split(",").map(S=>S.trim()).filter(S=>S):[],N=l.trusted_proxies?l.trusted_proxies.split(",").map(S=>S.trim()).filter(S=>S):[],j=()=>{if(!c.trim())return;const S=[...g,c.trim()];r({...l,allowed_ips:S.join(",")}),d("")},b=S=>{const F=g.filter((E,C)=>C!==S);r({...l,allowed_ips:F.join(",")})},y=()=>{if(!m.trim())return;const S=[...N,m.trim()];r({...l,trusted_proxies:S.join(",")}),h("")},w=S=>{const F=N.filter((E,C)=>C!==S);r({...l,trusted_proxies:F.join(",")})},z=S=>{!S&&l.enabled?p(!0):r({...l,enabled:S})},M=()=>{r({...l,enabled:!1}),p(!1)};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"WebUI ๆœๅŠก้…็ฝฎ"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qe,{checked:l.enabled,onCheckedChange:z}),e.jsx(T,{className:"cursor-pointer",children:"ๅฏ็”จ WebUI"})]}),l.enabled&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"่ฟ่กŒๆจกๅผ"}),e.jsxs(Pe,{value:l.mode,onValueChange:S=>r({...l,mode:S}),children:[e.jsx(Ie,{children:e.jsx(Fe,{placeholder:"้€‰ๆ‹ฉ่ฟ่กŒๆจกๅผ"})}),e.jsxs(Be,{children:[e.jsx(W,{value:"development",children:"ๅผ€ๅ‘ๆจกๅผ"}),e.jsx(W,{value:"production",children:"็”Ÿไบงๆจกๅผ"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆณจๆ„: WebUI ็š„็›‘ๅฌๅœฐๅ€ๅ’Œ็ซฏๅฃ่ฏทๅœจ .env ๆ–‡ไปถไธญ้…็ฝฎ WEBUI_HOST ๅ’Œ WEBUI_PORT"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"้˜ฒ็ˆฌ่™ซๆจกๅผ"}),e.jsxs(Pe,{value:l.anti_crawler_mode,onValueChange:S=>r({...l,anti_crawler_mode:S}),children:[e.jsx(Ie,{children:e.jsx(Fe,{placeholder:"้€‰ๆ‹ฉ้˜ฒ็ˆฌ่™ซๆจกๅผ"})}),e.jsxs(Be,{children:[e.jsx(W,{value:"false",children:"็ฆ็”จ"}),e.jsx(W,{value:"basic",children:"ๅŸบ็ก€๏ผˆๅช่ฎฐๅฝ•ไธ้˜ปๆญข๏ผ‰"}),e.jsx(W,{value:"loose",children:"ๅฎฝๆพ"}),e.jsx(W,{value:"strict",children:"ไธฅๆ ผ"})]})]})]}),e.jsxs("div",{className:"grid gap-2 sm:col-span-2",children:[e.jsx(T,{children:"IP ็™ฝๅๅ•"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{value:c,onChange:S=>d(S.target.value),onKeyDown:S=>{S.key==="Enter"&&(S.preventDefault(),j())},placeholder:"่พ“ๅ…ฅIPๅœฐๅ€ๅŽๆŒ‰ๅ›ž่ฝฆๆˆ–็‚นๅ‡ปๆทปๅŠ "}),e.jsx(_,{type:"button",size:"sm",onClick:j,disabled:!c.trim(),children:e.jsx(Xs,{className:"h-4 w-4"})})]}),g.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:g.map((S,F)=>e.jsxs(Ce,{variant:"secondary",className:"flex items-center gap-1",children:[S,e.jsx("button",{type:"button",onClick:()=>b(F),className:"ml-1 hover:bg-destructive/20 rounded-full p-0.5",children:e.jsx(Sa,{className:"h-3 w-3"})})]},F))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆ”ฏๆŒ็ฒพ็กฎIPใ€CIDRๆ ผๅผๅ’Œ้€š้…็ฌฆ๏ผˆๅฆ‚๏ผš127.0.0.1ใ€192.168.1.0/24๏ผ‰"})]}),e.jsxs("div",{className:"grid gap-2 sm:col-span-2",children:[e.jsx(T,{children:"ไฟกไปป็š„ไปฃ็† IP"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{value:m,onChange:S=>h(S.target.value),onKeyDown:S=>{S.key==="Enter"&&(S.preventDefault(),y())},placeholder:"่พ“ๅ…ฅไปฃ็†IPๅŽๆŒ‰ๅ›ž่ฝฆๆˆ–็‚นๅ‡ปๆทปๅŠ "}),e.jsx(_,{type:"button",size:"sm",onClick:y,disabled:!m.trim(),children:e.jsx(Xs,{className:"h-4 w-4"})})]}),N.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:N.map((S,F)=>e.jsxs(Ce,{variant:"secondary",className:"flex items-center gap-1",children:[S,e.jsx("button",{type:"button",onClick:()=>w(F),className:"ml-1 hover:bg-destructive/20 rounded-full p-0.5",children:e.jsx(Sa,{className:"h-3 w-3"})})]},F))}),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(qe,{checked:l.trust_xff,onCheckedChange:S=>r({...l,trust_xff:S})}),e.jsx(T,{className:"cursor-pointer",children:"ๅฏ็”จ X-Forwarded-For ไปฃ็†่งฃๆž"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qe,{checked:l.secure_cookie,onCheckedChange:S=>r({...l,secure_cookie:S})}),e.jsx(T,{className:"cursor-pointer",children:"ๅฏ็”จๅฎ‰ๅ…จ Cookie๏ผˆไป… HTTPS๏ผ‰"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qe,{checked:l.enable_paragraph_content,onCheckedChange:S=>r({...l,enable_paragraph_content:S})}),e.jsx(T,{className:"cursor-pointer",children:"ๅœจ็Ÿฅ่ฏ†ๅ›พ่ฐฑไธญๅŠ ่ฝฝๆฎต่ฝๅฎŒๆ•ดๅ†…ๅฎน"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅฏ็”จๅŽ๏ผŒ็Ÿฅ่ฏ†ๅ›พ่ฐฑๅฏ่ง†ๅŒ–็•Œ้ขไผšๆ˜พ็คบๆฎต่ฝ่Š‚็‚น็š„ๅฎŒๆ•ดๅ†…ๅฎนใ€‚้œ€่ฆๅŠ ่ฝฝ embedding store๏ผŒไผšๅ ็”จ้ขๅค–ๅ†…ๅญ˜๏ผˆ็บฆๆ•ฐ็™พMB๏ผ‰ใ€‚"})]})]})]}),e.jsx(bs,{open:f,onOpenChange:p,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"่ญฆๅ‘Š๏ผšๅณๅฐ†ๅ…ณ้—ญ WebUI"}),e.jsxs(gs,{children:["ๅ…ณ้—ญ WebUI ๅŽ๏ผŒๅœจๆ‚จไธ‹ๆฌก้‡ๅฏ้บฆ้บฆไน‹ๅ‰๏ผŒWebUI ็•Œ้ขๅฐ†ๆ— ๆณ•่ฎฟ้—ฎใ€‚",e.jsx("br",{}),e.jsx("br",{}),"ๆ‚จ้œ€่ฆ้€š่ฟ‡ไฟฎๆ”น้…็ฝฎๆ–‡ไปถๆˆ–ๅ‘ฝไปค่กŒ้‡ๆ–ฐๅฏ็”จ WebUI ๆ‰่ƒฝๅ†ๆฌก่ฎฟ้—ฎๆญค็•Œ้ขใ€‚",e.jsx("br",{}),e.jsx("br",{}),"็กฎๅฎš่ฆๅ…ณ้—ญ WebUI ๅ—๏ผŸ"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{variant:"destructive",onClick:M,children:"็กฎ่ฎคๅ…ณ้—ญ"})]})]})})]})}),En="/api/webui/config";async function Hg(){const l=await(await ke(`${En}/bot`)).json();if(!l.success)throw new Error("่Žทๅ–้…็ฝฎๆ•ฐๆฎๅคฑ่ดฅ");return l.config}async function Nn(){const l=await(await ke(`${En}/model`)).json();if(!l.success)throw new Error("่Žทๅ–ๆจกๅž‹้…็ฝฎๆ•ฐๆฎๅคฑ่ดฅ");return l.config}async function qg(a){const r=await(await ke(`${En}/bot`,{method:"POST",body:JSON.stringify(a)})).json();if(!r.success)throw new Error(r.message||"ไฟๅญ˜้…็ฝฎๅคฑ่ดฅ")}async function jS(){const l=await(await ke(`${En}/bot/raw`)).json();if(!l.success)throw new Error("่Žทๅ–้…็ฝฎๆบไปฃ็ ๅคฑ่ดฅ");return l.content}async function vS(a){const r=await(await ke(`${En}/bot/raw`,{method:"POST",body:JSON.stringify({raw_content:a})})).json();if(!r.success)throw new Error(r.message||"ไฟๅญ˜้…็ฝฎๅคฑ่ดฅ")}async function lc(a){const r=await(await ke(`${En}/model`,{method:"POST",body:JSON.stringify(a)})).json();if(!r.success)throw new Error(r.message||"ไฟๅญ˜้…็ฝฎๅคฑ่ดฅ")}async function NS(a,l){const c=await(await ke(`${En}/bot/section/${a}`,{method:"POST",body:JSON.stringify(l)})).json();if(!c.success)throw new Error(c.message||`ไฟๅญ˜้…็ฝฎ่Š‚ ${a} ๅคฑ่ดฅ`)}async function Wm(a,l){const c=await(await ke(`${En}/model/section/${a}`,{method:"POST",body:JSON.stringify(l)})).json();if(!c.success)throw new Error(c.message||`ไฟๅญ˜้…็ฝฎ่Š‚ ${a} ๅคฑ่ดฅ`)}async function bS(a,l="openai",r="/models"){const c=new URLSearchParams({provider_name:a,parser:l,endpoint:r}),d=await ke(`/api/webui/models/list?${c}`);if(!d.ok){const h=await d.json().catch(()=>({}));throw new Error(h.detail||`่Žทๅ–ๆจกๅž‹ๅˆ—่กจๅคฑ่ดฅ (${d.status})`)}const m=await d.json();if(!m.success)throw new Error("่Žทๅ–ๆจกๅž‹ๅˆ—่กจๅคฑ่ดฅ");return m.models}async function yS(a){const l=new URLSearchParams({provider_name:a}),r=await ke(`/api/webui/models/test-connection-by-name?${l}`,{method:"POST"});if(!r.ok){const c=await r.json().catch(()=>({}));throw new Error(c.detail||`ๆต‹่ฏ•่ฟžๆŽฅๅคฑ่ดฅ (${r.status})`)}return await r.json()}const wS=ti("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"}}),ht=u.forwardRef(({className:a,variant:l,...r},c)=>e.jsx("div",{ref:c,role:"alert",className:P(wS({variant:l}),a),...r}));ht.displayName="Alert";const Jn=u.forwardRef(({className:a,...l},r)=>e.jsx("h5",{ref:r,className:P("mb-1 font-medium leading-none tracking-tight",a),...l}));Jn.displayName="AlertTitle";const ft=u.forwardRef(({className:a,...l},r)=>e.jsx("div",{ref:r,className:P("text-sm [&_p]:leading-relaxed",a),...l}));ft.displayName="AlertDescription";const _S={name:"toml",startState:function(){return{inString:!1,stringType:"",lhs:!0,inArray:0}},token:function(a,l){let r;if(!l.inString&&(r=a.match(/^('''|"""|'|")/))&&(l.stringType=r[0],l.inString=!0),a.sol()&&!l.inString&&l.inArray===0&&(l.lhs=!0),l.inString){for(;l.inString;)if(a.match(l.stringType))l.inString=!1;else if(a.peek()==="\\")a.next(),a.next();else{if(a.eol())break;a.match(/^.[^\\\"\']*/)}return l.lhs?"property":"string"}else{if(l.inArray&&a.peek()==="]")return a.next(),l.inArray--,"bracket";if(l.lhs&&a.peek()==="["&&a.skipTo("]"))return a.next(),a.peek()==="]"&&a.next(),"atom";if(a.peek()==="#")return a.skipToEnd(),"comment";if(a.eatSpace())return null;if(l.lhs&&a.eatWhile(function(c){return c!="="&&c!=" "}))return"property";if(l.lhs&&a.peek()==="=")return a.next(),l.lhs=!1,null;if(!l.lhs&&a.match(/^\d\d\d\d[\d\-\:\.T]*Z/))return"atom";if(!l.lhs&&(a.match("true")||a.match("false")))return"atom";if(!l.lhs&&a.peek()==="[")return l.inArray++,a.next(),"bracket";if(!l.lhs&&a.match(/^\-?\d+(?:\.\d+)?/))return"number";a.eatSpace()||a.next()}return null},languageData:{commentTokens:{line:"#"}}},SS={python:[d1()],json:[u1(),m1()],toml:[o1.define(_S)],text:[]};function Qv({value:a,onChange:l,language:r="text",readOnly:c=!1,height:d="400px",minHeight:m,maxHeight:h,placeholder:f,theme:p="dark",className:g=""}){const[N,j]=u.useState(!1);if(u.useEffect(()=>{j(!0)},[]),!N)return e.jsx("div",{className:`rounded-md border bg-muted animate-pulse ${g}`,style:{height:d,minHeight:m,maxHeight:h}});const b=[...SS[r]||[],zm.lineWrapping,zm.theme({"&":{fontFamily:'"JetBrains Mono", "Fira Code", "Consolas", "Monaco", monospace'},".cm-content":{fontFamily:'"JetBrains Mono", "Fira Code", "Consolas", "Monaco", monospace'},".cm-gutters":{fontFamily:'"JetBrains Mono", "Fira Code", "Consolas", "Monaco", monospace'},".cm-scroller":{fontFamily:'"JetBrains Mono", "Fira Code", "Consolas", "Monaco", monospace'}})];return c&&b.push(zm.editable.of(!1)),e.jsx("div",{className:`rounded-md overflow-hidden border custom-scrollbar ${g}`,children:e.jsx(x1,{value:a,height:d,minHeight:m,maxHeight:h,theme:p==="dark"?h1:void 0,extensions:b,onChange:l,placeholder:f,basicSetup:{lineNumbers:!0,highlightActiveLineGutter:!0,highlightSpecialChars:!0,history:!0,foldGutter:!0,drawSelection:!0,dropCursor:!0,allowMultipleSelections:!0,indentOnInput:!0,syntaxHighlighting:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,rectangularSelection:!0,crosshairCursor:!0,highlightActiveLine:!0,highlightSelectionMatches:!0,closeBracketsKeymap:!0,defaultKeymap:!0,searchKeymap:!0,historyKeymap:!0,foldKeymap:!0,completionKeymap:!0,lintKeymap:!0}})})}function kS({id:a,index:l,itemType:r,itemFields:c,value:d,onChange:m,onRemove:h,disabled:f,canRemove:p,placeholder:g}){const{attributes:N,listeners:j,setNodeRef:b,transform:y,transition:w,isDragging:z}=Cv({id:a,disabled:f}),M={transform:Tv.Transform.toString(y),transition:w};return e.jsxs("div",{ref:b,style:M,className:P("flex items-start gap-2 group",z&&"opacity-50 z-50"),children:[e.jsx("button",{type:"button",className:P("flex-shrink-0 p-2 cursor-grab active:cursor-grabbing","text-muted-foreground hover:text-foreground transition-colors","opacity-0 group-hover:opacity-100 focus:opacity-100",f&&"cursor-not-allowed opacity-30"),...N,...j,children:e.jsx(dv,{className:"h-4 w-4"})}),e.jsx("div",{className:"flex-1 min-w-0",children:r==="object"&&c?e.jsx(CS,{value:d,onChange:m,fields:c,disabled:f}):r==="number"?e.jsx(ae,{type:"number",value:d??"",onChange:S=>m(parseFloat(S.target.value)||0),placeholder:g??`็ฌฌ ${l+1} ้กน`,disabled:f,className:"font-mono"}):e.jsx(ae,{type:"text",value:d??"",onChange:S=>m(S.target.value),placeholder:g??`็ฌฌ ${l+1} ้กน`,disabled:f})}),e.jsx(_,{type:"button",variant:"ghost",size:"icon",onClick:h,disabled:f||!p,className:P("flex-shrink-0 text-muted-foreground hover:text-destructive","opacity-0 group-hover:opacity-100 focus:opacity-100 transition-opacity"),children:e.jsx(os,{className:"h-4 w-4"})})]})}function CS({value:a,onChange:l,fields:r,disabled:c}){const d=u.useCallback((h,f)=>{l({...a,[h]:f})},[a,l]),m=(h,f)=>{const p=a?.[h];if(f.type==="boolean"||f.type==="switch")return e.jsxs("div",{className:"flex items-center justify-between py-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsx(qe,{checked:!!(p??f.default),onCheckedChange:g=>d(h,g),disabled:c})]});if(f.type==="slider"||f.type==="number"&&f.min!=null&&f.max!=null){const g=p??f.default??f.min??0;return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsx("span",{className:"text-xs text-muted-foreground",children:g})]}),e.jsx(el,{value:[g],onValueChange:N=>d(h,N[0]),min:f.min??0,max:f.max??100,step:f.step??1,disabled:c,className:"py-1"})]})}return f.type==="select"&&f.choices?e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsxs(Pe,{value:String(p??f.default??""),onValueChange:g=>d(h,g),disabled:c,children:[e.jsx(Ie,{className:"h-8 text-sm",children:e.jsx(Fe,{placeholder:f.placeholder??"่ฏท้€‰ๆ‹ฉ"})}),e.jsx(Be,{children:f.choices.map(g=>e.jsx(W,{value:String(g),children:String(g)},String(g)))})]})]}):f.type==="number"?e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsx(ae,{type:"number",value:p??f.default??"",onChange:g=>d(h,parseFloat(g.target.value)||0),placeholder:f.placeholder,disabled:c,className:"h-8 text-sm"})]}):e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:f.label??h}),e.jsx(ae,{type:"text",value:p??f.default??"",onChange:g=>d(h,g.target.value),placeholder:f.placeholder,disabled:c,className:"h-8 text-sm"})]})};return e.jsx(Te,{className:"p-3 space-y-2 bg-muted/30",children:Object.entries(r).map(([h,f])=>e.jsx("div",{children:m(h,f)},h))})}function TS({value:a,onChange:l,itemType:r="string",itemFields:c,minItems:d,maxItems:m,disabled:h,placeholder:f}){const p=u.useMemo(()=>Array.isArray(a)?a:typeof a=="string"&&a.trim()?a.split(",").map(E=>E.trim()):[],[a]),[g]=u.useState(()=>new Map),N=u.useCallback(E=>(g.has(E)||g.set(E,`item-${Date.now()}-${E}-${Math.random().toString(36).slice(2)}`),g.get(E)),[g]),j=u.useMemo(()=>{const E=[];for(let C=0;C{const{active:C,over:R}=E;if(R&&C.id!==R.id){const H=j.indexOf(C.id),O=j.indexOf(R.id),X=wv(p,H,O);l(X)}},[p,j,l]),w=u.useCallback(()=>{if(m!=null&&p.length>=m)return;let E;r==="object"&&c?E=Object.fromEntries(Object.entries(c).map(([C,R])=>[C,R.default??""])):r==="number"?E=0:E="",l([...p,E])},[p,m,r,c,l]),z=u.useCallback((E,C)=>{const R=[...p];R[E]=C,l(R)},[p,l]),M=u.useCallback(E=>{if(d!=null&&p.length<=d)return;const C=p.filter((R,H)=>H!==E);g.delete(E),l(C)},[p,d,g,l]),S=m==null||p.lengthd;return e.jsxs("div",{className:"space-y-2",children:[p.length===0?e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground py-4 justify-center border border-dashed rounded-md",children:[e.jsx(Ut,{className:"h-4 w-4"}),e.jsx("span",{children:"ๆš‚ๆ— ๆ•ฐๆฎ๏ผŒ็‚นๅ‡ปไธ‹ๆ–นๆŒ‰้’ฎๆทปๅŠ "})]}):e.jsx(_v,{sensors:b,collisionDetection:Sv,onDragEnd:y,children:e.jsx(kv,{items:j,strategy:f1,children:e.jsx("div",{className:"space-y-2",children:p.map((E,C)=>e.jsx(kS,{id:j[C],index:C,itemType:r,itemFields:c,value:E,onChange:R=>z(C,R),onRemove:()=>M(C),disabled:h,canRemove:F,placeholder:f},j[C]))})})}),e.jsxs(_,{type:"button",variant:"outline",size:"sm",onClick:w,disabled:h||!S,className:"w-full",children:[e.jsx(Xs,{className:"h-4 w-4 mr-1"}),"ๆทปๅŠ ้กน็›ฎ",m!==void 0&&e.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(",p.length,"/",m,")"]})]}),(d!=null||m!=null)&&(d!==null||m!==null)&&e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:d!=null&&m!=null?`ๅ…่ฎธ ${d} - ${m} ้กน`:d!=null?`่‡ณๅฐ‘ ${d} ้กน`:`ๆœ€ๅคš ${m} ้กน`})]})}function bx({content:a,className:l=""}){return e.jsx("div",{className:`prose prose-sm dark:prose-invert max-w-none ${l}`,children:e.jsx(b1,{remarkPlugins:[w1,_1],rehypePlugins:[y1],components:{code({inline:r,className:c,children:d,...m}){return r?e.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-sm font-mono",...m,children:d}):e.jsx("code",{className:`${c} block bg-muted p-4 rounded-lg overflow-x-auto`,...m,children:d})},table({children:r,...c}){return e.jsx("div",{className:"overflow-x-auto",children:e.jsx("table",{className:"border-collapse border border-border",...c,children:r})})},th({children:r,...c}){return e.jsx("th",{className:"border border-border bg-muted px-4 py-2 text-left font-semibold",...c,children:r})},td({children:r,...c}){return e.jsx("td",{className:"border border-border px-4 py-2",...c,children:r})},a({children:r,...c}){return e.jsx("a",{className:"text-primary hover:underline",target:"_blank",rel:"noopener noreferrer",...c,children:r})},blockquote({children:r,...c}){return e.jsx("blockquote",{className:"border-l-4 border-primary pl-4 italic text-muted-foreground",...c,children:r})},h1({children:r,...c}){return e.jsx("h1",{className:"text-3xl font-bold mt-6 mb-4",...c,children:r})},h2({children:r,...c}){return e.jsx("h2",{className:"text-2xl font-bold mt-5 mb-3",...c,children:r})},h3({children:r,...c}){return e.jsx("h3",{className:"text-xl font-bold mt-4 mb-2",...c,children:r})},h4({children:r,...c}){return e.jsx("h4",{className:"text-lg font-semibold mt-3 mb-2",...c,children:r})},ul({children:r,...c}){return e.jsx("ul",{className:"list-disc list-inside space-y-1 my-2",...c,children:r})},ol({children:r,...c}){return e.jsx("ol",{className:"list-decimal list-inside space-y-1 my-2",...c,children:r})},p({children:r,...c}){return e.jsx("p",{className:"my-2 leading-relaxed",...c,children:r})},hr({...r}){return e.jsx("hr",{className:"my-4 border-border",...r})}},children:a})})}function ES(a,l){let r=a.slice(0,l).split(/\r\n|\n|\r/g);return[r.length,r.pop().length+1]}function MS(a,l,r){let c=a.split(/\r\n|\n|\r/g),d="",m=(Math.log10(l+1)|0)+1;for(let h=l-1;h<=l+1;h++){let f=c[h-1];f&&(d+=h.toString().padEnd(m," "),d+=": ",d+=f,d+=` `,h===l&&(d+=" ".repeat(m+r+2),d+=`^ `))}return d}class Ds extends Error{line;column;codeblock;constructor(l,r){const[c,d]=ES(r.toml,r.ptr),m=MS(r.toml,c,d);super(`Invalid TOML document: ${l} @@ -47,8 +47,8 @@ ${m}`,r),this.line=c,this.column=d,this.codeblock=m}}function AS(a,l){let r=0;fo `){if(!d)throw new Ds("newlines are not allowed in strings",{toml:a,ptr:l-1})}else if(g<" "&&g!==" "||g==="")throw new Ds("control characters are not allowed in strings",{toml:a,ptr:l-1});if(h){if(h=!1,g==="u"||g==="U"){let N=a.slice(l,l+=g==="u"?4:8);if(!LS.test(N))throw new Ds("invalid unicode escape",{toml:a,ptr:m});try{f+=String.fromCodePoint(parseInt(N,16))}catch{throw new Ds("invalid unicode escape",{toml:a,ptr:m})}}else if(d&&(g===` `||g===" "||g===" "||g==="\r")){if(l=Pl(a,l-1,!0),a[l]!==` `&&a[l]!=="\r")throw new Ds("invalid escape: only line-ending whitespace may be escaped",{toml:a,ptr:m});l=Pl(a,l)}else if(g in Gg)f+=Gg[g];else throw new Ds("unrecognized escape sequence",{toml:a,ptr:m});p=l}else!c&&g==="\\"&&(m=l-1,h=!0,f+=a.slice(p,m))}return f+a.slice(p,r-1)}function US(a,l,r,c){if(a==="true")return!0;if(a==="false")return!1;if(a==="-inf")return-1/0;if(a==="inf"||a==="+inf")return 1/0;if(a==="nan"||a==="+nan"||a==="-nan")return NaN;if(a==="-0")return c?0n:0;let d=RS.test(a);if(d||DS.test(a)){if(OS.test(a))throw new Ds("leading zeroes are not allowed",{toml:l,ptr:r});a=a.replace(/_/g,"");let h=+a;if(isNaN(h))throw new Ds("invalid number",{toml:l,ptr:r});if(d){if((d=!Number.isSafeInteger(h))&&!c)throw new Ds("integer value cannot be represented losslessly",{toml:l,ptr:r});(d||c===!0)&&(h=BigInt(a))}return h}const m=new Jr(a);if(!m.isValid())throw new Ds("invalid value",{toml:l,ptr:r});return m}function $S(a,l,r,c){let d=a.slice(l,r),m=d.indexOf("#");m>-1&&(yx(a,m),d=d.slice(0,m));let h=d.trimEnd();if(!c){let f=d.indexOf(` -`,h.length);if(f>-1)throw new Ds("newlines are not allowed in inline tables",{toml:a,ptr:l+f})}return[h,m]}function wx(a,l,r,c,d){if(c===0)throw new Ds("document contains excessively nested structures. aborting.",{toml:a,ptr:l});let m=a[l];if(m==="["||m==="{"){let[p,g]=m==="["?PS(a,l,c,d):IS(a,l,c,d),N=r?Vg(a,g,",",r):g;if(g-N&&r==="}"){let j=Xo(a,g,N);if(j>-1)throw new Ds("newlines are not allowed in inline tables",{toml:a,ptr:j})}return[p,N]}let h;if(m==='"'||m==="'"){h=Yv(a,l);let p=Jv(a,l,h);if(r){if(h=Pl(a,h,r!=="]"),a[h]&&a[h]!==","&&a[h]!==r&&a[h]!==` -`&&a[h]!=="\r")throw new Ds("unexpected character encountered",{toml:a,ptr:h});h+=+(a[h]===",")}return[p,h]}h=Vg(a,l,",",r);let f=$S(a,l,h-+(a[h-1]===","),r==="]");if(!f[0])throw new Ds("incomplete key-value declaration: no value specified",{toml:a,ptr:l});return r&&f[1]>-1&&(h=Pl(a,l+f[1]),h+=+(a[h]===",")),[US(f[0],a,l,d),h]}let BS=/^[a-zA-Z0-9-_]+[ \t]*$/;function ex(a,l,r="="){let c=l-1,d=[],m=a.indexOf(r,l);if(m<0)throw new Ds("incomplete key-value: cannot find end of key",{toml:a,ptr:l});do{let h=a[l=++c];if(h!==" "&&h!==" ")if(h==='"'||h==="'"){if(h===a[l+1]&&h===a[l+2])throw new Ds("multiline strings are not allowed in keys",{toml:a,ptr:l});let f=Yv(a,l);if(f<0)throw new Ds("unfinished string encountered",{toml:a,ptr:l});c=a.indexOf(".",f);let p=a.slice(f,c<0||c>m?m:c),g=Xo(p);if(g>-1)throw new Ds("newlines are not allowed in keys",{toml:a,ptr:l+c+g});if(p.trimStart())throw new Ds("found extra tokens after the string part",{toml:a,ptr:f});if(mm?m:c);if(!BS.test(f))throw new Ds("only letter, numbers, dashes and underscores are allowed in keys",{toml:a,ptr:l});d.push(f.trimEnd())}}while(c+1&&c-1)throw new Ds("newlines are not allowed in inline tables",{toml:a,ptr:l+f})}return[h,m]}function wx(a,l,r,c,d){if(c===0)throw new Ds("document contains excessively nested structures. aborting.",{toml:a,ptr:l});let m=a[l];if(m==="["||m==="{"){let[p,g]=m==="["?PS(a,l,c,d):BS(a,l,c,d),N=r?Vg(a,g,",",r):g;if(g-N&&r==="}"){let j=Xo(a,g,N);if(j>-1)throw new Ds("newlines are not allowed in inline tables",{toml:a,ptr:j})}return[p,N]}let h;if(m==='"'||m==="'"){h=Yv(a,l);let p=Jv(a,l,h);if(r){if(h=Pl(a,h,r!=="]"),a[h]&&a[h]!==","&&a[h]!==r&&a[h]!==` +`&&a[h]!=="\r")throw new Ds("unexpected character encountered",{toml:a,ptr:h});h+=+(a[h]===",")}return[p,h]}h=Vg(a,l,",",r);let f=$S(a,l,h-+(a[h-1]===","),r==="]");if(!f[0])throw new Ds("incomplete key-value declaration: no value specified",{toml:a,ptr:l});return r&&f[1]>-1&&(h=Pl(a,l+f[1]),h+=+(a[h]===",")),[US(f[0],a,l,d),h]}let IS=/^[a-zA-Z0-9-_]+[ \t]*$/;function ex(a,l,r="="){let c=l-1,d=[],m=a.indexOf(r,l);if(m<0)throw new Ds("incomplete key-value: cannot find end of key",{toml:a,ptr:l});do{let h=a[l=++c];if(h!==" "&&h!==" ")if(h==='"'||h==="'"){if(h===a[l+1]&&h===a[l+2])throw new Ds("multiline strings are not allowed in keys",{toml:a,ptr:l});let f=Yv(a,l);if(f<0)throw new Ds("unfinished string encountered",{toml:a,ptr:l});c=a.indexOf(".",f);let p=a.slice(f,c<0||c>m?m:c),g=Xo(p);if(g>-1)throw new Ds("newlines are not allowed in keys",{toml:a,ptr:l+c+g});if(p.trimStart())throw new Ds("found extra tokens after the string part",{toml:a,ptr:f});if(mm?m:c);if(!IS.test(f))throw new Ds("only letter, numbers, dashes and underscores are allowed in keys",{toml:a,ptr:l});d.push(f.trimEnd())}}while(c+1&&c{try{l(!0),await NS(b,y),r(!1),m?.()}catch(w){console.error(`่‡ชๅŠจไฟๅญ˜ ${b} ๅคฑ่ดฅ:`,w),r(!0),h?.(w instanceof Error?w:new Error(String(w)))}finally{l(!1)}},[l,r,m,h]),g=u.useCallback((b,y)=>{a||(r(!0),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{p(b,y)},d))},[a,r,p,d]),N=u.useCallback(async(b,y)=>{f.current&&(clearTimeout(f.current),f.current=null),await p(b,y)},[p]),j=u.useCallback(()=>{f.current&&(clearTimeout(f.current),f.current=null)},[]);return u.useEffect(()=>()=>{f.current&&clearTimeout(f.current)},[]),{triggerAutoSave:g,saveNow:N,cancelPendingAutoSave:j}}function Vt(a,l,r,c){u.useEffect(()=>{a&&!r&&c(l,a)},[a])}const QS=500;function YS(){return e.jsx(lr,{children:e.jsx(JS,{})})}function JS(){const[a,l]=u.useState(!0),[r,c]=u.useState(!1),[d,m]=u.useState(!1),[h,f]=u.useState(!1),[p,g]=u.useState("visual"),[N,j]=u.useState(""),[b,y]=u.useState(!1),[w,z]=u.useState(""),{toast:M}=nt(),{triggerRestart:S,isRestarting:F}=Tn(),[E,C]=u.useState(null),[R,H]=u.useState(null),[O,X]=u.useState(null),[L,me]=u.useState(null),[Ne,je]=u.useState(null),[ce,ge]=u.useState(null),[pe,D]=u.useState(null),[Q,B]=u.useState(null),[ue,Y]=u.useState(null),[we,fe]=u.useState(null),[Ee,G]=u.useState(null),[$,A]=u.useState(null),[K,Re]=u.useState(null),[se,$e]=u.useState(null),[cs,J]=u.useState(null),[Z,Le]=u.useState(null),[le,De]=u.useState(null),[xe,Me]=u.useState(null),[ds,Ts]=u.useState(null),[Ct,ia]=u.useState(null),[ut,Is]=u.useState(null),V=u.useRef(!0),Ke=u.useRef({}),He=Ae=>{const Qe=Ae.split(` +`:c}function KS(a,l,r,c={}){const{debounceMs:d=2e3,onSaveSuccess:m,onSaveError:h}=c,f=u.useRef(null),p=u.useCallback(async(b,y)=>{try{l(!0),await NS(b,y),r(!1),m?.()}catch(w){console.error(`่‡ชๅŠจไฟๅญ˜ ${b} ๅคฑ่ดฅ:`,w),r(!0),h?.(w instanceof Error?w:new Error(String(w)))}finally{l(!1)}},[l,r,m,h]),g=u.useCallback((b,y)=>{a||(r(!0),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{p(b,y)},d))},[a,r,p,d]),N=u.useCallback(async(b,y)=>{f.current&&(clearTimeout(f.current),f.current=null),await p(b,y)},[p]),j=u.useCallback(()=>{f.current&&(clearTimeout(f.current),f.current=null)},[]);return u.useEffect(()=>()=>{f.current&&clearTimeout(f.current)},[]),{triggerAutoSave:g,saveNow:N,cancelPendingAutoSave:j}}function Vt(a,l,r,c){u.useEffect(()=>{a&&!r&&c(l,a)},[a])}const QS=500;function YS(){return e.jsx(lr,{children:e.jsx(JS,{})})}function JS(){const[a,l]=u.useState(!0),[r,c]=u.useState(!1),[d,m]=u.useState(!1),[h,f]=u.useState(!1),[p,g]=u.useState("visual"),[N,j]=u.useState(""),[b,y]=u.useState(!1),[w,z]=u.useState(""),{toast:M}=nt(),{triggerRestart:S,isRestarting:F}=Tn(),[E,C]=u.useState(null),[R,H]=u.useState(null),[O,X]=u.useState(null),[L,me]=u.useState(null),[Ne,je]=u.useState(null),[re,ge]=u.useState(null),[pe,D]=u.useState(null),[Q,I]=u.useState(null),[ue,Y]=u.useState(null),[we,fe]=u.useState(null),[Ee,G]=u.useState(null),[$,A]=u.useState(null),[K,Re]=u.useState(null),[se,$e]=u.useState(null),[cs,J]=u.useState(null),[Z,Le]=u.useState(null),[ne,De]=u.useState(null),[xe,Me]=u.useState(null),[ds,Ts]=u.useState(null),[Ct,ia]=u.useState(null),[ut,Bs]=u.useState(null),V=u.useRef(!0),Ke=u.useRef({}),He=Ae=>{const Qe=Ae.split(` `);let As=Qe[0];As=As.replace(/^Error:\s*/,"");const mt=[[/Invalid TOML document: unrecognized escape sequence/,"TOML ๆ–‡ๆกฃ้”™่ฏฏ๏ผšๆ— ๆณ•่ฏ†ๅˆซ็š„่ฝฌไน‰ๅบๅˆ—๏ผˆๆ็คบ๏ผšๅœจๅŒๅผ•ๅทๅญ—็ฌฆไธฒไธญไฝฟ็”จ \\\\ ่ฝฌไน‰ๅๆ–œๆ ๏ผŒๆˆ–ไฝฟ็”จๅ•ๅผ•ๅทๅญ—็ฌฆไธฒ๏ผ‰"],[/Invalid TOML document: only letter, numbers, dashes and underscores are allowed in keys/,"TOML ๆ–‡ๆกฃ้”™่ฏฏ๏ผš้”ฎๅๅช่ƒฝๅŒ…ๅซๅญ—ๆฏใ€ๆ•ฐๅญ—ใ€็Ÿญๆจช็บฟๅ’Œไธ‹ๅˆ’็บฟ"],[/Invalid TOML document: (.+)/,"TOML ๆ–‡ๆกฃ้”™่ฏฏ๏ผš$1"],[/Unexpected character.*at line (\d+), column (\d+)/,"็ฌฌ $1 ่กŒ็ฌฌ $2 ๅˆ—๏ผšๆ„ๅค–็š„ๅญ—็ฌฆ"],[/Expected.*at line (\d+), column (\d+)/,"็ฌฌ $1 ่กŒ็ฌฌ $2 ๅˆ—๏ผš็ผบๅฐ‘ๅฟ…่ฆ็š„ๅญ—็ฌฆ"],[/Invalid.*at line (\d+), column (\d+)/,"็ฌฌ $1 ่กŒ็ฌฌ $2 ๅˆ—๏ผšๆ— ๆ•ˆ็š„่ฏญๆณ•"],[/Unterminated string at line (\d+)/,"็ฌฌ $1 ่กŒ๏ผšๅญ—็ฌฆไธฒๆœชๆญฃๅธธ็ป“ๆŸ๏ผˆ็ผบๅฐ‘ๅผ•ๅท๏ผ‰"],[/Duplicate key.*at line (\d+)/,"็ฌฌ $1 ่กŒ๏ผš้‡ๅค็š„้”ฎๅ"],[/Invalid escape sequence at line (\d+)/,"็ฌฌ $1 ่กŒ๏ผšๆ— ๆ•ˆ็š„่ฝฌไน‰ๅบๅˆ—๏ผˆๆ็คบ๏ผšๅœจๅŒๅผ•ๅทๅญ—็ฌฆไธฒไธญไฝฟ็”จ \\\\ ่ฝฌไน‰ๅๆ–œๆ ๏ผ‰"],[/Expected.*but got.*at line (\d+)/,"็ฌฌ $1 ่กŒ๏ผš็ฑปๅž‹ไธๅŒน้…"],[/line (\d+), column (\d+)/,"็ฌฌ $1 ่กŒ็ฌฌ $2 ๅˆ—"],[/Unexpected end of input/,"ๆ„ๅค–็š„ๆ–‡ไปถ็ป“ๆŸ๏ผˆๅฏ่ƒฝ็ผบๅฐ‘้—ญๅˆ็ฌฆๅท๏ผ‰"],[/Unexpected token/,"ๆ„ๅค–็š„ๆ ‡่ฎฐ"],[/Invalid number/,"ๆ— ๆ•ˆ็š„ๆ•ฐๅญ—"],[/Invalid date/,"ๆ— ๆ•ˆ็š„ๆ—ฅๆœŸๆ ผๅผ"],[/Invalid boolean/,"ๆ— ๆ•ˆ็š„ๅธƒๅฐ”ๅ€ผ๏ผˆๅบ”ไธบ true ๆˆ– false๏ผ‰"],[/Unexpected character/,"ๆ„ๅค–็š„ๅญ—็ฌฆ"],[/unrecognized escape sequence/,"ๆ— ๆณ•่ฏ†ๅˆซ็š„่ฝฌไน‰ๅบๅˆ—"]];for(const[Ht,ca]of mt)if(Ht.test(As)){As=As.replace(Ht,ca);break}return Qe.length>1?(Qe[0]=As,Qe.join(` -`)):As},Je=u.useCallback(Ae=>{Ke.current=Ae,C(Ae.bot),H(Ae.personality);const Qe=Ae.chat;Qe.talk_value_rules||(Qe.talk_value_rules=[]),X(Qe),me(Ae.expression),je(Ae.emoji),ge(Ae.memory),D(Ae.tool),B(Ae.voice),Y(Ae.message_receive),fe(Ae.dream),G(Ae.lpmm_knowledge),A(Ae.keyword_reaction),Re(Ae.response_post_process),$e(Ae.chinese_typo),J(Ae.response_splitter),Le(Ae.log),De(Ae.debug),Me(Ae.experimental),Ts(Ae.maim_message),ia(Ae.telemetry),Is(Ae.webui)},[]),Es=u.useCallback(()=>({...Ke.current,bot:E,personality:R,chat:O,expression:L,emoji:Ne,memory:ce,tool:pe,voice:Q,message_receive:ue,dream:we,lpmm_knowledge:Ee,keyword_reaction:$,response_post_process:K,chinese_typo:se,response_splitter:cs,log:Z,debug:le,experimental:xe,maim_message:ds,telemetry:Ct,webui:ut}),[E,R,O,L,Ne,ce,pe,Q,ue,we,Ee,$,K,se,cs,Z,le,xe,ds,Ct,ut]),ms=u.useCallback(async()=>{try{const Qe=(await jS()).replace(/"([^"]*)"/g,(As,mt)=>`"${mt.replace(/\\n/g,` -`).replace(/\\t/g," ").replace(/\\r/g,"\r").replace(/\\"/g,'"').replace(/\\\\/g,"\\")}"`);j(Qe),y(!1)}catch(Ae){M({variant:"destructive",title:"ๅŠ ่ฝฝๅคฑ่ดฅ",description:Ae instanceof Error?Ae.message:"ๅŠ ่ฝฝๆบไปฃ็ ๅคฑ่ดฅ"})}},[M]),Ms=u.useCallback(async()=>{try{l(!0);const Ae=await Hg();Je(Ae),f(!1),V.current=!1,await ms()}catch(Ae){console.error("ๅŠ ่ฝฝ้…็ฝฎๅคฑ่ดฅ:",Ae),M({title:"ๅŠ ่ฝฝๅคฑ่ดฅ",description:"ๆ— ๆณ•ๅŠ ่ฝฝ้…็ฝฎๆ–‡ไปถ",variant:"destructive"})}finally{l(!1)}},[M,ms,Je]);u.useEffect(()=>{Ms()},[Ms]);const{triggerAutoSave:We,cancelPendingAutoSave:Cs}=KS(V.current,m,f);Vt(E,"bot",V.current,We),Vt(R,"personality",V.current,We),Vt(O,"chat",V.current,We),Vt(L,"expression",V.current,We),Vt(Ne,"emoji",V.current,We),Vt(ce,"memory",V.current,We),Vt(pe,"tool",V.current,We),Vt(Q,"voice",V.current,We),Vt(we,"dream",V.current,We),Vt(Ee,"lpmm_knowledge",V.current,We),Vt($,"keyword_reaction",V.current,We),Vt(K,"response_post_process",V.current,We),Vt(se,"chinese_typo",V.current,We),Vt(cs,"response_splitter",V.current,We),Vt(Z,"log",V.current,We),Vt(le,"debug",V.current,We),Vt(ds,"maim_message",V.current,We),Vt(Ct,"telemetry",V.current,We),Vt(ut,"webui",V.current,We);const rs=async()=>{try{c(!0);try{_x(N)}catch(Qe){const As=Qe instanceof Error?Qe.message:"TOML ๆ ผๅผ้”™่ฏฏ",mt=He(As);y(!0),z(mt),M({variant:"destructive",title:"TOML ๆ ผๅผ้”™่ฏฏ",description:mt}),c(!1);return}const Ae=N.replace(/"([^"]*)"/g,(Qe,As)=>`"${As.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r")}"`);await vS(Ae),f(!1),y(!1),z(""),M({title:"ไฟๅญ˜ๆˆๅŠŸ",description:"้…็ฝฎๅทฒไฟๅญ˜"}),await Ms()}catch(Ae){y(!0);const Qe=Ae instanceof Error?Ae.message:"ไฟๅญ˜้…็ฝฎๅคฑ่ดฅ";z(Qe),M({variant:"destructive",title:"ไฟๅญ˜ๅคฑ่ดฅ",description:Qe})}finally{c(!1)}},is=async Ae=>{if(h){M({variant:"destructive",title:"ๅˆ‡ๆขๅคฑ่ดฅ",description:"่ฏทๅ…ˆไฟๅญ˜ๅฝ“ๅ‰ๆ›ดๆ”น"});return}if(g(Ae),Ae==="source")await ms();else try{const Qe=await Hg();Je(Qe),f(!1)}catch(Qe){console.error("ๅŠ ่ฝฝ้…็ฝฎๅคฑ่ดฅ:",Qe),M({title:"ๅŠ ่ฝฝๅคฑ่ดฅ",description:"ๆ— ๆณ•ๅŠ ่ฝฝ้…็ฝฎๆ–‡ไปถ",variant:"destructive"})}},ys=async()=>{try{c(!0),Cs(),await qg(Es()),f(!1),M({title:"ไฟๅญ˜ๆˆๅŠŸ",description:"้บฆ้บฆไธป็จ‹ๅบ้…็ฝฎๅทฒไฟๅญ˜"})}catch(Ae){console.error("ไฟๅญ˜้…็ฝฎๅคฑ่ดฅ:",Ae),M({title:"ไฟๅญ˜ๅคฑ่ดฅ",description:Ae.message,variant:"destructive"})}finally{c(!1)}},rt=async()=>{await S()},jt=async()=>{try{c(!0),Cs(),await qg(Es()),f(!1),M({title:"ไฟๅญ˜ๆˆๅŠŸ",description:"้…็ฝฎๅทฒไฟๅญ˜๏ผŒๅณๅฐ†้‡ๅฏ้บฆ้บฆ..."}),await new Promise(Ae=>setTimeout(Ae,QS)),await rt()}catch(Ae){console.error("ไฟๅญ˜ๅคฑ่ดฅ:",Ae),M({title:"ไฟๅญ˜ๅคฑ่ดฅ",description:Ae.message,variant:"destructive"})}finally{c(!1)}};return a?e.jsx(ts,{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(ts,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:gap-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl md:text-3xl font-bold",children:"้บฆ้บฆไธป็จ‹ๅบ้…็ฝฎ"}),e.jsx("p",{className:"text-muted-foreground mt-1 text-xs sm:text-sm",children:"็ฎก็†้บฆ้บฆ็š„ๆ ธๅฟƒๅŠŸ่ƒฝๅ’Œ่กŒไธบ่ฎพ็ฝฎ"})]}),e.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[e.jsxs(_,{onClick:p==="visual"?ys:rs,disabled:r||d||!h||F,size:"sm",variant:"outline",className:"w-20 sm:w-24",children:[e.jsx(gc,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),e.jsx("span",{className:"ml-1 truncate text-xs sm:text-sm",children:r?"ไฟๅญ˜ไธญ":d?"่‡ชๅŠจ":h?"ไฟๅญ˜":"ๅทฒไฟๅญ˜"})]}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{disabled:r||d||F,size:"sm",className:"w-20 sm:w-28",children:[e.jsx(pc,{className:"h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"ml-1 truncate text-xs sm:text-sm",children:F?"้‡ๅฏไธญ":h?"ไฟๅญ˜้‡ๅฏ":"้‡ๅฏ"})]})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎค้‡ๅฏ้บฆ้บฆ๏ผŸ"}),e.jsx(gs,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:h?"ๅฝ“ๅ‰ๆœ‰ๆœชไฟๅญ˜็š„้…็ฝฎๆ›ดๆ”นใ€‚็‚นๅ‡ป็กฎ่ฎคๅฐ†ๅ…ˆไฟๅญ˜้…็ฝฎ,็„ถๅŽ้‡ๅฏ้บฆ้บฆไฝฟๆ–ฐ้…็ฝฎ็”Ÿๆ•ˆใ€‚้‡ๅฏ่ฟ‡็จ‹ไธญ้บฆ้บฆๅฐ†ๆš‚ๆ—ถ็ฆป็บฟใ€‚":"ๅณๅฐ†้‡ๅฏ้บฆ้บฆไธป็จ‹ๅบใ€‚้‡ๅฏ่ฟ‡็จ‹ไธญ้บฆ้บฆๅฐ†ๆš‚ๆ—ถ็ฆป็บฟ,้…็ฝฎๅฐ†ๅœจ้‡ๅฏๅŽ็”Ÿๆ•ˆใ€‚"})})})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:h?jt:rt,children:h?"ไฟๅญ˜ๅนถ้‡ๅฏ":"็กฎ่ฎค้‡ๅฏ"})]})]})]})]})]}),e.jsx("div",{className:"flex",children:e.jsx(Jt,{value:p,onValueChange:Ae=>is(Ae),className:"w-full",children:e.jsxs(Gt,{className:"h-8 sm:h-9 w-full grid grid-cols-2",children:[e.jsxs(Xe,{value:"visual",className:"text-xs sm:text-sm",children:[e.jsx(uv,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"ๅฏ่ง†ๅŒ–็ผ–่พ‘"]}),e.jsxs(Xe,{value:"source",className:"text-xs sm:text-sm",children:[e.jsx(dx,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"ๆบไปฃ็ ็ผ–่พ‘"]})]})})})]}),e.jsxs(ht,{children:[e.jsx(Yt,{className:"h-4 w-4"}),e.jsxs(ft,{children:["้…็ฝฎๆ›ดๆ–ฐๅŽ้œ€่ฆ",e.jsx("strong",{children:"้‡ๅฏ้บฆ้บฆ"}),'ๆ‰่ƒฝ็”Ÿๆ•ˆใ€‚ไฝ ๅฏไปฅ็‚นๅ‡ปๅณไธŠ่ง’็š„"ไฟๅญ˜ๅนถ้‡ๅฏ"ๆŒ‰้’ฎไธ€้”ฎๅฎŒๆˆไฟๅญ˜ๅ’Œ้‡ๅฏใ€‚']})]}),p==="source"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(ht,{children:[e.jsx(Yt,{className:"h-4 w-4"}),e.jsxs(ft,{children:[e.jsx("strong",{children:"ๆบไปฃ็ ๆจกๅผ๏ผˆ้ซ˜็บงๅŠŸ่ƒฝ๏ผ‰๏ผš"}),"็›ดๆŽฅ็ผ–่พ‘ TOML ้…็ฝฎๆ–‡ไปถใ€‚ๆญคๅŠŸ่ƒฝไป…้€‚็”จไบŽ็†Ÿๆ‚‰ TOML ่ฏญๆณ•็š„้ซ˜็บง็”จๆˆทใ€‚ไฟๅญ˜ๆ—ถไผšๅœจๅ‰็ซฏ้ชŒ่ฏๆ ผๅผ๏ผŒๅชๆœ‰ๆ ผๅผๅฎŒๅ…จๆญฃ็กฎๆ‰่ƒฝไฟๅญ˜ใ€‚",b&&w&&e.jsxs("div",{className:"text-destructive font-semibold mt-3 p-3 bg-destructive/10 rounded-md",children:[e.jsx("div",{className:"font-bold mb-2",children:"โš ๏ธ TOML ๆ ผๅผ้”™่ฏฏ๏ผš"}),e.jsx("pre",{className:"text-sm font-mono whitespace-pre-wrap break-words",children:w})]})]})]}),e.jsx(Qv,{value:N,onChange:Ae=>{j(Ae),f(!0),b&&(y(!1),z(""))},language:"toml",theme:"dark",height:"calc(100vh - 280px)",minHeight:"500px",placeholder:"TOML ้…็ฝฎๅ†…ๅฎน"})]}),p==="visual"&&e.jsx(e.Fragment,{children:e.jsxs(Jt,{defaultValue:"bot",className:"w-full",children:[e.jsxs(Gt,{className:"flex flex-wrap h-auto gap-1 p-1 sm:grid sm:grid-cols-5 lg:grid-cols-10",children:[e.jsx(Xe,{value:"bot",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"ๅŸบๆœฌไฟกๆฏ"}),e.jsx(Xe,{value:"personality",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"ไบบๆ ผ"}),e.jsx(Xe,{value:"chat",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"่Šๅคฉ"}),e.jsx(Xe,{value:"expression",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"่กจ่พพ"}),e.jsx(Xe,{value:"features",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"ๅŠŸ่ƒฝ"}),e.jsx(Xe,{value:"processing",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"ๅค„็†"}),e.jsx(Xe,{value:"dream",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"ๅšๆขฆ"}),e.jsx(Xe,{value:"lpmm",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"็Ÿฅ่ฏ†ๅบ“"}),e.jsx(Xe,{value:"webui",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"WebUI"}),e.jsx(Xe,{value:"other",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"ๅ…ถไป–"})]}),e.jsx(Ss,{value:"bot",className:"space-y-4",children:E&&e.jsx(W2,{config:E,onChange:C})}),e.jsx(Ss,{value:"personality",className:"space-y-4",children:R&&e.jsx(eS,{config:R,onChange:H})}),e.jsx(Ss,{value:"chat",className:"space-y-4",children:O&&e.jsx(aS,{config:O,onChange:X})}),e.jsx(Ss,{value:"expression",className:"space-y-4",children:L&&e.jsx(xS,{config:L,onChange:me})}),e.jsx(Ss,{value:"features",className:"space-y-4",children:Ne&&ce&&pe&&Q&&e.jsx(uS,{emojiConfig:Ne,memoryConfig:ce,toolConfig:pe,voiceConfig:Q,onEmojiChange:je,onMemoryChange:ge,onToolChange:D,onVoiceChange:B})}),e.jsxs(Ss,{value:"processing",className:"space-y-4",children:[$&&K&&se&&cs&&e.jsx(fS,{keywordReactionConfig:$,responsePostProcessConfig:K,chineseTypoConfig:se,responseSplitterConfig:cs,onKeywordReactionChange:A,onResponsePostProcessChange:Re,onChineseTypoChange:$e,onResponseSplitterChange:J}),ue&&e.jsx(pS,{config:ue,onChange:Y})]}),e.jsx(Ss,{value:"dream",className:"space-y-4",children:we&&e.jsx(lS,{config:we,onChange:fe})}),e.jsx(Ss,{value:"lpmm",className:"space-y-4",children:Ee&&e.jsx(nS,{config:Ee,onChange:G})}),e.jsx(Ss,{value:"webui",className:"space-y-4",children:ut&&e.jsx(gS,{config:ut,onChange:Is})}),e.jsxs(Ss,{value:"other",className:"space-y-4",children:[Z&&e.jsx(rS,{config:Z,onChange:Le}),le&&e.jsx(iS,{config:le,onChange:De}),xe&&e.jsx(cS,{config:xe,onChange:Me}),ds&&e.jsx(oS,{config:ds,onChange:Ts}),Ct&&e.jsx(dS,{config:Ct,onChange:ia})]})]})}),e.jsx(nr,{})]})})}const ql=u.forwardRef(({className:a,...l},r)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:r,className:P("w-full caption-bottom text-sm",a),...l})}));ql.displayName="Table";const Vl=u.forwardRef(({className:a,...l},r)=>e.jsx("thead",{ref:r,className:P("[&_tr]:border-b",a),...l}));Vl.displayName="TableHeader";const Gl=u.forwardRef(({className:a,...l},r)=>e.jsx("tbody",{ref:r,className:P("[&_tr:last-child]:border-0",a),...l}));Gl.displayName="TableBody";const XS=u.forwardRef(({className:a,...l},r)=>e.jsx("tfoot",{ref:r,className:P("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",a),...l}));XS.displayName="TableFooter";const _t=u.forwardRef(({className:a,...l},r)=>e.jsx("tr",{ref:r,className:P("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",a),...l}));_t.displayName="TableRow";const ns=u.forwardRef(({className:a,...l},r)=>e.jsx("th",{ref:r,className:P("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",a),...l}));ns.displayName="TableHead";const Ze=u.forwardRef(({className:a,...l},r)=>e.jsx("td",{ref:r,className:P("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",a),...l}));Ze.displayName="TableCell";const ZS=u.forwardRef(({className:a,...l},r)=>e.jsx("caption",{ref:r,className:P("mt-4 text-sm text-muted-foreground",a),...l}));ZS.displayName="TableCaption";const md=u.forwardRef(({className:a,...l},r)=>e.jsx(ka,{ref:r,className:P("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",a),...l}));md.displayName=ka.displayName;const xd=u.forwardRef(({className:a,...l},r)=>e.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[e.jsx($t,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(ka.Input,{ref:r,className:P("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",a),...l})]}));xd.displayName=ka.Input.displayName;const hd=u.forwardRef(({className:a,...l},r)=>e.jsx(ka.List,{ref:r,className:P("max-h-[300px] overflow-y-auto overflow-x-hidden",a),...l}));hd.displayName=ka.List.displayName;const fd=u.forwardRef((a,l)=>e.jsx(ka.Empty,{ref:l,className:"py-6 text-center text-sm",...a}));fd.displayName=ka.Empty.displayName;const uc=u.forwardRef(({className:a,...l},r)=>e.jsx(ka.Group,{ref:r,className:P("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",a),...l}));uc.displayName=ka.Group.displayName;const WS=u.forwardRef(({className:a,...l},r)=>e.jsx(ka.Separator,{ref:r,className:P("-mx-1 h-px bg-border",a),...l}));WS.displayName=ka.Separator.displayName;const mc=u.forwardRef(({className:a,...l},r)=>e.jsx(ka.Item,{ref:r,className:P("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",a),...l}));mc.displayName=ka.Item.displayName;const Zv=j1,Wv=v1,eN=N1,Tx=u.forwardRef(({className:a,sideOffset:l=4,...r},c)=>e.jsx(g1,{children:e.jsx(Zj,{ref:c,sideOffset:l,className:P("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",a),...r})}));Tx.displayName=Zj.displayName;function Bl({content:a,className:l,iconClassName:r,side:c="top",align:d="center",maxWidth:m="300px"}){return e.jsx(Zv,{delayDuration:200,children:e.jsxs(Wv,{children:[e.jsx(eN,{asChild:!0,children:e.jsxs("button",{type:"button",className:P("inline-flex items-center justify-center rounded-full","text-muted-foreground hover:text-foreground","transition-colors cursor-help","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",l),onClick:h=>h.preventDefault(),children:[e.jsx(ox,{className:P("h-4 w-4",r)}),e.jsx("span",{className:"sr-only",children:"ๅธฎๅŠฉไฟกๆฏ"})]})}),e.jsx(Tx,{side:c,align:d,className:P("max-w-[var(--max-width)] text-sm leading-relaxed","bg-background text-foreground","border-2 border-primary shadow-lg","p-4"),style:{"--max-width":m},children:a})]})})}const sN=u.createContext(null),tN="maibot-completed-tours";function e4(){try{const a=localStorage.getItem(tN);return a?new Set(JSON.parse(a)):new Set}catch{return new Set}}function Qg(a){localStorage.setItem(tN,JSON.stringify([...a]))}function s4({children:a}){const[l,r]=u.useState({activeTourId:null,stepIndex:0,isRunning:!1}),[c]=u.useState(()=>new Map),[d,m]=u.useState(e4),[,h]=u.useState(0),f=u.useCallback((E,C)=>{c.set(E,C),h(R=>R+1)},[c]),p=u.useCallback(E=>{c.delete(E),r(C=>C.activeTourId===E?{...C,activeTourId:null,isRunning:!1,stepIndex:0}:C)},[c]),g=u.useCallback((E,C=0)=>{c.has(E)&&r({activeTourId:E,stepIndex:C,isRunning:!0})},[c]),N=u.useCallback(()=>{r(E=>({...E,isRunning:!1}))},[]),j=u.useCallback(E=>{r(C=>({...C,stepIndex:E}))},[]),b=u.useCallback(()=>{r(E=>({...E,stepIndex:E.stepIndex+1}))},[]),y=u.useCallback(()=>{r(E=>({...E,stepIndex:Math.max(0,E.stepIndex-1)}))},[]),w=u.useCallback(()=>l.activeTourId?c.get(l.activeTourId)||[]:[],[l.activeTourId,c]),z=u.useCallback(E=>{m(C=>{const R=new Set(C);return R.add(E),Qg(R),R})},[]),M=u.useCallback(E=>{const{action:C,index:R,status:H,type:O}=E,X=["finished","skipped"];if(C==="close"){r(L=>({...L,isRunning:!1,stepIndex:0}));return}X.includes(H)?r(L=>(H==="finished"&&L.activeTourId&&setTimeout(()=>z(L.activeTourId),0),{...L,isRunning:!1,stepIndex:0})):O==="step:after"&&(C==="next"?r(L=>({...L,stepIndex:R+1})):C==="prev"&&r(L=>({...L,stepIndex:R-1})))},[z]),S=u.useCallback(E=>d.has(E),[d]),F=u.useCallback(E=>{m(C=>{const R=new Set(C);return R.delete(E),Qg(R),R})},[]);return e.jsx(sN.Provider,{value:{state:l,tours:c,registerTour:f,unregisterTour:p,startTour:g,stopTour:N,goToStep:j,nextStep:b,prevStep:y,getCurrentSteps:w,handleJoyrideCallback:M,isTourCompleted:S,markTourCompleted:z,resetTourCompleted:F},children:a})}function Ex(){const a=u.useContext(sN);if(!a)throw new Error("useTour must be used within a TourProvider");return a}const t4={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)"}},a4={back:"ไธŠไธ€ๆญฅ",close:"ๅ…ณ้—ญ",last:"ๅฎŒๆˆ",next:"ไธ‹ไธ€ๆญฅ",nextLabelWithProgress:"ไธ‹ไธ€ๆญฅ ({step}/{steps})",open:"ๆ‰“ๅผ€ๅฏน่ฏๆก†",skip:"่ทณ่ฟ‡"};function l4(){const{state:a,getCurrentSteps:l,handleJoyrideCallback:r}=Ex(),c=l(),[d,m]=u.useState(!1),h=u.useRef(a.stepIndex),f=u.useRef(null);u.useEffect(()=>{h.current!==a.stepIndex&&(m(!1),h.current=a.stepIndex)},[a.stepIndex]),u.useEffect(()=>{if(!a.isRunning||c.length===0){m(!1);return}const j=c[a.stepIndex];if(!j){m(!1);return}const b=j.target;if(b==="body"){m(!0);return}m(!1);const y=setTimeout(()=>{const w=()=>{const F=document.querySelector(b);if(F){const E=F.getBoundingClientRect();if(E.width>0&&E.height>0)return!0}return!1};if(w()){setTimeout(()=>m(!0),100);return}const z=setInterval(()=>{w()&&(clearInterval(z),setTimeout(()=>m(!0),100))},100),M=setTimeout(()=>{clearInterval(z),m(!0)},5e3),S=()=>{clearInterval(z),clearTimeout(M)};f.current=S},150);return()=>{clearTimeout(y),f.current&&(f.current(),f.current=null)}},[a.isRunning,a.stepIndex,c]);const[p,g]=u.useState(null);if(u.useEffect(()=>{let j=document.getElementById("tour-portal-container");return j||(j=document.createElement("div"),j.id="tour-portal-container",j.style.cssText="position: fixed; top: 0; left: 0; z-index: 99999; pointer-events: none;",document.body.appendChild(j)),g(j),()=>{}},[]),!a.isRunning||c.length===0||!d)return null;const N=e.jsx(g_,{steps:c,stepIndex:a.stepIndex,run:a.isRunning,continuous:!0,showSkipButton:!0,showProgress:!0,disableOverlayClose:!0,disableScrolling:!1,disableScrollParentFix:!1,callback:r,styles:t4,locale:a4,scrollOffset:80,scrollToFirstStep:!0,floaterProps:{styles:{floater:{zIndex:99999}},disableAnimation:!0}},`tour-step-${a.stepIndex}`);return p?tw.createPortal(N,p):N}const gl="model-assignment-tour",aN=[{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}],lN={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"},Wi=[{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 Yg(a){return a?a.replace(/\/+$/,"").toLowerCase():""}function n4(a){if(!a)return null;const l=Yg(a);return Wi.find(r=>r.id!=="custom"&&Yg(r.base_url)===l)||null}const Lo=a=>({...a,max_retry:a.max_retry??2,timeout:a.timeout??30,retry_interval:a.retry_interval??10}),r4=(a,l=[],r=null)=>{const c={};return a?(a.name?.trim()?l.some((m,h)=>r!==null&&h===r?!1:m.name.trim().toLowerCase()===a.name.trim().toLowerCase())&&(c.name="ๆไพ›ๅ•†ๅ็งฐๅทฒๅญ˜ๅœจ๏ผŒ่ฏทไฝฟ็”จๅ…ถไป–ๅ็งฐ"):c.name="่ฏท่พ“ๅ…ฅๆไพ›ๅ•†ๅ็งฐ",a.base_url?.trim()||(c.base_url="่ฏท่พ“ๅ…ฅๅŸบ็ก€ URL"),a.api_key?.trim()||(c.api_key="่ฏท่พ“ๅ…ฅ API Key"),{isValid:Object.keys(c).length===0,errors:c}):{isValid:!1,errors:{name:"ๆไพ›ๅ•†ๆ•ฐๆฎไธบ็ฉบ"}}};function i4(){return e.jsx(lr,{children:e.jsx(c4,{})})}function c4(){const[a,l]=u.useState([]),[r,c]=u.useState(!0),[d,m]=u.useState(!1),[h,f]=u.useState(!1),[p,g]=u.useState(!1),[N,j]=u.useState(!1),[b,y]=u.useState(null),[w,z]=u.useState(null),[M,S]=u.useState("custom"),[F,E]=u.useState(!1),[C,R]=u.useState(!1),[H,O]=u.useState(null),[X,L]=u.useState(!1),[me,Ne]=u.useState(""),[je,ce]=u.useState(new Set),[ge,pe]=u.useState(!1),[D,Q]=u.useState(1),[B,ue]=u.useState(20),[Y,we]=u.useState(""),[fe,Ee]=u.useState({isOpen:!1,providersToDelete:[],affectedModels:[],pendingProviders:[],context:"auto",oldProviders:[]}),[G,$]=u.useState({}),[A,K]=u.useState(new Set),[Re,se]=u.useState(new Map),{toast:$e}=nt(),cs=ha(),{state:J,goToStep:Z,registerTour:Le}=Ex(),{triggerRestart:le,isRestarting:De}=Tn(),xe=u.useRef(null),Me=u.useRef(!0);u.useEffect(()=>{Le(gl,aN)},[Le]),u.useEffect(()=>{if(J.activeTourId===gl&&J.isRunning){const te=lN[J.stepIndex];te&&!window.location.pathname.endsWith(te.replace("/config/",""))&&cs({to:te})}},[J.stepIndex,J.activeTourId,J.isRunning,cs]);const ds=u.useRef(J.stepIndex);u.useEffect(()=>{if(J.activeTourId===gl&&J.isRunning){const te=ds.current,_e=J.stepIndex;te>=3&&te<=9&&_e<3&&j(!1),te>=10&&_e>=3&&_e<=9&&($({}),S("custom"),y({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10}),z(null),L(!1),j(!0)),ds.current=_e}},[J.stepIndex,J.activeTourId,J.isRunning]),u.useEffect(()=>{if(J.activeTourId!==gl||!J.isRunning)return;const te=_e=>{const U=_e.target,Se=J.stepIndex;Se===2&&U.closest('[data-tour="add-provider-button"]')?setTimeout(()=>Z(3),300):Se===9&&U.closest('[data-tour="provider-cancel-button"]')&&setTimeout(()=>Z(10),300)};return document.addEventListener("click",te,!0),()=>document.removeEventListener("click",te,!0)},[J,Z]),u.useEffect(()=>{Ts()},[]);const Ts=async()=>{try{c(!0);const te=await Nn();l(te.api_providers||[]),g(!1),Me.current=!1}catch(te){console.error("ๅŠ ่ฝฝ้…็ฝฎๅคฑ่ดฅ:",te)}finally{c(!1)}},Ct=async()=>{await le()},ia=async()=>{try{m(!0),xe.current&&clearTimeout(xe.current);const te=a.map(es=>({...es,max_retry:es.max_retry??2,timeout:es.timeout??30,retry_interval:es.retry_interval??10})),{shouldProceed:_e}=await ut(te,"restart");if(!_e){m(!1);return}const U=await Nn(),Se=new Set(te.map(es=>es.name)),us=(U.models||[]).filter(es=>Se.has(es.api_provider));U.api_providers=te,U.models=us,await lc(U),g(!1),$e({title:"ไฟๅญ˜ๆˆๅŠŸ",description:"ๆญฃๅœจ้‡ๅฏ้บฆ้บฆ..."}),await Ct()}catch(te){console.error("ไฟๅญ˜้…็ฝฎๅคฑ่ดฅ:",te),$e({title:"ไฟๅญ˜ๅคฑ่ดฅ",description:te.message,variant:"destructive"}),m(!1)}},ut=u.useCallback(async(te,_e="auto")=>{try{const U=await Nn(),Se=new Set(a.map($s=>$s.name)),as=new Set(te.map($s=>$s.name)),us=Array.from(Se).filter($s=>!as.has($s));if(us.length===0)return{shouldProceed:!0,providers:te};const Tt=(U.models||[]).filter($s=>us.includes($s.api_provider));return Tt.length===0?{shouldProceed:!0,providers:te}:(Ee({isOpen:!0,providersToDelete:us,affectedModels:Tt,pendingProviders:te,context:_e,oldProviders:[...a]}),{shouldProceed:!1,providers:te})}catch(U){return console.error("ๆฃ€ๆŸฅๅˆ ้™คๅฝฑๅ“ๅคฑ่ดฅ:",U),{shouldProceed:!0,providers:te}}},[a]),Is=async()=>{try{(fe.context==="auto"?f:m)(!0),Ee($s=>({...$s,isOpen:!1}));const _e=await Nn(),U=fe.pendingProviders.map(Lo),Se=new Set(U.map($s=>$s.name)),us=(_e.models||[]).filter($s=>Se.has($s.api_provider)),es=new Set(fe.affectedModels.map($s=>$s.name)),Tt=_e.model_task_config;Tt&&Object.keys(Tt).forEach($s=>{const pa=Tt[$s];pa&&Array.isArray(pa.model_list)&&(pa.model_list=pa.model_list.filter(oa=>!es.has(oa)))}),_e.api_providers=U,_e.models=us,_e.model_task_config=Tt,await lc(_e),l(fe.pendingProviders),g(!1),$e({title:"ๅˆ ้™คๆˆๅŠŸ",description:`ๅทฒๅˆ ้™ค ${fe.providersToDelete.length} ไธชๆไพ›ๅ•†ๅ’Œ ${fe.affectedModels.length} ไธชๅ…ณ่”ๆจกๅž‹`}),Ee({isOpen:!1,providersToDelete:[],affectedModels:[],pendingProviders:[],context:"auto",oldProviders:[]}),ce(new Set),fe.context==="restart"&&await Ct()}catch(te){console.error("ๅˆ ้™คๅคฑ่ดฅ:",te),$e({title:"ๅˆ ้™คๅคฑ่ดฅ",description:te.message,variant:"destructive"})}finally{fe.context==="auto"?f(!1):m(!1)}},V=()=>{fe.oldProviders.length>0&&l(fe.oldProviders),Ee({isOpen:!1,providersToDelete:[],affectedModels:[],pendingProviders:[],context:"auto",oldProviders:[]}),g(!1)},Ke=u.useCallback(async te=>{if(Me.current)return;const{shouldProceed:_e}=await ut(te,"auto");if(!_e){g(!0);return}try{f(!0);const U=te.map(Lo);await Wm("api_providers",U),g(!1)}catch(U){console.error("่‡ชๅŠจไฟๅญ˜ๅคฑ่ดฅ:",U),$e({title:"่‡ชๅŠจไฟๅญ˜ๅคฑ่ดฅ",description:U.message,variant:"destructive"}),g(!0)}finally{f(!1)}},[a,ut]);u.useEffect(()=>{if(!Me.current)return g(!0),xe.current&&clearTimeout(xe.current),xe.current=setTimeout(()=>{Ke(a)},2e3),()=>{xe.current&&clearTimeout(xe.current)}},[a,Ke]);const He=async()=>{try{m(!0),xe.current&&clearTimeout(xe.current);const te=a.map(Lo),{shouldProceed:_e}=await ut(te,"manual");if(!_e){m(!1);return}const U=await Nn(),Se=new Set(te.map(es=>es.name)),as=U.models||[],us=as.filter(es=>{const Tt=Se.has(es.api_provider);return Tt||console.warn(`ๆจกๅž‹ "${es.name}" ๅผ•็”จไบ†ๅทฒๅˆ ้™ค็š„ๆไพ›ๅ•† "${es.api_provider}"๏ผŒๅฐ†่ขซ็งป้™ค`),Tt});if(as.length!==us.length){const es=as.length-us.length;$e({title:"ๆณจๆ„",description:`ๅทฒ่‡ชๅŠจ็งป้™ค ${es} ไธชๅผ•็”จๅทฒๅˆ ้™คๆไพ›ๅ•†็š„ๆจกๅž‹`,variant:"default"})}console.log("ๅ‘้€็š„ providers ๆ•ฐๆฎ:",te),U.api_providers=te,U.models=us,console.log("ๅฎŒๆ•ด้…็ฝฎๆ•ฐๆฎ:",U),await lc(U),g(!1),$e({title:"ไฟๅญ˜ๆˆๅŠŸ",description:"ๆจกๅž‹ๆไพ›ๅ•†้…็ฝฎๅทฒไฟๅญ˜"})}catch(te){console.error("ไฟๅญ˜้…็ฝฎๅคฑ่ดฅ:",te),$e({title:"ไฟๅญ˜ๅคฑ่ดฅ",description:te.message,variant:"destructive"})}finally{m(!1)}},Je=(te,_e)=>{if($({}),te){const U=Wi.find(Se=>Se.base_url===te.base_url&&Se.client_type===te.client_type);S(U?.id||"custom"),y(te)}else S("custom"),y({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10});z(_e),L(!1),j(!0)},Es=u.useCallback(te=>{S(te),E(!1);const _e=Wi.find(U=>U.id===te);_e&&_e.id!=="custom"?y(U=>({...U,name:_e.name,base_url:_e.base_url,client_type:_e.client_type})):_e?.id==="custom"&&y(U=>({...U,name:"",base_url:"",client_type:"openai"}))},[]),ms=u.useMemo(()=>M!=="custom",[M]),Ms=u.useCallback(async()=>{if(b?.api_key)try{await navigator.clipboard.writeText(b.api_key),$e({title:"ๅคๅˆถๆˆๅŠŸ",description:"API Key ๅทฒๅคๅˆถๅˆฐๅ‰ช่ดดๆฟ"})}catch{$e({title:"ๅคๅˆถๅคฑ่ดฅ",description:"ๆ— ๆณ•่ฎฟ้—ฎๅ‰ช่ดดๆฟ",variant:"destructive"})}},[b?.api_key,$e]),We=()=>{if(!b)return;const{isValid:te,errors:_e}=r4(b,a,w);if(!te){$(_e);return}$({});const U=Lo(b);if(w!==null){const Se=[...a];Se[w]=U,l(Se)}else l([...a,U]);j(!1),y(null),z(null)},Cs=te=>{if(!te&&b){const _e={...b,max_retry:b.max_retry??2,timeout:b.timeout??30,retry_interval:b.retry_interval??10};y(_e)}j(te)},rs=te=>{O(te),R(!0)},is=async()=>{if(H!==null){const te=a.filter((U,Se)=>Se!==H),{shouldProceed:_e}=await ut(te,"manual");_e&&(l(te),$e({title:"ๅˆ ้™คๆˆๅŠŸ",description:"ๆไพ›ๅ•†ๅทฒไปŽๅˆ—่กจไธญ็งป้™ค"}))}R(!1),O(null)},ys=te=>{const _e=new Set(je);_e.has(te)?_e.delete(te):_e.add(te),ce(_e)},rt=()=>{if(je.size===Qe.length)ce(new Set);else{const te=Qe.map((_e,U)=>a.findIndex(Se=>Se===Qe[U]));ce(new Set(te))}},jt=()=>{if(je.size===0){$e({title:"ๆ็คบ",description:"่ฏทๅ…ˆ้€‰ๆ‹ฉ่ฆๅˆ ้™ค็š„ๆไพ›ๅ•†",variant:"default"});return}pe(!0)},Ae=async()=>{const te=a.filter((U,Se)=>!je.has(Se)),{shouldProceed:_e}=await ut(te,"manual");_e&&(l(te),ce(new Set),$e({title:"ๆ‰น้‡ๅˆ ้™คๆˆๅŠŸ",description:`ๅทฒๅˆ ้™ค ${je.size} ไธชๆไพ›ๅ•†`})),pe(!1)},Qe=u.useMemo(()=>{if(!me)return a;const te=me.toLowerCase();return a.filter(_e=>_e.name.toLowerCase().includes(te)||_e.base_url.toLowerCase().includes(te)||_e.client_type.toLowerCase().includes(te))},[a,me]),{totalPages:As,paginatedProviders:mt}=u.useMemo(()=>{const te=Math.ceil(Qe.length/B),_e=Qe.slice((D-1)*B,D*B);return{totalPages:te,paginatedProviders:_e}},[Qe,D,B]),Ht=u.useCallback(()=>{const te=parseInt(Y);te>=1&&te<=As&&(Q(te),we(""))},[Y,As]),ca=async te=>{K(_e=>new Set(_e).add(te));try{const _e=await yS(te);se(U=>new Map(U).set(te,_e)),_e.network_ok?_e.api_key_valid===!0?$e({title:"่ฟžๆŽฅๆญฃๅธธ",description:`${te} ็ฝ‘็ปœ่ฟžๆŽฅๆญฃๅธธ๏ผŒAPI Key ๆœ‰ๆ•ˆ (${_e.latency_ms}ms)`}):_e.api_key_valid===!1?$e({title:"่ฟžๆŽฅๆญฃๅธธไฝ† Key ๆ— ๆ•ˆ",description:`${te} ็ฝ‘็ปœ่ฟžๆŽฅๆญฃๅธธ๏ผŒไฝ† API Key ๆ— ๆ•ˆๆˆ–ๅทฒ่ฟ‡ๆœŸ`,variant:"destructive"}):$e({title:"็ฝ‘็ปœ่ฟžๆŽฅๆญฃๅธธ",description:`${te} ๅฏไปฅ่ฎฟ้—ฎ (${_e.latency_ms}ms)`}):$e({title:"่ฟžๆŽฅๅคฑ่ดฅ",description:_e.error||"ๆ— ๆณ•่ฟžๆŽฅๅˆฐๆไพ›ๅ•†",variant:"destructive"})}catch(_e){$e({title:"ๆต‹่ฏ•ๅคฑ่ดฅ",description:_e.message,variant:"destructive"})}finally{K(_e=>{const U=new Set(_e);return U.delete(te),U})}},Fa=async()=>{for(const te of a)await ca(te.name)},Xt=te=>{const _e=A.has(te),U=Re.get(te);return _e?e.jsxs(Ce,{variant:"secondary",className:"gap-1",children:[e.jsx(Fs,{className:"h-3 w-3 animate-spin"}),"ๆต‹่ฏ•ไธญ"]}):U?U.network_ok?U.api_key_valid===!0?e.jsxs(Ce,{className:"gap-1 bg-green-600 hover:bg-green-700",children:[e.jsx(st,{className:"h-3 w-3"}),"ๆญฃๅธธ"]}):U.api_key_valid===!1?e.jsxs(Ce,{variant:"destructive",className:"gap-1",children:[e.jsx(Ut,{className:"h-3 w-3"}),"Keyๆ— ๆ•ˆ"]}):e.jsxs(Ce,{className:"gap-1 bg-blue-600 hover:bg-blue-700",children:[e.jsx(st,{className:"h-3 w-3"}),"ๅฏ่ฎฟ้—ฎ"]}):e.jsxs(Ce,{variant:"destructive",className:"gap-1",children:[e.jsx(ta,{className:"h-3 w-3"}),"็ฆป็บฟ"]}):null};return r?e.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("p",{className:"text-muted-foreground",children:"ๅŠ ่ฝฝไธญ..."})})}):e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"AIๆจกๅž‹ๅŽ‚ๅ•†้…็ฝฎ"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"็ฎก็† AI ๆจกๅž‹ๅŽ‚ๅ•†็š„ API ้…็ฝฎ"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[je.size>0&&e.jsxs(_,{onClick:jt,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(os,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"ๆ‰น้‡ๅˆ ้™ค (",je.size,")"]}),e.jsxs(_,{onClick:Fa,size:"sm",variant:"outline",className:"w-full sm:w-auto",disabled:a.length===0||A.size>0,children:[e.jsx(sl,{className:"mr-2 h-4 w-4"}),A.size>0?`ๆต‹่ฏ•ไธญ (${A.size})`:"ๆต‹่ฏ•ๅ…จ้ƒจ"]}),e.jsxs(_,{onClick:()=>Je(null,null),size:"sm",className:"w-full sm:w-auto","data-tour":"add-provider-button",children:[e.jsx(Xs,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"ๆทปๅŠ ๆไพ›ๅ•†"]}),e.jsxs(_,{onClick:He,disabled:d||h||!p||De,size:"sm",variant:"outline",className:"w-full sm:w-auto sm:min-w-[120px]",children:[e.jsx(gc,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),d?"ไฟๅญ˜ไธญ...":h?"่‡ชๅŠจไฟๅญ˜ไธญ...":p?"ไฟๅญ˜้…็ฝฎ":"ๅทฒไฟๅญ˜"]}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{disabled:d||h||De,size:"sm",className:"w-full sm:w-auto sm:min-w-[120px]",children:[e.jsx(pc,{className:"mr-2 h-4 w-4"}),De?"้‡ๅฏไธญ...":p?"ไฟๅญ˜ๅนถ้‡ๅฏ":"้‡ๅฏ้บฆ้บฆ"]})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎค้‡ๅฏ้บฆ้บฆ๏ผŸ"}),e.jsx(gs,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:p?"ๅฝ“ๅ‰ๆœ‰ๆœชไฟๅญ˜็š„้…็ฝฎๆ›ดๆ”นใ€‚็‚นๅ‡ป็กฎ่ฎคๅฐ†ๅ…ˆไฟๅญ˜้…็ฝฎ,็„ถๅŽ้‡ๅฏ้บฆ้บฆไฝฟๆ–ฐ้…็ฝฎ็”Ÿๆ•ˆใ€‚้‡ๅฏ่ฟ‡็จ‹ไธญ้บฆ้บฆๅฐ†ๆš‚ๆ—ถ็ฆป็บฟใ€‚":"ๅณๅฐ†้‡ๅฏ้บฆ้บฆไธป็จ‹ๅบใ€‚้‡ๅฏ่ฟ‡็จ‹ไธญ้บฆ้บฆๅฐ†ๆš‚ๆ—ถ็ฆป็บฟ,้…็ฝฎๅฐ†ๅœจ้‡ๅฏๅŽ็”Ÿๆ•ˆใ€‚"})})})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:p?ia:Ct,children:p?"ไฟๅญ˜ๅนถ้‡ๅฏ":"็กฎ่ฎค้‡ๅฏ"})]})]})]})]})]}),e.jsxs(ht,{children:[e.jsx(Yt,{className:"h-4 w-4"}),e.jsxs(ft,{children:["้…็ฝฎๆ›ดๆ–ฐๅŽ้œ€่ฆ",e.jsx("strong",{children:"้‡ๅฏ้บฆ้บฆ"}),'ๆ‰่ƒฝ็”Ÿๆ•ˆใ€‚ไฝ ๅฏไปฅ็‚นๅ‡ปๅณไธŠ่ง’็š„"ไฟๅญ˜ๅนถ้‡ๅฏ"ๆŒ‰้’ฎไธ€้”ฎๅฎŒๆˆไฟๅญ˜ๅ’Œ้‡ๅฏใ€‚']})]}),e.jsxs(ts,{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($t,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ne,{placeholder:"ๆœ็ดขๆไพ›ๅ•†ๅ็งฐใ€URL ๆˆ–็ฑปๅž‹...",value:me,onChange:te=>Ne(te.target.value),className:"pl-9"})]}),me&&e.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["ๆ‰พๅˆฐ ",Qe.length," ไธช็ป“ๆžœ"]})]}),e.jsx("div",{className:"md:hidden space-y-3",children:Qe.length===0?e.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:me?"ๆœชๆ‰พๅˆฐๅŒน้…็š„ๆไพ›ๅ•†":'ๆš‚ๆ— ๆไพ›ๅ•†้…็ฝฎ๏ผŒ็‚นๅ‡ป"ๆทปๅŠ ๆไพ›ๅ•†"ๅผ€ๅง‹้…็ฝฎ'}):mt.map((te,_e)=>{const U=a.findIndex(Se=>Se===te);return e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h3",{className:"font-semibold text-base truncate",children:te.name}),Xt(te.name)]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:te.base_url})]}),e.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>ca(te.name),disabled:A.has(te.name),title:"ๆต‹่ฏ•่ฟžๆŽฅ",children:A.has(te.name)?e.jsx(Fs,{className:"h-4 w-4 animate-spin"}):e.jsx(sl,{className:"h-4 w-4"})}),e.jsx(_,{variant:"default",size:"sm",onClick:()=>Je(te,U),children:e.jsx(Zn,{className:"h-4 w-4",strokeWidth:2,fill:"none"})}),e.jsx(_,{size:"sm",onClick:()=>rs(U),className:"bg-red-600 hover:bg-red-700 text-white",children:e.jsx(os,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"ๅฎขๆˆท็ซฏ็ฑปๅž‹"}),e.jsx("p",{className:"font-medium",children:te.client_type})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"ๆœ€ๅคง้‡่ฏ•"}),e.jsx("p",{className:"font-medium",children:te.max_retry})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"่ถ…ๆ—ถ(็ง’)"}),e.jsx("p",{className:"font-medium",children:te.timeout})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"้‡่ฏ•้—ด้š”(็ง’)"}),e.jsx("p",{className:"font-medium",children:te.retry_interval})]})]})]},_e)})}),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(ql,{children:[e.jsx(Vl,{children:e.jsxs(_t,{children:[e.jsx(ns,{className:"w-12",children:e.jsx(tt,{checked:je.size===Qe.length&&Qe.length>0,onCheckedChange:rt})}),e.jsx(ns,{children:"็Šถๆ€"}),e.jsx(ns,{children:"ๅ็งฐ"}),e.jsx(ns,{children:"ๅŸบ็ก€URL"}),e.jsx(ns,{children:"ๅฎขๆˆท็ซฏ็ฑปๅž‹"}),e.jsx(ns,{className:"text-right",children:"ๆœ€ๅคง้‡่ฏ•"}),e.jsx(ns,{className:"text-right",children:"่ถ…ๆ—ถ(็ง’)"}),e.jsx(ns,{className:"text-right",children:"้‡่ฏ•้—ด้š”(็ง’)"}),e.jsx(ns,{className:"text-right",children:"ๆ“ไฝœ"})]})}),e.jsx(Gl,{children:mt.length===0?e.jsx(_t,{children:e.jsx(Ze,{colSpan:9,className:"text-center text-muted-foreground py-8",children:me?"ๆœชๆ‰พๅˆฐๅŒน้…็š„ๆไพ›ๅ•†":'ๆš‚ๆ— ๆไพ›ๅ•†้…็ฝฎ๏ผŒ็‚นๅ‡ป"ๆทปๅŠ ๆไพ›ๅ•†"ๅผ€ๅง‹้…็ฝฎ'})}):mt.map((te,_e)=>{const U=a.findIndex(Se=>Se===te);return e.jsxs(_t,{children:[e.jsx(Ze,{children:e.jsx(tt,{checked:je.has(U),onCheckedChange:()=>ys(U)})}),e.jsx(Ze,{children:Xt(te.name)||e.jsx(Ce,{variant:"outline",className:"text-muted-foreground",children:"ๆœชๆต‹่ฏ•"})}),e.jsx(Ze,{className:"font-medium",children:te.name}),e.jsx(Ze,{className:"max-w-xs truncate",title:te.base_url,children:te.base_url}),e.jsx(Ze,{children:te.client_type}),e.jsx(Ze,{className:"text-right",children:te.max_retry}),e.jsx(Ze,{className:"text-right",children:te.timeout}),e.jsx(Ze,{className:"text-right",children:te.retry_interval}),e.jsx(Ze,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>ca(te.name),disabled:A.has(te.name),title:"ๆต‹่ฏ•่ฟžๆŽฅ",children:A.has(te.name)?e.jsx(Fs,{className:"h-4 w-4 animate-spin"}):e.jsx(sl,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"default",size:"sm",onClick:()=>Je(te,U),children:[e.jsx(Zn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"็ผ–่พ‘"]}),e.jsxs(_,{size:"sm",onClick:()=>rs(U),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(os,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"ๅˆ ้™ค"]})]})})]},_e)})})]})})}),Qe.length>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{htmlFor:"page-size-provider",className:"text-sm whitespace-nowrap",children:"ๆฏ้กตๆ˜พ็คบ"}),e.jsxs(Pe,{value:B.toString(),onValueChange:te=>{ue(parseInt(te)),Q(1),ce(new Set)},children:[e.jsx(Be,{id:"page-size-provider",className:"w-20",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"10",children:"10"}),e.jsx(W,{value:"20",children:"20"}),e.jsx(W,{value:"50",children:"50"}),e.jsx(W,{value:"100",children:"100"})]})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["ๆ˜พ็คบ ",(D-1)*B+1," ๅˆฐ"," ",Math.min(D*B,Qe.length)," ๆก๏ผŒๅ…ฑ ",Qe.length," ๆก"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>Q(1),disabled:D===1,className:"hidden sm:flex",children:e.jsx(kn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>Q(te=>Math.max(1,te-1)),disabled:D===1,children:[e.jsx(Pa,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"ไธŠไธ€้กต"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{type:"number",value:Y,onChange:te=>we(te.target.value),onKeyDown:te=>te.key==="Enter"&&Ht(),placeholder:D.toString(),className:"w-16 h-8 text-center",min:1,max:As}),e.jsx(_,{variant:"outline",size:"sm",onClick:Ht,disabled:!Y,className:"h-8",children:"่ทณ่ฝฌ"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>Q(te=>te+1),disabled:D>=As,children:[e.jsx("span",{className:"hidden sm:inline",children:"ไธ‹ไธ€้กต"}),e.jsx(ra,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>Q(As),disabled:D>=As,className:"hidden sm:flex",children:e.jsx(Cn,{className:"h-4 w-4"})})]})]})]}),e.jsx(Qs,{open:N,onOpenChange:Cs,children:e.jsxs(Hs,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto","data-tour":"provider-dialog",preventOutsideClose:J.isRunning,children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:w!==null?"็ผ–่พ‘ๆไพ›ๅ•†":"ๆทปๅŠ ๆไพ›ๅ•†"}),e.jsx(at,{children:"้…็ฝฎ API ๆไพ›ๅ•†็š„่ฟžๆŽฅไฟกๆฏๅ’Œๅ‚ๆ•ฐ"})]}),e.jsxs("form",{onSubmit:te=>{te.preventDefault(),We()},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(cl,{open:F,onOpenChange:E,children:[e.jsx(ol,{asChild:!0,children:e.jsxs(_,{variant:"outline",role:"combobox","aria-expanded":F,className:"w-full justify-between",children:[M?Wi.find(te=>te.id===M)?.display_name:"้€‰ๆ‹ฉๆไพ›ๅ•†ๆจกๆฟ...",e.jsx(mx,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(tl,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:e.jsxs(md,{children:[e.jsx(xd,{placeholder:"ๆœ็ดขๆไพ›ๅ•†ๆจกๆฟ..."}),e.jsx(ts,{className:"h-[300px]",children:e.jsxs(hd,{className:"max-h-none overflow-visible",children:[e.jsx(fd,{children:"ๆœชๆ‰พๅˆฐๅŒน้…็š„ๆจกๆฟ"}),e.jsx(uc,{children:Wi.map(te=>e.jsxs(mc,{value:te.display_name,onSelect:()=>Es(te.id),children:[e.jsx(Ot,{className:`mr-2 h-4 w-4 ${M===te.id?"opacity-100":"opacity-0"}`}),te.display_name]},te.id))})]})})]})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"้€‰ๆ‹ฉ้ข„่ฎพๆจกๆฟๅฏ่‡ชๅŠจๅกซๅ…… URL ๅ’Œๅฎขๆˆท็ซฏ็ฑปๅž‹,ๆ”ฏๆŒๆœ็ดข"})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-name-input",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(T,{htmlFor:"name",className:G.name?"text-destructive":"",children:"ๅ็งฐ *"}),e.jsx(Bl,{content:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"font-medium",children:"ๆไพ›ๅ•†ๅ็งฐ"}),e.jsx("p",{children:"ไธบ่ฟ™ไธช API ๆไพ›ๅ•†่ฎพ็ฝฎไธ€ไธชไพฟไบŽ่ฏ†ๅˆซ็š„ๅ็งฐ๏ผŒ็”จไบŽๅœจๆจกๅž‹้…็ฝฎไธญๅผ•็”จใ€‚"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs",children:[e.jsx("li",{children:"ๆŽจ่ไฝฟ็”จๅŽ‚ๅ•†ๅฎ˜ๆ–นๅ็งฐ๏ผŒๅฆ‚ DeepSeekใ€OpenAI"}),e.jsx("li",{children:"ๅ็งฐ้œ€่ฆๅ”ฏไธ€๏ผŒไธ่ƒฝไธŽ็Žฐๆœ‰ๆไพ›ๅ•†้‡ๅค"})]})]}),side:"right",maxWidth:"350px"})]}),e.jsx(ne,{id:"name",value:b?.name||"",onChange:te=>{y(_e=>_e?{..._e,name:te.target.value}:null),G.name&&$(_e=>({..._e,name:void 0}))},placeholder:"ไพ‹ๅฆ‚: DeepSeek, SiliconFlow",className:G.name?"border-destructive focus-visible:ring-destructive":""}),G.name&&e.jsx("p",{className:"text-xs text-destructive",children:G.name})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-url-input",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(T,{htmlFor:"base_url",className:G.base_url?"text-destructive":"",children:"ๅŸบ็ก€ URL *"}),e.jsx(Bl,{content:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"font-medium",children:"API ๅŸบ็ก€ๅœฐๅ€"}),e.jsx("p",{children:"ๆไพ›ๅ•†็š„ API ็ซฏ็‚นๅŸบ็ก€ URL๏ผŒ้€šๅธธไปฅ /v1 ็ป“ๅฐพใ€‚"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs",children:[e.jsxs("li",{children:[e.jsx("strong",{children:"OpenAI ๆ ผๅผ๏ผš"}),"https://api.openai.com/v1"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"DeepSeek๏ผš"}),"https://api.deepseek.com"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"็ก…ๅŸบๆตๅŠจ๏ผš"}),"https://api.siliconflow.cn/v1"]}),e.jsx("li",{children:"้€‰ๆ‹ฉๆจกๆฟไผš่‡ชๅŠจๅกซๅ……ๆญฃ็กฎ็š„ URL"})]})]}),side:"right",maxWidth:"400px"})]}),e.jsx(ne,{id:"base_url",value:b?.base_url||"",onChange:te=>{y(_e=>_e?{..._e,base_url:te.target.value}:null),G.base_url&&$(_e=>({..._e,base_url:void 0}))},placeholder:"https://api.example.com/v1",disabled:ms,className:`${ms?"bg-muted cursor-not-allowed":""} ${G.base_url?"border-destructive focus-visible:ring-destructive":""}`}),G.base_url&&e.jsx("p",{className:"text-xs text-destructive",children:G.base_url}),ms&&!G.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.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(T,{htmlFor:"api_key",className:G.api_key?"text-destructive":"",children:"API Key *"}),e.jsx(Bl,{content:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"font-medium",children:"API ๅฏ†้’ฅ"}),e.jsx("p",{children:"ไปŽๆไพ›ๅ•†ๅนณๅฐ่Žทๅ–็š„่บซไปฝ้ชŒ่ฏๅฏ†้’ฅใ€‚"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs",children:[e.jsxs("li",{children:["้€šๅธธไปฅ ",e.jsx("code",{children:"sk-"})," ๅผ€ๅคด"]}),e.jsx("li",{children:"่ฏทๅฆฅๅ–„ไฟ็ฎก๏ผŒไธ่ฆๆณ„้œฒ็ป™ไป–ไบบ"}),e.jsx("li",{children:"ๅฏไปฅ็‚นๅ‡ป็œผ็›ๅ›พๆ ‡ๅˆ‡ๆขๆ˜พ็คบ/้š่—"}),e.jsx("li",{children:"็‚นๅ‡ปๅคๅˆถๅ›พๆ ‡ๅฏๅฟซ้€Ÿๅคๅˆถๅฏ†้’ฅ"})]})]}),side:"right",maxWidth:"350px"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{id:"api_key",type:X?"text":"password",value:b?.api_key||"",onChange:te=>{y(_e=>_e?{..._e,api_key:te.target.value}:null),G.api_key&&$(_e=>({..._e,api_key:void 0}))},placeholder:"sk-...",className:`flex-1 ${G.api_key?"border-destructive focus-visible:ring-destructive":""}`}),e.jsx(_,{type:"button",variant:"outline",size:"icon",onClick:()=>L(!X),title:X?"้š่—ๅฏ†้’ฅ":"ๆ˜พ็คบๅฏ†้’ฅ",children:X?e.jsx(ic,{className:"h-4 w-4"}):e.jsx(ua,{className:"h-4 w-4"})}),e.jsx(_,{type:"button",variant:"outline",size:"icon",onClick:Ms,title:"ๅคๅˆถๅฏ†้’ฅ",children:e.jsx(qo,{className:"h-4 w-4"})})]}),G.api_key&&e.jsx("p",{className:"text-xs text-destructive",children:G.api_key})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(T,{htmlFor:"client_type",children:"ๅฎขๆˆท็ซฏ็ฑปๅž‹"}),e.jsx(Bl,{content:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"font-medium",children:"API ๅฎขๆˆท็ซฏ็ฑปๅž‹"}),e.jsx("p",{children:"ๆŒ‡ๅฎšไธŽๆไพ›ๅ•†้€šไฟกๆ—ถไฝฟ็”จ็š„ API ๅ่ฎฎๆ ผๅผใ€‚"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs",children:[e.jsxs("li",{children:[e.jsx("strong",{children:"OpenAI๏ผš"}),"ๅ…ผๅฎน OpenAI API ๆ ผๅผ็š„ๆไพ›ๅ•†"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Gemini๏ผš"}),"Google Gemini ไธ“็”จๆ ผๅผ"]}),e.jsx("li",{children:"ๅคง้ƒจๅˆ†็ฌฌไธ‰ๆ–นๆไพ›ๅ•†้ƒฝๅ…ผๅฎน OpenAI ๆ ผๅผ"})]})]}),side:"right",maxWidth:"350px"})]}),e.jsxs(Pe,{value:b?.client_type||"openai",onValueChange:te=>y(_e=>_e?{..._e,client_type:te}:null),disabled:ms,children:[e.jsx(Be,{id:"client_type",className:ms?"bg-muted cursor-not-allowed":"",children:e.jsx(Fe,{placeholder:"้€‰ๆ‹ฉๅฎขๆˆท็ซฏ็ฑปๅž‹"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"openai",children:"OpenAI"}),e.jsx(W,{value:"gemini",children:"Gemini"})]})]}),ms&&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.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(T,{htmlFor:"max_retry",children:"ๆœ€ๅคง้‡่ฏ•"}),e.jsx(Bl,{content:"API ่ฏทๆฑ‚ๅคฑ่ดฅๆ—ถ็š„ๆœ€ๅคง้‡่ฏ•ๆฌกๆ•ฐใ€‚่ฎพ็ฝฎไธบ 0 ่กจ็คบไธ้‡่ฏ•ใ€‚้ป˜่ฎคๅ€ผ๏ผš2",side:"top",maxWidth:"250px"})]}),e.jsx(ne,{id:"max_retry",type:"number",min:"0",value:b?.max_retry??"",onChange:te=>{const _e=te.target.value===""?null:parseInt(te.target.value);y(U=>U?{...U,max_retry:_e}:null)},placeholder:"้ป˜่ฎค: 2"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(T,{htmlFor:"timeout",children:"่ถ…ๆ—ถ(็ง’)"}),e.jsx(Bl,{content:"ๅ•ๆฌก API ่ฏทๆฑ‚็š„่ถ…ๆ—ถๆ—ถ้—ด๏ผˆ็ง’๏ผ‰ใ€‚่ถ…ๆ—ถๅŽไผš่งฆๅ‘้‡่ฏ•ๆˆ–ๆŠฅ้”™ใ€‚้ป˜่ฎคๅ€ผ๏ผš30 ็ง’",side:"top",maxWidth:"250px"})]}),e.jsx(ne,{id:"timeout",type:"number",min:"1",value:b?.timeout??"",onChange:te=>{const _e=te.target.value===""?null:parseInt(te.target.value);y(U=>U?{...U,timeout:_e}:null)},placeholder:"้ป˜่ฎค: 30"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(T,{htmlFor:"retry_interval",children:"้‡่ฏ•้—ด้š”(็ง’)"}),e.jsx(Bl,{content:"ไธคๆฌก้‡่ฏ•ไน‹้—ด็š„็ญ‰ๅพ…ๆ—ถ้—ด๏ผˆ็ง’๏ผ‰ใ€‚้€‚ๅฝ“็š„้—ด้š”ๅฏไปฅ้ฟๅ…่งฆๅ‘ API ้™ๆตใ€‚้ป˜่ฎคๅ€ผ๏ผš10 ็ง’",side:"top",maxWidth:"250px"})]}),e.jsx(ne,{id:"retry_interval",type:"number",min:"1",value:b?.retry_interval??"",onChange:te=>{const _e=te.target.value===""?null:parseInt(te.target.value);y(U=>U?{...U,retry_interval:_e}:null)},placeholder:"้ป˜่ฎค: 10"})]})]})]}),e.jsxs(gt,{children:[e.jsx(_,{type:"button",variant:"outline",onClick:()=>j(!1),"data-tour":"provider-cancel-button",children:"ๅ–ๆถˆ"}),e.jsx(_,{type:"submit","data-tour":"provider-save-button",children:"ไฟๅญ˜"})]})]})]})}),e.jsx(bs,{open:C,onOpenChange:R,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsxs(gs,{children:['็กฎๅฎš่ฆๅˆ ้™คๆไพ›ๅ•† "',H!==null?a[H]?.name:"",'" ๅ—๏ผŸ ๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚']})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:is,children:"ๅˆ ้™ค"})]})]})}),e.jsx(bs,{open:ge,onOpenChange:pe,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๆ‰น้‡ๅˆ ้™ค"}),e.jsxs(gs,{children:["็กฎๅฎš่ฆๅˆ ้™ค้€‰ไธญ็š„ ",je.size," ไธชๆไพ›ๅ•†ๅ—๏ผŸ ๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:Ae,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"ๆ‰น้‡ๅˆ ้™ค"})]})]})}),e.jsx(bs,{open:fe.isOpen,onOpenChange:te=>Ee(_e=>({..._e,isOpen:te})),children:e.jsxs(xs,{className:"max-w-2xl",children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™คๆไพ›ๅ•†"}),e.jsx(gs,{asChild:!0,children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:["ๆ‚จๅณๅฐ†ๅˆ ้™คไปฅไธ‹ๆไพ›ๅ•†๏ผš",e.jsx("strong",{className:"text-foreground ml-1",children:fe.providersToDelete.join(", ")})]}),e.jsxs("p",{className:"text-yellow-600 dark:text-yellow-500 font-medium",children:["โš ๏ธ ๆญคๆ“ไฝœๅฐ†ๅŒๆ—ถๅˆ ้™ค ",fe.affectedModels.length," ไธชๅ…ณ่”็š„ๆจกๅž‹๏ผš"]}),e.jsx(ts,{className:"h-32 w-full rounded border p-3",children:e.jsx("div",{className:"space-y-1",children:fe.affectedModels.map((te,_e)=>e.jsxs("div",{className:"text-sm",children:[e.jsx("span",{className:"font-mono text-muted-foreground",children:"โ€ข"}),e.jsx("span",{className:"ml-2 font-medium",children:te.name}),e.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(",te.model_identifier,")"]})]},_e))})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"่ฟ™ไบ›ๆจกๅž‹ๅฐ†ไปŽๆจกๅž‹ๅˆ—่กจๅ’Œๆ‰€ๆœ‰ไปปๅŠกๅˆ†้…ไธญ็งป้™คใ€‚ๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚"})]})})]}),e.jsxs(fs,{children:[e.jsx(vs,{onClick:V,children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:Is,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"็กฎ่ฎคๅˆ ้™ค"})]})]})}),e.jsx(nr,{})]})}function nc(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).substring(2,11)}`}function Im(a){return a===null?"null":Array.isArray(a)?"array":typeof a=="object"?"object":typeof a=="boolean"?"boolean":typeof a=="number"?"number":"string"}function sx(a){return Object.entries(a).map(([l,r])=>{const c=Im(r),d={id:nc(),key:l,value:r,type:c,expanded:!0};return c==="object"&&r&&typeof r=="object"?d.children=sx(r):c==="array"&&Array.isArray(r)&&(d.children=r.map((m,h)=>{const f=Im(m),p={id:nc(),key:String(h),value:m,type:f,expanded:!0};return f==="object"&&m&&typeof m=="object"?p.children=sx(m):f==="array"&&Array.isArray(m)&&(p.children=m.map((g,N)=>({id:nc(),key:String(N),value:g,type:Im(g),expanded:!0}))),p})),d})}function tx(a){const l={};for(const r of a)r.key.trim()&&(r.type==="object"&&r.children?l[r.key]=tx(r.children):r.type==="array"&&r.children?l[r.key]=r.children.map(c=>c.type==="object"&&c.children?tx(c.children):c.type==="array"&&c.children?c.children.map(d=>d.value):c.value):r.type==="null"?l[r.key]=null:l[r.key]=r.value);return l}function Jg(a,l){switch(l){case"boolean":return a==="true";case"number":{const r=parseFloat(a);return isNaN(r)?0:r}case"null":return null;default:return a}}function nN({node:a,level:l,onUpdate:r,onRemove:c,onAddChild:d,onToggleExpand:m}){const h=a.type==="object"||a.type==="array",f=a.children&&a.children.length>0;return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"grid gap-2 items-center",style:{gridTemplateColumns:h?"32px 1fr 90px 64px":"32px 1fr 1fr 90px 32px",paddingLeft:`${l*20}px`},children:[e.jsx(_,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>m(a.id),disabled:!h||!f,children:h&&f?a.expanded?e.jsx(Ba,{className:"h-4 w-4"}):e.jsx(ra,{className:"h-4 w-4"}):e.jsx("span",{className:"w-4"})}),e.jsx(ne,{value:a.key,onChange:p=>r(a.id,"key",p.target.value),placeholder:"key",className:"h-8 text-sm"}),!h&&e.jsx(e.Fragment,{children:a.type==="boolean"?e.jsxs("div",{className:"flex items-center h-8 px-3 border rounded-md bg-background",children:[e.jsx(Ge,{checked:a.value===!0,onCheckedChange:p=>r(a.id,"value",p)}),e.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:a.value?"true":"false"})]}):a.type==="null"?e.jsx("div",{className:"flex items-center h-8 px-3 border rounded-md bg-muted text-sm text-muted-foreground",children:"null"}):e.jsx(ne,{type:a.type==="number"?"number":"text",value:a.value,onChange:p=>r(a.id,"value",p.target.value),placeholder:"value",className:"h-8 text-sm",step:a.type==="number"?"any":void 0})}),e.jsxs(Pe,{value:a.type,onValueChange:p=>r(a.id,"type",p),children:[e.jsx(Be,{className:"h-8 text-xs",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"string",children:"ๅญ—็ฌฆไธฒ"}),e.jsx(W,{value:"number",children:"ๆ•ฐๅญ—"}),e.jsx(W,{value:"boolean",children:"ๅธƒๅฐ”"}),e.jsx(W,{value:"null",children:"Null"}),e.jsx(W,{value:"object",children:"ๅฏน่ฑก"}),e.jsx(W,{value:"array",children:"ๆ•ฐ็ป„"})]})]}),e.jsxs("div",{className:"flex gap-1 justify-end",children:[h&&e.jsx(_,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-primary",onClick:()=>d(a.id),title:"ๆทปๅŠ ๅญ้กน",children:e.jsx(Xs,{className:"h-4 w-4"})}),e.jsx(_,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",onClick:()=>c(a.id),title:"ๅˆ ้™ค",children:e.jsx(os,{className:"h-4 w-4"})})]})]}),h&&a.expanded&&a.children&&a.children.length>0&&e.jsx("div",{className:"space-y-1",children:a.children.map(p=>e.jsx(nN,{node:p,level:l+1,onUpdate:r,onRemove:c,onAddChild:d,onToggleExpand:m},p.id))})]})}function o4({value:a,onChange:l,placeholder:r="ๆทปๅŠ ๅ‚ๆ•ฐ..."}){const[c,d]=u.useState(()=>sx(a||{})),m=u.useCallback(j=>{d(j),l(tx(j))},[l]),h=u.useCallback(()=>{const j={id:nc(),key:"",value:"",type:"string",expanded:!1};m([...c,j])},[c,m]),f=u.useCallback((j,b,y)=>{const w=z=>z.map(M=>{if(M.id===j)if(b==="type"){const S=y;if(S==="object")return{...M,type:S,value:{},children:[]};if(S==="array")return{...M,type:S,value:[],children:[]};if(S==="null")return{...M,type:S,value:null};{const F=Jg(String(M.value),S);return{...M,type:S,value:F,children:void 0}}}else if(b==="value"){const S=Jg(String(y),M.type);return{...M,value:S}}else return{...M,[b]:String(y)};return M.children?{...M,children:w(M.children)}:M});m(w(c))},[c,m]),p=u.useCallback(j=>{const b=y=>y.filter(w=>w.id!==j).map(w=>w.children?{...w,children:b(w.children)}:w);m(b(c))},[c,m]),g=u.useCallback(j=>{const b=y=>y.map(w=>{if(w.id===j){const z={id:nc(),key:w.type==="array"?String(w.children?.length||0):"",value:"",type:"string",expanded:!0};return{...w,children:[...w.children||[],z]}}return w.children?{...w,children:b(w.children)}:w});m(b(c))},[c,m]),N=u.useCallback(j=>{const b=y=>y.map(w=>w.id===j?{...w,expanded:!w.expanded}:w.children?{...w,children:b(w.children)}:w);d(b(c))},[c]);return e.jsxs("div",{className:"h-full flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:[c.length," ไธชๅ‚ๆ•ฐ"]}),e.jsxs(_,{type:"button",size:"sm",variant:"outline",onClick:h,className:"h-7 text-xs",children:[e.jsx(Xs,{className:"h-3 w-3 mr-1"}),"ๆทปๅŠ ๅ‚ๆ•ฐ"]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto space-y-1",children:c.length===0?e.jsx("div",{className:"text-sm text-muted-foreground text-center py-4 border border-dashed rounded-md",children:r}):e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"grid gap-2 text-xs text-muted-foreground px-1 sticky top-0 bg-background z-10",style:{gridTemplateColumns:"32px 1fr 1fr 90px 32px"},children:[e.jsx("span",{}),e.jsx("span",{children:"้”ฎๅ"}),e.jsx("span",{children:"ๅ€ผ"}),e.jsx("span",{children:"็ฑปๅž‹"}),e.jsx("span",{})]}),c.map(j=>e.jsx(nN,{node:j,level:0,onUpdate:f,onRemove:p,onAddChild:g,onToggleExpand:N},j.id))]})})]})}function Xg(a){if(!a.trim())return{valid:!0,parsed:{}};try{const l=JSON.parse(a);return typeof l!="object"||l===null||Array.isArray(l)?{valid:!1,error:"ๅฟ…้กปๆ˜ฏไธ€ไธช JSON ๅฏน่ฑก {}"}:{valid:!0,parsed:l}}catch{return{valid:!1,error:"JSON ๆ ผๅผ้”™่ฏฏ"}}}function d4({value:a,onChange:l,className:r,placeholder:c="ๆทปๅŠ ้ขๅค–ๅ‚ๆ•ฐ..."}){const[d,m]=u.useState("list"),h=u.useMemo(()=>Object.keys(a||{}).length>0?JSON.stringify(a,null,2):"",[a]),[f,p]=u.useState(h),[g,N]=u.useState(null);u.useEffect(()=>{p(h)},[h]);const j=u.useMemo(()=>{const w=Xg(f);return w.valid&&w.parsed?{success:!0,data:w.parsed}:{success:!1,data:{}}},[f]),b=u.useCallback(w=>{const z=w;z==="json"&&d==="list"&&(p(Object.keys(a).length>0?JSON.stringify(a,null,2):""),N(null)),m(z)},[d,a]),y=u.useCallback(w=>{p(w);const z=Xg(w);z.valid&&z.parsed?(N(null),l(z.parsed)):N(z.error||"JSON ๆ ผๅผ้”™่ฏฏ")},[l]);return e.jsx("div",{className:P("h-full flex flex-col",r),children:e.jsxs(Jt,{value:d,onValueChange:b,className:"w-full flex-1 flex flex-col",children:[e.jsxs(Gt,{className:"h-8 p-0.5 bg-muted/60 w-fit",children:[e.jsx(Xe,{value:"list",className:"h-7 px-3 text-xs data-[state=active]:bg-background data-[state=active]:shadow-sm",children:"ๅฏ่ง†ๅŒ–็ผ–่พ‘"}),e.jsx(Xe,{value:"json",className:"h-7 px-3 text-xs data-[state=active]:bg-background data-[state=active]:shadow-sm",children:"JSON ็ผ–่พ‘"})]}),e.jsx(Ss,{value:"list",className:"mt-2 flex-1 flex flex-col overflow-hidden data-[state=inactive]:hidden data-[state=inactive]:h-0",children:e.jsx(o4,{value:a,onChange:l,placeholder:c})}),e.jsx(Ss,{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(Ut,{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(Ot,{className:"h-3 w-3"}),e.jsx("span",{children:"ๆœ‰ๆ•ˆ"})]})]}),e.jsx(pt,{value:f,onChange:w=>y(w.target.value),placeholder:`{ +`)):As},Je=u.useCallback(Ae=>{Ke.current=Ae,C(Ae.bot),H(Ae.personality);const Qe=Ae.chat;Qe.talk_value_rules||(Qe.talk_value_rules=[]),X(Qe),me(Ae.expression),je(Ae.emoji),ge(Ae.memory),D(Ae.tool),I(Ae.voice),Y(Ae.message_receive),fe(Ae.dream),G(Ae.lpmm_knowledge),A(Ae.keyword_reaction),Re(Ae.response_post_process),$e(Ae.chinese_typo),J(Ae.response_splitter),Le(Ae.log),De(Ae.debug),Me(Ae.experimental),Ts(Ae.maim_message),ia(Ae.telemetry),Bs(Ae.webui)},[]),Es=u.useCallback(()=>({...Ke.current,bot:E,personality:R,chat:O,expression:L,emoji:Ne,memory:re,tool:pe,voice:Q,message_receive:ue,dream:we,lpmm_knowledge:Ee,keyword_reaction:$,response_post_process:K,chinese_typo:se,response_splitter:cs,log:Z,debug:ne,experimental:xe,maim_message:ds,telemetry:Ct,webui:ut}),[E,R,O,L,Ne,re,pe,Q,ue,we,Ee,$,K,se,cs,Z,ne,xe,ds,Ct,ut]),ms=u.useCallback(async()=>{try{const Qe=(await jS()).replace(/"([^"]*)"/g,(As,mt)=>`"${mt.replace(/\\n/g,` +`).replace(/\\t/g," ").replace(/\\r/g,"\r").replace(/\\"/g,'"').replace(/\\\\/g,"\\")}"`);j(Qe),y(!1)}catch(Ae){M({variant:"destructive",title:"ๅŠ ่ฝฝๅคฑ่ดฅ",description:Ae instanceof Error?Ae.message:"ๅŠ ่ฝฝๆบไปฃ็ ๅคฑ่ดฅ"})}},[M]),Ms=u.useCallback(async()=>{try{l(!0);const Ae=await Hg();Je(Ae),f(!1),V.current=!1,await ms()}catch(Ae){console.error("ๅŠ ่ฝฝ้…็ฝฎๅคฑ่ดฅ:",Ae),M({title:"ๅŠ ่ฝฝๅคฑ่ดฅ",description:"ๆ— ๆณ•ๅŠ ่ฝฝ้…็ฝฎๆ–‡ไปถ",variant:"destructive"})}finally{l(!1)}},[M,ms,Je]);u.useEffect(()=>{Ms()},[Ms]);const{triggerAutoSave:We,cancelPendingAutoSave:Cs}=KS(V.current,m,f);Vt(E,"bot",V.current,We),Vt(R,"personality",V.current,We),Vt(O,"chat",V.current,We),Vt(L,"expression",V.current,We),Vt(Ne,"emoji",V.current,We),Vt(re,"memory",V.current,We),Vt(pe,"tool",V.current,We),Vt(Q,"voice",V.current,We),Vt(we,"dream",V.current,We),Vt(Ee,"lpmm_knowledge",V.current,We),Vt($,"keyword_reaction",V.current,We),Vt(K,"response_post_process",V.current,We),Vt(se,"chinese_typo",V.current,We),Vt(cs,"response_splitter",V.current,We),Vt(Z,"log",V.current,We),Vt(ne,"debug",V.current,We),Vt(ds,"maim_message",V.current,We),Vt(Ct,"telemetry",V.current,We),Vt(ut,"webui",V.current,We);const rs=async()=>{try{c(!0);try{_x(N)}catch(Qe){const As=Qe instanceof Error?Qe.message:"TOML ๆ ผๅผ้”™่ฏฏ",mt=He(As);y(!0),z(mt),M({variant:"destructive",title:"TOML ๆ ผๅผ้”™่ฏฏ",description:mt}),c(!1);return}const Ae=N.replace(/"([^"]*)"/g,(Qe,As)=>`"${As.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r")}"`);await vS(Ae),f(!1),y(!1),z(""),M({title:"ไฟๅญ˜ๆˆๅŠŸ",description:"้…็ฝฎๅทฒไฟๅญ˜"}),await Ms()}catch(Ae){y(!0);const Qe=Ae instanceof Error?Ae.message:"ไฟๅญ˜้…็ฝฎๅคฑ่ดฅ";z(Qe),M({variant:"destructive",title:"ไฟๅญ˜ๅคฑ่ดฅ",description:Qe})}finally{c(!1)}},is=async Ae=>{if(h){M({variant:"destructive",title:"ๅˆ‡ๆขๅคฑ่ดฅ",description:"่ฏทๅ…ˆไฟๅญ˜ๅฝ“ๅ‰ๆ›ดๆ”น"});return}if(g(Ae),Ae==="source")await ms();else try{const Qe=await Hg();Je(Qe),f(!1)}catch(Qe){console.error("ๅŠ ่ฝฝ้…็ฝฎๅคฑ่ดฅ:",Qe),M({title:"ๅŠ ่ฝฝๅคฑ่ดฅ",description:"ๆ— ๆณ•ๅŠ ่ฝฝ้…็ฝฎๆ–‡ไปถ",variant:"destructive"})}},ys=async()=>{try{c(!0),Cs(),await qg(Es()),f(!1),M({title:"ไฟๅญ˜ๆˆๅŠŸ",description:"้บฆ้บฆไธป็จ‹ๅบ้…็ฝฎๅทฒไฟๅญ˜"})}catch(Ae){console.error("ไฟๅญ˜้…็ฝฎๅคฑ่ดฅ:",Ae),M({title:"ไฟๅญ˜ๅคฑ่ดฅ",description:Ae.message,variant:"destructive"})}finally{c(!1)}},rt=async()=>{await S()},jt=async()=>{try{c(!0),Cs(),await qg(Es()),f(!1),M({title:"ไฟๅญ˜ๆˆๅŠŸ",description:"้…็ฝฎๅทฒไฟๅญ˜๏ผŒๅณๅฐ†้‡ๅฏ้บฆ้บฆ..."}),await new Promise(Ae=>setTimeout(Ae,QS)),await rt()}catch(Ae){console.error("ไฟๅญ˜ๅคฑ่ดฅ:",Ae),M({title:"ไฟๅญ˜ๅคฑ่ดฅ",description:Ae.message,variant:"destructive"})}finally{c(!1)}};return a?e.jsx(ts,{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(ts,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:gap-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl md:text-3xl font-bold",children:"้บฆ้บฆไธป็จ‹ๅบ้…็ฝฎ"}),e.jsx("p",{className:"text-muted-foreground mt-1 text-xs sm:text-sm",children:"็ฎก็†้บฆ้บฆ็š„ๆ ธๅฟƒๅŠŸ่ƒฝๅ’Œ่กŒไธบ่ฎพ็ฝฎ"})]}),e.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[e.jsxs(_,{onClick:p==="visual"?ys:rs,disabled:r||d||!h||F,size:"sm",variant:"outline",className:"w-20 sm:w-24",children:[e.jsx(gc,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),e.jsx("span",{className:"ml-1 truncate text-xs sm:text-sm",children:r?"ไฟๅญ˜ไธญ":d?"่‡ชๅŠจ":h?"ไฟๅญ˜":"ๅทฒไฟๅญ˜"})]}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{disabled:r||d||F,size:"sm",className:"w-20 sm:w-28",children:[e.jsx(pc,{className:"h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"ml-1 truncate text-xs sm:text-sm",children:F?"้‡ๅฏไธญ":h?"ไฟๅญ˜้‡ๅฏ":"้‡ๅฏ"})]})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎค้‡ๅฏ้บฆ้บฆ๏ผŸ"}),e.jsx(gs,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:h?"ๅฝ“ๅ‰ๆœ‰ๆœชไฟๅญ˜็š„้…็ฝฎๆ›ดๆ”นใ€‚็‚นๅ‡ป็กฎ่ฎคๅฐ†ๅ…ˆไฟๅญ˜้…็ฝฎ,็„ถๅŽ้‡ๅฏ้บฆ้บฆไฝฟๆ–ฐ้…็ฝฎ็”Ÿๆ•ˆใ€‚้‡ๅฏ่ฟ‡็จ‹ไธญ้บฆ้บฆๅฐ†ๆš‚ๆ—ถ็ฆป็บฟใ€‚":"ๅณๅฐ†้‡ๅฏ้บฆ้บฆไธป็จ‹ๅบใ€‚้‡ๅฏ่ฟ‡็จ‹ไธญ้บฆ้บฆๅฐ†ๆš‚ๆ—ถ็ฆป็บฟ,้…็ฝฎๅฐ†ๅœจ้‡ๅฏๅŽ็”Ÿๆ•ˆใ€‚"})})})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:h?jt:rt,children:h?"ไฟๅญ˜ๅนถ้‡ๅฏ":"็กฎ่ฎค้‡ๅฏ"})]})]})]})]})]}),e.jsx("div",{className:"flex",children:e.jsx(Jt,{value:p,onValueChange:Ae=>is(Ae),className:"w-full",children:e.jsxs(Gt,{className:"h-8 sm:h-9 w-full grid grid-cols-2",children:[e.jsxs(Xe,{value:"visual",className:"text-xs sm:text-sm",children:[e.jsx(uv,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"ๅฏ่ง†ๅŒ–็ผ–่พ‘"]}),e.jsxs(Xe,{value:"source",className:"text-xs sm:text-sm",children:[e.jsx(dx,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"ๆบไปฃ็ ็ผ–่พ‘"]})]})})})]}),e.jsxs(ht,{children:[e.jsx(Yt,{className:"h-4 w-4"}),e.jsxs(ft,{children:["้…็ฝฎๆ›ดๆ–ฐๅŽ้œ€่ฆ",e.jsx("strong",{children:"้‡ๅฏ้บฆ้บฆ"}),'ๆ‰่ƒฝ็”Ÿๆ•ˆใ€‚ไฝ ๅฏไปฅ็‚นๅ‡ปๅณไธŠ่ง’็š„"ไฟๅญ˜ๅนถ้‡ๅฏ"ๆŒ‰้’ฎไธ€้”ฎๅฎŒๆˆไฟๅญ˜ๅ’Œ้‡ๅฏใ€‚']})]}),p==="source"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(ht,{children:[e.jsx(Yt,{className:"h-4 w-4"}),e.jsxs(ft,{children:[e.jsx("strong",{children:"ๆบไปฃ็ ๆจกๅผ๏ผˆ้ซ˜็บงๅŠŸ่ƒฝ๏ผ‰๏ผš"}),"็›ดๆŽฅ็ผ–่พ‘ TOML ้…็ฝฎๆ–‡ไปถใ€‚ๆญคๅŠŸ่ƒฝไป…้€‚็”จไบŽ็†Ÿๆ‚‰ TOML ่ฏญๆณ•็š„้ซ˜็บง็”จๆˆทใ€‚ไฟๅญ˜ๆ—ถไผšๅœจๅ‰็ซฏ้ชŒ่ฏๆ ผๅผ๏ผŒๅชๆœ‰ๆ ผๅผๅฎŒๅ…จๆญฃ็กฎๆ‰่ƒฝไฟๅญ˜ใ€‚",b&&w&&e.jsxs("div",{className:"text-destructive font-semibold mt-3 p-3 bg-destructive/10 rounded-md",children:[e.jsx("div",{className:"font-bold mb-2",children:"โš ๏ธ TOML ๆ ผๅผ้”™่ฏฏ๏ผš"}),e.jsx("pre",{className:"text-sm font-mono whitespace-pre-wrap break-words",children:w})]})]})]}),e.jsx(Qv,{value:N,onChange:Ae=>{j(Ae),f(!0),b&&(y(!1),z(""))},language:"toml",theme:"dark",height:"calc(100vh - 280px)",minHeight:"500px",placeholder:"TOML ้…็ฝฎๅ†…ๅฎน"})]}),p==="visual"&&e.jsx(e.Fragment,{children:e.jsxs(Jt,{defaultValue:"bot",className:"w-full",children:[e.jsxs(Gt,{className:"flex flex-wrap h-auto gap-1 p-1 sm:grid sm:grid-cols-5 lg:grid-cols-10",children:[e.jsx(Xe,{value:"bot",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"ๅŸบๆœฌไฟกๆฏ"}),e.jsx(Xe,{value:"personality",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"ไบบๆ ผ"}),e.jsx(Xe,{value:"chat",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"่Šๅคฉ"}),e.jsx(Xe,{value:"expression",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"่กจ่พพ"}),e.jsx(Xe,{value:"features",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"ๅŠŸ่ƒฝ"}),e.jsx(Xe,{value:"processing",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"ๅค„็†"}),e.jsx(Xe,{value:"dream",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"ๅšๆขฆ"}),e.jsx(Xe,{value:"lpmm",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"็Ÿฅ่ฏ†ๅบ“"}),e.jsx(Xe,{value:"webui",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"WebUI"}),e.jsx(Xe,{value:"other",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"ๅ…ถไป–"})]}),e.jsx(Ss,{value:"bot",className:"space-y-4",children:E&&e.jsx(W2,{config:E,onChange:C})}),e.jsx(Ss,{value:"personality",className:"space-y-4",children:R&&e.jsx(eS,{config:R,onChange:H})}),e.jsx(Ss,{value:"chat",className:"space-y-4",children:O&&e.jsx(aS,{config:O,onChange:X})}),e.jsx(Ss,{value:"expression",className:"space-y-4",children:L&&e.jsx(xS,{config:L,onChange:me})}),e.jsx(Ss,{value:"features",className:"space-y-4",children:Ne&&re&&pe&&Q&&e.jsx(uS,{emojiConfig:Ne,memoryConfig:re,toolConfig:pe,voiceConfig:Q,onEmojiChange:je,onMemoryChange:ge,onToolChange:D,onVoiceChange:I})}),e.jsxs(Ss,{value:"processing",className:"space-y-4",children:[$&&K&&se&&cs&&e.jsx(fS,{keywordReactionConfig:$,responsePostProcessConfig:K,chineseTypoConfig:se,responseSplitterConfig:cs,onKeywordReactionChange:A,onResponsePostProcessChange:Re,onChineseTypoChange:$e,onResponseSplitterChange:J}),ue&&e.jsx(pS,{config:ue,onChange:Y})]}),e.jsx(Ss,{value:"dream",className:"space-y-4",children:we&&e.jsx(lS,{config:we,onChange:fe})}),e.jsx(Ss,{value:"lpmm",className:"space-y-4",children:Ee&&e.jsx(nS,{config:Ee,onChange:G})}),e.jsx(Ss,{value:"webui",className:"space-y-4",children:ut&&e.jsx(gS,{config:ut,onChange:Bs})}),e.jsxs(Ss,{value:"other",className:"space-y-4",children:[Z&&e.jsx(rS,{config:Z,onChange:Le}),ne&&e.jsx(iS,{config:ne,onChange:De}),xe&&e.jsx(cS,{config:xe,onChange:Me}),ds&&e.jsx(oS,{config:ds,onChange:Ts}),Ct&&e.jsx(dS,{config:Ct,onChange:ia})]})]})}),e.jsx(nr,{})]})})}const ql=u.forwardRef(({className:a,...l},r)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:r,className:P("w-full caption-bottom text-sm",a),...l})}));ql.displayName="Table";const Vl=u.forwardRef(({className:a,...l},r)=>e.jsx("thead",{ref:r,className:P("[&_tr]:border-b",a),...l}));Vl.displayName="TableHeader";const Gl=u.forwardRef(({className:a,...l},r)=>e.jsx("tbody",{ref:r,className:P("[&_tr:last-child]:border-0",a),...l}));Gl.displayName="TableBody";const XS=u.forwardRef(({className:a,...l},r)=>e.jsx("tfoot",{ref:r,className:P("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",a),...l}));XS.displayName="TableFooter";const _t=u.forwardRef(({className:a,...l},r)=>e.jsx("tr",{ref:r,className:P("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",a),...l}));_t.displayName="TableRow";const ns=u.forwardRef(({className:a,...l},r)=>e.jsx("th",{ref:r,className:P("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",a),...l}));ns.displayName="TableHead";const Ze=u.forwardRef(({className:a,...l},r)=>e.jsx("td",{ref:r,className:P("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",a),...l}));Ze.displayName="TableCell";const ZS=u.forwardRef(({className:a,...l},r)=>e.jsx("caption",{ref:r,className:P("mt-4 text-sm text-muted-foreground",a),...l}));ZS.displayName="TableCaption";const md=u.forwardRef(({className:a,...l},r)=>e.jsx(ka,{ref:r,className:P("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",a),...l}));md.displayName=ka.displayName;const xd=u.forwardRef(({className:a,...l},r)=>e.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[e.jsx($t,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(ka.Input,{ref:r,className:P("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",a),...l})]}));xd.displayName=ka.Input.displayName;const hd=u.forwardRef(({className:a,...l},r)=>e.jsx(ka.List,{ref:r,className:P("max-h-[300px] overflow-y-auto overflow-x-hidden",a),...l}));hd.displayName=ka.List.displayName;const fd=u.forwardRef((a,l)=>e.jsx(ka.Empty,{ref:l,className:"py-6 text-center text-sm",...a}));fd.displayName=ka.Empty.displayName;const uc=u.forwardRef(({className:a,...l},r)=>e.jsx(ka.Group,{ref:r,className:P("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",a),...l}));uc.displayName=ka.Group.displayName;const WS=u.forwardRef(({className:a,...l},r)=>e.jsx(ka.Separator,{ref:r,className:P("-mx-1 h-px bg-border",a),...l}));WS.displayName=ka.Separator.displayName;const mc=u.forwardRef(({className:a,...l},r)=>e.jsx(ka.Item,{ref:r,className:P("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",a),...l}));mc.displayName=ka.Item.displayName;const Zv=j_,Wv=v_,eN=N_,Tx=u.forwardRef(({className:a,sideOffset:l=4,...r},c)=>e.jsx(g_,{children:e.jsx(Zj,{ref:c,sideOffset:l,className:P("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",a),...r})}));Tx.displayName=Zj.displayName;function Il({content:a,className:l,iconClassName:r,side:c="top",align:d="center",maxWidth:m="300px"}){return e.jsx(Zv,{delayDuration:200,children:e.jsxs(Wv,{children:[e.jsx(eN,{asChild:!0,children:e.jsxs("button",{type:"button",className:P("inline-flex items-center justify-center rounded-full","text-muted-foreground hover:text-foreground","transition-colors cursor-help","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",l),onClick:h=>h.preventDefault(),children:[e.jsx(ox,{className:P("h-4 w-4",r)}),e.jsx("span",{className:"sr-only",children:"ๅธฎๅŠฉไฟกๆฏ"})]})}),e.jsx(Tx,{side:c,align:d,className:P("max-w-[var(--max-width)] text-sm leading-relaxed","bg-background text-foreground","border-2 border-primary shadow-lg","p-4"),style:{"--max-width":m},children:a})]})})}const sN=u.createContext(null),tN="maibot-completed-tours";function e4(){try{const a=localStorage.getItem(tN);return a?new Set(JSON.parse(a)):new Set}catch{return new Set}}function Qg(a){localStorage.setItem(tN,JSON.stringify([...a]))}function s4({children:a}){const[l,r]=u.useState({activeTourId:null,stepIndex:0,isRunning:!1}),[c]=u.useState(()=>new Map),[d,m]=u.useState(e4),[,h]=u.useState(0),f=u.useCallback((E,C)=>{c.set(E,C),h(R=>R+1)},[c]),p=u.useCallback(E=>{c.delete(E),r(C=>C.activeTourId===E?{...C,activeTourId:null,isRunning:!1,stepIndex:0}:C)},[c]),g=u.useCallback((E,C=0)=>{c.has(E)&&r({activeTourId:E,stepIndex:C,isRunning:!0})},[c]),N=u.useCallback(()=>{r(E=>({...E,isRunning:!1}))},[]),j=u.useCallback(E=>{r(C=>({...C,stepIndex:E}))},[]),b=u.useCallback(()=>{r(E=>({...E,stepIndex:E.stepIndex+1}))},[]),y=u.useCallback(()=>{r(E=>({...E,stepIndex:Math.max(0,E.stepIndex-1)}))},[]),w=u.useCallback(()=>l.activeTourId?c.get(l.activeTourId)||[]:[],[l.activeTourId,c]),z=u.useCallback(E=>{m(C=>{const R=new Set(C);return R.add(E),Qg(R),R})},[]),M=u.useCallback(E=>{const{action:C,index:R,status:H,type:O}=E,X=["finished","skipped"];if(C==="close"){r(L=>({...L,isRunning:!1,stepIndex:0}));return}X.includes(H)?r(L=>(H==="finished"&&L.activeTourId&&setTimeout(()=>z(L.activeTourId),0),{...L,isRunning:!1,stepIndex:0})):O==="step:after"&&(C==="next"?r(L=>({...L,stepIndex:R+1})):C==="prev"&&r(L=>({...L,stepIndex:R-1})))},[z]),S=u.useCallback(E=>d.has(E),[d]),F=u.useCallback(E=>{m(C=>{const R=new Set(C);return R.delete(E),Qg(R),R})},[]);return e.jsx(sN.Provider,{value:{state:l,tours:c,registerTour:f,unregisterTour:p,startTour:g,stopTour:N,goToStep:j,nextStep:b,prevStep:y,getCurrentSteps:w,handleJoyrideCallback:M,isTourCompleted:S,markTourCompleted:z,resetTourCompleted:F},children:a})}function Ex(){const a=u.useContext(sN);if(!a)throw new Error("useTour must be used within a TourProvider");return a}const t4={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)"}},a4={back:"ไธŠไธ€ๆญฅ",close:"ๅ…ณ้—ญ",last:"ๅฎŒๆˆ",next:"ไธ‹ไธ€ๆญฅ",nextLabelWithProgress:"ไธ‹ไธ€ๆญฅ ({step}/{steps})",open:"ๆ‰“ๅผ€ๅฏน่ฏๆก†",skip:"่ทณ่ฟ‡"};function l4(){const{state:a,getCurrentSteps:l,handleJoyrideCallback:r}=Ex(),c=l(),[d,m]=u.useState(!1),h=u.useRef(a.stepIndex),f=u.useRef(null);u.useEffect(()=>{h.current!==a.stepIndex&&(m(!1),h.current=a.stepIndex)},[a.stepIndex]),u.useEffect(()=>{if(!a.isRunning||c.length===0){m(!1);return}const j=c[a.stepIndex];if(!j){m(!1);return}const b=j.target;if(b==="body"){m(!0);return}m(!1);const y=setTimeout(()=>{const w=()=>{const F=document.querySelector(b);if(F){const E=F.getBoundingClientRect();if(E.width>0&&E.height>0)return!0}return!1};if(w()){setTimeout(()=>m(!0),100);return}const z=setInterval(()=>{w()&&(clearInterval(z),setTimeout(()=>m(!0),100))},100),M=setTimeout(()=>{clearInterval(z),m(!0)},5e3),S=()=>{clearInterval(z),clearTimeout(M)};f.current=S},150);return()=>{clearTimeout(y),f.current&&(f.current(),f.current=null)}},[a.isRunning,a.stepIndex,c]);const[p,g]=u.useState(null);if(u.useEffect(()=>{let j=document.getElementById("tour-portal-container");return j||(j=document.createElement("div"),j.id="tour-portal-container",j.style.cssText="position: fixed; top: 0; left: 0; z-index: 99999; pointer-events: none;",document.body.appendChild(j)),g(j),()=>{}},[]),!a.isRunning||c.length===0||!d)return null;const N=e.jsx(g1,{steps:c,stepIndex:a.stepIndex,run:a.isRunning,continuous:!0,showSkipButton:!0,showProgress:!0,disableOverlayClose:!0,disableScrolling:!1,disableScrollParentFix:!1,callback:r,styles:t4,locale:a4,scrollOffset:80,scrollToFirstStep:!0,floaterProps:{styles:{floater:{zIndex:99999}},disableAnimation:!0}},`tour-step-${a.stepIndex}`);return p?tw.createPortal(N,p):N}const gl="model-assignment-tour",aN=[{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}],lN={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"},Wi=[{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 Yg(a){return a?a.replace(/\/+$/,"").toLowerCase():""}function n4(a){if(!a)return null;const l=Yg(a);return Wi.find(r=>r.id!=="custom"&&Yg(r.base_url)===l)||null}const Lo=a=>({...a,max_retry:a.max_retry??2,timeout:a.timeout??30,retry_interval:a.retry_interval??10}),r4=(a,l=[],r=null)=>{const c={};return a?(a.name?.trim()?l.some((m,h)=>r!==null&&h===r?!1:m.name.trim().toLowerCase()===a.name.trim().toLowerCase())&&(c.name="ๆไพ›ๅ•†ๅ็งฐๅทฒๅญ˜ๅœจ๏ผŒ่ฏทไฝฟ็”จๅ…ถไป–ๅ็งฐ"):c.name="่ฏท่พ“ๅ…ฅๆไพ›ๅ•†ๅ็งฐ",a.base_url?.trim()||(c.base_url="่ฏท่พ“ๅ…ฅๅŸบ็ก€ URL"),a.api_key?.trim()||(c.api_key="่ฏท่พ“ๅ…ฅ API Key"),{isValid:Object.keys(c).length===0,errors:c}):{isValid:!1,errors:{name:"ๆไพ›ๅ•†ๆ•ฐๆฎไธบ็ฉบ"}}};function i4(){return e.jsx(lr,{children:e.jsx(c4,{})})}function c4(){const[a,l]=u.useState([]),[r,c]=u.useState(!0),[d,m]=u.useState(!1),[h,f]=u.useState(!1),[p,g]=u.useState(!1),[N,j]=u.useState(!1),[b,y]=u.useState(null),[w,z]=u.useState(null),[M,S]=u.useState("custom"),[F,E]=u.useState(!1),[C,R]=u.useState(!1),[H,O]=u.useState(null),[X,L]=u.useState(!1),[me,Ne]=u.useState(""),[je,re]=u.useState(new Set),[ge,pe]=u.useState(!1),[D,Q]=u.useState(1),[I,ue]=u.useState(20),[Y,we]=u.useState(""),[fe,Ee]=u.useState({isOpen:!1,providersToDelete:[],affectedModels:[],pendingProviders:[],context:"auto",oldProviders:[]}),[G,$]=u.useState({}),[A,K]=u.useState(new Set),[Re,se]=u.useState(new Map),{toast:$e}=nt(),cs=ha(),{state:J,goToStep:Z,registerTour:Le}=Ex(),{triggerRestart:ne,isRestarting:De}=Tn(),xe=u.useRef(null),Me=u.useRef(!0);u.useEffect(()=>{Le(gl,aN)},[Le]),u.useEffect(()=>{if(J.activeTourId===gl&&J.isRunning){const te=lN[J.stepIndex];te&&!window.location.pathname.endsWith(te.replace("/config/",""))&&cs({to:te})}},[J.stepIndex,J.activeTourId,J.isRunning,cs]);const ds=u.useRef(J.stepIndex);u.useEffect(()=>{if(J.activeTourId===gl&&J.isRunning){const te=ds.current,_e=J.stepIndex;te>=3&&te<=9&&_e<3&&j(!1),te>=10&&_e>=3&&_e<=9&&($({}),S("custom"),y({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10}),z(null),L(!1),j(!0)),ds.current=_e}},[J.stepIndex,J.activeTourId,J.isRunning]),u.useEffect(()=>{if(J.activeTourId!==gl||!J.isRunning)return;const te=_e=>{const U=_e.target,Se=J.stepIndex;Se===2&&U.closest('[data-tour="add-provider-button"]')?setTimeout(()=>Z(3),300):Se===9&&U.closest('[data-tour="provider-cancel-button"]')&&setTimeout(()=>Z(10),300)};return document.addEventListener("click",te,!0),()=>document.removeEventListener("click",te,!0)},[J,Z]),u.useEffect(()=>{Ts()},[]);const Ts=async()=>{try{c(!0);const te=await Nn();l(te.api_providers||[]),g(!1),Me.current=!1}catch(te){console.error("ๅŠ ่ฝฝ้…็ฝฎๅคฑ่ดฅ:",te)}finally{c(!1)}},Ct=async()=>{await ne()},ia=async()=>{try{m(!0),xe.current&&clearTimeout(xe.current);const te=a.map(es=>({...es,max_retry:es.max_retry??2,timeout:es.timeout??30,retry_interval:es.retry_interval??10})),{shouldProceed:_e}=await ut(te,"restart");if(!_e){m(!1);return}const U=await Nn(),Se=new Set(te.map(es=>es.name)),us=(U.models||[]).filter(es=>Se.has(es.api_provider));U.api_providers=te,U.models=us,await lc(U),g(!1),$e({title:"ไฟๅญ˜ๆˆๅŠŸ",description:"ๆญฃๅœจ้‡ๅฏ้บฆ้บฆ..."}),await Ct()}catch(te){console.error("ไฟๅญ˜้…็ฝฎๅคฑ่ดฅ:",te),$e({title:"ไฟๅญ˜ๅคฑ่ดฅ",description:te.message,variant:"destructive"}),m(!1)}},ut=u.useCallback(async(te,_e="auto")=>{try{const U=await Nn(),Se=new Set(a.map($s=>$s.name)),as=new Set(te.map($s=>$s.name)),us=Array.from(Se).filter($s=>!as.has($s));if(us.length===0)return{shouldProceed:!0,providers:te};const Tt=(U.models||[]).filter($s=>us.includes($s.api_provider));return Tt.length===0?{shouldProceed:!0,providers:te}:(Ee({isOpen:!0,providersToDelete:us,affectedModels:Tt,pendingProviders:te,context:_e,oldProviders:[...a]}),{shouldProceed:!1,providers:te})}catch(U){return console.error("ๆฃ€ๆŸฅๅˆ ้™คๅฝฑๅ“ๅคฑ่ดฅ:",U),{shouldProceed:!0,providers:te}}},[a]),Bs=async()=>{try{(fe.context==="auto"?f:m)(!0),Ee($s=>({...$s,isOpen:!1}));const _e=await Nn(),U=fe.pendingProviders.map(Lo),Se=new Set(U.map($s=>$s.name)),us=(_e.models||[]).filter($s=>Se.has($s.api_provider)),es=new Set(fe.affectedModels.map($s=>$s.name)),Tt=_e.model_task_config;Tt&&Object.keys(Tt).forEach($s=>{const pa=Tt[$s];pa&&Array.isArray(pa.model_list)&&(pa.model_list=pa.model_list.filter(oa=>!es.has(oa)))}),_e.api_providers=U,_e.models=us,_e.model_task_config=Tt,await lc(_e),l(fe.pendingProviders),g(!1),$e({title:"ๅˆ ้™คๆˆๅŠŸ",description:`ๅทฒๅˆ ้™ค ${fe.providersToDelete.length} ไธชๆไพ›ๅ•†ๅ’Œ ${fe.affectedModels.length} ไธชๅ…ณ่”ๆจกๅž‹`}),Ee({isOpen:!1,providersToDelete:[],affectedModels:[],pendingProviders:[],context:"auto",oldProviders:[]}),re(new Set),fe.context==="restart"&&await Ct()}catch(te){console.error("ๅˆ ้™คๅคฑ่ดฅ:",te),$e({title:"ๅˆ ้™คๅคฑ่ดฅ",description:te.message,variant:"destructive"})}finally{fe.context==="auto"?f(!1):m(!1)}},V=()=>{fe.oldProviders.length>0&&l(fe.oldProviders),Ee({isOpen:!1,providersToDelete:[],affectedModels:[],pendingProviders:[],context:"auto",oldProviders:[]}),g(!1)},Ke=u.useCallback(async te=>{if(Me.current)return;const{shouldProceed:_e}=await ut(te,"auto");if(!_e){g(!0);return}try{f(!0);const U=te.map(Lo);await Wm("api_providers",U),g(!1)}catch(U){console.error("่‡ชๅŠจไฟๅญ˜ๅคฑ่ดฅ:",U),$e({title:"่‡ชๅŠจไฟๅญ˜ๅคฑ่ดฅ",description:U.message,variant:"destructive"}),g(!0)}finally{f(!1)}},[a,ut]);u.useEffect(()=>{if(!Me.current)return g(!0),xe.current&&clearTimeout(xe.current),xe.current=setTimeout(()=>{Ke(a)},2e3),()=>{xe.current&&clearTimeout(xe.current)}},[a,Ke]);const He=async()=>{try{m(!0),xe.current&&clearTimeout(xe.current);const te=a.map(Lo),{shouldProceed:_e}=await ut(te,"manual");if(!_e){m(!1);return}const U=await Nn(),Se=new Set(te.map(es=>es.name)),as=U.models||[],us=as.filter(es=>{const Tt=Se.has(es.api_provider);return Tt||console.warn(`ๆจกๅž‹ "${es.name}" ๅผ•็”จไบ†ๅทฒๅˆ ้™ค็š„ๆไพ›ๅ•† "${es.api_provider}"๏ผŒๅฐ†่ขซ็งป้™ค`),Tt});if(as.length!==us.length){const es=as.length-us.length;$e({title:"ๆณจๆ„",description:`ๅทฒ่‡ชๅŠจ็งป้™ค ${es} ไธชๅผ•็”จๅทฒๅˆ ้™คๆไพ›ๅ•†็š„ๆจกๅž‹`,variant:"default"})}console.log("ๅ‘้€็š„ providers ๆ•ฐๆฎ:",te),U.api_providers=te,U.models=us,console.log("ๅฎŒๆ•ด้…็ฝฎๆ•ฐๆฎ:",U),await lc(U),g(!1),$e({title:"ไฟๅญ˜ๆˆๅŠŸ",description:"ๆจกๅž‹ๆไพ›ๅ•†้…็ฝฎๅทฒไฟๅญ˜"})}catch(te){console.error("ไฟๅญ˜้…็ฝฎๅคฑ่ดฅ:",te),$e({title:"ไฟๅญ˜ๅคฑ่ดฅ",description:te.message,variant:"destructive"})}finally{m(!1)}},Je=(te,_e)=>{if($({}),te){const U=Wi.find(Se=>Se.base_url===te.base_url&&Se.client_type===te.client_type);S(U?.id||"custom"),y(te)}else S("custom"),y({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10});z(_e),L(!1),j(!0)},Es=u.useCallback(te=>{S(te),E(!1);const _e=Wi.find(U=>U.id===te);_e&&_e.id!=="custom"?y(U=>({...U,name:_e.name,base_url:_e.base_url,client_type:_e.client_type})):_e?.id==="custom"&&y(U=>({...U,name:"",base_url:"",client_type:"openai"}))},[]),ms=u.useMemo(()=>M!=="custom",[M]),Ms=u.useCallback(async()=>{if(b?.api_key)try{await navigator.clipboard.writeText(b.api_key),$e({title:"ๅคๅˆถๆˆๅŠŸ",description:"API Key ๅทฒๅคๅˆถๅˆฐๅ‰ช่ดดๆฟ"})}catch{$e({title:"ๅคๅˆถๅคฑ่ดฅ",description:"ๆ— ๆณ•่ฎฟ้—ฎๅ‰ช่ดดๆฟ",variant:"destructive"})}},[b?.api_key,$e]),We=()=>{if(!b)return;const{isValid:te,errors:_e}=r4(b,a,w);if(!te){$(_e);return}$({});const U=Lo(b);if(w!==null){const Se=[...a];Se[w]=U,l(Se)}else l([...a,U]);j(!1),y(null),z(null)},Cs=te=>{if(!te&&b){const _e={...b,max_retry:b.max_retry??2,timeout:b.timeout??30,retry_interval:b.retry_interval??10};y(_e)}j(te)},rs=te=>{O(te),R(!0)},is=async()=>{if(H!==null){const te=a.filter((U,Se)=>Se!==H),{shouldProceed:_e}=await ut(te,"manual");_e&&(l(te),$e({title:"ๅˆ ้™คๆˆๅŠŸ",description:"ๆไพ›ๅ•†ๅทฒไปŽๅˆ—่กจไธญ็งป้™ค"}))}R(!1),O(null)},ys=te=>{const _e=new Set(je);_e.has(te)?_e.delete(te):_e.add(te),re(_e)},rt=()=>{if(je.size===Qe.length)re(new Set);else{const te=Qe.map((_e,U)=>a.findIndex(Se=>Se===Qe[U]));re(new Set(te))}},jt=()=>{if(je.size===0){$e({title:"ๆ็คบ",description:"่ฏทๅ…ˆ้€‰ๆ‹ฉ่ฆๅˆ ้™ค็š„ๆไพ›ๅ•†",variant:"default"});return}pe(!0)},Ae=async()=>{const te=a.filter((U,Se)=>!je.has(Se)),{shouldProceed:_e}=await ut(te,"manual");_e&&(l(te),re(new Set),$e({title:"ๆ‰น้‡ๅˆ ้™คๆˆๅŠŸ",description:`ๅทฒๅˆ ้™ค ${je.size} ไธชๆไพ›ๅ•†`})),pe(!1)},Qe=u.useMemo(()=>{if(!me)return a;const te=me.toLowerCase();return a.filter(_e=>_e.name.toLowerCase().includes(te)||_e.base_url.toLowerCase().includes(te)||_e.client_type.toLowerCase().includes(te))},[a,me]),{totalPages:As,paginatedProviders:mt}=u.useMemo(()=>{const te=Math.ceil(Qe.length/I),_e=Qe.slice((D-1)*I,D*I);return{totalPages:te,paginatedProviders:_e}},[Qe,D,I]),Ht=u.useCallback(()=>{const te=parseInt(Y);te>=1&&te<=As&&(Q(te),we(""))},[Y,As]),ca=async te=>{K(_e=>new Set(_e).add(te));try{const _e=await yS(te);se(U=>new Map(U).set(te,_e)),_e.network_ok?_e.api_key_valid===!0?$e({title:"่ฟžๆŽฅๆญฃๅธธ",description:`${te} ็ฝ‘็ปœ่ฟžๆŽฅๆญฃๅธธ๏ผŒAPI Key ๆœ‰ๆ•ˆ (${_e.latency_ms}ms)`}):_e.api_key_valid===!1?$e({title:"่ฟžๆŽฅๆญฃๅธธไฝ† Key ๆ— ๆ•ˆ",description:`${te} ็ฝ‘็ปœ่ฟžๆŽฅๆญฃๅธธ๏ผŒไฝ† API Key ๆ— ๆ•ˆๆˆ–ๅทฒ่ฟ‡ๆœŸ`,variant:"destructive"}):$e({title:"็ฝ‘็ปœ่ฟžๆŽฅๆญฃๅธธ",description:`${te} ๅฏไปฅ่ฎฟ้—ฎ (${_e.latency_ms}ms)`}):$e({title:"่ฟžๆŽฅๅคฑ่ดฅ",description:_e.error||"ๆ— ๆณ•่ฟžๆŽฅๅˆฐๆไพ›ๅ•†",variant:"destructive"})}catch(_e){$e({title:"ๆต‹่ฏ•ๅคฑ่ดฅ",description:_e.message,variant:"destructive"})}finally{K(_e=>{const U=new Set(_e);return U.delete(te),U})}},Fa=async()=>{for(const te of a)await ca(te.name)},Xt=te=>{const _e=A.has(te),U=Re.get(te);return _e?e.jsxs(Ce,{variant:"secondary",className:"gap-1",children:[e.jsx(Fs,{className:"h-3 w-3 animate-spin"}),"ๆต‹่ฏ•ไธญ"]}):U?U.network_ok?U.api_key_valid===!0?e.jsxs(Ce,{className:"gap-1 bg-green-600 hover:bg-green-700",children:[e.jsx(st,{className:"h-3 w-3"}),"ๆญฃๅธธ"]}):U.api_key_valid===!1?e.jsxs(Ce,{variant:"destructive",className:"gap-1",children:[e.jsx(Ut,{className:"h-3 w-3"}),"Keyๆ— ๆ•ˆ"]}):e.jsxs(Ce,{className:"gap-1 bg-blue-600 hover:bg-blue-700",children:[e.jsx(st,{className:"h-3 w-3"}),"ๅฏ่ฎฟ้—ฎ"]}):e.jsxs(Ce,{variant:"destructive",className:"gap-1",children:[e.jsx(ta,{className:"h-3 w-3"}),"็ฆป็บฟ"]}):null};return r?e.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("p",{className:"text-muted-foreground",children:"ๅŠ ่ฝฝไธญ..."})})}):e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"AIๆจกๅž‹ๅŽ‚ๅ•†้…็ฝฎ"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"็ฎก็† AI ๆจกๅž‹ๅŽ‚ๅ•†็š„ API ้…็ฝฎ"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[je.size>0&&e.jsxs(_,{onClick:jt,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(os,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"ๆ‰น้‡ๅˆ ้™ค (",je.size,")"]}),e.jsxs(_,{onClick:Fa,size:"sm",variant:"outline",className:"w-full sm:w-auto",disabled:a.length===0||A.size>0,children:[e.jsx(sl,{className:"mr-2 h-4 w-4"}),A.size>0?`ๆต‹่ฏ•ไธญ (${A.size})`:"ๆต‹่ฏ•ๅ…จ้ƒจ"]}),e.jsxs(_,{onClick:()=>Je(null,null),size:"sm",className:"w-full sm:w-auto","data-tour":"add-provider-button",children:[e.jsx(Xs,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"ๆทปๅŠ ๆไพ›ๅ•†"]}),e.jsxs(_,{onClick:He,disabled:d||h||!p||De,size:"sm",variant:"outline",className:"w-full sm:w-auto sm:min-w-[120px]",children:[e.jsx(gc,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),d?"ไฟๅญ˜ไธญ...":h?"่‡ชๅŠจไฟๅญ˜ไธญ...":p?"ไฟๅญ˜้…็ฝฎ":"ๅทฒไฟๅญ˜"]}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{disabled:d||h||De,size:"sm",className:"w-full sm:w-auto sm:min-w-[120px]",children:[e.jsx(pc,{className:"mr-2 h-4 w-4"}),De?"้‡ๅฏไธญ...":p?"ไฟๅญ˜ๅนถ้‡ๅฏ":"้‡ๅฏ้บฆ้บฆ"]})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎค้‡ๅฏ้บฆ้บฆ๏ผŸ"}),e.jsx(gs,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:p?"ๅฝ“ๅ‰ๆœ‰ๆœชไฟๅญ˜็š„้…็ฝฎๆ›ดๆ”นใ€‚็‚นๅ‡ป็กฎ่ฎคๅฐ†ๅ…ˆไฟๅญ˜้…็ฝฎ,็„ถๅŽ้‡ๅฏ้บฆ้บฆไฝฟๆ–ฐ้…็ฝฎ็”Ÿๆ•ˆใ€‚้‡ๅฏ่ฟ‡็จ‹ไธญ้บฆ้บฆๅฐ†ๆš‚ๆ—ถ็ฆป็บฟใ€‚":"ๅณๅฐ†้‡ๅฏ้บฆ้บฆไธป็จ‹ๅบใ€‚้‡ๅฏ่ฟ‡็จ‹ไธญ้บฆ้บฆๅฐ†ๆš‚ๆ—ถ็ฆป็บฟ,้…็ฝฎๅฐ†ๅœจ้‡ๅฏๅŽ็”Ÿๆ•ˆใ€‚"})})})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:p?ia:Ct,children:p?"ไฟๅญ˜ๅนถ้‡ๅฏ":"็กฎ่ฎค้‡ๅฏ"})]})]})]})]})]}),e.jsxs(ht,{children:[e.jsx(Yt,{className:"h-4 w-4"}),e.jsxs(ft,{children:["้…็ฝฎๆ›ดๆ–ฐๅŽ้œ€่ฆ",e.jsx("strong",{children:"้‡ๅฏ้บฆ้บฆ"}),'ๆ‰่ƒฝ็”Ÿๆ•ˆใ€‚ไฝ ๅฏไปฅ็‚นๅ‡ปๅณไธŠ่ง’็š„"ไฟๅญ˜ๅนถ้‡ๅฏ"ๆŒ‰้’ฎไธ€้”ฎๅฎŒๆˆไฟๅญ˜ๅ’Œ้‡ๅฏใ€‚']})]}),e.jsxs(ts,{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($t,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ae,{placeholder:"ๆœ็ดขๆไพ›ๅ•†ๅ็งฐใ€URL ๆˆ–็ฑปๅž‹...",value:me,onChange:te=>Ne(te.target.value),className:"pl-9"})]}),me&&e.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["ๆ‰พๅˆฐ ",Qe.length," ไธช็ป“ๆžœ"]})]}),e.jsx("div",{className:"md:hidden space-y-3",children:Qe.length===0?e.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:me?"ๆœชๆ‰พๅˆฐๅŒน้…็š„ๆไพ›ๅ•†":'ๆš‚ๆ— ๆไพ›ๅ•†้…็ฝฎ๏ผŒ็‚นๅ‡ป"ๆทปๅŠ ๆไพ›ๅ•†"ๅผ€ๅง‹้…็ฝฎ'}):mt.map((te,_e)=>{const U=a.findIndex(Se=>Se===te);return e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h3",{className:"font-semibold text-base truncate",children:te.name}),Xt(te.name)]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:te.base_url})]}),e.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>ca(te.name),disabled:A.has(te.name),title:"ๆต‹่ฏ•่ฟžๆŽฅ",children:A.has(te.name)?e.jsx(Fs,{className:"h-4 w-4 animate-spin"}):e.jsx(sl,{className:"h-4 w-4"})}),e.jsx(_,{variant:"default",size:"sm",onClick:()=>Je(te,U),children:e.jsx(Zn,{className:"h-4 w-4",strokeWidth:2,fill:"none"})}),e.jsx(_,{size:"sm",onClick:()=>rs(U),className:"bg-red-600 hover:bg-red-700 text-white",children:e.jsx(os,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"ๅฎขๆˆท็ซฏ็ฑปๅž‹"}),e.jsx("p",{className:"font-medium",children:te.client_type})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"ๆœ€ๅคง้‡่ฏ•"}),e.jsx("p",{className:"font-medium",children:te.max_retry})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"่ถ…ๆ—ถ(็ง’)"}),e.jsx("p",{className:"font-medium",children:te.timeout})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"้‡่ฏ•้—ด้š”(็ง’)"}),e.jsx("p",{className:"font-medium",children:te.retry_interval})]})]})]},_e)})}),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(ql,{children:[e.jsx(Vl,{children:e.jsxs(_t,{children:[e.jsx(ns,{className:"w-12",children:e.jsx(tt,{checked:je.size===Qe.length&&Qe.length>0,onCheckedChange:rt})}),e.jsx(ns,{children:"็Šถๆ€"}),e.jsx(ns,{children:"ๅ็งฐ"}),e.jsx(ns,{children:"ๅŸบ็ก€URL"}),e.jsx(ns,{children:"ๅฎขๆˆท็ซฏ็ฑปๅž‹"}),e.jsx(ns,{className:"text-right",children:"ๆœ€ๅคง้‡่ฏ•"}),e.jsx(ns,{className:"text-right",children:"่ถ…ๆ—ถ(็ง’)"}),e.jsx(ns,{className:"text-right",children:"้‡่ฏ•้—ด้š”(็ง’)"}),e.jsx(ns,{className:"text-right",children:"ๆ“ไฝœ"})]})}),e.jsx(Gl,{children:mt.length===0?e.jsx(_t,{children:e.jsx(Ze,{colSpan:9,className:"text-center text-muted-foreground py-8",children:me?"ๆœชๆ‰พๅˆฐๅŒน้…็š„ๆไพ›ๅ•†":'ๆš‚ๆ— ๆไพ›ๅ•†้…็ฝฎ๏ผŒ็‚นๅ‡ป"ๆทปๅŠ ๆไพ›ๅ•†"ๅผ€ๅง‹้…็ฝฎ'})}):mt.map((te,_e)=>{const U=a.findIndex(Se=>Se===te);return e.jsxs(_t,{children:[e.jsx(Ze,{children:e.jsx(tt,{checked:je.has(U),onCheckedChange:()=>ys(U)})}),e.jsx(Ze,{children:Xt(te.name)||e.jsx(Ce,{variant:"outline",className:"text-muted-foreground",children:"ๆœชๆต‹่ฏ•"})}),e.jsx(Ze,{className:"font-medium",children:te.name}),e.jsx(Ze,{className:"max-w-xs truncate",title:te.base_url,children:te.base_url}),e.jsx(Ze,{children:te.client_type}),e.jsx(Ze,{className:"text-right",children:te.max_retry}),e.jsx(Ze,{className:"text-right",children:te.timeout}),e.jsx(Ze,{className:"text-right",children:te.retry_interval}),e.jsx(Ze,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>ca(te.name),disabled:A.has(te.name),title:"ๆต‹่ฏ•่ฟžๆŽฅ",children:A.has(te.name)?e.jsx(Fs,{className:"h-4 w-4 animate-spin"}):e.jsx(sl,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"default",size:"sm",onClick:()=>Je(te,U),children:[e.jsx(Zn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"็ผ–่พ‘"]}),e.jsxs(_,{size:"sm",onClick:()=>rs(U),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(os,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"ๅˆ ้™ค"]})]})})]},_e)})})]})})}),Qe.length>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{htmlFor:"page-size-provider",className:"text-sm whitespace-nowrap",children:"ๆฏ้กตๆ˜พ็คบ"}),e.jsxs(Pe,{value:I.toString(),onValueChange:te=>{ue(parseInt(te)),Q(1),re(new Set)},children:[e.jsx(Ie,{id:"page-size-provider",className:"w-20",children:e.jsx(Fe,{})}),e.jsxs(Be,{children:[e.jsx(W,{value:"10",children:"10"}),e.jsx(W,{value:"20",children:"20"}),e.jsx(W,{value:"50",children:"50"}),e.jsx(W,{value:"100",children:"100"})]})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["ๆ˜พ็คบ ",(D-1)*I+1," ๅˆฐ"," ",Math.min(D*I,Qe.length)," ๆก๏ผŒๅ…ฑ ",Qe.length," ๆก"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>Q(1),disabled:D===1,className:"hidden sm:flex",children:e.jsx(kn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>Q(te=>Math.max(1,te-1)),disabled:D===1,children:[e.jsx(Pa,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"ไธŠไธ€้กต"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae,{type:"number",value:Y,onChange:te=>we(te.target.value),onKeyDown:te=>te.key==="Enter"&&Ht(),placeholder:D.toString(),className:"w-16 h-8 text-center",min:1,max:As}),e.jsx(_,{variant:"outline",size:"sm",onClick:Ht,disabled:!Y,className:"h-8",children:"่ทณ่ฝฌ"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>Q(te=>te+1),disabled:D>=As,children:[e.jsx("span",{className:"hidden sm:inline",children:"ไธ‹ไธ€้กต"}),e.jsx(ra,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>Q(As),disabled:D>=As,className:"hidden sm:flex",children:e.jsx(Cn,{className:"h-4 w-4"})})]})]})]}),e.jsx(Qs,{open:N,onOpenChange:Cs,children:e.jsxs(Hs,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto","data-tour":"provider-dialog",preventOutsideClose:J.isRunning,children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:w!==null?"็ผ–่พ‘ๆไพ›ๅ•†":"ๆทปๅŠ ๆไพ›ๅ•†"}),e.jsx(at,{children:"้…็ฝฎ API ๆไพ›ๅ•†็š„่ฟžๆŽฅไฟกๆฏๅ’Œๅ‚ๆ•ฐ"})]}),e.jsxs("form",{onSubmit:te=>{te.preventDefault(),We()},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(cl,{open:F,onOpenChange:E,children:[e.jsx(ol,{asChild:!0,children:e.jsxs(_,{variant:"outline",role:"combobox","aria-expanded":F,className:"w-full justify-between",children:[M?Wi.find(te=>te.id===M)?.display_name:"้€‰ๆ‹ฉๆไพ›ๅ•†ๆจกๆฟ...",e.jsx(mx,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(tl,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:e.jsxs(md,{children:[e.jsx(xd,{placeholder:"ๆœ็ดขๆไพ›ๅ•†ๆจกๆฟ..."}),e.jsx(ts,{className:"h-[300px]",children:e.jsxs(hd,{className:"max-h-none overflow-visible",children:[e.jsx(fd,{children:"ๆœชๆ‰พๅˆฐๅŒน้…็š„ๆจกๆฟ"}),e.jsx(uc,{children:Wi.map(te=>e.jsxs(mc,{value:te.display_name,onSelect:()=>Es(te.id),children:[e.jsx(Ot,{className:`mr-2 h-4 w-4 ${M===te.id?"opacity-100":"opacity-0"}`}),te.display_name]},te.id))})]})})]})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"้€‰ๆ‹ฉ้ข„่ฎพๆจกๆฟๅฏ่‡ชๅŠจๅกซๅ…… URL ๅ’Œๅฎขๆˆท็ซฏ็ฑปๅž‹,ๆ”ฏๆŒๆœ็ดข"})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-name-input",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(T,{htmlFor:"name",className:G.name?"text-destructive":"",children:"ๅ็งฐ *"}),e.jsx(Il,{content:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"font-medium",children:"ๆไพ›ๅ•†ๅ็งฐ"}),e.jsx("p",{children:"ไธบ่ฟ™ไธช API ๆไพ›ๅ•†่ฎพ็ฝฎไธ€ไธชไพฟไบŽ่ฏ†ๅˆซ็š„ๅ็งฐ๏ผŒ็”จไบŽๅœจๆจกๅž‹้…็ฝฎไธญๅผ•็”จใ€‚"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs",children:[e.jsx("li",{children:"ๆŽจ่ไฝฟ็”จๅŽ‚ๅ•†ๅฎ˜ๆ–นๅ็งฐ๏ผŒๅฆ‚ DeepSeekใ€OpenAI"}),e.jsx("li",{children:"ๅ็งฐ้œ€่ฆๅ”ฏไธ€๏ผŒไธ่ƒฝไธŽ็Žฐๆœ‰ๆไพ›ๅ•†้‡ๅค"})]})]}),side:"right",maxWidth:"350px"})]}),e.jsx(ae,{id:"name",value:b?.name||"",onChange:te=>{y(_e=>_e?{..._e,name:te.target.value}:null),G.name&&$(_e=>({..._e,name:void 0}))},placeholder:"ไพ‹ๅฆ‚: DeepSeek, SiliconFlow",className:G.name?"border-destructive focus-visible:ring-destructive":""}),G.name&&e.jsx("p",{className:"text-xs text-destructive",children:G.name})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-url-input",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(T,{htmlFor:"base_url",className:G.base_url?"text-destructive":"",children:"ๅŸบ็ก€ URL *"}),e.jsx(Il,{content:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"font-medium",children:"API ๅŸบ็ก€ๅœฐๅ€"}),e.jsx("p",{children:"ๆไพ›ๅ•†็š„ API ็ซฏ็‚นๅŸบ็ก€ URL๏ผŒ้€šๅธธไปฅ /v1 ็ป“ๅฐพใ€‚"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs",children:[e.jsxs("li",{children:[e.jsx("strong",{children:"OpenAI ๆ ผๅผ๏ผš"}),"https://api.openai.com/v1"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"DeepSeek๏ผš"}),"https://api.deepseek.com"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"็ก…ๅŸบๆตๅŠจ๏ผš"}),"https://api.siliconflow.cn/v1"]}),e.jsx("li",{children:"้€‰ๆ‹ฉๆจกๆฟไผš่‡ชๅŠจๅกซๅ……ๆญฃ็กฎ็š„ URL"})]})]}),side:"right",maxWidth:"400px"})]}),e.jsx(ae,{id:"base_url",value:b?.base_url||"",onChange:te=>{y(_e=>_e?{..._e,base_url:te.target.value}:null),G.base_url&&$(_e=>({..._e,base_url:void 0}))},placeholder:"https://api.example.com/v1",disabled:ms,className:`${ms?"bg-muted cursor-not-allowed":""} ${G.base_url?"border-destructive focus-visible:ring-destructive":""}`}),G.base_url&&e.jsx("p",{className:"text-xs text-destructive",children:G.base_url}),ms&&!G.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.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(T,{htmlFor:"api_key",className:G.api_key?"text-destructive":"",children:"API Key *"}),e.jsx(Il,{content:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"font-medium",children:"API ๅฏ†้’ฅ"}),e.jsx("p",{children:"ไปŽๆไพ›ๅ•†ๅนณๅฐ่Žทๅ–็š„่บซไปฝ้ชŒ่ฏๅฏ†้’ฅใ€‚"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs",children:[e.jsxs("li",{children:["้€šๅธธไปฅ ",e.jsx("code",{children:"sk-"})," ๅผ€ๅคด"]}),e.jsx("li",{children:"่ฏทๅฆฅๅ–„ไฟ็ฎก๏ผŒไธ่ฆๆณ„้œฒ็ป™ไป–ไบบ"}),e.jsx("li",{children:"ๅฏไปฅ็‚นๅ‡ป็œผ็›ๅ›พๆ ‡ๅˆ‡ๆขๆ˜พ็คบ/้š่—"}),e.jsx("li",{children:"็‚นๅ‡ปๅคๅˆถๅ›พๆ ‡ๅฏๅฟซ้€Ÿๅคๅˆถๅฏ†้’ฅ"})]})]}),side:"right",maxWidth:"350px"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{id:"api_key",type:X?"text":"password",value:b?.api_key||"",onChange:te=>{y(_e=>_e?{..._e,api_key:te.target.value}:null),G.api_key&&$(_e=>({..._e,api_key:void 0}))},placeholder:"sk-...",className:`flex-1 ${G.api_key?"border-destructive focus-visible:ring-destructive":""}`}),e.jsx(_,{type:"button",variant:"outline",size:"icon",onClick:()=>L(!X),title:X?"้š่—ๅฏ†้’ฅ":"ๆ˜พ็คบๅฏ†้’ฅ",children:X?e.jsx(ic,{className:"h-4 w-4"}):e.jsx(ua,{className:"h-4 w-4"})}),e.jsx(_,{type:"button",variant:"outline",size:"icon",onClick:Ms,title:"ๅคๅˆถๅฏ†้’ฅ",children:e.jsx(qo,{className:"h-4 w-4"})})]}),G.api_key&&e.jsx("p",{className:"text-xs text-destructive",children:G.api_key})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(T,{htmlFor:"client_type",children:"ๅฎขๆˆท็ซฏ็ฑปๅž‹"}),e.jsx(Il,{content:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"font-medium",children:"API ๅฎขๆˆท็ซฏ็ฑปๅž‹"}),e.jsx("p",{children:"ๆŒ‡ๅฎšไธŽๆไพ›ๅ•†้€šไฟกๆ—ถไฝฟ็”จ็š„ API ๅ่ฎฎๆ ผๅผใ€‚"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs",children:[e.jsxs("li",{children:[e.jsx("strong",{children:"OpenAI๏ผš"}),"ๅ…ผๅฎน OpenAI API ๆ ผๅผ็š„ๆไพ›ๅ•†"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Gemini๏ผš"}),"Google Gemini ไธ“็”จๆ ผๅผ"]}),e.jsx("li",{children:"ๅคง้ƒจๅˆ†็ฌฌไธ‰ๆ–นๆไพ›ๅ•†้ƒฝๅ…ผๅฎน OpenAI ๆ ผๅผ"})]})]}),side:"right",maxWidth:"350px"})]}),e.jsxs(Pe,{value:b?.client_type||"openai",onValueChange:te=>y(_e=>_e?{..._e,client_type:te}:null),disabled:ms,children:[e.jsx(Ie,{id:"client_type",className:ms?"bg-muted cursor-not-allowed":"",children:e.jsx(Fe,{placeholder:"้€‰ๆ‹ฉๅฎขๆˆท็ซฏ็ฑปๅž‹"})}),e.jsxs(Be,{children:[e.jsx(W,{value:"openai",children:"OpenAI"}),e.jsx(W,{value:"gemini",children:"Gemini"})]})]}),ms&&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.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(T,{htmlFor:"max_retry",children:"ๆœ€ๅคง้‡่ฏ•"}),e.jsx(Il,{content:"API ่ฏทๆฑ‚ๅคฑ่ดฅๆ—ถ็š„ๆœ€ๅคง้‡่ฏ•ๆฌกๆ•ฐใ€‚่ฎพ็ฝฎไธบ 0 ่กจ็คบไธ้‡่ฏ•ใ€‚้ป˜่ฎคๅ€ผ๏ผš2",side:"top",maxWidth:"250px"})]}),e.jsx(ae,{id:"max_retry",type:"number",min:"0",value:b?.max_retry??"",onChange:te=>{const _e=te.target.value===""?null:parseInt(te.target.value);y(U=>U?{...U,max_retry:_e}:null)},placeholder:"้ป˜่ฎค: 2"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(T,{htmlFor:"timeout",children:"่ถ…ๆ—ถ(็ง’)"}),e.jsx(Il,{content:"ๅ•ๆฌก API ่ฏทๆฑ‚็š„่ถ…ๆ—ถๆ—ถ้—ด๏ผˆ็ง’๏ผ‰ใ€‚่ถ…ๆ—ถๅŽไผš่งฆๅ‘้‡่ฏ•ๆˆ–ๆŠฅ้”™ใ€‚้ป˜่ฎคๅ€ผ๏ผš30 ็ง’",side:"top",maxWidth:"250px"})]}),e.jsx(ae,{id:"timeout",type:"number",min:"1",value:b?.timeout??"",onChange:te=>{const _e=te.target.value===""?null:parseInt(te.target.value);y(U=>U?{...U,timeout:_e}:null)},placeholder:"้ป˜่ฎค: 30"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(T,{htmlFor:"retry_interval",children:"้‡่ฏ•้—ด้š”(็ง’)"}),e.jsx(Il,{content:"ไธคๆฌก้‡่ฏ•ไน‹้—ด็š„็ญ‰ๅพ…ๆ—ถ้—ด๏ผˆ็ง’๏ผ‰ใ€‚้€‚ๅฝ“็š„้—ด้š”ๅฏไปฅ้ฟๅ…่งฆๅ‘ API ้™ๆตใ€‚้ป˜่ฎคๅ€ผ๏ผš10 ็ง’",side:"top",maxWidth:"250px"})]}),e.jsx(ae,{id:"retry_interval",type:"number",min:"1",value:b?.retry_interval??"",onChange:te=>{const _e=te.target.value===""?null:parseInt(te.target.value);y(U=>U?{...U,retry_interval:_e}:null)},placeholder:"้ป˜่ฎค: 10"})]})]})]}),e.jsxs(gt,{children:[e.jsx(_,{type:"button",variant:"outline",onClick:()=>j(!1),"data-tour":"provider-cancel-button",children:"ๅ–ๆถˆ"}),e.jsx(_,{type:"submit","data-tour":"provider-save-button",children:"ไฟๅญ˜"})]})]})]})}),e.jsx(bs,{open:C,onOpenChange:R,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsxs(gs,{children:['็กฎๅฎš่ฆๅˆ ้™คๆไพ›ๅ•† "',H!==null?a[H]?.name:"",'" ๅ—๏ผŸ ๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚']})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:is,children:"ๅˆ ้™ค"})]})]})}),e.jsx(bs,{open:ge,onOpenChange:pe,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๆ‰น้‡ๅˆ ้™ค"}),e.jsxs(gs,{children:["็กฎๅฎš่ฆๅˆ ้™ค้€‰ไธญ็š„ ",je.size," ไธชๆไพ›ๅ•†ๅ—๏ผŸ ๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:Ae,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"ๆ‰น้‡ๅˆ ้™ค"})]})]})}),e.jsx(bs,{open:fe.isOpen,onOpenChange:te=>Ee(_e=>({..._e,isOpen:te})),children:e.jsxs(xs,{className:"max-w-2xl",children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™คๆไพ›ๅ•†"}),e.jsx(gs,{asChild:!0,children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:["ๆ‚จๅณๅฐ†ๅˆ ้™คไปฅไธ‹ๆไพ›ๅ•†๏ผš",e.jsx("strong",{className:"text-foreground ml-1",children:fe.providersToDelete.join(", ")})]}),e.jsxs("p",{className:"text-yellow-600 dark:text-yellow-500 font-medium",children:["โš ๏ธ ๆญคๆ“ไฝœๅฐ†ๅŒๆ—ถๅˆ ้™ค ",fe.affectedModels.length," ไธชๅ…ณ่”็š„ๆจกๅž‹๏ผš"]}),e.jsx(ts,{className:"h-32 w-full rounded border p-3",children:e.jsx("div",{className:"space-y-1",children:fe.affectedModels.map((te,_e)=>e.jsxs("div",{className:"text-sm",children:[e.jsx("span",{className:"font-mono text-muted-foreground",children:"โ€ข"}),e.jsx("span",{className:"ml-2 font-medium",children:te.name}),e.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(",te.model_identifier,")"]})]},_e))})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"่ฟ™ไบ›ๆจกๅž‹ๅฐ†ไปŽๆจกๅž‹ๅˆ—่กจๅ’Œๆ‰€ๆœ‰ไปปๅŠกๅˆ†้…ไธญ็งป้™คใ€‚ๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚"})]})})]}),e.jsxs(fs,{children:[e.jsx(vs,{onClick:V,children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:Bs,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"็กฎ่ฎคๅˆ ้™ค"})]})]})}),e.jsx(nr,{})]})}function nc(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).substring(2,11)}`}function Bm(a){return a===null?"null":Array.isArray(a)?"array":typeof a=="object"?"object":typeof a=="boolean"?"boolean":typeof a=="number"?"number":"string"}function sx(a){return Object.entries(a).map(([l,r])=>{const c=Bm(r),d={id:nc(),key:l,value:r,type:c,expanded:!0};return c==="object"&&r&&typeof r=="object"?d.children=sx(r):c==="array"&&Array.isArray(r)&&(d.children=r.map((m,h)=>{const f=Bm(m),p={id:nc(),key:String(h),value:m,type:f,expanded:!0};return f==="object"&&m&&typeof m=="object"?p.children=sx(m):f==="array"&&Array.isArray(m)&&(p.children=m.map((g,N)=>({id:nc(),key:String(N),value:g,type:Bm(g),expanded:!0}))),p})),d})}function tx(a){const l={};for(const r of a)r.key.trim()&&(r.type==="object"&&r.children?l[r.key]=tx(r.children):r.type==="array"&&r.children?l[r.key]=r.children.map(c=>c.type==="object"&&c.children?tx(c.children):c.type==="array"&&c.children?c.children.map(d=>d.value):c.value):r.type==="null"?l[r.key]=null:l[r.key]=r.value);return l}function Jg(a,l){switch(l){case"boolean":return a==="true";case"number":{const r=parseFloat(a);return isNaN(r)?0:r}case"null":return null;default:return a}}function nN({node:a,level:l,onUpdate:r,onRemove:c,onAddChild:d,onToggleExpand:m}){const h=a.type==="object"||a.type==="array",f=a.children&&a.children.length>0;return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"grid gap-2 items-center",style:{gridTemplateColumns:h?"32px 1fr 90px 64px":"32px 1fr 1fr 90px 32px",paddingLeft:`${l*20}px`},children:[e.jsx(_,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>m(a.id),disabled:!h||!f,children:h&&f?a.expanded?e.jsx(Ia,{className:"h-4 w-4"}):e.jsx(ra,{className:"h-4 w-4"}):e.jsx("span",{className:"w-4"})}),e.jsx(ae,{value:a.key,onChange:p=>r(a.id,"key",p.target.value),placeholder:"key",className:"h-8 text-sm"}),!h&&e.jsx(e.Fragment,{children:a.type==="boolean"?e.jsxs("div",{className:"flex items-center h-8 px-3 border rounded-md bg-background",children:[e.jsx(qe,{checked:a.value===!0,onCheckedChange:p=>r(a.id,"value",p)}),e.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:a.value?"true":"false"})]}):a.type==="null"?e.jsx("div",{className:"flex items-center h-8 px-3 border rounded-md bg-muted text-sm text-muted-foreground",children:"null"}):e.jsx(ae,{type:a.type==="number"?"number":"text",value:a.value,onChange:p=>r(a.id,"value",p.target.value),placeholder:"value",className:"h-8 text-sm",step:a.type==="number"?"any":void 0})}),e.jsxs(Pe,{value:a.type,onValueChange:p=>r(a.id,"type",p),children:[e.jsx(Ie,{className:"h-8 text-xs",children:e.jsx(Fe,{})}),e.jsxs(Be,{children:[e.jsx(W,{value:"string",children:"ๅญ—็ฌฆไธฒ"}),e.jsx(W,{value:"number",children:"ๆ•ฐๅญ—"}),e.jsx(W,{value:"boolean",children:"ๅธƒๅฐ”"}),e.jsx(W,{value:"null",children:"Null"}),e.jsx(W,{value:"object",children:"ๅฏน่ฑก"}),e.jsx(W,{value:"array",children:"ๆ•ฐ็ป„"})]})]}),e.jsxs("div",{className:"flex gap-1 justify-end",children:[h&&e.jsx(_,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-primary",onClick:()=>d(a.id),title:"ๆทปๅŠ ๅญ้กน",children:e.jsx(Xs,{className:"h-4 w-4"})}),e.jsx(_,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",onClick:()=>c(a.id),title:"ๅˆ ้™ค",children:e.jsx(os,{className:"h-4 w-4"})})]})]}),h&&a.expanded&&a.children&&a.children.length>0&&e.jsx("div",{className:"space-y-1",children:a.children.map(p=>e.jsx(nN,{node:p,level:l+1,onUpdate:r,onRemove:c,onAddChild:d,onToggleExpand:m},p.id))})]})}function o4({value:a,onChange:l,placeholder:r="ๆทปๅŠ ๅ‚ๆ•ฐ..."}){const[c,d]=u.useState(()=>sx(a||{})),m=u.useCallback(j=>{d(j),l(tx(j))},[l]),h=u.useCallback(()=>{const j={id:nc(),key:"",value:"",type:"string",expanded:!1};m([...c,j])},[c,m]),f=u.useCallback((j,b,y)=>{const w=z=>z.map(M=>{if(M.id===j)if(b==="type"){const S=y;if(S==="object")return{...M,type:S,value:{},children:[]};if(S==="array")return{...M,type:S,value:[],children:[]};if(S==="null")return{...M,type:S,value:null};{const F=Jg(String(M.value),S);return{...M,type:S,value:F,children:void 0}}}else if(b==="value"){const S=Jg(String(y),M.type);return{...M,value:S}}else return{...M,[b]:String(y)};return M.children?{...M,children:w(M.children)}:M});m(w(c))},[c,m]),p=u.useCallback(j=>{const b=y=>y.filter(w=>w.id!==j).map(w=>w.children?{...w,children:b(w.children)}:w);m(b(c))},[c,m]),g=u.useCallback(j=>{const b=y=>y.map(w=>{if(w.id===j){const z={id:nc(),key:w.type==="array"?String(w.children?.length||0):"",value:"",type:"string",expanded:!0};return{...w,children:[...w.children||[],z]}}return w.children?{...w,children:b(w.children)}:w});m(b(c))},[c,m]),N=u.useCallback(j=>{const b=y=>y.map(w=>w.id===j?{...w,expanded:!w.expanded}:w.children?{...w,children:b(w.children)}:w);d(b(c))},[c]);return e.jsxs("div",{className:"h-full flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:[c.length," ไธชๅ‚ๆ•ฐ"]}),e.jsxs(_,{type:"button",size:"sm",variant:"outline",onClick:h,className:"h-7 text-xs",children:[e.jsx(Xs,{className:"h-3 w-3 mr-1"}),"ๆทปๅŠ ๅ‚ๆ•ฐ"]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto space-y-1",children:c.length===0?e.jsx("div",{className:"text-sm text-muted-foreground text-center py-4 border border-dashed rounded-md",children:r}):e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"grid gap-2 text-xs text-muted-foreground px-1 sticky top-0 bg-background z-10",style:{gridTemplateColumns:"32px 1fr 1fr 90px 32px"},children:[e.jsx("span",{}),e.jsx("span",{children:"้”ฎๅ"}),e.jsx("span",{children:"ๅ€ผ"}),e.jsx("span",{children:"็ฑปๅž‹"}),e.jsx("span",{})]}),c.map(j=>e.jsx(nN,{node:j,level:0,onUpdate:f,onRemove:p,onAddChild:g,onToggleExpand:N},j.id))]})})]})}function Xg(a){if(!a.trim())return{valid:!0,parsed:{}};try{const l=JSON.parse(a);return typeof l!="object"||l===null||Array.isArray(l)?{valid:!1,error:"ๅฟ…้กปๆ˜ฏไธ€ไธช JSON ๅฏน่ฑก {}"}:{valid:!0,parsed:l}}catch{return{valid:!1,error:"JSON ๆ ผๅผ้”™่ฏฏ"}}}function d4({value:a,onChange:l,className:r,placeholder:c="ๆทปๅŠ ้ขๅค–ๅ‚ๆ•ฐ..."}){const[d,m]=u.useState("list"),h=u.useMemo(()=>Object.keys(a||{}).length>0?JSON.stringify(a,null,2):"",[a]),[f,p]=u.useState(h),[g,N]=u.useState(null);u.useEffect(()=>{p(h)},[h]);const j=u.useMemo(()=>{const w=Xg(f);return w.valid&&w.parsed?{success:!0,data:w.parsed}:{success:!1,data:{}}},[f]),b=u.useCallback(w=>{const z=w;z==="json"&&d==="list"&&(p(Object.keys(a).length>0?JSON.stringify(a,null,2):""),N(null)),m(z)},[d,a]),y=u.useCallback(w=>{p(w);const z=Xg(w);z.valid&&z.parsed?(N(null),l(z.parsed)):N(z.error||"JSON ๆ ผๅผ้”™่ฏฏ")},[l]);return e.jsx("div",{className:P("h-full flex flex-col",r),children:e.jsxs(Jt,{value:d,onValueChange:b,className:"w-full flex-1 flex flex-col",children:[e.jsxs(Gt,{className:"h-8 p-0.5 bg-muted/60 w-fit",children:[e.jsx(Xe,{value:"list",className:"h-7 px-3 text-xs data-[state=active]:bg-background data-[state=active]:shadow-sm",children:"ๅฏ่ง†ๅŒ–็ผ–่พ‘"}),e.jsx(Xe,{value:"json",className:"h-7 px-3 text-xs data-[state=active]:bg-background data-[state=active]:shadow-sm",children:"JSON ็ผ–่พ‘"})]}),e.jsx(Ss,{value:"list",className:"mt-2 flex-1 flex flex-col overflow-hidden data-[state=inactive]:hidden data-[state=inactive]:h-0",children:e.jsx(o4,{value:a,onChange:l,placeholder:c})}),e.jsx(Ss,{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(Ut,{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(Ot,{className:"h-3 w-3"}),e.jsx("span",{children:"ๆœ‰ๆ•ˆ"})]})]}),e.jsx(pt,{value:f,onChange:w=>y(w.target.value),placeholder:`{ "key": "value" }`,className:P("font-mono text-sm flex-1 resize-none",g&&"border-destructive focus-visible:ring-destructive")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆ”ฏๆŒไปปๆ„ JSON ็ฑปๅž‹๏ผˆๅŒ…ๆ‹ฌๅตŒๅฅ—ๅฏน่ฑกๅ’Œๆ•ฐ็ป„๏ผ‰"})]}),e.jsxs("div",{className:"flex flex-col gap-2 overflow-hidden",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"้ข„่งˆ"}),e.jsx("div",{className:"flex-1 rounded-md border bg-muted/30 p-3 overflow-auto",children:j.success&&Object.keys(j.data).length>0?e.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-words",children:JSON.stringify(j.data,null,2)}):j.success?e.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"ๆš‚ๆ— ๅ‚ๆ•ฐ"}):e.jsx("div",{className:"flex items-center justify-center h-full text-sm text-destructive",children:"JSON ๆ ผๅผ้”™่ฏฏ"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅฎžๆ—ถ้ข„่งˆ่งฃๆž็ป“ๆžœ"})]})]})})]})})}function u4({open:a,onOpenChange:l,value:r,onChange:c}){const[d,m]=u.useState(r),h=g=>{g&&m(r),l(g)},f=()=>{c(d),l(!1)},p=()=>{m(r),l(!1)};return e.jsx(Qs,{open:a,onOpenChange:h,children:e.jsxs(Hs,{className:"max-w-3xl h-[70vh] flex flex-col",children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"็ผ–่พ‘้ขๅค–ๅ‚ๆ•ฐ"}),e.jsx(at,{children:"้…็ฝฎๆจกๅž‹่ฐƒ็”จๆ—ถ็š„้ขๅค–ๅ‚ๆ•ฐ๏ผŒๆ”ฏๆŒๅตŒๅฅ—ๅฏน่ฑกๅ’Œๆ•ฐ็ป„"})]}),e.jsx("div",{className:"flex-1 overflow-hidden min-h-0",children:e.jsx(d4,{value:d,onChange:m,placeholder:"ๆทปๅŠ ้ขๅค–ๅ‚ๆ•ฐ๏ผˆๅฆ‚ thinkingใ€top_p ็ญ‰๏ผ‰..."})}),e.jsxs(gt,{children:[e.jsx(_,{variant:"outline",onClick:p,children:"ๅ–ๆถˆ"}),e.jsx(_,{onClick:f,children:"ไฟๅญ˜"})]})]})})}const ai="https://maibot-plugin-stats.maibot-webui.workers.dev";async function m4(a){const l=new URLSearchParams;a?.status&&l.set("status",a.status),a?.page&&l.set("page",a.page.toString()),a?.page_size&&l.set("page_size",a.page_size.toString()),a?.search&&l.set("search",a.search),a?.sort_by&&l.set("sort_by",a.sort_by),a?.sort_order&&l.set("sort_order",a.sort_order);const r=await fetch(`${ai}/pack?${l.toString()}`);if(!r.ok)throw new Error(`่Žทๅ– Pack ๅˆ—่กจๅคฑ่ดฅ: ${r.status}`);return r.json()}async function x4(a){const l=await fetch(`${ai}/pack/${a}`);if(!l.ok)throw new Error(`่Žทๅ– Pack ๅคฑ่ดฅ: ${l.status}`);const r=await l.json();if(!r.success)throw new Error(r.error||"่Žทๅ– Pack ๅคฑ่ดฅ");return r.pack}async function h4(a){const r=await(await fetch(`${ai}/pack`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})).json();if(!r.success)throw new Error(r.error||"ๅˆ›ๅปบ Pack ๅคฑ่ดฅ");return r}async function f4(a,l){await fetch(`${ai}/pack/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pack_id:a,user_id:l})})}async function rN(a,l){const c=await(await fetch(`${ai}/pack/like`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pack_id:a,user_id:l})})).json();if(!c.success)throw new Error(c.error||"็‚น่ตžๅคฑ่ดฅ");return{likes:c.likes,liked:c.liked}}async function iN(a,l){return(await(await fetch(`${ai}/pack/like/check?pack_id=${a}&user_id=${l}`)).json()).liked||!1}async function p4(a){const l=await ke("/api/webui/config/model");if(!l.ok)throw new Error("่Žทๅ–ๅฝ“ๅ‰ๆจกๅž‹้…็ฝฎๅคฑ่ดฅ");const r=await l.json(),c=r.config||r;console.log("=== Pack Conflict Detection ==="),console.log("Pack providers:",a.providers),console.log("Local providers:",c.api_providers);const d={existing_providers:[],new_providers:[],conflicting_models:[]},m=c.api_providers||[];for(const f of a.providers){console.log(` Checking pack provider: ${f.name}`),console.log(` Pack URL: ${f.base_url}`),console.log(` Normalized: ${Pm(f.base_url)}`);const p=m.filter(g=>{const N=Pm(g.base_url),j=Pm(f.base_url);return console.log(` Comparing with local "${g.name}": ${g.base_url}`),console.log(` Local normalized: ${N}`),console.log(` Match: ${N===j}`),N===j});p.length>0?(console.log(` โœ“ Matched with ${p.length} local provider(s):`,p.map(g=>g.name).join(", ")),d.existing_providers.push({pack_provider:f,local_providers:p.map(g=>({name:g.name,base_url:g.base_url}))})):(console.log(" โœ— No match found - will need API key"),d.new_providers.push(f))}const h=c.models||[];console.log(` === Model Conflict Detection ===`);for(const f of a.models){const p=h.find(g=>g.name===f.name);p&&(console.log(`Model conflict: ${f.name}`),d.conflicting_models.push({pack_model:f.name,local_model:p.name}))}return console.log(` === Detection Summary ===`),console.log(`Existing providers: ${d.existing_providers.length}`),console.log(`New providers: ${d.new_providers.length}`),console.log(`Conflicting models: ${d.conflicting_models.length}`),console.log(`=========================== -`),d}async function g4(a,l,r,c){const d=await ke("/api/webui/config/model");if(!d.ok)throw new Error("่Žทๅ–ๅฝ“ๅ‰ๆจกๅž‹้…็ฝฎๅคฑ่ดฅ");const m=await d.json(),h=m.config||m;if(l.apply_providers){const p=l.selected_providers?a.providers.filter(g=>l.selected_providers.includes(g.name)):a.providers;for(const g of p){if(r[g.name])continue;const N=c[g.name];if(!N)throw new Error(`ๆไพ›ๅ•† "${g.name}" ็ผบๅฐ‘ API Key`);const j={...g,api_key:N},b=h.api_providers.findIndex(y=>y.name===g.name);b>=0?h.api_providers[b]=j:h.api_providers.push(j)}}if(l.apply_models){const p=l.selected_models?a.models.filter(g=>l.selected_models.includes(g.name)):a.models;for(const g of p){const N=r[g.api_provider]||g.api_provider,j={...g,api_provider:N},b=h.models.findIndex(y=>y.name===g.name);b>=0?h.models[b]=j:h.models.push(j)}}if(l.apply_task_config){const p=l.selected_tasks||Object.keys(a.task_config);for(const g of p){const N=a.task_config[g];if(!N)continue;const j=new Set(l.selected_models||a.models.map(w=>w.name)),b=N.model_list.filter(w=>j.has(w));if(b.length===0)continue;const y={...N,model_list:b};if(l.task_mode==="replace")h.model_task_config[g]=y;else{const w=h.model_task_config[g];if(w){const z=[...new Set([...w.model_list,...b])];h.model_task_config[g]={...w,model_list:z}}else h.model_task_config[g]=y}}}if(!(await ke("/api/webui/config/model",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(h)})).ok)throw new Error("ไฟๅญ˜้…็ฝฎๅคฑ่ดฅ")}async function j4(a){const l=await ke("/api/webui/config/model");if(!l.ok)throw new Error("่Žทๅ–ๅฝ“ๅ‰ๆจกๅž‹้…็ฝฎๅคฑ่ดฅ");const r=await l.json();if(!r.success||!r.config)throw new Error("่Žทๅ–้…็ฝฎๅคฑ่ดฅ");const c=r.config;let d=(c.api_providers||[]).map(g=>({name:g.name,base_url:g.base_url,client_type:g.client_type,max_retry:g.max_retry,timeout:g.timeout,retry_interval:g.retry_interval}));a.selectedProviders&&(d=d.filter(g=>a.selectedProviders.includes(g.name)));let m=c.models||[];a.selectedModels&&(m=m.filter(g=>a.selectedModels.includes(g.name)));const h={},f=c.model_task_config||{},p=a.selectedTasks||Object.keys(f);for(const g of p)f[g]&&(h[g]=f[g]);return{providers:d,models:m,task_config:h}}function Pm(a){try{const l=new URL(a);return`${l.protocol}//${l.host}${l.pathname}`.replace(/\/$/,"").toLowerCase()}catch{return a.toLowerCase().replace(/\/$/,"")}}function cN(){const a="maibot_pack_user_id";let l=localStorage.getItem(a);return l||(l="pack_user_"+Math.random().toString(36).substring(2,15),localStorage.setItem(a,l)),l}const v4={utils:"้€š็”จๅทฅๅ…ท",utils_small:"่ฝป้‡ๅทฅๅ…ท",tool_use:"ๅทฅๅ…ท่ฐƒ็”จ",replyer:"ๅ›žๅค็”Ÿๆˆ",planner:"่ง„ๅˆ’ๆŽจ็†",vlm:"่ง†่ง‰ๆจกๅž‹",voice:"่ฏญ้Ÿณๅค„็†",embedding:"ๅ‘้‡ๅตŒๅ…ฅ",lpmm_entity_extract:"ๅฎžไฝ“ๆๅ–",lpmm_rdf_build:"RDFๆž„ๅปบ",lpmm_qa:"้—ฎ็ญ”ๆจกๅž‹"},N4=["ๅฎ˜ๆ–นๆŽจ่","ๆ€งไปทๆฏ”","้ซ˜ๆ€ง่ƒฝ","ๅ…่ดนๆจกๅž‹","ๅ›ฝๅ†…ๅฏ็”จ","ๆตทๅค–ๆจกๅž‹","OpenAI","Claude","Gemini","ๅ›ฝไบงๆจกๅž‹","ๅคšๆจกๆ€","่ฝป้‡็บง"];function b4({trigger:a}){const[l,r]=u.useState(!1),[c,d]=u.useState(1),[m,h]=u.useState(!1),[f,p]=u.useState(!1),[g,N]=u.useState([]),[j,b]=u.useState([]),[y,w]=u.useState({}),[z,M]=u.useState(new Set),[S,F]=u.useState(new Set),[E,C]=u.useState(new Set),[R,H]=u.useState(""),[O,X]=u.useState(""),[L,me]=u.useState(""),[Ne,je]=u.useState([]);u.useEffect(()=>{l&&c===1&&ce()},[l,c]);const ce=async()=>{h(!0);try{const G=await j4({name:"",description:"",author:""});N(G.providers),b(G.models),w(G.task_config),M(new Set(G.providers.map($=>$.name))),F(new Set(G.models.map($=>$.name))),C(new Set(Object.keys(G.task_config)))}catch(G){console.error("ๅŠ ่ฝฝ้…็ฝฎๅคฑ่ดฅ:",G),aa({title:"ๅŠ ่ฝฝๅฝ“ๅ‰้…็ฝฎๅคฑ่ดฅ",variant:"destructive"})}finally{h(!1)}},ge=G=>{const $=new Set(z),A=new Set(S),K=new Set(E);$.has(G)?($.delete(G),j.filter(se=>se.api_provider===G).forEach(se=>A.delete(se.name)),Object.entries(y).forEach(([se,$e])=>{$e.model_list&&($e.model_list.some(J=>A.has(J))||K.delete(se))})):($.add(G),j.filter(se=>se.api_provider===G).forEach(se=>A.add(se.name)),Object.entries(y).forEach(([se,$e])=>{$e.model_list&&$e.model_list.some(J=>{const Z=j.find(Le=>Le.name===J);return Z&&Z.api_provider===G})&&K.add(se)})),M($),F(A),C(K)},pe=G=>{const $=new Set(S),A=new Set(E);$.has(G)?($.delete(G),Object.entries(y).forEach(([K,Re])=>{Re.model_list&&(Re.model_list.some($e=>$.has($e))||A.delete(K))})):($.add(G),Object.entries(y).forEach(([K,Re])=>{Re.model_list&&Re.model_list.includes(G)&&A.add(K)})),F($),C(A)},D=G=>{const $=new Set(E);$.has(G)?$.delete(G):$.add(G),C($)},Q=G=>{Ne.includes(G)?je(Ne.filter($=>$!==G)):Ne.length<5?je([...Ne,G]):aa({title:"ๆœ€ๅคš้€‰ๆ‹ฉ 5 ไธชๆ ‡็ญพ",variant:"destructive"})},B=()=>{z.size===g.length?M(new Set):M(new Set(g.map(G=>G.name)))},ue=()=>{S.size===j.length?F(new Set):F(new Set(j.map(G=>G.name)))},Y=()=>{const G=Object.keys(y);E.size===G.length?C(new Set):C(new Set(G))},we=async()=>{if(!R.trim()){aa({title:"่ฏท่พ“ๅ…ฅๆจกๆฟๅ็งฐ",variant:"destructive"});return}if(!O.trim()){aa({title:"่ฏท่พ“ๅ…ฅๆจกๆฟๆ่ฟฐ",variant:"destructive"});return}if(!L.trim()){aa({title:"่ฏท่พ“ๅ…ฅไฝœ่€…ๅ็งฐ",variant:"destructive"});return}if(z.size===0&&S.size===0&&E.size===0){aa({title:"่ฏท่‡ณๅฐ‘้€‰ๆ‹ฉไธ€้กน้…็ฝฎ",variant:"destructive"});return}p(!0);try{const G=g.filter(K=>z.has(K.name)),$=j.filter(K=>S.has(K.name)),A={};for(const[K,Re]of Object.entries(y))E.has(K)&&(A[K]=Re);await h4({name:R.trim(),description:O.trim(),author:L.trim(),tags:Ne,providers:G,models:$,task_config:A}),aa({title:"ๆจกๆฟๅทฒๆไบคๅฎกๆ ธ๏ผŒๅฎกๆ ธ้€š่ฟ‡ๅŽๅฐ†ๆ˜พ็คบๅœจๅธ‚ๅœบไธญ"}),r(!1),fe()}catch(G){console.error("ๆไบคๅคฑ่ดฅ:",G),aa({title:G instanceof Error?G.message:"ๆไบคๅคฑ่ดฅ",variant:"destructive"})}finally{p(!1)}},fe=()=>{d(1),H(""),X(""),me(""),je([]),M(new Set),F(new Set),C(new Set)},Ee=2;return e.jsxs(Qs,{open:l,onOpenChange:r,children:[e.jsx(dd,{asChild:!0,children:a||e.jsxs(_,{variant:"outline",children:[e.jsx(mv,{className:"w-4 h-4 mr-2"}),"ๅˆ†ไบซ้…็ฝฎ"]})}),e.jsxs(Hs,{className:"max-w-2xl max-h-[85vh] flex flex-col",children:[e.jsxs(qs,{children:[e.jsxs(Vs,{className:"flex items-center gap-2",children:[e.jsx(xa,{className:"w-5 h-5"}),"ๅˆ†ไบซ้…็ฝฎๆจกๆฟ"]}),e.jsxs(at,{children:["ๆญฅ้ชค ",c," / ",Ee,"๏ผš",c===1&&"้€‰ๆ‹ฉ่ฆๅˆ†ไบซ็š„้…็ฝฎ",c===2&&"ๅกซๅ†™ๆจกๆฟไฟกๆฏ"]})]}),e.jsx(ts,{className:"h-[calc(85vh-220px)] pr-4",children:m?e.jsxs("div",{className:"py-8 text-center",children:[e.jsx(Fs,{className:"w-8 h-8 mx-auto animate-spin text-primary"}),e.jsx("p",{className:"mt-4 text-muted-foreground",children:"ๆญฃๅœจๅŠ ่ฝฝๅฝ“ๅ‰้…็ฝฎ..."})]}):e.jsxs(e.Fragment,{children:[c===1&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(ht,{children:[e.jsx(Yt,{className:"h-4 w-4"}),e.jsx(Jn,{children:"ๅฎ‰ๅ…จๆ็คบ"}),e.jsxs(ft,{children:["ๅˆ†ไบซ็š„้…็ฝฎๅฐ†",e.jsx("strong",{children:"ไธๅŒ…ๅซ"})," API Key๏ผŒๅ…ถไป–็”จๆˆท้œ€่ฆ่‡ช่กŒ้…็ฝฎใ€‚"]})]}),e.jsxs(Jt,{defaultValue:"providers",className:"w-full",children:[e.jsxs(Gt,{className:"grid w-full grid-cols-3",children:[e.jsxs(Xe,{value:"providers",children:[e.jsx(Hl,{className:"w-4 h-4 mr-2"}),"API ๆไพ›ๅ•†",e.jsxs(Ce,{variant:"secondary",className:"ml-2",children:[z.size,"/",g.length]})]}),e.jsxs(Xe,{value:"models",children:[e.jsx(Wn,{className:"w-4 h-4 mr-2"}),"ๆจกๅž‹้…็ฝฎ",e.jsxs(Ce,{variant:"secondary",className:"ml-2",children:[S.size,"/",j.length]})]}),e.jsxs(Xe,{value:"tasks",children:[e.jsx(er,{className:"w-4 h-4 mr-2"}),"ไปปๅŠก้…็ฝฎ",e.jsxs(Ce,{variant:"secondary",className:"ml-2",children:[E.size,"/",Object.keys(y).length]})]})]}),e.jsx(Ss,{value:"providers",className:"space-y-2 mt-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex justify-end",children:e.jsx(_,{variant:"ghost",size:"sm",onClick:B,children:z.size===g.length?"ๅ–ๆถˆๅ…จ้€‰":"ๅ…จ้€‰"})}),g.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-2",children:"ๆš‚ๆ— ๆไพ›ๅ•†้…็ฝฎ"}):g.map(G=>e.jsxs("div",{className:"flex items-center space-x-2 p-2 rounded hover:bg-muted",children:[e.jsx(tt,{id:`provider-${G.name}`,checked:z.has(G.name),onCheckedChange:()=>ge(G.name)}),e.jsxs(T,{htmlFor:`provider-${G.name}`,className:"flex-1 cursor-pointer",children:[e.jsx("span",{className:"font-medium",children:G.name}),e.jsx("span",{className:"text-xs text-muted-foreground ml-2",children:G.base_url})]}),e.jsx(Ce,{variant:"outline",className:"text-xs",children:G.client_type})]},G.name))]})}),e.jsx(Ss,{value:"models",className:"space-y-2 mt-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex justify-end",children:e.jsx(_,{variant:"ghost",size:"sm",onClick:ue,children:S.size===j.length?"ๅ–ๆถˆๅ…จ้€‰":"ๅ…จ้€‰"})}),j.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-2",children:"ๆš‚ๆ— ๆจกๅž‹้…็ฝฎ"}):j.map(G=>e.jsxs("div",{className:"flex items-center space-x-2 p-2 rounded hover:bg-muted",children:[e.jsx(tt,{id:`model-${G.name}`,checked:S.has(G.name),onCheckedChange:()=>pe(G.name)}),e.jsxs(T,{htmlFor:`model-${G.name}`,className:"flex-1 cursor-pointer",children:[e.jsx("span",{className:"font-medium",children:G.name}),e.jsx("span",{className:"text-xs text-muted-foreground ml-2",children:G.model_identifier})]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:G.api_provider})]},G.name))]})}),e.jsx(Ss,{value:"tasks",className:"space-y-2 mt-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex justify-end",children:e.jsx(_,{variant:"ghost",size:"sm",onClick:Y,children:E.size===Object.keys(y).length?"ๅ–ๆถˆๅ…จ้€‰":"ๅ…จ้€‰"})}),Object.keys(y).length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-2",children:"ๆš‚ๆ— ไปปๅŠก้…็ฝฎ"}):Object.entries(y).map(([G,$])=>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(tt,{id:`task-${G}`,checked:E.has(G),onCheckedChange:()=>D(G)}),e.jsx(T,{htmlFor:`task-${G}`,className:"flex-1 cursor-pointer",children:e.jsx("span",{className:"font-medium",children:v4[G]||G})}),e.jsxs(Ce,{variant:"outline",className:"text-xs",children:[$.model_list.length," ไธชๆจกๅž‹"]})]}),$.model_list&&$.model_list.length>0&&e.jsx("div",{className:"ml-6 flex flex-wrap gap-1",children:$.model_list.map(A=>{const K=j.find(se=>se.name===A),Re=S.has(A);return e.jsxs(Ce,{variant:Re?"default":"outline",className:"text-xs cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>pe(A),children:[A,K&&e.jsxs("span",{className:"ml-1 opacity-70",children:["(",K.api_provider,")"]})]},A)})})]},G))]})})]})]}),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(Hl,{className:"w-4 h-4"}),z.size," ไธชๆไพ›ๅ•†"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Wn,{className:"w-4 h-4"}),S.size," ไธชๆจกๅž‹"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(er,{className:"w-4 h-4"}),E.size," ไธชไปปๅŠก"]})]}),e.jsx(la,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"pack-name",children:"ๆจกๆฟๅ็งฐ *"}),e.jsx(ne,{id:"pack-name",placeholder:"ไพ‹ๅฆ‚๏ผš้ซ˜ๆ€งไปทๆฏ”ๅ›ฝไบงๆจกๅž‹้…็ฝฎ",value:R,onChange:G=>H(G.target.value),maxLength:50}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[R.length,"/50"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"pack-description",children:"ๆจกๆฟๆ่ฟฐ *"}),e.jsx(pt,{id:"pack-description",placeholder:"่ฏฆ็ป†ๆ่ฟฐ่ฟ™ไธช้…็ฝฎๆจกๆฟ็š„็‰น็‚นใ€้€‚็”จๅœบๆ™ฏ็ญ‰...",value:O,onChange:G=>X(G.target.value),rows:4,maxLength:500}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[O.length,"/500"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"pack-author",children:"ไฝœ่€…ๅ็งฐ *"}),e.jsx(ne,{id:"pack-author",placeholder:"ไฝ ็š„ๆ˜ต็งฐๆˆ– ID",value:L,onChange:G=>me(G.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:N4.map(G=>e.jsxs(Ce,{variant:Ne.includes(G)?"default":"outline",className:"cursor-pointer transition-colors",onClick:()=>Q(G),children:[Ne.includes(G)&&e.jsx(Ot,{className:"w-3 h-3 mr-1"}),e.jsx(cd,{className:"w-3 h-3 mr-1"}),G]},G))})]})]}),e.jsxs(ht,{children:[e.jsx(Yt,{className:"h-4 w-4"}),e.jsx(Jn,{children:"ๅฎกๆ ธ่ฏดๆ˜Ž"}),e.jsx(ft,{children:"ๆไบคๅŽ้œ€่ฆ็ป่ฟ‡ๅฎกๆ ธๆ‰่ƒฝๅœจๅธ‚ๅœบไธญๅฑ•็คบใ€‚ๅฎกๆ ธ้€šๅธธๅœจ 1-3 ไธชๅทฅไฝœๆ—ฅๅ†…ๅฎŒๆˆใ€‚"})]})]})]})}),e.jsxs(gt,{className:"flex justify-between pt-4 border-t",children:[e.jsx("div",{children:c>1&&e.jsx(_,{variant:"outline",onClick:()=>d(c-1),disabled:f,children:"ไธŠไธ€ๆญฅ"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(_,{variant:"outline",onClick:()=>{r(!1),fe()},disabled:f,children:"ๅ–ๆถˆ"}),cd(c+1),disabled:m||z.size===0&&S.size===0&&E.size===0,children:"ไธ‹ไธ€ๆญฅ"}):e.jsxs(_,{onClick:we,disabled:f,children:[f&&e.jsx(Fs,{className:"w-4 h-4 mr-2 animate-spin"}),"ๆไบคๅฎกๆ ธ"]})]})]})]})]})}function y4({value:a,label:l,onRemove:r}){const{attributes:c,listeners:d,setNodeRef:m,transform:h,transition:f,isDragging:p}=Cv({id:a}),g={transform:Tv.Transform.toString(h),transition:f,opacity:p?.5:1},N=b=>{b.preventDefault(),b.stopPropagation(),r(a)},j=b=>{b.stopPropagation()};return e.jsx("div",{ref:m,style:g,className:P("inline-flex items-center gap-1",p&&"shadow-lg"),children:e.jsxs(Ce,{variant:"secondary",className:"cursor-move hover:bg-secondary/80 flex items-center gap-1",children:[e.jsx("div",{...c,...d,className:"cursor-grab active:cursor-grabbing flex items-center",children:e.jsx(dv,{className:"h-3 w-3 text-muted-foreground"})}),e.jsx("span",{children:l}),e.jsx("span",{role:"button",tabIndex:0,className:"ml-1 rounded-sm hover:bg-destructive/20 focus:outline-none focus:ring-1 focus:ring-destructive cursor-pointer",onClick:N,onPointerDown:j,onMouseDown:b=>b.stopPropagation(),onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),N(b))},children:e.jsx(Sa,{className:"h-3 w-3 hover:text-destructive",strokeWidth:2,fill:"none"})})]})})}function w4({options:a,selected:l,onChange:r,placeholder:c="้€‰ๆ‹ฉ้€‰้กน...",emptyText:d="ๆœชๆ‰พๅˆฐ้€‰้กน",className:m}){const[h,f]=u.useState(!1),p=vv(Qo(yv,{activationConstraint:{distance:8}}),Qo(bv,{coordinateGetter:Nv})),g=b=>{l.includes(b)?r(l.filter(y=>y!==b)):r([...l,b])},N=b=>{r(l.filter(y=>y!==b))},j=b=>{const{active:y,over:w}=b;if(w&&y.id!==w.id){const z=l.indexOf(y.id),M=l.indexOf(w.id);r(wv(l,z,M))}};return e.jsxs(cl,{open:h,onOpenChange:f,children:[e.jsx(ol,{asChild:!0,children:e.jsxs(_,{variant:"outline",role:"combobox","aria-expanded":h,className:P("w-full justify-between min-h-10 h-auto",m),children:[e.jsx(_v,{sensors:p,collisionDetection:Sv,onDragEnd:j,children:e.jsx(kv,{items:l,strategy:p_,children:e.jsx("div",{className:"flex gap-1 flex-wrap flex-1",children:l.length===0?e.jsx("span",{className:"text-muted-foreground",children:c}):l.map(b=>{const y=a.find(w=>w.value===b);return e.jsx(y4,{value:b,label:y?.label||b,onRemove:N},b)})})})}),e.jsx(mx,{className:"ml-2 h-4 w-4 shrink-0 opacity-50",strokeWidth:2,fill:"none"})]})}),e.jsx(tl,{className:"w-full p-0",align:"start",children:e.jsxs(md,{children:[e.jsx(xd,{placeholder:"ๆœ็ดข...",className:"h-9"}),e.jsxs(hd,{children:[e.jsx(fd,{children:d}),e.jsx(uc,{children:a.map(b=>{const y=l.includes(b.value);return e.jsxs(mc,{value:b.value,onSelect:()=>g(b.value),children:[e.jsx("div",{className:P("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",y?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(Ot,{className:"h-3 w-3",strokeWidth:2,fill:"none"})}),e.jsx("span",{children:b.label})]},b.value)})})]})]})})]})}const Ul=Bs.memo(function({title:l,description:r,taskConfig:c,modelNames:d,onChange:m,hideTemperature:h=!1,hideMaxTokens:f=!1,dataTour:p}){const g=N=>{m("model_list",N)};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-base sm:text-lg",children:l}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:r})]}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2","data-tour":p,children:[e.jsx(T,{children:"ๆจกๅž‹ๅˆ—่กจ"}),e.jsx(w4,{options:d.map(N=>({label:N,value:N})),selected:c.model_list||[],onChange:g,placeholder:"้€‰ๆ‹ฉๆจกๅž‹...",emptyText:"ๆš‚ๆ— ๅฏ็”จๆจกๅž‹"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[!h&&e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"ๆธฉๅบฆ"}),e.jsx(ne,{type:"number",step:"0.1",min:"0",max:"1",value:c.temperature??.3,onChange:N=>{const j=parseFloat(N.target.value);!isNaN(j)&&j>=0&&j<=1&&m("temperature",j)},className:"w-20 h-8 text-sm"})]}),e.jsx(el,{value:[c.temperature??.3],onValueChange:N=>m("temperature",N[0]),min:0,max:1,step:.1,className:"w-full"})]}),!f&&e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"ๆœ€ๅคง Token"}),e.jsx(ne,{type:"number",step:"1",min:"1",value:c.max_tokens??1024,onChange:N=>m("max_tokens",parseInt(N.target.value))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"ๆ…ข่ฏทๆฑ‚้˜ˆๅ€ผ (็ง’)"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"่ถ…ๆ—ถ่ญฆๅ‘Š"})]}),e.jsx(ne,{type:"number",step:"1",min:"1",value:c.slow_threshold??15,onChange:N=>{const j=parseInt(N.target.value);!isNaN(j)&&j>=1&&m("slow_threshold",j)},placeholder:"15"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆจกๅž‹ๅ“ๅบ”ๆ—ถ้—ด่ถ…่ฟ‡ๆญค้˜ˆๅ€ผๅฐ†่พ“ๅ‡บ่ญฆๅ‘Šๆ—ฅๅฟ—"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"ๆจกๅž‹้€‰ๆ‹ฉ็ญ–็•ฅ"}),e.jsxs(Pe,{value:c.selection_strategy??"balance",onValueChange:N=>m("selection_strategy",N),children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"้€‰ๆ‹ฉๆจกๅž‹้€‰ๆ‹ฉ็ญ–็•ฅ"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"balance",children:"่ดŸ่ฝฝๅ‡่กก๏ผˆbalance๏ผ‰"}),e.jsx(W,{value:"random",children:"้šๆœบ้€‰ๆ‹ฉ๏ผˆrandom๏ผ‰"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"่ดŸ่ฝฝๅ‡่กก๏ผšไผ˜ๅ…ˆ้€‰ๆ‹ฉไฝฟ็”จๆฌกๆ•ฐๅฐ‘็š„ๆจกๅž‹ใ€‚้šๆœบ้€‰ๆ‹ฉ๏ผšๅฎŒๅ…จ้šๆœบไปŽๆจกๅž‹ๅˆ—่กจไธญ้€‰ๆ‹ฉ"})]})]})]})}),_4=Bs.memo(function({paginatedModels:l,allModels:r,onEdit:c,onDelete:d,isModelUsed:m,searchQuery:h}){return l.length===0?e.jsx("div",{className:"md:hidden text-center text-muted-foreground py-8 rounded-lg border bg-card",children:h?"ๆœชๆ‰พๅˆฐๅŒน้…็š„ๆจกๅž‹":"ๆš‚ๆ— ๆจกๅž‹้…็ฝฎ"}):e.jsx("div",{className:"md:hidden space-y-3",children:l.map((f,p)=>{const g=r.findIndex(j=>j===f),N=m(f.name);return e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("h3",{className:"font-semibold text-base",children:f.name}),e.jsx(Ce,{variant:N?"default":"secondary",className:N?"bg-green-600 hover:bg-green-700":"",children:N?"ๅทฒไฝฟ็”จ":"ๆœชไฝฟ็”จ"})]}),e.jsx("p",{className:"text-xs text-muted-foreground break-all",title:f.model_identifier,children:f.model_identifier})]}),e.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>c(f,g),children:[e.jsx(Zn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"็ผ–่พ‘"]}),e.jsxs(_,{size:"sm",onClick:()=>d(g),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(os,{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)})})}),S4=Bs.memo(function({paginatedModels:l,allModels:r,filteredModels:c,selectedModels:d,onEdit:m,onDelete:h,onToggleSelection:f,onToggleSelectAll:p,isModelUsed:g,searchQuery:N}){return e.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(ql,{children:[e.jsx(Vl,{children:e.jsxs(_t,{children:[e.jsx(ns,{className:"w-12",children:e.jsx(tt,{checked:d.size===c.length&&c.length>0,onCheckedChange:p})}),e.jsx(ns,{className:"w-24",children:"ไฝฟ็”จ็Šถๆ€"}),e.jsx(ns,{children:"ๆจกๅž‹ๅ็งฐ"}),e.jsx(ns,{children:"ๆจกๅž‹ๆ ‡่ฏ†็ฌฆ"}),e.jsx(ns,{children:"ๆไพ›ๅ•†"}),e.jsx(ns,{className:"text-center",children:"ๆธฉๅบฆ"}),e.jsx(ns,{className:"text-right",children:"่พ“ๅ…ฅไปทๆ ผ"}),e.jsx(ns,{className:"text-right",children:"่พ“ๅ‡บไปทๆ ผ"}),e.jsx(ns,{className:"text-right",children:"ๆ“ไฝœ"})]})}),e.jsx(Gl,{children:l.length===0?e.jsx(_t,{children:e.jsx(Ze,{colSpan:9,className:"text-center text-muted-foreground py-8",children:N?"ๆœชๆ‰พๅˆฐๅŒน้…็š„ๆจกๅž‹":"ๆš‚ๆ— ๆจกๅž‹้…็ฝฎ"})}):l.map((j,b)=>{const y=r.findIndex(z=>z===j),w=g(j.name);return e.jsxs(_t,{children:[e.jsx(Ze,{children:e.jsx(tt,{checked:d.has(y),onCheckedChange:()=>f(y)})}),e.jsx(Ze,{children:e.jsx(Ce,{variant:w?"default":"secondary",className:w?"bg-green-600 hover:bg-green-700":"",children:w?"ๅทฒไฝฟ็”จ":"ๆœชไฝฟ็”จ"})}),e.jsx(Ze,{className:"font-medium",children:j.name}),e.jsx(Ze,{className:"max-w-xs truncate",title:j.model_identifier,children:j.model_identifier}),e.jsx(Ze,{children:j.api_provider}),e.jsx(Ze,{className:"text-center",children:j.temperature!=null?j.temperature:e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsxs(Ze,{className:"text-right",children:["ยฅ",j.price_in,"/M"]}),e.jsxs(Ze,{className:"text-right",children:["ยฅ",j.price_out,"/M"]}),e.jsx(Ze,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>m(j,y),children:[e.jsx(Zn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"็ผ–่พ‘"]}),e.jsxs(_,{size:"sm",onClick:()=>h(y),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(os,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"ๅˆ ้™ค"]})]})})]},b)})})]})})})}),k4=300*1e3,Zg=new Map,C4=[10,20,50,100],T4=Bs.memo(function({page:l,pageSize:r,totalItems:c,jumpToPage:d,onPageChange:m,onPageSizeChange:h,onJumpToPageChange:f,onJumpToPage:p,onSelectionClear:g}){const N=Math.ceil(c/r),j=y=>{h(parseInt(y)),m(1),g?.()},b=y=>{y.key==="Enter"&&p()};return c===0?null:e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{htmlFor:"page-size-model",className:"text-sm whitespace-nowrap",children:"ๆฏ้กตๆ˜พ็คบ"}),e.jsxs(Pe,{value:r.toString(),onValueChange:j,children:[e.jsx(Be,{id:"page-size-model",className:"w-20",children:e.jsx(Fe,{})}),e.jsx(Ie,{children:C4.map(y=>e.jsx(W,{value:y.toString(),children:y},y))})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["ๆ˜พ็คบ ",(l-1)*r+1," ๅˆฐ"," ",Math.min(l*r,c)," ๆก๏ผŒๅ…ฑ ",c," ๆก"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>m(1),disabled:l===1,className:"hidden sm:flex",children:e.jsx(kn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>m(Math.max(1,l-1)),disabled:l===1,children:[e.jsx(Pa,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"ไธŠไธ€้กต"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{type:"number",value:d,onChange:y=>f(y.target.value),onKeyDown:b,placeholder:l.toString(),className:"w-16 h-8 text-center",min:1,max:N}),e.jsx(_,{variant:"outline",size:"sm",onClick:p,disabled:!d,className:"h-8",children:"่ทณ่ฝฌ"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>m(l+1),disabled:l>=N,children:[e.jsx("span",{className:"hidden sm:inline",children:"ไธ‹ไธ€้กต"}),e.jsx(ra,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>m(N),disabled:l>=N,className:"hidden sm:flex",children:e.jsx(Cn,{className:"h-4 w-4"})})]})]})});function E4(a){const{models:l,taskConfig:r,debounceMs:c=2e3,onSavingChange:d,onUnsavedChange:m}=a,h=u.useRef(null),f=u.useRef(null),p=u.useRef(!0),g=u.useCallback(()=>{h.current&&(clearTimeout(h.current),h.current=null),f.current&&(clearTimeout(f.current),f.current=null)},[]),N=u.useCallback(y=>{const w={model_identifier:y.model_identifier,name:y.name,api_provider:y.api_provider,price_in:y.price_in??0,price_out:y.price_out??0,force_stream_mode:y.force_stream_mode??!1,extra_params:y.extra_params??{}};return y.temperature!=null&&(w.temperature=y.temperature),y.max_tokens!=null&&(w.max_tokens=y.max_tokens),w},[]),j=u.useCallback(async y=>{try{d?.(!0);const w=y.map(N);await Wm("models",w),m?.(!1)}catch(w){console.error("่‡ชๅŠจไฟๅญ˜ๆจกๅž‹ๅˆ—่กจๅคฑ่ดฅ:",w),m?.(!0)}finally{d?.(!1)}},[d,m,N]),b=u.useCallback(async y=>{try{d?.(!0),await Wm("model_task_config",y),m?.(!1)}catch(w){console.error("่‡ชๅŠจไฟๅญ˜ไปปๅŠก้…็ฝฎๅคฑ่ดฅ:",w),m?.(!0)}finally{d?.(!1)}},[d,m]);return u.useEffect(()=>{if(!p.current)return m?.(!0),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{j(l)},c),()=>{h.current&&clearTimeout(h.current)}},[l,j,c,m]),u.useEffect(()=>{if(!(p.current||!r))return m?.(!0),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{b(r)},c),()=>{f.current&&clearTimeout(f.current)}},[r,b,c,m]),u.useEffect(()=>()=>{g()},[g]),{clearTimers:g,initialLoadRef:p}}function M4(a={}){const{onCloseEditDialog:l}=a,r=ha(),{registerTour:c,startTour:d,state:m,goToStep:h}=Ex(),f=u.useRef(m.stepIndex);return u.useEffect(()=>{c(gl,aN)},[c]),u.useEffect(()=>{if(m.activeTourId===gl&&m.isRunning){const g=lN[m.stepIndex];g&&!window.location.pathname.endsWith(g.replace("/config/",""))&&r({to:g})}},[m.stepIndex,m.activeTourId,m.isRunning,r]),u.useEffect(()=>{if(m.activeTourId===gl&&m.isRunning){const g=f.current,N=m.stepIndex;g>=12&&g<=17&&N<12&&l?.(),f.current=N}},[m.stepIndex,m.activeTourId,m.isRunning,l]),u.useEffect(()=>{if(m.activeTourId!==gl||!m.isRunning)return;const g=N=>{const j=N.target,b=m.stepIndex;b===2&&j.closest('[data-tour="add-provider-button"]')?setTimeout(()=>h(3),300):b===9&&j.closest('[data-tour="provider-cancel-button"]')?setTimeout(()=>h(10),300):b===11&&j.closest('[data-tour="add-model-button"]')?setTimeout(()=>h(12),300):b===17&&j.closest('[data-tour="model-cancel-button"]')?setTimeout(()=>h(18),300):b===18&&j.closest('[data-tour="tasks-tab-trigger"]')&&setTimeout(()=>h(19),300)};return document.addEventListener("click",g,!0),()=>document.removeEventListener("click",g,!0)},[m,h]),{startTour:u.useCallback(()=>{d(gl)},[d]),isRunning:m.isRunning&&m.activeTourId===gl,stepIndex:m.stepIndex}}function A4(a){const{getProviderConfig:l}=a,[r,c]=u.useState([]),[d,m]=u.useState(!1),[h,f]=u.useState(null),[p,g]=u.useState(null),N=u.useCallback(()=>{c([]),f(null),g(null)},[]),j=u.useCallback(async(b,y=!1)=>{const w=l(b);if(!w?.base_url){c([]),g(null),f('ๆไพ›ๅ•†้…็ฝฎไธๅฎŒๆ•ด๏ผŒ่ฏทๅ…ˆๅœจ"ๆจกๅž‹ๆไพ›ๅ•†้…็ฝฎ"ไธญ้…็ฝฎ');return}if(!w.api_key){c([]),g(null),f('่ฏฅๆไพ›ๅ•†ๆœช้…็ฝฎ API Key๏ผŒ่ฏทๅ…ˆๅœจ"ๆจกๅž‹ๆไพ›ๅ•†้…็ฝฎ"ไธญๅกซๅ†™');return}const z=n4(w.base_url);if(g(z),!z?.modelFetcher){c([]),f(null);return}const M=`${b}:${w.base_url}`,S=Zg.get(M);if(!y&&S&&Date.now()-S.timestampE(!1)}),{clearTimers:V,initialLoadRef:Ke}=E4({models:a,taskConfig:p,onSavingChange:z,onUnsavedChange:S}),He=u.useCallback((ae,oe)=>{if(!ae)return;const qe=new Set(oe.map(Ca=>Ca.name)),Ys=[],Ps=[],vt=[{key:"utils",label:"ๅทฅๅ…ทๆจกๅž‹"},{key:"tool_use",label:"ๅทฅๅ…ท่ฐƒ็”จๆจกๅž‹"},{key:"replyer",label:"ๅ›žๅคๆจกๅž‹"},{key:"planner",label:"่ง„ๅˆ’ๅ™จๆจกๅž‹"},{key:"vlm",label:"่ง†่ง‰ๆจกๅž‹"},{key:"voice",label:"่ฏญ้Ÿณๆจกๅž‹"},{key:"embedding",label:"ๅตŒๅ…ฅๆจกๅž‹"},{key:"lpmm_entity_extract",label:"LPMMๅฎžไฝ“ๆŠฝๅ–"},{key:"lpmm_rdf_build",label:"LPMMๅ…ณ็ณปๆž„ๅปบ"}];for(const{key:Ca,label:ll}of vt){const ml=ae[Ca];if(!ml)continue;if(!ml.model_list||ml.model_list.length===0){Ps.push(ll);continue}const rr=ml.model_list.filter(Ql=>!qe.has(Ql));rr.length>0&&Ys.push({taskName:ll,invalidModels:rr})}le(Ys),xe(Ps)},[]),Je=u.useCallback(async()=>{try{j(!0);const ae=await Nn(),oe=ae.models||[];l(oe),f(oe.map(vt=>vt.name));const qe=ae.api_providers||[];c(qe.map(vt=>vt.name)),m(qe);const Ys=ae.model_task_config||null;g(Ys),He(Ys,oe);const Ps=Ys?.embedding?.model_list||[];J.current=[...Ps],S(!1),Ke.current=!1}catch(ae){console.error("ๅŠ ่ฝฝ้…็ฝฎๅคฑ่ดฅ:",ae)}finally{j(!1)}},[Ke,He]);u.useEffect(()=>{Je()},[Je]);const Es=u.useCallback(ae=>d.find(oe=>oe.name===ae),[d]),{availableModels:ms,fetchingModels:Ms,modelFetchError:We,matchedTemplate:Cs,fetchModelsForProvider:rs,clearModels:is}=A4({getProviderConfig:Es});u.useEffect(()=>{F&&C?.api_provider&&rs(C.api_provider)},[F,C?.api_provider,rs]);const ys=async()=>{await Ct()},rt=u.useCallback(()=>{if(!p)return;const ae=new Set(a.map(Ys=>Ys.name)),oe={...p},qe=Object.keys(oe);for(const Ys of qe){const Ps=oe[Ys];Ps&&Ps.model_list&&(Ps.model_list=Ps.model_list.filter(vt=>ae.has(vt)))}g(oe),le([]),Ts({title:"ๆธ…็†ๅฎŒๆˆ",description:"ๅทฒๅˆ ้™คๆ‰€ๆœ‰ๆ— ๆ•ˆ็š„ๆจกๅž‹ๅผ•็”จ"})},[p,a,Ts]),jt=ae=>{const oe={model_identifier:ae.model_identifier,name:ae.name,api_provider:ae.api_provider,price_in:ae.price_in??0,price_out:ae.price_out??0,force_stream_mode:ae.force_stream_mode??!1,extra_params:ae.extra_params??{}};return ae.temperature!=null&&(oe.temperature=ae.temperature),ae.max_tokens!=null&&(oe.max_tokens=ae.max_tokens),oe},Ae=async()=>{try{y(!0),V();const ae=await Nn();ae.models=a.map(jt),ae.model_task_config=p,await lc(ae),S(!1),Ts({title:"ไฟๅญ˜ๆˆๅŠŸ",description:"ๆญฃๅœจ้‡ๅฏ้บฆ้บฆ..."}),await ys()}catch(ae){console.error("ไฟๅญ˜้…็ฝฎๅคฑ่ดฅ:",ae),Ts({title:"ไฟๅญ˜ๅคฑ่ดฅ",description:ae.message,variant:"destructive"}),y(!1)}},Qe=async()=>{try{y(!0),V();const ae=await Nn();ae.models=a.map(jt),ae.model_task_config=p,await lc(ae),S(!1),Ts({title:"ไฟๅญ˜ๆˆๅŠŸ",description:"ๆจกๅž‹้…็ฝฎๅทฒไฟๅญ˜"}),await Je()}catch(ae){console.error("ไฟๅญ˜้…็ฝฎๅคฑ่ดฅ:",ae),Ts({title:"ไฟๅญ˜ๅคฑ่ดฅ",description:ae.message,variant:"destructive"})}finally{y(!1)}},As=(ae,oe)=>{ds({}),R(ae||{model_identifier:"",name:"",api_provider:r[0]||"",price_in:0,price_out:0,temperature:null,max_tokens:null,force_stream_mode:!1,extra_params:{}}),O(oe),E(!0)},mt=()=>{if(!C)return;const ae={};if(C.name?.trim()?a.some((vt,Ca)=>H!==null&&Ca===H?!1:vt.name.trim().toLowerCase()===C.name.trim().toLowerCase())&&(ae.name="ๆจกๅž‹ๅ็งฐๅทฒๅญ˜ๅœจ๏ผŒ่ฏทไฝฟ็”จๅ…ถไป–ๅ็งฐ"):ae.name="่ฏท่พ“ๅ…ฅๆจกๅž‹ๅ็งฐ",C.api_provider?.trim()||(ae.api_provider="่ฏท้€‰ๆ‹ฉ API ๆไพ›ๅ•†"),C.model_identifier?.trim()||(ae.model_identifier="่ฏท่พ“ๅ…ฅๆจกๅž‹ๆ ‡่ฏ†็ฌฆ"),Object.keys(ae).length>0){ds(ae);return}ds({});const oe={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&&(oe.temperature=C.temperature),C.max_tokens!=null&&(oe.max_tokens=C.max_tokens);let qe,Ys=null;if(H!==null?(Ys=a[H].name,qe=[...a],qe[H]=oe):qe=[...a,oe],l(qe),f(qe.map(Ps=>Ps.name)),Ys&&Ys!==oe.name&&p){const Ps=vt=>vt.map(Ca=>Ca===Ys?oe.name:Ca);g({...p,utils:{...p.utils,model_list:Ps(p.utils?.model_list||[])},tool_use:{...p.tool_use,model_list:Ps(p.tool_use?.model_list||[])},replyer:{...p.replyer,model_list:Ps(p.replyer?.model_list||[])},planner:{...p.planner,model_list:Ps(p.planner?.model_list||[])},vlm:{...p.vlm,model_list:Ps(p.vlm?.model_list||[])},voice:{...p.voice,model_list:Ps(p.voice?.model_list||[])},embedding:{...p.embedding,model_list:Ps(p.embedding?.model_list||[])},lpmm_entity_extract:{...p.lpmm_entity_extract,model_list:Ps(p.lpmm_entity_extract?.model_list||[])},lpmm_rdf_build:{...p.lpmm_rdf_build,model_list:Ps(p.lpmm_rdf_build?.model_list||[])}})}E(!1),R(null),O(null),Ts({title:H!==null?"ๆจกๅž‹ๅทฒๆ›ดๆ–ฐ":"ๆจกๅž‹ๅทฒๆทปๅŠ ",description:'้…็ฝฎๅฐ†ๅœจ 2 ็ง’ๅŽ่‡ชๅŠจไฟๅญ˜๏ผŒๆˆ–็‚นๅ‡ปๅณไธŠ่ง’"ไฟๅญ˜้…็ฝฎ"ๆŒ‰้’ฎ็ซ‹ๅณไฟๅญ˜'})},Ht=ae=>{if(!ae&&C){const oe={...C,price_in:C.price_in??0,price_out:C.price_out??0};R(oe)}E(ae)},ca=ae=>{ce(ae),Ne(!0)},Fa=()=>{if(je!==null){const ae=a.filter((oe,qe)=>qe!==je);l(ae),f(ae.map(oe=>oe.name)),He(p,ae),Ts({title:"ๅˆ ้™คๆˆๅŠŸ",description:'้…็ฝฎๅฐ†ๅœจ 2 ็ง’ๅŽ่‡ชๅŠจไฟๅญ˜๏ผŒๆˆ–็‚นๅ‡ปๅณไธŠ่ง’"ไฟๅญ˜้…็ฝฎ"ๆŒ‰้’ฎ็ซ‹ๅณไฟๅญ˜'})}Ne(!1),ce(null)},Xt=ae=>{const oe=new Set(D);oe.has(ae)?oe.delete(ae):oe.add(ae),Q(oe)},te=()=>{if(D.size===es.length)Q(new Set);else{const ae=es.map((oe,qe)=>a.findIndex(Ys=>Ys===es[qe]));Q(new Set(ae))}},_e=()=>{if(D.size===0){Ts({title:"ๆ็คบ",description:"่ฏทๅ…ˆ้€‰ๆ‹ฉ่ฆๅˆ ้™ค็š„ๆจกๅž‹",variant:"default"});return}ue(!0)},U=()=>{const ae=D.size,oe=a.filter((qe,Ys)=>!D.has(Ys));l(oe),f(oe.map(qe=>qe.name)),He(p,oe),Q(new Set),ue(!1),Ts({title:"ๆ‰น้‡ๅˆ ้™คๆˆๅŠŸ",description:`ๅทฒๅˆ ้™ค ${ae} ไธชๆจกๅž‹๏ผŒ้…็ฝฎๅฐ†ๅœจ 2 ็ง’ๅŽ่‡ชๅŠจไฟๅญ˜`})},Se=(ae,oe,qe)=>{if(!p)return;if(ae==="embedding"&&oe==="model_list"&&Array.isArray(qe)){const Ps=J.current,vt=qe;if((Ps.length!==vt.length||Ps.some(ll=>!vt.includes(ll))||vt.some(ll=>!Ps.includes(ll)))&&Ps.length>0){Z.current={field:oe,value:qe},cs(!0);return}}const Ys={...p,[ae]:{...p[ae],[oe]:qe}};g(Ys),He(Ys,a),ae==="embedding"&&oe==="model_list"&&Array.isArray(qe)&&(J.current=[...qe])},as=()=>{if(!p||!Z.current)return;const{field:ae,value:oe}=Z.current,qe={...p,embedding:{...p.embedding,[ae]:oe}};g(qe),He(qe,a),ae==="model_list"&&Array.isArray(oe)&&(J.current=[...oe]),Z.current=null,cs(!1),Ts({title:"ๅตŒๅ…ฅๆจกๅž‹ๅทฒๆ›ดๆ–ฐ",description:"ๅปบ่ฎฎ้‡ๆ–ฐ็”Ÿๆˆ็Ÿฅ่ฏ†ๅบ“ๅ‘้‡ไปฅ็กฎไฟๆœ€ไฝณๅŒน้…็ฒพๅบฆ"})},us=()=>{Z.current=null,cs(!1)},es=a.filter(ae=>{if(!ge)return!0;const oe=ge.toLowerCase();return ae.name.toLowerCase().includes(oe)||ae.model_identifier.toLowerCase().includes(oe)||ae.api_provider.toLowerCase().includes(oe)}),Tt=Math.ceil(es.length/fe),$s=es.slice((Y-1)*fe,Y*fe),pa=()=>{const ae=parseInt(G);ae>=1&&ae<=Tt&&(we(ae),$(""))},oa=ae=>p?[p.utils?.model_list||[],p.tool_use?.model_list||[],p.replyer?.model_list||[],p.planner?.model_list||[],p.vlm?.model_list||[],p.voice?.model_list||[],p.embedding?.model_list||[],p.lpmm_entity_extract?.model_list||[],p.lpmm_rdf_build?.model_list||[]].some(qe=>qe.includes(ae)):!1;return N?e.jsx(ts,{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(ts,{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(b4,{trigger:e.jsxs(_,{variant:"outline",size:"sm",className:"flex-1 sm:flex-none",children:[e.jsx(mv,{className:"mr-2 h-4 w-4"}),"ๅˆ†ไบซ้…็ฝฎ"]})}),e.jsxs(_,{onClick:Qe,disabled:b||w||!M||ia,size:"sm",variant:"outline",className:"flex-1 sm:flex-none sm:min-w-[120px]",children:[e.jsx(gc,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),b?"ไฟๅญ˜ไธญ...":w?"่‡ชๅŠจไฟๅญ˜ไธญ...":M?"ไฟๅญ˜้…็ฝฎ":"ๅทฒไฟๅญ˜"]}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{disabled:b||w||ia,size:"sm",className:"flex-1 sm:flex-none sm:min-w-[120px]",children:[e.jsx(pc,{className:"mr-2 h-4 w-4"}),ia?"้‡ๅฏไธญ...":M?"ไฟๅญ˜ๅนถ้‡ๅฏ":"้‡ๅฏ้บฆ้บฆ"]})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎค้‡ๅฏ้บฆ้บฆ๏ผŸ"}),e.jsx(gs,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:M?"ๅฝ“ๅ‰ๆœ‰ๆœชไฟๅญ˜็š„้…็ฝฎๆ›ดๆ”นใ€‚็‚นๅ‡ป็กฎ่ฎคๅฐ†ๅ…ˆไฟๅญ˜้…็ฝฎ,็„ถๅŽ้‡ๅฏ้บฆ้บฆไฝฟๆ–ฐ้…็ฝฎ็”Ÿๆ•ˆใ€‚้‡ๅฏ่ฟ‡็จ‹ไธญ้บฆ้บฆๅฐ†ๆš‚ๆ—ถ็ฆป็บฟใ€‚":"ๅณๅฐ†้‡ๅฏ้บฆ้บฆไธป็จ‹ๅบใ€‚้‡ๅฏ่ฟ‡็จ‹ไธญ้บฆ้บฆๅฐ†ๆš‚ๆ—ถ็ฆป็บฟ,้…็ฝฎๅฐ†ๅœจ้‡ๅฏๅŽ็”Ÿๆ•ˆใ€‚"})})})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:M?Ae:ys,children:M?"ไฟๅญ˜ๅนถ้‡ๅฏ":"็กฎ่ฎค้‡ๅฏ"})]})]})]})]})]}),e.jsxs(ht,{children:[e.jsx(Yt,{className:"h-4 w-4"}),e.jsxs(ft,{children:["้…็ฝฎๆ›ดๆ–ฐๅŽ้œ€่ฆ",e.jsx("strong",{children:"้‡ๅฏ้บฆ้บฆ"}),'ๆ‰่ƒฝ็”Ÿๆ•ˆใ€‚ไฝ ๅฏไปฅ็‚นๅ‡ปๅณไธŠ่ง’็š„"ไฟๅญ˜ๅนถ้‡ๅฏ"ๆŒ‰้’ฎไธ€้”ฎๅฎŒๆˆไฟๅญ˜ๅ’Œ้‡ๅฏใ€‚']})]}),Le.length>0&&e.jsxs(ht,{variant:"destructive",children:[e.jsx(Lt,{className:"h-4 w-4"}),e.jsxs(ft,{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:Le.map(({taskName:ae,invalidModels:oe})=>e.jsxs("div",{className:"text-sm",children:[e.jsx("strong",{children:ae})," ๅผ•็”จไบ†ไธๅญ˜ๅœจ็š„ๆจกๅž‹: ",oe.join(", ")]},ae))})]}),e.jsx(_,{variant:"outline",size:"sm",className:"shrink-0 bg-background hover:bg-accent",onClick:rt,children:"ไธ€้”ฎๆธ…็†"})]})]}),De.length>0&&e.jsxs(ht,{variant:"default",className:"border-yellow-500/50 bg-yellow-500/10",children:[e.jsx(Lt,{className:"h-4 w-4 text-yellow-600"}),e.jsxs(ft,{children:[e.jsx("strong",{className:"text-yellow-600",children:"ไปฅไธ‹ไปปๅŠกๆœช้…็ฝฎๆจกๅž‹"}),e.jsxs("div",{className:"mt-2 text-sm",children:[De.join("ใ€")," ่ฟ˜ๆœชๅˆ†้…ๆจกๅž‹๏ผŒ่ฟ™ไบ›ๅŠŸ่ƒฝๅฐ†ๆ— ๆณ•ๆญฃๅธธๅทฅไฝœใ€‚"]})]})]}),e.jsxs(ht,{className:"hidden lg:flex border-primary/30 bg-primary/5 cursor-pointer hover:bg-primary/10 transition-colors",onClick:ut,children:[e.jsx(U1,{className:"h-4 w-4 text-primary"}),e.jsxs(ft,{className:"flex items-center justify-between",children:[e.jsxs("span",{children:[e.jsx("strong",{className:"text-primary",children:"ๆ–ฐๆ‰‹ๅผ•ๅฏผ๏ผš"}),"ไธ็Ÿฅ้“ๅฆ‚ไฝ•้…็ฝฎๆจกๅž‹๏ผŸ็‚นๅ‡ป่ฟ™้‡Œๅผ€ๅง‹ๅญฆไน ๅฆ‚ไฝ•ไธบ้บฆ้บฆ็š„็ป„ไปถๅˆ†้…ๆจกๅž‹ใ€‚"]}),e.jsx(_,{variant:"outline",size:"sm",className:"ml-4 shrink-0",children:"ๅผ€ๅง‹ๅผ•ๅฏผ"})]})]}),e.jsxs(Jt,{defaultValue:"models",className:"w-full",children:[e.jsxs(Gt,{className:"grid w-full max-w-full sm:max-w-md grid-cols-2",children:[e.jsx(Xe,{value:"models",children:"ๆทปๅŠ ๆจกๅž‹"}),e.jsx(Xe,{value:"tasks","data-tour":"tasks-tab-trigger",children:"ไธบๆจกๅž‹ๅˆ†้…ๅŠŸ่ƒฝ"})]}),e.jsxs(Ss,{value:"models",className:"space-y-4 mt-0",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-2",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"้…็ฝฎๅฏ็”จ็š„ๆจกๅž‹ๅˆ—่กจ"}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[D.size>0&&e.jsxs(_,{onClick:_e,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(os,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"ๆ‰น้‡ๅˆ ้™ค (",D.size,")"]}),e.jsxs(_,{onClick:()=>As(null,null),size:"sm",variant:"outline",className:"w-full sm:w-auto","data-tour":"add-model-button",children:[e.jsx(Xs,{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($t,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ne,{placeholder:"ๆœ็ดขๆจกๅž‹ๅ็งฐใ€ๆ ‡่ฏ†็ฌฆๆˆ–ๆไพ›ๅ•†...",value:ge,onChange:ae=>pe(ae.target.value),className:"pl-9"})]}),ge&&e.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["ๆ‰พๅˆฐ ",es.length," ไธช็ป“ๆžœ"]})]}),e.jsx(_4,{paginatedModels:$s,allModels:a,onEdit:As,onDelete:ca,isModelUsed:oa,searchQuery:ge}),e.jsx(S4,{paginatedModels:$s,allModels:a,filteredModels:es,selectedModels:D,onEdit:As,onDelete:ca,onToggleSelection:Xt,onToggleSelectAll:te,isModelUsed:oa,searchQuery:ge}),e.jsx(T4,{page:Y,pageSize:fe,totalItems:es.length,jumpToPage:G,onPageChange:we,onPageSizeChange:Ee,onJumpToPageChange:$,onJumpToPage:pa,onSelectionClear:()=>Q(new Set)})]}),e.jsxs(Ss,{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(Ul,{title:"็ป„ไปถๆจกๅž‹ (utils)",description:"็”จไบŽ่กจๆƒ…ๅŒ…ใ€ๅ–ๅใ€ๅ…ณ็ณปใ€ๆƒ…็ปชๅ˜ๅŒ–็ญ‰็ป„ไปถ",taskConfig:p.utils,modelNames:h,onChange:(ae,oe)=>Se("utils",ae,oe),dataTour:"task-model-select"}),e.jsx(Ul,{title:"ๅทฅๅ…ท่ฐƒ็”จๆจกๅž‹ (tool_use)",description:"้œ€่ฆไฝฟ็”จๆ”ฏๆŒๅทฅๅ…ท่ฐƒ็”จ็š„ๆจกๅž‹",taskConfig:p.tool_use,modelNames:h,onChange:(ae,oe)=>Se("tool_use",ae,oe)}),e.jsx(Ul,{title:"้ฆ–่ฆๅ›žๅคๆจกๅž‹ (replyer)",description:"็”จไบŽ่กจ่พพๅ™จๅ’Œ่กจ่พพๆ–นๅผๅญฆไน ",taskConfig:p.replyer,modelNames:h,onChange:(ae,oe)=>Se("replyer",ae,oe)}),e.jsx(Ul,{title:"ๅ†ณ็ญ–ๆจกๅž‹ (planner)",description:"่ดŸ่ดฃๅ†ณๅฎš้บฆ้บฆ่ฏฅไป€ไนˆๆ—ถๅ€™ๅ›žๅค",taskConfig:p.planner,modelNames:h,onChange:(ae,oe)=>Se("planner",ae,oe)}),e.jsx(Ul,{title:"ๅ›พๅƒ่ฏ†ๅˆซๆจกๅž‹ (vlm)",description:"่ง†่ง‰่ฏญ่จ€ๆจกๅž‹",taskConfig:p.vlm,modelNames:h,onChange:(ae,oe)=>Se("vlm",ae,oe),hideTemperature:!0}),e.jsx(Ul,{title:"่ฏญ้Ÿณ่ฏ†ๅˆซๆจกๅž‹ (voice)",description:"่ฏญ้Ÿณ่ฝฌๆ–‡ๅญ—",taskConfig:p.voice,modelNames:h,onChange:(ae,oe)=>Se("voice",ae,oe),hideTemperature:!0,hideMaxTokens:!0}),e.jsx(Ul,{title:"ๅตŒๅ…ฅๆจกๅž‹ (embedding)",description:"็”จไบŽๅ‘้‡ๅŒ–",taskConfig:p.embedding,modelNames:h,onChange:(ae,oe)=>Se("embedding",ae,oe),hideTemperature:!0,hideMaxTokens:!0}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"LPMM ็Ÿฅ่ฏ†ๅบ“ๆจกๅž‹"}),e.jsx(Ul,{title:"ๅฎžไฝ“ๆๅ–ๆจกๅž‹ (lpmm_entity_extract)",description:"ไปŽๆ–‡ๆœฌไธญๆๅ–ๅฎžไฝ“",taskConfig:p.lpmm_entity_extract,modelNames:h,onChange:(ae,oe)=>Se("lpmm_entity_extract",ae,oe)}),e.jsx(Ul,{title:"RDF ๆž„ๅปบๆจกๅž‹ (lpmm_rdf_build)",description:"ๆž„ๅปบ็Ÿฅ่ฏ†ๅ›พ่ฐฑ",taskConfig:p.lpmm_rdf_build,modelNames:h,onChange:(ae,oe)=>Se("lpmm_rdf_build",ae,oe)})]})]})]})]}),e.jsx(Qs,{open:F,onOpenChange:Ht,children:e.jsxs(Hs,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto","data-tour":"model-dialog",preventOutsideClose:Is,children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:H!==null?"็ผ–่พ‘ๆจกๅž‹":"ๆทปๅŠ ๆจกๅž‹"}),e.jsx(at,{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:Me.name?"text-destructive":"",children:"ๆจกๅž‹ๅ็งฐ *"}),e.jsx(ne,{id:"model_name",value:C?.name||"",onChange:ae=>{R(oe=>oe?{...oe,name:ae.target.value}:null),Me.name&&ds(oe=>({...oe,name:void 0}))},placeholder:"ไพ‹ๅฆ‚: qwen3-30b",className:Me.name?"border-destructive focus-visible:ring-destructive":""}),Me.name?e.jsx("p",{className:"text-xs text-destructive",children:Me.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:Me.api_provider?"text-destructive":"",children:"API ๆไพ›ๅ•† *"}),e.jsxs(Pe,{value:C?.api_provider||"",onValueChange:ae=>{R(oe=>oe?{...oe,api_provider:ae}:null),is(),Me.api_provider&&ds(oe=>({...oe,api_provider:void 0}))},children:[e.jsx(Be,{id:"api_provider",className:Me.api_provider?"border-destructive focus-visible:ring-destructive":"",children:e.jsx(Fe,{placeholder:"้€‰ๆ‹ฉๆไพ›ๅ•†"})}),e.jsx(Ie,{children:r.map(ae=>e.jsx(W,{value:ae,children:ae},ae))})]}),Me.api_provider&&e.jsx("p",{className:"text-xs text-destructive",children:Me.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:Me.model_identifier?"text-destructive":"",children:"ๆจกๅž‹ๆ ‡่ฏ†็ฌฆ *"}),Cs?.modelFetcher&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ce,{variant:"secondary",className:"text-xs",children:Cs.display_name}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-6 px-2",onClick:()=>C?.api_provider&&rs(C.api_provider,!0),disabled:Ms,children:Ms?e.jsx(Fs,{className:"h-3 w-3 animate-spin"}):e.jsx(dt,{className:"h-3 w-3"})})]})]}),Cs?.modelFetcher?e.jsxs(cl,{open:Re,onOpenChange:se,children:[e.jsx(ol,{asChild:!0,children:e.jsxs(_,{variant:"outline",role:"combobox","aria-expanded":Re,className:"w-full justify-between font-normal",disabled:Ms||!!We,children:[Ms?e.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(Fs,{className:"h-4 w-4 animate-spin"}),"ๆญฃๅœจ่Žทๅ–ๆจกๅž‹ๅˆ—่กจ..."]}):We?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(mx,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(tl,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:e.jsxs(md,{children:[e.jsx(xd,{placeholder:"ๆœ็ดขๆจกๅž‹..."}),e.jsx(ts,{className:"h-[300px]",children:e.jsxs(hd,{className:"max-h-none overflow-visible",children:[e.jsx(fd,{children:We?e.jsxs("div",{className:"py-4 px-2 text-center space-y-2",children:[e.jsx("p",{className:"text-sm text-destructive",children:We}),!We.includes("API Key")&&e.jsx(_,{variant:"link",size:"sm",onClick:()=>C?.api_provider&&rs(C.api_provider,!0),children:"้‡่ฏ•"})]}):"ๆœชๆ‰พๅˆฐๅŒน้…็š„ๆจกๅž‹"}),e.jsx(uc,{heading:"ๅฏ็”จๆจกๅž‹",children:ms.map(ae=>e.jsxs(mc,{value:ae.id,onSelect:()=>{R(oe=>oe?{...oe,model_identifier:ae.id}:null),se(!1)},children:[e.jsx(Ot,{className:`mr-2 h-4 w-4 ${C?.model_identifier===ae.id?"opacity-100":"opacity-0"}`}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{children:ae.id}),ae.name!==ae.id&&e.jsx("span",{className:"text-xs text-muted-foreground",children:ae.name})]})]},ae.id))}),e.jsx(uc,{heading:"ๆ‰‹ๅŠจ่พ“ๅ…ฅ",children:e.jsxs(mc,{value:"__manual_input__",onSelect:()=>{se(!1)},children:[e.jsx(Zn,{className:"mr-2 h-4 w-4"}),"ๆ‰‹ๅŠจ่พ“ๅ…ฅๆจกๅž‹ๆ ‡่ฏ†็ฌฆ..."]})})]})})]})})]}):e.jsx(ne,{id:"model_identifier",value:C?.model_identifier||"",onChange:ae=>{R(oe=>oe?{...oe,model_identifier:ae.target.value}:null),Me.model_identifier&&ds(oe=>({...oe,model_identifier:void 0}))},placeholder:"Qwen/Qwen3-30B-A3B-Instruct-2507",className:Me.model_identifier?"border-destructive focus-visible:ring-destructive":""}),Me.model_identifier&&e.jsx("p",{className:"text-xs text-destructive",children:Me.model_identifier}),We&&Cs?.modelFetcher&&!Me.model_identifier&&e.jsxs(ht,{variant:"destructive",className:"mt-2 py-2",children:[e.jsx(Yt,{className:"h-4 w-4"}),e.jsx(ft,{className:"text-xs",children:We})]}),Cs?.modelFetcher&&e.jsx(ne,{value:C?.model_identifier||"",onChange:ae=>{R(oe=>oe?{...oe,model_identifier:ae.target.value}:null),Me.model_identifier&&ds(oe=>({...oe,model_identifier:void 0}))},placeholder:"ๆˆ–ๆ‰‹ๅŠจ่พ“ๅ…ฅๆจกๅž‹ๆ ‡่ฏ†็ฌฆ",className:`mt-2 ${Me.model_identifier?"border-destructive focus-visible:ring-destructive":""}`}),!Me.model_identifier&&e.jsx("p",{className:"text-xs text-muted-foreground",children:We?'่ฏทๆ‰‹ๅŠจ่พ“ๅ…ฅๆจกๅž‹ๆ ‡่ฏ†็ฌฆ๏ผŒๆˆ–ๅ‰ๅพ€"ๆจกๅž‹ๆไพ›ๅ•†้…็ฝฎ"ๆฃ€ๆŸฅ API Key':Cs?.modelFetcher?`ๅทฒ่ฏ†ๅˆซไธบ ${Cs.display_name}๏ผŒๆ”ฏๆŒ่‡ชๅŠจ่Žทๅ–ๆจกๅž‹ๅˆ—่กจ`:"API ๆไพ›ๅ•†ๆไพ›็š„ๆจกๅž‹ ID"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"price_in",children:"่พ“ๅ…ฅไปทๆ ผ (ยฅ/M token)"}),e.jsx(ne,{id:"price_in",type:"number",step:"0.1",min:"0",value:C?.price_in??"",onChange:ae=>{const oe=ae.target.value===""?null:parseFloat(ae.target.value);R(qe=>qe?{...qe,price_in:oe}:null)},placeholder:"้ป˜่ฎค: 0"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"price_out",children:"่พ“ๅ‡บไปทๆ ผ (ยฅ/M token)"}),e.jsx(ne,{id:"price_out",type:"number",step:"0.1",min:"0",value:C?.price_out??"",onChange:ae=>{const oe=ae.target.value===""?null:parseFloat(ae.target.value);R(qe=>qe?{...qe,price_out:oe}: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.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(T,{htmlFor:"enable_model_temperature",className:"cursor-pointer",children:"่‡ชๅฎšไน‰ๆจกๅž‹ๆธฉๅบฆ"}),e.jsx(Bl,{content:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"font-medium",children:"ไป€ไนˆๆ˜ฏๆธฉๅบฆ๏ผˆTemperature๏ผ‰๏ผŸ"}),e.jsx("p",{children:"ๆธฉๅบฆๆŽงๅˆถๆจกๅž‹่พ“ๅ‡บ็š„้šๆœบๆ€งๅ’Œๅˆ›้€ ๆ€ง๏ผš"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs",children:[e.jsxs("li",{children:[e.jsx("strong",{children:"ไฝŽๆธฉๅบฆ๏ผˆ0.1-0.3๏ผ‰"}),"๏ผšๆ›ด็กฎๅฎšใ€ๆ›ดไฟๅฎˆ็š„่พ“ๅ‡บ๏ผŒ้€‚ๅˆไบ‹ๅฎžๆ€งไปปๅŠก"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"ไธญๆธฉๅบฆ๏ผˆ0.5-0.7๏ผ‰"}),"๏ผšๅนณ่กกๅˆ›้€ ๆ€งไธŽๅฏๆŽงๆ€ง"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"้ซ˜ๆธฉๅบฆ๏ผˆ0.8-1.0๏ผ‰"}),"๏ผšๆ›ดๆœ‰ๅˆ›ๆ„ใ€ๆ›ดๅคšๆ ทๅŒ–็š„่พ“ๅ‡บ"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"ๆž้ซ˜ๆธฉๅบฆ๏ผˆ1.0-2.0๏ผ‰"}),"๏ผšๆžๅบฆ้šๆœบ๏ผŒๅฏ่ƒฝไบง็”Ÿไธๅฏ้ข„ๆต‹็š„็ป“ๆžœ"]})]})]}),side:"right",maxWidth:"400px"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅฏ็”จๅŽๅฐ†่ฆ†็›–ใ€Œไธบๆจกๅž‹ๅˆ†้…ๅŠŸ่ƒฝใ€ไธญ็š„ไปปๅŠกๆธฉๅบฆ้…็ฝฎ"})]}),e.jsx(Ge,{id:"enable_model_temperature",checked:C?.temperature!=null,onCheckedChange:ae=>{R(ae?oe=>oe?{...oe,temperature:.5}:null:oe=>oe?{...oe,temperature:null}:null)}})]}),C?.temperature!=null&&e.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx(T,{className:"text-sm",children:"ๆธฉๅบฆๅ€ผ"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{type:"number",value:C.temperature,onChange:ae=>{const oe=parseFloat(ae.target.value);!isNaN(oe)&&oe>=0&&oe<=2&&R(qe=>qe?{...qe,temperature:oe}:null)},onBlur:ae=>{const oe=parseFloat(ae.target.value);isNaN(oe)||oe<0?R(qe=>qe?{...qe,temperature:0}:null):oe>2&&R(qe=>qe?{...qe,temperature:2}:null)},step:.01,min:0,max:2,className:"w-20 h-8 text-sm text-right tabular-nums"}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>K(!A),className:"h-8 px-2",title:A?"ๅˆ‡ๆขๅˆฐๅŸบ็ก€ๆจกๅผ (0-1)":"่งฃ้”้ซ˜็บง่Œƒๅ›ด (0-2)",children:A?e.jsx($1,{className:"h-4 w-4"}):e.jsx(Jm,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-muted-foreground tabular-nums",children:"0"}),e.jsx(el,{value:[C.temperature],onValueChange:ae=>R(oe=>oe?{...oe,temperature:ae[0]}:null),min:0,max:A?2:1,step:A?.05:.1,className:"flex-1"}),e.jsx("span",{className:"text-xs text-muted-foreground tabular-nums",children:A?"2":"1"})]}),A&&e.jsxs(ht,{className:"bg-amber-500/10 border-amber-500/20 [&>svg+div]:translate-y-0",children:[e.jsx(Lt,{className:"h-4 w-4 text-amber-500"}),e.jsx(ft,{className:"text-xs text-amber-600 dark:text-amber-400",children:"้ซ˜็บงๆจกๅผ๏ผšๆธฉๅบฆ > 1 ไผšไบง็”Ÿๆ›ด้šๆœบใ€ๆ›ดไธๅฏ้ข„ๆต‹็š„่พ“ๅ‡บ๏ผŒ่ฏท่ฐจๆ…Žไฝฟ็”จ"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:A?"่พƒไฝŽ๏ผˆ0.1-0.5๏ผ‰ไบง็”Ÿ็กฎๅฎš่พ“ๅ‡บ๏ผŒไธญ็ญ‰๏ผˆ0.5-1.0๏ผ‰ๅนณ่กกๅˆ›้€ ๆ€ง๏ผŒ่พƒ้ซ˜๏ผˆ1.0-2.0๏ผ‰ไบง็”Ÿๆžๅบฆ้šๆœบ่พ“ๅ‡บ":"่พƒไฝŽ็š„ๆธฉๅบฆ๏ผˆ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.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(T,{htmlFor:"enable_model_max_tokens",className:"cursor-pointer",children:"่‡ชๅฎšไน‰ๆœ€ๅคง Token"}),e.jsx(Bl,{content:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"font-medium",children:"ไป€ไนˆๆ˜ฏๆœ€ๅคง Token๏ผŸ"}),e.jsx("p",{children:"ๆŽงๅˆถๆจกๅž‹ๅ•ๆฌกๅ›žๅค็š„ๆœ€ๅคง้•ฟๅบฆใ€‚1 token โ‰ˆ 0.75 ไธช่‹ฑๆ–‡ๅ•่ฏๆˆ– 0.5 ไธชไธญๆ–‡ๅญ—็ฌฆใ€‚"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs",children:[e.jsxs("li",{children:[e.jsx("strong",{children:"่พƒๅฐๅ€ผ๏ผˆ512-1024๏ผ‰"}),"๏ผš็ฎ€็Ÿญๅ›žๅค๏ผŒ่Š‚็œๆˆๆœฌ"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"ไธญ็ญ‰ๅ€ผ๏ผˆ2048-4096๏ผ‰"}),"๏ผšๆญฃๅธธๅฏน่ฏ้•ฟๅบฆ"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"่พƒๅคงๅ€ผ๏ผˆ8192+๏ผ‰"}),"๏ผš้•ฟๆ–‡ๆœฌ็”Ÿๆˆ๏ผŒๆˆๆœฌ่พƒ้ซ˜"]})]})]}),side:"right",maxWidth:"400px"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅฏ็”จๅŽๅฐ†่ฆ†็›–ใ€Œไธบๆจกๅž‹ๅˆ†้…ๅŠŸ่ƒฝใ€ไธญ็š„ไปปๅŠกๆœ€ๅคง Token ้…็ฝฎ"})]}),e.jsx(Ge,{id:"enable_model_max_tokens",checked:C?.max_tokens!=null,onCheckedChange:ae=>{R(ae?oe=>oe?{...oe,max_tokens:2048}:null:oe=>oe?{...oe,max_tokens:null}:null)}})]}),C?.max_tokens!=null&&e.jsxs("div",{className:"space-y-2 pt-2 border-t",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-sm",children:"ๆœ€ๅคง Token ๆ•ฐ"}),e.jsx(ne,{type:"number",min:"1",max:"128000",value:C.max_tokens,onChange:ae=>{const oe=parseInt(ae.target.value);!isNaN(oe)&&oe>=1&&R(qe=>qe?{...qe,max_tokens:oe}:null)},className:"w-28 h-8 text-sm"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"้™ๅˆถๆจกๅž‹ๅ•ๆฌก่พ“ๅ‡บ็š„ๆœ€ๅคง token ๆ•ฐ้‡๏ผŒไธๅŒๆจกๅž‹ๆ”ฏๆŒ็š„ไธŠ้™ไธๅŒ"})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"force_stream_mode",checked:C?.force_stream_mode||!1,onCheckedChange:ae=>R(oe=>oe?{...oe,force_stream_mode:ae}:null)}),e.jsx(T,{htmlFor:"force_stream_mode",className:"cursor-pointer",children:"ๅผบๅˆถๆตๅผ่พ“ๅ‡บๆจกๅผ"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"้ขๅค–ๅ‚ๆ•ฐ"}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs(_,{type:"button",variant:"outline",size:"sm",className:"flex-1 justify-start h-9",onClick:()=>L(!0),children:[e.jsx(Sn,{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(ae=>e.jsx("span",{className:"inline-block mr-2",children:e.jsx("code",{className:"px-1.5 py-0.5 bg-muted rounded",children:ae})},ae)),Object.keys(C?.extra_params||{}).length>3&&e.jsx("span",{children:"..."})]})]})]}),e.jsxs(gt,{children:[e.jsx(_,{variant:"outline",onClick:()=>E(!1),"data-tour":"model-cancel-button",children:"ๅ–ๆถˆ"}),e.jsx(_,{onClick:mt,"data-tour":"model-save-button",children:"ไฟๅญ˜"})]})]})}),e.jsx(bs,{open:me,onOpenChange:Ne,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsxs(gs,{children:['็กฎๅฎš่ฆๅˆ ้™คๆจกๅž‹ "',je!==null?a[je]?.name:"",'" ๅ—๏ผŸ ๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚']})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:Fa,children:"ๅˆ ้™ค"})]})]})}),e.jsx(bs,{open:B,onOpenChange:ue,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๆ‰น้‡ๅˆ ้™ค"}),e.jsxs(gs,{children:["็กฎๅฎš่ฆๅˆ ้™ค้€‰ไธญ็š„ ",D.size," ไธชๆจกๅž‹ๅ—๏ผŸ ๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:U,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"ๆ‰น้‡ๅˆ ้™ค"})]})]})}),e.jsx(bs,{open:$e,onOpenChange:cs,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsxs(ps,{className:"flex items-center gap-2",children:[e.jsx(Lt,{className:"h-5 w-5 text-amber-500"}),"ๆ›ดๆขๅตŒๅ…ฅๆจกๅž‹่ญฆๅ‘Š"]}),e.jsx(gs,{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(fs,{children:[e.jsx(vs,{onClick:us,children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:as,className:"bg-amber-600 hover:bg-amber-700",children:"็กฎ่ฎคๆ›ดๆข"})]})]})}),e.jsx(u4,{open:X,onOpenChange:L,value:C?.extra_params||{},onChange:ae=>R(oe=>oe?{...oe,extra_params:ae}:null)}),e.jsx(nr,{})]})})}const xc=Mj,hc=Aw,fc=zw,pd="/api/webui/config";async function D4(){const l=await(await ke(`${pd}/adapter-config/path`)).json();return!l.success||!l.path?null:{path:l.path,lastModified:l.lastModified}}async function Wg(a){const r=await(await ke(`${pd}/adapter-config/path`,{method:"POST",headers:Zs(),body:JSON.stringify({path:a})})).json();if(!r.success)throw new Error(r.message||"ไฟๅญ˜่ทฏๅพ„ๅคฑ่ดฅ")}async function ej(a){const r=await(await ke(`${pd}/adapter-config?path=${encodeURIComponent(a)}`)).json();if(!r.success)throw new Error("่ฏปๅ–้…็ฝฎๆ–‡ไปถๅคฑ่ดฅ");return r.content}async function sj(a,l){const c=await(await ke(`${pd}/adapter-config`,{method:"POST",headers:Zs(),body:JSON.stringify({path:a,content:l})})).json();if(!c.success)throw new Error(c.message||"ไฟๅญ˜้…็ฝฎๅคฑ่ดฅ")}const kt={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},forward:{image_threshold:30},debug:{level:"INFO"}},Fm={oneclick:{name:"ไธ€้”ฎๅŒ…",description:"ไฝฟ็”จไธ€้”ฎๅŒ…้ƒจ็ฝฒ็š„้€‚้…ๅ™จ้…็ฝฎ",path:"../MaiBot-Napcat-Adapter/config.toml",icon:xa},docker:{name:"Docker",description:"Docker Compose ้ƒจ็ฝฒ็š„้€‚้…ๅ™จ้…็ฝฎ",path:"/MaiMBot/adapters-config/config.toml",icon:B1}};function Hm(a){try{const l=_x(a);return{inner:{...kt.inner,...l.inner},nickname:{...kt.nickname,...l.nickname},napcat_server:{...kt.napcat_server,...l.napcat_server},maibot_server:{...kt.maibot_server,...l.maibot_server},chat:{...kt.chat,...l.chat},voice:{...kt.voice,...l.voice},forward:{...kt.forward,...l.forward},debug:{...kt.debug,...l.debug}}}catch(l){throw console.error("TOML ่งฃๆžๅคฑ่ดฅ:",l),new Error(`ๆ— ๆณ•่งฃๆž TOML ๆ–‡ไปถ: ${l instanceof Error?l.message:"ๆœช็Ÿฅ้”™่ฏฏ"}`)}}function qm(a){try{const l=(d,m)=>d===""||d===null||d===void 0?m:d,r={inner:{version:l(a.inner.version,kt.inner.version)},nickname:{nickname:l(a.nickname.nickname,kt.nickname.nickname)},napcat_server:{host:l(a.napcat_server.host,kt.napcat_server.host),port:l(a.napcat_server.port||0,kt.napcat_server.port),token:l(a.napcat_server.token,kt.napcat_server.token),heartbeat_interval:l(a.napcat_server.heartbeat_interval||0,kt.napcat_server.heartbeat_interval)},maibot_server:{host:l(a.maibot_server.host,kt.maibot_server.host),port:l(a.maibot_server.port||0,kt.maibot_server.port)},chat:{group_list_type:l(a.chat.group_list_type,kt.chat.group_list_type),group_list:a.chat.group_list||[],private_list_type:l(a.chat.private_list_type,kt.chat.private_list_type),private_list:a.chat.private_list||[],ban_user_id:a.chat.ban_user_id||[],ban_qq_bot:a.chat.ban_qq_bot??kt.chat.ban_qq_bot,enable_poke:a.chat.enable_poke??kt.chat.enable_poke},voice:{use_tts:a.voice.use_tts??kt.voice.use_tts},forward:{image_threshold:l(a.forward.image_threshold||0,kt.forward.image_threshold)},debug:{level:l(a.debug.level,kt.debug.level)}};let c=GS(r);return c=O4(c),c}catch(l){throw console.error("TOML ็”Ÿๆˆๅคฑ่ดฅ:",l),new Error(`ๆ— ๆณ•็”Ÿๆˆ TOML ๆ–‡ไปถ: ${l instanceof Error?l.message:"ๆœช็Ÿฅ้”™่ฏฏ"}`)}}function O4(a){const l=a.split(` +`),d}async function g4(a,l,r,c){const d=await ke("/api/webui/config/model");if(!d.ok)throw new Error("่Žทๅ–ๅฝ“ๅ‰ๆจกๅž‹้…็ฝฎๅคฑ่ดฅ");const m=await d.json(),h=m.config||m;if(l.apply_providers){const p=l.selected_providers?a.providers.filter(g=>l.selected_providers.includes(g.name)):a.providers;for(const g of p){if(r[g.name])continue;const N=c[g.name];if(!N)throw new Error(`ๆไพ›ๅ•† "${g.name}" ็ผบๅฐ‘ API Key`);const j={...g,api_key:N},b=h.api_providers.findIndex(y=>y.name===g.name);b>=0?h.api_providers[b]=j:h.api_providers.push(j)}}if(l.apply_models){const p=l.selected_models?a.models.filter(g=>l.selected_models.includes(g.name)):a.models;for(const g of p){const N=r[g.api_provider]||g.api_provider,j={...g,api_provider:N},b=h.models.findIndex(y=>y.name===g.name);b>=0?h.models[b]=j:h.models.push(j)}}if(l.apply_task_config){const p=l.selected_tasks||Object.keys(a.task_config);for(const g of p){const N=a.task_config[g];if(!N)continue;const j=new Set(l.selected_models||a.models.map(w=>w.name)),b=N.model_list.filter(w=>j.has(w));if(b.length===0)continue;const y={...N,model_list:b};if(l.task_mode==="replace")h.model_task_config[g]=y;else{const w=h.model_task_config[g];if(w){const z=[...new Set([...w.model_list,...b])];h.model_task_config[g]={...w,model_list:z}}else h.model_task_config[g]=y}}}if(!(await ke("/api/webui/config/model",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(h)})).ok)throw new Error("ไฟๅญ˜้…็ฝฎๅคฑ่ดฅ")}async function j4(a){const l=await ke("/api/webui/config/model");if(!l.ok)throw new Error("่Žทๅ–ๅฝ“ๅ‰ๆจกๅž‹้…็ฝฎๅคฑ่ดฅ");const r=await l.json();if(!r.success||!r.config)throw new Error("่Žทๅ–้…็ฝฎๅคฑ่ดฅ");const c=r.config;let d=(c.api_providers||[]).map(g=>({name:g.name,base_url:g.base_url,client_type:g.client_type,max_retry:g.max_retry,timeout:g.timeout,retry_interval:g.retry_interval}));a.selectedProviders&&(d=d.filter(g=>a.selectedProviders.includes(g.name)));let m=c.models||[];a.selectedModels&&(m=m.filter(g=>a.selectedModels.includes(g.name)));const h={},f=c.model_task_config||{},p=a.selectedTasks||Object.keys(f);for(const g of p)f[g]&&(h[g]=f[g]);return{providers:d,models:m,task_config:h}}function Pm(a){try{const l=new URL(a);return`${l.protocol}//${l.host}${l.pathname}`.replace(/\/$/,"").toLowerCase()}catch{return a.toLowerCase().replace(/\/$/,"")}}function cN(){const a="maibot_pack_user_id";let l=localStorage.getItem(a);return l||(l="pack_user_"+Math.random().toString(36).substring(2,15),localStorage.setItem(a,l)),l}const v4={utils:"้€š็”จๅทฅๅ…ท",utils_small:"่ฝป้‡ๅทฅๅ…ท",tool_use:"ๅทฅๅ…ท่ฐƒ็”จ",replyer:"ๅ›žๅค็”Ÿๆˆ",planner:"่ง„ๅˆ’ๆŽจ็†",vlm:"่ง†่ง‰ๆจกๅž‹",voice:"่ฏญ้Ÿณๅค„็†",embedding:"ๅ‘้‡ๅตŒๅ…ฅ",lpmm_entity_extract:"ๅฎžไฝ“ๆๅ–",lpmm_rdf_build:"RDFๆž„ๅปบ",lpmm_qa:"้—ฎ็ญ”ๆจกๅž‹"},N4=["ๅฎ˜ๆ–นๆŽจ่","ๆ€งไปทๆฏ”","้ซ˜ๆ€ง่ƒฝ","ๅ…่ดนๆจกๅž‹","ๅ›ฝๅ†…ๅฏ็”จ","ๆตทๅค–ๆจกๅž‹","OpenAI","Claude","Gemini","ๅ›ฝไบงๆจกๅž‹","ๅคšๆจกๆ€","่ฝป้‡็บง"];function b4({trigger:a}){const[l,r]=u.useState(!1),[c,d]=u.useState(1),[m,h]=u.useState(!1),[f,p]=u.useState(!1),[g,N]=u.useState([]),[j,b]=u.useState([]),[y,w]=u.useState({}),[z,M]=u.useState(new Set),[S,F]=u.useState(new Set),[E,C]=u.useState(new Set),[R,H]=u.useState(""),[O,X]=u.useState(""),[L,me]=u.useState(""),[Ne,je]=u.useState([]);u.useEffect(()=>{l&&c===1&&re()},[l,c]);const re=async()=>{h(!0);try{const G=await j4({name:"",description:"",author:""});N(G.providers),b(G.models),w(G.task_config),M(new Set(G.providers.map($=>$.name))),F(new Set(G.models.map($=>$.name))),C(new Set(Object.keys(G.task_config)))}catch(G){console.error("ๅŠ ่ฝฝ้…็ฝฎๅคฑ่ดฅ:",G),aa({title:"ๅŠ ่ฝฝๅฝ“ๅ‰้…็ฝฎๅคฑ่ดฅ",variant:"destructive"})}finally{h(!1)}},ge=G=>{const $=new Set(z),A=new Set(S),K=new Set(E);$.has(G)?($.delete(G),j.filter(se=>se.api_provider===G).forEach(se=>A.delete(se.name)),Object.entries(y).forEach(([se,$e])=>{$e.model_list&&($e.model_list.some(J=>A.has(J))||K.delete(se))})):($.add(G),j.filter(se=>se.api_provider===G).forEach(se=>A.add(se.name)),Object.entries(y).forEach(([se,$e])=>{$e.model_list&&$e.model_list.some(J=>{const Z=j.find(Le=>Le.name===J);return Z&&Z.api_provider===G})&&K.add(se)})),M($),F(A),C(K)},pe=G=>{const $=new Set(S),A=new Set(E);$.has(G)?($.delete(G),Object.entries(y).forEach(([K,Re])=>{Re.model_list&&(Re.model_list.some($e=>$.has($e))||A.delete(K))})):($.add(G),Object.entries(y).forEach(([K,Re])=>{Re.model_list&&Re.model_list.includes(G)&&A.add(K)})),F($),C(A)},D=G=>{const $=new Set(E);$.has(G)?$.delete(G):$.add(G),C($)},Q=G=>{Ne.includes(G)?je(Ne.filter($=>$!==G)):Ne.length<5?je([...Ne,G]):aa({title:"ๆœ€ๅคš้€‰ๆ‹ฉ 5 ไธชๆ ‡็ญพ",variant:"destructive"})},I=()=>{z.size===g.length?M(new Set):M(new Set(g.map(G=>G.name)))},ue=()=>{S.size===j.length?F(new Set):F(new Set(j.map(G=>G.name)))},Y=()=>{const G=Object.keys(y);E.size===G.length?C(new Set):C(new Set(G))},we=async()=>{if(!R.trim()){aa({title:"่ฏท่พ“ๅ…ฅๆจกๆฟๅ็งฐ",variant:"destructive"});return}if(!O.trim()){aa({title:"่ฏท่พ“ๅ…ฅๆจกๆฟๆ่ฟฐ",variant:"destructive"});return}if(!L.trim()){aa({title:"่ฏท่พ“ๅ…ฅไฝœ่€…ๅ็งฐ",variant:"destructive"});return}if(z.size===0&&S.size===0&&E.size===0){aa({title:"่ฏท่‡ณๅฐ‘้€‰ๆ‹ฉไธ€้กน้…็ฝฎ",variant:"destructive"});return}p(!0);try{const G=g.filter(K=>z.has(K.name)),$=j.filter(K=>S.has(K.name)),A={};for(const[K,Re]of Object.entries(y))E.has(K)&&(A[K]=Re);await h4({name:R.trim(),description:O.trim(),author:L.trim(),tags:Ne,providers:G,models:$,task_config:A}),aa({title:"ๆจกๆฟๅทฒๆไบคๅฎกๆ ธ๏ผŒๅฎกๆ ธ้€š่ฟ‡ๅŽๅฐ†ๆ˜พ็คบๅœจๅธ‚ๅœบไธญ"}),r(!1),fe()}catch(G){console.error("ๆไบคๅคฑ่ดฅ:",G),aa({title:G instanceof Error?G.message:"ๆไบคๅคฑ่ดฅ",variant:"destructive"})}finally{p(!1)}},fe=()=>{d(1),H(""),X(""),me(""),je([]),M(new Set),F(new Set),C(new Set)},Ee=2;return e.jsxs(Qs,{open:l,onOpenChange:r,children:[e.jsx(dd,{asChild:!0,children:a||e.jsxs(_,{variant:"outline",children:[e.jsx(mv,{className:"w-4 h-4 mr-2"}),"ๅˆ†ไบซ้…็ฝฎ"]})}),e.jsxs(Hs,{className:"max-w-2xl max-h-[85vh] flex flex-col",children:[e.jsxs(qs,{children:[e.jsxs(Vs,{className:"flex items-center gap-2",children:[e.jsx(xa,{className:"w-5 h-5"}),"ๅˆ†ไบซ้…็ฝฎๆจกๆฟ"]}),e.jsxs(at,{children:["ๆญฅ้ชค ",c," / ",Ee,"๏ผš",c===1&&"้€‰ๆ‹ฉ่ฆๅˆ†ไบซ็š„้…็ฝฎ",c===2&&"ๅกซๅ†™ๆจกๆฟไฟกๆฏ"]})]}),e.jsx(ts,{className:"h-[calc(85vh-220px)] pr-4",children:m?e.jsxs("div",{className:"py-8 text-center",children:[e.jsx(Fs,{className:"w-8 h-8 mx-auto animate-spin text-primary"}),e.jsx("p",{className:"mt-4 text-muted-foreground",children:"ๆญฃๅœจๅŠ ่ฝฝๅฝ“ๅ‰้…็ฝฎ..."})]}):e.jsxs(e.Fragment,{children:[c===1&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(ht,{children:[e.jsx(Yt,{className:"h-4 w-4"}),e.jsx(Jn,{children:"ๅฎ‰ๅ…จๆ็คบ"}),e.jsxs(ft,{children:["ๅˆ†ไบซ็š„้…็ฝฎๅฐ†",e.jsx("strong",{children:"ไธๅŒ…ๅซ"})," API Key๏ผŒๅ…ถไป–็”จๆˆท้œ€่ฆ่‡ช่กŒ้…็ฝฎใ€‚"]})]}),e.jsxs(Jt,{defaultValue:"providers",className:"w-full",children:[e.jsxs(Gt,{className:"grid w-full grid-cols-3",children:[e.jsxs(Xe,{value:"providers",children:[e.jsx(Hl,{className:"w-4 h-4 mr-2"}),"API ๆไพ›ๅ•†",e.jsxs(Ce,{variant:"secondary",className:"ml-2",children:[z.size,"/",g.length]})]}),e.jsxs(Xe,{value:"models",children:[e.jsx(Wn,{className:"w-4 h-4 mr-2"}),"ๆจกๅž‹้…็ฝฎ",e.jsxs(Ce,{variant:"secondary",className:"ml-2",children:[S.size,"/",j.length]})]}),e.jsxs(Xe,{value:"tasks",children:[e.jsx(er,{className:"w-4 h-4 mr-2"}),"ไปปๅŠก้…็ฝฎ",e.jsxs(Ce,{variant:"secondary",className:"ml-2",children:[E.size,"/",Object.keys(y).length]})]})]}),e.jsx(Ss,{value:"providers",className:"space-y-2 mt-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex justify-end",children:e.jsx(_,{variant:"ghost",size:"sm",onClick:I,children:z.size===g.length?"ๅ–ๆถˆๅ…จ้€‰":"ๅ…จ้€‰"})}),g.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-2",children:"ๆš‚ๆ— ๆไพ›ๅ•†้…็ฝฎ"}):g.map(G=>e.jsxs("div",{className:"flex items-center space-x-2 p-2 rounded hover:bg-muted",children:[e.jsx(tt,{id:`provider-${G.name}`,checked:z.has(G.name),onCheckedChange:()=>ge(G.name)}),e.jsxs(T,{htmlFor:`provider-${G.name}`,className:"flex-1 cursor-pointer",children:[e.jsx("span",{className:"font-medium",children:G.name}),e.jsx("span",{className:"text-xs text-muted-foreground ml-2",children:G.base_url})]}),e.jsx(Ce,{variant:"outline",className:"text-xs",children:G.client_type})]},G.name))]})}),e.jsx(Ss,{value:"models",className:"space-y-2 mt-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex justify-end",children:e.jsx(_,{variant:"ghost",size:"sm",onClick:ue,children:S.size===j.length?"ๅ–ๆถˆๅ…จ้€‰":"ๅ…จ้€‰"})}),j.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-2",children:"ๆš‚ๆ— ๆจกๅž‹้…็ฝฎ"}):j.map(G=>e.jsxs("div",{className:"flex items-center space-x-2 p-2 rounded hover:bg-muted",children:[e.jsx(tt,{id:`model-${G.name}`,checked:S.has(G.name),onCheckedChange:()=>pe(G.name)}),e.jsxs(T,{htmlFor:`model-${G.name}`,className:"flex-1 cursor-pointer",children:[e.jsx("span",{className:"font-medium",children:G.name}),e.jsx("span",{className:"text-xs text-muted-foreground ml-2",children:G.model_identifier})]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:G.api_provider})]},G.name))]})}),e.jsx(Ss,{value:"tasks",className:"space-y-2 mt-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex justify-end",children:e.jsx(_,{variant:"ghost",size:"sm",onClick:Y,children:E.size===Object.keys(y).length?"ๅ–ๆถˆๅ…จ้€‰":"ๅ…จ้€‰"})}),Object.keys(y).length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-2",children:"ๆš‚ๆ— ไปปๅŠก้…็ฝฎ"}):Object.entries(y).map(([G,$])=>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(tt,{id:`task-${G}`,checked:E.has(G),onCheckedChange:()=>D(G)}),e.jsx(T,{htmlFor:`task-${G}`,className:"flex-1 cursor-pointer",children:e.jsx("span",{className:"font-medium",children:v4[G]||G})}),e.jsxs(Ce,{variant:"outline",className:"text-xs",children:[$.model_list.length," ไธชๆจกๅž‹"]})]}),$.model_list&&$.model_list.length>0&&e.jsx("div",{className:"ml-6 flex flex-wrap gap-1",children:$.model_list.map(A=>{const K=j.find(se=>se.name===A),Re=S.has(A);return e.jsxs(Ce,{variant:Re?"default":"outline",className:"text-xs cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>pe(A),children:[A,K&&e.jsxs("span",{className:"ml-1 opacity-70",children:["(",K.api_provider,")"]})]},A)})})]},G))]})})]})]}),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(Hl,{className:"w-4 h-4"}),z.size," ไธชๆไพ›ๅ•†"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Wn,{className:"w-4 h-4"}),S.size," ไธชๆจกๅž‹"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(er,{className:"w-4 h-4"}),E.size," ไธชไปปๅŠก"]})]}),e.jsx(la,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"pack-name",children:"ๆจกๆฟๅ็งฐ *"}),e.jsx(ae,{id:"pack-name",placeholder:"ไพ‹ๅฆ‚๏ผš้ซ˜ๆ€งไปทๆฏ”ๅ›ฝไบงๆจกๅž‹้…็ฝฎ",value:R,onChange:G=>H(G.target.value),maxLength:50}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[R.length,"/50"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"pack-description",children:"ๆจกๆฟๆ่ฟฐ *"}),e.jsx(pt,{id:"pack-description",placeholder:"่ฏฆ็ป†ๆ่ฟฐ่ฟ™ไธช้…็ฝฎๆจกๆฟ็š„็‰น็‚นใ€้€‚็”จๅœบๆ™ฏ็ญ‰...",value:O,onChange:G=>X(G.target.value),rows:4,maxLength:500}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[O.length,"/500"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"pack-author",children:"ไฝœ่€…ๅ็งฐ *"}),e.jsx(ae,{id:"pack-author",placeholder:"ไฝ ็š„ๆ˜ต็งฐๆˆ– ID",value:L,onChange:G=>me(G.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:N4.map(G=>e.jsxs(Ce,{variant:Ne.includes(G)?"default":"outline",className:"cursor-pointer transition-colors",onClick:()=>Q(G),children:[Ne.includes(G)&&e.jsx(Ot,{className:"w-3 h-3 mr-1"}),e.jsx(cd,{className:"w-3 h-3 mr-1"}),G]},G))})]})]}),e.jsxs(ht,{children:[e.jsx(Yt,{className:"h-4 w-4"}),e.jsx(Jn,{children:"ๅฎกๆ ธ่ฏดๆ˜Ž"}),e.jsx(ft,{children:"ๆไบคๅŽ้œ€่ฆ็ป่ฟ‡ๅฎกๆ ธๆ‰่ƒฝๅœจๅธ‚ๅœบไธญๅฑ•็คบใ€‚ๅฎกๆ ธ้€šๅธธๅœจ 1-3 ไธชๅทฅไฝœๆ—ฅๅ†…ๅฎŒๆˆใ€‚"})]})]})]})}),e.jsxs(gt,{className:"flex justify-between pt-4 border-t",children:[e.jsx("div",{children:c>1&&e.jsx(_,{variant:"outline",onClick:()=>d(c-1),disabled:f,children:"ไธŠไธ€ๆญฅ"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(_,{variant:"outline",onClick:()=>{r(!1),fe()},disabled:f,children:"ๅ–ๆถˆ"}),cd(c+1),disabled:m||z.size===0&&S.size===0&&E.size===0,children:"ไธ‹ไธ€ๆญฅ"}):e.jsxs(_,{onClick:we,disabled:f,children:[f&&e.jsx(Fs,{className:"w-4 h-4 mr-2 animate-spin"}),"ๆไบคๅฎกๆ ธ"]})]})]})]})]})}function y4({value:a,label:l,onRemove:r}){const{attributes:c,listeners:d,setNodeRef:m,transform:h,transition:f,isDragging:p}=Cv({id:a}),g={transform:Tv.Transform.toString(h),transition:f,opacity:p?.5:1},N=b=>{b.preventDefault(),b.stopPropagation(),r(a)},j=b=>{b.stopPropagation()};return e.jsx("div",{ref:m,style:g,className:P("inline-flex items-center gap-1",p&&"shadow-lg"),children:e.jsxs(Ce,{variant:"secondary",className:"cursor-move hover:bg-secondary/80 flex items-center gap-1",children:[e.jsx("div",{...c,...d,className:"cursor-grab active:cursor-grabbing flex items-center",children:e.jsx(dv,{className:"h-3 w-3 text-muted-foreground"})}),e.jsx("span",{children:l}),e.jsx("span",{role:"button",tabIndex:0,className:"ml-1 rounded-sm hover:bg-destructive/20 focus:outline-none focus:ring-1 focus:ring-destructive cursor-pointer",onClick:N,onPointerDown:j,onMouseDown:b=>b.stopPropagation(),onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),N(b))},children:e.jsx(Sa,{className:"h-3 w-3 hover:text-destructive",strokeWidth:2,fill:"none"})})]})})}function w4({options:a,selected:l,onChange:r,placeholder:c="้€‰ๆ‹ฉ้€‰้กน...",emptyText:d="ๆœชๆ‰พๅˆฐ้€‰้กน",className:m}){const[h,f]=u.useState(!1),p=vv(Qo(yv,{activationConstraint:{distance:8}}),Qo(bv,{coordinateGetter:Nv})),g=b=>{l.includes(b)?r(l.filter(y=>y!==b)):r([...l,b])},N=b=>{r(l.filter(y=>y!==b))},j=b=>{const{active:y,over:w}=b;if(w&&y.id!==w.id){const z=l.indexOf(y.id),M=l.indexOf(w.id);r(wv(l,z,M))}};return e.jsxs(cl,{open:h,onOpenChange:f,children:[e.jsx(ol,{asChild:!0,children:e.jsxs(_,{variant:"outline",role:"combobox","aria-expanded":h,className:P("w-full justify-between min-h-10 h-auto",m),children:[e.jsx(_v,{sensors:p,collisionDetection:Sv,onDragEnd:j,children:e.jsx(kv,{items:l,strategy:p1,children:e.jsx("div",{className:"flex gap-1 flex-wrap flex-1",children:l.length===0?e.jsx("span",{className:"text-muted-foreground",children:c}):l.map(b=>{const y=a.find(w=>w.value===b);return e.jsx(y4,{value:b,label:y?.label||b,onRemove:N},b)})})})}),e.jsx(mx,{className:"ml-2 h-4 w-4 shrink-0 opacity-50",strokeWidth:2,fill:"none"})]})}),e.jsx(tl,{className:"w-full p-0",align:"start",children:e.jsxs(md,{children:[e.jsx(xd,{placeholder:"ๆœ็ดข...",className:"h-9"}),e.jsxs(hd,{children:[e.jsx(fd,{children:d}),e.jsx(uc,{children:a.map(b=>{const y=l.includes(b.value);return e.jsxs(mc,{value:b.value,onSelect:()=>g(b.value),children:[e.jsx("div",{className:P("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",y?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(Ot,{className:"h-3 w-3",strokeWidth:2,fill:"none"})}),e.jsx("span",{children:b.label})]},b.value)})})]})]})})]})}const Ul=Is.memo(function({title:l,description:r,taskConfig:c,modelNames:d,onChange:m,hideTemperature:h=!1,hideMaxTokens:f=!1,dataTour:p}){const g=N=>{m("model_list",N)};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-base sm:text-lg",children:l}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:r})]}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2","data-tour":p,children:[e.jsx(T,{children:"ๆจกๅž‹ๅˆ—่กจ"}),e.jsx(w4,{options:d.map(N=>({label:N,value:N})),selected:c.model_list||[],onChange:g,placeholder:"้€‰ๆ‹ฉๆจกๅž‹...",emptyText:"ๆš‚ๆ— ๅฏ็”จๆจกๅž‹"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[!h&&e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"ๆธฉๅบฆ"}),e.jsx(ae,{type:"number",step:"0.1",min:"0",max:"1",value:c.temperature??.3,onChange:N=>{const j=parseFloat(N.target.value);!isNaN(j)&&j>=0&&j<=1&&m("temperature",j)},className:"w-20 h-8 text-sm"})]}),e.jsx(el,{value:[c.temperature??.3],onValueChange:N=>m("temperature",N[0]),min:0,max:1,step:.1,className:"w-full"})]}),!f&&e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"ๆœ€ๅคง Token"}),e.jsx(ae,{type:"number",step:"1",min:"1",value:c.max_tokens??1024,onChange:N=>m("max_tokens",parseInt(N.target.value))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:"ๆ…ข่ฏทๆฑ‚้˜ˆๅ€ผ (็ง’)"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"่ถ…ๆ—ถ่ญฆๅ‘Š"})]}),e.jsx(ae,{type:"number",step:"1",min:"1",value:c.slow_threshold??15,onChange:N=>{const j=parseInt(N.target.value);!isNaN(j)&&j>=1&&m("slow_threshold",j)},placeholder:"15"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆจกๅž‹ๅ“ๅบ”ๆ—ถ้—ด่ถ…่ฟ‡ๆญค้˜ˆๅ€ผๅฐ†่พ“ๅ‡บ่ญฆๅ‘Šๆ—ฅๅฟ—"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{children:"ๆจกๅž‹้€‰ๆ‹ฉ็ญ–็•ฅ"}),e.jsxs(Pe,{value:c.selection_strategy??"balance",onValueChange:N=>m("selection_strategy",N),children:[e.jsx(Ie,{children:e.jsx(Fe,{placeholder:"้€‰ๆ‹ฉๆจกๅž‹้€‰ๆ‹ฉ็ญ–็•ฅ"})}),e.jsxs(Be,{children:[e.jsx(W,{value:"balance",children:"่ดŸ่ฝฝๅ‡่กก๏ผˆbalance๏ผ‰"}),e.jsx(W,{value:"random",children:"้šๆœบ้€‰ๆ‹ฉ๏ผˆrandom๏ผ‰"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"่ดŸ่ฝฝๅ‡่กก๏ผšไผ˜ๅ…ˆ้€‰ๆ‹ฉไฝฟ็”จๆฌกๆ•ฐๅฐ‘็š„ๆจกๅž‹ใ€‚้šๆœบ้€‰ๆ‹ฉ๏ผšๅฎŒๅ…จ้šๆœบไปŽๆจกๅž‹ๅˆ—่กจไธญ้€‰ๆ‹ฉ"})]})]})]})}),_4=Is.memo(function({paginatedModels:l,allModels:r,onEdit:c,onDelete:d,isModelUsed:m,searchQuery:h}){return l.length===0?e.jsx("div",{className:"md:hidden text-center text-muted-foreground py-8 rounded-lg border bg-card",children:h?"ๆœชๆ‰พๅˆฐๅŒน้…็š„ๆจกๅž‹":"ๆš‚ๆ— ๆจกๅž‹้…็ฝฎ"}):e.jsx("div",{className:"md:hidden space-y-3",children:l.map((f,p)=>{const g=r.findIndex(j=>j===f),N=m(f.name);return e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("h3",{className:"font-semibold text-base",children:f.name}),e.jsx(Ce,{variant:N?"default":"secondary",className:N?"bg-green-600 hover:bg-green-700":"",children:N?"ๅทฒไฝฟ็”จ":"ๆœชไฝฟ็”จ"})]}),e.jsx("p",{className:"text-xs text-muted-foreground break-all",title:f.model_identifier,children:f.model_identifier})]}),e.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>c(f,g),children:[e.jsx(Zn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"็ผ–่พ‘"]}),e.jsxs(_,{size:"sm",onClick:()=>d(g),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(os,{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)})})}),S4=Is.memo(function({paginatedModels:l,allModels:r,filteredModels:c,selectedModels:d,onEdit:m,onDelete:h,onToggleSelection:f,onToggleSelectAll:p,isModelUsed:g,searchQuery:N}){return e.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(ql,{children:[e.jsx(Vl,{children:e.jsxs(_t,{children:[e.jsx(ns,{className:"w-12",children:e.jsx(tt,{checked:d.size===c.length&&c.length>0,onCheckedChange:p})}),e.jsx(ns,{className:"w-24",children:"ไฝฟ็”จ็Šถๆ€"}),e.jsx(ns,{children:"ๆจกๅž‹ๅ็งฐ"}),e.jsx(ns,{children:"ๆจกๅž‹ๆ ‡่ฏ†็ฌฆ"}),e.jsx(ns,{children:"ๆไพ›ๅ•†"}),e.jsx(ns,{className:"text-center",children:"ๆธฉๅบฆ"}),e.jsx(ns,{className:"text-right",children:"่พ“ๅ…ฅไปทๆ ผ"}),e.jsx(ns,{className:"text-right",children:"่พ“ๅ‡บไปทๆ ผ"}),e.jsx(ns,{className:"text-right",children:"ๆ“ไฝœ"})]})}),e.jsx(Gl,{children:l.length===0?e.jsx(_t,{children:e.jsx(Ze,{colSpan:9,className:"text-center text-muted-foreground py-8",children:N?"ๆœชๆ‰พๅˆฐๅŒน้…็š„ๆจกๅž‹":"ๆš‚ๆ— ๆจกๅž‹้…็ฝฎ"})}):l.map((j,b)=>{const y=r.findIndex(z=>z===j),w=g(j.name);return e.jsxs(_t,{children:[e.jsx(Ze,{children:e.jsx(tt,{checked:d.has(y),onCheckedChange:()=>f(y)})}),e.jsx(Ze,{children:e.jsx(Ce,{variant:w?"default":"secondary",className:w?"bg-green-600 hover:bg-green-700":"",children:w?"ๅทฒไฝฟ็”จ":"ๆœชไฝฟ็”จ"})}),e.jsx(Ze,{className:"font-medium",children:j.name}),e.jsx(Ze,{className:"max-w-xs truncate",title:j.model_identifier,children:j.model_identifier}),e.jsx(Ze,{children:j.api_provider}),e.jsx(Ze,{className:"text-center",children:j.temperature!=null?j.temperature:e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsxs(Ze,{className:"text-right",children:["ยฅ",j.price_in,"/M"]}),e.jsxs(Ze,{className:"text-right",children:["ยฅ",j.price_out,"/M"]}),e.jsx(Ze,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>m(j,y),children:[e.jsx(Zn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"็ผ–่พ‘"]}),e.jsxs(_,{size:"sm",onClick:()=>h(y),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(os,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"ๅˆ ้™ค"]})]})})]},b)})})]})})})}),k4=300*1e3,Zg=new Map,C4=[10,20,50,100],T4=Is.memo(function({page:l,pageSize:r,totalItems:c,jumpToPage:d,onPageChange:m,onPageSizeChange:h,onJumpToPageChange:f,onJumpToPage:p,onSelectionClear:g}){const N=Math.ceil(c/r),j=y=>{h(parseInt(y)),m(1),g?.()},b=y=>{y.key==="Enter"&&p()};return c===0?null:e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{htmlFor:"page-size-model",className:"text-sm whitespace-nowrap",children:"ๆฏ้กตๆ˜พ็คบ"}),e.jsxs(Pe,{value:r.toString(),onValueChange:j,children:[e.jsx(Ie,{id:"page-size-model",className:"w-20",children:e.jsx(Fe,{})}),e.jsx(Be,{children:C4.map(y=>e.jsx(W,{value:y.toString(),children:y},y))})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["ๆ˜พ็คบ ",(l-1)*r+1," ๅˆฐ"," ",Math.min(l*r,c)," ๆก๏ผŒๅ…ฑ ",c," ๆก"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>m(1),disabled:l===1,className:"hidden sm:flex",children:e.jsx(kn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>m(Math.max(1,l-1)),disabled:l===1,children:[e.jsx(Pa,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"ไธŠไธ€้กต"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae,{type:"number",value:d,onChange:y=>f(y.target.value),onKeyDown:b,placeholder:l.toString(),className:"w-16 h-8 text-center",min:1,max:N}),e.jsx(_,{variant:"outline",size:"sm",onClick:p,disabled:!d,className:"h-8",children:"่ทณ่ฝฌ"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>m(l+1),disabled:l>=N,children:[e.jsx("span",{className:"hidden sm:inline",children:"ไธ‹ไธ€้กต"}),e.jsx(ra,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>m(N),disabled:l>=N,className:"hidden sm:flex",children:e.jsx(Cn,{className:"h-4 w-4"})})]})]})});function E4(a){const{models:l,taskConfig:r,debounceMs:c=2e3,onSavingChange:d,onUnsavedChange:m}=a,h=u.useRef(null),f=u.useRef(null),p=u.useRef(!0),g=u.useCallback(()=>{h.current&&(clearTimeout(h.current),h.current=null),f.current&&(clearTimeout(f.current),f.current=null)},[]),N=u.useCallback(y=>{const w={model_identifier:y.model_identifier,name:y.name,api_provider:y.api_provider,price_in:y.price_in??0,price_out:y.price_out??0,force_stream_mode:y.force_stream_mode??!1,extra_params:y.extra_params??{}};return y.temperature!=null&&(w.temperature=y.temperature),y.max_tokens!=null&&(w.max_tokens=y.max_tokens),w},[]),j=u.useCallback(async y=>{try{d?.(!0);const w=y.map(N);await Wm("models",w),m?.(!1)}catch(w){console.error("่‡ชๅŠจไฟๅญ˜ๆจกๅž‹ๅˆ—่กจๅคฑ่ดฅ:",w),m?.(!0)}finally{d?.(!1)}},[d,m,N]),b=u.useCallback(async y=>{try{d?.(!0),await Wm("model_task_config",y),m?.(!1)}catch(w){console.error("่‡ชๅŠจไฟๅญ˜ไปปๅŠก้…็ฝฎๅคฑ่ดฅ:",w),m?.(!0)}finally{d?.(!1)}},[d,m]);return u.useEffect(()=>{if(!p.current)return m?.(!0),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{j(l)},c),()=>{h.current&&clearTimeout(h.current)}},[l,j,c,m]),u.useEffect(()=>{if(!(p.current||!r))return m?.(!0),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{b(r)},c),()=>{f.current&&clearTimeout(f.current)}},[r,b,c,m]),u.useEffect(()=>()=>{g()},[g]),{clearTimers:g,initialLoadRef:p}}function M4(a={}){const{onCloseEditDialog:l}=a,r=ha(),{registerTour:c,startTour:d,state:m,goToStep:h}=Ex(),f=u.useRef(m.stepIndex);return u.useEffect(()=>{c(gl,aN)},[c]),u.useEffect(()=>{if(m.activeTourId===gl&&m.isRunning){const g=lN[m.stepIndex];g&&!window.location.pathname.endsWith(g.replace("/config/",""))&&r({to:g})}},[m.stepIndex,m.activeTourId,m.isRunning,r]),u.useEffect(()=>{if(m.activeTourId===gl&&m.isRunning){const g=f.current,N=m.stepIndex;g>=12&&g<=17&&N<12&&l?.(),f.current=N}},[m.stepIndex,m.activeTourId,m.isRunning,l]),u.useEffect(()=>{if(m.activeTourId!==gl||!m.isRunning)return;const g=N=>{const j=N.target,b=m.stepIndex;b===2&&j.closest('[data-tour="add-provider-button"]')?setTimeout(()=>h(3),300):b===9&&j.closest('[data-tour="provider-cancel-button"]')?setTimeout(()=>h(10),300):b===11&&j.closest('[data-tour="add-model-button"]')?setTimeout(()=>h(12),300):b===17&&j.closest('[data-tour="model-cancel-button"]')?setTimeout(()=>h(18),300):b===18&&j.closest('[data-tour="tasks-tab-trigger"]')&&setTimeout(()=>h(19),300)};return document.addEventListener("click",g,!0),()=>document.removeEventListener("click",g,!0)},[m,h]),{startTour:u.useCallback(()=>{d(gl)},[d]),isRunning:m.isRunning&&m.activeTourId===gl,stepIndex:m.stepIndex}}function A4(a){const{getProviderConfig:l}=a,[r,c]=u.useState([]),[d,m]=u.useState(!1),[h,f]=u.useState(null),[p,g]=u.useState(null),N=u.useCallback(()=>{c([]),f(null),g(null)},[]),j=u.useCallback(async(b,y=!1)=>{const w=l(b);if(!w?.base_url){c([]),g(null),f('ๆไพ›ๅ•†้…็ฝฎไธๅฎŒๆ•ด๏ผŒ่ฏทๅ…ˆๅœจ"ๆจกๅž‹ๆไพ›ๅ•†้…็ฝฎ"ไธญ้…็ฝฎ');return}if(!w.api_key){c([]),g(null),f('่ฏฅๆไพ›ๅ•†ๆœช้…็ฝฎ API Key๏ผŒ่ฏทๅ…ˆๅœจ"ๆจกๅž‹ๆไพ›ๅ•†้…็ฝฎ"ไธญๅกซๅ†™');return}const z=n4(w.base_url);if(g(z),!z?.modelFetcher){c([]),f(null);return}const M=`${b}:${w.base_url}`,S=Zg.get(M);if(!y&&S&&Date.now()-S.timestampE(!1)}),{clearTimers:V,initialLoadRef:Ke}=E4({models:a,taskConfig:p,onSavingChange:z,onUnsavedChange:S}),He=u.useCallback((le,oe)=>{if(!le)return;const Ve=new Set(oe.map(Ca=>Ca.name)),Ys=[],Ps=[],vt=[{key:"utils",label:"ๅทฅๅ…ทๆจกๅž‹"},{key:"tool_use",label:"ๅทฅๅ…ท่ฐƒ็”จๆจกๅž‹"},{key:"replyer",label:"ๅ›žๅคๆจกๅž‹"},{key:"planner",label:"่ง„ๅˆ’ๅ™จๆจกๅž‹"},{key:"vlm",label:"่ง†่ง‰ๆจกๅž‹"},{key:"voice",label:"่ฏญ้Ÿณๆจกๅž‹"},{key:"embedding",label:"ๅตŒๅ…ฅๆจกๅž‹"},{key:"lpmm_entity_extract",label:"LPMMๅฎžไฝ“ๆŠฝๅ–"},{key:"lpmm_rdf_build",label:"LPMMๅ…ณ็ณปๆž„ๅปบ"}];for(const{key:Ca,label:ll}of vt){const ml=le[Ca];if(!ml)continue;if(!ml.model_list||ml.model_list.length===0){Ps.push(ll);continue}const rr=ml.model_list.filter(Ql=>!Ve.has(Ql));rr.length>0&&Ys.push({taskName:ll,invalidModels:rr})}ne(Ys),xe(Ps)},[]),Je=u.useCallback(async()=>{try{j(!0);const le=await Nn(),oe=le.models||[];l(oe),f(oe.map(vt=>vt.name));const Ve=le.api_providers||[];c(Ve.map(vt=>vt.name)),m(Ve);const Ys=le.model_task_config||null;g(Ys),He(Ys,oe);const Ps=Ys?.embedding?.model_list||[];J.current=[...Ps],S(!1),Ke.current=!1}catch(le){console.error("ๅŠ ่ฝฝ้…็ฝฎๅคฑ่ดฅ:",le)}finally{j(!1)}},[Ke,He]);u.useEffect(()=>{Je()},[Je]);const Es=u.useCallback(le=>d.find(oe=>oe.name===le),[d]),{availableModels:ms,fetchingModels:Ms,modelFetchError:We,matchedTemplate:Cs,fetchModelsForProvider:rs,clearModels:is}=A4({getProviderConfig:Es});u.useEffect(()=>{F&&C?.api_provider&&rs(C.api_provider)},[F,C?.api_provider,rs]);const ys=async()=>{await Ct()},rt=u.useCallback(()=>{if(!p)return;const le=new Set(a.map(Ys=>Ys.name)),oe={...p},Ve=Object.keys(oe);for(const Ys of Ve){const Ps=oe[Ys];Ps&&Ps.model_list&&(Ps.model_list=Ps.model_list.filter(vt=>le.has(vt)))}g(oe),ne([]),Ts({title:"ๆธ…็†ๅฎŒๆˆ",description:"ๅทฒๅˆ ้™คๆ‰€ๆœ‰ๆ— ๆ•ˆ็š„ๆจกๅž‹ๅผ•็”จ"})},[p,a,Ts]),jt=le=>{const oe={model_identifier:le.model_identifier,name:le.name,api_provider:le.api_provider,price_in:le.price_in??0,price_out:le.price_out??0,force_stream_mode:le.force_stream_mode??!1,extra_params:le.extra_params??{}};return le.temperature!=null&&(oe.temperature=le.temperature),le.max_tokens!=null&&(oe.max_tokens=le.max_tokens),oe},Ae=async()=>{try{y(!0),V();const le=await Nn();le.models=a.map(jt),le.model_task_config=p,await lc(le),S(!1),Ts({title:"ไฟๅญ˜ๆˆๅŠŸ",description:"ๆญฃๅœจ้‡ๅฏ้บฆ้บฆ..."}),await ys()}catch(le){console.error("ไฟๅญ˜้…็ฝฎๅคฑ่ดฅ:",le),Ts({title:"ไฟๅญ˜ๅคฑ่ดฅ",description:le.message,variant:"destructive"}),y(!1)}},Qe=async()=>{try{y(!0),V();const le=await Nn();le.models=a.map(jt),le.model_task_config=p,await lc(le),S(!1),Ts({title:"ไฟๅญ˜ๆˆๅŠŸ",description:"ๆจกๅž‹้…็ฝฎๅทฒไฟๅญ˜"}),await Je()}catch(le){console.error("ไฟๅญ˜้…็ฝฎๅคฑ่ดฅ:",le),Ts({title:"ไฟๅญ˜ๅคฑ่ดฅ",description:le.message,variant:"destructive"})}finally{y(!1)}},As=(le,oe)=>{ds({}),R(le||{model_identifier:"",name:"",api_provider:r[0]||"",price_in:0,price_out:0,temperature:null,max_tokens:null,force_stream_mode:!1,extra_params:{}}),O(oe),E(!0)},mt=()=>{if(!C)return;const le={};if(C.name?.trim()?a.some((vt,Ca)=>H!==null&&Ca===H?!1:vt.name.trim().toLowerCase()===C.name.trim().toLowerCase())&&(le.name="ๆจกๅž‹ๅ็งฐๅทฒๅญ˜ๅœจ๏ผŒ่ฏทไฝฟ็”จๅ…ถไป–ๅ็งฐ"):le.name="่ฏท่พ“ๅ…ฅๆจกๅž‹ๅ็งฐ",C.api_provider?.trim()||(le.api_provider="่ฏท้€‰ๆ‹ฉ API ๆไพ›ๅ•†"),C.model_identifier?.trim()||(le.model_identifier="่ฏท่พ“ๅ…ฅๆจกๅž‹ๆ ‡่ฏ†็ฌฆ"),Object.keys(le).length>0){ds(le);return}ds({});const oe={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&&(oe.temperature=C.temperature),C.max_tokens!=null&&(oe.max_tokens=C.max_tokens);let Ve,Ys=null;if(H!==null?(Ys=a[H].name,Ve=[...a],Ve[H]=oe):Ve=[...a,oe],l(Ve),f(Ve.map(Ps=>Ps.name)),Ys&&Ys!==oe.name&&p){const Ps=vt=>vt.map(Ca=>Ca===Ys?oe.name:Ca);g({...p,utils:{...p.utils,model_list:Ps(p.utils?.model_list||[])},tool_use:{...p.tool_use,model_list:Ps(p.tool_use?.model_list||[])},replyer:{...p.replyer,model_list:Ps(p.replyer?.model_list||[])},planner:{...p.planner,model_list:Ps(p.planner?.model_list||[])},vlm:{...p.vlm,model_list:Ps(p.vlm?.model_list||[])},voice:{...p.voice,model_list:Ps(p.voice?.model_list||[])},embedding:{...p.embedding,model_list:Ps(p.embedding?.model_list||[])},lpmm_entity_extract:{...p.lpmm_entity_extract,model_list:Ps(p.lpmm_entity_extract?.model_list||[])},lpmm_rdf_build:{...p.lpmm_rdf_build,model_list:Ps(p.lpmm_rdf_build?.model_list||[])}})}E(!1),R(null),O(null),Ts({title:H!==null?"ๆจกๅž‹ๅทฒๆ›ดๆ–ฐ":"ๆจกๅž‹ๅทฒๆทปๅŠ ",description:'้…็ฝฎๅฐ†ๅœจ 2 ็ง’ๅŽ่‡ชๅŠจไฟๅญ˜๏ผŒๆˆ–็‚นๅ‡ปๅณไธŠ่ง’"ไฟๅญ˜้…็ฝฎ"ๆŒ‰้’ฎ็ซ‹ๅณไฟๅญ˜'})},Ht=le=>{if(!le&&C){const oe={...C,price_in:C.price_in??0,price_out:C.price_out??0};R(oe)}E(le)},ca=le=>{re(le),Ne(!0)},Fa=()=>{if(je!==null){const le=a.filter((oe,Ve)=>Ve!==je);l(le),f(le.map(oe=>oe.name)),He(p,le),Ts({title:"ๅˆ ้™คๆˆๅŠŸ",description:'้…็ฝฎๅฐ†ๅœจ 2 ็ง’ๅŽ่‡ชๅŠจไฟๅญ˜๏ผŒๆˆ–็‚นๅ‡ปๅณไธŠ่ง’"ไฟๅญ˜้…็ฝฎ"ๆŒ‰้’ฎ็ซ‹ๅณไฟๅญ˜'})}Ne(!1),re(null)},Xt=le=>{const oe=new Set(D);oe.has(le)?oe.delete(le):oe.add(le),Q(oe)},te=()=>{if(D.size===es.length)Q(new Set);else{const le=es.map((oe,Ve)=>a.findIndex(Ys=>Ys===es[Ve]));Q(new Set(le))}},_e=()=>{if(D.size===0){Ts({title:"ๆ็คบ",description:"่ฏทๅ…ˆ้€‰ๆ‹ฉ่ฆๅˆ ้™ค็š„ๆจกๅž‹",variant:"default"});return}ue(!0)},U=()=>{const le=D.size,oe=a.filter((Ve,Ys)=>!D.has(Ys));l(oe),f(oe.map(Ve=>Ve.name)),He(p,oe),Q(new Set),ue(!1),Ts({title:"ๆ‰น้‡ๅˆ ้™คๆˆๅŠŸ",description:`ๅทฒๅˆ ้™ค ${le} ไธชๆจกๅž‹๏ผŒ้…็ฝฎๅฐ†ๅœจ 2 ็ง’ๅŽ่‡ชๅŠจไฟๅญ˜`})},Se=(le,oe,Ve)=>{if(!p)return;if(le==="embedding"&&oe==="model_list"&&Array.isArray(Ve)){const Ps=J.current,vt=Ve;if((Ps.length!==vt.length||Ps.some(ll=>!vt.includes(ll))||vt.some(ll=>!Ps.includes(ll)))&&Ps.length>0){Z.current={field:oe,value:Ve},cs(!0);return}}const Ys={...p,[le]:{...p[le],[oe]:Ve}};g(Ys),He(Ys,a),le==="embedding"&&oe==="model_list"&&Array.isArray(Ve)&&(J.current=[...Ve])},as=()=>{if(!p||!Z.current)return;const{field:le,value:oe}=Z.current,Ve={...p,embedding:{...p.embedding,[le]:oe}};g(Ve),He(Ve,a),le==="model_list"&&Array.isArray(oe)&&(J.current=[...oe]),Z.current=null,cs(!1),Ts({title:"ๅตŒๅ…ฅๆจกๅž‹ๅทฒๆ›ดๆ–ฐ",description:"ๅปบ่ฎฎ้‡ๆ–ฐ็”Ÿๆˆ็Ÿฅ่ฏ†ๅบ“ๅ‘้‡ไปฅ็กฎไฟๆœ€ไฝณๅŒน้…็ฒพๅบฆ"})},us=()=>{Z.current=null,cs(!1)},es=a.filter(le=>{if(!ge)return!0;const oe=ge.toLowerCase();return le.name.toLowerCase().includes(oe)||le.model_identifier.toLowerCase().includes(oe)||le.api_provider.toLowerCase().includes(oe)}),Tt=Math.ceil(es.length/fe),$s=es.slice((Y-1)*fe,Y*fe),pa=()=>{const le=parseInt(G);le>=1&&le<=Tt&&(we(le),$(""))},oa=le=>p?[p.utils?.model_list||[],p.tool_use?.model_list||[],p.replyer?.model_list||[],p.planner?.model_list||[],p.vlm?.model_list||[],p.voice?.model_list||[],p.embedding?.model_list||[],p.lpmm_entity_extract?.model_list||[],p.lpmm_rdf_build?.model_list||[]].some(Ve=>Ve.includes(le)):!1;return N?e.jsx(ts,{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(ts,{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(b4,{trigger:e.jsxs(_,{variant:"outline",size:"sm",className:"flex-1 sm:flex-none",children:[e.jsx(mv,{className:"mr-2 h-4 w-4"}),"ๅˆ†ไบซ้…็ฝฎ"]})}),e.jsxs(_,{onClick:Qe,disabled:b||w||!M||ia,size:"sm",variant:"outline",className:"flex-1 sm:flex-none sm:min-w-[120px]",children:[e.jsx(gc,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),b?"ไฟๅญ˜ไธญ...":w?"่‡ชๅŠจไฟๅญ˜ไธญ...":M?"ไฟๅญ˜้…็ฝฎ":"ๅทฒไฟๅญ˜"]}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{disabled:b||w||ia,size:"sm",className:"flex-1 sm:flex-none sm:min-w-[120px]",children:[e.jsx(pc,{className:"mr-2 h-4 w-4"}),ia?"้‡ๅฏไธญ...":M?"ไฟๅญ˜ๅนถ้‡ๅฏ":"้‡ๅฏ้บฆ้บฆ"]})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎค้‡ๅฏ้บฆ้บฆ๏ผŸ"}),e.jsx(gs,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:M?"ๅฝ“ๅ‰ๆœ‰ๆœชไฟๅญ˜็š„้…็ฝฎๆ›ดๆ”นใ€‚็‚นๅ‡ป็กฎ่ฎคๅฐ†ๅ…ˆไฟๅญ˜้…็ฝฎ,็„ถๅŽ้‡ๅฏ้บฆ้บฆไฝฟๆ–ฐ้…็ฝฎ็”Ÿๆ•ˆใ€‚้‡ๅฏ่ฟ‡็จ‹ไธญ้บฆ้บฆๅฐ†ๆš‚ๆ—ถ็ฆป็บฟใ€‚":"ๅณๅฐ†้‡ๅฏ้บฆ้บฆไธป็จ‹ๅบใ€‚้‡ๅฏ่ฟ‡็จ‹ไธญ้บฆ้บฆๅฐ†ๆš‚ๆ—ถ็ฆป็บฟ,้…็ฝฎๅฐ†ๅœจ้‡ๅฏๅŽ็”Ÿๆ•ˆใ€‚"})})})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:M?Ae:ys,children:M?"ไฟๅญ˜ๅนถ้‡ๅฏ":"็กฎ่ฎค้‡ๅฏ"})]})]})]})]})]}),e.jsxs(ht,{children:[e.jsx(Yt,{className:"h-4 w-4"}),e.jsxs(ft,{children:["้…็ฝฎๆ›ดๆ–ฐๅŽ้œ€่ฆ",e.jsx("strong",{children:"้‡ๅฏ้บฆ้บฆ"}),'ๆ‰่ƒฝ็”Ÿๆ•ˆใ€‚ไฝ ๅฏไปฅ็‚นๅ‡ปๅณไธŠ่ง’็š„"ไฟๅญ˜ๅนถ้‡ๅฏ"ๆŒ‰้’ฎไธ€้”ฎๅฎŒๆˆไฟๅญ˜ๅ’Œ้‡ๅฏใ€‚']})]}),Le.length>0&&e.jsxs(ht,{variant:"destructive",children:[e.jsx(Lt,{className:"h-4 w-4"}),e.jsxs(ft,{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:Le.map(({taskName:le,invalidModels:oe})=>e.jsxs("div",{className:"text-sm",children:[e.jsx("strong",{children:le})," ๅผ•็”จไบ†ไธๅญ˜ๅœจ็š„ๆจกๅž‹: ",oe.join(", ")]},le))})]}),e.jsx(_,{variant:"outline",size:"sm",className:"shrink-0 bg-background hover:bg-accent",onClick:rt,children:"ไธ€้”ฎๆธ…็†"})]})]}),De.length>0&&e.jsxs(ht,{variant:"default",className:"border-yellow-500/50 bg-yellow-500/10",children:[e.jsx(Lt,{className:"h-4 w-4 text-yellow-600"}),e.jsxs(ft,{children:[e.jsx("strong",{className:"text-yellow-600",children:"ไปฅไธ‹ไปปๅŠกๆœช้…็ฝฎๆจกๅž‹"}),e.jsxs("div",{className:"mt-2 text-sm",children:[De.join("ใ€")," ่ฟ˜ๆœชๅˆ†้…ๆจกๅž‹๏ผŒ่ฟ™ไบ›ๅŠŸ่ƒฝๅฐ†ๆ— ๆณ•ๆญฃๅธธๅทฅไฝœใ€‚"]})]})]}),e.jsxs(ht,{className:"hidden lg:flex border-primary/30 bg-primary/5 cursor-pointer hover:bg-primary/10 transition-colors",onClick:ut,children:[e.jsx(U_,{className:"h-4 w-4 text-primary"}),e.jsxs(ft,{className:"flex items-center justify-between",children:[e.jsxs("span",{children:[e.jsx("strong",{className:"text-primary",children:"ๆ–ฐๆ‰‹ๅผ•ๅฏผ๏ผš"}),"ไธ็Ÿฅ้“ๅฆ‚ไฝ•้…็ฝฎๆจกๅž‹๏ผŸ็‚นๅ‡ป่ฟ™้‡Œๅผ€ๅง‹ๅญฆไน ๅฆ‚ไฝ•ไธบ้บฆ้บฆ็š„็ป„ไปถๅˆ†้…ๆจกๅž‹ใ€‚"]}),e.jsx(_,{variant:"outline",size:"sm",className:"ml-4 shrink-0",children:"ๅผ€ๅง‹ๅผ•ๅฏผ"})]})]}),e.jsxs(Jt,{defaultValue:"models",className:"w-full",children:[e.jsxs(Gt,{className:"grid w-full max-w-full sm:max-w-md grid-cols-2",children:[e.jsx(Xe,{value:"models",children:"ๆทปๅŠ ๆจกๅž‹"}),e.jsx(Xe,{value:"tasks","data-tour":"tasks-tab-trigger",children:"ไธบๆจกๅž‹ๅˆ†้…ๅŠŸ่ƒฝ"})]}),e.jsxs(Ss,{value:"models",className:"space-y-4 mt-0",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-2",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"้…็ฝฎๅฏ็”จ็š„ๆจกๅž‹ๅˆ—่กจ"}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[D.size>0&&e.jsxs(_,{onClick:_e,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(os,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"ๆ‰น้‡ๅˆ ้™ค (",D.size,")"]}),e.jsxs(_,{onClick:()=>As(null,null),size:"sm",variant:"outline",className:"w-full sm:w-auto","data-tour":"add-model-button",children:[e.jsx(Xs,{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($t,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ae,{placeholder:"ๆœ็ดขๆจกๅž‹ๅ็งฐใ€ๆ ‡่ฏ†็ฌฆๆˆ–ๆไพ›ๅ•†...",value:ge,onChange:le=>pe(le.target.value),className:"pl-9"})]}),ge&&e.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["ๆ‰พๅˆฐ ",es.length," ไธช็ป“ๆžœ"]})]}),e.jsx(_4,{paginatedModels:$s,allModels:a,onEdit:As,onDelete:ca,isModelUsed:oa,searchQuery:ge}),e.jsx(S4,{paginatedModels:$s,allModels:a,filteredModels:es,selectedModels:D,onEdit:As,onDelete:ca,onToggleSelection:Xt,onToggleSelectAll:te,isModelUsed:oa,searchQuery:ge}),e.jsx(T4,{page:Y,pageSize:fe,totalItems:es.length,jumpToPage:G,onPageChange:we,onPageSizeChange:Ee,onJumpToPageChange:$,onJumpToPage:pa,onSelectionClear:()=>Q(new Set)})]}),e.jsxs(Ss,{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(Ul,{title:"็ป„ไปถๆจกๅž‹ (utils)",description:"็”จไบŽ่กจๆƒ…ๅŒ…ใ€ๅ–ๅใ€ๅ…ณ็ณปใ€ๆƒ…็ปชๅ˜ๅŒ–็ญ‰็ป„ไปถ",taskConfig:p.utils,modelNames:h,onChange:(le,oe)=>Se("utils",le,oe),dataTour:"task-model-select"}),e.jsx(Ul,{title:"ๅทฅๅ…ท่ฐƒ็”จๆจกๅž‹ (tool_use)",description:"้œ€่ฆไฝฟ็”จๆ”ฏๆŒๅทฅๅ…ท่ฐƒ็”จ็š„ๆจกๅž‹",taskConfig:p.tool_use,modelNames:h,onChange:(le,oe)=>Se("tool_use",le,oe)}),e.jsx(Ul,{title:"้ฆ–่ฆๅ›žๅคๆจกๅž‹ (replyer)",description:"็”จไบŽ่กจ่พพๅ™จๅ’Œ่กจ่พพๆ–นๅผๅญฆไน ",taskConfig:p.replyer,modelNames:h,onChange:(le,oe)=>Se("replyer",le,oe)}),e.jsx(Ul,{title:"ๅ†ณ็ญ–ๆจกๅž‹ (planner)",description:"่ดŸ่ดฃๅ†ณๅฎš้บฆ้บฆ่ฏฅไป€ไนˆๆ—ถๅ€™ๅ›žๅค",taskConfig:p.planner,modelNames:h,onChange:(le,oe)=>Se("planner",le,oe)}),e.jsx(Ul,{title:"ๅ›พๅƒ่ฏ†ๅˆซๆจกๅž‹ (vlm)",description:"่ง†่ง‰่ฏญ่จ€ๆจกๅž‹",taskConfig:p.vlm,modelNames:h,onChange:(le,oe)=>Se("vlm",le,oe),hideTemperature:!0}),e.jsx(Ul,{title:"่ฏญ้Ÿณ่ฏ†ๅˆซๆจกๅž‹ (voice)",description:"่ฏญ้Ÿณ่ฝฌๆ–‡ๅญ—",taskConfig:p.voice,modelNames:h,onChange:(le,oe)=>Se("voice",le,oe),hideTemperature:!0,hideMaxTokens:!0}),e.jsx(Ul,{title:"ๅตŒๅ…ฅๆจกๅž‹ (embedding)",description:"็”จไบŽๅ‘้‡ๅŒ–",taskConfig:p.embedding,modelNames:h,onChange:(le,oe)=>Se("embedding",le,oe),hideTemperature:!0,hideMaxTokens:!0}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"LPMM ็Ÿฅ่ฏ†ๅบ“ๆจกๅž‹"}),e.jsx(Ul,{title:"ๅฎžไฝ“ๆๅ–ๆจกๅž‹ (lpmm_entity_extract)",description:"ไปŽๆ–‡ๆœฌไธญๆๅ–ๅฎžไฝ“",taskConfig:p.lpmm_entity_extract,modelNames:h,onChange:(le,oe)=>Se("lpmm_entity_extract",le,oe)}),e.jsx(Ul,{title:"RDF ๆž„ๅปบๆจกๅž‹ (lpmm_rdf_build)",description:"ๆž„ๅปบ็Ÿฅ่ฏ†ๅ›พ่ฐฑ",taskConfig:p.lpmm_rdf_build,modelNames:h,onChange:(le,oe)=>Se("lpmm_rdf_build",le,oe)})]})]})]})]}),e.jsx(Qs,{open:F,onOpenChange:Ht,children:e.jsxs(Hs,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto","data-tour":"model-dialog",preventOutsideClose:Bs,children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:H!==null?"็ผ–่พ‘ๆจกๅž‹":"ๆทปๅŠ ๆจกๅž‹"}),e.jsx(at,{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:Me.name?"text-destructive":"",children:"ๆจกๅž‹ๅ็งฐ *"}),e.jsx(ae,{id:"model_name",value:C?.name||"",onChange:le=>{R(oe=>oe?{...oe,name:le.target.value}:null),Me.name&&ds(oe=>({...oe,name:void 0}))},placeholder:"ไพ‹ๅฆ‚: qwen3-30b",className:Me.name?"border-destructive focus-visible:ring-destructive":""}),Me.name?e.jsx("p",{className:"text-xs text-destructive",children:Me.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:Me.api_provider?"text-destructive":"",children:"API ๆไพ›ๅ•† *"}),e.jsxs(Pe,{value:C?.api_provider||"",onValueChange:le=>{R(oe=>oe?{...oe,api_provider:le}:null),is(),Me.api_provider&&ds(oe=>({...oe,api_provider:void 0}))},children:[e.jsx(Ie,{id:"api_provider",className:Me.api_provider?"border-destructive focus-visible:ring-destructive":"",children:e.jsx(Fe,{placeholder:"้€‰ๆ‹ฉๆไพ›ๅ•†"})}),e.jsx(Be,{children:r.map(le=>e.jsx(W,{value:le,children:le},le))})]}),Me.api_provider&&e.jsx("p",{className:"text-xs text-destructive",children:Me.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:Me.model_identifier?"text-destructive":"",children:"ๆจกๅž‹ๆ ‡่ฏ†็ฌฆ *"}),Cs?.modelFetcher&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ce,{variant:"secondary",className:"text-xs",children:Cs.display_name}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-6 px-2",onClick:()=>C?.api_provider&&rs(C.api_provider,!0),disabled:Ms,children:Ms?e.jsx(Fs,{className:"h-3 w-3 animate-spin"}):e.jsx(dt,{className:"h-3 w-3"})})]})]}),Cs?.modelFetcher?e.jsxs(cl,{open:Re,onOpenChange:se,children:[e.jsx(ol,{asChild:!0,children:e.jsxs(_,{variant:"outline",role:"combobox","aria-expanded":Re,className:"w-full justify-between font-normal",disabled:Ms||!!We,children:[Ms?e.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(Fs,{className:"h-4 w-4 animate-spin"}),"ๆญฃๅœจ่Žทๅ–ๆจกๅž‹ๅˆ—่กจ..."]}):We?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(mx,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(tl,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:e.jsxs(md,{children:[e.jsx(xd,{placeholder:"ๆœ็ดขๆจกๅž‹..."}),e.jsx(ts,{className:"h-[300px]",children:e.jsxs(hd,{className:"max-h-none overflow-visible",children:[e.jsx(fd,{children:We?e.jsxs("div",{className:"py-4 px-2 text-center space-y-2",children:[e.jsx("p",{className:"text-sm text-destructive",children:We}),!We.includes("API Key")&&e.jsx(_,{variant:"link",size:"sm",onClick:()=>C?.api_provider&&rs(C.api_provider,!0),children:"้‡่ฏ•"})]}):"ๆœชๆ‰พๅˆฐๅŒน้…็š„ๆจกๅž‹"}),e.jsx(uc,{heading:"ๅฏ็”จๆจกๅž‹",children:ms.map(le=>e.jsxs(mc,{value:le.id,onSelect:()=>{R(oe=>oe?{...oe,model_identifier:le.id}:null),se(!1)},children:[e.jsx(Ot,{className:`mr-2 h-4 w-4 ${C?.model_identifier===le.id?"opacity-100":"opacity-0"}`}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{children:le.id}),le.name!==le.id&&e.jsx("span",{className:"text-xs text-muted-foreground",children:le.name})]})]},le.id))}),e.jsx(uc,{heading:"ๆ‰‹ๅŠจ่พ“ๅ…ฅ",children:e.jsxs(mc,{value:"__manual_input__",onSelect:()=>{se(!1)},children:[e.jsx(Zn,{className:"mr-2 h-4 w-4"}),"ๆ‰‹ๅŠจ่พ“ๅ…ฅๆจกๅž‹ๆ ‡่ฏ†็ฌฆ..."]})})]})})]})})]}):e.jsx(ae,{id:"model_identifier",value:C?.model_identifier||"",onChange:le=>{R(oe=>oe?{...oe,model_identifier:le.target.value}:null),Me.model_identifier&&ds(oe=>({...oe,model_identifier:void 0}))},placeholder:"Qwen/Qwen3-30B-A3B-Instruct-2507",className:Me.model_identifier?"border-destructive focus-visible:ring-destructive":""}),Me.model_identifier&&e.jsx("p",{className:"text-xs text-destructive",children:Me.model_identifier}),We&&Cs?.modelFetcher&&!Me.model_identifier&&e.jsxs(ht,{variant:"destructive",className:"mt-2 py-2",children:[e.jsx(Yt,{className:"h-4 w-4"}),e.jsx(ft,{className:"text-xs",children:We})]}),Cs?.modelFetcher&&e.jsx(ae,{value:C?.model_identifier||"",onChange:le=>{R(oe=>oe?{...oe,model_identifier:le.target.value}:null),Me.model_identifier&&ds(oe=>({...oe,model_identifier:void 0}))},placeholder:"ๆˆ–ๆ‰‹ๅŠจ่พ“ๅ…ฅๆจกๅž‹ๆ ‡่ฏ†็ฌฆ",className:`mt-2 ${Me.model_identifier?"border-destructive focus-visible:ring-destructive":""}`}),!Me.model_identifier&&e.jsx("p",{className:"text-xs text-muted-foreground",children:We?'่ฏทๆ‰‹ๅŠจ่พ“ๅ…ฅๆจกๅž‹ๆ ‡่ฏ†็ฌฆ๏ผŒๆˆ–ๅ‰ๅพ€"ๆจกๅž‹ๆไพ›ๅ•†้…็ฝฎ"ๆฃ€ๆŸฅ API Key':Cs?.modelFetcher?`ๅทฒ่ฏ†ๅˆซไธบ ${Cs.display_name}๏ผŒๆ”ฏๆŒ่‡ชๅŠจ่Žทๅ–ๆจกๅž‹ๅˆ—่กจ`:"API ๆไพ›ๅ•†ๆไพ›็š„ๆจกๅž‹ ID"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"price_in",children:"่พ“ๅ…ฅไปทๆ ผ (ยฅ/M token)"}),e.jsx(ae,{id:"price_in",type:"number",step:"0.1",min:"0",value:C?.price_in??"",onChange:le=>{const oe=le.target.value===""?null:parseFloat(le.target.value);R(Ve=>Ve?{...Ve,price_in:oe}:null)},placeholder:"้ป˜่ฎค: 0"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"price_out",children:"่พ“ๅ‡บไปทๆ ผ (ยฅ/M token)"}),e.jsx(ae,{id:"price_out",type:"number",step:"0.1",min:"0",value:C?.price_out??"",onChange:le=>{const oe=le.target.value===""?null:parseFloat(le.target.value);R(Ve=>Ve?{...Ve,price_out:oe}: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.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(T,{htmlFor:"enable_model_temperature",className:"cursor-pointer",children:"่‡ชๅฎšไน‰ๆจกๅž‹ๆธฉๅบฆ"}),e.jsx(Il,{content:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"font-medium",children:"ไป€ไนˆๆ˜ฏๆธฉๅบฆ๏ผˆTemperature๏ผ‰๏ผŸ"}),e.jsx("p",{children:"ๆธฉๅบฆๆŽงๅˆถๆจกๅž‹่พ“ๅ‡บ็š„้šๆœบๆ€งๅ’Œๅˆ›้€ ๆ€ง๏ผš"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs",children:[e.jsxs("li",{children:[e.jsx("strong",{children:"ไฝŽๆธฉๅบฆ๏ผˆ0.1-0.3๏ผ‰"}),"๏ผšๆ›ด็กฎๅฎšใ€ๆ›ดไฟๅฎˆ็š„่พ“ๅ‡บ๏ผŒ้€‚ๅˆไบ‹ๅฎžๆ€งไปปๅŠก"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"ไธญๆธฉๅบฆ๏ผˆ0.5-0.7๏ผ‰"}),"๏ผšๅนณ่กกๅˆ›้€ ๆ€งไธŽๅฏๆŽงๆ€ง"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"้ซ˜ๆธฉๅบฆ๏ผˆ0.8-1.0๏ผ‰"}),"๏ผšๆ›ดๆœ‰ๅˆ›ๆ„ใ€ๆ›ดๅคšๆ ทๅŒ–็š„่พ“ๅ‡บ"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"ๆž้ซ˜ๆธฉๅบฆ๏ผˆ1.0-2.0๏ผ‰"}),"๏ผšๆžๅบฆ้šๆœบ๏ผŒๅฏ่ƒฝไบง็”Ÿไธๅฏ้ข„ๆต‹็š„็ป“ๆžœ"]})]})]}),side:"right",maxWidth:"400px"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅฏ็”จๅŽๅฐ†่ฆ†็›–ใ€Œไธบๆจกๅž‹ๅˆ†้…ๅŠŸ่ƒฝใ€ไธญ็š„ไปปๅŠกๆธฉๅบฆ้…็ฝฎ"})]}),e.jsx(qe,{id:"enable_model_temperature",checked:C?.temperature!=null,onCheckedChange:le=>{R(le?oe=>oe?{...oe,temperature:.5}:null:oe=>oe?{...oe,temperature:null}:null)}})]}),C?.temperature!=null&&e.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx(T,{className:"text-sm",children:"ๆธฉๅบฆๅ€ผ"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae,{type:"number",value:C.temperature,onChange:le=>{const oe=parseFloat(le.target.value);!isNaN(oe)&&oe>=0&&oe<=2&&R(Ve=>Ve?{...Ve,temperature:oe}:null)},onBlur:le=>{const oe=parseFloat(le.target.value);isNaN(oe)||oe<0?R(Ve=>Ve?{...Ve,temperature:0}:null):oe>2&&R(Ve=>Ve?{...Ve,temperature:2}:null)},step:.01,min:0,max:2,className:"w-20 h-8 text-sm text-right tabular-nums"}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>K(!A),className:"h-8 px-2",title:A?"ๅˆ‡ๆขๅˆฐๅŸบ็ก€ๆจกๅผ (0-1)":"่งฃ้”้ซ˜็บง่Œƒๅ›ด (0-2)",children:A?e.jsx($_,{className:"h-4 w-4"}):e.jsx(Jm,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-muted-foreground tabular-nums",children:"0"}),e.jsx(el,{value:[C.temperature],onValueChange:le=>R(oe=>oe?{...oe,temperature:le[0]}:null),min:0,max:A?2:1,step:A?.05:.1,className:"flex-1"}),e.jsx("span",{className:"text-xs text-muted-foreground tabular-nums",children:A?"2":"1"})]}),A&&e.jsxs(ht,{className:"bg-amber-500/10 border-amber-500/20 [&>svg+div]:translate-y-0",children:[e.jsx(Lt,{className:"h-4 w-4 text-amber-500"}),e.jsx(ft,{className:"text-xs text-amber-600 dark:text-amber-400",children:"้ซ˜็บงๆจกๅผ๏ผšๆธฉๅบฆ > 1 ไผšไบง็”Ÿๆ›ด้šๆœบใ€ๆ›ดไธๅฏ้ข„ๆต‹็š„่พ“ๅ‡บ๏ผŒ่ฏท่ฐจๆ…Žไฝฟ็”จ"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:A?"่พƒไฝŽ๏ผˆ0.1-0.5๏ผ‰ไบง็”Ÿ็กฎๅฎš่พ“ๅ‡บ๏ผŒไธญ็ญ‰๏ผˆ0.5-1.0๏ผ‰ๅนณ่กกๅˆ›้€ ๆ€ง๏ผŒ่พƒ้ซ˜๏ผˆ1.0-2.0๏ผ‰ไบง็”Ÿๆžๅบฆ้šๆœบ่พ“ๅ‡บ":"่พƒไฝŽ็š„ๆธฉๅบฆ๏ผˆ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.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(T,{htmlFor:"enable_model_max_tokens",className:"cursor-pointer",children:"่‡ชๅฎšไน‰ๆœ€ๅคง Token"}),e.jsx(Il,{content:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"font-medium",children:"ไป€ไนˆๆ˜ฏๆœ€ๅคง Token๏ผŸ"}),e.jsx("p",{children:"ๆŽงๅˆถๆจกๅž‹ๅ•ๆฌกๅ›žๅค็š„ๆœ€ๅคง้•ฟๅบฆใ€‚1 token โ‰ˆ 0.75 ไธช่‹ฑๆ–‡ๅ•่ฏๆˆ– 0.5 ไธชไธญๆ–‡ๅญ—็ฌฆใ€‚"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs",children:[e.jsxs("li",{children:[e.jsx("strong",{children:"่พƒๅฐๅ€ผ๏ผˆ512-1024๏ผ‰"}),"๏ผš็ฎ€็Ÿญๅ›žๅค๏ผŒ่Š‚็œๆˆๆœฌ"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"ไธญ็ญ‰ๅ€ผ๏ผˆ2048-4096๏ผ‰"}),"๏ผšๆญฃๅธธๅฏน่ฏ้•ฟๅบฆ"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"่พƒๅคงๅ€ผ๏ผˆ8192+๏ผ‰"}),"๏ผš้•ฟๆ–‡ๆœฌ็”Ÿๆˆ๏ผŒๆˆๆœฌ่พƒ้ซ˜"]})]})]}),side:"right",maxWidth:"400px"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅฏ็”จๅŽๅฐ†่ฆ†็›–ใ€Œไธบๆจกๅž‹ๅˆ†้…ๅŠŸ่ƒฝใ€ไธญ็š„ไปปๅŠกๆœ€ๅคง Token ้…็ฝฎ"})]}),e.jsx(qe,{id:"enable_model_max_tokens",checked:C?.max_tokens!=null,onCheckedChange:le=>{R(le?oe=>oe?{...oe,max_tokens:2048}:null:oe=>oe?{...oe,max_tokens:null}:null)}})]}),C?.max_tokens!=null&&e.jsxs("div",{className:"space-y-2 pt-2 border-t",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{className:"text-sm",children:"ๆœ€ๅคง Token ๆ•ฐ"}),e.jsx(ae,{type:"number",min:"1",max:"128000",value:C.max_tokens,onChange:le=>{const oe=parseInt(le.target.value);!isNaN(oe)&&oe>=1&&R(Ve=>Ve?{...Ve,max_tokens:oe}: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(qe,{id:"force_stream_mode",checked:C?.force_stream_mode||!1,onCheckedChange:le=>R(oe=>oe?{...oe,force_stream_mode:le}:null)}),e.jsx(T,{htmlFor:"force_stream_mode",className:"cursor-pointer",children:"ๅผบๅˆถๆตๅผ่พ“ๅ‡บๆจกๅผ"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"้ขๅค–ๅ‚ๆ•ฐ"}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs(_,{type:"button",variant:"outline",size:"sm",className:"flex-1 justify-start h-9",onClick:()=>L(!0),children:[e.jsx(Sn,{className:"h-4 w-4 mr-2"}),Object.keys(C?.extra_params||{}).length>0?e.jsxs("span",{children:["ๅทฒ้…็ฝฎ ",Object.keys(C?.extra_params||{}).length," ไธชๅ‚ๆ•ฐ"]}):e.jsx("span",{className:"text-muted-foreground",children:"ๆœช้…็ฝฎ้ขๅค–ๅ‚ๆ•ฐ"})]})}),Object.keys(C?.extra_params||{}).length>0&&e.jsxs("div",{className:"text-xs text-muted-foreground px-1",children:[Object.keys(C?.extra_params||{}).slice(0,3).map(le=>e.jsx("span",{className:"inline-block mr-2",children:e.jsx("code",{className:"px-1.5 py-0.5 bg-muted rounded",children:le})},le)),Object.keys(C?.extra_params||{}).length>3&&e.jsx("span",{children:"..."})]})]})]}),e.jsxs(gt,{children:[e.jsx(_,{variant:"outline",onClick:()=>E(!1),"data-tour":"model-cancel-button",children:"ๅ–ๆถˆ"}),e.jsx(_,{onClick:mt,"data-tour":"model-save-button",children:"ไฟๅญ˜"})]})]})}),e.jsx(bs,{open:me,onOpenChange:Ne,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsxs(gs,{children:['็กฎๅฎš่ฆๅˆ ้™คๆจกๅž‹ "',je!==null?a[je]?.name:"",'" ๅ—๏ผŸ ๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚']})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:Fa,children:"ๅˆ ้™ค"})]})]})}),e.jsx(bs,{open:I,onOpenChange:ue,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๆ‰น้‡ๅˆ ้™ค"}),e.jsxs(gs,{children:["็กฎๅฎš่ฆๅˆ ้™ค้€‰ไธญ็š„ ",D.size," ไธชๆจกๅž‹ๅ—๏ผŸ ๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:U,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"ๆ‰น้‡ๅˆ ้™ค"})]})]})}),e.jsx(bs,{open:$e,onOpenChange:cs,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsxs(ps,{className:"flex items-center gap-2",children:[e.jsx(Lt,{className:"h-5 w-5 text-amber-500"}),"ๆ›ดๆขๅตŒๅ…ฅๆจกๅž‹่ญฆๅ‘Š"]}),e.jsx(gs,{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(fs,{children:[e.jsx(vs,{onClick:us,children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:as,className:"bg-amber-600 hover:bg-amber-700",children:"็กฎ่ฎคๆ›ดๆข"})]})]})}),e.jsx(u4,{open:X,onOpenChange:L,value:C?.extra_params||{},onChange:le=>R(oe=>oe?{...oe,extra_params:le}:null)}),e.jsx(nr,{})]})})}const xc=Mj,hc=Aw,fc=zw,pd="/api/webui/config";async function D4(){const l=await(await ke(`${pd}/adapter-config/path`)).json();return!l.success||!l.path?null:{path:l.path,lastModified:l.lastModified}}async function Wg(a){const r=await(await ke(`${pd}/adapter-config/path`,{method:"POST",headers:Zs(),body:JSON.stringify({path:a})})).json();if(!r.success)throw new Error(r.message||"ไฟๅญ˜่ทฏๅพ„ๅคฑ่ดฅ")}async function ej(a){const r=await(await ke(`${pd}/adapter-config?path=${encodeURIComponent(a)}`)).json();if(!r.success)throw new Error("่ฏปๅ–้…็ฝฎๆ–‡ไปถๅคฑ่ดฅ");return r.content}async function sj(a,l){const c=await(await ke(`${pd}/adapter-config`,{method:"POST",headers:Zs(),body:JSON.stringify({path:a,content:l})})).json();if(!c.success)throw new Error(c.message||"ไฟๅญ˜้…็ฝฎๅคฑ่ดฅ")}const kt={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},forward:{image_threshold:30},debug:{level:"INFO"}},Fm={oneclick:{name:"ไธ€้”ฎๅŒ…",description:"ไฝฟ็”จไธ€้”ฎๅŒ…้ƒจ็ฝฒ็š„้€‚้…ๅ™จ้…็ฝฎ",path:"../MaiBot-Napcat-Adapter/config.toml",icon:xa},docker:{name:"Docker",description:"Docker Compose ้ƒจ็ฝฒ็š„้€‚้…ๅ™จ้…็ฝฎ",path:"/MaiMBot/adapters-config/config.toml",icon:I_}};function Hm(a){try{const l=_x(a);return{inner:{...kt.inner,...l.inner},nickname:{...kt.nickname,...l.nickname},napcat_server:{...kt.napcat_server,...l.napcat_server},maibot_server:{...kt.maibot_server,...l.maibot_server},chat:{...kt.chat,...l.chat},voice:{...kt.voice,...l.voice},forward:{...kt.forward,...l.forward},debug:{...kt.debug,...l.debug}}}catch(l){throw console.error("TOML ่งฃๆžๅคฑ่ดฅ:",l),new Error(`ๆ— ๆณ•่งฃๆž TOML ๆ–‡ไปถ: ${l instanceof Error?l.message:"ๆœช็Ÿฅ้”™่ฏฏ"}`)}}function qm(a){try{const l=(d,m)=>d===""||d===null||d===void 0?m:d,r={inner:{version:l(a.inner.version,kt.inner.version)},nickname:{nickname:l(a.nickname.nickname,kt.nickname.nickname)},napcat_server:{host:l(a.napcat_server.host,kt.napcat_server.host),port:l(a.napcat_server.port||0,kt.napcat_server.port),token:l(a.napcat_server.token,kt.napcat_server.token),heartbeat_interval:l(a.napcat_server.heartbeat_interval||0,kt.napcat_server.heartbeat_interval)},maibot_server:{host:l(a.maibot_server.host,kt.maibot_server.host),port:l(a.maibot_server.port||0,kt.maibot_server.port)},chat:{group_list_type:l(a.chat.group_list_type,kt.chat.group_list_type),group_list:a.chat.group_list||[],private_list_type:l(a.chat.private_list_type,kt.chat.private_list_type),private_list:a.chat.private_list||[],ban_user_id:a.chat.ban_user_id||[],ban_qq_bot:a.chat.ban_qq_bot??kt.chat.ban_qq_bot,enable_poke:a.chat.enable_poke??kt.chat.enable_poke},voice:{use_tts:a.voice.use_tts??kt.voice.use_tts},forward:{image_threshold:l(a.forward.image_threshold||0,kt.forward.image_threshold)},debug:{level:l(a.debug.level,kt.debug.level)}};let c=GS(r);return c=O4(c),c}catch(l){throw console.error("TOML ็”Ÿๆˆๅคฑ่ดฅ:",l),new Error(`ๆ— ๆณ•็”Ÿๆˆ TOML ๆ–‡ไปถ: ${l instanceof Error?l.message:"ๆœช็Ÿฅ้”™่ฏฏ"}`)}}function O4(a){const l=a.split(` `),r=[];for(let c=0;c"|?*\x00-\x1F]/.test(a)?{valid:!1,error:"่ทฏๅพ„ๅŒ…ๅซ้žๆณ•ๅญ—็ฌฆ"}:{valid:!0,error:""}}function L4(){const[a,l]=u.useState("upload"),[r,c]=u.useState(null),[d,m]=u.useState(""),[h,f]=u.useState(""),[p,g]=u.useState("oneclick"),[N,j]=u.useState(""),[b,y]=u.useState(!1),[w,z]=u.useState(!1),[M,S]=u.useState(!1),[F,E]=u.useState(!1),[C,R]=u.useState(null),[H,O]=u.useState(!1),X=u.useRef(null),{toast:L}=nt(),me=u.useRef(null),Ne=A=>{if(f(A),A.trim()){const K=Vm(A);j(K.error)}else j("")},je=u.useCallback(async A=>{const K=Fm[A];z(!0);try{const Re=await ej(K.path),se=Hm(Re);c(se),g(A),f(K.path),await Wg(K.path),L({title:"ๅŠ ่ฝฝๆˆๅŠŸ",description:`ๅทฒไปŽ${K.name}้ข„่ฎพๅŠ ่ฝฝ้…็ฝฎ`})}catch(Re){console.error("ๅŠ ่ฝฝ้ข„่ฎพ้…็ฝฎๅคฑ่ดฅ:",Re),L({title:"ๅŠ ่ฝฝๅคฑ่ดฅ",description:Re instanceof Error?Re.message:"ๆ— ๆณ•่ฏปๅ–้ข„่ฎพ้…็ฝฎๆ–‡ไปถ",variant:"destructive"})}finally{z(!1)}},[L]),ce=u.useCallback(async A=>{const K=Vm(A);if(!K.valid){j(K.error),L({title:"่ทฏๅพ„ๆ— ๆ•ˆ",description:K.error,variant:"destructive"});return}j(""),z(!0);try{const Re=await ej(A),se=Hm(Re);c(se),f(A),await Wg(A),L({title:"ๅŠ ่ฝฝๆˆๅŠŸ",description:"ๅทฒไปŽ้…็ฝฎๆ–‡ไปถๅŠ ่ฝฝ"})}catch(Re){console.error("ๅŠ ่ฝฝ้…็ฝฎๅคฑ่ดฅ:",Re),L({title:"ๅŠ ่ฝฝๅคฑ่ดฅ",description:Re instanceof Error?Re.message:"ๆ— ๆณ•่ฏปๅ–้…็ฝฎๆ–‡ไปถ",variant:"destructive"})}finally{z(!1)}},[L]);u.useEffect(()=>{(async()=>{try{const K=await D4();if(K&&K.path){f(K.path);const Re=Object.entries(Fm).find(([,se])=>se.path===K.path);Re?(l("preset"),g(Re[0]),await je(Re[0])):(l("path"),await ce(K.path))}}catch(K){console.error("ๅŠ ่ฝฝไฟๅญ˜็š„่ทฏๅพ„ๅคฑ่ดฅ:",K)}})()},[ce,je]);const ge=u.useCallback(A=>{a!=="path"&&a!=="preset"||!h||(me.current&&clearTimeout(me.current),me.current=setTimeout(async()=>{y(!0);try{const K=qm(A);await sj(h,K),L({title:"่‡ชๅŠจไฟๅญ˜ๆˆๅŠŸ",description:"้…็ฝฎๅทฒไฟๅญ˜ๅˆฐๆ–‡ไปถ"})}catch(K){console.error("่‡ชๅŠจไฟๅญ˜ๅคฑ่ดฅ:",K),L({title:"่‡ชๅŠจไฟๅญ˜ๅคฑ่ดฅ",description:K instanceof Error?K.message:"ไฟๅญ˜้…็ฝฎๅคฑ่ดฅ",variant:"destructive"})}finally{y(!1)}},1e3))},[a,h,L]),pe=async()=>{if(!r||!h)return;const A=Vm(h);if(!A.valid){L({title:"ไฟๅญ˜ๅคฑ่ดฅ",description:A.error,variant:"destructive"});return}y(!0);try{const K=qm(r);await sj(h,K),L({title:"ไฟๅญ˜ๆˆๅŠŸ",description:"้…็ฝฎๅทฒไฟๅญ˜ๅˆฐๆ–‡ไปถ"})}catch(K){console.error("ไฟๅญ˜ๅคฑ่ดฅ:",K),L({title:"ไฟๅญ˜ๅคฑ่ดฅ",description:K instanceof Error?K.message:"ไฟๅญ˜้…็ฝฎๅคฑ่ดฅ",variant:"destructive"})}finally{y(!1)}},D=async()=>{h&&await ce(h)},Q=A=>{if(A!==a){if(r){R(A),S(!0);return}B(A)}},B=A=>{c(null),m(""),j(""),l(A),A==="preset"&&je("oneclick"),L({title:"ๅทฒๅˆ‡ๆขๆจกๅผ",description:{upload:"็ŽฐๅœจๅฏไปฅไธŠไผ ้…็ฝฎๆ–‡ไปถ",path:"็ŽฐๅœจๅฏไปฅๆŒ‡ๅฎš้…็ฝฎๆ–‡ไปถ่ทฏๅพ„",preset:"็Žฐๅœจๅฏไปฅไฝฟ็”จ้ข„่ฎพ้…็ฝฎ"}[A]})},ue=()=>{C&&(B(C),R(null)),S(!1)},Y=()=>{if(r){E(!0);return}we()},we=()=>{f(""),c(null),j(""),L({title:"ๅทฒๆธ…็ฉบ",description:"่ทฏๅพ„ๅ’Œ้…็ฝฎๅทฒๆธ…็ฉบ"})},fe=()=>{we(),E(!1)},Ee=A=>{const K=A.target.files?.[0];if(!K)return;const Re=new FileReader;Re.onload=se=>{try{const $e=se.target?.result,cs=Hm($e);c(cs),m(K.name),L({title:"ไธŠไผ ๆˆๅŠŸ",description:`ๅทฒๅŠ ่ฝฝ้…็ฝฎๆ–‡ไปถ๏ผš${K.name}`})}catch($e){console.error("่งฃๆž้…็ฝฎๆ–‡ไปถๅคฑ่ดฅ:",$e),L({title:"่งฃๆžๅคฑ่ดฅ",description:"้…็ฝฎๆ–‡ไปถๆ ผๅผ้”™่ฏฏ๏ผŒ่ฏทๆฃ€ๆŸฅๆ–‡ไปถๅ†…ๅฎน",variant:"destructive"})}},Re.readAsText(K)},G=()=>{if(!r)return;const A=qm(r),K=new Blob([A],{type:"text/plain;charset=utf-8"}),Re=URL.createObjectURL(K),se=document.createElement("a");se.href=Re,se.download=d||"config.toml",document.body.appendChild(se),se.click(),document.body.removeChild(se),URL.revokeObjectURL(Re),L({title:"ไธ‹่ฝฝๆˆๅŠŸ",description:"้…็ฝฎๆ–‡ไปถๅทฒไธ‹่ฝฝ๏ผŒ่ฏทๆ‰‹ๅŠจ่ฆ†็›–ๅนถ้‡ๅฏ้€‚้…ๅ™จ"})},$=()=>{c(JSON.parse(JSON.stringify(kt))),m("config.toml"),L({title:"ๅทฒๅŠ ่ฝฝ้ป˜่ฎค้…็ฝฎ",description:"ๅฏไปฅๅผ€ๅง‹็ผ–่พ‘้…็ฝฎ"})};return e.jsx(ts,{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.jsx(xc,{open:H,onOpenChange:O,children:e.jsxs(Te,{children:[e.jsx(Oe,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Ue,{children:"ๅทฅไฝœๆจกๅผ"}),e.jsx(Ns,{children:"้€‰ๆ‹ฉ้…็ฝฎๆ–‡ไปถ็š„็ฎก็†ๆ–นๅผ"})]}),e.jsx(hc,{asChild:!0,children:e.jsxs(_,{variant:"ghost",size:"sm",className:"w-9 p-0",children:[e.jsx(Ba,{className:`h-4 w-4 transition-transform duration-200 ${H?"transform rotate-180":""}`}),e.jsx("span",{className:"sr-only",children:"ๅˆ‡ๆข"})]})})]})}),e.jsx(fc,{children:e.jsxs(ze,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3 md:gap-4",children:[e.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${a==="preset"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>Q("preset"),children:e.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[e.jsx(xa,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"้ข„่ฎพๆจกๅผ"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"ไฝฟ็”จ้ข„่ฎพ็š„้ƒจ็ฝฒ้…็ฝฎ"})]})]})}),e.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${a==="upload"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>Q("upload"),children:e.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[e.jsx(cc,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"ไธŠไผ ๆ–‡ไปถๆจกๅผ"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"ไธŠไผ ้…็ฝฎๆ–‡ไปถ๏ผŒ็ผ–่พ‘ๅŽไธ‹่ฝฝๅนถๆ‰‹ๅŠจ่ฆ†็›–"})]})]})}),e.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${a==="path"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>Q("path"),children:e.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[e.jsx(I1,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"ๆŒ‡ๅฎš่ทฏๅพ„ๆจกๅผ"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"ๆŒ‡ๅฎš้…็ฝฎๆ–‡ไปถ่ทฏๅพ„๏ผŒ่‡ชๅŠจๅŠ ่ฝฝๅ’Œไฟๅญ˜"})]})]})})]}),a==="preset"&&e.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[e.jsx(T,{className:"text-sm md:text-base",children:"้€‰ๆ‹ฉ้ƒจ็ฝฒๆ–นๅผ"}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:Object.entries(Fm).map(([A,K])=>{const Re=K.icon,se=p===A;return e.jsx("div",{className:`border-2 rounded-lg p-3 cursor-pointer transition-all ${se?"border-primary bg-primary/5":"border-muted hover:border-primary/50"}`,onClick:()=>{g(A),je(A)},children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Re,{className:"h-5 w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h4",{className:"font-semibold text-sm",children:K.name}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:K.description}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 font-mono break-all",children:K.path})]})]})},A)})})]}),a==="path"&&e.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"config-path",className:"text-sm md:text-base",children:"้…็ฝฎๆ–‡ไปถ่ทฏๅพ„"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx(ne,{id:"config-path",value:h,onChange:A=>Ne(A.target.value),placeholder:"ไพ‹: C:\\Adapter\\config.toml",className:`text-sm ${N?"border-destructive":""}`}),N&&e.jsx("p",{className:"text-xs text-destructive",children:N})]}),e.jsx(_,{onClick:()=>ce(h),disabled:w||!h||!!N,className:"w-full sm:w-auto",children:w?e.jsxs(e.Fragment,{children:[e.jsx(dt,{className:"h-4 w-4 animate-spin mr-2"}),e.jsx("span",{className:"sm:hidden",children:"ๅŠ ่ฝฝไธญ..."})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"sm:hidden",children:"ๅŠ ่ฝฝ้…็ฝฎ"}),e.jsx("span",{className:"hidden sm:inline",children:"ๅŠ ่ฝฝ"})]})})]})]}),e.jsxs("details",{className:"rounded-lg bg-muted/50 p-3 group",children:[e.jsxs("summary",{className:"text-xs font-medium cursor-pointer select-none list-none flex items-center justify-between",children:[e.jsx("span",{children:"่ทฏๅพ„ๆ ผๅผ่ฏดๆ˜Ž"}),e.jsx("svg",{className:"h-4 w-4 transition-transform group-open:rotate-180",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),e.jsxs("div",{className:"mt-2 space-y-2 text-xs text-muted-foreground",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Windows"})}),e.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[e.jsx("div",{children:"C:\\Adapter\\config.toml"}),e.jsx("div",{className:"hidden sm:block",children:"D:\\MaiBot\\adapter\\config.toml"}),e.jsx("div",{className:"hidden sm:block",children:"\\\\server\\share\\config.toml"})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Linux"})}),e.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[e.jsx("div",{children:"/opt/adapter/config.toml"}),e.jsx("div",{className:"hidden sm:block",children:"/home/user/adapter/config.toml"}),e.jsx("div",{className:"hidden sm:block",children:"~/adapter/config.toml"})]})]}),e.jsx("p",{className:"pt-1 border-t text-[10px] md:text-xs",children:"๐Ÿ’ก ้…็ฝฎไผš่‡ชๅŠจไฟๅญ˜ๅˆฐๆŒ‡ๅฎšๆ–‡ไปถ๏ผŒไฟฎๆ”นๅŽ 1 ็ง’่‡ชๅŠจไฟๅญ˜"})]})]})]})]})})]})}),e.jsxs(ht,{children:[e.jsx(Yt,{className:"h-4 w-4"}),e.jsx(ft,{children:a==="preset"?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"้ข„่ฎพๆจกๅผ๏ผš"}),"้€‰ๆ‹ฉ้ข„่ฎพ็š„้ƒจ็ฝฒๆ–นๅผ๏ผŒ้…็ฝฎไผš่‡ชๅŠจๅŠ ่ฝฝ๏ผŒไฟฎๆ”นๅŽ 1 ็ง’่‡ชๅŠจไฟๅญ˜",b&&" (ๆญฃๅœจไฟๅญ˜...)"]}):a==="upload"?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"ไธŠไผ ๆ–‡ไปถๆจกๅผ๏ผš"}),"ไธŠไผ ้…็ฝฎๆ–‡ไปถ โ†’ ๅœจ็บฟ็ผ–่พ‘ โ†’ ไธ‹่ฝฝๆ–‡ไปถ โ†’ ๆ‰‹ๅŠจ่ฆ†็›–ๅนถ้‡ๅฏ้€‚้…ๅ™จ"]}):e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"ๆŒ‡ๅฎš่ทฏๅพ„ๆจกๅผ๏ผš"}),"ๆŒ‡ๅฎš้…็ฝฎๆ–‡ไปถ่ทฏๅพ„ๅŽ๏ผŒ้…็ฝฎไผš่‡ชๅŠจๅŠ ่ฝฝ๏ผŒไฟฎๆ”นๅŽ 1 ็ง’่‡ชๅŠจไฟๅญ˜",b&&" (ๆญฃๅœจไฟๅญ˜...)"]})})]}),a==="upload"&&!r&&e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full",children:[e.jsx("input",{ref:X,type:"file",accept:".toml",className:"hidden",onChange:Ee}),e.jsxs(_,{onClick:()=>X.current?.click(),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(cc,{className:"mr-2 h-4 w-4"}),"ไธŠไผ ้…็ฝฎ"]}),e.jsxs(_,{onClick:$,size:"sm",className:"w-full sm:w-auto",children:[e.jsx(Ua,{className:"mr-2 h-4 w-4"}),"ไฝฟ็”จ้ป˜่ฎค้…็ฝฎ"]})]}),a==="upload"&&r&&e.jsx("div",{className:"flex gap-2",children:e.jsxs(_,{onClick:G,size:"sm",className:"w-full sm:w-auto",children:[e.jsx(na,{className:"mr-2 h-4 w-4"}),"ไธ‹่ฝฝ้…็ฝฎ"]})}),(a==="preset"||a==="path")&&r&&e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs(_,{onClick:pe,size:"sm",disabled:b||!!N,className:"w-full sm:w-auto",children:[e.jsx(gc,{className:"mr-2 h-4 w-4"}),b?"ไฟๅญ˜ไธญ...":"็ซ‹ๅณไฟๅญ˜"]}),e.jsxs(_,{onClick:D,size:"sm",variant:"outline",disabled:w,className:"w-full sm:w-auto",children:[e.jsx(dt,{className:`mr-2 h-4 w-4 ${w?"animate-spin":""}`}),"ๅˆทๆ–ฐ"]}),a==="path"&&e.jsxs(_,{onClick:Y,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(os,{className:"mr-2 h-4 w-4"}),"ๆธ…็ฉบ่ทฏๅพ„"]})]}),r?e.jsxs(Jt,{defaultValue:"napcat",className:"w-full",children:[e.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:e.jsxs(Gt,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5",children:[e.jsxs(Xe,{value:"napcat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[e.jsx("span",{className:"hidden sm:inline",children:"Napcat ่ฟžๆŽฅ"}),e.jsx("span",{className:"sm:hidden",children:"Napcat"})]}),e.jsxs(Xe,{value:"maibot",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[e.jsx("span",{className:"hidden sm:inline",children:"้บฆ้บฆ่ฟžๆŽฅ"}),e.jsx("span",{className:"sm:hidden",children:"้บฆ้บฆ"})]}),e.jsxs(Xe,{value:"chat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[e.jsx("span",{className:"hidden sm:inline",children:"่ŠๅคฉๆŽงๅˆถ"}),e.jsx("span",{className:"sm:hidden",children:"่Šๅคฉ"})]}),e.jsxs(Xe,{value:"voice",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[e.jsx("span",{className:"hidden sm:inline",children:"่ฏญ้ŸณไธŽ่ฝฌๅ‘"}),e.jsx("span",{className:"sm:hidden",children:"่ฏญ้Ÿณ"})]}),e.jsx(Xe,{value:"debug",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:"่ฐƒ่ฏ•"})]})}),e.jsx(Ss,{value:"napcat",className:"space-y-4",children:e.jsx(U4,{config:r,onChange:A=>{c(A),ge(A)}})}),e.jsx(Ss,{value:"maibot",className:"space-y-4",children:e.jsx($4,{config:r,onChange:A=>{c(A),ge(A)}})}),e.jsx(Ss,{value:"chat",className:"space-y-4",children:e.jsx(B4,{config:r,onChange:A=>{c(A),ge(A)}})}),e.jsx(Ss,{value:"voice",className:"space-y-4",children:e.jsx(I4,{config:r,onChange:A=>{c(A),ge(A)}})}),e.jsx(Ss,{value:"debug",className:"space-y-4",children:e.jsx(P4,{config:r,onChange:A=>{c(A),ge(A)}})})]}):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(Ua,{className:"h-12 w-12 md:h-16 md:w-16 mx-auto text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold",children:"ๅฐšๆœชๅŠ ่ฝฝ้…็ฝฎ"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-2 px-4",children:a==="preset"?"่ฏท้€‰ๆ‹ฉ้ข„่ฎพ็š„้ƒจ็ฝฒๆ–นๅผ":a==="upload"?"่ฏทไธŠไผ ็Žฐๆœ‰้…็ฝฎๆ–‡ไปถ๏ผŒๆˆ–ไฝฟ็”จ้ป˜่ฎค้…็ฝฎๅผ€ๅง‹็ผ–่พ‘":"่ฏทๆŒ‡ๅฎš้…็ฝฎๆ–‡ไปถ่ทฏๅพ„ๅนถ็‚นๅ‡ปๅŠ ่ฝฝๆŒ‰้’ฎ"})]})]})}),e.jsx(bs,{open:M,onOpenChange:S,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ‡ๆขๆจกๅผ"}),e.jsxs(gs,{children:["ๅˆ‡ๆขๆจกๅผๅฐ†ๆธ…็ฉบๅฝ“ๅ‰้…็ฝฎ๏ผŒ็กฎๅฎš่ฆ็ปง็ปญๅ—๏ผŸ",e.jsx("br",{}),e.jsx("span",{className:"text-destructive font-medium",children:"่ฏท็กฎไฟๅทฒไฟๅญ˜้‡่ฆ้…็ฝฎ"})]})]}),e.jsxs(fs,{children:[e.jsx(vs,{onClick:()=>{S(!1),R(null)},children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:ue,children:"็กฎ่ฎคๅˆ‡ๆข"})]})]})}),e.jsx(bs,{open:F,onOpenChange:E,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๆธ…็ฉบ่ทฏๅพ„"}),e.jsxs(gs,{children:["ๆธ…็ฉบ่ทฏๅพ„ๅฐ†ๆธ…้™คๅฝ“ๅ‰้…็ฝฎ๏ผŒ็กฎๅฎš่ฆ็ปง็ปญๅ—๏ผŸ",e.jsx("br",{}),e.jsx("span",{className:"text-muted-foreground text-sm",children:"ๆญคๆ“ไฝœไธไผšๅˆ ้™ค้…็ฝฎๆ–‡ไปถ๏ผŒๅชๆ˜ฏๆธ…้™ค็•Œ้ขไธญ็š„้…็ฝฎ"})]})]}),e.jsxs(fs,{children:[e.jsx(vs,{onClick:()=>E(!1),children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:fe,className:"bg-destructive hover:bg-destructive/90",children:"็กฎ่ฎคๆธ…็ฉบ"})]})]})})]})})}function U4({config:a,onChange:l}){return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"Napcat WebSocket ๆœๅŠก่ฎพ็ฝฎ"}),e.jsxs("div",{className:"grid gap-3 md:gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"napcat-host",className:"text-sm md:text-base",children:"ไธปๆœบๅœฐๅ€"}),e.jsx(ne,{id:"napcat-host",value:a.napcat_server.host,onChange:r=>l({...a,napcat_server:{...a.napcat_server,host:r.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat ่ฎพๅฎš็š„ไธปๆœบๅœฐๅ€"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"napcat-port",className:"text-sm md:text-base",children:"็ซฏๅฃ"}),e.jsx(ne,{id:"napcat-port",type:"number",value:a.napcat_server.port||"",onChange:r=>l({...a,napcat_server:{...a.napcat_server,port:r.target.value?parseInt(r.target.value):0}}),placeholder:"8095",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat ่ฎพๅฎš็š„็ซฏๅฃ๏ผˆ็•™็ฉบไฝฟ็”จ้ป˜่ฎคๅ€ผ 8095๏ผ‰"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"napcat-token",className:"text-sm md:text-base",children:"่ฎฟ้—ฎไปค็‰Œ๏ผˆToken๏ผ‰"}),e.jsx(ne,{id:"napcat-token",type:"password",value:a.napcat_server.token,onChange:r=>l({...a,napcat_server:{...a.napcat_server,token:r.target.value}}),placeholder:"็•™็ฉบ่กจ็คบๆ— ้œ€ไปค็‰Œ",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat ่ฎพๅฎš็š„่ฎฟ้—ฎไปค็‰Œ๏ผŒ่‹ฅๆ— ๅˆ™็•™็ฉบ"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"napcat-heartbeat",className:"text-sm md:text-base",children:"ๅฟƒ่ทณ้—ด้š”๏ผˆ็ง’๏ผ‰"}),e.jsx(ne,{id:"napcat-heartbeat",type:"number",value:a.napcat_server.heartbeat_interval||"",onChange:r=>l({...a,napcat_server:{...a.napcat_server,heartbeat_interval:r.target.value?parseInt(r.target.value):0}}),placeholder:"30",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ไธŽ Napcat ่ฎพ็ฝฎ็š„ๅฟƒ่ทณ้—ด้š”ไฟๆŒไธ€่‡ด๏ผˆ็•™็ฉบไฝฟ็”จ้ป˜่ฎคๅ€ผ 30๏ผ‰"})]})]})]})})}function $4({config:a,onChange:l}){return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"้บฆ้บฆ WebSocket ๆœๅŠก่ฎพ็ฝฎ"}),e.jsxs("div",{className:"grid gap-3 md:gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"maibot-host",className:"text-sm md:text-base",children:"ไธปๆœบๅœฐๅ€"}),e.jsx(ne,{id:"maibot-host",value:a.maibot_server.host,onChange:r=>l({...a,maibot_server:{...a.maibot_server,host:r.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"้บฆ้บฆๅœจ .env ๆ–‡ไปถไธญ่ฎพ็ฝฎ็š„ HOST ๅญ—ๆฎต"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"maibot-port",className:"text-sm md:text-base",children:"็ซฏๅฃ"}),e.jsx(ne,{id:"maibot-port",type:"number",value:a.maibot_server.port||"",onChange:r=>l({...a,maibot_server:{...a.maibot_server,port:r.target.value?parseInt(r.target.value):0}}),placeholder:"8000",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"้บฆ้บฆๅœจ .env ๆ–‡ไปถไธญ่ฎพ็ฝฎ็š„ PORT ๅญ—ๆฎต๏ผˆ็•™็ฉบไฝฟ็”จ้ป˜่ฎคๅ€ผ 8000๏ผ‰"})]})]})]})})}function B4({config:a,onChange:l}){const r=m=>{const h={...a};m==="group"?h.chat.group_list=[...h.chat.group_list,0]:m==="private"?h.chat.private_list=[...h.chat.private_list,0]:h.chat.ban_user_id=[...h.chat.ban_user_id,0],l(h)},c=(m,h)=>{const f={...a};m==="group"?f.chat.group_list=f.chat.group_list.filter((p,g)=>g!==h):m==="private"?f.chat.private_list=f.chat.private_list.filter((p,g)=>g!==h):f.chat.ban_user_id=f.chat.ban_user_id.filter((p,g)=>g!==h),l(f)},d=(m,h,f)=>{const p={...a};m==="group"?p.chat.group_list[h]=f:m==="private"?p.chat.private_list[h]=f:p.chat.ban_user_id[h]=f,l(p)};return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"่Šๅคฉ้ป‘็™ฝๅๅ•ๅŠŸ่ƒฝ"}),e.jsxs("div",{className:"grid gap-4 md:gap-6",children:[e.jsxs("div",{className:"space-y-3 md:space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-sm md:text-base",children:"็พค็ป„ๅๅ•็ฑปๅž‹"}),e.jsxs(Pe,{value:a.chat.group_list_type,onValueChange:m=>l({...a,chat:{...a.chat,group_list_type:m}}),children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"whitelist",children:"็™ฝๅๅ•๏ผˆไป…ๅๅ•ๅ†…ๅฏ่Šๅคฉ๏ผ‰"}),e.jsx(W,{value:"blacklist",children:"้ป‘ๅๅ•๏ผˆๅๅ•ๅ†…็ฆๆญข่Šๅคฉ๏ผ‰"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[e.jsx(T,{className:"text-sm md:text-base",children:"็พค็ป„ๅˆ—่กจ"}),e.jsxs(_,{onClick:()=>r("group"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(Ua,{className:"mr-1 h-4 w-4"}),"ๆทปๅŠ ็พคๅท"]})]}),a.chat.group_list.map((m,h)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{type:"number",value:m,onChange:f=>d("group",h,parseInt(f.target.value)||0),placeholder:"่พ“ๅ…ฅ็พคๅท",className:"text-sm md:text-base"}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(os,{className:"h-4 w-4"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsxs(gs,{children:["็กฎๅฎš่ฆๅˆ ้™ค็พคๅท ",m," ๅ—๏ผŸๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:()=>c("group",h),children:"ๅˆ ้™ค"})]})]})]})]},h)),a.chat.group_list.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๆš‚ๆ— ็พค็ป„"})]})]}),e.jsxs("div",{className:"space-y-3 md:space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-sm md:text-base",children:"็ง่Šๅๅ•็ฑปๅž‹"}),e.jsxs(Pe,{value:a.chat.private_list_type,onValueChange:m=>l({...a,chat:{...a.chat,private_list_type:m}}),children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"whitelist",children:"็™ฝๅๅ•๏ผˆไป…ๅๅ•ๅ†…ๅฏ่Šๅคฉ๏ผ‰"}),e.jsx(W,{value:"blacklist",children:"้ป‘ๅๅ•๏ผˆๅๅ•ๅ†…็ฆๆญข่Šๅคฉ๏ผ‰"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[e.jsx(T,{className:"text-sm md:text-base",children:"็ง่Šๅˆ—่กจ"}),e.jsxs(_,{onClick:()=>r("private"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(Ua,{className:"mr-1 h-4 w-4"}),"ๆทปๅŠ ็”จๆˆท"]})]}),a.chat.private_list.map((m,h)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{type:"number",value:m,onChange:f=>d("private",h,parseInt(f.target.value)||0),placeholder:"่พ“ๅ…ฅQQๅท",className:"text-sm md:text-base"}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(os,{className:"h-4 w-4"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsxs(gs,{children:["็กฎๅฎš่ฆๅˆ ้™ค็”จๆˆท ",m," ๅ—๏ผŸๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:()=>c("private",h),children:"ๅˆ ้™ค"})]})]})]})]},h)),a.chat.private_list.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๆš‚ๆ— ็”จๆˆท"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-sm md:text-base",children:"ๅ…จๅฑ€็ฆๆญขๅๅ•"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"ๅๅ•ไธญ็š„็”จๆˆทๆ— ๆณ•่ฟ›่กŒไปปไฝ•่Šๅคฉ"})]}),e.jsxs(_,{onClick:()=>r("ban"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(Ua,{className:"mr-1 h-4 w-4"}),"ๆทปๅŠ ็”จๆˆท"]})]}),a.chat.ban_user_id.map((m,h)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{type:"number",value:m,onChange:f=>d("ban",h,parseInt(f.target.value)||0),placeholder:"่พ“ๅ…ฅQQๅท",className:"text-sm md:text-base"}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(os,{className:"h-4 w-4"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsxs(gs,{children:["็กฎๅฎš่ฆไปŽๅ…จๅฑ€็ฆๆญขๅๅ•ไธญๅˆ ้™ค็”จๆˆท ",m," ๅ—๏ผŸๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:()=>c("ban",h),children:"ๅˆ ้™ค"})]})]})]})]},h)),a.chat.ban_user_id.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๆš‚ๆ— ็ฆๆญข็”จๆˆท"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-sm md:text-base",children:"ๅฑ่”ฝQQๅฎ˜ๆ–นๆœบๅ™จไบบ"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"ๆ˜ฏๅฆๅฑ่”ฝๆฅ่‡ชQQๅฎ˜ๆ–นๆœบๅ™จไบบ็š„ๆถˆๆฏ"})]}),e.jsx(Ge,{checked:a.chat.ban_qq_bot,onCheckedChange:m=>l({...a,chat:{...a.chat,ban_qq_bot:m}})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-sm md:text-base",children:"ๅฏ็”จๆˆณไธ€ๆˆณๅŠŸ่ƒฝ"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"ๆ˜ฏๅฆๅ“ๅบ”ๆˆณไธ€ๆˆณๆถˆๆฏ"})]}),e.jsx(Ge,{checked:a.chat.enable_poke,onCheckedChange:m=>l({...a,chat:{...a.chat,enable_poke:m}})})]})]})]})})}function I4({config:a,onChange:l}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"ๅ‘้€่ฏญ้Ÿณ่ฎพ็ฝฎ"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-sm md:text-base",children:"ไฝฟ็”จ TTS ่ฏญ้Ÿณ"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"่ฏท็กฎไฟๅทฒ้…็ฝฎ TTS ๅนถๆœ‰ๅฏนๅบ”็š„้€‚้…ๅ™จ"})]}),e.jsx(Ge,{checked:a.voice.use_tts,onCheckedChange:r=>l({...a,voice:{...a.voice,use_tts:r}})})]})]}),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-2",children:[e.jsx(T,{htmlFor:"image-threshold",className:"text-sm md:text-base",children:"ๅ›พ็‰‡ๆ•ฐ้‡้˜ˆๅ€ผ"}),e.jsx(ne,{id:"image-threshold",type:"number",value:a.forward.image_threshold||"",onChange:r=>l({...a,forward:{...a.forward,image_threshold:r.target.value?parseInt(r.target.value):0}}),placeholder:"30",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"่ฝฌๅ‘ๆถˆๆฏไธญๅ›พ็‰‡ๆ•ฐ้‡่ถ…่ฟ‡ๆญคๅ€ผๆ—ถไฝฟ็”จๅ ไฝ็ฌฆ๏ผˆ้ฟๅ…้บฆ้บฆVLMๅค„็†ๅกๆญป๏ผ‰"})]})]})]})}function P4({config:a,onChange:l}){return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"่ฐƒ่ฏ•่ฎพ็ฝฎ"}),e.jsx("div",{className:"grid gap-3 md:gap-4",children:e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-sm md:text-base",children:"ๆ—ฅๅฟ—็ญ‰็บง"}),e.jsxs(Pe,{value:a.debug.level,onValueChange:r=>l({...a,debug:{level:r}}),children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"DEBUG",children:"DEBUG๏ผˆ่ฐƒ่ฏ•๏ผ‰"}),e.jsx(W,{value:"INFO",children:"INFO๏ผˆไฟกๆฏ๏ผ‰"}),e.jsx(W,{value:"WARNING",children:"WARNING๏ผˆ่ญฆๅ‘Š๏ผ‰"}),e.jsx(W,{value:"ERROR",children:"ERROR๏ผˆ้”™่ฏฏ๏ผ‰"}),e.jsx(W,{value:"CRITICAL",children:"CRITICAL๏ผˆไธฅ้‡๏ผ‰"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"่ฎพ็ฝฎ้€‚้…ๅ™จ็š„ๆ—ฅๅฟ—่พ“ๅ‡บ็ญ‰็บง"})]})})]})})}const F4=["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"],H4=/^(aria-|data-)/,oN=a=>Object.fromEntries(Object.entries(a).filter(([l])=>H4.test(l)||F4.includes(l)));function q4(a,l){const r=oN(a);return Object.keys(a).some(c=>!Object.hasOwn(r,c)&&a[c]!==l[c])}class V4 extends u.Component{container;plugin;componentDidMount(){this.installPlugin()}componentDidUpdate(l){if(l.uppy!==this.props.uppy)this.uninstallPlugin(l),this.installPlugin();else if(q4(this.props,l)){const{uppy:r,...c}={...this.props,target:this.container};this.plugin.setOptions(c)}}componentWillUnmount(){this.uninstallPlugin()}installPlugin(){const{uppy:l,...r}={id:"Dashboard",...this.props,inline:!0,target:this.container};l.use(v_,r),this.plugin=l.getPlugin(r.id)}uninstallPlugin(l=this.props){const{uppy:r}=l;r.removePlugin(this.plugin)}render(){return u.createElement("div",{className:"uppy-Container",ref:l=>{this.container=l},...oN(this.props)})}}function G4({src:a,alt:l="่กจๆƒ…ๅŒ…",className:r,maxRetries:c=5,retryInterval:d=1500}){const[m,h]=u.useState("loading"),[f,p]=u.useState(0),[g,N]=u.useState(null),[j,b]=u.useState(a);a!==j&&(h("loading"),p(0),N(null),b(a));const y=u.useCallback(async()=>{try{const w=await fetch(a,{credentials:"include"});if(w.status===202){h("generating"),f{p(S=>S+1)},d):h("error");return}if(!w.ok){h("error");return}const z=await w.blob(),M=URL.createObjectURL(z);N(M),h("loaded")}catch(w){console.error("ๅŠ ่ฝฝ็ผฉ็•ฅๅ›พๅคฑ่ดฅ:",w),h("error")}},[a,f,c,d]);return u.useEffect(()=>{y()},[y]),u.useEffect(()=>()=>{g&&URL.revokeObjectURL(g)},[g]),m==="loading"||m==="generating"?e.jsx(ks,{className:P("w-full h-full",r)}):m==="error"||!g?e.jsx("div",{className:P("w-full h-full flex items-center justify-center bg-muted",r),children:e.jsx(xx,{className:"h-8 w-8 text-muted-foreground"})}):e.jsx("img",{src:g,alt:l,className:P("w-full h-full object-contain",r)})}function K4({children:a,className:l}){return e.jsx(bx,{content:a,className:l})}const al="/api/webui/emoji";async function Q4(a){const l=new URLSearchParams;a.page&&l.append("page",a.page.toString()),a.page_size&&l.append("page_size",a.page_size.toString()),a.search&&l.append("search",a.search),a.is_registered!==void 0&&l.append("is_registered",a.is_registered.toString()),a.is_banned!==void 0&&l.append("is_banned",a.is_banned.toString()),a.format&&l.append("format",a.format),a.sort_by&&l.append("sort_by",a.sort_by),a.sort_order&&l.append("sort_order",a.sort_order);const r=await ke(`${al}/list?${l}`,{});if(!r.ok)throw new Error(`่Žทๅ–่กจๆƒ…ๅŒ…ๅˆ—่กจๅคฑ่ดฅ: ${r.statusText}`);return r.json()}async function Y4(a){const l=await ke(`${al}/${a}`,{});if(!l.ok)throw new Error(`่Žทๅ–่กจๆƒ…ๅŒ…่ฏฆๆƒ…ๅคฑ่ดฅ: ${l.statusText}`);return l.json()}async function J4(a,l){const r=await ke(`${al}/${a}`,{method:"PATCH",body:JSON.stringify(l)});if(!r.ok)throw new Error(`ๆ›ดๆ–ฐ่กจๆƒ…ๅŒ…ๅคฑ่ดฅ: ${r.statusText}`);return r.json()}async function X4(a){const l=await ke(`${al}/${a}`,{method:"DELETE"});if(!l.ok)throw new Error(`ๅˆ ้™ค่กจๆƒ…ๅŒ…ๅคฑ่ดฅ: ${l.statusText}`);return l.json()}async function Z4(){const a=await ke(`${al}/stats/summary`,{});if(!a.ok)throw new Error(`่Žทๅ–็ปŸ่ฎกๆ•ฐๆฎๅคฑ่ดฅ: ${a.statusText}`);return a.json()}async function W4(a){const l=await ke(`${al}/${a}/register`,{method:"POST"});if(!l.ok)throw new Error(`ๆณจๅ†Œ่กจๆƒ…ๅŒ…ๅคฑ่ดฅ: ${l.statusText}`);return l.json()}async function ek(a){const l=await ke(`${al}/${a}/ban`,{method:"POST"});if(!l.ok)throw new Error(`ๅฐ็ฆ่กจๆƒ…ๅŒ…ๅคฑ่ดฅ: ${l.statusText}`);return l.json()}function sk(a,l=!1){return l?`${al}/${a}/thumbnail?original=true`:`${al}/${a}/thumbnail`}function tk(a){return`${al}/${a}/thumbnail?original=true`}async function ak(a){const l=await ke(`${al}/batch/delete`,{method:"POST",body:JSON.stringify({emoji_ids:a})});if(!l.ok){const r=await l.json();throw new Error(r.detail||"ๆ‰น้‡ๅˆ ้™คๅคฑ่ดฅ")}return l.json()}function lk(){return`${al}/upload`}function nk(){const[a,l]=u.useState([]),[r,c]=u.useState(null),[d,m]=u.useState(!1),[h,f]=u.useState(1),[p,g]=u.useState(0),[N,j]=u.useState(20),[b,y]=u.useState("all"),[w,z]=u.useState("all"),[M,S]=u.useState("all"),[F,E]=u.useState("usage_count"),[C,R]=u.useState("desc"),[H,O]=u.useState(null),[X,L]=u.useState(!1),[me,Ne]=u.useState(!1),[je,ce]=u.useState(!1),[ge,pe]=u.useState(new Set),[D,Q]=u.useState(!1),[B,ue]=u.useState(""),[Y,we]=u.useState("medium"),[fe,Ee]=u.useState(!1),{toast:G}=nt(),$=u.useCallback(async()=>{try{m(!0);const xe=await Q4({page:h,page_size:N,is_registered:b==="all"?void 0:b==="registered",is_banned:w==="all"?void 0:w==="banned",format:M==="all"?void 0:M,sort_by:F,sort_order:C});l(xe.data),g(xe.total)}catch(xe){const Me=xe instanceof Error?xe.message:"ๅŠ ่ฝฝ่กจๆƒ…ๅŒ…ๅˆ—่กจๅคฑ่ดฅ";G({title:"้”™่ฏฏ",description:Me,variant:"destructive"})}finally{m(!1)}},[h,N,b,w,M,F,C,G]),A=async()=>{try{const xe=await Z4();c(xe.data)}catch(xe){console.error("ๅŠ ่ฝฝ็ปŸ่ฎกๆ•ฐๆฎๅคฑ่ดฅ:",xe)}};u.useEffect(()=>{$()},[$]),u.useEffect(()=>{A()},[]);const K=async xe=>{try{const Me=await Y4(xe.id);O(Me.data),L(!0)}catch(Me){const ds=Me instanceof Error?Me.message:"ๅŠ ่ฝฝ่ฏฆๆƒ…ๅคฑ่ดฅ";G({title:"้”™่ฏฏ",description:ds,variant:"destructive"})}},Re=xe=>{O(xe),Ne(!0)},se=xe=>{O(xe),ce(!0)},$e=async()=>{if(H)try{await X4(H.id),G({title:"ๆˆๅŠŸ",description:"่กจๆƒ…ๅŒ…ๅทฒๅˆ ้™ค"}),ce(!1),O(null),$(),A()}catch(xe){const Me=xe instanceof Error?xe.message:"ๅˆ ้™คๅคฑ่ดฅ";G({title:"้”™่ฏฏ",description:Me,variant:"destructive"})}},cs=async xe=>{try{await W4(xe.id),G({title:"ๆˆๅŠŸ",description:"่กจๆƒ…ๅŒ…ๅทฒๆณจๅ†Œ"}),$(),A()}catch(Me){const ds=Me instanceof Error?Me.message:"ๆณจๅ†Œๅคฑ่ดฅ";G({title:"้”™่ฏฏ",description:ds,variant:"destructive"})}},J=async xe=>{try{await ek(xe.id),G({title:"ๆˆๅŠŸ",description:"่กจๆƒ…ๅŒ…ๅทฒๅฐ็ฆ"}),$(),A()}catch(Me){const ds=Me instanceof Error?Me.message:"ๅฐ็ฆๅคฑ่ดฅ";G({title:"้”™่ฏฏ",description:ds,variant:"destructive"})}},Z=xe=>{const Me=new Set(ge);Me.has(xe)?Me.delete(xe):Me.add(xe),pe(Me)},Le=async()=>{try{const xe=await ak(Array.from(ge));G({title:"ๆ‰น้‡ๅˆ ้™คๅฎŒๆˆ",description:xe.message}),pe(new Set),Q(!1),$(),A()}catch(xe){G({title:"ๆ‰น้‡ๅˆ ้™คๅคฑ่ดฅ",description:xe instanceof Error?xe.message:"ๆ‰น้‡ๅˆ ้™คๅคฑ่ดฅ",variant:"destructive"})}},le=()=>{const xe=parseInt(B),Me=Math.ceil(p/N);xe>=1&&xe<=Me?(f(xe),ue("")):G({title:"ๆ— ๆ•ˆ็š„้กต็ ",description:`่ฏท่พ“ๅ…ฅ1-${Me}ไน‹้—ด็š„้กต็ `,variant:"destructive"})},De=r?.formats?Object.keys(r.formats):[];return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsxs("div",{className:"mb-4 sm:mb-6 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"่กจๆƒ…ๅŒ…็ฎก็†"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"็ฎก็†้บฆ้บฆ็š„่กจๆƒ…ๅŒ…่ต„ๆบ"})]}),e.jsxs(_,{onClick:()=>Ee(!0),className:"gap-2",children:[e.jsx(cc,{className:"h-4 w-4"}),"ไธŠไผ ่กจๆƒ…ๅŒ…"]})]}),e.jsx(ts,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[r&&e.jsxs("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[e.jsx(Te,{children:e.jsxs(Oe,{className:"pb-2",children:[e.jsx(Ns,{children:"ๆ€ปๆ•ฐ"}),e.jsx(Ue,{className:"text-2xl",children:r.total})]})}),e.jsx(Te,{children:e.jsxs(Oe,{className:"pb-2",children:[e.jsx(Ns,{children:"ๅทฒๆณจๅ†Œ"}),e.jsx(Ue,{className:"text-2xl text-green-600",children:r.registered})]})}),e.jsx(Te,{children:e.jsxs(Oe,{className:"pb-2",children:[e.jsx(Ns,{children:"ๅทฒๅฐ็ฆ"}),e.jsx(Ue,{className:"text-2xl text-red-600",children:r.banned})]})}),e.jsx(Te,{children:e.jsxs(Oe,{className:"pb-2",children:[e.jsx(Ns,{children:"ๆœชๆณจๅ†Œ"}),e.jsx(Ue,{className:"text-2xl text-gray-600",children:r.unregistered})]})})]}),e.jsxs(Te,{children:[e.jsx(Oe,{children:e.jsxs(Ue,{className:"flex items-center gap-2",children:[e.jsx(Po,{className:"h-5 w-5"}),"็ญ›้€‰ๅ’ŒๆŽ’ๅบ"]})}),e.jsxs(ze,{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"ๆŽ’ๅบๆ–นๅผ"}),e.jsxs(Pe,{value:`${F}-${C}`,onValueChange:xe=>{const[Me,ds]=xe.split("-");E(Me),R(ds),f(1)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"usage_count-desc",children:"ไฝฟ็”จๆฌกๆ•ฐ (ๅคšโ†’ๅฐ‘)"}),e.jsx(W,{value:"usage_count-asc",children:"ไฝฟ็”จๆฌกๆ•ฐ (ๅฐ‘โ†’ๅคš)"}),e.jsx(W,{value:"register_time-desc",children:"ๆณจๅ†Œๆ—ถ้—ด (ๆ–ฐโ†’ๆ—ง)"}),e.jsx(W,{value:"register_time-asc",children:"ๆณจๅ†Œๆ—ถ้—ด (ๆ—งโ†’ๆ–ฐ)"}),e.jsx(W,{value:"record_time-desc",children:"่ฎฐๅฝ•ๆ—ถ้—ด (ๆ–ฐโ†’ๆ—ง)"}),e.jsx(W,{value:"record_time-asc",children:"่ฎฐๅฝ•ๆ—ถ้—ด (ๆ—งโ†’ๆ–ฐ)"}),e.jsx(W,{value:"last_used_time-desc",children:"ๆœ€ๅŽไฝฟ็”จ (ๆ–ฐโ†’ๆ—ง)"}),e.jsx(W,{value:"last_used_time-asc",children:"ๆœ€ๅŽไฝฟ็”จ (ๆ—งโ†’ๆ–ฐ)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"ๆณจๅ†Œ็Šถๆ€"}),e.jsxs(Pe,{value:b,onValueChange:xe=>{y(xe),f(1)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"all",children:"ๅ…จ้ƒจ"}),e.jsx(W,{value:"registered",children:"ๅทฒๆณจๅ†Œ"}),e.jsx(W,{value:"unregistered",children:"ๆœชๆณจๅ†Œ"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"ๅฐ็ฆ็Šถๆ€"}),e.jsxs(Pe,{value:w,onValueChange:xe=>{z(xe),f(1)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"all",children:"ๅ…จ้ƒจ"}),e.jsx(W,{value:"banned",children:"ๅทฒๅฐ็ฆ"}),e.jsx(W,{value:"unbanned",children:"ๆœชๅฐ็ฆ"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"ๆ ผๅผ"}),e.jsxs(Pe,{value:M,onValueChange:xe=>{S(xe),f(1)},children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"all",children:"ๅ…จ้ƒจ"}),De.map(xe=>e.jsxs(W,{value:xe,children:[xe.toUpperCase()," (",r?.formats[xe],")"]},xe))]})]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 pt-4 border-t",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[ge.size>0&&e.jsxs("span",{className:"text-sm text-muted-foreground",children:["ๅทฒ้€‰ๆ‹ฉ ",ge.size," ไธช่กจๆƒ…ๅŒ…"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{className:"text-sm whitespace-nowrap",children:"ๅก็‰‡ๅคงๅฐ"}),e.jsxs(Pe,{value:Y,onValueChange:xe=>we(xe),children:[e.jsx(Be,{className:"w-24",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"small",children:"ๅฐ"}),e.jsx(W,{value:"medium",children:"ไธญ"}),e.jsx(W,{value:"large",children:"ๅคง"})]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{htmlFor:"emoji-page-size",className:"text-sm whitespace-nowrap",children:"ๆฏ้กตๆ˜พ็คบ"}),e.jsxs(Pe,{value:N.toString(),onValueChange:xe=>{j(parseInt(xe)),f(1),pe(new Set)},children:[e.jsx(Be,{id:"emoji-page-size",className:"w-20",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"20",children:"20"}),e.jsx(W,{value:"40",children:"40"}),e.jsx(W,{value:"60",children:"60"}),e.jsx(W,{value:"100",children:"100"})]})]}),ge.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>pe(new Set),children:"ๅ–ๆถˆ้€‰ๆ‹ฉ"}),e.jsxs(_,{variant:"destructive",size:"sm",onClick:()=>Q(!0),children:[e.jsx(os,{className:"h-4 w-4 mr-1"}),"ๆ‰น้‡ๅˆ ้™ค"]})]})]})]}),e.jsx("div",{className:"flex justify-end pt-4 border-t",children:e.jsxs(_,{variant:"outline",size:"sm",onClick:$,disabled:d,children:[e.jsx(dt,{className:`h-4 w-4 mr-2 ${d?"animate-spin":""}`}),"ๅˆทๆ–ฐ"]})})]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"่กจๆƒ…ๅŒ…ๅˆ—่กจ"}),e.jsxs(Ns,{children:["ๅ…ฑ ",p," ไธช่กจๆƒ…ๅŒ…๏ผŒๅฝ“ๅ‰็ฌฌ ",h," ้กต"]})]}),e.jsxs(ze,{children:[a.length===0?e.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"ๆš‚ๆ— ๆ•ฐๆฎ"}):e.jsx("div",{className:`grid gap-3 ${Y==="small"?"grid-cols-3 sm:grid-cols-4 md:grid-cols-6 lg:grid-cols-8 xl:grid-cols-10":Y==="medium"?"grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 xl:grid-cols-8":"grid-cols-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5"}`,children:a.map(xe=>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(xe.id)?"ring-2 ring-primary bg-primary/5":""}`,onClick:()=>Z(xe.id),children:[e.jsx("div",{className:`absolute top-1 left-1 z-10 transition-opacity ${ge.has(xe.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(xe.id)?"bg-primary border-primary text-primary-foreground":"bg-background/80 border-muted-foreground/50"}`,children:ge.has(xe.id)&&e.jsx(st,{className:"h-3 w-3"})})}),e.jsxs("div",{className:"absolute top-1 right-1 z-10 flex flex-col gap-0.5",children:[xe.is_registered&&e.jsx(Ce,{variant:"default",className:"bg-green-600 text-[10px] px-1 py-0",children:"ๅทฒๆณจๅ†Œ"}),xe.is_banned&&e.jsx(Ce,{variant:"destructive",className:"text-[10px] px-1 py-0",children:"ๅทฒๅฐ็ฆ"})]}),e.jsx("div",{className:`aspect-square bg-muted flex items-center justify-center overflow-hidden ${Y==="small"?"p-1":Y==="medium"?"p-2":"p-3"}`,children:e.jsx(G4,{src:sk(xe.id),alt:"่กจๆƒ…ๅŒ…"})}),e.jsxs("div",{className:`border-t bg-card ${Y==="small"?"p-1":"p-2"}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-1 text-xs text-muted-foreground mb-1",children:[e.jsx(Ce,{variant:"outline",className:"text-[10px] px-1 py-0",children:xe.format.toUpperCase()}),e.jsxs("span",{className:"font-mono",children:[xe.usage_count,"ๆฌก"]})]}),e.jsxs("div",{className:`flex gap-1 justify-center opacity-0 group-hover:opacity-100 transition-opacity ${Y==="small"?"flex-wrap":""}`,children:[e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Me=>{Me.stopPropagation(),Re(xe)},title:"็ผ–่พ‘",children:e.jsx(sr,{className:"h-3 w-3"})}),e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Me=>{Me.stopPropagation(),K(xe)},title:"่ฏฆๆƒ…",children:e.jsx(Yt,{className:"h-3 w-3"})}),!xe.is_registered&&e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6 text-green-600 hover:text-green-700",onClick:Me=>{Me.stopPropagation(),cs(xe)},title:"ๆณจๅ†Œ",children:e.jsx(st,{className:"h-3 w-3"})}),!xe.is_banned&&e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6 text-orange-600 hover:text-orange-700",onClick:Me=>{Me.stopPropagation(),J(xe)},title:"ๅฐ็ฆ",children:e.jsx(iv,{className:"h-3 w-3"})}),e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6 text-red-600 hover:text-red-700",onClick:Me=>{Me.stopPropagation(),se(xe)},title:"ๅˆ ้™ค",children:e.jsx(os,{className:"h-3 w-3"})})]})]})]},xe.id))}),p>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["ๆ˜พ็คบ ",(h-1)*N+1," ๅˆฐ"," ",Math.min(h*N,p)," ๆก๏ผŒๅ…ฑ ",p," ๆก"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(kn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(xe=>Math.max(1,xe-1)),disabled:h===1,children:[e.jsx(Pa,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"ไธŠไธ€้กต"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{type:"number",value:B,onChange:xe=>ue(xe.target.value),onKeyDown:xe=>xe.key==="Enter"&&le(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(p/N)}),e.jsx(_,{variant:"outline",size:"sm",onClick:le,disabled:!B,className:"h-8",children:"่ทณ่ฝฌ"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(xe=>xe+1),disabled:h>=Math.ceil(p/N),children:[e.jsx("span",{className:"hidden sm:inline",children:"ไธ‹ไธ€้กต"}),e.jsx(ra,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(p/N)),disabled:h>=Math.ceil(p/N),className:"hidden sm:flex",children:e.jsx(Cn,{className:"h-4 w-4"})})]})]})]})]}),e.jsx(rk,{emoji:H,open:X,onOpenChange:L}),e.jsx(ik,{emoji:H,open:me,onOpenChange:Ne,onSuccess:()=>{$(),A()}}),e.jsx(ck,{open:fe,onOpenChange:Ee,onSuccess:()=>{$(),A()}})]})}),e.jsx(bs,{open:D,onOpenChange:Q,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๆ‰น้‡ๅˆ ้™ค"}),e.jsxs(gs,{children:["ไฝ ็กฎๅฎš่ฆๅˆ ้™ค้€‰ไธญ็š„ ",ge.size," ไธช่กจๆƒ…ๅŒ…ๅ—๏ผŸๆญคๆ“ไฝœไธๅฏๆ’ค้”€ใ€‚"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:Le,children:"็กฎ่ฎคๅˆ ้™ค"})]})]})}),e.jsx(Qs,{open:je,onOpenChange:ce,children:e.jsxs(Hs,{children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsx(at,{children:"็กฎๅฎš่ฆๅˆ ้™ค่ฟ™ไธช่กจๆƒ…ๅŒ…ๅ—๏ผŸๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚"})]}),e.jsxs(gt,{children:[e.jsx(_,{variant:"outline",onClick:()=>ce(!1),children:"ๅ–ๆถˆ"}),e.jsx(_,{variant:"destructive",onClick:$e,children:"ๅˆ ้™ค"})]})]})})]})}function rk({emoji:a,open:l,onOpenChange:r}){if(!a)return null;const c=d=>d?new Date(d*1e3).toLocaleString("zh-CN"):"-";return e.jsx(Qs,{open:l,onOpenChange:r,children:e.jsxs(Hs,{className:"max-w-2xl max-h-[90vh]",children:[e.jsx(qs,{children:e.jsx(Vs,{children:"่กจๆƒ…ๅŒ…่ฏฆๆƒ…"})}),e.jsx(ts,{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:tk(a.id),alt:a.description||"่กจๆƒ…ๅŒ…",className:"w-full h-full object-cover",onError:d=>{const m=d.target;m.style.display="none";const h=m.parentElement;h&&(h.innerHTML='')}})})}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"ID"}),e.jsx("div",{className:"mt-1 font-mono",children:a.id})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"ๆ ผๅผ"}),e.jsx("div",{className:"mt-1",children:e.jsx(Ce,{variant:"outline",children:a.format.toUpperCase()})})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"ๆ–‡ไปถ่ทฏๅพ„"}),e.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:a.full_path})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"ๅ“ˆๅธŒๅ€ผ"}),e.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:a.emoji_hash})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"ๆ่ฟฐ"}),a.description?e.jsx("div",{className:"mt-1 rounded-lg border bg-muted/50 p-3",children:e.jsx(K4,{className:"prose-sm",children:a.description})}):e.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:"-"})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"ๆƒ…็ปช"}),e.jsx("div",{className:"mt-1",children:a.emotion?e.jsx("span",{className:"text-sm",children:a.emotion}):e.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"็Šถๆ€"}),e.jsxs("div",{className:"mt-2 flex gap-2",children:[a.is_registered&&e.jsx(Ce,{variant:"default",className:"bg-green-600",children:"ๅทฒๆณจๅ†Œ"}),a.is_banned&&e.jsx(Ce,{variant:"destructive",children:"ๅทฒๅฐ็ฆ"}),!a.is_registered&&!a.is_banned&&e.jsx(Ce,{variant:"outline",children:"ๆœชๆณจๅ†Œ"})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"ไฝฟ็”จๆฌกๆ•ฐ"}),e.jsx("div",{className:"mt-1 font-mono text-lg",children:a.usage_count})]})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"่ฎฐๅฝ•ๆ—ถ้—ด"}),e.jsx("div",{className:"mt-1 text-sm",children:c(a.record_time)})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"ๆณจๅ†Œๆ—ถ้—ด"}),e.jsx("div",{className:"mt-1 text-sm",children:c(a.register_time)})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"ๆœ€ๅŽไฝฟ็”จ"}),e.jsx("div",{className:"mt-1 text-sm",children:c(a.last_used_time)})]})]})})]})})}function ik({emoji:a,open:l,onOpenChange:r,onSuccess:c}){const[d,m]=u.useState(""),[h,f]=u.useState(!1),[p,g]=u.useState(!1),[N,j]=u.useState(!1),{toast:b}=nt();u.useEffect(()=>{a&&(m(a.emotion||""),f(a.is_registered),g(a.is_banned))},[a]);const y=async()=>{if(a)try{j(!0);const w=d.split(/[,,]/).map(z=>z.trim()).filter(Boolean).join(",");await J4(a.id,{emotion:w||void 0,is_registered:h,is_banned:p}),b({title:"ๆˆๅŠŸ",description:"่กจๆƒ…ๅŒ…ไฟกๆฏๅทฒๆ›ดๆ–ฐ"}),r(!1),c()}catch(w){const z=w instanceof Error?w.message:"ไฟๅญ˜ๅคฑ่ดฅ";b({title:"้”™่ฏฏ",description:z,variant:"destructive"})}finally{j(!1)}};return a?e.jsx(Qs,{open:l,onOpenChange:r,children:e.jsxs(Hs,{className:"max-w-2xl",children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"็ผ–่พ‘่กจๆƒ…ๅŒ…"}),e.jsx(at,{children:"ไฟฎๆ”น่กจๆƒ…ๅŒ…็š„ๆƒ…็ปชๅ’Œ็Šถๆ€ไฟกๆฏ"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(T,{children:"ๆƒ…็ปช"}),e.jsx(pt,{value:d,onChange:w=>m(w.target.value),placeholder:"่พ“ๅ…ฅๆƒ…็ปชๆ่ฟฐ...",rows:2,className:"mt-1"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"่พ“ๅ…ฅๆƒ…็ปช็›ธๅ…ณ็š„ๆ–‡ๆœฌๆ่ฟฐ"})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(tt,{id:"is_registered",checked:h,onCheckedChange:w=>{w===!0?(f(!0),g(!1)):f(!1)}}),e.jsx(T,{htmlFor:"is_registered",className:"cursor-pointer",children:"ๅทฒๆณจๅ†Œ"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(tt,{id:"is_banned",checked:p,onCheckedChange:w=>{w===!0?(g(!0),f(!1)):g(!1)}}),e.jsx(T,{htmlFor:"is_banned",className:"cursor-pointer",children:"ๅทฒๅฐ็ฆ"})]})]})]}),e.jsxs(gt,{children:[e.jsx(_,{variant:"outline",onClick:()=>r(!1),children:"ๅ–ๆถˆ"}),e.jsx(_,{onClick:y,disabled:N,children:N?"ไฟๅญ˜ไธญ...":"ไฟๅญ˜"})]})]})}):null}function ck({open:a,onOpenChange:l,onSuccess:r}){const[c,d]=u.useState("select"),[m,h]=u.useState([]),[f,p]=u.useState(null),[g,N]=u.useState(!1),{toast:j}=nt(),b=u.useMemo(()=>new N_({id:"emoji-uploader",autoProceed:!1,restrictions:{maxFileSize:10485760,allowedFileTypes:["image/jpeg","image/png","image/gif","image/webp"],maxNumberOfFiles:20},locale:{pluralize:()=>0,strings:{addMoreFiles:"ๆทปๅŠ ๆ›ดๅคšๆ–‡ไปถ",addingMoreFiles:"ๆญฃๅœจๆทปๅŠ ๆ›ดๅคšๆ–‡ไปถ",allowedFileTypes:"ๅ…่ฎธ็š„ๆ–‡ไปถ็ฑปๅž‹๏ผš%{types}",cancel:"ๅ–ๆถˆ",closeModal:"ๅ…ณ้—ญ",complete:"ๅฎŒๆˆ",connectedToInternet:"ๅทฒ่ฟžๆŽฅๅˆฐไบ’่”็ฝ‘",copyLink:"ๅคๅˆถ้“พๆŽฅ",copyLinkToClipboardFallback:"ๅคๅˆถไธ‹ๆ–น้“พๆŽฅ",copyLinkToClipboardSuccess:"้“พๆŽฅๅทฒๅคๅˆถๅˆฐๅ‰ช่ดดๆฟ",dashboardTitle:"้€‰ๆ‹ฉๆ–‡ไปถ",dashboardWindowTitle:"ๆ–‡ไปถ้€‰ๆ‹ฉ็ช—ๅฃ๏ผˆๆŒ‰ ESC ๅ…ณ้—ญ๏ผ‰",done:"ๅฎŒๆˆ",dropHereOr:"ๆ‹–ๆ”พๆ–‡ไปถๅˆฐ่ฟ™้‡Œๆˆ– %{browse}",dropHint:"ๅฐ†ๆ–‡ไปถๆ‹–ๆ”พๅˆฐๆญคๅค„",dropPasteFiles:"ๅฐ†ๆ–‡ไปถๆ‹–ๆ”พๅˆฐ่ฟ™้‡Œๆˆ– %{browseFiles}",dropPasteFolders:"ๅฐ†ๆ–‡ไปถๆ‹–ๆ”พๅˆฐ่ฟ™้‡Œๆˆ– %{browseFolders}",dropPasteBoth:"ๅฐ†ๆ–‡ไปถๆ‹–ๆ”พๅˆฐ่ฟ™้‡Œ๏ผŒ%{browseFiles} ๆˆ– %{browseFolders}",dropPasteImportFiles:"ๅฐ†ๆ–‡ไปถๆ‹–ๆ”พๅˆฐ่ฟ™้‡Œ๏ผŒ%{browseFiles} ๆˆ–ไปŽไปฅไธ‹ไฝ็ฝฎๅฏผๅ…ฅ๏ผš",dropPasteImportFolders:"ๅฐ†ๆ–‡ไปถๆ‹–ๆ”พๅˆฐ่ฟ™้‡Œ๏ผŒ%{browseFolders} ๆˆ–ไปŽไปฅไธ‹ไฝ็ฝฎๅฏผๅ…ฅ๏ผš",dropPasteImportBoth:"ๅฐ†ๆ–‡ไปถๆ‹–ๆ”พๅˆฐ่ฟ™้‡Œ๏ผŒ%{browseFiles}๏ผŒ%{browseFolders} ๆˆ–ไปŽไปฅไธ‹ไฝ็ฝฎๅฏผๅ…ฅ๏ผš",editFile:"็ผ–่พ‘ๆ–‡ไปถ",editing:"ๆญฃๅœจ็ผ–่พ‘ %{file}",emptyFolderAdded:"ๆœชไปŽ็ฉบๆ–‡ไปถๅคนๆทปๅŠ ๆ–‡ไปถ",exceedsSize:"%{file} ่ถ…่ฟ‡ไบ†ๆœ€ๅคงๅ…่ฎธๅคงๅฐ %{size}",failedToUpload:"ไธŠไผ  %{file} ๅคฑ่ดฅ",fileSource:"ๆ–‡ไปถๆฅๆบ๏ผš%{name}",filesUploadedOfTotal:{0:"ๅทฒไธŠไผ  %{complete} / %{smart_count} ไธชๆ–‡ไปถ",1:"ๅทฒไธŠไผ  %{complete} / %{smart_count} ไธชๆ–‡ไปถ"},filter:"็ญ›้€‰",finishEditingFile:"ๅฎŒๆˆ็ผ–่พ‘ๆ–‡ไปถ",folderAdded:{0:"ๅทฒไปŽ %{folder} ๆทปๅŠ  %{smart_count} ไธชๆ–‡ไปถ",1:"ๅทฒไปŽ %{folder} ๆทปๅŠ  %{smart_count} ไธชๆ–‡ไปถ"},generatingThumbnails:"ๆญฃๅœจ็”Ÿๆˆ็ผฉ็•ฅๅ›พ...",import:"ๅฏผๅ…ฅ",importFiles:"ไปŽไปฅไธ‹ไฝ็ฝฎๅฏผๅ…ฅๆ–‡ไปถ๏ผš",importFrom:"ไปŽ %{name} ๅฏผๅ…ฅ",loading:"ๅŠ ่ฝฝไธญ...",logOut:"็™ปๅ‡บ",myDevice:"ๆˆ‘็š„่ฎพๅค‡",noFilesFound:"่ฟ™้‡Œๆฒกๆœ‰ๆ–‡ไปถๆˆ–ๆ–‡ไปถๅคน",noInternetConnection:"ๆ— ็ฝ‘็ปœ่ฟžๆŽฅ",openFolderNamed:"ๆ‰“ๅผ€ๆ–‡ไปถๅคน %{name}",pause:"ๆš‚ๅœ",pauseUpload:"ๆš‚ๅœไธŠไผ ",paused:"ๅทฒๆš‚ๅœ",poweredBy:"ๆŠ€ๆœฏๆ”ฏๆŒ๏ผš%{uppy}",processingXFiles:{0:"ๆญฃๅœจๅค„็† %{smart_count} ไธชๆ–‡ไปถ",1:"ๆญฃๅœจๅค„็† %{smart_count} ไธชๆ–‡ไปถ"},recording:"ๅฝ•ๅˆถไธญ",removeFile:"็งป้™คๆ–‡ไปถ",resetFilter:"้‡็ฝฎ็ญ›้€‰",resume:"็ปง็ปญ",resumeUpload:"็ปง็ปญไธŠไผ ",retry:"้‡่ฏ•",retryUpload:"้‡่ฏ•ไธŠไผ ",save:"ไฟๅญ˜",saveChanges:"ไฟๅญ˜ๆ›ดๆ”น",selectFileNamed:"้€‰ๆ‹ฉๆ–‡ไปถ %{name}",selectX:{0:"้€‰ๆ‹ฉ %{smart_count}",1:"้€‰ๆ‹ฉ %{smart_count}"},smile:"็ฌ‘ไธ€ไธช๏ผ",startRecording:"ๅผ€ๅง‹ๅฝ•ๅˆถ่ง†้ข‘",stopRecording:"ๅœๆญขๅฝ•ๅˆถ่ง†้ข‘",takePicture:"ๆ‹็…ง",timedOut:"ไธŠไผ ๅทฒๅœๆปž %{seconds} ็ง’๏ผŒๆญฃๅœจไธญๆญขใ€‚",upload:"ไธ‹ไธ€ๆญฅ",uploadComplete:"ไธŠไผ ๅฎŒๆˆ",uploadFailed:"ไธŠไผ ๅคฑ่ดฅ",uploadPaused:"ไธŠไผ ๅทฒๆš‚ๅœ",uploadXFiles:{0:"ไธ‹ไธ€ๆญฅ๏ผˆ%{smart_count} ไธชๆ–‡ไปถ๏ผ‰",1:"ไธ‹ไธ€ๆญฅ๏ผˆ%{smart_count} ไธชๆ–‡ไปถ๏ผ‰"},uploadXNewFiles:{0:"ไธ‹ไธ€ๆญฅ๏ผˆ+%{smart_count} ไธชๆ–‡ไปถ๏ผ‰",1:"ไธ‹ไธ€ๆญฅ๏ผˆ+%{smart_count} ไธชๆ–‡ไปถ๏ผ‰"},uploading:"ๆญฃๅœจไธŠไผ ",uploadingXFiles:{0:"ๆญฃๅœจไธŠไผ  %{smart_count} ไธชๆ–‡ไปถ",1:"ๆญฃๅœจไธŠไผ  %{smart_count} ไธชๆ–‡ไปถ"},xFilesSelected:{0:"ๅทฒ้€‰ๆ‹ฉ %{smart_count} ไธชๆ–‡ไปถ",1:"ๅทฒ้€‰ๆ‹ฉ %{smart_count} ไธชๆ–‡ไปถ"},xMoreFilesAdded:{0:"ๅˆๆทปๅŠ ไบ† %{smart_count} ไธชๆ–‡ไปถ",1:"ๅˆๆทปๅŠ ไบ† %{smart_count} ไธชๆ–‡ไปถ"},xTimeLeft:"ๅ‰ฉไฝ™ %{time}",youCanOnlyUploadFileTypes:"ๆ‚จๅช่ƒฝไธŠไผ ๏ผš%{types}",youCanOnlyUploadX:{0:"ๆ‚จๅช่ƒฝไธŠไผ  %{smart_count} ไธชๆ–‡ไปถ",1:"ๆ‚จๅช่ƒฝไธŠไผ  %{smart_count} ไธชๆ–‡ไปถ"},youHaveToAtLeastSelectX:{0:"ๆ‚จ่‡ณๅฐ‘้œ€่ฆ้€‰ๆ‹ฉ %{smart_count} ไธชๆ–‡ไปถ",1:"ๆ‚จ่‡ณๅฐ‘้œ€่ฆ้€‰ๆ‹ฉ %{smart_count} ไธชๆ–‡ไปถ"},browseFiles:"ๆต่งˆๆ–‡ไปถ",browseFolders:"ๆต่งˆๆ–‡ไปถๅคน",cancelUpload:"ๅ–ๆถˆไธŠไผ ",addMore:"ๆทปๅŠ ๆ›ดๅคš",back:"่ฟ”ๅ›ž",editFileWithFilename:"็ผ–่พ‘ๆ–‡ไปถ %{file}"}}}),[]);u.useEffect(()=>{const H=()=>{const O=b.getFiles();if(O.length===0)return;const X=O.map(L=>({id:L.id,name:L.name,previewUrl:L.preview||URL.createObjectURL(L.data),emotion:"",description:"",isRegistered:!0,file:L.data}));h(X),O.length===1?(p(X[0].id),d("edit-single")):d("edit-multiple")};return b.on("upload",H),()=>{b.off("upload",H)}},[b]),u.useEffect(()=>{a||(b.cancelAll(),d("select"),h([]),p(null),N(!1))},[a,b]);const y=u.useCallback((H,O)=>{h(X=>X.map(L=>L.id===H?{...L,...O}:L))},[]),w=u.useCallback(H=>H.emotion.trim().length>0,[]),z=u.useMemo(()=>m.length>0&&m.every(w),[m,w]),M=u.useMemo(()=>m.find(H=>H.id===f)||null,[m,f]),S=u.useCallback(()=>{(c==="edit-single"||c==="edit-multiple")&&(d("select"),h([]),p(null))},[c]),F=u.useCallback(async()=>{if(!z){j({title:"่ฏทๅกซๅ†™ๅฟ…ๅกซ้กน",description:"ๆฏไธช่กจๆƒ…ๅŒ…็š„ๆƒ…ๆ„Ÿๆ ‡็ญพ้ƒฝๆ˜ฏๅฟ…ๅกซ็š„",variant:"destructive"});return}N(!0);let H=0,O=0;try{for(const X of m){const L=new FormData;L.append("file",X.file),L.append("emotion",X.emotion),L.append("description",X.description),L.append("is_registered",X.isRegistered.toString());try{(await ke(lk(),{method:"POST",body:L})).ok?H++:O++}catch{O++}}O===0?(j({title:"ไธŠไผ ๆˆๅŠŸ",description:`ๆˆๅŠŸไธŠไผ  ${H} ไธช่กจๆƒ…ๅŒ…`}),l(!1),r()):(j({title:"้ƒจๅˆ†ไธŠไผ ๅคฑ่ดฅ",description:`ๆˆๅŠŸ ${H} ไธช๏ผŒๅคฑ่ดฅ ${O} ไธช`,variant:"destructive"}),r())}finally{N(!1)}},[z,m,j,l,r]),E=()=>e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"border rounded-lg overflow-hidden w-full",children:e.jsx(V4,{uppy:b,proudlyDisplayPoweredByUppy:!1,hideProgressDetails:!0,height:350,width:"100%",theme:"auto",note:"ๆ”ฏๆŒ JPGใ€PNGใ€GIFใ€WebP ๆ ผๅผ๏ผŒๆœ€ๅคš 20 ไธชๆ–‡ไปถ"})})}),C=()=>{const H=m[0];return H?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(_,{variant:"ghost",size:"sm",onClick:S,children:[e.jsx($a,{className:"h-4 w-4 mr-1"}),"่ฟ”ๅ›ž"]}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"็ผ–่พ‘่กจๆƒ…ๅŒ…ไฟกๆฏ"})]}),e.jsxs("div",{className:"flex gap-6",children:[e.jsxs("div",{className:"flex-shrink-0",children:[e.jsx("div",{className:"w-32 h-32 rounded-lg border overflow-hidden bg-muted flex items-center justify-center",children:e.jsx("img",{src:H.previewUrl,alt:H.name,className:"max-w-full max-h-full object-contain"})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2 text-center truncate max-w-32",children:H.name})]}),e.jsxs("div",{className:"flex-1 space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"single-emotion",children:["ๆƒ…ๆ„Ÿๆ ‡็ญพ ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ne,{id:"single-emotion",value:H.emotion,onChange:O=>y(H.id,{emotion:O.target.value}),placeholder:"ๅคšไธชๆ ‡็ญพ็”จ้€—ๅทๅˆ†้š”๏ผŒๅฆ‚๏ผšๅผ€ๅฟƒ,้ซ˜ๅ…ด",className:H.emotion.trim()?"":"border-destructive"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"็”จไบŽๆƒ…ๆ„ŸๅŒน้…๏ผŒๅคšไธชๆ ‡็ญพ็”จ้€—ๅทๅˆ†้š”"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"single-description",children:"ๆ่ฟฐ"}),e.jsx(ne,{id:"single-description",value:H.description,onChange:O=>y(H.id,{description:O.target.value}),placeholder:"่พ“ๅ…ฅ่กจๆƒ…ๅŒ…ๆ่ฟฐ..."})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(tt,{id:"single-is-registered",checked:H.isRegistered,onCheckedChange:O=>y(H.id,{isRegistered:O===!0})}),e.jsx(T,{htmlFor:"single-is-registered",className:"cursor-pointer",children:"ไธŠไผ ๅŽ็ซ‹ๅณๆณจๅ†Œ๏ผˆๅฏ่ขซ้บฆ้บฆไฝฟ็”จ๏ผ‰"})]})]})]}),e.jsx(gt,{children:e.jsx(_,{onClick:F,disabled:!z||g,children:g?"ไธŠไผ ไธญ...":"ไธŠไผ "})})]}):null},R=()=>{const H=m.filter(w).length,O=m.length;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(_,{variant:"ghost",size:"sm",onClick:S,children:[e.jsx($a,{className:"h-4 w-4 mr-1"}),"่ฟ”ๅ›ž"]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["็ผ–่พ‘่กจๆƒ…ๅŒ…ไฟกๆฏ๏ผˆ",H,"/",O," ๅทฒๅฎŒๆˆ๏ผ‰"]})]}),e.jsx(Ce,{variant:z?"default":"secondary",children:z?e.jsxs(e.Fragment,{children:[e.jsx(Ot,{className:"h-3 w-3 mr-1"}),"ๅ…จ้ƒจๅฎŒๆˆ"]}):e.jsxs(e.Fragment,{children:[e.jsx(Sa,{className:"h-3 w-3 mr-1"}),"ๆœชๅฎŒๆˆ"]})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(ts,{className:"h-[350px] pr-2",children:e.jsx("div",{className:"space-y-2",children:m.map(X=>{const L=w(X),me=f===X.id;return e.jsxs("div",{onClick:()=>p(X.id),className:` +`)}function Vm(a){if(!a.trim())return{valid:!1,error:"่ทฏๅพ„ไธ่ƒฝไธบ็ฉบ"};if(!a.toLowerCase().endsWith(".toml"))return{valid:!1,error:"ๆ–‡ไปถๅฟ…้กปๆ˜ฏ .toml ๆ ผๅผ"};const l=/^([a-zA-Z]:\\|\\\\[^\\]+\\[^\\]+\\).+\.toml$/i,r=/^(\/|~\/).+\.toml$/i,c=/^(\.{1,2}[\\/]|[^:\\/]).+\.toml$/i,d=l.test(a),m=r.test(a),h=c.test(a);return!d&&!m&&!h?{valid:!1,error:"่ทฏๅพ„ๆ ผๅผ้”™่ฏฏ"}:/[<>"|?*\x00-\x1F]/.test(a)?{valid:!1,error:"่ทฏๅพ„ๅŒ…ๅซ้žๆณ•ๅญ—็ฌฆ"}:{valid:!0,error:""}}function L4(){const[a,l]=u.useState("upload"),[r,c]=u.useState(null),[d,m]=u.useState(""),[h,f]=u.useState(""),[p,g]=u.useState("oneclick"),[N,j]=u.useState(""),[b,y]=u.useState(!1),[w,z]=u.useState(!1),[M,S]=u.useState(!1),[F,E]=u.useState(!1),[C,R]=u.useState(null),[H,O]=u.useState(!1),X=u.useRef(null),{toast:L}=nt(),me=u.useRef(null),Ne=A=>{if(f(A),A.trim()){const K=Vm(A);j(K.error)}else j("")},je=u.useCallback(async A=>{const K=Fm[A];z(!0);try{const Re=await ej(K.path),se=Hm(Re);c(se),g(A),f(K.path),await Wg(K.path),L({title:"ๅŠ ่ฝฝๆˆๅŠŸ",description:`ๅทฒไปŽ${K.name}้ข„่ฎพๅŠ ่ฝฝ้…็ฝฎ`})}catch(Re){console.error("ๅŠ ่ฝฝ้ข„่ฎพ้…็ฝฎๅคฑ่ดฅ:",Re),L({title:"ๅŠ ่ฝฝๅคฑ่ดฅ",description:Re instanceof Error?Re.message:"ๆ— ๆณ•่ฏปๅ–้ข„่ฎพ้…็ฝฎๆ–‡ไปถ",variant:"destructive"})}finally{z(!1)}},[L]),re=u.useCallback(async A=>{const K=Vm(A);if(!K.valid){j(K.error),L({title:"่ทฏๅพ„ๆ— ๆ•ˆ",description:K.error,variant:"destructive"});return}j(""),z(!0);try{const Re=await ej(A),se=Hm(Re);c(se),f(A),await Wg(A),L({title:"ๅŠ ่ฝฝๆˆๅŠŸ",description:"ๅทฒไปŽ้…็ฝฎๆ–‡ไปถๅŠ ่ฝฝ"})}catch(Re){console.error("ๅŠ ่ฝฝ้…็ฝฎๅคฑ่ดฅ:",Re),L({title:"ๅŠ ่ฝฝๅคฑ่ดฅ",description:Re instanceof Error?Re.message:"ๆ— ๆณ•่ฏปๅ–้…็ฝฎๆ–‡ไปถ",variant:"destructive"})}finally{z(!1)}},[L]);u.useEffect(()=>{(async()=>{try{const K=await D4();if(K&&K.path){f(K.path);const Re=Object.entries(Fm).find(([,se])=>se.path===K.path);Re?(l("preset"),g(Re[0]),await je(Re[0])):(l("path"),await re(K.path))}}catch(K){console.error("ๅŠ ่ฝฝไฟๅญ˜็š„่ทฏๅพ„ๅคฑ่ดฅ:",K)}})()},[re,je]);const ge=u.useCallback(A=>{a!=="path"&&a!=="preset"||!h||(me.current&&clearTimeout(me.current),me.current=setTimeout(async()=>{y(!0);try{const K=qm(A);await sj(h,K),L({title:"่‡ชๅŠจไฟๅญ˜ๆˆๅŠŸ",description:"้…็ฝฎๅทฒไฟๅญ˜ๅˆฐๆ–‡ไปถ"})}catch(K){console.error("่‡ชๅŠจไฟๅญ˜ๅคฑ่ดฅ:",K),L({title:"่‡ชๅŠจไฟๅญ˜ๅคฑ่ดฅ",description:K instanceof Error?K.message:"ไฟๅญ˜้…็ฝฎๅคฑ่ดฅ",variant:"destructive"})}finally{y(!1)}},1e3))},[a,h,L]),pe=async()=>{if(!r||!h)return;const A=Vm(h);if(!A.valid){L({title:"ไฟๅญ˜ๅคฑ่ดฅ",description:A.error,variant:"destructive"});return}y(!0);try{const K=qm(r);await sj(h,K),L({title:"ไฟๅญ˜ๆˆๅŠŸ",description:"้…็ฝฎๅทฒไฟๅญ˜ๅˆฐๆ–‡ไปถ"})}catch(K){console.error("ไฟๅญ˜ๅคฑ่ดฅ:",K),L({title:"ไฟๅญ˜ๅคฑ่ดฅ",description:K instanceof Error?K.message:"ไฟๅญ˜้…็ฝฎๅคฑ่ดฅ",variant:"destructive"})}finally{y(!1)}},D=async()=>{h&&await re(h)},Q=A=>{if(A!==a){if(r){R(A),S(!0);return}I(A)}},I=A=>{c(null),m(""),j(""),l(A),A==="preset"&&je("oneclick"),L({title:"ๅทฒๅˆ‡ๆขๆจกๅผ",description:{upload:"็ŽฐๅœจๅฏไปฅไธŠไผ ้…็ฝฎๆ–‡ไปถ",path:"็ŽฐๅœจๅฏไปฅๆŒ‡ๅฎš้…็ฝฎๆ–‡ไปถ่ทฏๅพ„",preset:"็Žฐๅœจๅฏไปฅไฝฟ็”จ้ข„่ฎพ้…็ฝฎ"}[A]})},ue=()=>{C&&(I(C),R(null)),S(!1)},Y=()=>{if(r){E(!0);return}we()},we=()=>{f(""),c(null),j(""),L({title:"ๅทฒๆธ…็ฉบ",description:"่ทฏๅพ„ๅ’Œ้…็ฝฎๅทฒๆธ…็ฉบ"})},fe=()=>{we(),E(!1)},Ee=A=>{const K=A.target.files?.[0];if(!K)return;const Re=new FileReader;Re.onload=se=>{try{const $e=se.target?.result,cs=Hm($e);c(cs),m(K.name),L({title:"ไธŠไผ ๆˆๅŠŸ",description:`ๅทฒๅŠ ่ฝฝ้…็ฝฎๆ–‡ไปถ๏ผš${K.name}`})}catch($e){console.error("่งฃๆž้…็ฝฎๆ–‡ไปถๅคฑ่ดฅ:",$e),L({title:"่งฃๆžๅคฑ่ดฅ",description:"้…็ฝฎๆ–‡ไปถๆ ผๅผ้”™่ฏฏ๏ผŒ่ฏทๆฃ€ๆŸฅๆ–‡ไปถๅ†…ๅฎน",variant:"destructive"})}},Re.readAsText(K)},G=()=>{if(!r)return;const A=qm(r),K=new Blob([A],{type:"text/plain;charset=utf-8"}),Re=URL.createObjectURL(K),se=document.createElement("a");se.href=Re,se.download=d||"config.toml",document.body.appendChild(se),se.click(),document.body.removeChild(se),URL.revokeObjectURL(Re),L({title:"ไธ‹่ฝฝๆˆๅŠŸ",description:"้…็ฝฎๆ–‡ไปถๅทฒไธ‹่ฝฝ๏ผŒ่ฏทๆ‰‹ๅŠจ่ฆ†็›–ๅนถ้‡ๅฏ้€‚้…ๅ™จ"})},$=()=>{c(JSON.parse(JSON.stringify(kt))),m("config.toml"),L({title:"ๅทฒๅŠ ่ฝฝ้ป˜่ฎค้…็ฝฎ",description:"ๅฏไปฅๅผ€ๅง‹็ผ–่พ‘้…็ฝฎ"})};return e.jsx(ts,{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.jsx(xc,{open:H,onOpenChange:O,children:e.jsxs(Te,{children:[e.jsx(Oe,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Ue,{children:"ๅทฅไฝœๆจกๅผ"}),e.jsx(Ns,{children:"้€‰ๆ‹ฉ้…็ฝฎๆ–‡ไปถ็š„็ฎก็†ๆ–นๅผ"})]}),e.jsx(hc,{asChild:!0,children:e.jsxs(_,{variant:"ghost",size:"sm",className:"w-9 p-0",children:[e.jsx(Ia,{className:`h-4 w-4 transition-transform duration-200 ${H?"transform rotate-180":""}`}),e.jsx("span",{className:"sr-only",children:"ๅˆ‡ๆข"})]})})]})}),e.jsx(fc,{children:e.jsxs(ze,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3 md:gap-4",children:[e.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${a==="preset"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>Q("preset"),children:e.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[e.jsx(xa,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"้ข„่ฎพๆจกๅผ"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"ไฝฟ็”จ้ข„่ฎพ็š„้ƒจ็ฝฒ้…็ฝฎ"})]})]})}),e.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${a==="upload"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>Q("upload"),children:e.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[e.jsx(cc,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"ไธŠไผ ๆ–‡ไปถๆจกๅผ"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"ไธŠไผ ้…็ฝฎๆ–‡ไปถ๏ผŒ็ผ–่พ‘ๅŽไธ‹่ฝฝๅนถๆ‰‹ๅŠจ่ฆ†็›–"})]})]})}),e.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${a==="path"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>Q("path"),children:e.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[e.jsx(B_,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"ๆŒ‡ๅฎš่ทฏๅพ„ๆจกๅผ"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"ๆŒ‡ๅฎš้…็ฝฎๆ–‡ไปถ่ทฏๅพ„๏ผŒ่‡ชๅŠจๅŠ ่ฝฝๅ’Œไฟๅญ˜"})]})]})})]}),a==="preset"&&e.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[e.jsx(T,{className:"text-sm md:text-base",children:"้€‰ๆ‹ฉ้ƒจ็ฝฒๆ–นๅผ"}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:Object.entries(Fm).map(([A,K])=>{const Re=K.icon,se=p===A;return e.jsx("div",{className:`border-2 rounded-lg p-3 cursor-pointer transition-all ${se?"border-primary bg-primary/5":"border-muted hover:border-primary/50"}`,onClick:()=>{g(A),je(A)},children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Re,{className:"h-5 w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h4",{className:"font-semibold text-sm",children:K.name}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:K.description}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 font-mono break-all",children:K.path})]})]})},A)})})]}),a==="path"&&e.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"config-path",className:"text-sm md:text-base",children:"้…็ฝฎๆ–‡ไปถ่ทฏๅพ„"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx(ae,{id:"config-path",value:h,onChange:A=>Ne(A.target.value),placeholder:"ไพ‹: C:\\Adapter\\config.toml",className:`text-sm ${N?"border-destructive":""}`}),N&&e.jsx("p",{className:"text-xs text-destructive",children:N})]}),e.jsx(_,{onClick:()=>re(h),disabled:w||!h||!!N,className:"w-full sm:w-auto",children:w?e.jsxs(e.Fragment,{children:[e.jsx(dt,{className:"h-4 w-4 animate-spin mr-2"}),e.jsx("span",{className:"sm:hidden",children:"ๅŠ ่ฝฝไธญ..."})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"sm:hidden",children:"ๅŠ ่ฝฝ้…็ฝฎ"}),e.jsx("span",{className:"hidden sm:inline",children:"ๅŠ ่ฝฝ"})]})})]})]}),e.jsxs("details",{className:"rounded-lg bg-muted/50 p-3 group",children:[e.jsxs("summary",{className:"text-xs font-medium cursor-pointer select-none list-none flex items-center justify-between",children:[e.jsx("span",{children:"่ทฏๅพ„ๆ ผๅผ่ฏดๆ˜Ž"}),e.jsx("svg",{className:"h-4 w-4 transition-transform group-open:rotate-180",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),e.jsxs("div",{className:"mt-2 space-y-2 text-xs text-muted-foreground",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Windows"})}),e.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[e.jsx("div",{children:"C:\\Adapter\\config.toml"}),e.jsx("div",{className:"hidden sm:block",children:"D:\\MaiBot\\adapter\\config.toml"}),e.jsx("div",{className:"hidden sm:block",children:"\\\\server\\share\\config.toml"})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Linux"})}),e.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[e.jsx("div",{children:"/opt/adapter/config.toml"}),e.jsx("div",{className:"hidden sm:block",children:"/home/user/adapter/config.toml"}),e.jsx("div",{className:"hidden sm:block",children:"~/adapter/config.toml"})]})]}),e.jsx("p",{className:"pt-1 border-t text-[10px] md:text-xs",children:"๐Ÿ’ก ้…็ฝฎไผš่‡ชๅŠจไฟๅญ˜ๅˆฐๆŒ‡ๅฎšๆ–‡ไปถ๏ผŒไฟฎๆ”นๅŽ 1 ็ง’่‡ชๅŠจไฟๅญ˜"})]})]})]})]})})]})}),e.jsxs(ht,{children:[e.jsx(Yt,{className:"h-4 w-4"}),e.jsx(ft,{children:a==="preset"?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"้ข„่ฎพๆจกๅผ๏ผš"}),"้€‰ๆ‹ฉ้ข„่ฎพ็š„้ƒจ็ฝฒๆ–นๅผ๏ผŒ้…็ฝฎไผš่‡ชๅŠจๅŠ ่ฝฝ๏ผŒไฟฎๆ”นๅŽ 1 ็ง’่‡ชๅŠจไฟๅญ˜",b&&" (ๆญฃๅœจไฟๅญ˜...)"]}):a==="upload"?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"ไธŠไผ ๆ–‡ไปถๆจกๅผ๏ผš"}),"ไธŠไผ ้…็ฝฎๆ–‡ไปถ โ†’ ๅœจ็บฟ็ผ–่พ‘ โ†’ ไธ‹่ฝฝๆ–‡ไปถ โ†’ ๆ‰‹ๅŠจ่ฆ†็›–ๅนถ้‡ๅฏ้€‚้…ๅ™จ"]}):e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"ๆŒ‡ๅฎš่ทฏๅพ„ๆจกๅผ๏ผš"}),"ๆŒ‡ๅฎš้…็ฝฎๆ–‡ไปถ่ทฏๅพ„ๅŽ๏ผŒ้…็ฝฎไผš่‡ชๅŠจๅŠ ่ฝฝ๏ผŒไฟฎๆ”นๅŽ 1 ็ง’่‡ชๅŠจไฟๅญ˜",b&&" (ๆญฃๅœจไฟๅญ˜...)"]})})]}),a==="upload"&&!r&&e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full",children:[e.jsx("input",{ref:X,type:"file",accept:".toml",className:"hidden",onChange:Ee}),e.jsxs(_,{onClick:()=>X.current?.click(),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(cc,{className:"mr-2 h-4 w-4"}),"ไธŠไผ ้…็ฝฎ"]}),e.jsxs(_,{onClick:$,size:"sm",className:"w-full sm:w-auto",children:[e.jsx(Ua,{className:"mr-2 h-4 w-4"}),"ไฝฟ็”จ้ป˜่ฎค้…็ฝฎ"]})]}),a==="upload"&&r&&e.jsx("div",{className:"flex gap-2",children:e.jsxs(_,{onClick:G,size:"sm",className:"w-full sm:w-auto",children:[e.jsx(na,{className:"mr-2 h-4 w-4"}),"ไธ‹่ฝฝ้…็ฝฎ"]})}),(a==="preset"||a==="path")&&r&&e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs(_,{onClick:pe,size:"sm",disabled:b||!!N,className:"w-full sm:w-auto",children:[e.jsx(gc,{className:"mr-2 h-4 w-4"}),b?"ไฟๅญ˜ไธญ...":"็ซ‹ๅณไฟๅญ˜"]}),e.jsxs(_,{onClick:D,size:"sm",variant:"outline",disabled:w,className:"w-full sm:w-auto",children:[e.jsx(dt,{className:`mr-2 h-4 w-4 ${w?"animate-spin":""}`}),"ๅˆทๆ–ฐ"]}),a==="path"&&e.jsxs(_,{onClick:Y,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(os,{className:"mr-2 h-4 w-4"}),"ๆธ…็ฉบ่ทฏๅพ„"]})]}),r?e.jsxs(Jt,{defaultValue:"napcat",className:"w-full",children:[e.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:e.jsxs(Gt,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5",children:[e.jsxs(Xe,{value:"napcat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[e.jsx("span",{className:"hidden sm:inline",children:"Napcat ่ฟžๆŽฅ"}),e.jsx("span",{className:"sm:hidden",children:"Napcat"})]}),e.jsxs(Xe,{value:"maibot",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[e.jsx("span",{className:"hidden sm:inline",children:"้บฆ้บฆ่ฟžๆŽฅ"}),e.jsx("span",{className:"sm:hidden",children:"้บฆ้บฆ"})]}),e.jsxs(Xe,{value:"chat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[e.jsx("span",{className:"hidden sm:inline",children:"่ŠๅคฉๆŽงๅˆถ"}),e.jsx("span",{className:"sm:hidden",children:"่Šๅคฉ"})]}),e.jsxs(Xe,{value:"voice",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[e.jsx("span",{className:"hidden sm:inline",children:"่ฏญ้ŸณไธŽ่ฝฌๅ‘"}),e.jsx("span",{className:"sm:hidden",children:"่ฏญ้Ÿณ"})]}),e.jsx(Xe,{value:"debug",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:"่ฐƒ่ฏ•"})]})}),e.jsx(Ss,{value:"napcat",className:"space-y-4",children:e.jsx(U4,{config:r,onChange:A=>{c(A),ge(A)}})}),e.jsx(Ss,{value:"maibot",className:"space-y-4",children:e.jsx($4,{config:r,onChange:A=>{c(A),ge(A)}})}),e.jsx(Ss,{value:"chat",className:"space-y-4",children:e.jsx(I4,{config:r,onChange:A=>{c(A),ge(A)}})}),e.jsx(Ss,{value:"voice",className:"space-y-4",children:e.jsx(B4,{config:r,onChange:A=>{c(A),ge(A)}})}),e.jsx(Ss,{value:"debug",className:"space-y-4",children:e.jsx(P4,{config:r,onChange:A=>{c(A),ge(A)}})})]}):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(Ua,{className:"h-12 w-12 md:h-16 md:w-16 mx-auto text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold",children:"ๅฐšๆœชๅŠ ่ฝฝ้…็ฝฎ"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-2 px-4",children:a==="preset"?"่ฏท้€‰ๆ‹ฉ้ข„่ฎพ็š„้ƒจ็ฝฒๆ–นๅผ":a==="upload"?"่ฏทไธŠไผ ็Žฐๆœ‰้…็ฝฎๆ–‡ไปถ๏ผŒๆˆ–ไฝฟ็”จ้ป˜่ฎค้…็ฝฎๅผ€ๅง‹็ผ–่พ‘":"่ฏทๆŒ‡ๅฎš้…็ฝฎๆ–‡ไปถ่ทฏๅพ„ๅนถ็‚นๅ‡ปๅŠ ่ฝฝๆŒ‰้’ฎ"})]})]})}),e.jsx(bs,{open:M,onOpenChange:S,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ‡ๆขๆจกๅผ"}),e.jsxs(gs,{children:["ๅˆ‡ๆขๆจกๅผๅฐ†ๆธ…็ฉบๅฝ“ๅ‰้…็ฝฎ๏ผŒ็กฎๅฎš่ฆ็ปง็ปญๅ—๏ผŸ",e.jsx("br",{}),e.jsx("span",{className:"text-destructive font-medium",children:"่ฏท็กฎไฟๅทฒไฟๅญ˜้‡่ฆ้…็ฝฎ"})]})]}),e.jsxs(fs,{children:[e.jsx(vs,{onClick:()=>{S(!1),R(null)},children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:ue,children:"็กฎ่ฎคๅˆ‡ๆข"})]})]})}),e.jsx(bs,{open:F,onOpenChange:E,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๆธ…็ฉบ่ทฏๅพ„"}),e.jsxs(gs,{children:["ๆธ…็ฉบ่ทฏๅพ„ๅฐ†ๆธ…้™คๅฝ“ๅ‰้…็ฝฎ๏ผŒ็กฎๅฎš่ฆ็ปง็ปญๅ—๏ผŸ",e.jsx("br",{}),e.jsx("span",{className:"text-muted-foreground text-sm",children:"ๆญคๆ“ไฝœไธไผšๅˆ ้™ค้…็ฝฎๆ–‡ไปถ๏ผŒๅชๆ˜ฏๆธ…้™ค็•Œ้ขไธญ็š„้…็ฝฎ"})]})]}),e.jsxs(fs,{children:[e.jsx(vs,{onClick:()=>E(!1),children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:fe,className:"bg-destructive hover:bg-destructive/90",children:"็กฎ่ฎคๆธ…็ฉบ"})]})]})})]})})}function U4({config:a,onChange:l}){return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"Napcat WebSocket ๆœๅŠก่ฎพ็ฝฎ"}),e.jsxs("div",{className:"grid gap-3 md:gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"napcat-host",className:"text-sm md:text-base",children:"ไธปๆœบๅœฐๅ€"}),e.jsx(ae,{id:"napcat-host",value:a.napcat_server.host,onChange:r=>l({...a,napcat_server:{...a.napcat_server,host:r.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat ่ฎพๅฎš็š„ไธปๆœบๅœฐๅ€"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"napcat-port",className:"text-sm md:text-base",children:"็ซฏๅฃ"}),e.jsx(ae,{id:"napcat-port",type:"number",value:a.napcat_server.port||"",onChange:r=>l({...a,napcat_server:{...a.napcat_server,port:r.target.value?parseInt(r.target.value):0}}),placeholder:"8095",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat ่ฎพๅฎš็š„็ซฏๅฃ๏ผˆ็•™็ฉบไฝฟ็”จ้ป˜่ฎคๅ€ผ 8095๏ผ‰"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"napcat-token",className:"text-sm md:text-base",children:"่ฎฟ้—ฎไปค็‰Œ๏ผˆToken๏ผ‰"}),e.jsx(ae,{id:"napcat-token",type:"password",value:a.napcat_server.token,onChange:r=>l({...a,napcat_server:{...a.napcat_server,token:r.target.value}}),placeholder:"็•™็ฉบ่กจ็คบๆ— ้œ€ไปค็‰Œ",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat ่ฎพๅฎš็š„่ฎฟ้—ฎไปค็‰Œ๏ผŒ่‹ฅๆ— ๅˆ™็•™็ฉบ"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"napcat-heartbeat",className:"text-sm md:text-base",children:"ๅฟƒ่ทณ้—ด้š”๏ผˆ็ง’๏ผ‰"}),e.jsx(ae,{id:"napcat-heartbeat",type:"number",value:a.napcat_server.heartbeat_interval||"",onChange:r=>l({...a,napcat_server:{...a.napcat_server,heartbeat_interval:r.target.value?parseInt(r.target.value):0}}),placeholder:"30",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ไธŽ Napcat ่ฎพ็ฝฎ็š„ๅฟƒ่ทณ้—ด้š”ไฟๆŒไธ€่‡ด๏ผˆ็•™็ฉบไฝฟ็”จ้ป˜่ฎคๅ€ผ 30๏ผ‰"})]})]})]})})}function $4({config:a,onChange:l}){return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"้บฆ้บฆ WebSocket ๆœๅŠก่ฎพ็ฝฎ"}),e.jsxs("div",{className:"grid gap-3 md:gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"maibot-host",className:"text-sm md:text-base",children:"ไธปๆœบๅœฐๅ€"}),e.jsx(ae,{id:"maibot-host",value:a.maibot_server.host,onChange:r=>l({...a,maibot_server:{...a.maibot_server,host:r.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"้บฆ้บฆๅœจ .env ๆ–‡ไปถไธญ่ฎพ็ฝฎ็š„ HOST ๅญ—ๆฎต"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{htmlFor:"maibot-port",className:"text-sm md:text-base",children:"็ซฏๅฃ"}),e.jsx(ae,{id:"maibot-port",type:"number",value:a.maibot_server.port||"",onChange:r=>l({...a,maibot_server:{...a.maibot_server,port:r.target.value?parseInt(r.target.value):0}}),placeholder:"8000",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"้บฆ้บฆๅœจ .env ๆ–‡ไปถไธญ่ฎพ็ฝฎ็š„ PORT ๅญ—ๆฎต๏ผˆ็•™็ฉบไฝฟ็”จ้ป˜่ฎคๅ€ผ 8000๏ผ‰"})]})]})]})})}function I4({config:a,onChange:l}){const r=m=>{const h={...a};m==="group"?h.chat.group_list=[...h.chat.group_list,0]:m==="private"?h.chat.private_list=[...h.chat.private_list,0]:h.chat.ban_user_id=[...h.chat.ban_user_id,0],l(h)},c=(m,h)=>{const f={...a};m==="group"?f.chat.group_list=f.chat.group_list.filter((p,g)=>g!==h):m==="private"?f.chat.private_list=f.chat.private_list.filter((p,g)=>g!==h):f.chat.ban_user_id=f.chat.ban_user_id.filter((p,g)=>g!==h),l(f)},d=(m,h,f)=>{const p={...a};m==="group"?p.chat.group_list[h]=f:m==="private"?p.chat.private_list[h]=f:p.chat.ban_user_id[h]=f,l(p)};return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"่Šๅคฉ้ป‘็™ฝๅๅ•ๅŠŸ่ƒฝ"}),e.jsxs("div",{className:"grid gap-4 md:gap-6",children:[e.jsxs("div",{className:"space-y-3 md:space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-sm md:text-base",children:"็พค็ป„ๅๅ•็ฑปๅž‹"}),e.jsxs(Pe,{value:a.chat.group_list_type,onValueChange:m=>l({...a,chat:{...a.chat,group_list_type:m}}),children:[e.jsx(Ie,{children:e.jsx(Fe,{})}),e.jsxs(Be,{children:[e.jsx(W,{value:"whitelist",children:"็™ฝๅๅ•๏ผˆไป…ๅๅ•ๅ†…ๅฏ่Šๅคฉ๏ผ‰"}),e.jsx(W,{value:"blacklist",children:"้ป‘ๅๅ•๏ผˆๅๅ•ๅ†…็ฆๆญข่Šๅคฉ๏ผ‰"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[e.jsx(T,{className:"text-sm md:text-base",children:"็พค็ป„ๅˆ—่กจ"}),e.jsxs(_,{onClick:()=>r("group"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(Ua,{className:"mr-1 h-4 w-4"}),"ๆทปๅŠ ็พคๅท"]})]}),a.chat.group_list.map((m,h)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{type:"number",value:m,onChange:f=>d("group",h,parseInt(f.target.value)||0),placeholder:"่พ“ๅ…ฅ็พคๅท",className:"text-sm md:text-base"}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(os,{className:"h-4 w-4"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsxs(gs,{children:["็กฎๅฎš่ฆๅˆ ้™ค็พคๅท ",m," ๅ—๏ผŸๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:()=>c("group",h),children:"ๅˆ ้™ค"})]})]})]})]},h)),a.chat.group_list.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๆš‚ๆ— ็พค็ป„"})]})]}),e.jsxs("div",{className:"space-y-3 md:space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-sm md:text-base",children:"็ง่Šๅๅ•็ฑปๅž‹"}),e.jsxs(Pe,{value:a.chat.private_list_type,onValueChange:m=>l({...a,chat:{...a.chat,private_list_type:m}}),children:[e.jsx(Ie,{children:e.jsx(Fe,{})}),e.jsxs(Be,{children:[e.jsx(W,{value:"whitelist",children:"็™ฝๅๅ•๏ผˆไป…ๅๅ•ๅ†…ๅฏ่Šๅคฉ๏ผ‰"}),e.jsx(W,{value:"blacklist",children:"้ป‘ๅๅ•๏ผˆๅๅ•ๅ†…็ฆๆญข่Šๅคฉ๏ผ‰"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[e.jsx(T,{className:"text-sm md:text-base",children:"็ง่Šๅˆ—่กจ"}),e.jsxs(_,{onClick:()=>r("private"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(Ua,{className:"mr-1 h-4 w-4"}),"ๆทปๅŠ ็”จๆˆท"]})]}),a.chat.private_list.map((m,h)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{type:"number",value:m,onChange:f=>d("private",h,parseInt(f.target.value)||0),placeholder:"่พ“ๅ…ฅQQๅท",className:"text-sm md:text-base"}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(os,{className:"h-4 w-4"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsxs(gs,{children:["็กฎๅฎš่ฆๅˆ ้™ค็”จๆˆท ",m," ๅ—๏ผŸๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:()=>c("private",h),children:"ๅˆ ้™ค"})]})]})]})]},h)),a.chat.private_list.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๆš‚ๆ— ็”จๆˆท"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-sm md:text-base",children:"ๅ…จๅฑ€็ฆๆญขๅๅ•"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"ๅๅ•ไธญ็š„็”จๆˆทๆ— ๆณ•่ฟ›่กŒไปปไฝ•่Šๅคฉ"})]}),e.jsxs(_,{onClick:()=>r("ban"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(Ua,{className:"mr-1 h-4 w-4"}),"ๆทปๅŠ ็”จๆˆท"]})]}),a.chat.ban_user_id.map((m,h)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{type:"number",value:m,onChange:f=>d("ban",h,parseInt(f.target.value)||0),placeholder:"่พ“ๅ…ฅQQๅท",className:"text-sm md:text-base"}),e.jsxs(bs,{children:[e.jsx(wt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(os,{className:"h-4 w-4"})})}),e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsxs(gs,{children:["็กฎๅฎš่ฆไปŽๅ…จๅฑ€็ฆๆญขๅๅ•ไธญๅˆ ้™ค็”จๆˆท ",m," ๅ—๏ผŸๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:()=>c("ban",h),children:"ๅˆ ้™ค"})]})]})]})]},h)),a.chat.ban_user_id.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๆš‚ๆ— ็ฆๆญข็”จๆˆท"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-sm md:text-base",children:"ๅฑ่”ฝQQๅฎ˜ๆ–นๆœบๅ™จไบบ"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"ๆ˜ฏๅฆๅฑ่”ฝๆฅ่‡ชQQๅฎ˜ๆ–นๆœบๅ™จไบบ็š„ๆถˆๆฏ"})]}),e.jsx(qe,{checked:a.chat.ban_qq_bot,onCheckedChange:m=>l({...a,chat:{...a.chat,ban_qq_bot:m}})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-sm md:text-base",children:"ๅฏ็”จๆˆณไธ€ๆˆณๅŠŸ่ƒฝ"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"ๆ˜ฏๅฆๅ“ๅบ”ๆˆณไธ€ๆˆณๆถˆๆฏ"})]}),e.jsx(qe,{checked:a.chat.enable_poke,onCheckedChange:m=>l({...a,chat:{...a.chat,enable_poke:m}})})]})]})]})})}function B4({config:a,onChange:l}){return e.jsxs("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(qe,{checked:a.voice.use_tts,onCheckedChange:r=>l({...a,voice:{...a.voice,use_tts:r}})})]})]}),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-2",children:[e.jsx(T,{htmlFor:"image-threshold",className:"text-sm md:text-base",children:"ๅ›พ็‰‡ๆ•ฐ้‡้˜ˆๅ€ผ"}),e.jsx(ae,{id:"image-threshold",type:"number",value:a.forward.image_threshold||"",onChange:r=>l({...a,forward:{...a.forward,image_threshold:r.target.value?parseInt(r.target.value):0}}),placeholder:"30",className:"text-sm md:text-base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"่ฝฌๅ‘ๆถˆๆฏไธญๅ›พ็‰‡ๆ•ฐ้‡่ถ…่ฟ‡ๆญคๅ€ผๆ—ถไฝฟ็”จๅ ไฝ็ฌฆ๏ผˆ้ฟๅ…้บฆ้บฆVLMๅค„็†ๅกๆญป๏ผ‰"})]})]})]})}function P4({config:a,onChange:l}){return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"่ฐƒ่ฏ•่ฎพ็ฝฎ"}),e.jsx("div",{className:"grid gap-3 md:gap-4",children:e.jsxs("div",{className:"grid gap-2",children:[e.jsx(T,{className:"text-sm md:text-base",children:"ๆ—ฅๅฟ—็ญ‰็บง"}),e.jsxs(Pe,{value:a.debug.level,onValueChange:r=>l({...a,debug:{level:r}}),children:[e.jsx(Ie,{children:e.jsx(Fe,{})}),e.jsxs(Be,{children:[e.jsx(W,{value:"DEBUG",children:"DEBUG๏ผˆ่ฐƒ่ฏ•๏ผ‰"}),e.jsx(W,{value:"INFO",children:"INFO๏ผˆไฟกๆฏ๏ผ‰"}),e.jsx(W,{value:"WARNING",children:"WARNING๏ผˆ่ญฆๅ‘Š๏ผ‰"}),e.jsx(W,{value:"ERROR",children:"ERROR๏ผˆ้”™่ฏฏ๏ผ‰"}),e.jsx(W,{value:"CRITICAL",children:"CRITICAL๏ผˆไธฅ้‡๏ผ‰"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"่ฎพ็ฝฎ้€‚้…ๅ™จ็š„ๆ—ฅๅฟ—่พ“ๅ‡บ็ญ‰็บง"})]})})]})})}const F4=["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"],H4=/^(aria-|data-)/,oN=a=>Object.fromEntries(Object.entries(a).filter(([l])=>H4.test(l)||F4.includes(l)));function q4(a,l){const r=oN(a);return Object.keys(a).some(c=>!Object.hasOwn(r,c)&&a[c]!==l[c])}class V4 extends u.Component{container;plugin;componentDidMount(){this.installPlugin()}componentDidUpdate(l){if(l.uppy!==this.props.uppy)this.uninstallPlugin(l),this.installPlugin();else if(q4(this.props,l)){const{uppy:r,...c}={...this.props,target:this.container};this.plugin.setOptions(c)}}componentWillUnmount(){this.uninstallPlugin()}installPlugin(){const{uppy:l,...r}={id:"Dashboard",...this.props,inline:!0,target:this.container};l.use(v1,r),this.plugin=l.getPlugin(r.id)}uninstallPlugin(l=this.props){const{uppy:r}=l;r.removePlugin(this.plugin)}render(){return u.createElement("div",{className:"uppy-Container",ref:l=>{this.container=l},...oN(this.props)})}}function G4({src:a,alt:l="่กจๆƒ…ๅŒ…",className:r,maxRetries:c=5,retryInterval:d=1500}){const[m,h]=u.useState("loading"),[f,p]=u.useState(0),[g,N]=u.useState(null),[j,b]=u.useState(a);a!==j&&(h("loading"),p(0),N(null),b(a));const y=u.useCallback(async()=>{try{const w=await fetch(a,{credentials:"include"});if(w.status===202){h("generating"),f{p(S=>S+1)},d):h("error");return}if(!w.ok){h("error");return}const z=await w.blob(),M=URL.createObjectURL(z);N(M),h("loaded")}catch(w){console.error("ๅŠ ่ฝฝ็ผฉ็•ฅๅ›พๅคฑ่ดฅ:",w),h("error")}},[a,f,c,d]);return u.useEffect(()=>{y()},[y]),u.useEffect(()=>()=>{g&&URL.revokeObjectURL(g)},[g]),m==="loading"||m==="generating"?e.jsx(ks,{className:P("w-full h-full",r)}):m==="error"||!g?e.jsx("div",{className:P("w-full h-full flex items-center justify-center bg-muted",r),children:e.jsx(xx,{className:"h-8 w-8 text-muted-foreground"})}):e.jsx("img",{src:g,alt:l,className:P("w-full h-full object-contain",r)})}function K4({children:a,className:l}){return e.jsx(bx,{content:a,className:l})}const al="/api/webui/emoji";async function Q4(a){const l=new URLSearchParams;a.page&&l.append("page",a.page.toString()),a.page_size&&l.append("page_size",a.page_size.toString()),a.search&&l.append("search",a.search),a.is_registered!==void 0&&l.append("is_registered",a.is_registered.toString()),a.is_banned!==void 0&&l.append("is_banned",a.is_banned.toString()),a.format&&l.append("format",a.format),a.sort_by&&l.append("sort_by",a.sort_by),a.sort_order&&l.append("sort_order",a.sort_order);const r=await ke(`${al}/list?${l}`,{});if(!r.ok)throw new Error(`่Žทๅ–่กจๆƒ…ๅŒ…ๅˆ—่กจๅคฑ่ดฅ: ${r.statusText}`);return r.json()}async function Y4(a){const l=await ke(`${al}/${a}`,{});if(!l.ok)throw new Error(`่Žทๅ–่กจๆƒ…ๅŒ…่ฏฆๆƒ…ๅคฑ่ดฅ: ${l.statusText}`);return l.json()}async function J4(a,l){const r=await ke(`${al}/${a}`,{method:"PATCH",body:JSON.stringify(l)});if(!r.ok)throw new Error(`ๆ›ดๆ–ฐ่กจๆƒ…ๅŒ…ๅคฑ่ดฅ: ${r.statusText}`);return r.json()}async function X4(a){const l=await ke(`${al}/${a}`,{method:"DELETE"});if(!l.ok)throw new Error(`ๅˆ ้™ค่กจๆƒ…ๅŒ…ๅคฑ่ดฅ: ${l.statusText}`);return l.json()}async function Z4(){const a=await ke(`${al}/stats/summary`,{});if(!a.ok)throw new Error(`่Žทๅ–็ปŸ่ฎกๆ•ฐๆฎๅคฑ่ดฅ: ${a.statusText}`);return a.json()}async function W4(a){const l=await ke(`${al}/${a}/register`,{method:"POST"});if(!l.ok)throw new Error(`ๆณจๅ†Œ่กจๆƒ…ๅŒ…ๅคฑ่ดฅ: ${l.statusText}`);return l.json()}async function ek(a){const l=await ke(`${al}/${a}/ban`,{method:"POST"});if(!l.ok)throw new Error(`ๅฐ็ฆ่กจๆƒ…ๅŒ…ๅคฑ่ดฅ: ${l.statusText}`);return l.json()}function sk(a,l=!1){return l?`${al}/${a}/thumbnail?original=true`:`${al}/${a}/thumbnail`}function tk(a){return`${al}/${a}/thumbnail?original=true`}async function ak(a){const l=await ke(`${al}/batch/delete`,{method:"POST",body:JSON.stringify({emoji_ids:a})});if(!l.ok){const r=await l.json();throw new Error(r.detail||"ๆ‰น้‡ๅˆ ้™คๅคฑ่ดฅ")}return l.json()}function lk(){return`${al}/upload`}function nk(){const[a,l]=u.useState([]),[r,c]=u.useState(null),[d,m]=u.useState(!1),[h,f]=u.useState(1),[p,g]=u.useState(0),[N,j]=u.useState(20),[b,y]=u.useState("all"),[w,z]=u.useState("all"),[M,S]=u.useState("all"),[F,E]=u.useState("usage_count"),[C,R]=u.useState("desc"),[H,O]=u.useState(null),[X,L]=u.useState(!1),[me,Ne]=u.useState(!1),[je,re]=u.useState(!1),[ge,pe]=u.useState(new Set),[D,Q]=u.useState(!1),[I,ue]=u.useState(""),[Y,we]=u.useState("medium"),[fe,Ee]=u.useState(!1),{toast:G}=nt(),$=u.useCallback(async()=>{try{m(!0);const xe=await Q4({page:h,page_size:N,is_registered:b==="all"?void 0:b==="registered",is_banned:w==="all"?void 0:w==="banned",format:M==="all"?void 0:M,sort_by:F,sort_order:C});l(xe.data),g(xe.total)}catch(xe){const Me=xe instanceof Error?xe.message:"ๅŠ ่ฝฝ่กจๆƒ…ๅŒ…ๅˆ—่กจๅคฑ่ดฅ";G({title:"้”™่ฏฏ",description:Me,variant:"destructive"})}finally{m(!1)}},[h,N,b,w,M,F,C,G]),A=async()=>{try{const xe=await Z4();c(xe.data)}catch(xe){console.error("ๅŠ ่ฝฝ็ปŸ่ฎกๆ•ฐๆฎๅคฑ่ดฅ:",xe)}};u.useEffect(()=>{$()},[$]),u.useEffect(()=>{A()},[]);const K=async xe=>{try{const Me=await Y4(xe.id);O(Me.data),L(!0)}catch(Me){const ds=Me instanceof Error?Me.message:"ๅŠ ่ฝฝ่ฏฆๆƒ…ๅคฑ่ดฅ";G({title:"้”™่ฏฏ",description:ds,variant:"destructive"})}},Re=xe=>{O(xe),Ne(!0)},se=xe=>{O(xe),re(!0)},$e=async()=>{if(H)try{await X4(H.id),G({title:"ๆˆๅŠŸ",description:"่กจๆƒ…ๅŒ…ๅทฒๅˆ ้™ค"}),re(!1),O(null),$(),A()}catch(xe){const Me=xe instanceof Error?xe.message:"ๅˆ ้™คๅคฑ่ดฅ";G({title:"้”™่ฏฏ",description:Me,variant:"destructive"})}},cs=async xe=>{try{await W4(xe.id),G({title:"ๆˆๅŠŸ",description:"่กจๆƒ…ๅŒ…ๅทฒๆณจๅ†Œ"}),$(),A()}catch(Me){const ds=Me instanceof Error?Me.message:"ๆณจๅ†Œๅคฑ่ดฅ";G({title:"้”™่ฏฏ",description:ds,variant:"destructive"})}},J=async xe=>{try{await ek(xe.id),G({title:"ๆˆๅŠŸ",description:"่กจๆƒ…ๅŒ…ๅทฒๅฐ็ฆ"}),$(),A()}catch(Me){const ds=Me instanceof Error?Me.message:"ๅฐ็ฆๅคฑ่ดฅ";G({title:"้”™่ฏฏ",description:ds,variant:"destructive"})}},Z=xe=>{const Me=new Set(ge);Me.has(xe)?Me.delete(xe):Me.add(xe),pe(Me)},Le=async()=>{try{const xe=await ak(Array.from(ge));G({title:"ๆ‰น้‡ๅˆ ้™คๅฎŒๆˆ",description:xe.message}),pe(new Set),Q(!1),$(),A()}catch(xe){G({title:"ๆ‰น้‡ๅˆ ้™คๅคฑ่ดฅ",description:xe instanceof Error?xe.message:"ๆ‰น้‡ๅˆ ้™คๅคฑ่ดฅ",variant:"destructive"})}},ne=()=>{const xe=parseInt(I),Me=Math.ceil(p/N);xe>=1&&xe<=Me?(f(xe),ue("")):G({title:"ๆ— ๆ•ˆ็š„้กต็ ",description:`่ฏท่พ“ๅ…ฅ1-${Me}ไน‹้—ด็š„้กต็ `,variant:"destructive"})},De=r?.formats?Object.keys(r.formats):[];return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsxs("div",{className:"mb-4 sm:mb-6 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"่กจๆƒ…ๅŒ…็ฎก็†"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"็ฎก็†้บฆ้บฆ็š„่กจๆƒ…ๅŒ…่ต„ๆบ"})]}),e.jsxs(_,{onClick:()=>Ee(!0),className:"gap-2",children:[e.jsx(cc,{className:"h-4 w-4"}),"ไธŠไผ ่กจๆƒ…ๅŒ…"]})]}),e.jsx(ts,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[r&&e.jsxs("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[e.jsx(Te,{children:e.jsxs(Oe,{className:"pb-2",children:[e.jsx(Ns,{children:"ๆ€ปๆ•ฐ"}),e.jsx(Ue,{className:"text-2xl",children:r.total})]})}),e.jsx(Te,{children:e.jsxs(Oe,{className:"pb-2",children:[e.jsx(Ns,{children:"ๅทฒๆณจๅ†Œ"}),e.jsx(Ue,{className:"text-2xl text-green-600",children:r.registered})]})}),e.jsx(Te,{children:e.jsxs(Oe,{className:"pb-2",children:[e.jsx(Ns,{children:"ๅทฒๅฐ็ฆ"}),e.jsx(Ue,{className:"text-2xl text-red-600",children:r.banned})]})}),e.jsx(Te,{children:e.jsxs(Oe,{className:"pb-2",children:[e.jsx(Ns,{children:"ๆœชๆณจๅ†Œ"}),e.jsx(Ue,{className:"text-2xl text-gray-600",children:r.unregistered})]})})]}),e.jsxs(Te,{children:[e.jsx(Oe,{children:e.jsxs(Ue,{className:"flex items-center gap-2",children:[e.jsx(Po,{className:"h-5 w-5"}),"็ญ›้€‰ๅ’ŒๆŽ’ๅบ"]})}),e.jsxs(ze,{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"ๆŽ’ๅบๆ–นๅผ"}),e.jsxs(Pe,{value:`${F}-${C}`,onValueChange:xe=>{const[Me,ds]=xe.split("-");E(Me),R(ds),f(1)},children:[e.jsx(Ie,{children:e.jsx(Fe,{})}),e.jsxs(Be,{children:[e.jsx(W,{value:"usage_count-desc",children:"ไฝฟ็”จๆฌกๆ•ฐ (ๅคšโ†’ๅฐ‘)"}),e.jsx(W,{value:"usage_count-asc",children:"ไฝฟ็”จๆฌกๆ•ฐ (ๅฐ‘โ†’ๅคš)"}),e.jsx(W,{value:"register_time-desc",children:"ๆณจๅ†Œๆ—ถ้—ด (ๆ–ฐโ†’ๆ—ง)"}),e.jsx(W,{value:"register_time-asc",children:"ๆณจๅ†Œๆ—ถ้—ด (ๆ—งโ†’ๆ–ฐ)"}),e.jsx(W,{value:"record_time-desc",children:"่ฎฐๅฝ•ๆ—ถ้—ด (ๆ–ฐโ†’ๆ—ง)"}),e.jsx(W,{value:"record_time-asc",children:"่ฎฐๅฝ•ๆ—ถ้—ด (ๆ—งโ†’ๆ–ฐ)"}),e.jsx(W,{value:"last_used_time-desc",children:"ๆœ€ๅŽไฝฟ็”จ (ๆ–ฐโ†’ๆ—ง)"}),e.jsx(W,{value:"last_used_time-asc",children:"ๆœ€ๅŽไฝฟ็”จ (ๆ—งโ†’ๆ–ฐ)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"ๆณจๅ†Œ็Šถๆ€"}),e.jsxs(Pe,{value:b,onValueChange:xe=>{y(xe),f(1)},children:[e.jsx(Ie,{children:e.jsx(Fe,{})}),e.jsxs(Be,{children:[e.jsx(W,{value:"all",children:"ๅ…จ้ƒจ"}),e.jsx(W,{value:"registered",children:"ๅทฒๆณจๅ†Œ"}),e.jsx(W,{value:"unregistered",children:"ๆœชๆณจๅ†Œ"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"ๅฐ็ฆ็Šถๆ€"}),e.jsxs(Pe,{value:w,onValueChange:xe=>{z(xe),f(1)},children:[e.jsx(Ie,{children:e.jsx(Fe,{})}),e.jsxs(Be,{children:[e.jsx(W,{value:"all",children:"ๅ…จ้ƒจ"}),e.jsx(W,{value:"banned",children:"ๅทฒๅฐ็ฆ"}),e.jsx(W,{value:"unbanned",children:"ๆœชๅฐ็ฆ"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"ๆ ผๅผ"}),e.jsxs(Pe,{value:M,onValueChange:xe=>{S(xe),f(1)},children:[e.jsx(Ie,{children:e.jsx(Fe,{})}),e.jsxs(Be,{children:[e.jsx(W,{value:"all",children:"ๅ…จ้ƒจ"}),De.map(xe=>e.jsxs(W,{value:xe,children:[xe.toUpperCase()," (",r?.formats[xe],")"]},xe))]})]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 pt-4 border-t",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[ge.size>0&&e.jsxs("span",{className:"text-sm text-muted-foreground",children:["ๅทฒ้€‰ๆ‹ฉ ",ge.size," ไธช่กจๆƒ…ๅŒ…"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{className:"text-sm whitespace-nowrap",children:"ๅก็‰‡ๅคงๅฐ"}),e.jsxs(Pe,{value:Y,onValueChange:xe=>we(xe),children:[e.jsx(Ie,{className:"w-24",children:e.jsx(Fe,{})}),e.jsxs(Be,{children:[e.jsx(W,{value:"small",children:"ๅฐ"}),e.jsx(W,{value:"medium",children:"ไธญ"}),e.jsx(W,{value:"large",children:"ๅคง"})]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{htmlFor:"emoji-page-size",className:"text-sm whitespace-nowrap",children:"ๆฏ้กตๆ˜พ็คบ"}),e.jsxs(Pe,{value:N.toString(),onValueChange:xe=>{j(parseInt(xe)),f(1),pe(new Set)},children:[e.jsx(Ie,{id:"emoji-page-size",className:"w-20",children:e.jsx(Fe,{})}),e.jsxs(Be,{children:[e.jsx(W,{value:"20",children:"20"}),e.jsx(W,{value:"40",children:"40"}),e.jsx(W,{value:"60",children:"60"}),e.jsx(W,{value:"100",children:"100"})]})]}),ge.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>pe(new Set),children:"ๅ–ๆถˆ้€‰ๆ‹ฉ"}),e.jsxs(_,{variant:"destructive",size:"sm",onClick:()=>Q(!0),children:[e.jsx(os,{className:"h-4 w-4 mr-1"}),"ๆ‰น้‡ๅˆ ้™ค"]})]})]})]}),e.jsx("div",{className:"flex justify-end pt-4 border-t",children:e.jsxs(_,{variant:"outline",size:"sm",onClick:$,disabled:d,children:[e.jsx(dt,{className:`h-4 w-4 mr-2 ${d?"animate-spin":""}`}),"ๅˆทๆ–ฐ"]})})]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"่กจๆƒ…ๅŒ…ๅˆ—่กจ"}),e.jsxs(Ns,{children:["ๅ…ฑ ",p," ไธช่กจๆƒ…ๅŒ…๏ผŒๅฝ“ๅ‰็ฌฌ ",h," ้กต"]})]}),e.jsxs(ze,{children:[a.length===0?e.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"ๆš‚ๆ— ๆ•ฐๆฎ"}):e.jsx("div",{className:`grid gap-3 ${Y==="small"?"grid-cols-3 sm:grid-cols-4 md:grid-cols-6 lg:grid-cols-8 xl:grid-cols-10":Y==="medium"?"grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 xl:grid-cols-8":"grid-cols-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5"}`,children:a.map(xe=>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(xe.id)?"ring-2 ring-primary bg-primary/5":""}`,onClick:()=>Z(xe.id),children:[e.jsx("div",{className:`absolute top-1 left-1 z-10 transition-opacity ${ge.has(xe.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(xe.id)?"bg-primary border-primary text-primary-foreground":"bg-background/80 border-muted-foreground/50"}`,children:ge.has(xe.id)&&e.jsx(st,{className:"h-3 w-3"})})}),e.jsxs("div",{className:"absolute top-1 right-1 z-10 flex flex-col gap-0.5",children:[xe.is_registered&&e.jsx(Ce,{variant:"default",className:"bg-green-600 text-[10px] px-1 py-0",children:"ๅทฒๆณจๅ†Œ"}),xe.is_banned&&e.jsx(Ce,{variant:"destructive",className:"text-[10px] px-1 py-0",children:"ๅทฒๅฐ็ฆ"})]}),e.jsx("div",{className:`aspect-square bg-muted flex items-center justify-center overflow-hidden ${Y==="small"?"p-1":Y==="medium"?"p-2":"p-3"}`,children:e.jsx(G4,{src:sk(xe.id),alt:"่กจๆƒ…ๅŒ…"})}),e.jsxs("div",{className:`border-t bg-card ${Y==="small"?"p-1":"p-2"}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-1 text-xs text-muted-foreground mb-1",children:[e.jsx(Ce,{variant:"outline",className:"text-[10px] px-1 py-0",children:xe.format.toUpperCase()}),e.jsxs("span",{className:"font-mono",children:[xe.usage_count,"ๆฌก"]})]}),e.jsxs("div",{className:`flex gap-1 justify-center opacity-0 group-hover:opacity-100 transition-opacity ${Y==="small"?"flex-wrap":""}`,children:[e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Me=>{Me.stopPropagation(),Re(xe)},title:"็ผ–่พ‘",children:e.jsx(sr,{className:"h-3 w-3"})}),e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Me=>{Me.stopPropagation(),K(xe)},title:"่ฏฆๆƒ…",children:e.jsx(Yt,{className:"h-3 w-3"})}),!xe.is_registered&&e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6 text-green-600 hover:text-green-700",onClick:Me=>{Me.stopPropagation(),cs(xe)},title:"ๆณจๅ†Œ",children:e.jsx(st,{className:"h-3 w-3"})}),!xe.is_banned&&e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6 text-orange-600 hover:text-orange-700",onClick:Me=>{Me.stopPropagation(),J(xe)},title:"ๅฐ็ฆ",children:e.jsx(iv,{className:"h-3 w-3"})}),e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6 text-red-600 hover:text-red-700",onClick:Me=>{Me.stopPropagation(),se(xe)},title:"ๅˆ ้™ค",children:e.jsx(os,{className:"h-3 w-3"})})]})]})]},xe.id))}),p>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["ๆ˜พ็คบ ",(h-1)*N+1," ๅˆฐ"," ",Math.min(h*N,p)," ๆก๏ผŒๅ…ฑ ",p," ๆก"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(kn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(xe=>Math.max(1,xe-1)),disabled:h===1,children:[e.jsx(Pa,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"ไธŠไธ€้กต"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae,{type:"number",value:I,onChange:xe=>ue(xe.target.value),onKeyDown:xe=>xe.key==="Enter"&&ne(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(p/N)}),e.jsx(_,{variant:"outline",size:"sm",onClick:ne,disabled:!I,className:"h-8",children:"่ทณ่ฝฌ"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(xe=>xe+1),disabled:h>=Math.ceil(p/N),children:[e.jsx("span",{className:"hidden sm:inline",children:"ไธ‹ไธ€้กต"}),e.jsx(ra,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(p/N)),disabled:h>=Math.ceil(p/N),className:"hidden sm:flex",children:e.jsx(Cn,{className:"h-4 w-4"})})]})]})]})]}),e.jsx(rk,{emoji:H,open:X,onOpenChange:L}),e.jsx(ik,{emoji:H,open:me,onOpenChange:Ne,onSuccess:()=>{$(),A()}}),e.jsx(ck,{open:fe,onOpenChange:Ee,onSuccess:()=>{$(),A()}})]})}),e.jsx(bs,{open:D,onOpenChange:Q,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๆ‰น้‡ๅˆ ้™ค"}),e.jsxs(gs,{children:["ไฝ ็กฎๅฎš่ฆๅˆ ้™ค้€‰ไธญ็š„ ",ge.size," ไธช่กจๆƒ…ๅŒ…ๅ—๏ผŸๆญคๆ“ไฝœไธๅฏๆ’ค้”€ใ€‚"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:Le,children:"็กฎ่ฎคๅˆ ้™ค"})]})]})}),e.jsx(Qs,{open:je,onOpenChange:re,children:e.jsxs(Hs,{children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsx(at,{children:"็กฎๅฎš่ฆๅˆ ้™ค่ฟ™ไธช่กจๆƒ…ๅŒ…ๅ—๏ผŸๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚"})]}),e.jsxs(gt,{children:[e.jsx(_,{variant:"outline",onClick:()=>re(!1),children:"ๅ–ๆถˆ"}),e.jsx(_,{variant:"destructive",onClick:$e,children:"ๅˆ ้™ค"})]})]})})]})}function rk({emoji:a,open:l,onOpenChange:r}){if(!a)return null;const c=d=>d?new Date(d*1e3).toLocaleString("zh-CN"):"-";return e.jsx(Qs,{open:l,onOpenChange:r,children:e.jsxs(Hs,{className:"max-w-2xl max-h-[90vh]",children:[e.jsx(qs,{children:e.jsx(Vs,{children:"่กจๆƒ…ๅŒ…่ฏฆๆƒ…"})}),e.jsx(ts,{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:tk(a.id),alt:a.description||"่กจๆƒ…ๅŒ…",className:"w-full h-full object-cover",onError:d=>{const m=d.target;m.style.display="none";const h=m.parentElement;h&&(h.innerHTML='')}})})}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"ID"}),e.jsx("div",{className:"mt-1 font-mono",children:a.id})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"ๆ ผๅผ"}),e.jsx("div",{className:"mt-1",children:e.jsx(Ce,{variant:"outline",children:a.format.toUpperCase()})})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"ๆ–‡ไปถ่ทฏๅพ„"}),e.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:a.full_path})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"ๅ“ˆๅธŒๅ€ผ"}),e.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:a.emoji_hash})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"ๆ่ฟฐ"}),a.description?e.jsx("div",{className:"mt-1 rounded-lg border bg-muted/50 p-3",children:e.jsx(K4,{className:"prose-sm",children:a.description})}):e.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:"-"})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"ๆƒ…็ปช"}),e.jsx("div",{className:"mt-1",children:a.emotion?e.jsx("span",{className:"text-sm",children:a.emotion}):e.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"็Šถๆ€"}),e.jsxs("div",{className:"mt-2 flex gap-2",children:[a.is_registered&&e.jsx(Ce,{variant:"default",className:"bg-green-600",children:"ๅทฒๆณจๅ†Œ"}),a.is_banned&&e.jsx(Ce,{variant:"destructive",children:"ๅทฒๅฐ็ฆ"}),!a.is_registered&&!a.is_banned&&e.jsx(Ce,{variant:"outline",children:"ๆœชๆณจๅ†Œ"})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"ไฝฟ็”จๆฌกๆ•ฐ"}),e.jsx("div",{className:"mt-1 font-mono text-lg",children:a.usage_count})]})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"่ฎฐๅฝ•ๆ—ถ้—ด"}),e.jsx("div",{className:"mt-1 text-sm",children:c(a.record_time)})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"ๆณจๅ†Œๆ—ถ้—ด"}),e.jsx("div",{className:"mt-1 text-sm",children:c(a.register_time)})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-muted-foreground",children:"ๆœ€ๅŽไฝฟ็”จ"}),e.jsx("div",{className:"mt-1 text-sm",children:c(a.last_used_time)})]})]})})]})})}function ik({emoji:a,open:l,onOpenChange:r,onSuccess:c}){const[d,m]=u.useState(""),[h,f]=u.useState(!1),[p,g]=u.useState(!1),[N,j]=u.useState(!1),{toast:b}=nt();u.useEffect(()=>{a&&(m(a.emotion||""),f(a.is_registered),g(a.is_banned))},[a]);const y=async()=>{if(a)try{j(!0);const w=d.split(/[,,]/).map(z=>z.trim()).filter(Boolean).join(",");await J4(a.id,{emotion:w||void 0,is_registered:h,is_banned:p}),b({title:"ๆˆๅŠŸ",description:"่กจๆƒ…ๅŒ…ไฟกๆฏๅทฒๆ›ดๆ–ฐ"}),r(!1),c()}catch(w){const z=w instanceof Error?w.message:"ไฟๅญ˜ๅคฑ่ดฅ";b({title:"้”™่ฏฏ",description:z,variant:"destructive"})}finally{j(!1)}};return a?e.jsx(Qs,{open:l,onOpenChange:r,children:e.jsxs(Hs,{className:"max-w-2xl",children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"็ผ–่พ‘่กจๆƒ…ๅŒ…"}),e.jsx(at,{children:"ไฟฎๆ”น่กจๆƒ…ๅŒ…็š„ๆƒ…็ปชๅ’Œ็Šถๆ€ไฟกๆฏ"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(T,{children:"ๆƒ…็ปช"}),e.jsx(pt,{value:d,onChange:w=>m(w.target.value),placeholder:"่พ“ๅ…ฅๆƒ…็ปชๆ่ฟฐ...",rows:2,className:"mt-1"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"่พ“ๅ…ฅๆƒ…็ปช็›ธๅ…ณ็š„ๆ–‡ๆœฌๆ่ฟฐ"})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(tt,{id:"is_registered",checked:h,onCheckedChange:w=>{w===!0?(f(!0),g(!1)):f(!1)}}),e.jsx(T,{htmlFor:"is_registered",className:"cursor-pointer",children:"ๅทฒๆณจๅ†Œ"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(tt,{id:"is_banned",checked:p,onCheckedChange:w=>{w===!0?(g(!0),f(!1)):g(!1)}}),e.jsx(T,{htmlFor:"is_banned",className:"cursor-pointer",children:"ๅทฒๅฐ็ฆ"})]})]})]}),e.jsxs(gt,{children:[e.jsx(_,{variant:"outline",onClick:()=>r(!1),children:"ๅ–ๆถˆ"}),e.jsx(_,{onClick:y,disabled:N,children:N?"ไฟๅญ˜ไธญ...":"ไฟๅญ˜"})]})]})}):null}function ck({open:a,onOpenChange:l,onSuccess:r}){const[c,d]=u.useState("select"),[m,h]=u.useState([]),[f,p]=u.useState(null),[g,N]=u.useState(!1),{toast:j}=nt(),b=u.useMemo(()=>new N1({id:"emoji-uploader",autoProceed:!1,restrictions:{maxFileSize:10485760,allowedFileTypes:["image/jpeg","image/png","image/gif","image/webp"],maxNumberOfFiles:20},locale:{pluralize:()=>0,strings:{addMoreFiles:"ๆทปๅŠ ๆ›ดๅคšๆ–‡ไปถ",addingMoreFiles:"ๆญฃๅœจๆทปๅŠ ๆ›ดๅคšๆ–‡ไปถ",allowedFileTypes:"ๅ…่ฎธ็š„ๆ–‡ไปถ็ฑปๅž‹๏ผš%{types}",cancel:"ๅ–ๆถˆ",closeModal:"ๅ…ณ้—ญ",complete:"ๅฎŒๆˆ",connectedToInternet:"ๅทฒ่ฟžๆŽฅๅˆฐไบ’่”็ฝ‘",copyLink:"ๅคๅˆถ้“พๆŽฅ",copyLinkToClipboardFallback:"ๅคๅˆถไธ‹ๆ–น้“พๆŽฅ",copyLinkToClipboardSuccess:"้“พๆŽฅๅทฒๅคๅˆถๅˆฐๅ‰ช่ดดๆฟ",dashboardTitle:"้€‰ๆ‹ฉๆ–‡ไปถ",dashboardWindowTitle:"ๆ–‡ไปถ้€‰ๆ‹ฉ็ช—ๅฃ๏ผˆๆŒ‰ ESC ๅ…ณ้—ญ๏ผ‰",done:"ๅฎŒๆˆ",dropHereOr:"ๆ‹–ๆ”พๆ–‡ไปถๅˆฐ่ฟ™้‡Œๆˆ– %{browse}",dropHint:"ๅฐ†ๆ–‡ไปถๆ‹–ๆ”พๅˆฐๆญคๅค„",dropPasteFiles:"ๅฐ†ๆ–‡ไปถๆ‹–ๆ”พๅˆฐ่ฟ™้‡Œๆˆ– %{browseFiles}",dropPasteFolders:"ๅฐ†ๆ–‡ไปถๆ‹–ๆ”พๅˆฐ่ฟ™้‡Œๆˆ– %{browseFolders}",dropPasteBoth:"ๅฐ†ๆ–‡ไปถๆ‹–ๆ”พๅˆฐ่ฟ™้‡Œ๏ผŒ%{browseFiles} ๆˆ– %{browseFolders}",dropPasteImportFiles:"ๅฐ†ๆ–‡ไปถๆ‹–ๆ”พๅˆฐ่ฟ™้‡Œ๏ผŒ%{browseFiles} ๆˆ–ไปŽไปฅไธ‹ไฝ็ฝฎๅฏผๅ…ฅ๏ผš",dropPasteImportFolders:"ๅฐ†ๆ–‡ไปถๆ‹–ๆ”พๅˆฐ่ฟ™้‡Œ๏ผŒ%{browseFolders} ๆˆ–ไปŽไปฅไธ‹ไฝ็ฝฎๅฏผๅ…ฅ๏ผš",dropPasteImportBoth:"ๅฐ†ๆ–‡ไปถๆ‹–ๆ”พๅˆฐ่ฟ™้‡Œ๏ผŒ%{browseFiles}๏ผŒ%{browseFolders} ๆˆ–ไปŽไปฅไธ‹ไฝ็ฝฎๅฏผๅ…ฅ๏ผš",editFile:"็ผ–่พ‘ๆ–‡ไปถ",editing:"ๆญฃๅœจ็ผ–่พ‘ %{file}",emptyFolderAdded:"ๆœชไปŽ็ฉบๆ–‡ไปถๅคนๆทปๅŠ ๆ–‡ไปถ",exceedsSize:"%{file} ่ถ…่ฟ‡ไบ†ๆœ€ๅคงๅ…่ฎธๅคงๅฐ %{size}",failedToUpload:"ไธŠไผ  %{file} ๅคฑ่ดฅ",fileSource:"ๆ–‡ไปถๆฅๆบ๏ผš%{name}",filesUploadedOfTotal:{0:"ๅทฒไธŠไผ  %{complete} / %{smart_count} ไธชๆ–‡ไปถ",1:"ๅทฒไธŠไผ  %{complete} / %{smart_count} ไธชๆ–‡ไปถ"},filter:"็ญ›้€‰",finishEditingFile:"ๅฎŒๆˆ็ผ–่พ‘ๆ–‡ไปถ",folderAdded:{0:"ๅทฒไปŽ %{folder} ๆทปๅŠ  %{smart_count} ไธชๆ–‡ไปถ",1:"ๅทฒไปŽ %{folder} ๆทปๅŠ  %{smart_count} ไธชๆ–‡ไปถ"},generatingThumbnails:"ๆญฃๅœจ็”Ÿๆˆ็ผฉ็•ฅๅ›พ...",import:"ๅฏผๅ…ฅ",importFiles:"ไปŽไปฅไธ‹ไฝ็ฝฎๅฏผๅ…ฅๆ–‡ไปถ๏ผš",importFrom:"ไปŽ %{name} ๅฏผๅ…ฅ",loading:"ๅŠ ่ฝฝไธญ...",logOut:"็™ปๅ‡บ",myDevice:"ๆˆ‘็š„่ฎพๅค‡",noFilesFound:"่ฟ™้‡Œๆฒกๆœ‰ๆ–‡ไปถๆˆ–ๆ–‡ไปถๅคน",noInternetConnection:"ๆ— ็ฝ‘็ปœ่ฟžๆŽฅ",openFolderNamed:"ๆ‰“ๅผ€ๆ–‡ไปถๅคน %{name}",pause:"ๆš‚ๅœ",pauseUpload:"ๆš‚ๅœไธŠไผ ",paused:"ๅทฒๆš‚ๅœ",poweredBy:"ๆŠ€ๆœฏๆ”ฏๆŒ๏ผš%{uppy}",processingXFiles:{0:"ๆญฃๅœจๅค„็† %{smart_count} ไธชๆ–‡ไปถ",1:"ๆญฃๅœจๅค„็† %{smart_count} ไธชๆ–‡ไปถ"},recording:"ๅฝ•ๅˆถไธญ",removeFile:"็งป้™คๆ–‡ไปถ",resetFilter:"้‡็ฝฎ็ญ›้€‰",resume:"็ปง็ปญ",resumeUpload:"็ปง็ปญไธŠไผ ",retry:"้‡่ฏ•",retryUpload:"้‡่ฏ•ไธŠไผ ",save:"ไฟๅญ˜",saveChanges:"ไฟๅญ˜ๆ›ดๆ”น",selectFileNamed:"้€‰ๆ‹ฉๆ–‡ไปถ %{name}",selectX:{0:"้€‰ๆ‹ฉ %{smart_count}",1:"้€‰ๆ‹ฉ %{smart_count}"},smile:"็ฌ‘ไธ€ไธช๏ผ",startRecording:"ๅผ€ๅง‹ๅฝ•ๅˆถ่ง†้ข‘",stopRecording:"ๅœๆญขๅฝ•ๅˆถ่ง†้ข‘",takePicture:"ๆ‹็…ง",timedOut:"ไธŠไผ ๅทฒๅœๆปž %{seconds} ็ง’๏ผŒๆญฃๅœจไธญๆญขใ€‚",upload:"ไธ‹ไธ€ๆญฅ",uploadComplete:"ไธŠไผ ๅฎŒๆˆ",uploadFailed:"ไธŠไผ ๅคฑ่ดฅ",uploadPaused:"ไธŠไผ ๅทฒๆš‚ๅœ",uploadXFiles:{0:"ไธ‹ไธ€ๆญฅ๏ผˆ%{smart_count} ไธชๆ–‡ไปถ๏ผ‰",1:"ไธ‹ไธ€ๆญฅ๏ผˆ%{smart_count} ไธชๆ–‡ไปถ๏ผ‰"},uploadXNewFiles:{0:"ไธ‹ไธ€ๆญฅ๏ผˆ+%{smart_count} ไธชๆ–‡ไปถ๏ผ‰",1:"ไธ‹ไธ€ๆญฅ๏ผˆ+%{smart_count} ไธชๆ–‡ไปถ๏ผ‰"},uploading:"ๆญฃๅœจไธŠไผ ",uploadingXFiles:{0:"ๆญฃๅœจไธŠไผ  %{smart_count} ไธชๆ–‡ไปถ",1:"ๆญฃๅœจไธŠไผ  %{smart_count} ไธชๆ–‡ไปถ"},xFilesSelected:{0:"ๅทฒ้€‰ๆ‹ฉ %{smart_count} ไธชๆ–‡ไปถ",1:"ๅทฒ้€‰ๆ‹ฉ %{smart_count} ไธชๆ–‡ไปถ"},xMoreFilesAdded:{0:"ๅˆๆทปๅŠ ไบ† %{smart_count} ไธชๆ–‡ไปถ",1:"ๅˆๆทปๅŠ ไบ† %{smart_count} ไธชๆ–‡ไปถ"},xTimeLeft:"ๅ‰ฉไฝ™ %{time}",youCanOnlyUploadFileTypes:"ๆ‚จๅช่ƒฝไธŠไผ ๏ผš%{types}",youCanOnlyUploadX:{0:"ๆ‚จๅช่ƒฝไธŠไผ  %{smart_count} ไธชๆ–‡ไปถ",1:"ๆ‚จๅช่ƒฝไธŠไผ  %{smart_count} ไธชๆ–‡ไปถ"},youHaveToAtLeastSelectX:{0:"ๆ‚จ่‡ณๅฐ‘้œ€่ฆ้€‰ๆ‹ฉ %{smart_count} ไธชๆ–‡ไปถ",1:"ๆ‚จ่‡ณๅฐ‘้œ€่ฆ้€‰ๆ‹ฉ %{smart_count} ไธชๆ–‡ไปถ"},browseFiles:"ๆต่งˆๆ–‡ไปถ",browseFolders:"ๆต่งˆๆ–‡ไปถๅคน",cancelUpload:"ๅ–ๆถˆไธŠไผ ",addMore:"ๆทปๅŠ ๆ›ดๅคš",back:"่ฟ”ๅ›ž",editFileWithFilename:"็ผ–่พ‘ๆ–‡ไปถ %{file}"}}}),[]);u.useEffect(()=>{const H=()=>{const O=b.getFiles();if(O.length===0)return;const X=O.map(L=>({id:L.id,name:L.name,previewUrl:L.preview||URL.createObjectURL(L.data),emotion:"",description:"",isRegistered:!0,file:L.data}));h(X),O.length===1?(p(X[0].id),d("edit-single")):d("edit-multiple")};return b.on("upload",H),()=>{b.off("upload",H)}},[b]),u.useEffect(()=>{a||(b.cancelAll(),d("select"),h([]),p(null),N(!1))},[a,b]);const y=u.useCallback((H,O)=>{h(X=>X.map(L=>L.id===H?{...L,...O}:L))},[]),w=u.useCallback(H=>H.emotion.trim().length>0,[]),z=u.useMemo(()=>m.length>0&&m.every(w),[m,w]),M=u.useMemo(()=>m.find(H=>H.id===f)||null,[m,f]),S=u.useCallback(()=>{(c==="edit-single"||c==="edit-multiple")&&(d("select"),h([]),p(null))},[c]),F=u.useCallback(async()=>{if(!z){j({title:"่ฏทๅกซๅ†™ๅฟ…ๅกซ้กน",description:"ๆฏไธช่กจๆƒ…ๅŒ…็š„ๆƒ…ๆ„Ÿๆ ‡็ญพ้ƒฝๆ˜ฏๅฟ…ๅกซ็š„",variant:"destructive"});return}N(!0);let H=0,O=0;try{for(const X of m){const L=new FormData;L.append("file",X.file),L.append("emotion",X.emotion),L.append("description",X.description),L.append("is_registered",X.isRegistered.toString());try{(await ke(lk(),{method:"POST",body:L})).ok?H++:O++}catch{O++}}O===0?(j({title:"ไธŠไผ ๆˆๅŠŸ",description:`ๆˆๅŠŸไธŠไผ  ${H} ไธช่กจๆƒ…ๅŒ…`}),l(!1),r()):(j({title:"้ƒจๅˆ†ไธŠไผ ๅคฑ่ดฅ",description:`ๆˆๅŠŸ ${H} ไธช๏ผŒๅคฑ่ดฅ ${O} ไธช`,variant:"destructive"}),r())}finally{N(!1)}},[z,m,j,l,r]),E=()=>e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"border rounded-lg overflow-hidden w-full",children:e.jsx(V4,{uppy:b,proudlyDisplayPoweredByUppy:!1,hideProgressDetails:!0,height:350,width:"100%",theme:"auto",note:"ๆ”ฏๆŒ JPGใ€PNGใ€GIFใ€WebP ๆ ผๅผ๏ผŒๆœ€ๅคš 20 ไธชๆ–‡ไปถ"})})}),C=()=>{const H=m[0];return H?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(_,{variant:"ghost",size:"sm",onClick:S,children:[e.jsx($a,{className:"h-4 w-4 mr-1"}),"่ฟ”ๅ›ž"]}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"็ผ–่พ‘่กจๆƒ…ๅŒ…ไฟกๆฏ"})]}),e.jsxs("div",{className:"flex gap-6",children:[e.jsxs("div",{className:"flex-shrink-0",children:[e.jsx("div",{className:"w-32 h-32 rounded-lg border overflow-hidden bg-muted flex items-center justify-center",children:e.jsx("img",{src:H.previewUrl,alt:H.name,className:"max-w-full max-h-full object-contain"})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2 text-center truncate max-w-32",children:H.name})]}),e.jsxs("div",{className:"flex-1 space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"single-emotion",children:["ๆƒ…ๆ„Ÿๆ ‡็ญพ ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ae,{id:"single-emotion",value:H.emotion,onChange:O=>y(H.id,{emotion:O.target.value}),placeholder:"ๅคšไธชๆ ‡็ญพ็”จ้€—ๅทๅˆ†้š”๏ผŒๅฆ‚๏ผšๅผ€ๅฟƒ,้ซ˜ๅ…ด",className:H.emotion.trim()?"":"border-destructive"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"็”จไบŽๆƒ…ๆ„ŸๅŒน้…๏ผŒๅคšไธชๆ ‡็ญพ็”จ้€—ๅทๅˆ†้š”"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"single-description",children:"ๆ่ฟฐ"}),e.jsx(ae,{id:"single-description",value:H.description,onChange:O=>y(H.id,{description:O.target.value}),placeholder:"่พ“ๅ…ฅ่กจๆƒ…ๅŒ…ๆ่ฟฐ..."})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(tt,{id:"single-is-registered",checked:H.isRegistered,onCheckedChange:O=>y(H.id,{isRegistered:O===!0})}),e.jsx(T,{htmlFor:"single-is-registered",className:"cursor-pointer",children:"ไธŠไผ ๅŽ็ซ‹ๅณๆณจๅ†Œ๏ผˆๅฏ่ขซ้บฆ้บฆไฝฟ็”จ๏ผ‰"})]})]})]}),e.jsx(gt,{children:e.jsx(_,{onClick:F,disabled:!z||g,children:g?"ไธŠไผ ไธญ...":"ไธŠไผ "})})]}):null},R=()=>{const H=m.filter(w).length,O=m.length;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(_,{variant:"ghost",size:"sm",onClick:S,children:[e.jsx($a,{className:"h-4 w-4 mr-1"}),"่ฟ”ๅ›ž"]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["็ผ–่พ‘่กจๆƒ…ๅŒ…ไฟกๆฏ๏ผˆ",H,"/",O," ๅทฒๅฎŒๆˆ๏ผ‰"]})]}),e.jsx(Ce,{variant:z?"default":"secondary",children:z?e.jsxs(e.Fragment,{children:[e.jsx(Ot,{className:"h-3 w-3 mr-1"}),"ๅ…จ้ƒจๅฎŒๆˆ"]}):e.jsxs(e.Fragment,{children:[e.jsx(Sa,{className:"h-3 w-3 mr-1"}),"ๆœชๅฎŒๆˆ"]})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(ts,{className:"h-[350px] pr-2",children:e.jsx("div",{className:"space-y-2",children:m.map(X=>{const L=w(X),me=f===X.id;return e.jsxs("div",{onClick:()=>p(X.id),className:` flex items-center gap-3 p-3 rounded-lg border-2 cursor-pointer transition-all ${me?"ring-2 ring-primary":""} ${L?"border-green-500 bg-green-50 dark:bg-green-950/20":"border-border hover:border-muted-foreground/50"} - `,children:[e.jsx("div",{className:"w-12 h-12 rounded border overflow-hidden bg-muted flex-shrink-0 flex items-center justify-center",children:e.jsx("img",{src:X.previewUrl,alt:X.name,className:"max-w-full max-h-full object-contain"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:X.name}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:X.emotion||"ๆœชๅกซๅ†™ๆƒ…ๆ„Ÿๆ ‡็ญพ"})]}),L?e.jsx(st,{className:"h-5 w-5 text-green-500 flex-shrink-0"}):e.jsx("div",{className:"h-5 w-5 rounded-full border-2 border-muted-foreground/30 flex-shrink-0"})]},X.id)})})}),e.jsx("div",{className:"border rounded-lg p-4",children:M?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-16 h-16 rounded border overflow-hidden bg-muted flex items-center justify-center",children:e.jsx("img",{src:M.previewUrl,alt:M.name,className:"max-w-full max-h-full object-contain"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium truncate",children:M.name}),w(M)&&e.jsxs(Ce,{variant:"outline",className:"text-green-600 border-green-600",children:[e.jsx(Ot,{className:"h-3 w-3 mr-1"}),"ๅทฒๅฎŒๆˆ"]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"multi-emotion",children:["ๆƒ…ๆ„Ÿๆ ‡็ญพ ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ne,{id:"multi-emotion",value:M.emotion,onChange:X=>y(M.id,{emotion:X.target.value}),placeholder:"ๅคšไธชๆ ‡็ญพ็”จ้€—ๅทๅˆ†้š”๏ผŒๅฆ‚๏ผšๅผ€ๅฟƒ,้ซ˜ๅ…ด",className:M.emotion.trim()?"":"border-destructive"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"multi-description",children:"ๆ่ฟฐ"}),e.jsx(ne,{id:"multi-description",value:M.description,onChange:X=>y(M.id,{description:X.target.value}),placeholder:"่พ“ๅ…ฅ่กจๆƒ…ๅŒ…ๆ่ฟฐ..."})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(tt,{id:"multi-is-registered",checked:M.isRegistered,onCheckedChange:X=>y(M.id,{isRegistered:X===!0})}),e.jsx(T,{htmlFor:"multi-is-registered",className:"cursor-pointer text-sm",children:"ไธŠไผ ๅŽ็ซ‹ๅณๆณจๅ†Œ"})]})]}):e.jsx("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:e.jsxs("div",{className:"text-center",children:[e.jsx(xx,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"็‚นๅ‡ปๅทฆไพงๅก็‰‡็ผ–่พ‘"})]})})})]}),e.jsx(gt,{children:e.jsx(_,{onClick:F,disabled:!z||g,children:g?"ไธŠไผ ไธญ...":`ไธŠไผ ๅ…จ้ƒจ (${O})`})})]})};return e.jsx(Qs,{open:a,onOpenChange:l,children:e.jsxs(Hs,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[e.jsxs(qs,{children:[e.jsxs(Vs,{className:"flex items-center gap-2",children:[e.jsx(cc,{className:"h-5 w-5"}),c==="select"&&"ไธŠไผ ่กจๆƒ…ๅŒ… - ้€‰ๆ‹ฉๆ–‡ไปถ",c==="edit-single"&&"ไธŠไผ ่กจๆƒ…ๅŒ… - ๅกซๅ†™ไฟกๆฏ",c==="edit-multiple"&&"ไธŠไผ ่กจๆƒ…ๅŒ… - ๆ‰น้‡็ผ–่พ‘"]}),e.jsxs(at,{children:[c==="select"&&"ๆ”ฏๆŒ JPGใ€PNGใ€GIFใ€WebP ๆ ผๅผ๏ผŒๅ•ไธชๆ–‡ไปถๆœ€ๅคง 10MB๏ผŒๅฏๅŒๆ—ถไธŠไผ ๅคšไธชๆ–‡ไปถ",c==="edit-single"&&"่ฏทๅกซๅ†™่กจๆƒ…ๅŒ…็š„ๆƒ…ๆ„Ÿๆ ‡็ญพ๏ผˆๅฟ…ๅกซ๏ผ‰ๅ’Œๆ่ฟฐ",c==="edit-multiple"&&"็‚นๅ‡ปๅทฆไพงๅก็‰‡็ผ–่พ‘ๆฏไธช่กจๆƒ…ๅŒ…็š„ไฟกๆฏ๏ผŒๆƒ…ๆ„Ÿๆ ‡็ญพไธบๅฟ…ๅกซ้กน"]})]}),e.jsxs("div",{className:"overflow-y-auto pr-1",children:[c==="select"&&E(),c==="edit-single"&&C(),c==="edit-multiple"&&R()]})]})})}function ok(){const[a,l]=u.useState([]),[r,c]=u.useState(!0),[d,m]=u.useState(0),[h,f]=u.useState(1),[p,g]=u.useState(20),[N,j]=u.useState(""),[b,y]=u.useState(null),[w,z]=u.useState(!1),[M,S]=u.useState(!1),[F,E]=u.useState(!1),[C,R]=u.useState(null),[H,O]=u.useState(new Set),[X,L]=u.useState(!1),[me,Ne]=u.useState(""),[je,ce]=u.useState({total:0,recent_7days:0,chat_count:0,top_chats:{}}),[ge,pe]=u.useState([]),[D,Q]=u.useState(new Map),[B,ue]=u.useState(!1),[Y,we]=u.useState(0),{toast:fe}=nt(),Ee=async()=>{try{c(!0);const le=await a2({page:h,page_size:p,search:N||void 0});l(le.data),m(le.total)}catch(le){fe({title:"ๅŠ ่ฝฝๅคฑ่ดฅ",description:le instanceof Error?le.message:"ๆ— ๆณ•ๅŠ ่ฝฝ่กจ่พพๆ–นๅผ",variant:"destructive"})}finally{c(!1)}},G=async()=>{try{const le=await o2();le?.data&&ce(le.data)}catch(le){console.error("ๅŠ ่ฝฝ็ปŸ่ฎกๆ•ฐๆฎๅคฑ่ดฅ:",le)}},$=async()=>{try{const le=await jx();we(le.unchecked)}catch(le){console.error("ๅŠ ่ฝฝๅฎกๆ ธ็ปŸ่ฎกๅคฑ่ดฅ:",le)}},A=async()=>{try{const le=await gx();if(le?.data){pe(le.data);const De=new Map;le.data.forEach(xe=>{De.set(xe.chat_id,xe.chat_name)}),Q(De)}}catch(le){console.error("ๅŠ ่ฝฝ่Šๅคฉๅˆ—่กจๅคฑ่ดฅ:",le)}},K=le=>D.get(le)||le;u.useEffect(()=>{Ee(),$(),G(),A()},[h,p,N]);const Re=async le=>{try{const De=await l2(le.id);y(De.data),z(!0)}catch(De){fe({title:"ๅŠ ่ฝฝ่ฏฆๆƒ…ๅคฑ่ดฅ",description:De instanceof Error?De.message:"ๆ— ๆณ•ๅŠ ่ฝฝ่กจ่พพๆ–นๅผ่ฏฆๆƒ…",variant:"destructive"})}},se=le=>{y(le),S(!0)},$e=async le=>{try{await i2(le.id),fe({title:"ๅˆ ้™คๆˆๅŠŸ",description:`ๅทฒๅˆ ้™ค่กจ่พพๆ–นๅผ: ${le.situation}`}),R(null),Ee(),G()}catch(De){fe({title:"ๅˆ ้™คๅคฑ่ดฅ",description:De instanceof Error?De.message:"ๆ— ๆณ•ๅˆ ้™ค่กจ่พพๆ–นๅผ",variant:"destructive"})}},cs=le=>{const De=new Set(H);De.has(le)?De.delete(le):De.add(le),O(De)},J=()=>{H.size===a.length&&a.length>0?O(new Set):O(new Set(a.map(le=>le.id)))},Z=async()=>{try{await c2(Array.from(H)),fe({title:"ๆ‰น้‡ๅˆ ้™คๆˆๅŠŸ",description:`ๅทฒๅˆ ้™ค ${H.size} ไธช่กจ่พพๆ–นๅผ`}),O(new Set),L(!1),Ee(),G()}catch(le){fe({title:"ๆ‰น้‡ๅˆ ้™คๅคฑ่ดฅ",description:le instanceof Error?le.message:"ๆ— ๆณ•ๆ‰น้‡ๅˆ ้™ค่กจ่พพๆ–นๅผ",variant:"destructive"})}},Le=()=>{const le=parseInt(me),De=Math.ceil(d/p);le>=1&&le<=De?(f(le),Ne("")):fe({title:"ๆ— ๆ•ˆ็š„้กต็ ",description:`่ฏท่พ“ๅ…ฅ1-${De}ไน‹้—ด็š„้กต็ `,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(Ia,{className:"h-8 w-8",strokeWidth:2}),"่กจ่พพๆ–นๅผ็ฎก็†"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"็ฎก็†้บฆ้บฆ็š„่กจ่พพๆ–นๅผๅ’Œ่ฏๆœฏๆจกๆฟ"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(_,{variant:"outline",onClick:()=>ue(!0),className:"gap-2",children:[e.jsx(cv,{className:"h-4 w-4"}),"ไบบๅทฅๅฎกๆ ธ",Y>0&&e.jsx("span",{className:"ml-1 px-1.5 py-0.5 text-xs rounded-full bg-orange-500 text-white",children:Y>99?"99+":Y})]}),e.jsxs(_,{onClick:()=>E(!0),className:"gap-2",children:[e.jsx(Xs,{className:"h-4 w-4"}),"ๆ–ฐๅขž่กจ่พพๆ–นๅผ"]})]})]})}),e.jsx(ts,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"ๆ€ปๆ•ฐ้‡"}),e.jsx("div",{className:"text-2xl font-bold mt-1",children:je.total})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"่ฟ‘7ๅคฉๆ–ฐๅขž"}),e.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:je.recent_7days})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"ๅ…ณ่”่Šๅคฉๆ•ฐ"}),e.jsx("div",{className:"text-2xl font-bold mt-1 text-blue-600",children:je.chat_count})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx(T,{htmlFor:"search",children:"ๆœ็ดข"}),e.jsx("div",{className:"flex flex-col sm:flex-row gap-2 mt-1.5",children:e.jsxs("div",{className:"flex-1 relative",children:[e.jsx($t,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(ne,{id:"search",placeholder:"ๆœ็ดขๆƒ…ๅขƒใ€้ฃŽๆ ผๆˆ–ไธŠไธ‹ๆ–‡...",value:N,onChange:le=>j(le.target.value),className:"pl-9"})]})}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[e.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:H.size>0&&e.jsxs("span",{children:["ๅทฒ้€‰ๆ‹ฉ ",H.size," ไธช่กจ่พพๆ–นๅผ"]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"ๆฏ้กตๆ˜พ็คบ"}),e.jsxs(Pe,{value:p.toString(),onValueChange:le=>{g(parseInt(le)),f(1),O(new Set)},children:[e.jsx(Be,{id:"page-size",className:"w-20",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"10",children:"10"}),e.jsx(W,{value:"20",children:"20"}),e.jsx(W,{value:"50",children:"50"}),e.jsx(W,{value:"100",children:"100"})]})]}),H.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>O(new Set),children:"ๅ–ๆถˆ้€‰ๆ‹ฉ"}),e.jsxs(_,{variant:"destructive",size:"sm",onClick:()=>L(!0),children:[e.jsx(os,{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(ql,{children:[e.jsx(Vl,{children:e.jsxs(_t,{children:[e.jsx(ns,{className:"w-12",children:e.jsx(tt,{checked:H.size===a.length&&a.length>0,onCheckedChange:J})}),e.jsx(ns,{children:"ๆƒ…ๅขƒ"}),e.jsx(ns,{children:"้ฃŽๆ ผ"}),e.jsx(ns,{children:"่Šๅคฉ"}),e.jsx(ns,{className:"text-right",children:"ๆ“ไฝœ"})]})}),e.jsx(Gl,{children:r?e.jsx(_t,{children:e.jsx(Ze,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"ๅŠ ่ฝฝไธญ..."})}):a.length===0?e.jsx(_t,{children:e.jsx(Ze,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"ๆš‚ๆ— ๆ•ฐๆฎ"})}):a.map(le=>e.jsxs(_t,{children:[e.jsx(Ze,{children:e.jsx(tt,{checked:H.has(le.id),onCheckedChange:()=>cs(le.id)})}),e.jsx(Ze,{className:"font-medium max-w-xs truncate",children:le.situation}),e.jsx(Ze,{className:"max-w-xs truncate",children:le.style}),e.jsx(Ze,{className:"max-w-[200px] truncate",title:K(le.chat_id),style:{wordBreak:"keep-all"},children:e.jsx("span",{className:"whitespace-nowrap overflow-hidden text-ellipsis block",children:K(le.chat_id)})}),e.jsx(Ze,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>se(le),children:[e.jsx(sr,{className:"h-4 w-4 mr-1"}),"็ผ–่พ‘"]}),e.jsx(_,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>Re(le),title:"ๆŸฅ็œ‹่ฏฆๆƒ…",children:e.jsx(ua,{className:"h-4 w-4"})}),e.jsxs(_,{size:"sm",onClick:()=>R(le),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(os,{className:"h-4 w-4 mr-1"}),"ๅˆ ้™ค"]})]})})]},le.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3 p-4",children:r?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"ๅŠ ่ฝฝไธญ..."}):a.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"ๆš‚ๆ— ๆ•ฐๆฎ"}):a.map(le=>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(tt,{checked:H.has(le.id),onCheckedChange:()=>cs(le.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:le.situation,children:le.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:le.style,children:le.style})]})]})]}),e.jsxs("div",{className:"text-sm",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"่Šๅคฉ"}),e.jsx("p",{className:"text-sm truncate",title:K(le.chat_id),style:{wordBreak:"keep-all"},children:K(le.chat_id)})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>se(le),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(sr,{className:"h-3 w-3 mr-1"}),"็ผ–่พ‘"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>Re(le),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:e.jsx(ua,{className:"h-3 w-3"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>R(le),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[e.jsx(os,{className:"h-3 w-3 mr-1"}),"ๅˆ ้™ค"]})]})]},le.id))}),d>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["ๅ…ฑ ",d," ๆก่ฎฐๅฝ•๏ผŒ็ฌฌ ",h," / ",Math.ceil(d/p)," ้กต"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(kn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h-1),disabled:h===1,children:[e.jsx(Pa,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"ไธŠไธ€้กต"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{type:"number",value:me,onChange:le=>Ne(le.target.value),onKeyDown:le=>le.key==="Enter"&&Le(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(d/p)}),e.jsx(_,{variant:"outline",size:"sm",onClick:Le,disabled:!me,className:"h-8",children:"่ทณ่ฝฌ"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h+1),disabled:h>=Math.ceil(d/p),children:[e.jsx("span",{className:"hidden sm:inline",children:"ไธ‹ไธ€้กต"}),e.jsx(ra,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(d/p)),disabled:h>=Math.ceil(d/p),className:"hidden sm:flex",children:e.jsx(Cn,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(dk,{expression:b,open:w,onOpenChange:z,chatNameMap:D}),e.jsx(uk,{open:F,onOpenChange:E,chatList:ge,onSuccess:()=>{Ee(),G(),E(!1)}}),e.jsx(mk,{expression:b,open:M,onOpenChange:S,chatList:ge,onSuccess:()=>{Ee(),G(),S(!1)}}),e.jsx(bs,{open:!!C,onOpenChange:()=>R(null),children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsxs(gs,{children:['็กฎๅฎš่ฆๅˆ ้™ค่กจ่พพๆ–นๅผ "',C?.situation,'" ๅ—๏ผŸ ๆญคๆ“ไฝœไธๅฏๆ’ค้”€ใ€‚']})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:()=>C&&$e(C),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"ๅˆ ้™ค"})]})]})}),e.jsx(xk,{open:X,onOpenChange:L,onConfirm:Z,count:H.size}),e.jsx(Pv,{open:B,onOpenChange:le=>{ue(le),le||(Ee(),G(),$())}})]})}function dk({expression:a,open:l,onOpenChange:r,chatNameMap:c}){if(!a)return null;const d=h=>h?new Date(h*1e3).toLocaleString("zh-CN"):"-",m=h=>c.get(h)||h;return e.jsx(Qs,{open:l,onOpenChange:r,children:e.jsxs(Hs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"่กจ่พพๆ–นๅผ่ฏฆๆƒ…"}),e.jsx(at,{children:"ๆŸฅ็œ‹่กจ่พพๆ–นๅผ็š„ๅฎŒๆ•ดไฟกๆฏ"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Yi,{label:"ๆƒ…ๅขƒ",value:a.situation}),e.jsx(Yi,{label:"้ฃŽๆ ผ",value:a.style}),e.jsx(Yi,{label:"่Šๅคฉ",value:m(a.chat_id)}),e.jsx(Yi,{icon:Wr,label:"่ฎฐๅฝ•ID",value:a.id.toString(),mono:!0})]}),e.jsx("div",{className:"grid grid-cols-2 gap-4",children:e.jsx(Yi,{icon:da,label:"ๅˆ›ๅปบๆ—ถ้—ด",value:d(a.create_date)})}),e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-4",children:[e.jsx(T,{className:"text-xs text-muted-foreground mb-3 block",children:"็Šถๆ€ๆ ‡่ฎฐ"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:P("flex h-8 w-8 items-center justify-center rounded-full",a.checked?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-400 dark:bg-gray-800 dark:text-gray-600"),children:a.checked?e.jsx(st,{className:"h-5 w-5"}):e.jsx(Vo,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"ๅทฒๆฃ€ๆŸฅ"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a.checked?"ๅทฒ้€š่ฟ‡ๅฎกๆ ธ":"ๆœชๅฎกๆ ธ"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:P("flex h-8 w-8 items-center justify-center rounded-full",a.rejected?"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400":"bg-gray-100 text-gray-400 dark:bg-gray-800 dark:text-gray-600"),children:a.rejected?e.jsx(ta,{className:"h-5 w-5"}):e.jsx(Vo,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"ๅทฒๆ‹’็ป"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a.rejected?"ไธไผš่ขซไฝฟ็”จ":"ๆญฃๅธธ"})]})]})]})]})]}),e.jsx(gt,{children:e.jsx(_,{onClick:()=>r(!1),children:"ๅ…ณ้—ญ"})})]})})}function Yi({icon:a,label:l,value:r,mono:c=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(T,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[a&&e.jsx(a,{className:"h-3 w-3"}),l]}),e.jsx("div",{className:P("text-sm",c&&"font-mono",!r&&"text-muted-foreground"),children:r||"-"})]})}function uk({open:a,onOpenChange:l,chatList:r,onSuccess:c}){const[d,m]=u.useState({situation:"",style:"",chat_id:""}),[h,f]=u.useState(!1),{toast:p}=nt(),g=async()=>{if(!d.situation||!d.style||!d.chat_id){p({title:"้ชŒ่ฏๅคฑ่ดฅ",description:"่ฏทๅกซๅ†™ๅฟ…ๅกซๅญ—ๆฎต๏ผšๆƒ…ๅขƒใ€้ฃŽๆ ผๅ’Œ่Šๅคฉ",variant:"destructive"});return}try{f(!0),await n2(d),p({title:"ๅˆ›ๅปบๆˆๅŠŸ",description:"่กจ่พพๆ–นๅผๅทฒๅˆ›ๅปบ"}),m({situation:"",style:"",chat_id:""}),c()}catch(N){p({title:"ๅˆ›ๅปบๅคฑ่ดฅ",description:N instanceof Error?N.message:"ๆ— ๆณ•ๅˆ›ๅปบ่กจ่พพๆ–นๅผ",variant:"destructive"})}finally{f(!1)}};return e.jsx(Qs,{open:a,onOpenChange:l,children:e.jsxs(Hs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"ๆ–ฐๅขž่กจ่พพๆ–นๅผ"}),e.jsx(at,{children:"ๅˆ›ๅปบๆ–ฐ็š„่กจ่พพๆ–นๅผ่ฎฐๅฝ•"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"situation",children:["ๆƒ…ๅขƒ ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ne,{id:"situation",value:d.situation,onChange:N=>m({...d,situation:N.target.value}),placeholder:"ๆ่ฟฐไฝฟ็”จๅœบๆ™ฏ"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"style",children:["้ฃŽๆ ผ ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ne,{id:"style",value:d.style,onChange:N=>m({...d,style:N.target.value}),placeholder:"ๆ่ฟฐ่กจ่พพ้ฃŽๆ ผ"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"chat_id",children:["่Šๅคฉ ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs(Pe,{value:d.chat_id,onValueChange:N=>m({...d,chat_id:N}),children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"้€‰ๆ‹ฉๅ…ณ่”็š„่Šๅคฉ"})}),e.jsx(Ie,{children:r.map(N=>e.jsx(W,{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(gt,{children:[e.jsx(_,{variant:"outline",onClick:()=>l(!1),children:"ๅ–ๆถˆ"}),e.jsx(_,{onClick:g,disabled:h,children:h?"ๅˆ›ๅปบไธญ...":"ๅˆ›ๅปบ"})]})]})})}function mk({expression:a,open:l,onOpenChange:r,chatList:c,onSuccess:d}){const[m,h]=u.useState({}),[f,p]=u.useState(!1),{toast:g}=nt();u.useEffect(()=>{a&&h({situation:a.situation,style:a.style,chat_id:a.chat_id,checked:a.checked,rejected:a.rejected})},[a]);const N=async()=>{if(a)try{p(!0),await r2(a.id,m),g({title:"ไฟๅญ˜ๆˆๅŠŸ",description:"่กจ่พพๆ–นๅผๅทฒๆ›ดๆ–ฐ"}),d()}catch(j){g({title:"ไฟๅญ˜ๅคฑ่ดฅ",description:j instanceof Error?j.message:"ๆ— ๆณ•ๆ›ดๆ–ฐ่กจ่พพๆ–นๅผ",variant:"destructive"})}finally{p(!1)}};return a?e.jsx(Qs,{open:l,onOpenChange:r,children:e.jsxs(Hs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"็ผ–่พ‘่กจ่พพๆ–นๅผ"}),e.jsx(at,{children:"ไฟฎๆ”น่กจ่พพๆ–นๅผ็š„ไฟกๆฏ"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_situation",children:"ๆƒ…ๅขƒ"}),e.jsx(ne,{id:"edit_situation",value:m.situation||"",onChange:j=>h({...m,situation:j.target.value}),placeholder:"ๆ่ฟฐไฝฟ็”จๅœบๆ™ฏ"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_style",children:"้ฃŽๆ ผ"}),e.jsx(ne,{id:"edit_style",value:m.style||"",onChange:j=>h({...m,style:j.target.value}),placeholder:"ๆ่ฟฐ่กจ่พพ้ฃŽๆ ผ"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_chat_id",children:"่Šๅคฉ"}),e.jsxs(Pe,{value:m.chat_id||"",onValueChange:j=>h({...m,chat_id:j}),children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"้€‰ๆ‹ฉๅ…ณ่”็š„่Šๅคฉ"})}),e.jsx(Ie,{children:c.map(j=>e.jsx(W,{value:j.chat_id,children:e.jsxs("span",{className:"truncate",style:{wordBreak:"keep-all"},children:[j.chat_name,j.is_group&&e.jsx("span",{className:"text-muted-foreground ml-1",children:"(็พค่Š)"})]})},j.chat_id))})]})]}),e.jsxs(ht,{children:[e.jsx(Yt,{className:"h-4 w-4"}),e.jsx(ft,{className:"text-xs",children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{children:e.jsx("strong",{children:"็Šถๆ€ๆ ‡่ฎฐ่ฏดๆ˜Ž๏ผš"})}),e.jsx("p",{children:"โ€ข ๅทฒๆฃ€ๆŸฅ๏ผš่กจ็คบ่ฏฅ่กจ่พพๆ–นๅผๅทฒ้€š่ฟ‡ๅฎกๆ ธ๏ผˆๅฏ็”ฑAI่‡ชๅŠจๆฃ€ๆŸฅๆˆ–ไบบๅทฅๅฎกๆ ธ๏ผ‰"}),e.jsx("p",{children:"โ€ข ๅทฒๆ‹’็ป๏ผš่กจ็คบ่ฏฅ่กจ่พพๆ–นๅผ่ขซๆ ‡่ฎฐไธบไธๅˆ้€‚๏ผŒๅฐ†ๆฐธ่ฟœไธไผš่ขซไฝฟ็”จ"}),e.jsxs("p",{className:"text-muted-foreground mt-2",children:['ๆ นๆฎ้…็ฝฎไธญ"ไป…ไฝฟ็”จๅทฒๅฎกๆ ธ้€š่ฟ‡็š„่กจ่พพๆ–นๅผ"่ฎพ็ฝฎ๏ผš',e.jsx("br",{}),"โ€ข ๅผ€ๅฏๆ—ถ๏ผšๅชๆœ‰้€š่ฟ‡ๅฎกๆ ธ๏ผˆๅทฒๆฃ€ๆŸฅ๏ผ‰็š„้กน็›ฎไผš่ขซไฝฟ็”จ",e.jsx("br",{}),"โ€ข ๅ…ณ้—ญๆ—ถ๏ผšๆœชๅฎกๆ ธ็š„้กน็›ฎไนŸไผš่ขซไฝฟ็”จ"]})]})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"flex items-center justify-between space-x-2 rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{htmlFor:"edit_checked",className:"text-sm font-medium",children:"ๅทฒๆฃ€ๆŸฅ"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅทฒ้€š่ฟ‡ๅฎกๆ ธ"})]}),e.jsx(Ge,{id:"edit_checked",checked:m.checked??!1,onCheckedChange:j=>h({...m,checked:j})})]}),e.jsxs("div",{className:"flex items-center justify-between space-x-2 rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{htmlFor:"edit_rejected",className:"text-sm font-medium",children:"ๅทฒๆ‹’็ป"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ไธไผš่ขซไฝฟ็”จ"})]}),e.jsx(Ge,{id:"edit_rejected",checked:m.rejected??!1,onCheckedChange:j=>h({...m,rejected:j})})]})]})]}),e.jsxs(gt,{children:[e.jsx(_,{variant:"outline",onClick:()=>r(!1),children:"ๅ–ๆถˆ"}),e.jsx(_,{onClick:N,disabled:f,children:f?"ไฟๅญ˜ไธญ...":"ไฟๅญ˜"})]})]})}):null}function xk({open:a,onOpenChange:l,onConfirm:r,count:c}){return e.jsx(bs,{open:a,onOpenChange:l,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๆ‰น้‡ๅˆ ้™ค"}),e.jsxs(gs,{children:["ๆ‚จๅณๅฐ†ๅˆ ้™ค ",c," ไธช่กจ่พพๆ–นๅผ๏ผŒๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚็กฎๅฎš่ฆ็ปง็ปญๅ—๏ผŸ"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:r,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"็กฎ่ฎคๅˆ ้™ค"})]})]})})}const Kl="/api/webui/jargon";async function hk(){const a=await ke(`${Kl}/chats`,{});if(!a.ok){const l=await a.json();throw new Error(l.detail||"่Žทๅ–่Šๅคฉๅˆ—่กจๅคฑ่ดฅ")}return a.json()}async function fk(a){const l=new URLSearchParams;a.page&&l.append("page",a.page.toString()),a.page_size&&l.append("page_size",a.page_size.toString()),a.search&&l.append("search",a.search),a.chat_id&&l.append("chat_id",a.chat_id),a.is_jargon!==void 0&&a.is_jargon!==null&&l.append("is_jargon",a.is_jargon.toString()),a.is_global!==void 0&&l.append("is_global",a.is_global.toString());const r=await ke(`${Kl}/list?${l}`,{});if(!r.ok){const c=await r.json();throw new Error(c.detail||"่Žทๅ–้ป‘่ฏๅˆ—่กจๅคฑ่ดฅ")}return r.json()}async function pk(a){const l=await ke(`${Kl}/${a}`,{});if(!l.ok){const r=await l.json();throw new Error(r.detail||"่Žทๅ–้ป‘่ฏ่ฏฆๆƒ…ๅคฑ่ดฅ")}return l.json()}async function gk(a){const l=await ke(`${Kl}/`,{method:"POST",body:JSON.stringify(a)});if(!l.ok){const r=await l.json();throw new Error(r.detail||"ๅˆ›ๅปบ้ป‘่ฏๅคฑ่ดฅ")}return l.json()}async function jk(a,l){const r=await ke(`${Kl}/${a}`,{method:"PATCH",body:JSON.stringify(l)});if(!r.ok){const c=await r.json();throw new Error(c.detail||"ๆ›ดๆ–ฐ้ป‘่ฏๅคฑ่ดฅ")}return r.json()}async function vk(a){const l=await ke(`${Kl}/${a}`,{method:"DELETE"});if(!l.ok){const r=await l.json();throw new Error(r.detail||"ๅˆ ้™ค้ป‘่ฏๅคฑ่ดฅ")}return l.json()}async function Nk(a){const l=await ke(`${Kl}/batch/delete`,{method:"POST",body:JSON.stringify({ids:a})});if(!l.ok){const r=await l.json();throw new Error(r.detail||"ๆ‰น้‡ๅˆ ้™ค้ป‘่ฏๅคฑ่ดฅ")}return l.json()}async function bk(){const a=await ke(`${Kl}/stats/summary`,{});if(!a.ok){const l=await a.json();throw new Error(l.detail||"่Žทๅ–้ป‘่ฏ็ปŸ่ฎกๅคฑ่ดฅ")}return a.json()}async function yk(a,l){const r=new URLSearchParams;a.forEach(d=>r.append("ids",d.toString())),r.append("is_jargon",l.toString());const c=await ke(`${Kl}/batch/set-jargon?${r}`,{method:"POST"});if(!c.ok){const d=await c.json();throw new Error(d.detail||"ๆ‰น้‡่ฎพ็ฝฎ้ป‘่ฏ็Šถๆ€ๅคฑ่ดฅ")}return c.json()}function wk(){const[a,l]=u.useState([]),[r,c]=u.useState(!0),[d,m]=u.useState(0),[h,f]=u.useState(1),[p,g]=u.useState(20),[N,j]=u.useState(""),[b,y]=u.useState("all"),[w,z]=u.useState("all"),[M,S]=u.useState(null),[F,E]=u.useState(!1),[C,R]=u.useState(!1),[H,O]=u.useState(!1),[X,L]=u.useState(null),[me,Ne]=u.useState(new Set),[je,ce]=u.useState(!1),[ge,pe]=u.useState(""),[D,Q]=u.useState({total:0,confirmed_jargon:0,confirmed_not_jargon:0,pending:0,global_count:0,complete_count:0,chat_count:0,top_chats:{}}),[B,ue]=u.useState([]),{toast:Y}=nt(),we=async()=>{try{c(!0);const Z=await fk({page:h,page_size:p,search:N||void 0,chat_id:b==="all"?void 0:b,is_jargon:w==="all"?void 0:w==="true"?!0:w==="false"?!1:void 0});l(Z.data),m(Z.total)}catch(Z){Y({title:"ๅŠ ่ฝฝๅคฑ่ดฅ",description:Z instanceof Error?Z.message:"ๆ— ๆณ•ๅŠ ่ฝฝ้ป‘่ฏๅˆ—่กจ",variant:"destructive"})}finally{c(!1)}},fe=async()=>{try{const Z=await bk();Z?.data&&Q(Z.data)}catch(Z){console.error("ๅŠ ่ฝฝ็ปŸ่ฎกๆ•ฐๆฎๅคฑ่ดฅ:",Z)}},Ee=async()=>{try{const Z=await hk();Z?.data&&ue(Z.data)}catch(Z){console.error("ๅŠ ่ฝฝ่Šๅคฉๅˆ—่กจๅคฑ่ดฅ:",Z)}};u.useEffect(()=>{we(),fe(),Ee()},[h,p,N,b,w]);const G=async Z=>{try{const Le=await pk(Z.id);S(Le.data),E(!0)}catch(Le){Y({title:"ๅŠ ่ฝฝ่ฏฆๆƒ…ๅคฑ่ดฅ",description:Le instanceof Error?Le.message:"ๆ— ๆณ•ๅŠ ่ฝฝ้ป‘่ฏ่ฏฆๆƒ…",variant:"destructive"})}},$=Z=>{S(Z),R(!0)},A=async Z=>{try{await vk(Z.id),Y({title:"ๅˆ ้™คๆˆๅŠŸ",description:`ๅทฒๅˆ ้™ค้ป‘่ฏ: ${Z.content}`}),L(null),we(),fe()}catch(Le){Y({title:"ๅˆ ้™คๅคฑ่ดฅ",description:Le instanceof Error?Le.message:"ๆ— ๆณ•ๅˆ ้™ค้ป‘่ฏ",variant:"destructive"})}},K=Z=>{const Le=new Set(me);Le.has(Z)?Le.delete(Z):Le.add(Z),Ne(Le)},Re=()=>{me.size===a.length&&a.length>0?Ne(new Set):Ne(new Set(a.map(Z=>Z.id)))},se=async()=>{try{await Nk(Array.from(me)),Y({title:"ๆ‰น้‡ๅˆ ้™คๆˆๅŠŸ",description:`ๅทฒๅˆ ้™ค ${me.size} ไธช้ป‘่ฏ`}),Ne(new Set),ce(!1),we(),fe()}catch(Z){Y({title:"ๆ‰น้‡ๅˆ ้™คๅคฑ่ดฅ",description:Z instanceof Error?Z.message:"ๆ— ๆณ•ๆ‰น้‡ๅˆ ้™ค้ป‘่ฏ",variant:"destructive"})}},$e=async Z=>{try{await yk(Array.from(me),Z),Y({title:"ๆ“ไฝœๆˆๅŠŸ",description:`ๅทฒๅฐ† ${me.size} ไธช่ฏๆก่ฎพไธบ${Z?"้ป‘่ฏ":"้ž้ป‘่ฏ"}`}),Ne(new Set),we(),fe()}catch(Le){Y({title:"ๆ“ไฝœๅคฑ่ดฅ",description:Le instanceof Error?Le.message:"ๆ‰น้‡่ฎพ็ฝฎๅคฑ่ดฅ",variant:"destructive"})}},cs=()=>{const Z=parseInt(ge),Le=Math.ceil(d/p);Z>=1&&Z<=Le?(f(Z),pe("")):Y({title:"ๆ— ๆ•ˆ็š„้กต็ ",description:`่ฏท่พ“ๅ…ฅ1-${Le}ไน‹้—ด็š„้กต็ `,variant:"destructive"})},J=Z=>Z===!0?e.jsxs(Ce,{variant:"default",className:"bg-green-600 hover:bg-green-700",children:[e.jsx(Ot,{className:"h-3 w-3 mr-1"}),"ๆ˜ฏ้ป‘่ฏ"]}):Z===!1?e.jsxs(Ce,{variant:"secondary",children:[e.jsx(Sa,{className:"h-3 w-3 mr-1"}),"้ž้ป‘่ฏ"]}):e.jsxs(Ce,{variant:"outline",children:[e.jsx(ox,{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(P1,{className:"h-8 w-8",strokeWidth:2}),"้ป‘่ฏ็ฎก็†"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"็ฎก็†้บฆ้บฆๅญฆไน ๅˆฐ็š„้ป‘่ฏๅ’Œไฟš่ฏญ"})]}),e.jsxs(_,{onClick:()=>O(!0),className:"gap-2",children:[e.jsx(Xs,{className:"h-4 w-4"}),"ๆ–ฐๅขž้ป‘่ฏ"]})]})}),e.jsx(ts,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 lg:grid-cols-7 gap-3",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"ๆ€ปๆ•ฐ้‡"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1",children:D.total})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"ๅทฒ็กฎ่ฎค้ป‘่ฏ"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-green-600",children:D.confirmed_jargon})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"็กฎ่ฎค้ž้ป‘่ฏ"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-gray-500",children:D.confirmed_not_jargon})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"ๅพ…ๅˆคๅฎš"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-yellow-600",children:D.pending})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"ๅ…จๅฑ€้ป‘่ฏ"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-blue-600",children:D.global_count})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"ๆŽจๆ–ญๅฎŒๆˆ"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-purple-600",children:D.complete_count})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"ๅ…ณ่”่Šๅคฉๆ•ฐ"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1",children:D.chat_count})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(T,{htmlFor:"search",children:"ๆœ็ดข"}),e.jsxs("div",{className:"relative",children:[e.jsx($t,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(ne,{id:"search",placeholder:"ๆœ็ดขๅ†…ๅฎนใ€ๅซไน‰...",value:N,onChange:Z=>j(Z.target.value),className:"pl-9"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(T,{children:"่Šๅคฉ็ญ›้€‰"}),e.jsxs(Pe,{value:b,onValueChange:y,children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"ๅ…จ้ƒจ่Šๅคฉ"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"all",children:"ๅ…จ้ƒจ่Šๅคฉ"}),B.map(Z=>e.jsx(W,{value:Z.chat_id,children:Z.chat_name},Z.chat_id))]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(T,{children:"็Šถๆ€็ญ›้€‰"}),e.jsxs(Pe,{value:w,onValueChange:z,children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"ๅ…จ้ƒจ็Šถๆ€"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"all",children:"ๅ…จ้ƒจ็Šถๆ€"}),e.jsx(W,{value:"true",children:"ๆ˜ฏ้ป‘่ฏ"}),e.jsx(W,{value:"false",children:"้ž้ป‘่ฏ"})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(T,{htmlFor:"page-size",children:"ๆฏ้กตๆ˜พ็คบ"}),e.jsxs(Pe,{value:p.toString(),onValueChange:Z=>{g(parseInt(Z)),f(1),Ne(new Set)},children:[e.jsx(Be,{id:"page-size",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"10",children:"10"}),e.jsx(W,{value:"20",children:"20"}),e.jsx(W,{value:"50",children:"50"}),e.jsx(W,{value:"100",children:"100"})]})]})]})]}),me.size>0&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mt-4 pt-4 border-t",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:["ๅทฒ้€‰ๆ‹ฉ ",me.size," ไธช"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>$e(!0),children:[e.jsx(Ot,{className:"h-4 w-4 mr-1"}),"ๆ ‡่ฎฐไธบ้ป‘่ฏ"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>$e(!1),children:[e.jsx(Sa,{className:"h-4 w-4 mr-1"}),"ๆ ‡่ฎฐไธบ้ž้ป‘่ฏ"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>Ne(new Set),children:"ๅ–ๆถˆ้€‰ๆ‹ฉ"}),e.jsxs(_,{variant:"destructive",size:"sm",onClick:()=>ce(!0),children:[e.jsx(os,{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(ql,{children:[e.jsx(Vl,{children:e.jsxs(_t,{children:[e.jsx(ns,{className:"w-12",children:e.jsx(tt,{checked:me.size===a.length&&a.length>0,onCheckedChange:Re})}),e.jsx(ns,{children:"ๅ†…ๅฎน"}),e.jsx(ns,{children:"ๅซไน‰"}),e.jsx(ns,{children:"่Šๅคฉ"}),e.jsx(ns,{children:"็Šถๆ€"}),e.jsx(ns,{className:"text-center",children:"ๆฌกๆ•ฐ"}),e.jsx(ns,{className:"text-right",children:"ๆ“ไฝœ"})]})}),e.jsx(Gl,{children:r?e.jsx(_t,{children:e.jsx(Ze,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"ๅŠ ่ฝฝไธญ..."})}):a.length===0?e.jsx(_t,{children:e.jsx(Ze,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"ๆš‚ๆ— ๆ•ฐๆฎ"})}):a.map(Z=>e.jsxs(_t,{children:[e.jsx(Ze,{children:e.jsx(tt,{checked:me.has(Z.id),onCheckedChange:()=>K(Z.id)})}),e.jsx(Ze,{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(Go,{className:"h-4 w-4 text-blue-500 flex-shrink-0"})}),e.jsx("span",{className:"truncate",title:Z.content,children:Z.content})]})}),e.jsx(Ze,{className:"max-w-[200px] truncate",title:Z.meaning||"",children:Z.meaning||e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx(Ze,{className:"max-w-[150px] truncate",title:Z.chat_name||Z.chat_id,children:Z.chat_name||Z.chat_id}),e.jsx(Ze,{children:J(Z.is_jargon)}),e.jsx(Ze,{className:"text-center",children:Z.count}),e.jsx(Ze,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>$(Z),children:[e.jsx(sr,{className:"h-4 w-4 mr-1"}),"็ผ–่พ‘"]}),e.jsx(_,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>G(Z),title:"ๆŸฅ็œ‹่ฏฆๆƒ…",children:e.jsx(ua,{className:"h-4 w-4"})}),e.jsxs(_,{size:"sm",onClick:()=>L(Z),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(os,{className:"h-4 w-4 mr-1"}),"ๅˆ ้™ค"]})]})})]},Z.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3 p-4",children:r?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"ๅŠ ่ฝฝไธญ..."}):a.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"ๆš‚ๆ— ๆ•ฐๆฎ"}):a.map(Z=>e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(tt,{checked:me.has(Z.id),onCheckedChange:()=>K(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(Go,{className:"h-4 w-4 text-blue-500 flex-shrink-0"}),e.jsx("h3",{className:"font-semibold text-sm break-all",children:Z.content})]}),Z.meaning&&e.jsx("p",{className:"text-sm text-muted-foreground break-all",children:Z.meaning}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[J(Z.is_jargon),e.jsxs("span",{className:"text-muted-foreground",children:["ๆฌกๆ•ฐ: ",Z.count]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground truncate",children:["่Šๅคฉ: ",Z.chat_name||Z.chat_id]})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>$(Z),className:"text-xs px-2 py-1 h-auto",children:[e.jsx(sr,{className:"h-3 w-3 mr-1"}),"็ผ–่พ‘"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>G(Z),className:"text-xs px-2 py-1 h-auto",children:e.jsx(ua,{className:"h-3 w-3"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>L(Z),className:"text-xs px-2 py-1 h-auto text-destructive hover:text-destructive",children:[e.jsx(os,{className:"h-3 w-3 mr-1"}),"ๅˆ ้™ค"]})]})]},Z.id))}),d>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["ๅ…ฑ ",d," ๆก่ฎฐๅฝ•๏ผŒ็ฌฌ ",h," / ",Math.ceil(d/p)," ้กต"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(kn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h-1),disabled:h===1,children:[e.jsx(Pa,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"ไธŠไธ€้กต"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{type:"number",value:ge,onChange:Z=>pe(Z.target.value),onKeyDown:Z=>Z.key==="Enter"&&cs(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(d/p)}),e.jsx(_,{variant:"outline",size:"sm",onClick:cs,disabled:!ge,className:"h-8",children:"่ทณ่ฝฌ"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h+1),disabled:h>=Math.ceil(d/p),children:[e.jsx("span",{className:"hidden sm:inline",children:"ไธ‹ไธ€้กต"}),e.jsx(ra,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(d/p)),disabled:h>=Math.ceil(d/p),className:"hidden sm:flex",children:e.jsx(Cn,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(_k,{jargon:M,open:F,onOpenChange:E}),e.jsx(Sk,{open:H,onOpenChange:O,chatList:B,onSuccess:()=>{we(),fe(),O(!1)}}),e.jsx(kk,{jargon:M,open:C,onOpenChange:R,chatList:B,onSuccess:()=>{we(),fe(),R(!1)}}),e.jsx(bs,{open:!!X,onOpenChange:()=>L(null),children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsxs(gs,{children:['็กฎๅฎš่ฆๅˆ ้™ค้ป‘่ฏ "',X?.content,'" ๅ—๏ผŸๆญคๆ“ไฝœไธๅฏๆ’ค้”€ใ€‚']})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:()=>X&&A(X),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"ๅˆ ้™ค"})]})]})}),e.jsx(bs,{open:je,onOpenChange:ce,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๆ‰น้‡ๅˆ ้™ค"}),e.jsxs(gs,{children:["ๆ‚จๅณๅฐ†ๅˆ ้™ค ",me.size," ไธช้ป‘่ฏ๏ผŒๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚็กฎๅฎš่ฆ็ปง็ปญๅ—๏ผŸ"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:se,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"็กฎ่ฎคๅˆ ้™ค"})]})]})})]})}function _k({jargon:a,open:l,onOpenChange:r}){return a?e.jsx(Qs,{open:l,onOpenChange:r,children:e.jsxs(Hs,{className:"max-w-2xl max-h-[80vh] grid grid-rows-[auto_1fr_auto] overflow-hidden",children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"้ป‘่ฏ่ฏฆๆƒ…"}),e.jsx(at,{children:"ๆŸฅ็œ‹้ป‘่ฏ็š„ๅฎŒๆ•ดไฟกๆฏ"})]}),e.jsx(ts,{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(Gm,{icon:Wr,label:"่ฎฐๅฝ•ID",value:a.id.toString(),mono:!0}),e.jsx(Gm,{label:"ไฝฟ็”จๆฌกๆ•ฐ",value:a.count.toString()})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"ๅ†…ๅฎน"}),e.jsx("div",{className:"text-sm p-2 bg-muted rounded break-all whitespace-pre-wrap",children:a.content})]}),a.raw_content&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"ๅŽŸๅง‹ๅ†…ๅฎน"}),e.jsx("div",{className:"text-sm p-2 bg-muted rounded break-all",children:(()=>{try{const c=JSON.parse(a.raw_content);return Array.isArray(c)?c.map((d,m)=>e.jsxs("div",{children:[m>0&&e.jsx("hr",{className:"my-3 border-border"}),e.jsx("div",{className:"whitespace-pre-wrap",children:d})]},m)):e.jsx("div",{className:"whitespace-pre-wrap",children:a.raw_content})}catch{return e.jsx("div",{className:"whitespace-pre-wrap",children:a.raw_content})}})()})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"ๅซไน‰"}),e.jsx("div",{className:"text-sm p-2 bg-muted rounded break-all",children:a.meaning?e.jsx(bx,{content:a.meaning}):"-"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Gm,{label:"่Šๅคฉ",value:a.chat_name||a.chat_id}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"็Šถๆ€"}),e.jsxs("div",{className:"flex items-center gap-2",children:[a.is_jargon===!0&&e.jsx(Ce,{variant:"default",className:"bg-green-600",children:"ๆ˜ฏ้ป‘่ฏ"}),a.is_jargon===!1&&e.jsx(Ce,{variant:"secondary",children:"้ž้ป‘่ฏ"}),a.is_jargon===null&&e.jsx(Ce,{variant:"outline",children:"ๆœชๅˆคๅฎš"}),a.is_global&&e.jsx(Ce,{variant:"outline",className:"border-blue-500 text-blue-500",children:"ๅ…จๅฑ€"}),a.is_complete&&e.jsx(Ce,{variant:"outline",className:"border-purple-500 text-purple-500",children:"ๆŽจๆ–ญๅฎŒๆˆ"})]})]})]}),a.inference_with_context&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"ไธŠไธ‹ๆ–‡ๆŽจๆ–ญ็ป“ๆžœ"}),e.jsx("div",{className:"p-2 bg-muted rounded break-all whitespace-pre-wrap font-mono text-xs max-h-[200px] overflow-y-auto",children:a.inference_with_context})]}),a.inference_content_only&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"็บฏ่ฏๆกๆŽจๆ–ญ็ป“ๆžœ"}),e.jsx("div",{className:"p-2 bg-muted rounded break-all whitespace-pre-wrap font-mono text-xs max-h-[200px] overflow-y-auto",children:a.inference_content_only})]})]})}),e.jsx(gt,{className:"flex-shrink-0",children:e.jsx(_,{onClick:()=>r(!1),children:"ๅ…ณ้—ญ"})})]})}):null}function Gm({icon:a,label:l,value:r,mono:c=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(T,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[a&&e.jsx(a,{className:"h-3 w-3"}),l]}),e.jsx("div",{className:P("text-sm",c&&"font-mono",!r&&"text-muted-foreground"),children:r||"-"})]})}function Sk({open:a,onOpenChange:l,chatList:r,onSuccess:c}){const[d,m]=u.useState({content:"",meaning:"",chat_id:"",is_global:!1}),[h,f]=u.useState(!1),{toast:p}=nt(),g=async()=>{if(!d.content||!d.chat_id){p({title:"้ชŒ่ฏๅคฑ่ดฅ",description:"่ฏทๅกซๅ†™ๅฟ…ๅกซๅญ—ๆฎต๏ผšๅ†…ๅฎนๅ’Œ่Šๅคฉ",variant:"destructive"});return}try{f(!0),await gk(d),p({title:"ๅˆ›ๅปบๆˆๅŠŸ",description:"้ป‘่ฏๅทฒๅˆ›ๅปบ"}),m({content:"",meaning:"",chat_id:"",is_global:!1}),c()}catch(N){p({title:"ๅˆ›ๅปบๅคฑ่ดฅ",description:N instanceof Error?N.message:"ๆ— ๆณ•ๅˆ›ๅปบ้ป‘่ฏ",variant:"destructive"})}finally{f(!1)}};return e.jsx(Qs,{open:a,onOpenChange:l,children:e.jsxs(Hs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"ๆ–ฐๅขž้ป‘่ฏ"}),e.jsx(at,{children:"ๅˆ›ๅปบๆ–ฐ็š„้ป‘่ฏ่ฎฐๅฝ•"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"content",children:["ๅ†…ๅฎน ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ne,{id:"content",value:d.content,onChange:N=>m({...d,content:N.target.value}),placeholder:"่พ“ๅ…ฅ้ป‘่ฏๅ†…ๅฎน"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"meaning",children:"ๅซไน‰"}),e.jsx(pt,{id:"meaning",value:d.meaning||"",onChange:N=>m({...d,meaning:N.target.value}),placeholder:"่พ“ๅ…ฅ้ป‘่ฏๅซไน‰๏ผˆๅฏ้€‰๏ผ‰",rows:3})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"chat_id",children:["่Šๅคฉ ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs(Pe,{value:d.chat_id,onValueChange:N=>m({...d,chat_id:N}),children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"้€‰ๆ‹ฉๅ…ณ่”็š„่Šๅคฉ"})}),e.jsx(Ie,{children:r.map(N=>e.jsx(W,{value:N.chat_id,children:N.chat_name},N.chat_id))})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"is_global",checked:d.is_global,onCheckedChange:N=>m({...d,is_global:N})}),e.jsx(T,{htmlFor:"is_global",children:"่ฎพไธบๅ…จๅฑ€้ป‘่ฏ"})]})]}),e.jsxs(gt,{children:[e.jsx(_,{variant:"outline",onClick:()=>l(!1),children:"ๅ–ๆถˆ"}),e.jsx(_,{onClick:g,disabled:h,children:h?"ๅˆ›ๅปบไธญ...":"ๅˆ›ๅปบ"})]})]})})}function kk({jargon:a,open:l,onOpenChange:r,chatList:c,onSuccess:d}){const[m,h]=u.useState({}),[f,p]=u.useState(!1),{toast:g}=nt();u.useEffect(()=>{a&&h({content:a.content,meaning:a.meaning||"",chat_id:a.stream_id||a.chat_id,is_global:a.is_global,is_jargon:a.is_jargon})},[a]);const N=async()=>{if(a)try{p(!0),await jk(a.id,m),g({title:"ไฟๅญ˜ๆˆๅŠŸ",description:"้ป‘่ฏๅทฒๆ›ดๆ–ฐ"}),d()}catch(j){g({title:"ไฟๅญ˜ๅคฑ่ดฅ",description:j instanceof Error?j.message:"ๆ— ๆณ•ๆ›ดๆ–ฐ้ป‘่ฏ",variant:"destructive"})}finally{p(!1)}};return a?e.jsx(Qs,{open:l,onOpenChange:r,children:e.jsxs(Hs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"็ผ–่พ‘้ป‘่ฏ"}),e.jsx(at,{children:"ไฟฎๆ”น้ป‘่ฏ็š„ไฟกๆฏ"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_content",children:"ๅ†…ๅฎน"}),e.jsx(ne,{id:"edit_content",value:m.content||"",onChange:j=>h({...m,content:j.target.value}),placeholder:"่พ“ๅ…ฅ้ป‘่ฏๅ†…ๅฎน"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_meaning",children:"ๅซไน‰"}),e.jsx(pt,{id:"edit_meaning",value:m.meaning||"",onChange:j=>h({...m,meaning:j.target.value}),placeholder:"่พ“ๅ…ฅ้ป‘่ฏๅซไน‰",rows:3})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_chat_id",children:"่Šๅคฉ"}),e.jsxs(Pe,{value:m.chat_id||"",onValueChange:j=>h({...m,chat_id:j}),children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"้€‰ๆ‹ฉๅ…ณ่”็š„่Šๅคฉ"})}),e.jsx(Ie,{children:c.map(j=>e.jsx(W,{value:j.chat_id,children:j.chat_name},j.chat_id))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"้ป‘่ฏ็Šถๆ€"}),e.jsxs(Pe,{value:m.is_jargon===null?"null":m.is_jargon?.toString()||"null",onValueChange:j=>h({...m,is_jargon:j==="null"?null:j==="true"}),children:[e.jsx(Be,{children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"null",children:"ๆœชๅˆคๅฎš"}),e.jsx(W,{value:"true",children:"ๆ˜ฏ้ป‘่ฏ"}),e.jsx(W,{value:"false",children:"้ž้ป‘่ฏ"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"edit_is_global",checked:m.is_global,onCheckedChange:j=>h({...m,is_global:j})}),e.jsx(T,{htmlFor:"edit_is_global",children:"ๅ…จๅฑ€้ป‘่ฏ"})]})]}),e.jsxs(gt,{children:[e.jsx(_,{variant:"outline",onClick:()=>r(!1),children:"ๅ–ๆถˆ"}),e.jsx(_,{onClick:N,disabled:f,children:f?"ไฟๅญ˜ไธญ...":"ไฟๅญ˜"})]})]})}):null}const li="/api/webui/person";async function Ck(a){const l=new URLSearchParams;a.page&&l.append("page",a.page.toString()),a.page_size&&l.append("page_size",a.page_size.toString()),a.search&&l.append("search",a.search),a.is_known!==void 0&&l.append("is_known",a.is_known.toString()),a.platform&&l.append("platform",a.platform);const r=await ke(`${li}/list?${l}`,{headers:Zs()});if(!r.ok){const c=await r.json();throw new Error(c.detail||"่Žทๅ–ไบบ็‰ฉๅˆ—่กจๅคฑ่ดฅ")}return r.json()}async function Tk(a){const l=await ke(`${li}/${a}`,{headers:Zs()});if(!l.ok){const r=await l.json();throw new Error(r.detail||"่Žทๅ–ไบบ็‰ฉ่ฏฆๆƒ…ๅคฑ่ดฅ")}return l.json()}async function Ek(a,l){const r=await ke(`${li}/${a}`,{method:"PATCH",headers:Zs(),body:JSON.stringify(l)});if(!r.ok){const c=await r.json();throw new Error(c.detail||"ๆ›ดๆ–ฐไบบ็‰ฉไฟกๆฏๅคฑ่ดฅ")}return r.json()}async function Mk(a){const l=await ke(`${li}/${a}`,{method:"DELETE",headers:Zs()});if(!l.ok){const r=await l.json();throw new Error(r.detail||"ๅˆ ้™คไบบ็‰ฉไฟกๆฏๅคฑ่ดฅ")}return l.json()}async function Ak(){const a=await ke(`${li}/stats/summary`,{headers:Zs()});if(!a.ok){const l=await a.json();throw new Error(l.detail||"่Žทๅ–็ปŸ่ฎกๆ•ฐๆฎๅคฑ่ดฅ")}return a.json()}async function zk(a){const l=await ke(`${li}/batch/delete`,{method:"POST",headers:Zs(),body:JSON.stringify({person_ids:a})});if(!l.ok){const r=await l.json();throw new Error(r.detail||"ๆ‰น้‡ๅˆ ้™คๅคฑ่ดฅ")}return l.json()}function Rk(){const[a,l]=u.useState([]),[r,c]=u.useState(!0),[d,m]=u.useState(0),[h,f]=u.useState(1),[p,g]=u.useState(20),[N,j]=u.useState(""),[b,y]=u.useState(void 0),[w,z]=u.useState(void 0),[M,S]=u.useState(null),[F,E]=u.useState(!1),[C,R]=u.useState(!1),[H,O]=u.useState(null),[X,L]=u.useState({total:0,known:0,unknown:0,platforms:{}}),[me,Ne]=u.useState(new Set),[je,ce]=u.useState(!1),[ge,pe]=u.useState(""),{toast:D}=nt(),Q=async()=>{try{c(!0);const se=await Ck({page:h,page_size:p,search:N||void 0,is_known:b,platform:w});l(se.data),m(se.total)}catch(se){D({title:"ๅŠ ่ฝฝๅคฑ่ดฅ",description:se instanceof Error?se.message:"ๆ— ๆณ•ๅŠ ่ฝฝไบบ็‰ฉไฟกๆฏ",variant:"destructive"})}finally{c(!1)}},B=async()=>{try{const se=await Ak();se?.data&&L(se.data)}catch(se){console.error("ๅŠ ่ฝฝ็ปŸ่ฎกๆ•ฐๆฎๅคฑ่ดฅ:",se)}};u.useEffect(()=>{Q(),B()},[h,p,N,b,w]);const ue=async se=>{try{const $e=await Tk(se.person_id);S($e.data),E(!0)}catch($e){D({title:"ๅŠ ่ฝฝ่ฏฆๆƒ…ๅคฑ่ดฅ",description:$e instanceof Error?$e.message:"ๆ— ๆณ•ๅŠ ่ฝฝไบบ็‰ฉ่ฏฆๆƒ…",variant:"destructive"})}},Y=se=>{S(se),R(!0)},we=async se=>{try{await Mk(se.person_id),D({title:"ๅˆ ้™คๆˆๅŠŸ",description:`ๅทฒๅˆ ้™คไบบ็‰ฉไฟกๆฏ: ${se.person_name||se.nickname||se.user_id}`}),O(null),Q(),B()}catch($e){D({title:"ๅˆ ้™คๅคฑ่ดฅ",description:$e instanceof Error?$e.message:"ๆ— ๆณ•ๅˆ ้™คไบบ็‰ฉไฟกๆฏ",variant:"destructive"})}},fe=u.useMemo(()=>Object.keys(X.platforms),[X.platforms]),Ee=se=>{const $e=new Set(me);$e.has(se)?$e.delete(se):$e.add(se),Ne($e)},G=()=>{me.size===a.length&&a.length>0?Ne(new Set):Ne(new Set(a.map(se=>se.person_id)))},$=()=>{if(me.size===0){D({title:"ๆœช้€‰ๆ‹ฉไปปไฝ•ไบบ็‰ฉ",description:"่ฏทๅ…ˆ้€‰ๆ‹ฉ่ฆๅˆ ้™ค็š„ไบบ็‰ฉ",variant:"destructive"});return}ce(!0)},A=async()=>{try{const se=await zk(Array.from(me));D({title:"ๆ‰น้‡ๅˆ ้™คๅฎŒๆˆ",description:se.message}),Ne(new Set),ce(!1),Q(),B()}catch(se){D({title:"ๆ‰น้‡ๅˆ ้™คๅคฑ่ดฅ",description:se instanceof Error?se.message:"ๆ‰น้‡ๅˆ ้™คๅคฑ่ดฅ",variant:"destructive"})}},K=()=>{const se=parseInt(ge),$e=Math.ceil(d/p);se>=1&&se<=$e?(f(se),pe("")):D({title:"ๆ— ๆ•ˆ็š„้กต็ ",description:`่ฏท่พ“ๅ…ฅ1-${$e}ไน‹้—ด็š„้กต็ `,variant:"destructive"})},Re=se=>se?new Date(se*1e3).toLocaleString("zh-CN"):"-";return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsx("div",{className:"mb-4 sm:mb-6",children:e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(oc,{className:"h-8 w-8",strokeWidth:2}),"ไบบ็‰ฉไฟกๆฏ็ฎก็†"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"็ฎก็†้บฆ้บฆ่ฎค่ฏ†็š„ๆ‰€ๆœ‰ไบบ็‰ฉไฟกๆฏ"})]})})}),e.jsx(ts,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"ๆ€ปไบบๆ•ฐ"}),e.jsx("div",{className:"text-2xl font-bold mt-1",children:X.total})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"ๅทฒ่ฎค่ฏ†"}),e.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:X.known})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"ๆœช่ฎค่ฏ†"}),e.jsx("div",{className:"text-2xl font-bold mt-1 text-muted-foreground",children:X.unknown})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"sm:col-span-2",children:[e.jsx(T,{htmlFor:"search",children:"ๆœ็ดข"}),e.jsxs("div",{className:"relative mt-1.5",children:[e.jsx($t,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(ne,{id:"search",placeholder:"ๆœ็ดขๅ็งฐใ€ๆ˜ต็งฐๆˆ–็”จๆˆทID...",value:N,onChange:se=>j(se.target.value),className:"pl-9"})]})]}),e.jsxs("div",{children:[e.jsx(T,{htmlFor:"filter-known",children:"่ฎค่ฏ†็Šถๆ€"}),e.jsxs(Pe,{value:b===void 0?"all":b.toString(),onValueChange:se=>{y(se==="all"?void 0:se==="true"),f(1)},children:[e.jsx(Be,{id:"filter-known",className:"mt-1.5",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"all",children:"ๅ…จ้ƒจ"}),e.jsx(W,{value:"true",children:"ๅทฒ่ฎค่ฏ†"}),e.jsx(W,{value:"false",children:"ๆœช่ฎค่ฏ†"})]})]})]}),e.jsxs("div",{children:[e.jsx(T,{htmlFor:"filter-platform",children:"ๅนณๅฐ"}),e.jsxs(Pe,{value:w||"all",onValueChange:se=>{z(se==="all"?void 0:se),f(1)},children:[e.jsx(Be,{id:"filter-platform",className:"mt-1.5",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"all",children:"ๅ…จ้ƒจๅนณๅฐ"}),fe.map(se=>e.jsxs(W,{value:se,children:[se," (",X.platforms[se],")"]},se))]})]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[e.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:me.size>0&&e.jsxs("span",{children:["ๅทฒ้€‰ๆ‹ฉ ",me.size," ไธชไบบ็‰ฉ"]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"ๆฏ้กตๆ˜พ็คบ"}),e.jsxs(Pe,{value:p.toString(),onValueChange:se=>{g(parseInt(se)),f(1),Ne(new Set)},children:[e.jsx(Be,{id:"page-size",className:"w-20",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"10",children:"10"}),e.jsx(W,{value:"20",children:"20"}),e.jsx(W,{value:"50",children:"50"}),e.jsx(W,{value:"100",children:"100"})]})]}),me.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>Ne(new Set),children:"ๅ–ๆถˆ้€‰ๆ‹ฉ"}),e.jsxs(_,{variant:"destructive",size:"sm",onClick:$,children:[e.jsx(os,{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(ql,{children:[e.jsx(Vl,{children:e.jsxs(_t,{children:[e.jsx(ns,{className:"w-12",children:e.jsx(tt,{checked:a.length>0&&me.size===a.length,onCheckedChange:G,"aria-label":"ๅ…จ้€‰"})}),e.jsx(ns,{children:"็Šถๆ€"}),e.jsx(ns,{children:"ๅ็งฐ"}),e.jsx(ns,{children:"ๆ˜ต็งฐ"}),e.jsx(ns,{children:"ๅนณๅฐ"}),e.jsx(ns,{children:"็”จๆˆทID"}),e.jsx(ns,{children:"ๆœ€ๅŽๆ›ดๆ–ฐ"}),e.jsx(ns,{className:"text-right",children:"ๆ“ไฝœ"})]})}),e.jsx(Gl,{children:r?e.jsx(_t,{children:e.jsx(Ze,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"ๅŠ ่ฝฝไธญ..."})}):a.length===0?e.jsx(_t,{children:e.jsx(Ze,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"ๆš‚ๆ— ๆ•ฐๆฎ"})}):a.map(se=>e.jsxs(_t,{children:[e.jsx(Ze,{children:e.jsx(tt,{checked:me.has(se.person_id),onCheckedChange:()=>Ee(se.person_id),"aria-label":`้€‰ๆ‹ฉ ${se.person_name||se.nickname||se.user_id}`})}),e.jsx(Ze,{children:e.jsx("div",{className:P("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",se.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:se.is_known?"ๅทฒ่ฎค่ฏ†":"ๆœช่ฎค่ฏ†"})}),e.jsx(Ze,{className:"font-medium",children:se.person_name||e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx(Ze,{children:se.nickname||"-"}),e.jsx(Ze,{children:se.platform}),e.jsx(Ze,{className:"font-mono text-sm",children:se.user_id}),e.jsx(Ze,{className:"text-sm text-muted-foreground",children:Re(se.last_know)}),e.jsx(Ze,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>ue(se),children:[e.jsx(ua,{className:"h-4 w-4 mr-1"}),"่ฏฆๆƒ…"]}),e.jsxs(_,{variant:"default",size:"sm",onClick:()=>Y(se),children:[e.jsx(sr,{className:"h-4 w-4 mr-1"}),"็ผ–่พ‘"]}),e.jsxs(_,{size:"sm",onClick:()=>O(se),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(os,{className:"h-4 w-4 mr-1"}),"ๅˆ ้™ค"]})]})})]},se.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3 p-4",children:r?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"ๅŠ ่ฝฝไธญ..."}):a.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"ๆš‚ๆ— ๆ•ฐๆฎ"}):a.map(se=>e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(tt,{checked:me.has(se.person_id),onCheckedChange:()=>Ee(se.person_id),className:"mt-1"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:P("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium mb-2",se.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:se.is_known?"ๅทฒ่ฎค่ฏ†":"ๆœช่ฎค่ฏ†"}),e.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",children:se.person_name||e.jsx("span",{className:"text-muted-foreground",children:"ๆœชๅ‘ฝๅ"})}),se.nickname&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-1 w-full break-all",children:["ๆ˜ต็งฐ: ",se.nickname]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"ๅนณๅฐ"}),e.jsx("p",{className:"font-medium text-xs",children:se.platform})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"็”จๆˆทID"}),e.jsx("p",{className:"font-mono text-xs truncate",title:se.user_id,children:se.user_id})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"ๆœ€ๅŽๆ›ดๆ–ฐ"}),e.jsx("p",{className:"text-xs",children:Re(se.last_know)})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>ue(se),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(ua,{className:"h-3 w-3 mr-1"}),"ๆŸฅ็œ‹"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>Y(se),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(sr,{className:"h-3 w-3 mr-1"}),"็ผ–่พ‘"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>O(se),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[e.jsx(os,{className:"h-3 w-3 mr-1"}),"ๅˆ ้™ค"]})]})]},se.id))}),d>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["ๅ…ฑ ",d," ๆก่ฎฐๅฝ•๏ผŒ็ฌฌ ",h," / ",Math.ceil(d/p)," ้กต"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(kn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h-1),disabled:h===1,children:[e.jsx(Pa,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"ไธŠไธ€้กต"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{type:"number",value:ge,onChange:se=>pe(se.target.value),onKeyDown:se=>se.key==="Enter"&&K(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(d/p)}),e.jsx(_,{variant:"outline",size:"sm",onClick:K,disabled:!ge,className:"h-8",children:"่ทณ่ฝฌ"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h+1),disabled:h>=Math.ceil(d/p),children:[e.jsx("span",{className:"hidden sm:inline",children:"ไธ‹ไธ€้กต"}),e.jsx(ra,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(d/p)),disabled:h>=Math.ceil(d/p),className:"hidden sm:flex",children:e.jsx(Cn,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(Dk,{person:M,open:F,onOpenChange:E}),e.jsx(Ok,{person:M,open:C,onOpenChange:R,onSuccess:()=>{Q(),B(),R(!1)}}),e.jsx(bs,{open:!!H,onOpenChange:()=>O(null),children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsxs(gs,{children:['็กฎๅฎš่ฆๅˆ ้™คไบบ็‰ฉไฟกๆฏ "',H?.person_name||H?.nickname||H?.user_id,'" ๅ—๏ผŸ ๆญคๆ“ไฝœไธๅฏๆ’ค้”€ใ€‚']})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:()=>H&&we(H),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"ๅˆ ้™ค"})]})]})}),e.jsx(bs,{open:je,onOpenChange:ce,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๆ‰น้‡ๅˆ ้™ค"}),e.jsxs(gs,{children:["็กฎๅฎš่ฆๅˆ ้™ค้€‰ไธญ็š„ ",me.size," ไธชไบบ็‰ฉไฟกๆฏๅ—๏ผŸ ๆญคๆ“ไฝœไธๅฏๆ’ค้”€ใ€‚"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:A,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"ๆ‰น้‡ๅˆ ้™ค"})]})]})})]})}function Dk({person:a,open:l,onOpenChange:r}){if(!a)return null;const c=d=>d?new Date(d*1e3).toLocaleString("zh-CN"):"-";return e.jsx(Qs,{open:l,onOpenChange:r,children:e.jsxs(Hs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"ไบบ็‰ฉ่ฏฆๆƒ…"}),e.jsxs(at,{children:["ๆŸฅ็œ‹ ",a.person_name||a.nickname||a.user_id," ็š„ๅฎŒๆ•ดไฟกๆฏ"]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx($l,{icon:Fl,label:"ไบบ็‰ฉๅ็งฐ",value:a.person_name}),e.jsx($l,{icon:Ia,label:"ๆ˜ต็งฐ",value:a.nickname}),e.jsx($l,{icon:Wr,label:"็”จๆˆทID",value:a.user_id,mono:!0}),e.jsx($l,{icon:Wr,label:"ไบบ็‰ฉID",value:a.person_id,mono:!0}),e.jsx($l,{label:"ๅนณๅฐ",value:a.platform}),e.jsx($l,{label:"็Šถๆ€",value:a.is_known?"ๅทฒ่ฎค่ฏ†":"ๆœช่ฎค่ฏ†"})]}),a.name_reason&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"ๅ็งฐ่ฎพๅฎšๅŽŸๅ› "}),e.jsx("p",{className:"mt-1 text-sm",children:a.name_reason})]}),a.memory_points&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"ไธชไบบๅฐ่ฑก"}),e.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:a.memory_points})]}),a.group_nick_name&&a.group_nick_name.length>0&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"็พคๆ˜ต็งฐ"}),e.jsx("div",{className:"mt-2 space-y-1",children:a.group_nick_name.map((d,m)=>e.jsxs("div",{className:"text-sm flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:d.group_id}),e.jsx("span",{children:"โ†’"}),e.jsx("span",{children:d.group_nick_name})]},m))})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx($l,{icon:da,label:"่ฎค่ฏ†ๆ—ถ้—ด",value:c(a.know_times)}),e.jsx($l,{icon:da,label:"้ฆ–ๆฌก่ฎฐๅฝ•",value:c(a.know_since)}),e.jsx($l,{icon:da,label:"ๆœ€ๅŽๆ›ดๆ–ฐ",value:c(a.last_know)})]})]}),e.jsx(gt,{children:e.jsx(_,{onClick:()=>r(!1),children:"ๅ…ณ้—ญ"})})]})})}function $l({icon:a,label:l,value:r,mono:c=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(T,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[a&&e.jsx(a,{className:"h-3 w-3"}),l]}),e.jsx("div",{className:P("text-sm",c&&"font-mono",!r&&"text-muted-foreground"),children:r||"-"})]})}function Ok({person:a,open:l,onOpenChange:r,onSuccess:c}){const[d,m]=u.useState({}),[h,f]=u.useState(!1),{toast:p}=nt();u.useEffect(()=>{a&&m({person_name:a.person_name||"",name_reason:a.name_reason||"",nickname:a.nickname||"",is_known:a.is_known})},[a]);const g=async()=>{if(a)try{f(!0),await Ek(a.person_id,d),p({title:"ไฟๅญ˜ๆˆๅŠŸ",description:"ไบบ็‰ฉไฟกๆฏๅทฒๆ›ดๆ–ฐ"}),c()}catch(N){p({title:"ไฟๅญ˜ๅคฑ่ดฅ",description:N instanceof Error?N.message:"ๆ— ๆณ•ๆ›ดๆ–ฐไบบ็‰ฉไฟกๆฏ",variant:"destructive"})}finally{f(!1)}};return a?e.jsx(Qs,{open:l,onOpenChange:r,children:e.jsxs(Hs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"็ผ–่พ‘ไบบ็‰ฉไฟกๆฏ"}),e.jsxs(at,{children:["ไฟฎๆ”น ",a.person_name||a.nickname||a.user_id," ็š„ไฟกๆฏ"]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"person_name",children:"ไบบ็‰ฉๅ็งฐ"}),e.jsx(ne,{id:"person_name",value:d.person_name||"",onChange:N=>m({...d,person_name:N.target.value}),placeholder:"ไธบ่ฟ™ไธชไบบ่ฎพ็ฝฎไธ€ไธชๅ็งฐ"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"nickname",children:"ๆ˜ต็งฐ"}),e.jsx(ne,{id:"nickname",value:d.nickname||"",onChange:N=>m({...d,nickname:N.target.value}),placeholder:"ๆ˜ต็งฐ"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"name_reason",children:"ๅ็งฐ่ฎพๅฎšๅŽŸๅ› "}),e.jsx(pt,{id:"name_reason",value:d.name_reason||"",onChange:N=>m({...d,name_reason:N.target.value}),placeholder:"ไธบไป€ไนˆ่ฟ™ๆ ท็งฐๅ‘ผ่ฟ™ไธชไบบ๏ผŸ",rows:2})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{children:[e.jsx(T,{htmlFor:"is_known",className:"text-base font-medium",children:"ๅทฒ่ฎค่ฏ†"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๆ ‡่ฎฐๆ˜ฏๅฆๅทฒ็ป่ฎค่ฏ†่ฟ™ไธชไบบ"})]}),e.jsx(Ge,{id:"is_known",checked:d.is_known,onCheckedChange:N=>m({...d,is_known:N})})]})]}),e.jsxs(gt,{children:[e.jsx(_,{variant:"outline",onClick:()=>r(!1),children:"ๅ–ๆถˆ"}),e.jsx(_,{onClick:g,disabled:h,children:h?"ไฟๅญ˜ไธญ...":"ไฟๅญ˜"})]})]})}):null}var Lk=S_();const tj=mw(Lk),Mx="/api/webui";async function Uk(a=100,l="all"){const r=`${Mx}/knowledge/graph?limit=${a}&node_type=${l}`,c=await fetch(r);if(!c.ok)throw new Error(`่Žทๅ–็Ÿฅ่ฏ†ๅ›พ่ฐฑๅคฑ่ดฅ: ${c.status}`);return c.json()}async function $k(){const a=await fetch(`${Mx}/knowledge/stats`);if(!a.ok)throw new Error("่Žทๅ–็Ÿฅ่ฏ†ๅ›พ่ฐฑ็ปŸ่ฎกไฟกๆฏๅคฑ่ดฅ");return a.json()}async function Bk(a){const l=await fetch(`${Mx}/knowledge/search?query=${encodeURIComponent(a)}`);if(!l.ok)throw new Error("ๆœ็ดข็Ÿฅ่ฏ†่Š‚็‚นๅคฑ่ดฅ");return l.json()}const dN=u.memo(({data:a})=>e.jsxs("div",{className:"px-4 py-2 shadow-md rounded-lg bg-gradient-to-br from-blue-500 to-blue-600 border-2 border-blue-700 min-w-[120px]",children:[e.jsx(Yo,{type:"target",position:Jo.Top}),e.jsx("div",{className:"font-semibold text-white text-sm truncate max-w-[200px]",title:a.content,children:a.label}),e.jsx(Yo,{type:"source",position:Jo.Bottom})]}));dN.displayName="EntityNode";const uN=u.memo(({data:a})=>e.jsxs("div",{className:"px-3 py-2 shadow-md rounded-md bg-gradient-to-br from-green-500 to-green-600 border-2 border-green-700 min-w-[100px]",children:[e.jsx(Yo,{type:"target",position:Jo.Top}),e.jsx("div",{className:"font-medium text-white text-xs truncate max-w-[150px]",title:a.content,children:a.label}),e.jsx(Yo,{type:"source",position:Jo.Bottom})]}));uN.displayName="ParagraphNode";const Ik={entity:dN,paragraph:uN};function Pk(a,l){const r=new tj.graphlib.Graph;r.setDefaultEdgeLabel(()=>({})),r.setGraph({rankdir:"TB",ranksep:100,nodesep:80});const c=[],d=[];return a.forEach(m=>{r.setNode(m.id,{width:150,height:50})}),l.forEach(m=>{r.setEdge(m.source,m.target)}),tj.layout(r),a.forEach(m=>{const h=r.node(m.id);c.push({id:m.id,type:m.type,position:{x:h.x-75,y:h.y-25},data:{label:m.content.slice(0,20)+(m.content.length>20?"...":""),content:m.content}})}),l.forEach((m,h)=>{const f={id:`edge-${h}`,source:m.source,target:m.target,animated:a.length<=200&&m.weight>5,style:{strokeWidth:Math.min(m.weight/2,5),opacity:.6}};m.weight>10&&a.length<100&&(f.label=`${m.weight.toFixed(0)}`),d.push(f)}),{nodes:c,edges:d}}function Fk(){const a=ha(),[l,r]=u.useState(!1),[c,d]=u.useState(null),[m,h]=u.useState(""),[f,p]=u.useState("all"),[g,N]=u.useState(50),[j,b]=u.useState("50"),[y,w]=u.useState(!1),[z,M]=u.useState(!0),[S,F]=u.useState(!1),[E,C]=u.useState(!1),[R,H,O]=k_([]),[X,L,me]=C_([]),[Ne,je]=u.useState(0),[ce,ge]=u.useState(null),[pe,D]=u.useState(null),{toast:Q}=nt(),B=u.useCallback(A=>A.type==="entity"?"#6366f1":A.type==="paragraph"?"#10b981":"#6b7280",[]),ue=u.useCallback(async(A=!1)=>{try{if(!A&&g>200){C(!0);return}r(!0);const[K,Re]=await Promise.all([Uk(g,f),$k()]);if(d(Re),K.nodes.length===0){Q({title:"ๆ็คบ",description:"็Ÿฅ่ฏ†ๅบ“ไธบ็ฉบ๏ผŒ่ฏทๅ…ˆๅฏผๅ…ฅ็Ÿฅ่ฏ†ๆ•ฐๆฎ"}),H([]),L([]);return}const{nodes:se,edges:$e}=Pk(K.nodes,K.edges);H(se),L($e),je(se.length),Re&&Re.total_nodes>g&&Q({title:"ๆ็คบ",description:`็Ÿฅ่ฏ†ๅ›พ่ฐฑๅŒ…ๅซ ${Re.total_nodes} ไธช่Š‚็‚น๏ผŒๅฝ“ๅ‰ๆ˜พ็คบ ${se.length} ไธช`}),Q({title:"ๅŠ ่ฝฝๆˆๅŠŸ",description:`ๅทฒๅŠ ่ฝฝ ${se.length} ไธช่Š‚็‚น๏ผŒ${$e.length} ๆก่พน`})}catch(K){console.error("ๅŠ ่ฝฝ็Ÿฅ่ฏ†ๅ›พ่ฐฑๅคฑ่ดฅ:",K),Q({title:"ๅŠ ่ฝฝๅคฑ่ดฅ",description:K instanceof Error?K.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}finally{r(!1)}},[g,f,Q]),Y=u.useCallback(async()=>{if(!m.trim()){Q({title:"ๆ็คบ",description:"่ฏท่พ“ๅ…ฅๆœ็ดขๅ…ณ้”ฎ่ฏ"});return}try{const A=await Bk(m);if(A.length===0){Q({title:"ๆœชๆ‰พๅˆฐ",description:"ๆฒกๆœ‰ๆ‰พๅˆฐๅŒน้…็š„่Š‚็‚น"});return}const K=new Set(A.map(Re=>Re.id));H(Re=>Re.map(se=>({...se,style:{...se.style,opacity:K.has(se.id)?1:.3,filter:K.has(se.id)?"brightness(1.2)":"brightness(0.8)"}}))),Q({title:"ๆœ็ดขๅฎŒๆˆ",description:`ๆ‰พๅˆฐ ${A.length} ไธชๅŒน้…่Š‚็‚น`})}catch(A){console.error("ๆœ็ดขๅคฑ่ดฅ:",A),Q({title:"ๆœ็ดขๅคฑ่ดฅ",description:A instanceof Error?A.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}},[m,Q]),we=u.useCallback(()=>{H(A=>A.map(K=>({...K,style:{...K.style,opacity:1,filter:"brightness(1)"}})))},[]),fe=u.useCallback(()=>{M(!1),F(!0),ue()},[ue]),Ee=u.useCallback(()=>{C(!1),setTimeout(()=>{ue(!0)},0)},[ue]),G=u.useCallback((A,K)=>{R.find(se=>se.id===K.id)&&ge({id:K.id,type:K.type,content:K.data.content})},[R]);u.useEffect(()=>{z||S&&ue()},[g,f,z,S]);const $=u.useCallback((A,K)=>{const Re=R.find(cs=>cs.id===K.source),se=R.find(cs=>cs.id===K.target),$e=X.find(cs=>cs.id===K.id);Re&&se&&$e&&D({source:{id:Re.id,type:Re.type,content:Re.data.content},target:{id:se.id,type:se.type,content:se.data.content},edge:{source:K.source,target:K.target,weight:parseFloat(K.label||"0")}})},[R,X]);return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex-shrink-0 p-4 border-b bg-background",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"้บฆ้บฆ็Ÿฅ่ฏ†ๅบ“ๅ›พ่ฐฑ"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"ๅฏ่ง†ๅŒ–็Ÿฅ่ฏ†ๅฎžไฝ“ไธŽๅ…ณ็ณป็ฝ‘็ปœ"})]}),c&&e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.jsxs(Ce,{variant:"outline",className:"gap-1",children:[e.jsx(Zr,{className:"h-3 w-3"}),"่Š‚็‚น: ",c.total_nodes]}),e.jsxs(Ce,{variant:"outline",className:"gap-1",children:[e.jsx(xv,{className:"h-3 w-3"}),"่พน: ",c.total_edges]}),e.jsxs(Ce,{variant:"outline",className:"gap-1",children:[e.jsx(Yt,{className:"h-3 w-3"}),"ๅฎžไฝ“: ",c.entity_nodes]}),e.jsxs(Ce,{variant:"outline",className:"gap-1",children:[e.jsx(Ua,{className:"h-3 w-3"}),"ๆฎต่ฝ: ",c.paragraph_nodes]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 mt-4",children:[e.jsxs("div",{className:"flex-1 flex gap-2",children:[e.jsx(ne,{placeholder:"ๆœ็ดข่Š‚็‚นๅ†…ๅฎน...",value:m,onChange:A=>h(A.target.value),onKeyDown:A=>A.key==="Enter"&&Y(),className:"flex-1"}),e.jsx(_,{onClick:Y,size:"sm",children:e.jsx($t,{className:"h-4 w-4"})}),e.jsx(_,{onClick:we,variant:"outline",size:"sm",children:"้‡็ฝฎ"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(Pe,{value:f,onValueChange:A=>p(A),children:[e.jsx(Be,{className:"w-[120px]",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"all",children:"ๅ…จ้ƒจ่Š‚็‚น"}),e.jsx(W,{value:"entity",children:"ไป…ๅฎžไฝ“"}),e.jsx(W,{value:"paragraph",children:"ไป…ๆฎต่ฝ"})]})]}),e.jsxs(Pe,{value:g===1e4?"all":y?"custom":g.toString(),onValueChange:A=>{A==="custom"?(w(!0),b(g.toString())):A==="all"?(w(!1),N(1e4)):(w(!1),N(Number(A)))},children:[e.jsx(Be,{className:"w-[120px]",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"50",children:"50 ่Š‚็‚น"}),e.jsx(W,{value:"100",children:"100 ่Š‚็‚น"}),e.jsx(W,{value:"200",children:"200 ่Š‚็‚น"}),e.jsx(W,{value:"500",children:"500 ่Š‚็‚น"}),e.jsx(W,{value:"1000",children:"1000 ่Š‚็‚น"}),e.jsx(W,{value:"all",children:"ๅ…จ้ƒจ (ๆœ€ๅคš10000)"}),e.jsx(W,{value:"custom",children:"่‡ชๅฎšไน‰..."})]})]}),y&&e.jsx(ne,{type:"number",min:"50",value:j,onChange:A=>b(A.target.value),onBlur:()=>{const A=parseInt(j);!isNaN(A)&&A>=50?N(A):(b("50"),N(50))},onKeyDown:A=>{if(A.key==="Enter"){const K=parseInt(j);!isNaN(K)&&K>=50?N(K):(b("50"),N(50))}},placeholder:"ๆœ€ๅฐ‘50ไธช",className:"w-[120px]"}),e.jsx(_,{onClick:()=>ue(),variant:"outline",size:"sm",disabled:l,children:e.jsx(dt,{className:P("h-4 w-4",l&&"animate-spin")})})]})]})]}),e.jsx("div",{className:"flex-1 relative",children:l?e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(dt,{className:"h-8 w-8 animate-spin mx-auto mb-2 text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground",children:"ๅŠ ่ฝฝ็Ÿฅ่ฏ†ๅ›พ่ฐฑไธญ..."})]})}):R.length===0?e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(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(T_,{nodes:R,edges:X,onNodesChange:O,onEdgesChange:me,onNodeClick:G,onEdgeClick:$,nodeTypes:Ik,fitView:!0,minZoom:.05,maxZoom:1.5,defaultViewport:{x:0,y:0,zoom:.5},elevateNodesOnSelect:Ne<=500,nodesDraggable:Ne<=1e3,attributionPosition:"bottom-left",children:[e.jsx(E_,{variant:M_.Dots,gap:12,size:1}),e.jsx(A_,{}),Ne<=500&&e.jsx(z_,{nodeColor:B,nodeBorderRadius:8,pannable:!0,zoomable:!0}),e.jsxs(R_,{position:"top-right",className:"bg-background/95 backdrop-blur-sm rounded-lg border p-3 shadow-lg",children:[e.jsx("div",{className:"text-sm font-semibold mb-2",children:"ๅ›พไพ‹"}),e.jsxs("div",{className:"space-y-2 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-blue-500 to-blue-600 border-2 border-blue-700"}),e.jsx("span",{children:"ๅฎžไฝ“่Š‚็‚น"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-green-500 to-green-600 border-2 border-green-700"}),e.jsx("span",{children:"ๆฎต่ฝ่Š‚็‚น"})]}),Ne>200&&e.jsxs("div",{className:"mt-2 pt-2 border-t text-yellow-600 dark:text-yellow-500",children:[e.jsx("div",{className:"font-semibold",children:"ๆ€ง่ƒฝๆจกๅผ"}),e.jsx("div",{children:"ๅทฒ็ฆ็”จๅŠจ็”ป"}),Ne>500&&e.jsx("div",{children:"ๅทฒ็ฆ็”จ็ผฉ็•ฅๅ›พ"})]})]})]})]})}),e.jsx(Qs,{open:!!ce,onOpenChange:A=>!A&&ge(null),children:e.jsxs(Hs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsx(qs,{children:e.jsx(Vs,{children:"่Š‚็‚น่ฏฆๆƒ…"})}),ce&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"grid grid-cols-2 gap-4",children:e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"็ฑปๅž‹"}),e.jsx("div",{className:"mt-1",children:e.jsx(Ce,{variant:ce.type==="entity"?"default":"secondary",children:ce.type==="entity"?"๐Ÿท๏ธ ๅฎžไฝ“":"๐Ÿ“„ ๆฎต่ฝ"})})]})}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"ID"}),e.jsx("code",{className:"mt-1 block p-2 bg-muted rounded text-xs break-all",children:ce.id})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"ๅ†…ๅฎน"}),e.jsx(ts,{className:"mt-1 max-h-[400px] p-3 bg-muted rounded border",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:ce.content})})]})]})]})}),e.jsx(Qs,{open:!!pe,onOpenChange:A=>!A&&D(null),children:e.jsxs(Hs,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[e.jsx(qs,{children:e.jsx(Vs,{children:"่พน่ฏฆๆƒ…"})}),pe&&e.jsx(ts,{className:"flex-1 pr-4",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0 p-3 bg-blue-50 dark:bg-blue-950 rounded border-2 border-blue-200 dark:border-blue-800",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"ๆบ่Š‚็‚น"}),e.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:pe.source.content}),e.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[pe.source.id.slice(0,40),"..."]})]}),e.jsx("div",{className:"text-2xl text-muted-foreground flex-shrink-0",children:"โ†’"}),e.jsxs("div",{className:"flex-1 min-w-0 p-3 bg-green-50 dark:bg-green-950 rounded border-2 border-green-200 dark:border-green-800",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"็›ฎๆ ‡่Š‚็‚น"}),e.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:pe.target.content}),e.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[pe.target.id.slice(0,40),"..."]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"ๆƒ้‡"}),e.jsx("div",{className:"mt-1",children:e.jsx(Ce,{variant:"outline",className:"text-base font-mono",children:pe.edge.weight.toFixed(4)})})]})]})})]})}),e.jsx(bs,{open:z,onOpenChange:M,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"ๅŠ ่ฝฝ็Ÿฅ่ฏ†ๅ›พ่ฐฑ"}),e.jsxs(gs,{children:["็Ÿฅ่ฏ†ๅ›พ่ฐฑ็š„ๅŠจๆ€ๅฑ•็คบไผšๆถˆ่€—่พƒๅคš็ณป็ปŸ่ต„ๆบใ€‚",e.jsx("br",{}),"็กฎๅฎš่ฆๅŠ ่ฝฝ็Ÿฅ่ฏ†ๅ›พ่ฐฑๅ—?"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{onClick:()=>a({to:"/"}),children:"ๅ–ๆถˆ (่ฟ”ๅ›ž้ฆ–้กต)"}),e.jsx(js,{onClick:fe,children:"็กฎ่ฎคๅŠ ่ฝฝ"})]})]})}),e.jsx(bs,{open:E,onOpenChange:C,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"โš ๏ธ ่Š‚็‚นๆ•ฐ้‡่พƒๅคš"}),e.jsx(gs,{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(fs,{children:[e.jsx(vs,{onClick:()=>{C(!1),g>200&&(N(50),w(!1))},children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:Ee,className:"bg-orange-600 hover:bg-orange-700",children:"ๆˆ‘ไบ†่งฃ้ฃŽ้™ฉ๏ผŒ็ปง็ปญๅŠ ่ฝฝ"})]})]})})]})}function Hk(){return e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsx("div",{className:"flex-none border-b bg-card/50 px-6 py-4",children:e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"้บฆ้บฆ็Ÿฅ่ฏ†ๅบ“็ฎก็†"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"็ฎก็†ๅ’Œ็ป„็ป‡้บฆ้บฆ็š„็Ÿฅ่ฏ†ๅบ“ๅ†…ๅฎน"})]})})}),e.jsx("div",{className:"flex-1 overflow-auto p-6",children:e.jsx("div",{className:"mx-auto max-w-4xl",children:e.jsxs(Te,{children:[e.jsxs(Oe,{className:"text-center",children:[e.jsx("div",{className:"mx-auto mb-4 flex h-20 w-20 items-center justify-center rounded-full bg-primary/10",children:e.jsx(Zr,{className:"h-10 w-10 text-primary"})}),e.jsx(Ue,{className:"text-2xl",children:"้บฆ้บฆ็Ÿฅ่ฏ†ๅบ“็ฎก็†"}),e.jsx(Ns,{className:"text-base",children:"ๅŠŸ่ƒฝๅผ€ๅ‘ไธญ๏ผŒๆ•ฌ่ฏทๆœŸๅพ…"})]}),e.jsx(ze,{className:"text-center text-sm text-muted-foreground",children:e.jsx("p",{children:"ๆญคๅŠŸ่ƒฝๅฐ†ๆไพ›็Ÿฅ่ฏ†ๅบ“็š„ๅˆ›ๅปบใ€็ผ–่พ‘ใ€ๅฏผๅ…ฅๅ’Œ็ฎก็†่ƒฝๅŠ›"})})]})})})]})}function aj({className:a,classNames:l,showOutsideDays:r=!0,captionLayout:c="label",buttonVariant:d="ghost",formatters:m,components:h,...f}){const p=Ev();return e.jsx(j_,{showOutsideDays:r,className:P("bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,a),captionLayout:c,formatters:{formatMonthDropdown:g=>g.toLocaleString("default",{month:"short"}),...m},classNames:{root:P("w-fit",p.root),months:P("relative flex flex-col gap-4 md:flex-row",p.months),month:P("flex w-full flex-col gap-4",p.month),nav:P("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",p.nav),button_previous:P(si({variant:d}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",p.button_previous),button_next:P(si({variant:d}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",p.button_next),month_caption:P("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",p.month_caption),dropdowns:P("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",p.dropdowns),dropdown_root:P("has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",p.dropdown_root),dropdown:P("bg-popover absolute inset-0 opacity-0",p.dropdown),caption_label:P("select-none font-medium",c==="label"?"text-sm":"[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5",p.caption_label),table:"w-full border-collapse",weekdays:P("flex",p.weekdays),weekday:P("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",p.weekday),week:P("mt-2 flex w-full",p.week),week_number_header:P("w-[--cell-size] select-none",p.week_number_header),week_number:P("text-muted-foreground select-none text-[0.8rem]",p.week_number),day:P("group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",p.day),range_start:P("bg-accent rounded-l-md",p.range_start),range_middle:P("rounded-none",p.range_middle),range_end:P("bg-accent rounded-r-md",p.range_end),today:P("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",p.today),outside:P("text-muted-foreground aria-selected:text-muted-foreground",p.outside),disabled:P("text-muted-foreground opacity-50",p.disabled),hidden:P("invisible",p.hidden),...l},components:{Root:({className:g,rootRef:N,...j})=>e.jsx("div",{"data-slot":"calendar",ref:N,className:P(g),...j}),Chevron:({className:g,orientation:N,...j})=>N==="left"?e.jsx(Pa,{className:P("size-4",g),...j}):N==="right"?e.jsx(ra,{className:P("size-4",g),...j}):e.jsx(Ba,{className:P("size-4",g),...j}),DayButton:qk,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 qk({className:a,day:l,modifiers:r,...c}){const d=Ev(),m=u.useRef(null);return u.useEffect(()=>{r.focused&&m.current?.focus()},[r.focused]),e.jsx(_,{ref:m,variant:"ghost",size:"icon","data-day":l.date.toLocaleDateString(),"data-selected-single":r.selected&&!r.range_start&&!r.range_end&&!r.range_middle,"data-range-start":r.range_start,"data-range-end":r.range_end,"data-range-middle":r.range_middle,className:P("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70",d.day,a),...c})}const Uo={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 Vk(){const[a,l]=u.useState([]),[r,c]=u.useState(""),[d,m]=u.useState("all"),[h,f]=u.useState("all"),[p,g]=u.useState(void 0),[N,j]=u.useState(void 0),[b,y]=u.useState(!0),[w,z]=u.useState(!1),[M,S]=u.useState("xs"),[F,E]=u.useState(4),[C,R]=u.useState(!1),H=u.useRef(null);u.useEffect(()=>{const Y=Qn.getAllLogs();l(Y);const we=Qn.onLog(()=>{l(Qn.getAllLogs())}),fe=Qn.onConnectionChange(Ee=>{z(Ee)});return()=>{we(),fe()}},[]);const O=u.useMemo(()=>{const Y=new Set(a.map(we=>we.module).filter(we=>we&&we.trim()!==""));return Array.from(Y).sort()},[a]),X=Y=>{switch(Y){case"DEBUG":return"text-muted-foreground";case"INFO":return"text-blue-500 dark:text-blue-400";case"WARNING":return"text-yellow-600 dark:text-yellow-500";case"ERROR":return"text-red-600 dark:text-red-500";case"CRITICAL":return"text-red-700 dark:text-red-400 font-bold";default:return"text-foreground"}},L=Y=>{switch(Y){case"DEBUG":return"bg-gray-800/30 dark:bg-gray-800/50";case"INFO":return"bg-blue-900/20 dark:bg-blue-500/20";case"WARNING":return"bg-yellow-900/20 dark:bg-yellow-500/20";case"ERROR":return"bg-red-900/20 dark:bg-red-500/20";case"CRITICAL":return"bg-red-900/30 dark:bg-red-600/30";default:return"bg-gray-800/20 dark:bg-gray-800/30"}},me=()=>{window.location.reload()},Ne=()=>{Qn.clearLogs(),l([])},je=()=>{const Y=pe.map(G=>`${G.timestamp} [${G.level.padEnd(8)}] [${G.module}] ${G.message}`).join(` -`),we=new Blob([Y],{type:"text/plain;charset=utf-8"}),fe=URL.createObjectURL(we),Ee=document.createElement("a");Ee.href=fe,Ee.download=`logs-${Em(new Date,"yyyy-MM-dd-HHmmss")}.txt`,Ee.click(),URL.revokeObjectURL(fe)},ce=()=>{y(!b)},ge=()=>{g(void 0),j(void 0)},pe=u.useMemo(()=>a.filter(Y=>{const we=r===""||Y.message.toLowerCase().includes(r.toLowerCase())||Y.module.toLowerCase().includes(r.toLowerCase()),fe=d==="all"||Y.level===d,Ee=h==="all"||Y.module===h;let G=!0;if(p||N){const $=new Date(Y.timestamp);if(p){const A=new Date(p);A.setHours(0,0,0,0),G=G&&$>=A}if(N){const A=new Date(N);A.setHours(23,59,59,999),G=G&&$<=A}}return we&&fe&&Ee&&G}),[a,r,d,h,p,N]),D=Uo[M].rowHeight+F,Q=aw({count:pe.length,getScrollElement:()=>H.current,estimateSize:()=>D,overscan:50}),B=u.useRef(!1),ue=u.useRef(pe.length);return u.useEffect(()=>{const Y=H.current;if(!Y)return;const we=()=>{if(B.current)return;const{scrollTop:fe,scrollHeight:Ee,clientHeight:G}=Y,$=Ee-fe-G;$>100&&b?y(!1):$<50&&!b&&y(!0)};return Y.addEventListener("scroll",we,{passive:!0}),()=>Y.removeEventListener("scroll",we)},[b]),u.useEffect(()=>{const Y=pe.length>ue.current;ue.current=pe.length,b&&pe.length>0&&Y&&(B.current=!0,Q.scrollToIndex(pe.length-1,{align:"end",behavior:"auto"}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{B.current=!1})}))},[pe.length,b,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:P("h-2 w-2 sm:h-2.5 sm:w-2.5 rounded-full",w?"bg-green-500 animate-pulse":"bg-red-500")}),e.jsx("span",{className:"text-xs text-muted-foreground",children:w?"ๅทฒ่ฟžๆŽฅ":"ๆœช่ฟžๆŽฅ"})]})]}),e.jsx(Te,{className:"p-2 sm:p-3",children:e.jsx(xc,{open:C,onOpenChange:R,children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"flex-1 relative min-w-0",children:[e.jsx($t,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),e.jsx(ne,{placeholder:"ๆœ็ดขๆ—ฅๅฟ—...",value:r,onChange:Y=>c(Y.target.value),className:"pl-8 h-8 text-xs sm:text-sm"})]}),e.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[e.jsxs(_,{variant:b?"default":"outline",size:"sm",onClick:ce,className:"h-8 px-2",title:b?"่‡ชๅŠจๆปšๅŠจ":"ๅทฒๆš‚ๅœ",children:[b?e.jsx(F1,{className:"h-3.5 w-3.5"}):e.jsx(H1,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"ml-1 text-xs hidden sm:inline",children:b?"ๆปšๅŠจ":"ๆš‚ๅœ"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:Ne,className:"h-8 px-2",title:"ๆธ…็ฉบๆ—ฅๅฟ—",children:[e.jsx(os,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"ml-1 text-xs hidden md:inline",children:"ๆธ…็ฉบ"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:je,className:"h-8 px-2 hidden sm:flex",title:"ๅฏผๅ‡บๆ—ฅๅฟ—",children:[e.jsx(na,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"ml-1 text-xs hidden lg:inline",children:"ๅฏผๅ‡บ"})]}),e.jsx(hc,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:"h-8 px-2",title:C?"ๆ”ถ่ตท็ญ›้€‰":"ๅฑ•ๅผ€็ญ›้€‰",children:[e.jsx(Po,{className:"h-3.5 w-3.5"}),C?e.jsx(Xr,{className:"h-3.5 w-3.5 ml-1"}):e.jsx(Ba,{className:"h-3.5 w-3.5 ml-1"})]})})]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground text-center sm:text-right -mt-1",children:[e.jsxs("span",{className:"font-mono",children:[pe.length," / ",a.length]}),e.jsx("span",{className:"ml-1",children:"ๆกๆ—ฅๅฟ—"})]}),e.jsxs(fc,{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-2",children:[e.jsxs(Pe,{value:d,onValueChange:m,children:[e.jsxs(Be,{className:"w-full sm:flex-1 h-8 text-xs",children:[e.jsx(Po,{className:"h-3.5 w-3.5 mr-1.5"}),e.jsx(Fe,{placeholder:"็บงๅˆซ"})]}),e.jsxs(Ie,{children:[e.jsx(W,{value:"all",children:"ๅ…จ้ƒจ็บงๅˆซ"}),e.jsx(W,{value:"DEBUG",children:"DEBUG"}),e.jsx(W,{value:"INFO",children:"INFO"}),e.jsx(W,{value:"WARNING",children:"WARNING"}),e.jsx(W,{value:"ERROR",children:"ERROR"}),e.jsx(W,{value:"CRITICAL",children:"CRITICAL"})]})]}),e.jsxs(Pe,{value:h,onValueChange:f,children:[e.jsxs(Be,{className:"w-full sm:flex-1 h-8 text-xs",children:[e.jsx(Po,{className:"h-3.5 w-3.5 mr-1.5"}),e.jsx(Fe,{placeholder:"ๆจกๅ—"})]}),e.jsxs(Ie,{children:[e.jsx(W,{value:"all",children:"ๅ…จ้ƒจๆจกๅ—"}),O.map(Y=>e.jsx(W,{value:Y,children:Y},Y))]})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-2",children:[e.jsxs(cl,{children:[e.jsx(ol,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:P("w-full sm:flex-1 justify-start text-left font-normal h-8",!p&&"text-muted-foreground"),children:[e.jsx(Ko,{className:"mr-1.5 h-3.5 w-3.5"}),e.jsx("span",{className:"text-xs",children:p?Em(p,"PP",{locale:Oo}):"ๅผ€ๅง‹ๆ—ฅๆœŸ"})]})}),e.jsx(tl,{className:"w-auto p-0",align:"start",children:e.jsx(aj,{mode:"single",selected:p,onSelect:g,initialFocus:!0,locale:Oo})})]}),e.jsxs(cl,{children:[e.jsx(ol,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:P("w-full sm:flex-1 justify-start text-left font-normal h-8",!N&&"text-muted-foreground"),children:[e.jsx(Ko,{className:"mr-1.5 h-3.5 w-3.5"}),e.jsx("span",{className:"text-xs",children:N?Em(N,"PP",{locale:Oo}):"็ป“ๆŸๆ—ฅๆœŸ"})]})}),e.jsx(tl,{className:"w-auto p-0",align:"start",children:e.jsx(aj,{mode:"single",selected:N,onSelect:j,initialFocus:!0,locale:Oo})})]}),(p||N)&&e.jsxs(_,{variant:"outline",size:"sm",onClick:ge,className:"w-full sm:w-auto h-8",children:[e.jsx(Sa,{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(q1,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"ๅญ—ๅท"})]}),e.jsx("div",{className:"flex gap-1",children:Object.keys(Uo).map(Y=>e.jsx(_,{variant:M===Y?"default":"outline",size:"sm",onClick:()=>S(Y),className:"h-6 px-2 text-xs",children:Uo[Y].label},Y))})]}),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(el,{value:[F],onValueChange:([Y])=>E(Y),min:0,max:12,step:2,className:"flex-1"}),e.jsxs("span",{className:"text-xs text-muted-foreground w-7",children:[F,"px"]})]}),e.jsxs("div",{className:"flex gap-2 sm:hidden",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:me,className:"flex-1 h-8",children:[e.jsx(dt,{className:"h-3.5 w-3.5 mr-1"}),e.jsx("span",{className:"text-xs",children:"ๅˆทๆ–ฐ"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:je,className:"flex-1 h-8",children:[e.jsx(na,{className:"h-3.5 w-3.5 mr-1"}),e.jsx("span",{className:"text-xs",children:"ๅฏผๅ‡บ"})]})]})]})]})]})})})]}),e.jsx("div",{className:"flex-1 min-h-0 px-2 sm:px-3 lg:px-4 pb-2 sm:pb-3 lg:pb-4",children:e.jsx(Te,{className:"bg-black dark:bg-gray-950 border-gray-800 dark:border-gray-900 h-full overflow-hidden",children:e.jsx("div",{ref:H,className:P("h-full overflow-auto","[&::-webkit-scrollbar]:w-2.5","[&::-webkit-scrollbar-track]:bg-transparent","[&::-webkit-scrollbar-thumb]:bg-border [&::-webkit-scrollbar-thumb]:rounded-full","[&::-webkit-scrollbar-thumb:hover]:bg-border/80"),children:e.jsx("div",{className:P("p-2 sm:p-3 font-mono relative",Uo[M].class),style:{height:`${Q.getTotalSize()}px`},children:pe.length===0?e.jsx("div",{className:"text-gray-500 dark:text-gray-600 text-center py-8 text-xs sm:text-sm",children:"ๆš‚ๆ— ๆ—ฅๅฟ—ๆ•ฐๆฎ"}):Q.getVirtualItems().map(Y=>{const we=pe[Y.index];return e.jsxs("div",{"data-index":Y.index,ref:Q.measureElement,className:P("absolute top-0 left-0 w-full px-2 sm:px-3 rounded hover:bg-white/5 transition-colors",L(we.level)),style:{transform:`translateY(${Y.start}px)`,paddingTop:`${F/2}px`,paddingBottom:`${F/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:we.timestamp}),e.jsxs("span",{className:P("font-semibold text-[10px]",X(we.level)),children:["[",we.level,"]"]})]}),e.jsx("div",{className:"text-cyan-400 dark:text-cyan-500 truncate text-[10px]",children:we.module}),e.jsx("div",{className:"text-gray-300 dark:text-gray-400 whitespace-pre-wrap break-words text-[10px]",children:we.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:we.timestamp}),e.jsxs("span",{className:P("flex-shrink-0 w-[65px] lg:w-[75px] font-semibold",X(we.level)),children:["[",we.level,"]"]}),e.jsx("span",{className:"text-cyan-400 dark:text-cyan-500 flex-shrink-0 w-[100px] lg:w-[130px] truncate",children:we.module}),e.jsx("span",{className:"text-gray-300 dark:text-gray-400 flex-1 whitespace-pre-wrap break-words",children:we.message})]})]},Y.key)})})})})})]})}async function Gk(){return(await ke("/api/planner/overview")).json()}async function Kk(a,l=1,r=20,c){const d=new URLSearchParams({page:l.toString(),page_size:r.toString()});return c&&d.append("search",c),(await ke(`/api/planner/chat/${a}/logs?${d}`)).json()}async function Qk(a,l){return(await ke(`/api/planner/log/${a}/${l}`)).json()}async function Yk(){return(await ke("/api/replier/overview")).json()}async function Jk(a,l=1,r=20,c){const d=new URLSearchParams({page:l.toString(),page_size:r.toString()});return c&&d.append("search",c),(await ke(`/api/replier/chat/${a}/logs?${d}`)).json()}async function Xk(a,l){return(await ke(`/api/replier/log/${a}/${l}`)).json()}function mN(){const[a,l]=u.useState(new Map),[r,c]=u.useState(!0),d=u.useCallback(async()=>{try{c(!0);const h=await gx();if(h?.data){const f=new Map;h.data.forEach(p=>{f.set(p.chat_id,p.chat_name)}),l(f)}}catch(h){console.error("ๅŠ ่ฝฝ่Šๅคฉๅˆ—่กจๅคฑ่ดฅ:",h)}finally{c(!1)}},[]);u.useEffect(()=>{d()},[d]);const m=u.useCallback(h=>a.get(h)||h,[a]);return{chatNameMap:a,getChatName:m,loading:r,reload:d}}function Zo(a){return new Date(a*1e3).toLocaleString("zh-CN")}function xN(a){const r=Date.now()/1e3-a;return r<60?"ๅˆšๅˆš":r<3600?`${Math.floor(r/60)} ๅˆ†้’Ÿๅ‰`:r<86400?`${Math.floor(r/3600)} ๅฐๆ—ถๅ‰`:`${Math.floor(r/86400)} ๅคฉๅ‰`}function hN(a,l,r=1e4){u.useEffect(()=>{if(!a)return;const c=setInterval(l,r);return()=>clearInterval(c)},[a,l,r])}function Zk({autoRefresh:a,refreshKey:l}){const[r,c]=u.useState("overview"),[d,m]=u.useState(null),{getChatName:h}=mN(),[f,p]=u.useState(null),[g,N]=u.useState(!0),[j,b]=u.useState(null),[y,w]=u.useState(!1),[z,M]=u.useState(1),[S,F]=u.useState(20),[E,C]=u.useState(""),[R,H]=u.useState(""),[O,X]=u.useState(""),[L,me]=u.useState(null),[Ne,je]=u.useState(!1),[ce,ge]=u.useState(!1),pe=u.useCallback(async()=>{try{N(!0);const $=await Gk();p($)}catch($){console.error("ๅŠ ่ฝฝ่ง„ๅˆ’ๅ™จๆ€ป่งˆๅคฑ่ดฅ:",$)}finally{N(!1)}},[]),D=u.useCallback(async()=>{if(d)try{w(!0);const $=await Kk(d.chat_id,z,S,R||void 0);b($)}catch($){console.error("ๅŠ ่ฝฝ่Šๅคฉๆ—ฅๅฟ—ๅคฑ่ดฅ:",$)}finally{w(!1)}},[d,z,S,R]);u.useEffect(()=>{pe()},[pe]),u.useEffect(()=>{l>0&&(r==="overview"?pe():D())},[l,r,pe,D]),u.useEffect(()=>{r==="chat-logs"&&d&&D()},[r,d,D]),hN(a,u.useCallback(()=>{r==="overview"?pe():D()},[r,pe,D]));const Q=$=>{m($),M(1),H(""),X(""),c("chat-logs")},B=()=>{c("overview"),m(null),b(null),H(""),X("")},ue=()=>{H(O),M(1)},Y=()=>{X(""),H(""),M(1)},we=async($,A)=>{try{ge(!0),je(!0);const K=await Qk($,A);me(K)}catch(K){console.error("ๅŠ ่ฝฝ่ฎกๅˆ’่ฏฆๆƒ…ๅคฑ่ดฅ:",K)}finally{ge(!1)}},fe=$=>{F(Number($)),M(1)},Ee=()=>{const $=parseInt(E),A=j?Math.ceil(j.total/j.page_size):0;!isNaN($)&&$>=1&&$<=A&&(M($),C(""))},G=j?Math.ceil(j.total/j.page_size):0;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-4",children:r==="overview"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"่Šๅคฉๆ•ฐ้‡"}),e.jsx(Ia,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(ze,{children:g?e.jsx(ks,{className:"h-8 w-16"}):e.jsx("div",{className:"text-2xl font-bold",children:f?.total_chats||0})})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"่ฎกๅˆ’ๆ€ปๆ•ฐ"}),e.jsx(rx,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(ze,{children:g?e.jsx(ks,{className:"h-8 w-16"}):e.jsx("div",{className:"text-2xl font-bold",children:f?.total_plans||0})})]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"่Šๅคฉๅˆ—่กจ"}),e.jsx(Ns,{children:"็‚นๅ‡ปๆŸฅ็œ‹่ฏฅ่Šๅคฉ็š„ๆ‰€ๆœ‰่ฎกๅˆ’่ฎฐๅฝ•"})]}),e.jsx(ze,{children:g?e.jsx("div",{className:"grid gap-3 md:grid-cols-2 lg:grid-cols-3",children:[...Array(6)].map(($,A)=>e.jsx(ks,{className:"h-24 w-full"},A))}):f?.chats&&f.chats.length>0?e.jsx("div",{className:"grid gap-3 md:grid-cols-2 lg:grid-cols-3",children:f.chats.map($=>e.jsxs("div",{className:"border rounded-lg p-4 hover:bg-accent/50 transition-colors cursor-pointer",onClick:()=>Q($),children:[e.jsxs("div",{className:"flex items-start justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ia,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm truncate max-w-[180px]",title:h($.chat_id),children:h($.chat_id)})]}),e.jsx(Ce,{variant:"secondary",children:$.plan_count})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["ๆœ€ๅŽๆดปๅŠจ: ",xN($.latest_timestamp)]})]},$.chat_id))}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"ๆš‚ๆ— ่Šๅคฉ่ฎฐๅฝ•"})})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-4 mb-4",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:B,children:[e.jsx($a,{className:"h-4 w-4 mr-2"}),"่ฟ”ๅ›ž่Šๅคฉๅˆ—่กจ"]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:["ๅฝ“ๅ‰่Šๅคฉ: ",e.jsx("span",{className:"font-medium",children:d?h(d.chat_id):""}),e.jsx("span",{className:"mx-2",children:"โ€ข"}),"ๅ…ฑ ",j?.total||0," ๆก่ฎกๅˆ’่ฎฐๅฝ•"]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(Ue,{children:"่ฎกๅˆ’ๆ‰ง่กŒ่ฎฐๅฝ•"}),e.jsx(Ns,{children:d?h(d.chat_id):""})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ne,{placeholder:"ๆœ็ดขๆ็คบ่ฏๅ†…ๅฎน...",value:O,onChange:$=>X($.target.value),onKeyDown:$=>$.key==="Enter"&&ue(),className:"w-full sm:w-48"}),e.jsx(_,{variant:"outline",size:"icon",onClick:ue,children:e.jsx($t,{className:"h-4 w-4"})}),R&&e.jsx(_,{variant:"ghost",size:"sm",onClick:Y,children:"ๆธ…้™ค"})]}),e.jsxs(Pe,{value:S.toString(),onValueChange:fe,children:[e.jsx(Be,{className:"w-full sm:w-32",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"10",children:"10ๆก/้กต"}),e.jsx(W,{value:"20",children:"20ๆก/้กต"}),e.jsx(W,{value:"50",children:"50ๆก/้กต"}),e.jsx(W,{value:"100",children:"100ๆก/้กต"})]})]})]})]}),R&&e.jsxs("div",{className:"text-sm text-muted-foreground mt-2",children:["ๆœ็ดขๅ…ณ้”ฎ่ฏ: ",e.jsxs("span",{className:"font-medium",children:['"',R,'"']})]})]}),e.jsx(ze,{children:y?e.jsx("div",{className:"space-y-2",children:[...Array(5)].map(($,A)=>e.jsx(ks,{className:"h-20 w-full"},A))}):j?.data&&j.data.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-2",children:j.data.map($=>e.jsxs("div",{className:"border rounded-lg p-3 hover:bg-accent/50 transition-colors cursor-pointer",onClick:()=>we($.chat_id,$.filename),children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:Zo($.timestamp)}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsxs(Ce,{variant:"secondary",className:"text-xs",children:[$.action_count," ไธชๅŠจไฝœ"]}),e.jsxs(Ce,{variant:"outline",className:"text-xs",children:[$.total_plan_ms.toFixed(0),"ms"]})]})]}),$.action_types&&$.action_types.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:$.action_types.map((A,K)=>e.jsx(Ce,{variant:"outline",className:"text-xs bg-blue-50 dark:bg-blue-950 text-blue-700 dark:text-blue-300 border-blue-200 dark:border-blue-800",children:A},K))}),e.jsx("p",{className:"text-sm line-clamp-2",children:$.reasoning_preview||"ๆ— ๆŽจ็†ๅ†…ๅฎน"})]},$.filename))}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-3 mt-4 pt-4 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["ๅ…ฑ ",j.total," ๆก่ฎฐๅฝ•๏ผŒ็ฌฌ ",z," / ",G," ้กต"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>M(1),disabled:z===1,className:"hidden sm:flex",children:e.jsx(kn,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>M($=>Math.max(1,$-1)),disabled:z===1,children:e.jsx(Pa,{className:"h-4 w-4"})}),e.jsxs("div",{className:"hidden sm:flex items-center gap-2",children:[e.jsx(ne,{type:"number",min:1,max:G,value:E,onChange:$=>C($.target.value),onKeyDown:$=>$.key==="Enter"&&Ee(),placeholder:"่ทณ่ฝฌ",className:"w-20 h-8"}),e.jsx(_,{size:"sm",variant:"outline",onClick:Ee,children:"่ทณ่ฝฌ"})]}),e.jsxs("span",{className:"sm:hidden text-sm text-muted-foreground",children:[z,"/",G]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>M($=>Math.min(G,$+1)),disabled:z===G,children:e.jsx(ra,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>M(G),disabled:z===G,className:"hidden sm:flex",children:e.jsx(Cn,{className:"h-4 w-4"})})]})]})]}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"ๆš‚ๆ— ่ฎกๅˆ’่ฎฐๅฝ•"})})]})]})}),e.jsx(Qs,{open:Ne,onOpenChange:je,children:e.jsxs(Hs,{className:"max-w-4xl max-h-[80vh] grid grid-rows-[auto_1fr_auto] overflow-hidden",children:[e.jsxs(qs,{children:[e.jsxs(Vs,{className:"flex items-center gap-2",children:[e.jsx(Ua,{className:"h-5 w-5"}),"่ฎกๅˆ’ๆ‰ง่กŒ่ฏฆๆƒ…"]}),e.jsx(at,{children:"ๆŸฅ็œ‹้บฆ้บฆ็š„่ฏฆ็ป†่ฎกๅˆ’ๆŽจ็†่ฟ‡็จ‹ๅ’Œๆ‰ง่กŒๅŠจไฝœ"})]}),e.jsx(ts,{className:"h-full pr-4",children:e.jsx("div",{className:"space-y-6 pb-4",children:ce?e.jsx("div",{className:"space-y-4",children:[...Array(5)].map(($,A)=>e.jsx(ks,{className:"h-24 w-full"},A))}):L?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(da,{className:"h-4 w-4"}),"ๅŸบๆœฌไฟกๆฏ"]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 p-4 bg-muted/50 rounded-lg",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"่Šๅคฉ"}),e.jsx("div",{className:"text-sm",title:L.chat_id,children:h(L.chat_id)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"ๆ—ถ้—ดๆˆณ"}),e.jsx("div",{className:"text-sm",children:Zo(L.timestamp)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"็ฑปๅž‹"}),e.jsx(Ce,{variant:"outline",children:L.type})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"ๅŠจไฝœๆ•ฐ้‡"}),e.jsxs(Ce,{children:[L.actions.length," ไธชๅŠจไฝœ"]})]})]})]}),e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(sl,{className:"h-4 w-4"}),"ๆ€ง่ƒฝ็ปŸ่ฎก"]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs(Te,{children:[e.jsx(Oe,{className:"p-4 pb-2",children:e.jsx(Ue,{className:"text-xs text-muted-foreground",children:"ๆ็คบ่ฏๆž„ๅปบ"})}),e.jsx(ze,{className:"p-4 pt-0",children:e.jsxs("div",{className:"text-xl font-bold",children:[L.timing.prompt_build_ms?.toFixed(2)||0,"ms"]})})]}),e.jsxs(Te,{children:[e.jsx(Oe,{className:"p-4 pb-2",children:e.jsx(Ue,{className:"text-xs text-muted-foreground",children:"LLM ๆŽจ็†"})}),e.jsx(ze,{className:"p-4 pt-0",children:e.jsxs("div",{className:"text-xl font-bold",children:[L.timing.llm_duration_ms?.toFixed(2)||0,"ms"]})})]}),e.jsxs(Te,{children:[e.jsx(Oe,{className:"p-4 pb-2",children:e.jsx(Ue,{className:"text-xs text-muted-foreground",children:"ๆ€ป่ฎกๅˆ’ๆ—ถ้—ด"})}),e.jsx(ze,{className:"p-4 pt-0",children:e.jsxs("div",{className:"text-xl font-bold",children:[L.timing.total_plan_ms?.toFixed(2)||0,"ms"]})})]})]})]}),e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(hx,{className:"h-4 w-4"}),"ๆŽจ็†่ฟ‡็จ‹"]}),e.jsx("div",{className:"p-4 bg-muted/50 rounded-lg",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap leading-relaxed",children:L.reasoning||"ๆ— ๆŽจ็†ๅ†…ๅฎน"})})]}),e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(rv,{className:"h-4 w-4"}),"ๆ‰ง่กŒๅŠจไฝœ (",L.actions.length,")"]}),e.jsx("div",{className:"space-y-3",children:L.actions.map(($,A)=>e.jsxs(Te,{children:[e.jsx(Oe,{className:"p-4 pb-3",children:e.jsx("div",{className:"flex items-start justify-between",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(Ce,{variant:"default",children:["ๅŠจไฝœ ",A+1]}),e.jsx(Ce,{variant:"outline",children:$.action_type})]})})}),e.jsxs(ze,{className:"p-4 pt-0 space-y-3",children:[$.reasoning&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:"ๆŽจ็†ไพๆฎ"}),e.jsx("p",{className:"text-sm bg-muted/30 p-2 rounded",children:typeof $.reasoning=="string"?$.reasoning:JSON.stringify($.reasoning)})]}),$.action_message&&e.jsxs("div",{className:"overflow-hidden",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:"ๅŠจไฝœๆถˆๆฏ"}),typeof $.action_message=="string"?e.jsx("p",{className:"text-sm bg-muted/30 p-2 rounded break-all whitespace-pre-wrap",children:$.action_message}):e.jsx("pre",{className:"text-xs bg-muted/30 p-2 rounded overflow-x-auto whitespace-pre-wrap break-all",children:JSON.stringify($.action_message,null,2)})]}),$.action_data&&Object.keys($.action_data).length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:"ๅŠจไฝœๆ•ฐๆฎ"}),e.jsx("pre",{className:"text-xs bg-muted/30 p-2 rounded overflow-x-auto",children:JSON.stringify($.action_data,null,2)})]}),$.action_reasoning&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:"ๅŠจไฝœๆŽจ็†"}),e.jsx("p",{className:"text-sm bg-muted/30 p-2 rounded",children:typeof $.action_reasoning=="string"?$.action_reasoning:JSON.stringify($.action_reasoning)})]})]})]},A))})]}),e.jsx(la,{}),L.raw_output&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"ๅŽŸๅง‹่พ“ๅ‡บ"}),e.jsxs("details",{className:"group",children:[e.jsx("summary",{className:"cursor-pointer text-sm text-muted-foreground hover:text-foreground",children:"็‚นๅ‡ปๅฑ•ๅผ€ๆŸฅ็œ‹ๅฎŒๆ•ดๅŽŸๅง‹่พ“ๅ‡บ"}),e.jsx("div",{className:"mt-2 p-4 bg-muted/50 rounded-lg",children:e.jsx("pre",{className:"text-xs whitespace-pre-wrap break-words",children:L.raw_output})})]})]}),L.prompt&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"ๅฎŒๆ•ดๆ็คบ่ฏ"}),e.jsxs("details",{className:"group",children:[e.jsx("summary",{className:"cursor-pointer text-sm text-muted-foreground hover:text-foreground",children:"็‚นๅ‡ปๅฑ•ๅผ€ๆŸฅ็œ‹ๅฎŒๆ•ดๆ็คบ่ฏ"}),e.jsx("div",{className:"mt-2 p-4 bg-muted/50 rounded-lg",children:e.jsx("pre",{className:"text-xs whitespace-pre-wrap break-words",children:L.prompt})})]})]})]}):e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("p",{className:"text-muted-foreground",children:"ๆ— ๆ•ฐๆฎ"})})})}),e.jsx(gt,{className:"flex-shrink-0",children:e.jsx(_,{onClick:()=>je(!1),children:"ๅ…ณ้—ญ"})})]})})]})}function Wk({autoRefresh:a,refreshKey:l}){const[r,c]=u.useState("overview"),[d,m]=u.useState(null),{getChatName:h}=mN(),[f,p]=u.useState(null),[g,N]=u.useState(!0),[j,b]=u.useState(null),[y,w]=u.useState(!1),[z,M]=u.useState(1),[S,F]=u.useState(20),[E,C]=u.useState(""),[R,H]=u.useState(""),[O,X]=u.useState(""),[L,me]=u.useState(null),[Ne,je]=u.useState(!1),[ce,ge]=u.useState(!1),pe=u.useCallback(async()=>{try{N(!0);const $=await Yk();p($)}catch($){console.error("ๅŠ ่ฝฝๅ›žๅคๅ™จๆ€ป่งˆๅคฑ่ดฅ:",$)}finally{N(!1)}},[]),D=u.useCallback(async()=>{if(d)try{w(!0);const $=await Jk(d.chat_id,z,S,R||void 0);b($)}catch($){console.error("ๅŠ ่ฝฝ่Šๅคฉๆ—ฅๅฟ—ๅคฑ่ดฅ:",$)}finally{w(!1)}},[d,z,S,R]);u.useEffect(()=>{pe()},[pe]),u.useEffect(()=>{l>0&&(r==="overview"?pe():D())},[l,r,pe,D]),u.useEffect(()=>{r==="chat-logs"&&d&&D()},[r,d,D]),hN(a,u.useCallback(()=>{r==="overview"?pe():D()},[r,pe,D]));const Q=$=>{m($),M(1),H(""),X(""),c("chat-logs")},B=()=>{c("overview"),m(null),b(null),H(""),X("")},ue=()=>{H(O),M(1)},Y=()=>{X(""),H(""),M(1)},we=async($,A)=>{try{ge(!0),je(!0);const K=await Xk($,A);me(K)}catch(K){console.error("ๅŠ ่ฝฝๅ›žๅค่ฏฆๆƒ…ๅคฑ่ดฅ:",K)}finally{ge(!1)}},fe=$=>{F(Number($)),M(1)},Ee=()=>{const $=parseInt(E),A=j?Math.ceil(j.total/j.page_size):0;!isNaN($)&&$>=1&&$<=A&&(M($),C(""))},G=j?Math.ceil(j.total/j.page_size):0;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-4",children:r==="overview"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"่Šๅคฉๆ•ฐ้‡"}),e.jsx(Ia,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(ze,{children:g?e.jsx(ks,{className:"h-8 w-16"}):e.jsx("div",{className:"text-2xl font-bold",children:f?.total_chats||0})})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"ๅ›žๅคๆ€ปๆ•ฐ"}),e.jsx(rx,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(ze,{children:g?e.jsx(ks,{className:"h-8 w-16"}):e.jsx("div",{className:"text-2xl font-bold",children:f?.total_replies||0})})]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"่Šๅคฉๅˆ—่กจ"}),e.jsx(Ns,{children:"็‚นๅ‡ปๆŸฅ็œ‹่ฏฅ่Šๅคฉ็š„ๆ‰€ๆœ‰ๅ›žๅค่ฎฐๅฝ•"})]}),e.jsx(ze,{children:g?e.jsx("div",{className:"grid gap-3 md:grid-cols-2 lg:grid-cols-3",children:[...Array(6)].map(($,A)=>e.jsx(ks,{className:"h-24 w-full"},A))}):f?.chats&&f.chats.length>0?e.jsx("div",{className:"grid gap-3 md:grid-cols-2 lg:grid-cols-3",children:f.chats.map($=>e.jsxs("div",{className:"border rounded-lg p-4 hover:bg-accent/50 transition-colors cursor-pointer",onClick:()=>Q($),children:[e.jsxs("div",{className:"flex items-start justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ia,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm truncate max-w-[180px]",title:h($.chat_id),children:h($.chat_id)})]}),e.jsx(Ce,{variant:"secondary",children:$.reply_count})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["ๆœ€ๅŽๆดปๅŠจ: ",xN($.latest_timestamp)]})]},$.chat_id))}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"ๆš‚ๆ— ่Šๅคฉ่ฎฐๅฝ•"})})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-4 mb-4",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:B,children:[e.jsx($a,{className:"h-4 w-4 mr-2"}),"่ฟ”ๅ›ž่Šๅคฉๅˆ—่กจ"]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:["ๅฝ“ๅ‰่Šๅคฉ: ",e.jsx("span",{className:"font-medium",children:d?h(d.chat_id):""}),e.jsx("span",{className:"mx-2",children:"โ€ข"}),"ๅ…ฑ ",j?.total||0," ๆกๅ›žๅค่ฎฐๅฝ•"]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(Ue,{children:"ๅ›žๅค็”Ÿๆˆ่ฎฐๅฝ•"}),e.jsx(Ns,{children:d?h(d.chat_id):""})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ne,{placeholder:"ๆœ็ดขๆ็คบ่ฏๅ†…ๅฎน...",value:O,onChange:$=>X($.target.value),onKeyDown:$=>$.key==="Enter"&&ue(),className:"w-full sm:w-48"}),e.jsx(_,{variant:"outline",size:"icon",onClick:ue,children:e.jsx($t,{className:"h-4 w-4"})}),R&&e.jsx(_,{variant:"ghost",size:"sm",onClick:Y,children:"ๆธ…้™ค"})]}),e.jsxs(Pe,{value:S.toString(),onValueChange:fe,children:[e.jsx(Be,{className:"w-full sm:w-32",children:e.jsx(Fe,{})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"10",children:"10ๆก/้กต"}),e.jsx(W,{value:"20",children:"20ๆก/้กต"}),e.jsx(W,{value:"50",children:"50ๆก/้กต"}),e.jsx(W,{value:"100",children:"100ๆก/้กต"})]})]})]})]}),R&&e.jsxs("div",{className:"text-sm text-muted-foreground mt-2",children:["ๆœ็ดขๅ…ณ้”ฎ่ฏ: ",e.jsxs("span",{className:"font-medium",children:['"',R,'"']})]})]}),e.jsx(ze,{children:y?e.jsx("div",{className:"space-y-2",children:[...Array(5)].map(($,A)=>e.jsx(ks,{className:"h-20 w-full"},A))}):j?.data&&j.data.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-2",children:j.data.map($=>e.jsxs("div",{className:"border rounded-lg p-3 hover:bg-accent/50 transition-colors cursor-pointer",onClick:()=>we($.chat_id,$.filename),children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:Zo($.timestamp)}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[$.success?e.jsxs(Ce,{variant:"default",className:"text-xs bg-green-600",children:[e.jsx(Mg,{className:"h-3 w-3 mr-1"}),"ๆˆๅŠŸ"]}):e.jsxs(Ce,{variant:"destructive",className:"text-xs",children:[e.jsx(ta,{className:"h-3 w-3 mr-1"}),"ๅคฑ่ดฅ"]}),e.jsx(Ce,{variant:"outline",className:"text-xs",children:$.model}),e.jsxs(Ce,{variant:"secondary",className:"text-xs",children:[$.overall_ms.toFixed(0),"ms"]})]})]}),e.jsx("p",{className:"text-sm line-clamp-2",children:$.output_preview||"ๆ— ่พ“ๅ‡บๅ†…ๅฎน"})]},$.filename))}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-3 mt-4 pt-4 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["ๅ…ฑ ",j.total," ๆก่ฎฐๅฝ•๏ผŒ็ฌฌ ",z," / ",G," ้กต"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>M(1),disabled:z===1,className:"hidden sm:flex",children:e.jsx(kn,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>M($=>Math.max(1,$-1)),disabled:z===1,children:e.jsx(Pa,{className:"h-4 w-4"})}),e.jsxs("div",{className:"hidden sm:flex items-center gap-2",children:[e.jsx(ne,{type:"number",min:1,max:G,value:E,onChange:$=>C($.target.value),onKeyDown:$=>$.key==="Enter"&&Ee(),placeholder:"่ทณ่ฝฌ",className:"w-20 h-8"}),e.jsx(_,{size:"sm",variant:"outline",onClick:Ee,children:"่ทณ่ฝฌ"})]}),e.jsxs("span",{className:"sm:hidden text-sm text-muted-foreground",children:[z,"/",G]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>M($=>Math.min(G,$+1)),disabled:z===G,children:e.jsx(ra,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>M(G),disabled:z===G,className:"hidden sm:flex",children:e.jsx(Cn,{className:"h-4 w-4"})})]})]})]}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"ๆš‚ๆ— ๅ›žๅค่ฎฐๅฝ•"})})]})]})}),e.jsx(Qs,{open:Ne,onOpenChange:je,children:e.jsxs(Hs,{className:"max-w-4xl max-h-[80vh] grid grid-rows-[auto_1fr_auto] overflow-hidden",children:[e.jsxs(qs,{children:[e.jsxs(Vs,{className:"flex items-center gap-2",children:[e.jsx(Ua,{className:"h-5 w-5"}),"ๅ›žๅค็”Ÿๆˆ่ฏฆๆƒ…"]}),e.jsx(at,{children:"ๆŸฅ็œ‹้บฆ้บฆ็š„่ฏฆ็ป†ๅ›žๅค็”Ÿๆˆ่ฟ‡็จ‹"})]}),e.jsx(ts,{className:"h-full pr-4",children:e.jsx("div",{className:"space-y-6 pb-4",children:ce?e.jsx("div",{className:"space-y-4",children:[...Array(5)].map(($,A)=>e.jsx(ks,{className:"h-24 w-full"},A))}):L?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(da,{className:"h-4 w-4"}),"ๅŸบๆœฌไฟกๆฏ"]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 p-4 bg-muted/50 rounded-lg",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"่Šๅคฉ"}),e.jsx("div",{className:"text-sm",title:L.chat_id,children:h(L.chat_id)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"ๆ—ถ้—ดๆˆณ"}),e.jsx("div",{className:"text-sm",children:Zo(L.timestamp)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"็Šถๆ€"}),L.success?e.jsxs(Ce,{variant:"default",className:"bg-green-600",children:[e.jsx(Mg,{className:"h-3 w-3 mr-1"}),"ๆˆๅŠŸ"]}):e.jsxs(Ce,{variant:"destructive",children:[e.jsx(ta,{className:"h-3 w-3 mr-1"}),"ๅคฑ่ดฅ"]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"ๆ€่€ƒๆทฑๅบฆ"}),e.jsxs(Ce,{variant:"outline",children:["Level ",L.think_level]})]})]})]}),e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(V1,{className:"h-4 w-4"}),"ๆจกๅž‹ไฟกๆฏ"]}),e.jsx("div",{className:"p-4 bg-muted/50 rounded-lg",children:e.jsx(Ce,{variant:"secondary",className:"text-sm",children:L.model})})]}),e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(sl,{className:"h-4 w-4"}),"ๆ€ง่ƒฝ็ปŸ่ฎก"]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs(Te,{children:[e.jsx(Oe,{className:"p-4 pb-2",children:e.jsx(Ue,{className:"text-xs text-muted-foreground",children:"ๆ็คบ่ฏๆž„ๅปบ"})}),e.jsx(ze,{className:"p-4 pt-0",children:e.jsxs("div",{className:"text-xl font-bold",children:[L.timing.prompt_ms?.toFixed(2)||0,"ms"]})})]}),e.jsxs(Te,{children:[e.jsx(Oe,{className:"p-4 pb-2",children:e.jsx(Ue,{className:"text-xs text-muted-foreground",children:"LLM ๆŽจ็†"})}),e.jsx(ze,{className:"p-4 pt-0",children:e.jsxs("div",{className:"text-xl font-bold",children:[L.timing.llm_ms?.toFixed(2)||0,"ms"]})})]}),e.jsxs(Te,{children:[e.jsx(Oe,{className:"p-4 pb-2",children:e.jsx(Ue,{className:"text-xs text-muted-foreground",children:"ๆ€ป่€—ๆ—ถ"})}),e.jsx(ze,{className:"p-4 pt-0",children:e.jsxs("div",{className:"text-xl font-bold",children:[L.timing.overall_ms?.toFixed(2)||0,"ms"]})})]})]}),L.timing.timing_logs&&L.timing.timing_logs.length>0&&e.jsxs("div",{className:"mt-3 p-3 bg-muted/30 rounded-lg",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-2",children:"่€—ๆ—ถ่ฏฆๆƒ…"}),e.jsx("div",{className:"space-y-1",children:L.timing.timing_logs.map(($,A)=>e.jsx("div",{className:"text-xs text-muted-foreground",children:$},A))})]}),L.timing.almost_zero&&e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:[e.jsx("span",{className:"font-medium",children:"่ฟ‘ไนŽ้›ถ่€—ๆ—ถ: "}),L.timing.almost_zero]})]}),e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(hx,{className:"h-4 w-4"}),"ๅ›žๅค่พ“ๅ‡บ"]}),e.jsx("div",{className:"p-4 bg-muted/50 rounded-lg",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap leading-relaxed",children:L.output||"ๆ— ่พ“ๅ‡บๅ†…ๅฎน"})})]}),L.processed_output&&L.processed_output.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"ๅค„็†ๅŽ็š„่พ“ๅ‡บ"}),e.jsx("div",{className:"space-y-2",children:L.processed_output.map(($,A)=>e.jsx("div",{className:"p-3 bg-muted/30 rounded-lg",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:$})},A))})]})]}),L.reasoning&&e.jsxs(e.Fragment,{children:[e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"ๆŽจ็†่ฟ‡็จ‹"}),e.jsx("div",{className:"p-4 bg-muted/50 rounded-lg",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap leading-relaxed",children:L.reasoning})})]})]}),L.error&&e.jsxs(e.Fragment,{children:[e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold text-destructive",children:"้”™่ฏฏไฟกๆฏ"}),e.jsx("div",{className:"p-4 bg-destructive/10 rounded-lg border border-destructive/20",children:e.jsx("p",{className:"text-sm text-destructive whitespace-pre-wrap",children:L.error})})]})]}),L.prompt&&e.jsxs(e.Fragment,{children:[e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"ๅฎŒๆ•ดๆ็คบ่ฏ"}),e.jsxs("details",{className:"group",children:[e.jsx("summary",{className:"cursor-pointer text-sm text-muted-foreground hover:text-foreground",children:"็‚นๅ‡ปๅฑ•ๅผ€ๆŸฅ็œ‹ๅฎŒๆ•ดๆ็คบ่ฏ"}),e.jsx("div",{className:"mt-2 p-4 bg-muted/50 rounded-lg",children:e.jsx("pre",{className:"text-xs whitespace-pre-wrap break-words",children:L.prompt})})]})]})]})]}):e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("p",{className:"text-muted-foreground",children:"ๆ— ๆ•ฐๆฎ"})})})}),e.jsx(gt,{className:"flex-shrink-0",children:e.jsx(_,{onClick:()=>je(!1),children:"ๅ…ณ้—ญ"})})]})})]})}function eC(){const[a,l]=u.useState("planner"),[r,c]=u.useState(!1),[d,m]=u.useState(0),h=u.useCallback(()=>{m(f=>f+1)},[]);return e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"่ฎกๅˆ’ๅ™จ & ๅ›žๅคๅ™จ็›‘ๆŽง"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"ๅฎžๆ—ถ็›‘ๆŽง้บฆ้บฆ็š„ไปปๅŠก่ฎกๅˆ’ๅ™จๅ’Œๅ›žๅค็”Ÿๆˆๅ™จ่ฟ่กŒ็Šถๆ€"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(_,{variant:r?"default":"outline",size:"sm",onClick:()=>c(!r),children:[e.jsx(dt,{className:`h-4 w-4 mr-2 ${r?"animate-spin":""}`}),r?"่‡ชๅŠจๅˆทๆ–ฐไธญ":"่‡ชๅŠจๅˆทๆ–ฐ"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:h,children:e.jsx(dt,{className:"h-4 w-4"})})]})]}),e.jsxs(Jt,{value:a,onValueChange:f=>l(f),className:"w-full",children:[e.jsxs(Gt,{className:"grid w-full grid-cols-2 gap-0.5 sm:gap-1 h-auto p-1",children:[e.jsxs(Xe,{value:"planner",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(nx,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"่ฎกๅˆ’ๅ™จ็›‘ๆŽง"})]}),e.jsxs(Xe,{value:"replier",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(G1,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"ๅ›žๅคๅ™จ็›‘ๆŽง"})]})]}),e.jsxs(ts,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[e.jsx(Ss,{value:"planner",className:"mt-0",children:e.jsx(Zk,{autoRefresh:r,refreshKey:d})}),e.jsx(Ss,{value:"replier",className:"mt-0",children:e.jsx(Wk,{autoRefresh:r,refreshKey:d})})]})]})]})}const sC="Mai-with-u",tC="plugin-repo",aC="main",lC="plugin_details.json";async function nC(){try{const a=await ke("/api/webui/plugins/fetch-raw",{method:"POST",body:JSON.stringify({owner:sC,repo:tC,branch:aC,file_path:lC})});if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);const l=await a.json();if(!l.success||!l.data)throw new Error(l.error||"่Žทๅ–ๆ’ไปถๅˆ—่กจๅคฑ่ดฅ");return JSON.parse(l.data).filter(d=>!d?.id||!d?.manifest?(console.warn("่ทณ่ฟ‡ๆ— ๆ•ˆๆ’ไปถๆ•ฐๆฎ:",d),!1):!d.manifest.name||!d.manifest.version?(console.warn("่ทณ่ฟ‡็ผบๅฐ‘ๅฟ…้œ€ๅญ—ๆฎต็š„ๆ’ไปถ:",d.id),!1):!0).map(d=>({id:d.id,manifest:{manifest_version:d.manifest.manifest_version||1,name:d.manifest.name,version:d.manifest.version,description:d.manifest.description||"",author:d.manifest.author||{name:"Unknown"},license:d.manifest.license||"Unknown",host_application:d.manifest.host_application||{min_version:"0.0.0"},homepage_url:d.manifest.homepage_url,repository_url:d.manifest.repository_url,keywords:d.manifest.keywords||[],categories:d.manifest.categories||[],default_locale:d.manifest.default_locale||"zh-CN",locales_path:d.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!1,published_at:new Date().toISOString(),updated_at:new Date().toISOString()}))}catch(a){throw console.error("Failed to fetch plugin list:",a),a}}async function fN(){try{const a=await ke("/api/webui/plugins/git-status");if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);return await a.json()}catch(a){return console.error("Failed to check Git status:",a),{installed:!1,error:"ๆ— ๆณ•ๆฃ€ๆต‹ Git ๅฎ‰่ฃ…็Šถๆ€"}}}async function pN(){try{const a=await ke("/api/webui/plugins/version");if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);return await a.json()}catch(a){return console.error("Failed to get Maimai version:",a),{version:"0.0.0",version_major:0,version_minor:0,version_patch:0}}}function gN(a,l,r){const c=a.split(".").map(f=>parseInt(f)||0),d=c[0]||0,m=c[1]||0,h=c[2]||0;if(r.version_majorparseInt(j)||0),p=f[0]||0,g=f[1]||0,N=f[2]||0;if(r.version_major>p||r.version_major===p&&r.version_minor>g||r.version_major===p&&r.version_minor===g&&r.version_patch>N)return!1}return!0}async function rC(){try{const a=await ke("/api/webui/ws-token");if(!a.ok)return console.error("่Žทๅ– WebSocket token ๅคฑ่ดฅ:",a.status),null;const l=await a.json();return l.success&&l.token?l.token:null}catch(a){return console.error("่Žทๅ– WebSocket token ๅคฑ่ดฅ:",a),null}}async function iC(a,l){const r=await rC();if(!r)return console.warn("ๆ— ๆณ•่Žทๅ– WebSocket token๏ผŒๅฏ่ƒฝๆœช็™ปๅฝ•"),null;const c=window.location.protocol==="https:"?"wss:":"ws:",d=window.location.host,m=`${c}//${d}/api/webui/ws/plugin-progress?token=${encodeURIComponent(r)}`;try{const h=new WebSocket(m);return h.onopen=()=>{console.log("Plugin progress WebSocket connected");const f=setInterval(()=>{h.readyState===WebSocket.OPEN?h.send("ping"):clearInterval(f)},3e4)},h.onmessage=f=>{try{if(f.data==="pong")return;const p=JSON.parse(f.data);a(p)}catch(p){console.error("Failed to parse progress data:",p)}},h.onerror=f=>{console.error("Plugin progress WebSocket error:",f),l?.(f)},h.onclose=()=>{console.log("Plugin progress WebSocket disconnected")},h}catch(h){return console.error("ๅˆ›ๅปบ WebSocket ่ฟžๆŽฅๅคฑ่ดฅ:",h),null}}async function Il(){try{const a=await ke("/api/webui/plugins/installed",{headers:Zs()});if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);const l=await a.json();if(!l.success)throw new Error(l.message||"่Žทๅ–ๅทฒๅฎ‰่ฃ…ๆ’ไปถๅˆ—่กจๅคฑ่ดฅ");return l.plugins||[]}catch(a){return console.error("Failed to get installed plugins:",a),[]}}function bn(a,l){return l.some(r=>r.id===a)}function yn(a,l){const r=l.find(c=>c.id===a);if(r)return r.manifest?.version||r.version}async function jN(a,l,r="main"){const c=await ke("/api/webui/plugins/install",{method:"POST",body:JSON.stringify({plugin_id:a,repository_url:l,branch:r})});if(!c.ok){const d=await c.json();throw new Error(d.detail||"ๅฎ‰่ฃ…ๅคฑ่ดฅ")}return await c.json()}async function vN(a){const l=await ke("/api/webui/plugins/uninstall",{method:"POST",body:JSON.stringify({plugin_id:a})});if(!l.ok){const r=await l.json();throw new Error(r.detail||"ๅธ่ฝฝๅคฑ่ดฅ")}return await l.json()}async function NN(a,l,r="main"){const c=await ke("/api/webui/plugins/update",{method:"POST",body:JSON.stringify({plugin_id:a,repository_url:l,branch:r})});if(!c.ok){const d=await c.json();throw new Error(d.detail||"ๆ›ดๆ–ฐๅคฑ่ดฅ")}return await c.json()}async function cC(a){const l=await ke(`/api/webui/plugins/config/${a}/schema`,{headers:Zs()});if(!l.ok){const c=await l.text();try{const d=JSON.parse(c);throw new Error(d.detail||"่Žทๅ–้…็ฝฎ Schema ๅคฑ่ดฅ")}catch{throw new Error(`่Žทๅ–้…็ฝฎ Schema ๅคฑ่ดฅ (${l.status})`)}}const r=await l.json();if(!r.success)throw new Error(r.message||"่Žทๅ–้…็ฝฎ Schema ๅคฑ่ดฅ");return r.schema}async function oC(a){const l=await ke(`/api/webui/plugins/config/${a}`,{headers:Zs()});if(!l.ok){const c=await l.text();try{const d=JSON.parse(c);throw new Error(d.detail||"่Žทๅ–้…็ฝฎๅคฑ่ดฅ")}catch{throw new Error(`่Žทๅ–้…็ฝฎๅคฑ่ดฅ (${l.status})`)}}const r=await l.json();if(!r.success)throw new Error(r.message||"่Žทๅ–้…็ฝฎๅคฑ่ดฅ");return r.config}async function dC(a){const l=await ke(`/api/webui/plugins/config/${a}/raw`,{headers:Zs()});if(!l.ok){const c=await l.text();try{const d=JSON.parse(c);throw new Error(d.detail||"่Žทๅ–้…็ฝฎๅคฑ่ดฅ")}catch{throw new Error(`่Žทๅ–้…็ฝฎๅคฑ่ดฅ (${l.status})`)}}const r=await l.json();if(!r.success)throw new Error(r.message||"่Žทๅ–้…็ฝฎๅคฑ่ดฅ");return r.config}async function uC(a,l){const r=await ke(`/api/webui/plugins/config/${a}`,{method:"PUT",headers:Zs(),body:JSON.stringify({config:l})});if(!r.ok){const c=await r.json();throw new Error(c.detail||"ไฟๅญ˜้…็ฝฎๅคฑ่ดฅ")}return await r.json()}async function mC(a,l){const r=await ke(`/api/webui/plugins/config/${a}/raw`,{method:"PUT",headers:Zs(),body:JSON.stringify({config:l})});if(!r.ok){const c=await r.json();throw new Error(c.detail||"ไฟๅญ˜้…็ฝฎๅคฑ่ดฅ")}return await r.json()}async function xC(a){const l=await ke(`/api/webui/plugins/config/${a}/reset`,{method:"POST",headers:Zs()});if(!l.ok){const r=await l.json();throw new Error(r.detail||"้‡็ฝฎ้…็ฝฎๅคฑ่ดฅ")}return await l.json()}async function hC(a){const l=await ke(`/api/webui/plugins/config/${a}/toggle`,{method:"POST",headers:Zs()});if(!l.ok){const r=await l.json();throw new Error(r.detail||"ๅˆ‡ๆข็Šถๆ€ๅคฑ่ดฅ")}return await l.json()}const Nc="https://maibot-plugin-stats.maibot-webui.workers.dev";async function bN(a){try{const l=await fetch(`${Nc}/stats/${a}`);return l.ok?await l.json():(console.error("Failed to fetch plugin stats:",l.statusText),null)}catch(l){return console.error("Error fetching plugin stats:",l),null}}async function fC(a,l){try{const r=l||Ax(),c=await fetch(`${Nc}/stats/like`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:a,user_id:r})}),d=await c.json();return c.status===429?{success:!1,error:"ๆ“ไฝœ่ฟ‡ไบŽ้ข‘็น๏ผŒ่ฏท็จๅŽๅ†่ฏ•"}:c.ok?{success:!0,...d}:{success:!1,error:d.error||"็‚น่ตžๅคฑ่ดฅ"}}catch(r){return console.error("Error liking plugin:",r),{success:!1,error:"็ฝ‘็ปœ้”™่ฏฏ"}}}async function pC(a,l){try{const r=l||Ax(),c=await fetch(`${Nc}/stats/dislike`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:a,user_id:r})}),d=await c.json();return c.status===429?{success:!1,error:"ๆ“ไฝœ่ฟ‡ไบŽ้ข‘็น๏ผŒ่ฏท็จๅŽๅ†่ฏ•"}:c.ok?{success:!0,...d}:{success:!1,error:d.error||"็‚น่ธฉๅคฑ่ดฅ"}}catch(r){return console.error("Error disliking plugin:",r),{success:!1,error:"็ฝ‘็ปœ้”™่ฏฏ"}}}async function gC(a,l,r,c){if(l<1||l>5)return{success:!1,error:"่ฏ„ๅˆ†ๅฟ…้กปๅœจ 1-5 ไน‹้—ด"};try{const d=c||Ax(),m=await fetch(`${Nc}/stats/rate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:a,rating:l,comment:r,user_id:d})}),h=await m.json();return m.status===429?{success:!1,error:"ๆฏๅคฉๆœ€ๅคš่ฏ„ๅˆ† 3 ๆฌก"}:m.ok?{success:!0,...h}:{success:!1,error:h.error||"่ฏ„ๅˆ†ๅคฑ่ดฅ"}}catch(d){return console.error("Error rating plugin:",d),{success:!1,error:"็ฝ‘็ปœ้”™่ฏฏ"}}}async function yN(a){try{const l=await fetch(`${Nc}/stats/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:a})}),r=await l.json();return l.status===429?(console.warn("Download recording rate limited"),{success:!0}):l.ok?{success:!0,...r}:(console.error("Failed to record download:",r.error),{success:!1,error:r.error})}catch(l){return console.error("Error recording download:",l),{success:!1,error:"็ฝ‘็ปœ้”™่ฏฏ"}}}function jC(){const a=navigator,l=[navigator.userAgent,navigator.language,navigator.languages?.join(",")||"",navigator.platform,navigator.hardwareConcurrency||0,screen.width,screen.height,screen.colorDepth,screen.pixelDepth,new Date().getTimezoneOffset(),Intl.DateTimeFormat().resolvedOptions().timeZone,navigator.maxTouchPoints||0,a.deviceMemory||0].join("|");let r=0;for(let c=0;c{const Z=J.map(async De=>{try{const xe=await bN(De.id);return{id:De.id,stats:xe}}catch(xe){return console.warn(`Failed to load stats for ${De.id}:`,xe),{id:De.id,stats:null}}}),Le=await Promise.all(Z),le={};Le.forEach(({id:De,stats:xe})=>{xe&&(le[De]=xe)}),L(le)};u.useEffect(()=>{let J=null,Z=!1;return(async()=>{if(J=await iC(le=>{Z||(C(le),le.stage==="success"?setTimeout(()=>{Z||C(null)},2e3):le.stage==="error"&&(w(!1),M(le.error||"ๅŠ ่ฝฝๅคฑ่ดฅ")))},le=>{console.error("WebSocket error:",le),Z||fe({title:"WebSocket ่ฟžๆŽฅๅคฑ่ดฅ",description:"ๆ— ๆณ•ๅฎžๆ—ถๆ˜พ็คบๅŠ ่ฝฝ่ฟ›ๅบฆ",variant:"destructive"})}),await new Promise(le=>{if(!J){le();return}const De=()=>{J&&J.readyState===WebSocket.OPEN?(console.log("WebSocket connected, starting to load plugins"),le()):J&&J.readyState===WebSocket.CLOSED?(console.warn("WebSocket closed before loading plugins"),le()):setTimeout(De,100)};De()}),!Z){const le=await fN();F(le),le.installed||fe({title:"Git ๆœชๅฎ‰่ฃ…",description:le.error||"่ฏทๅ…ˆๅฎ‰่ฃ… Git ๆ‰่ƒฝไฝฟ็”จๆ’ไปถๅฎ‰่ฃ…ๅŠŸ่ƒฝ",variant:"destructive"})}if(!Z){const le=await pN();H(le)}if(!Z)try{w(!0),M(null);const le=await nC();if(!Z){const De=await Il();O(De);const xe=le.map(Me=>{const ds=bn(Me.id,De),Ts=yn(Me.id,De);return{...Me,installed:ds,installed_version:Ts}});for(const Me of De)!xe.some(Ts=>Ts.id===Me.id)&&Me.manifest&&xe.push({id:Me.id,manifest:{manifest_version:Me.manifest.manifest_version||1,name:Me.manifest.name,version:Me.manifest.version,description:Me.manifest.description||"",author:Me.manifest.author,license:Me.manifest.license||"Unknown",host_application:Me.manifest.host_application,homepage_url:Me.manifest.homepage_url,repository_url:Me.manifest.repository_url,keywords:Me.manifest.keywords||[],categories:Me.manifest.categories||[],default_locale:Me.manifest.default_locale||"zh-CN",locales_path:Me.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!0,installed_version:Me.manifest.version,published_at:new Date().toISOString(),updated_at:new Date().toISOString()});b(xe),Ee(xe)}}catch(le){if(!Z){const De=le instanceof Error?le.message:"ๅŠ ่ฝฝๆ’ไปถๅˆ—่กจๅคฑ่ดฅ";M(De),fe({title:"ๅŠ ่ฝฝๅคฑ่ดฅ",description:De,variant:"destructive"})}}finally{Z||w(!1)}})(),()=>{Z=!0,J&&J.close()}},[fe]);const G=J=>{if(!J.installed&&R&&!$(J))return e.jsxs(Ce,{variant:"destructive",className:"gap-1",children:[e.jsx(Ut,{className:"h-3 w-3"}),"ไธๅ…ผๅฎน"]});if(J.installed){const Z=J.installed_version?.trim(),Le=J.manifest.version?.trim();if(Z!==Le){const le=Z?.split(".").map(Number)||[0,0,0],De=Le?.split(".").map(Number)||[0,0,0];for(let xe=0;xe<3;xe++){if((De[xe]||0)>(le[xe]||0))return e.jsxs(Ce,{variant:"outline",className:"gap-1 text-orange-600 border-orange-600",children:[e.jsx(Ut,{className:"h-3 w-3"}),"ๅฏๆ›ดๆ–ฐ"]});if((De[xe]||0)<(le[xe]||0))break}}return e.jsxs(Ce,{variant:"default",className:"gap-1",children:[e.jsx(st,{className:"h-3 w-3"}),"ๅทฒๅฎ‰่ฃ…"]})}return null},$=J=>!R||!J.manifest?.host_application?!0:gN(J.manifest.host_application.min_version,J.manifest.host_application.max_version,R),A=J=>{if(!J.installed||!J.installed_version||!J.manifest?.version)return!1;const Z=J.installed_version.trim(),Le=J.manifest.version.trim();if(Z===Le)return!1;const le=Z.split(".").map(Number),De=Le.split(".").map(Number);for(let xe=0;xe<3;xe++){if((De[xe]||0)>(le[xe]||0))return!0;if((De[xe]||0)<(le[xe]||0))return!1}return!1},K=j.filter(J=>{if(!J.manifest)return console.warn("[่ฟ‡ๆปค] ่ทณ่ฟ‡ๆ—  manifest ็š„ๆ’ไปถ:",J.id),!1;const Z=c===""||J.manifest.name?.toLowerCase().includes(c.toLowerCase())||J.manifest.description?.toLowerCase().includes(c.toLowerCase())||J.manifest.keywords&&J.manifest.keywords.some(xe=>xe.toLowerCase().includes(c.toLowerCase())),Le=m==="all"||J.manifest.categories&&J.manifest.categories.includes(m);let le=!0;f==="installed"?le=J.installed===!0:f==="updates"&&(le=J.installed===!0&&A(J));const De=!g||!R||$(J);return Z&&Le&&le&&De}),Re=J=>{if(!S?.installed){fe({title:"ๆ— ๆณ•ๅฎ‰่ฃ…",description:"Git ๆœชๅฎ‰่ฃ…",variant:"destructive"});return}if(R&&!$(J)){fe({title:"ๆ— ๆณ•ๅฎ‰่ฃ…",description:"ๆ’ไปถไธŽๅฝ“ๅ‰้บฆ้บฆ็‰ˆๆœฌไธๅ…ผๅฎน",variant:"destructive"});return}ce(J),pe("main"),Q(""),ue("preset"),we(!1),Ne(!0)},se=async()=>{if(!je)return;const J=B==="custom"?D:ge;if(!J||J.trim()===""){fe({title:"ๅˆ†ๆ”ฏๅ็งฐไธ่ƒฝไธบ็ฉบ",variant:"destructive"});return}try{Ne(!1),await jN(je.id,je.manifest.repository_url||"",J),yN(je.id).catch(Le=>{console.warn("Failed to record download:",Le)}),fe({title:"ๅฎ‰่ฃ…ๆˆๅŠŸ",description:`${je.manifest.name} ๅทฒๆˆๅŠŸๅฎ‰่ฃ…`});const Z=await Il();O(Z),b(Le=>Le.map(le=>{if(le.id===je.id){const De=bn(le.id,Z),xe=yn(le.id,Z);return{...le,installed:De,installed_version:xe}}return le}))}catch(Z){fe({title:"ๅฎ‰่ฃ…ๅคฑ่ดฅ",description:Z instanceof Error?Z.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}finally{ce(null)}},$e=async J=>{try{await vN(J.id),fe({title:"ๅธ่ฝฝๆˆๅŠŸ",description:`${J.manifest.name} ๅทฒๆˆๅŠŸๅธ่ฝฝ`});const Z=await Il();O(Z),b(Le=>Le.map(le=>{if(le.id===J.id){const De=bn(le.id,Z),xe=yn(le.id,Z);return{...le,installed:De,installed_version:xe}}return le}))}catch(Z){fe({title:"ๅธ่ฝฝๅคฑ่ดฅ",description:Z instanceof Error?Z.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}},cs=async J=>{if(!S?.installed){fe({title:"ๆ— ๆณ•ๆ›ดๆ–ฐ",description:"Git ๆœชๅฎ‰่ฃ…",variant:"destructive"});return}try{const Z=await NN(J.id,J.manifest.repository_url||"","main");fe({title:"ๆ›ดๆ–ฐๆˆๅŠŸ",description:`${J.manifest.name} ๅทฒไปŽ ${Z.old_version} ๆ›ดๆ–ฐๅˆฐ ${Z.new_version}`});const Le=await Il();O(Le),b(le=>le.map(De=>{if(De.id===J.id){const xe=bn(De.id,Le),Me=yn(De.id,Le);return{...De,installed:xe,installed_version:Me}}return De}))}catch(Z){fe({title:"ๆ›ดๆ–ฐๅคฑ่ดฅ",description:Z instanceof Error?Z.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}};return e.jsx(ts,{className:"h-full",children:e.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"ๆ’ไปถๅธ‚ๅœบ"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"ๆต่งˆๅ’Œ็ฎก็†้บฆ้บฆ็š„ๆ’ไปถ"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(_,{variant:"outline",onClick:()=>l(),disabled:r,children:[e.jsx(hv,{className:`h-4 w-4 mr-2 ${r?"animate-spin":""}`}),"้‡ๅฏ้บฆ้บฆ"]}),e.jsxs(_,{onClick:()=>a({to:"/plugin-mirrors"}),children:[e.jsx(K1,{className:"h-4 w-4 mr-2"}),"้…็ฝฎ้•œๅƒๆบ"]})]})]}),e.jsx(Te,{className:"border-blue-200 bg-blue-50 dark:bg-blue-950/20 dark:border-blue-900",children:e.jsx(ze,{className:"py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Yt,{className:"h-4 w-4 text-blue-600 flex-shrink-0"}),e.jsxs("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:["ๅฎ‰่ฃ…ใ€ๅธ่ฝฝๆˆ–ๆ›ดๆ–ฐๆ’ไปถๅŽ๏ผŒ้œ€่ฆ",e.jsx("span",{className:"font-semibold",children:"้‡ๅฏ้บฆ้บฆ"}),"ๆ‰่ƒฝไฝฟๆ›ดๆ”น็”Ÿๆ•ˆ"]})]})})}),S&&!S.installed&&e.jsxs(Te,{className:"border-orange-600 bg-orange-50 dark:bg-orange-950/20",children:[e.jsx(Oe,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Lt,{className:"h-5 w-5 text-orange-600"}),e.jsxs("div",{children:[e.jsx(Ue,{className:"text-lg text-orange-900 dark:text-orange-100",children:"Git ๆœชๅฎ‰่ฃ…"}),e.jsx(Ns,{className:"text-orange-800 dark:text-orange-200",children:S.error||"่ฏทๅ…ˆๅฎ‰่ฃ… Git ๆ‰่ƒฝไฝฟ็”จๆ’ไปถๅฎ‰่ฃ…ๅŠŸ่ƒฝ"})]})]})}),e.jsx(ze,{children:e.jsxs("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:["ๆ‚จๅฏไปฅไปŽ ",e.jsx("a",{href:"https://git-scm.com/downloads",target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:"git-scm.com"})," ไธ‹่ฝฝๅนถๅฎ‰่ฃ… Gitใ€‚ ๅฎ‰่ฃ…ๅฎŒๆˆๅŽ๏ผŒ่ฏท้‡ๅฏ้บฆ้บฆๅบ”็”จใ€‚"]})})]}),e.jsx(Te,{className:"p-4",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx($t,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ne,{placeholder:"ๆœ็ดขๆ’ไปถ...",value:c,onChange:J=>d(J.target.value),className:"pl-9"})]}),e.jsxs(Pe,{value:m,onValueChange:h,children:[e.jsx(Be,{className:"w-full sm:w-[200px]",children:e.jsx(Fe,{placeholder:"้€‰ๆ‹ฉๅˆ†็ฑป"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"all",children:"ๅ…จ้ƒจๅˆ†็ฑป"}),e.jsx(W,{value:"Group Management",children:"็พค็ป„็ฎก็†"}),e.jsx(W,{value:"Entertainment & Interaction",children:"ๅจฑไนไบ’ๅŠจ"}),e.jsx(W,{value:"Utility Tools",children:"ๅฎž็”จๅทฅๅ…ท"}),e.jsx(W,{value:"Content Generation",children:"ๅ†…ๅฎน็”Ÿๆˆ"}),e.jsx(W,{value:"Multimedia",children:"ๅคšๅช’ไฝ“"}),e.jsx(W,{value:"External Integration",children:"ๅค–้ƒจ้›†ๆˆ"}),e.jsx(W,{value:"Data Analysis & Insights",children:"ๆ•ฐๆฎๅˆ†ๆžไธŽๆดžๅฏŸ"}),e.jsx(W,{value:"Other",children:"ๅ…ถไป–"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(tt,{id:"compatible-only",checked:g,onCheckedChange:J=>N(J===!0)}),e.jsx("label",{htmlFor:"compatible-only",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"ๅชๆ˜พ็คบๅ…ผๅฎนๅฝ“ๅ‰็‰ˆๆœฌ็š„ๆ’ไปถ"})]})]})}),e.jsx(Jt,{value:f,onValueChange:p,className:"w-full",children:e.jsxs(Gt,{className:"grid w-full grid-cols-3",children:[e.jsxs(Xe,{value:"all",children:["ๅ…จ้ƒจๆ’ไปถ (",j.filter(J=>{if(!J.manifest)return!1;const Z=c===""||J.manifest.name?.toLowerCase().includes(c.toLowerCase())||J.manifest.description?.toLowerCase().includes(c.toLowerCase())||J.manifest.keywords&&J.manifest.keywords.some(De=>De.toLowerCase().includes(c.toLowerCase())),Le=m==="all"||J.manifest.categories&&J.manifest.categories.includes(m),le=!g||!R||$(J);return Z&&Le&&le}).length,")"]}),e.jsxs(Xe,{value:"installed",children:["ๅทฒๅฎ‰่ฃ… (",j.filter(J=>{if(!J.manifest)return!1;const Z=c===""||J.manifest.name?.toLowerCase().includes(c.toLowerCase())||J.manifest.description?.toLowerCase().includes(c.toLowerCase())||J.manifest.keywords&&J.manifest.keywords.some(De=>De.toLowerCase().includes(c.toLowerCase())),Le=m==="all"||J.manifest.categories&&J.manifest.categories.includes(m),le=!g||!R||$(J);return J.installed&&Z&&Le&&le}).length,")"]}),e.jsxs(Xe,{value:"updates",children:["ๅฏๆ›ดๆ–ฐ (",j.filter(J=>{if(!J.manifest)return!1;const Z=c===""||J.manifest.name?.toLowerCase().includes(c.toLowerCase())||J.manifest.description?.toLowerCase().includes(c.toLowerCase())||J.manifest.keywords&&J.manifest.keywords.some(De=>De.toLowerCase().includes(c.toLowerCase())),Le=m==="all"||J.manifest.categories&&J.manifest.categories.includes(m),le=!g||!R||$(J);return J.installed&&A(J)&&Z&&Le&&le}).length,")"]})]})}),E&&E.stage==="loading"&&E.operation==="fetch"&&e.jsx(Te,{className:"p-4",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Fs,{className:"h-4 w-4 animate-spin"}),e.jsx("span",{className:"text-sm font-medium",children:"ๅŠ ่ฝฝๆ’ไปถๅˆ—่กจ"})]}),e.jsxs("span",{className:"text-sm font-medium",children:[E.progress,"%"]})]}),e.jsx(tr,{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(Te,{className:"border-destructive bg-destructive/10",children:e.jsx(Oe,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Lt,{className:"h-5 w-5 text-destructive"}),e.jsxs("div",{children:[e.jsx(Ue,{className:"text-lg text-destructive",children:"ๅŠ ่ฝฝๅคฑ่ดฅ"}),e.jsx(Ns,{className:"text-destructive/80",children:E.error})]})]})})}),y?e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(Fs,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-muted-foreground",children:"ๅŠ ่ฝฝๆ’ไปถๅˆ—่กจไธญ..."})]}):z?e.jsx(Te,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Lt,{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:z}),e.jsx(_,{onClick:()=>window.location.reload(),children:"้‡ๆ–ฐๅŠ ่ฝฝ"})]})}):K.length===0?e.jsx(Te,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx($t,{className:"h-12 w-12 text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"ๆœชๆ‰พๅˆฐๆ’ไปถ"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:c||m!=="all"?"ๅฐ่ฏ•่ฐƒๆ•ดๆœ็ดขๆกไปถๆˆ–็ญ›้€‰ๅ™จ":"ๆš‚ๆ— ๅฏ็”จๆ’ไปถ"})]})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:K.map(J=>e.jsxs(Te,{className:"flex flex-col hover:shadow-lg transition-shadow h-full",children:[e.jsxs(Oe,{children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx(Ue,{className:"text-xl",children:J.manifest?.name||J.id}),e.jsxs("div",{className:"flex flex-col gap-1",children:[J.manifest?.categories&&J.manifest.categories[0]&&e.jsx(Ce,{variant:"secondary",className:"text-xs whitespace-nowrap",children:vC[J.manifest.categories[0]]||J.manifest.categories[0]}),G(J)]})]}),e.jsx(Ns,{className:"line-clamp-2",children:J.manifest?.description||"ๆ— ๆ่ฟฐ"})]}),e.jsx(ze,{className:"flex-1",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(na,{className:"h-4 w-4"}),e.jsx("span",{children:(X[J.id]?.downloads??J.downloads??0).toLocaleString()})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(vn,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),e.jsx("span",{children:(X[J.id]?.rating??J.rating??0).toFixed(1)})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[J.manifest?.keywords&&J.manifest.keywords.slice(0,3).map(Z=>e.jsx(Ce,{variant:"outline",className:"text-xs",children:Z},Z)),J.manifest?.keywords&&J.manifest.keywords.length>3&&e.jsxs(Ce,{variant:"outline",className:"text-xs",children:["+",J.manifest.keywords.length-3]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground pt-2 border-t space-y-1",children:[e.jsxs("div",{children:["v",J.manifest?.version||"unknown"," ยท ",J.manifest?.author?.name||"Unknown"]}),J.manifest?.host_application&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{children:"ๆ”ฏๆŒ:"}),e.jsxs("span",{className:"font-medium",children:[J.manifest.host_application.min_version,J.manifest.host_application.max_version?` - ${J.manifest.host_application.max_version}`:" - ๆœ€ๆ–ฐ็‰ˆๆœฌ"]})]})]})]})}),e.jsx(od,{className:"pt-4",children:e.jsxs("div",{className:"flex items-center justify-end gap-2 w-full",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>a({to:"/plugin-detail",search:{pluginId:J.id}}),children:"ๆŸฅ็œ‹่ฏฆๆƒ…"}),J.installed?A(J)?e.jsxs(_,{size:"sm",disabled:!S?.installed,title:S?.installed?void 0:"Git ๆœชๅฎ‰่ฃ…",onClick:()=>cs(J),children:[e.jsx(dt,{className:"h-4 w-4 mr-1"}),"ๆ›ดๆ–ฐ"]}):e.jsxs(_,{variant:"destructive",size:"sm",disabled:!S?.installed,title:S?.installed?void 0:"Git ๆœชๅฎ‰่ฃ…",onClick:()=>$e(J),children:[e.jsx(os,{className:"h-4 w-4 mr-1"}),"ๅธ่ฝฝ"]}):e.jsxs(_,{size:"sm",disabled:!S?.installed||E?.operation==="install"||R!==null&&!$(J),title:S?.installed?R!==null&&!$(J)?`ไธๅ…ผๅฎนๅฝ“ๅ‰็‰ˆๆœฌ (้œ€่ฆ ${J.manifest?.host_application?.min_version||"ๆœช็Ÿฅ"}${J.manifest?.host_application?.max_version?` - ${J.manifest.host_application.max_version}`:"+"}๏ผŒๅฝ“ๅ‰ ${R?.version})`:void 0:"Git ๆœชๅฎ‰่ฃ…",onClick:()=>Re(J),children:[e.jsx(na,{className:"h-4 w-4 mr-1"}),E?.operation==="install"&&E?.plugin_id===J.id?"ๅฎ‰่ฃ…ไธญ...":"ๅฎ‰่ฃ…"]})]})}),E&&(E.stage==="loading"||E.stage==="success"||E.stage==="error")&&E.operation!=="fetch"&&E.plugin_id===J.id&&e.jsx("div",{className:"px-6 pb-4 -mt-2",children:e.jsxs("div",{className:`space-y-2 p-3 rounded-lg border ${E.stage==="success"?"bg-green-50 dark:bg-green-950/20 border-green-200 dark:border-green-900":E.stage==="error"?"bg-red-50 dark:bg-red-950/20 border-red-200 dark:border-red-900":"bg-muted/50"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[E.stage==="loading"?e.jsx(Fs,{className:"h-3 w-3 animate-spin"}):E.stage==="success"?e.jsx(st,{className:"h-3 w-3 text-green-600"}):e.jsx(Ut,{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(tr,{value:E.progress,className:`h-1.5 ${E.stage==="success"?"[&>div]:bg-green-500":""}`}),e.jsx("div",{className:`text-xs ${E.stage==="success"?"text-green-600 dark:text-green-400 truncate":E.stage==="error"?"text-red-600 dark:text-red-400":"text-muted-foreground truncate"}`,children:E.stage==="error"?E.error||E.message||"ๆ“ไฝœๅคฑ่ดฅ":E.message})]})})]},J.id))}),e.jsx(Qs,{open:me,onOpenChange:Ne,children:e.jsxs(Hs,{children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"ๅฎ‰่ฃ…ๆ’ไปถ"}),e.jsxs(at,{children:["ๅฎ‰่ฃ… ",je?.manifest.name]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["็‰ˆๆœฌ: ",je?.manifest.version]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["ไฝœ่€…: ",typeof je?.manifest.author=="string"?je.manifest.author:je?.manifest.author?.name]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(tt,{id:"advanced-options",checked:Y,onCheckedChange:J=>we(J)}),e.jsx("label",{htmlFor:"advanced-options",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"้ซ˜็บง้€‰้กน"})]}),Y&&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(Jt,{value:B,onValueChange:J=>ue(J),children:[e.jsxs(Gt,{className:"grid w-full grid-cols-2",children:[e.jsx(Xe,{value:"preset",className:"text-xs",children:"้ข„่ฎพๅˆ†ๆ”ฏ"}),e.jsx(Xe,{value:"custom",className:"text-xs",children:"่‡ชๅฎšไน‰ๅˆ†ๆ”ฏ"})]}),B==="preset"&&e.jsx("div",{className:"mt-3",children:e.jsxs(Pe,{value:ge,onValueChange:pe,children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:"้€‰ๆ‹ฉๅˆ†ๆ”ฏ"})}),e.jsxs(Ie,{children:[e.jsx(W,{value:"main",children:"main (้ป˜่ฎค)"}),e.jsx(W,{value:"master",children:"master"}),e.jsx(W,{value:"dev",children:"dev (ๅผ€ๅ‘็‰ˆ)"}),e.jsx(W,{value:"develop",children:"develop"}),e.jsx(W,{value:"beta",children:"beta (ๆต‹่ฏ•็‰ˆ)"}),e.jsx(W,{value:"stable",children:"stable (็จณๅฎš็‰ˆ)"})]})]})}),B==="custom"&&e.jsxs("div",{className:"space-y-2 mt-3",children:[e.jsx("input",{type:"text",className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",placeholder:"่พ“ๅ…ฅๅˆ†ๆ”ฏๅ็งฐ๏ผŒไพ‹ๅฆ‚: feature/new-feature",value:D,onChange:J=>Q(J.target.value)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"่พ“ๅ…ฅ Git ๅˆ†ๆ”ฏๅ็งฐใ€ๆ ‡็ญพๆˆ–ๆไบคๅ“ˆๅธŒ"})]})]})]})}),!Y&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๅฐ†ไปŽ้ป˜่ฎคๅˆ†ๆ”ฏ (main) ๅฎ‰่ฃ…ๆ’ไปถ"})]}),e.jsxs(gt,{children:[e.jsx(_,{variant:"outline",onClick:()=>Ne(!1),children:"ๅ–ๆถˆ"}),e.jsxs(_,{onClick:se,children:[e.jsx(na,{className:"h-4 w-4 mr-2"}),"ๅฎ‰่ฃ…"]})]})]})}),e.jsx(nr,{})]})})}function yC(){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(fv,{className:"h-8 w-8",strokeWidth:2}),"ๆจกๅž‹ๅˆ†้…้ข„่ฎพๅธ‚ๅœบ"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"ๆต่งˆๅ’Œไธ‹่ฝฝ็คพๅŒบๅ…ฑไบซ็š„ๆจกๅž‹ๅˆ†้…้ข„่ฎพ้…็ฝฎ"})]})})}),e.jsx(ts,{className:"flex-1",children:e.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-12rem)]",children:e.jsxs(Te,{className:"max-w-2xl w-full border-dashed",children:[e.jsxs(Oe,{className:"text-center",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx(xa,{className:"h-16 w-16 text-muted-foreground"})}),e.jsx(Ue,{className:"text-2xl",children:"ๅŠŸ่ƒฝๅผ€ๅ‘ไธญ"}),e.jsx(Ns,{className:"text-base",children:"ๆจกๅž‹ๅˆ†้…้ข„่ฎพๅธ‚ๅœบๅŠŸ่ƒฝๆญฃๅœจๅผ€ๅ‘ไธญ๏ผŒๆ•ฌ่ฏทๆœŸๅพ…๏ผ"})]}),e.jsx(ze,{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 wC({field:a,value:l,onChange:r}){const[c,d]=u.useState(!1);switch(a.ui_type){case"switch":return e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:a.label}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]}),e.jsx(Ge,{checked:!!l,onCheckedChange:r,disabled:a.disabled})]});case"number":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:a.label}),e.jsx(ne,{type:"number",value:l??a.default,onChange:m=>r(parseFloat(m.target.value)||0),min:a.min,max:a.max,step:a.step??1,placeholder:a.placeholder,disabled:a.disabled}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]});case"slider":return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:a.label}),e.jsx("span",{className:"text-sm text-muted-foreground",children:l??a.default})]}),e.jsx(el,{value:[l??a.default],onValueChange:m=>r(m[0]),min:a.min??0,max:a.max??100,step:a.step??1,disabled:a.disabled}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]});case"select":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:a.label}),e.jsxs(Pe,{value:String(l??a.default),onValueChange:r,disabled:a.disabled,children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:a.placeholder??"่ฏท้€‰ๆ‹ฉ"})}),e.jsx(Ie,{children:a.choices?.map(m=>e.jsx(W,{value:String(m),children:String(m)},String(m)))})]}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]});case"textarea":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:a.label}),e.jsx(pt,{value:l??a.default,onChange:m=>r(m.target.value),placeholder:a.placeholder,rows:a.rows??3,disabled:a.disabled}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]});case"password":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:a.label}),e.jsxs("div",{className:"relative",children:[e.jsx(ne,{type:c?"text":"password",value:l??"",onChange:m=>r(m.target.value),placeholder:a.placeholder,disabled:a.disabled,className:"pr-10"}),e.jsx(_,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3",onClick:()=>d(!c),children:c?e.jsx(ic,{className:"h-4 w-4"}):e.jsx(ua,{className:"h-4 w-4"})})]}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]});case"list":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:a.label}),e.jsx(TS,{value:Array.isArray(l)?l:[],onChange:m=>r(m),itemType:a.item_type??"string",itemFields:a.item_fields,minItems:a.min_items,maxItems:a.max_items,disabled:a.disabled,placeholder:a.placeholder}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]});case"text":default:return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:a.label}),e.jsx(ne,{type:"text",value:l??a.default??"",onChange:m=>r(m.target.value),placeholder:a.placeholder,maxLength:a.max_length,disabled:a.disabled}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]})}}function lj({section:a,config:l,onChange:r}){const[c,d]=u.useState(!a.collapsed),m=Object.entries(a.fields).filter(([,h])=>!h.hidden).sort(([,h],[,f])=>h.order-f.order);return e.jsx(xc,{open:c,onOpenChange:d,children:e.jsxs(Te,{children:[e.jsx(hc,{asChild:!0,children:e.jsxs(Oe,{className:"cursor-pointer hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[c?e.jsx(Ba,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(ra,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(Ue,{className:"text-lg",children:a.title})]}),e.jsxs(Ce,{variant:"secondary",className:"text-xs",children:[m.length," ้กน"]})]}),a.description&&e.jsx(Ns,{className:"ml-6",children:a.description})]})}),e.jsx(fc,{children:e.jsx(ze,{className:"space-y-4 pt-0",children:m.map(([h,f])=>e.jsx(wC,{field:f,value:l[a.name]?.[h],onChange:p=>r(a.name,h,p),sectionName:a.name},h))})})]})})}function _C({plugin:a,onBack:l}){const{toast:r}=nt(),{triggerRestart:c,isRestarting:d}=Tn(),[m,h]=u.useState("visual"),[f,p]=u.useState(null),[g,N]=u.useState({}),[j,b]=u.useState({}),[y,w]=u.useState(""),[z,M]=u.useState(""),[S,F]=u.useState(!0),[E,C]=u.useState(!1),[R,H]=u.useState(!1),[O,X]=u.useState(!1),[L,me]=u.useState(!1),Ne=u.useCallback(async()=>{F(!0);try{const[B,ue,Y]=await Promise.all([cC(a.id),oC(a.id),dC(a.id)]);p(B),N(ue),b(JSON.parse(JSON.stringify(ue))),w(Y),M(Y)}catch(B){r({title:"ๅŠ ่ฝฝ้…็ฝฎๅคฑ่ดฅ",description:B instanceof Error?B.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}finally{F(!1)}},[a.id,r]);u.useEffect(()=>{Ne()},[Ne]),u.useEffect(()=>{H(m==="visual"?JSON.stringify(g)!==JSON.stringify(j):y!==z)},[g,j,y,z,m]);const je=(B,ue,Y)=>{N(we=>({...we,[B]:{...we[B]||{},[ue]:Y}}))},ce=async()=>{C(!0);try{if(m==="source"){try{_x(y)}catch(B){X(!0),r({title:"TOML ๆ ผๅผ้”™่ฏฏ",description:B instanceof Error?B.message:"ๆ— ๆณ•่งฃๆž TOML ้…็ฝฎ๏ผŒ่ฏทๆฃ€ๆŸฅ่ฏญๆณ•",variant:"destructive"}),C(!1);return}await mC(a.id,y),M(y),X(!1)}else await uC(a.id,g),b(JSON.parse(JSON.stringify(g)));r({title:"้…็ฝฎๅทฒไฟๅญ˜",description:"ๆ›ดๆ”นๅฐ†ๅœจๆ’ไปถ้‡ๆ–ฐๅŠ ่ฝฝๅŽ็”Ÿๆ•ˆ"})}catch(B){r({title:"ไฟๅญ˜ๅคฑ่ดฅ",description:B instanceof Error?B.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}finally{C(!1)}},ge=async()=>{try{await xC(a.id),r({title:"้…็ฝฎๅทฒ้‡็ฝฎ",description:"ไธ‹ๆฌกๅŠ ่ฝฝๆ’ไปถๆ—ถๅฐ†ไฝฟ็”จ้ป˜่ฎค้…็ฝฎ"}),me(!1),Ne()}catch(B){r({title:"้‡็ฝฎๅคฑ่ดฅ",description:B instanceof Error?B.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}},pe=async()=>{try{const B=await hC(a.id);r({title:B.message,description:B.note}),Ne()}catch(B){r({title:"ๅˆ‡ๆข็Šถๆ€ๅคฑ่ดฅ",description:B instanceof Error?B.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}};if(S)return e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx(Fs,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(!f)return e.jsxs("div",{className:"flex flex-col items-center justify-center h-64 space-y-4",children:[e.jsx(Ut,{className:"h-12 w-12 text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground",children:"ๆ— ๆณ•ๅŠ ่ฝฝ้…็ฝฎ"}),e.jsxs(_,{onClick:l,variant:"outline",children:[e.jsx($a,{className:"h-4 w-4 mr-2"}),"่ฟ”ๅ›ž"]})]});const D=Object.values(f.sections).sort((B,ue)=>B.order-ue.order),Q=g.plugin?.enabled!==!1;return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(_,{variant:"ghost",size:"icon",onClick:l,children:e.jsx($a,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:f.plugin_info.name||a.manifest.name}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx(Ce,{variant:Q?"default":"secondary",children:Q?"ๅทฒๅฏ็”จ":"ๅทฒ็ฆ็”จ"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["v",f.plugin_info.version||a.manifest.version]})]})]})]}),e.jsxs("div",{className:"flex gap-2 ml-10 sm:ml-0",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>h(m==="visual"?"source":"visual"),children:m==="visual"?e.jsxs(e.Fragment,{children:[e.jsx(dx,{className:"h-4 w-4 mr-2"}),"ๆบไปฃ็ "]}):e.jsxs(e.Fragment,{children:[e.jsx(uv,{className:"h-4 w-4 mr-2"}),"ๅฏ่ง†ๅŒ–"]})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>c(),disabled:d,children:[e.jsx(hv,{className:`h-4 w-4 mr-2 ${d?"animate-spin":""}`}),"้‡ๅฏ้บฆ้บฆ"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:pe,children:[e.jsx(pc,{className:"h-4 w-4 mr-2"}),Q?"็ฆ็”จ":"ๅฏ็”จ"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>me(!0),children:[e.jsx(rc,{className:"h-4 w-4 mr-2"}),"้‡็ฝฎ"]}),e.jsxs(_,{size:"sm",onClick:ce,disabled:!R||E,children:[E?e.jsx(Fs,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(gc,{className:"h-4 w-4 mr-2"}),"ไฟๅญ˜"]})]})]}),R&&e.jsx(Te,{className:"border-orange-200 bg-orange-50 dark:bg-orange-950/20 dark:border-orange-900",children:e.jsx(ze,{className:"py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Yt,{className:"h-4 w-4 text-orange-600"}),e.jsx("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:"ๆœ‰ๆœชไฟๅญ˜็š„ๆ›ดๆ”น"})]})})}),m==="source"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(ht,{children:[e.jsx(Ut,{className:"h-4 w-4"}),e.jsxs(ft,{children:[e.jsx("strong",{children:"ๆบไปฃ็ ๆจกๅผ๏ผˆ้ซ˜็บงๅŠŸ่ƒฝ๏ผ‰๏ผš"}),"็›ดๆŽฅ็ผ–่พ‘ TOML ้…็ฝฎๆ–‡ไปถใ€‚ไฟๅญ˜ๆ—ถไผš้ชŒ่ฏๆ ผๅผ๏ผŒๅชๆœ‰ๆ ผๅผๆญฃ็กฎๆ‰่ƒฝไฟๅญ˜ใ€‚",O&&e.jsx("span",{className:"text-destructive font-semibold ml-2",children:"โš ๏ธ ไธŠๆฌกไฟๅญ˜ๅคฑ่ดฅ๏ผŒ่ฏทๆฃ€ๆŸฅ TOML ๆ ผๅผ"})]})]}),e.jsx(Qv,{value:y,onChange:B=>{w(B),O&&X(!1)},language:"toml",theme:"dark",height:"calc(100vh - 350px)",minHeight:"500px",placeholder:"TOML ้…็ฝฎๅ†…ๅฎน"})]}),m==="visual"&&e.jsxs(e.Fragment,{children:[e.jsxs(ht,{children:[e.jsx(Yt,{className:"h-4 w-4"}),e.jsxs(ft,{children:[e.jsx("strong",{children:"ๆ็คบ๏ผš"}),"ๅฆ‚ๆžœๆ’ไปถๅฝ“ๅ‰ๆœชๅŠ ่ฝฝๆˆ–ๆœชๅฏ็”จ๏ผŒWebUI ้€‚้…ๅ™จ็š„้ซ˜็บงๆ’ไปถๅฏ่ง†ๅŒ–็ผ–่พ‘ๅŠŸ่ƒฝๅฏ่ƒฝไผšไธๅฏ็”จใ€‚ ่ฏท็กฎไฟๆ’ไปถๅทฒๅฏ็”จๅนถๆˆๅŠŸๅŠ ่ฝฝๅŽ๏ผŒๅ†่ฟ›่กŒ้…็ฝฎ็ผ–่พ‘ใ€‚"]})]}),f.layout.type==="tabs"&&f.layout.tabs.length>0?e.jsxs(Jt,{defaultValue:f.layout.tabs[0]?.id,children:[e.jsx(Gt,{children:f.layout.tabs.map(B=>e.jsxs(Xe,{value:B.id,children:[B.title,B.badge&&e.jsx(Ce,{variant:"secondary",className:"ml-2 text-xs",children:B.badge})]},B.id))}),f.layout.tabs.map(B=>e.jsx(Ss,{value:B.id,className:"space-y-4 mt-4",children:B.sections.map(ue=>{const Y=f.sections[ue];return Y?e.jsx(lj,{section:Y,config:g,onChange:je},ue):null})},B.id))]}):e.jsx("div",{className:"space-y-4",children:D.map(B=>e.jsx(lj,{section:B,config:g,onChange:je},B.name))})]}),e.jsx(Qs,{open:L,onOpenChange:me,children:e.jsxs(Hs,{children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"็กฎ่ฎค้‡็ฝฎ้…็ฝฎ"}),e.jsx(at,{children:"่ฟ™ๅฐ†ๅˆ ้™คๅฝ“ๅ‰้…็ฝฎๆ–‡ไปถ๏ผŒไธ‹ๆฌกๅŠ ่ฝฝๆ’ไปถๆ—ถๅฐ†ไฝฟ็”จ้ป˜่ฎค้…็ฝฎใ€‚ๆญคๆ“ไฝœไธๅฏๆ’ค้”€ใ€‚"})]}),e.jsxs(gt,{children:[e.jsx(_,{variant:"outline",onClick:()=>me(!1),children:"ๅ–ๆถˆ"}),e.jsx(_,{variant:"destructive",onClick:ge,children:"็กฎ่ฎค้‡็ฝฎ"})]})]})})]})}function SC(){return e.jsx(lr,{children:e.jsx(kC,{})})}function kC(){const{toast:a}=nt(),[l,r]=u.useState([]),[c,d]=u.useState(!0),[m,h]=u.useState(""),[f,p]=u.useState(null),g=async()=>{d(!0);try{const w=await Il();r(w)}catch(w){a({title:"ๅŠ ่ฝฝๆ’ไปถๅˆ—่กจๅคฑ่ดฅ",description:w instanceof Error?w.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}finally{d(!1)}};u.useEffect(()=>{g()},[]);const j=l.filter(w=>{const z=m.toLowerCase();return w.id.toLowerCase().includes(z)||w.manifest.name.toLowerCase().includes(z)||w.manifest.description?.toLowerCase().includes(z)}).filter((w,z,M)=>z===M.findIndex(S=>S.id===w.id)),b=l.length,y=0;return f?e.jsxs(e.Fragment,{children:[e.jsx(ts,{className:"h-full",children:e.jsx("div",{className:"p-4 sm:p-6",children:e.jsx(_C,{plugin:f,onBack:()=>p(null)})})}),e.jsx(nr,{})]}):e.jsx(ts,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"ๆ’ไปถ้…็ฝฎ"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"็ฎก็†ๅ’Œ้…็ฝฎๅทฒๅฎ‰่ฃ…็š„ๆ’ไปถ"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:g,children:[e.jsx(dt,{className:`h-4 w-4 mr-2 ${c?"animate-spin":""}`}),"ๅˆทๆ–ฐ"]})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-3",children:[e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"ๅทฒๅฎ‰่ฃ…ๆ’ไปถ"}),e.jsx(xa,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(ze,{children:[e.jsx("div",{className:"text-2xl font-bold",children:l.length}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:c?"ๆญฃๅœจๅŠ ่ฝฝ...":"ไธชๆ’ไปถ"})]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"ๅทฒๅฏ็”จ"}),e.jsx(st,{className:"h-4 w-4 text-green-600"})]}),e.jsxs(ze,{children:[e.jsx("div",{className:"text-2xl font-bold",children:b}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"่ฟ่กŒไธญ็š„ๆ’ไปถ"})]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"ๅทฒ็ฆ็”จ"}),e.jsx(Ut,{className:"h-4 w-4 text-orange-600"})]}),e.jsxs(ze,{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("div",{className:"relative",children:[e.jsx($t,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ne,{placeholder:"ๆœ็ดขๆ’ไปถ...",value:m,onChange:w=>h(w.target.value),className:"pl-9"})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"ๅทฒๅฎ‰่ฃ…็š„ๆ’ไปถ"}),e.jsx(Ns,{children:"็‚นๅ‡ปๆ’ไปถๆŸฅ็œ‹ๅ’Œ็ผ–่พ‘้…็ฝฎ"})]}),e.jsx(ze,{children:c?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(Fs,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):j.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-4",children:[e.jsx(xa,{className:"h-16 w-16 text-muted-foreground/50"}),e.jsxs("div",{className:"text-center space-y-2",children:[e.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:m?"ๆฒกๆœ‰ๆ‰พๅˆฐๅŒน้…็š„ๆ’ไปถ":"ๆš‚ๆ— ๅทฒๅฎ‰่ฃ…็š„ๆ’ไปถ"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:m?"ๅฐ่ฏ•ๅ…ถไป–ๆœ็ดขๅ…ณ้”ฎ่ฏ":"ๅ‰ๅพ€ๆ’ไปถๅธ‚ๅœบๅฎ‰่ฃ…ๆ’ไปถ"})]})]}):e.jsx("div",{className:"space-y-2",children:j.map(w=>e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg border hover:bg-muted/50 cursor-pointer transition-colors",onClick:()=>p(w),children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"h-10 w-10 rounded-lg bg-primary/10 flex items-center justify-center flex-shrink-0",children:e.jsx(xa,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"font-medium truncate",children:w.manifest.name}),e.jsxs(Ce,{variant:"secondary",className:"text-xs flex-shrink-0",children:["v",w.manifest.version]})]}),e.jsx("p",{className:"text-sm text-muted-foreground truncate",children:w.manifest.description||"ๆš‚ๆ— ๆ่ฟฐ"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(_,{variant:"ghost",size:"sm",children:e.jsx(Sn,{className:"h-4 w-4"})}),e.jsx(ra,{className:"h-4 w-4 text-muted-foreground"})]})]},w.id))})})]})]})})}function CC(){const a=ha(),{toast:l}=nt(),[r,c]=u.useState([]),[d,m]=u.useState(!0),[h,f]=u.useState(null),[p,g]=u.useState(null),[N,j]=u.useState(!1),[b,y]=u.useState(!1),[w,z]=u.useState({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),M=u.useCallback(async()=>{try{m(!0),f(null);const O=await ke("/api/webui/plugins/mirrors");if(!O.ok)throw new Error("่Žทๅ–้•œๅƒๆบๅˆ—่กจๅคฑ่ดฅ");const X=await O.json();c(X.mirrors||[])}catch(O){const X=O instanceof Error?O.message:"ๅŠ ่ฝฝ้•œๅƒๆบๅคฑ่ดฅ";f(X),l({title:"ๅŠ ่ฝฝๅคฑ่ดฅ",description:X,variant:"destructive"})}finally{m(!1)}},[l]);u.useEffect(()=>{M()},[M]);const S=async()=>{try{const O=await ke("/api/webui/plugins/mirrors",{method:"POST",body:JSON.stringify(w)});if(!O.ok){const X=await O.json();throw new Error(X.detail||"ๆทปๅŠ ้•œๅƒๆบๅคฑ่ดฅ")}l({title:"ๆทปๅŠ ๆˆๅŠŸ",description:"้•œๅƒๆบๅทฒๆทปๅŠ "}),j(!1),z({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),M()}catch(O){l({title:"ๆทปๅŠ ๅคฑ่ดฅ",description:O instanceof Error?O.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}},F=async()=>{if(p)try{if(!(await ke(`/api/webui/plugins/mirrors/${p.id}`,{method:"PUT",body:JSON.stringify({name:w.name,raw_prefix:w.raw_prefix,clone_prefix:w.clone_prefix,enabled:w.enabled,priority:w.priority})})).ok)throw new Error("ๆ›ดๆ–ฐ้•œๅƒๆบๅคฑ่ดฅ");l({title:"ๆ›ดๆ–ฐๆˆๅŠŸ",description:"้•œๅƒๆบๅทฒๆ›ดๆ–ฐ"}),y(!1),g(null),M()}catch(O){l({title:"ๆ›ดๆ–ฐๅคฑ่ดฅ",description:O instanceof Error?O.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}},E=async O=>{if(confirm("็กฎๅฎš่ฆๅˆ ้™ค่ฟ™ไธช้•œๅƒๆบๅ—๏ผŸ"))try{if(!(await ke(`/api/webui/plugins/mirrors/${O}`,{method:"DELETE"})).ok)throw new Error("ๅˆ ้™ค้•œๅƒๆบๅคฑ่ดฅ");l({title:"ๅˆ ้™คๆˆๅŠŸ",description:"้•œๅƒๆบๅทฒๅˆ ้™ค"}),M()}catch(X){l({title:"ๅˆ ้™คๅคฑ่ดฅ",description:X instanceof Error?X.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}},C=async O=>{try{if(!(await ke(`/api/webui/plugins/mirrors/${O.id}`,{method:"PUT",body:JSON.stringify({enabled:!O.enabled})})).ok)throw new Error("ๆ›ดๆ–ฐ็Šถๆ€ๅคฑ่ดฅ");M()}catch(X){l({title:"ๆ›ดๆ–ฐๅคฑ่ดฅ",description:X instanceof Error?X.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}},R=O=>{g(O),z({id:O.id,name:O.name,raw_prefix:O.raw_prefix,clone_prefix:O.clone_prefix,enabled:O.enabled,priority:O.priority}),y(!0)},H=async(O,X)=>{const L=X==="up"?O.priority-1:O.priority+1;if(!(L<1))try{if(!(await ke(`/api/webui/plugins/mirrors/${O.id}`,{method:"PUT",body:JSON.stringify({priority:L})})).ok)throw new Error("ๆ›ดๆ–ฐไผ˜ๅ…ˆ็บงๅคฑ่ดฅ");M()}catch(me){l({title:"ๆ›ดๆ–ฐๅคฑ่ดฅ",description:me instanceof Error?me.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}};return e.jsx(ts,{className:"h-full",children:e.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>a({to:"/plugins"}),children:e.jsx($a,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"้•œๅƒๆบ้…็ฝฎ"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"็ฎก็† Git ๅ…‹้š†ๅ’Œๆ–‡ไปถไธ‹่ฝฝ็š„้•œๅƒๆบ"})]})]}),e.jsxs(_,{onClick:()=>j(!0),children:[e.jsx(Xs,{className:"h-4 w-4 mr-2"}),"ๆทปๅŠ ้•œๅƒๆบ"]})]}),d?e.jsx(Te,{className:"p-6",children:e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Fs,{className:"h-8 w-8 animate-spin text-primary"})})}):h?e.jsx(Te,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Lt,{className:"h-12 w-12 text-destructive mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"ๅŠ ่ฝฝๅคฑ่ดฅ"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:h}),e.jsx(_,{onClick:M,children:"้‡ๆ–ฐๅŠ ่ฝฝ"})]})}):e.jsxs(Te,{children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs(ql,{children:[e.jsx(Vl,{children:e.jsxs(_t,{children:[e.jsx(ns,{children:"็Šถๆ€"}),e.jsx(ns,{children:"ๅ็งฐ"}),e.jsx(ns,{children:"ID"}),e.jsx(ns,{children:"ไผ˜ๅ…ˆ็บง"}),e.jsx(ns,{className:"text-right",children:"ๆ“ไฝœ"})]})}),e.jsx(Gl,{children:r.map(O=>e.jsxs(_t,{children:[e.jsx(Ze,{children:e.jsx(Ge,{checked:O.enabled,onCheckedChange:()=>C(O)})}),e.jsx(Ze,{children:e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:O.name}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Raw: ",O.raw_prefix]})]})}),e.jsx(Ze,{children:e.jsx(Ce,{variant:"outline",children:O.id})}),e.jsx(Ze,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-mono",children:O.priority}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(_,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>H(O,"up"),disabled:O.priority===1,children:e.jsx(Xr,{className:"h-3 w-3"})}),e.jsx(_,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>H(O,"down"),children:e.jsx(Ba,{className:"h-3 w-3"})})]})]})}),e.jsx(Ze,{className:"text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>R(O),children:e.jsx(Zn,{className:"h-4 w-4"})}),e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>E(O.id),children:e.jsx(os,{className:"h-4 w-4 text-destructive"})})]})})]},O.id))})]})}),e.jsx("div",{className:"md:hidden p-4 space-y-4",children:r.map(O=>e.jsx(Te,{className:"p-4",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"font-semibold",children:O.name}),O.enabled&&e.jsx(Ce,{variant:"default",className:"text-xs",children:"ๅฏ็”จ"})]}),e.jsx(Ce,{variant:"outline",className:"mt-1 text-xs",children:O.id})]}),e.jsx(Ge,{checked:O.enabled,onCheckedChange:()=>C(O)})]}),e.jsxs("div",{className:"text-sm space-y-1",children:[e.jsxs("div",{className:"text-muted-foreground",children:[e.jsx("span",{className:"font-medium",children:"Raw: "}),e.jsx("span",{className:"break-all",children:O.raw_prefix})]}),e.jsxs("div",{className:"text-muted-foreground",children:[e.jsx("span",{className:"font-medium",children:"ไผ˜ๅ…ˆ็บง: "}),e.jsx("span",{className:"font-mono",children:O.priority})]})]}),e.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t",children:[e.jsxs(_,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>R(O),children:[e.jsx(Zn,{className:"h-4 w-4 mr-1"}),"็ผ–่พ‘"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>H(O,"up"),disabled:O.priority===1,children:e.jsx(Xr,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>H(O,"down"),children:e.jsx(Ba,{className:"h-4 w-4"})}),e.jsx(_,{variant:"destructive",size:"sm",onClick:()=>E(O.id),children:e.jsx(os,{className:"h-4 w-4"})})]})]})},O.id))})]}),e.jsx(Qs,{open:N,onOpenChange:j,children:e.jsxs(Hs,{className:"max-w-lg",children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"ๆทปๅŠ ้•œๅƒๆบ"}),e.jsx(at,{children:"ๆทปๅŠ ๆ–ฐ็š„ Git ้•œๅƒๆบ้…็ฝฎ"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"add-id",children:"้•œๅƒๆบ ID *"}),e.jsx(ne,{id:"add-id",placeholder:"ไพ‹ๅฆ‚: my-mirror",value:w.id,onChange:O=>z({...w,id:O.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"add-name",children:"ๅ็งฐ *"}),e.jsx(ne,{id:"add-name",placeholder:"ไพ‹ๅฆ‚: ๆˆ‘็š„้•œๅƒๆบ",value:w.name,onChange:O=>z({...w,name:O.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"add-raw",children:"Raw ๆ–‡ไปถๅ‰็ผ€ *"}),e.jsx(ne,{id:"add-raw",placeholder:"https://example.com/raw",value:w.raw_prefix,onChange:O=>z({...w,raw_prefix:O.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"add-clone",children:"ๅ…‹้š†ๅ‰็ผ€ *"}),e.jsx(ne,{id:"add-clone",placeholder:"https://example.com/clone",value:w.clone_prefix,onChange:O=>z({...w,clone_prefix:O.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"add-priority",children:"ไผ˜ๅ…ˆ็บง"}),e.jsx(ne,{id:"add-priority",type:"number",min:"1",value:w.priority,onChange:O=>z({...w,priority:parseInt(O.target.value)||1})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆ•ฐๅญ—่ถŠๅฐไผ˜ๅ…ˆ็บง่ถŠ้ซ˜"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"add-enabled",checked:w.enabled,onCheckedChange:O=>z({...w,enabled:O})}),e.jsx(T,{htmlFor:"add-enabled",children:"ๅฏ็”จๆญค้•œๅƒๆบ"})]})]}),e.jsxs(gt,{children:[e.jsx(_,{variant:"outline",onClick:()=>j(!1),children:"ๅ–ๆถˆ"}),e.jsx(_,{onClick:S,children:"ๆทปๅŠ "})]})]})}),e.jsx(Qs,{open:b,onOpenChange:y,children:e.jsxs(Hs,{className:"max-w-lg",children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"็ผ–่พ‘้•œๅƒๆบ"}),e.jsx(at,{children:"ไฟฎๆ”น้•œๅƒๆบ้…็ฝฎ"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"้•œๅƒๆบ ID"}),e.jsx(ne,{value:w.id,disabled:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit-name",children:"ๅ็งฐ *"}),e.jsx(ne,{id:"edit-name",value:w.name,onChange:O=>z({...w,name:O.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit-raw",children:"Raw ๆ–‡ไปถๅ‰็ผ€ *"}),e.jsx(ne,{id:"edit-raw",value:w.raw_prefix,onChange:O=>z({...w,raw_prefix:O.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit-clone",children:"ๅ…‹้š†ๅ‰็ผ€ *"}),e.jsx(ne,{id:"edit-clone",value:w.clone_prefix,onChange:O=>z({...w,clone_prefix:O.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit-priority",children:"ไผ˜ๅ…ˆ็บง"}),e.jsx(ne,{id:"edit-priority",type:"number",min:"1",value:w.priority,onChange:O=>z({...w,priority:parseInt(O.target.value)||1})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆ•ฐๅญ—่ถŠๅฐไผ˜ๅ…ˆ็บง่ถŠ้ซ˜"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ge,{id:"edit-enabled",checked:w.enabled,onCheckedChange:O=>z({...w,enabled:O})}),e.jsx(T,{htmlFor:"edit-enabled",children:"ๅฏ็”จๆญค้•œๅƒๆบ"})]})]}),e.jsxs(gt,{children:[e.jsx(_,{variant:"outline",onClick:()=>y(!1),children:"ๅ–ๆถˆ"}),e.jsx(_,{onClick:F,children:"ไฟๅญ˜"})]})]})})]})})}function TC({pluginId:a,compact:l=!1}){const[r,c]=u.useState(null),[d,m]=u.useState(!0),[h,f]=u.useState(0),[p,g]=u.useState(""),[N,j]=u.useState(!1),{toast:b}=nt(),y=async()=>{m(!0);const S=await bN(a);S&&c(S),m(!1)};u.useEffect(()=>{y()},[a]);const w=async()=>{const S=await fC(a);S.success?(b({title:"ๅทฒ็‚น่ตž",description:"ๆ„Ÿ่ฐขไฝ ็š„ๆ”ฏๆŒ๏ผ"}),y()):b({title:"็‚น่ตžๅคฑ่ดฅ",description:S.error||"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})},z=async()=>{const S=await pC(a);S.success?(b({title:"ๅทฒๅ้ฆˆ",description:"ๆ„Ÿ่ฐขไฝ ็š„ๅ้ฆˆ๏ผ"}),y()):b({title:"ๆ“ไฝœๅคฑ่ดฅ",description:S.error||"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})},M=async()=>{if(h===0){b({title:"่ฏท้€‰ๆ‹ฉ่ฏ„ๅˆ†",description:"่‡ณๅฐ‘้€‰ๆ‹ฉ 1 ้ข—ๆ˜Ÿ",variant:"destructive"});return}const S=await gC(a,h,p||void 0);S.success?(b({title:"่ฏ„ๅˆ†ๆˆๅŠŸ",description:"ๆ„Ÿ่ฐขไฝ ็š„่ฏ„ไปท๏ผ"}),j(!1),f(0),g(""),y()):b({title:"่ฏ„ๅˆ†ๅคฑ่ดฅ",description:S.error||"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})};return d?e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(na,{className:"h-4 w-4"}),e.jsx("span",{children:"-"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(vn,{className:"h-4 w-4"}),e.jsx("span",{children:"-"})]})]}):r?l?e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",title:`ไธ‹่ฝฝ้‡: ${r.downloads.toLocaleString()}`,children:[e.jsx(na,{className:"h-4 w-4"}),e.jsx("span",{children:r.downloads.toLocaleString()})]}),e.jsxs("div",{className:"flex items-center gap-1",title:`่ฏ„ๅˆ†: ${r.rating.toFixed(1)} (${r.rating_count} ๆก่ฏ„ไปท)`,children:[e.jsx(vn,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),e.jsx("span",{children:r.rating.toFixed(1)})]}),e.jsxs("div",{className:"flex items-center gap-1",title:`็‚น่ตžๆ•ฐ: ${r.likes}`,children:[e.jsx(Mm,{className:"h-4 w-4"}),e.jsx("span",{children:r.likes})]})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(na,{className:"h-5 w-5 text-muted-foreground mb-1"}),e.jsx("span",{className:"text-2xl font-bold",children:r.downloads.toLocaleString()}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"ไธ‹่ฝฝ้‡"})]}),e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(vn,{className:"h-5 w-5 text-yellow-400 mb-1 fill-yellow-400"}),e.jsx("span",{className:"text-2xl font-bold",children:r.rating.toFixed(1)}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[r.rating_count," ๆก่ฏ„ไปท"]})]}),e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(Mm,{className:"h-5 w-5 text-green-500 mb-1"}),e.jsx("span",{className:"text-2xl font-bold",children:r.likes}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"็‚น่ตž"})]}),e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(Ag,{className:"h-5 w-5 text-red-500 mb-1"}),e.jsx("span",{className:"text-2xl font-bold",children:r.dislikes}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"็‚น่ธฉ"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:w,children:[e.jsx(Mm,{className:"h-4 w-4 mr-1"}),"็‚น่ตž"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:z,children:[e.jsx(Ag,{className:"h-4 w-4 mr-1"}),"็‚น่ธฉ"]}),e.jsxs(Qs,{open:N,onOpenChange:j,children:[e.jsx(dd,{asChild:!0,children:e.jsxs(_,{variant:"default",size:"sm",children:[e.jsx(vn,{className:"h-4 w-4 mr-1"}),"่ฏ„ๅˆ†"]})}),e.jsxs(Hs,{children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"ไธบๆ’ไปถ่ฏ„ๅˆ†"}),e.jsx(at,{children:"ๅˆ†ไบซไฝ ็š„ไฝฟ็”จไฝ“้ชŒ๏ผŒๅธฎๅŠฉๅ…ถไป–็”จๆˆท"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx("div",{className:"flex gap-2",children:[1,2,3,4,5].map(S=>e.jsx("button",{onClick:()=>f(S),className:"focus:outline-none",children:e.jsx(vn,{className:`h-8 w-8 transition-colors ${S<=h?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-300"}`})},S))}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[h===0&&"็‚นๅ‡ปๆ˜Ÿๆ˜Ÿ่ฟ›่กŒ่ฏ„ๅˆ†",h===1&&"ๅพˆๅทฎ",h===2&&"ไธ€่ˆฌ",h===3&&"่ฟ˜่กŒ",h===4&&"ไธ้”™",h===5&&"้žๅธธๅฅฝ"]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium mb-2 block",children:"่ฏ„่ฎบ๏ผˆๅฏ้€‰๏ผ‰"}),e.jsx(pt,{value:p,onChange:S=>g(S.target.value),placeholder:"ๅˆ†ไบซไฝ ็š„ไฝฟ็”จไฝ“้ชŒ...",rows:4,maxLength:500}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1 text-right",children:[p.length," / 500"]})]})]}),e.jsxs(gt,{children:[e.jsx(_,{variant:"outline",onClick:()=>j(!1),children:"ๅ–ๆถˆ"}),e.jsx(_,{onClick:M,disabled:h===0,children:"ๆไบค่ฏ„ๅˆ†"})]})]})]})]}),r.recent_ratings&&r.recent_ratings.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"text-sm font-semibold",children:"ๆœ€่ฟ‘่ฏ„ไปท"}),e.jsx("div",{className:"space-y-3",children:r.recent_ratings.map((S,F)=>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(vn,{className:`h-3 w-3 ${E<=S.rating?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},E))}),e.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(S.created_at).toLocaleDateString()})]}),S.comment&&e.jsx("p",{className:"text-sm text-muted-foreground",children:S.comment})]},F))})]})]}):null}const EC={"Group Management":"็พค็ป„็ฎก็†","Entertainment & Interaction":"ๅจฑไนไบ’ๅŠจ","Utility Tools":"ๅฎž็”จๅทฅๅ…ท","Content Generation":"ๅ†…ๅฎน็”Ÿๆˆ",Multimedia:"ๅคšๅช’ไฝ“","External Integration":"ๅค–้ƒจ้›†ๆˆ","Data Analysis & Insights":"ๆ•ฐๆฎๅˆ†ๆžไธŽๆดžๅฏŸ",Other:"ๅ…ถไป–"};function MC(){const a=ha(),l=lw({strict:!1}),{toast:r}=nt(),[c,d]=u.useState(null),[m,h]=u.useState(""),[f,p]=u.useState(!0),[g,N]=u.useState(!0),[j,b]=u.useState(null),[y,w]=u.useState(null),[z,M]=u.useState(null),[S,F]=u.useState(!1),[E,C]=u.useState(),[R,H]=u.useState(!1);u.useEffect(()=>{(async()=>{if(!l.pluginId){b("็ผบๅฐ‘ๆ’ไปถ ID"),p(!1);return}try{p(!0),b(null);const ge=await ke("/api/webui/plugins/fetch-raw",{method:"POST",body:JSON.stringify({owner:"Mai-with-u",repo:"plugin-repo",branch:"main",file_path:"plugin_details.json"})});if(!ge.ok)throw new Error("่Žทๅ–ๆ’ไปถๅˆ—่กจๅคฑ่ดฅ");const pe=await ge.json();if(!pe.success||!pe.data)throw new Error(pe.error||"่Žทๅ–ๆ’ไปถๅˆ—่กจๅคฑ่ดฅ");const Q=JSON.parse(pe.data).find(fe=>fe.id===l.pluginId);if(!Q)throw new Error("ๆœชๆ‰พๅˆฐ่ฏฅๆ’ไปถ");const B={id:Q.id,manifest:Q.manifest,downloads:0,rating:0,review_count:0,installed:!1,published_at:new Date().toISOString(),updated_at:new Date().toISOString()};d(B);const[ue,Y,we]=await Promise.all([fN(),pN(),Il()]);w(ue),M(Y),F(bn(l.pluginId,we)),C(yn(l.pluginId,we))}catch(ge){b(ge instanceof Error?ge.message:"ๅŠ ่ฝฝๅคฑ่ดฅ")}finally{p(!1)}})()},[l.pluginId]),u.useEffect(()=>{(async()=>{if(!c?.manifest?.repository_url){N(!1);return}try{if(N(!0),S&&l.pluginId)try{const Y=await ke(`/api/webui/plugins/local-readme/${l.pluginId}`);if(Y.ok){const we=await Y.json();if(we.success&&we.data){h(we.data),N(!1);return}}}catch(Y){console.log("ๆœฌๅœฐ README ่Žทๅ–ๅคฑ่ดฅ๏ผŒๅฐ่ฏ•่ฟœ็จ‹่Žทๅ–:",Y)}const ge=c.manifest.repository_url.match(/github\.com\/([^/]+)\/([^/\s]+)/);if(!ge){h("ๆ— ๆณ•่งฃๆžไป“ๅบ“ๅœฐๅ€");return}const[,pe,D]=ge,Q=D.replace(/\.git$/,""),B=await ke("/api/webui/plugins/fetch-raw",{method:"POST",body:JSON.stringify({owner:pe,repo:Q,branch:"main",file_path:"README.md"})});if(!B.ok)throw new Error("่Žทๅ– README ๅคฑ่ดฅ");const ue=await B.json();ue.success&&ue.data?h(ue.data):h("่ฏฅๆ’ไปถๆš‚ๆ—  README ๆ–‡ๆกฃ")}catch(ge){console.error("ๅŠ ่ฝฝ README ๅคฑ่ดฅ:",ge),h("ๅŠ ่ฝฝ README ๅคฑ่ดฅ")}finally{N(!1)}})()},[c,S,l.pluginId]);const O=()=>!c||!S||!E?!1:E!==c.manifest.version,X=()=>!c||!z?!0:gN(c.manifest.host_application.min_version,c.manifest.host_application.max_version,z),L=async()=>{if(!(!c||!y?.installed))try{H(!0),await jN(c.id,c.manifest.repository_url||"","main"),yN(c.id).catch(ge=>{console.warn("Failed to record download:",ge)}),r({title:"ๅฎ‰่ฃ…ๆˆๅŠŸ",description:`${c.manifest.name} ๅทฒๆˆๅŠŸๅฎ‰่ฃ…`});const ce=await Il();F(bn(c.id,ce)),C(yn(c.id,ce))}catch(ce){r({title:"ๅฎ‰่ฃ…ๅคฑ่ดฅ",description:ce instanceof Error?ce.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}finally{H(!1)}},me=async()=>{if(c)try{H(!0),await vN(c.id),r({title:"ๅธ่ฝฝๆˆๅŠŸ",description:`${c.manifest.name} ๅทฒๆˆๅŠŸๅธ่ฝฝ`});const ce=await Il();F(bn(c.id,ce)),C(yn(c.id,ce))}catch(ce){r({title:"ๅธ่ฝฝๅคฑ่ดฅ",description:ce instanceof Error?ce.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}finally{H(!1)}},Ne=async()=>{if(!(!c||!y?.installed))try{H(!0);const ce=await NN(c.id,c.manifest.repository_url||"","main");r({title:"ๆ›ดๆ–ฐๆˆๅŠŸ",description:`${c.manifest.name} ๅทฒไปŽ ${ce.old_version} ๆ›ดๆ–ฐๅˆฐ ${ce.new_version}`});const ge=await Il();F(bn(c.id,ge)),C(yn(c.id,ge))}catch(ce){r({title:"ๆ›ดๆ–ฐๅคฑ่ดฅ",description:ce instanceof Error?ce.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}finally{H(!1)}};if(f)return e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>a({to:"/plugins"}),children:e.jsx($a,{className:"h-5 w-5"})}),e.jsx("div",{children:e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"ๆ’ไปถ่ฏฆๆƒ…"})})]}),e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(Fs,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-muted-foreground",children:"ๅŠ ่ฝฝๆ’ไปถไฟกๆฏไธญ..."})]})]});if(j||!c)return e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>a({to:"/plugins"}),children:e.jsx($a,{className:"h-5 w-5"})}),e.jsx("div",{children:e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"ๆ’ไปถ่ฏฆๆƒ…"})})]}),e.jsx(Te,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Ut,{className:"h-12 w-12 text-destructive mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"ๅŠ ่ฝฝๅคฑ่ดฅ"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:j}),e.jsx(_,{onClick:()=>a({to:"/plugins"}),children:"่ฟ”ๅ›žๆ’ไปถๅˆ—่กจ"})]})})]});const je=X();return e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>a({to:"/plugins"}),className:"shrink-0",children:e.jsx($a,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"ๆ’ไปถ่ฏฆๆƒ…"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:c.manifest.name})]})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:S?e.jsxs(e.Fragment,{children:[O()?e.jsx(_,{disabled:!y?.installed||R,onClick:Ne,title:y?.installed?void 0:"Git ๆœชๅฎ‰่ฃ…",children:R?e.jsxs(e.Fragment,{children:[e.jsx(Fs,{className:"h-4 w-4 mr-2 animate-spin"}),"ๆ›ดๆ–ฐไธญ..."]}):e.jsxs(e.Fragment,{children:[e.jsx(dt,{className:"h-4 w-4 mr-2"}),"ๆ›ดๆ–ฐ"]})}):null,e.jsx(_,{variant:"destructive",disabled:!y?.installed||R,onClick:me,title:y?.installed?void 0:"Git ๆœชๅฎ‰่ฃ…",children:R?e.jsxs(e.Fragment,{children:[e.jsx(Fs,{className:"h-4 w-4 mr-2 animate-spin"}),"ๅธ่ฝฝไธญ..."]}):e.jsxs(e.Fragment,{children:[e.jsx(os,{className:"h-4 w-4 mr-2"}),"ๅธ่ฝฝ"]})})]}):e.jsx(_,{disabled:!y?.installed||!je||R,onClick:L,title:y?.installed?je?void 0:`ไธๅ…ผๅฎนๅฝ“ๅ‰็‰ˆๆœฌ (้œ€่ฆ ${c.manifest.host_application.min_version}${c.manifest.host_application.max_version?` - ${c.manifest.host_application.max_version}`:"+"}๏ผŒๅฝ“ๅ‰ ${z?.version})`:"Git ๆœชๅฎ‰่ฃ…",children:R?e.jsxs(e.Fragment,{children:[e.jsx(Fs,{className:"h-4 w-4 mr-2 animate-spin"}),"ๅฎ‰่ฃ…ไธญ..."]}):e.jsxs(e.Fragment,{children:[e.jsx(na,{className:"h-4 w-4 mr-2"}),"ๅฎ‰่ฃ…"]})})})]}),e.jsx(ts,{className:"h-[calc(100vh-200px)] sm:h-[calc(100vh-220px)]",children:e.jsxs("div",{className:"space-y-6 pr-4",children:[e.jsx(Te,{children:e.jsx(Oe,{children:e.jsx("div",{className:"flex items-start justify-between gap-4",children:e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsx(Ue,{className:"text-2xl",children:c.manifest.name}),e.jsxs(Ce,{variant:"secondary",className:"text-sm",children:["v",c.manifest.version]}),S&&e.jsxs(Ce,{variant:"default",className:"text-sm",children:[e.jsx(st,{className:"h-3 w-3 mr-1"}),"ๅทฒๅฎ‰่ฃ… ",E&&`(v${E})`]}),O()&&e.jsxs(Ce,{variant:"outline",className:"text-sm border-orange-500 text-orange-500",children:[e.jsx(dt,{className:"h-3 w-3 mr-1"}),"ๅฏๆ›ดๆ–ฐ"]}),!je&&e.jsxs(Ce,{variant:"destructive",className:"text-sm",children:[e.jsx(Ut,{className:"h-3 w-3 mr-1"}),"ไธๅ…ผๅฎน"]})]}),e.jsx(Ns,{className:"text-base",children:c.manifest.description})]})})})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-1 space-y-6",children:[e.jsxs(Te,{children:[e.jsx(Oe,{children:e.jsx(Ue,{className:"text-lg",children:"็ปŸ่ฎกไฟกๆฏ"})}),e.jsx(ze,{children:e.jsx(TC,{pluginId:c.id})})]}),e.jsxs(Te,{children:[e.jsx(Oe,{children:e.jsx(Ue,{className:"text-lg",children:"ๅŸบๆœฌไฟกๆฏ"})}),e.jsx(ze,{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(Fl,{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(Io,{className:"h-3 w-3"})})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(xa,{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(ov,{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(Go,{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(Io,{className:"h-3 w-3"})]})]}),c.manifest.repository_url&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Q1,{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(Io,{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(Yt,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"ๆ”ฏๆŒ็‰ˆๆœฌ:"})]}),e.jsxs("div",{className:"text-sm pl-6 font-medium",children:[c.manifest.host_application.min_version,c.manifest.host_application.max_version?` - ${c.manifest.host_application.max_version}`:" - ๆœ€ๆ–ฐ็‰ˆๆœฌ"]})]})]})})]}),(c.manifest.categories||c.manifest.keywords)&&e.jsxs(Te,{children:[e.jsx(Oe,{children:e.jsx(Ue,{className:"text-lg",children:"ๅˆ†็ฑปไธŽๆ ‡็ญพ"})}),e.jsxs(ze,{className:"space-y-4",children:[c.manifest.categories&&c.manifest.categories.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"ๅˆ†็ฑป"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:c.manifest.categories.map(ce=>e.jsx(Ce,{variant:"secondary",children:EC[ce]||ce},ce))})]}),c.manifest.keywords&&c.manifest.keywords.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"ๆ ‡็ญพ"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:c.manifest.keywords.map(ce=>e.jsxs(Ce,{variant:"outline",className:"text-xs",children:[e.jsx(cd,{className:"h-3 w-3 mr-1"}),ce]},ce))})]})]})]})]}),e.jsxs(Te,{className:"lg:col-span-2",children:[e.jsx(Oe,{children:e.jsx(Ue,{className:"text-lg",children:"ๆ’ไปถ่ฏดๆ˜Ž"})}),e.jsx(ze,{children:e.jsx(ts,{className:"h-[600px] pr-4",children:g?e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(Fs,{className:"h-6 w-6 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-sm text-muted-foreground",children:"ๅŠ ่ฝฝ่ฏดๆ˜Žๆ–‡ๆกฃไธญ..."})]}):m?e.jsx(bx,{content:m}):e.jsx("div",{className:"text-center text-muted-foreground py-12",children:"ๆš‚ๆ— ่ฏดๆ˜Žๆ–‡ๆกฃ"})})})]})]})]})})]})}const ec=u.forwardRef(({className:a,...l},r)=>e.jsx(Aj,{ref:r,className:P("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",a),...l}));ec.displayName=Aj.displayName;const AC=u.forwardRef(({className:a,...l},r)=>e.jsx(zj,{ref:r,className:P("aspect-square h-full w-full",a),...l}));AC.displayName=zj.displayName;const sc=u.forwardRef(({className:a,...l},r)=>e.jsx(Rj,{ref:r,className:P("flex h-full w-full items-center justify-center rounded-full bg-muted",a),...l}));sc.displayName=Rj.displayName;function zC(){return"webui_"+Math.random().toString(36).substr(2,9)+"_"+Date.now().toString(36)}function RC(){const a="maibot_webui_user_id";let l=localStorage.getItem(a);return l||(l=zC(),localStorage.setItem(a,l)),l}function DC(){return localStorage.getItem("maibot_webui_user_name")||"WebUI็”จๆˆท"}function OC(a){localStorage.setItem("maibot_webui_user_name",a)}const wN="maibot_webui_virtual_tabs";function LC(){try{const a=localStorage.getItem(wN);if(a)return JSON.parse(a)}catch(a){console.error("[Chat] ๅŠ ่ฝฝ่™šๆ‹Ÿๆ ‡็ญพ้กตๅคฑ่ดฅ:",a)}return[]}function nj(a){try{localStorage.setItem(wN,JSON.stringify(a))}catch(l){console.error("[Chat] ไฟๅญ˜่™šๆ‹Ÿๆ ‡็ญพ้กตๅคฑ่ดฅ:",l)}}function UC({segment:a}){switch(a.type){case"text":return e.jsx("span",{className:"whitespace-pre-wrap",children:String(a.data)});case"image":case"emoji":return e.jsx("img",{src:String(a.data),alt:a.type==="emoji"?"่กจๆƒ…ๅŒ…":"ๅ›พ็‰‡",className:P("rounded-lg max-w-full",a.type==="emoji"?"max-h-32":"max-h-64"),loading:"lazy",onError:l=>{const r=l.target;r.style.display="none",r.parentElement?.insertAdjacentHTML("beforeend",`[${a.type==="emoji"?"่กจๆƒ…ๅŒ…":"ๅ›พ็‰‡"}ๅŠ ่ฝฝๅคฑ่ดฅ]`)}});case"voice":return e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("audio",{controls:!0,src:String(a.data),className:"max-w-[200px] h-8",children:"ๆ‚จ็š„ๆต่งˆๅ™จไธๆ”ฏๆŒ้Ÿณ้ข‘ๆ’ญๆ”พ"})});case"video":return e.jsx("video",{controls:!0,src:String(a.data),className:"rounded-lg max-w-full max-h-64",children:"ๆ‚จ็š„ๆต่งˆๅ™จไธๆ”ฏๆŒ่ง†้ข‘ๆ’ญๆ”พ"});case"face":return e.jsxs("span",{className:"text-muted-foreground",children:["[่กจๆƒ…:",String(a.data),"]"]});case"music":return e.jsx("span",{className:"text-muted-foreground",children:"[้Ÿณไนๅˆ†ไบซ]"});case"file":return e.jsxs("span",{className:"text-muted-foreground",children:["[ๆ–‡ไปถ: ",String(a.data),"]"]});case"reply":return e.jsx("span",{className:"text-muted-foreground text-xs",children:"[ๅ›žๅคๆถˆๆฏ]"});case"forward":return e.jsx("span",{className:"text-muted-foreground",children:"[่ฝฌๅ‘ๆถˆๆฏ]"});case"unknown":default:return e.jsxs("span",{className:"text-muted-foreground",children:["[",a.original_type||"ๆœช็Ÿฅๆถˆๆฏ","]"]})}}function $C({message:a,isBot:l}){return a.message_type==="rich"&&a.segments&&a.segments.length>0?e.jsx("div",{className:"flex flex-col gap-2",children:a.segments.map((r,c)=>e.jsx(UC,{segment:r},c))}):e.jsx("span",{className:"whitespace-pre-wrap",children:a.content})}function BC(){const a={id:"webui-default",type:"webui",label:"WebUI",messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}},l=()=>{const Ke=LC().map(He=>{const Je=He.virtualConfig;return!Je.groupId&&Je.platform&&Je.userId&&(Je.groupId=`webui_virtual_group_${Je.platform}_${Je.userId}`),{id:He.id,type:"virtual",label:He.label,virtualConfig:Je,messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}}});return[a,...Ke]},[r,c]=u.useState(l),[d,m]=u.useState("webui-default"),h=r.find(V=>V.id===d)||r[0],[f,p]=u.useState(""),[g,N]=u.useState(!1),[j,b]=u.useState(!0),[y,w]=u.useState(DC()),[z,M]=u.useState(!1),[S,F]=u.useState(""),[E,C]=u.useState(!1),[R,H]=u.useState([]),[O,X]=u.useState([]),[L,me]=u.useState(!1),[Ne,je]=u.useState(!1),[ce,ge]=u.useState(""),[pe,D]=u.useState({platform:"",personId:"",userId:"",userName:"",groupName:"",groupId:""}),Q=u.useRef(RC()),B=u.useRef(new Map),ue=u.useRef(null),Y=u.useRef(new Map),we=u.useRef(0),fe=u.useRef(new Map),{toast:Ee}=nt(),G=V=>(we.current+=1,`${V}-${Date.now()}-${we.current}-${Math.random().toString(36).substr(2,9)}`),$=u.useCallback((V,Ke)=>{c(He=>He.map(Je=>Je.id===V?{...Je,...Ke}:Je))},[]),A=u.useCallback((V,Ke)=>{c(He=>He.map(Je=>Je.id===V?{...Je,messages:[...Je.messages,Ke]}:Je))},[]),K=u.useCallback(()=>{ue.current?.scrollIntoView({behavior:"smooth"})},[]);u.useEffect(()=>{K()},[h?.messages,K]);const Re=u.useCallback(async()=>{me(!0);try{const V=await ke("/api/chat/platforms");if(console.log("[Chat] ๅนณๅฐๅˆ—่กจๅ“ๅบ”:",V.status,V.headers.get("content-type")),V.ok){const Ke=V.headers.get("content-type");if(Ke&&Ke.includes("application/json")){const He=await V.json();console.log("[Chat] ๅนณๅฐๅˆ—่กจๆ•ฐๆฎ:",He),H(He.platforms||[])}else{const He=await V.text();console.error("[Chat] ่Žทๅ–ๅนณๅฐๅˆ—่กจๅคฑ่ดฅ: ้ž JSON ๅ“ๅบ”:",He.substring(0,200)),Ee({title:"่ฟžๆŽฅๅคฑ่ดฅ",description:"ๆ— ๆณ•่ฟžๆŽฅๅˆฐๅŽ็ซฏๆœๅŠก๏ผŒ่ฏท็กฎไฟ MaiBot ๅทฒๅฏๅŠจ",variant:"destructive"})}}else console.error("[Chat] ่Žทๅ–ๅนณๅฐๅˆ—่กจๅคฑ่ดฅ: HTTP",V.status),Ee({title:"่Žทๅ–ๅนณๅฐๅคฑ่ดฅ",description:`ๆœๅŠกๅ™จ่ฟ”ๅ›ž้”™่ฏฏ: ${V.status}`,variant:"destructive"})}catch(V){console.error("[Chat] ่Žทๅ–ๅนณๅฐๅˆ—่กจๅคฑ่ดฅ:",V),Ee({title:"็ฝ‘็ปœ้”™่ฏฏ",description:"ๆ— ๆณ•่ฟžๆŽฅๅˆฐๅŽ็ซฏๆœๅŠก",variant:"destructive"})}finally{me(!1)}},[Ee]),se=u.useCallback(async(V,Ke)=>{je(!0);try{const He=new URLSearchParams;V&&He.append("platform",V),Ke&&He.append("search",Ke),He.append("limit","50");const Je=await ke(`/api/chat/persons?${He.toString()}`);if(Je.ok){const Es=Je.headers.get("content-type");if(Es&&Es.includes("application/json")){const ms=await Je.json();X(ms.persons||[])}else console.error("[Chat] ่Žทๅ–็”จๆˆทๅˆ—่กจๅคฑ่ดฅ: ๅŽ็ซฏ่ฟ”ๅ›ž้ž JSON ๅ“ๅบ”")}}catch(He){console.error("[Chat] ่Žทๅ–็”จๆˆทๅˆ—่กจๅคฑ่ดฅ:",He)}finally{je(!1)}},[]);u.useEffect(()=>{pe.platform&&se(pe.platform,ce)},[pe.platform,ce,se]);const $e=u.useCallback(async(V,Ke)=>{b(!0);try{const He=new URLSearchParams;He.append("user_id",Q.current),He.append("limit","50"),Ke&&He.append("group_id",Ke);const Je=`/api/chat/history?${He.toString()}`;console.log("[Chat] ๆญฃๅœจๅŠ ่ฝฝๅކๅฒๆถˆๆฏ:",Je);const Es=await ke(Je);if(Es.ok){const ms=await Es.text();try{const Ms=JSON.parse(ms);if(Ms.messages&&Ms.messages.length>0){const We=Ms.messages.map(rs=>({id:rs.id,type:rs.type,content:rs.content,timestamp:rs.timestamp,sender:{name:rs.sender_name||(rs.is_bot?"้บฆ้บฆ":"WebUI็”จๆˆท"),user_id:rs.user_id,is_bot:rs.is_bot}}));$(V,{messages:We});const Cs=fe.current.get(V)||new Set;We.forEach(rs=>{if(rs.type==="bot"){const is=`bot-${rs.content}-${Math.floor(rs.timestamp*1e3)}`;Cs.add(is)}}),fe.current.set(V,Cs)}}catch(Ms){console.error("[Chat] JSON ่งฃๆžๅคฑ่ดฅ:",Ms)}}}catch(He){console.error("[Chat] ๅŠ ่ฝฝๅކๅฒๆถˆๆฏๅคฑ่ดฅ:",He)}finally{b(!1)}},[$]),cs=u.useCallback(async(V,Ke,He)=>{const Je=B.current.get(V);if(Je?.readyState===WebSocket.OPEN||Je?.readyState===WebSocket.CONNECTING){console.log(`[Tab ${V}] WebSocket ๅทฒๅญ˜ๅœจ๏ผŒ่ทณ่ฟ‡่ฟžๆŽฅ`);return}N(!0);let Es=null;try{const Cs=await ke("/api/webui/ws-token");if(Cs.ok){const rs=await Cs.json();if(rs.success&&rs.token)Es=rs.token;else{console.warn(`[Tab ${V}] ่Žทๅ– WebSocket token ๅคฑ่ดฅ: ${rs.message||"ๆœช็™ปๅฝ•"}`),N(!1);return}}}catch(Cs){console.error(`[Tab ${V}] ่Žทๅ– WebSocket token ๅคฑ่ดฅ:`,Cs),N(!1);return}if(!Es){N(!1);return}const ms=window.location.protocol==="https:"?"wss:":"ws:",Ms=new URLSearchParams;Ms.append("token",Es),Ke==="virtual"&&He?(Ms.append("user_id",He.userId),Ms.append("user_name",He.userName),Ms.append("platform",He.platform),Ms.append("person_id",He.personId),Ms.append("group_name",He.groupName||"WebUI่™šๆ‹Ÿ็พค่Š"),He.groupId&&Ms.append("group_id",He.groupId)):(Ms.append("user_id",Q.current),Ms.append("user_name",y));const We=`${ms}//${window.location.host}/api/chat/ws?${Ms.toString()}`;console.log(`[Tab ${V}] ๆญฃๅœจ่ฟžๆŽฅ WebSocket:`,We);try{const Cs=new WebSocket(We);B.current.set(V,Cs),Cs.onopen=()=>{$(V,{isConnected:!0}),N(!1),console.log(`[Tab ${V}] WebSocket ๅทฒ่ฟžๆŽฅ`)},Cs.onmessage=rs=>{try{const is=JSON.parse(rs.data);switch(is.type){case"session_info":$(V,{sessionInfo:{session_id:is.session_id,user_id:is.user_id,user_name:is.user_name,bot_name:is.bot_name}});break;case"system":A(V,{id:G("sys"),type:"system",content:is.content||"",timestamp:is.timestamp||Date.now()/1e3});break;case"user_message":{const ys=is.sender?.user_id,rt=Ke==="virtual"&&He?He.userId:Q.current;console.log(`[Tab ${V}] ๆ”ถๅˆฐ user_message, sender: ${ys}, current: ${rt}`);const jt=ys?ys.replace(/^webui_user_/,""):"",Ae=rt?rt.replace(/^webui_user_/,""):"";if(jt&&Ae&&jt===Ae){console.log(`[Tab ${V}] ่ทณ่ฟ‡่‡ชๅทฑ็š„ๆถˆๆฏ๏ผˆuser_id ๅŒน้…๏ผ‰`);break}const Qe=fe.current.get(V)||new Set,As=`user-${is.content}-${Math.floor((is.timestamp||0)*1e3)}`;if(Qe.has(As)){console.log(`[Tab ${V}] ่ทณ่ฟ‡่‡ชๅทฑ็š„ๆถˆๆฏ๏ผˆๅ†…ๅฎนๅŽป้‡๏ผ‰`);break}if(Qe.add(As),fe.current.set(V,Qe),Qe.size>100){const mt=Qe.values().next().value;mt&&Qe.delete(mt)}A(V,{id:is.message_id||G("user"),type:"user",content:is.content||"",timestamp:is.timestamp||Date.now()/1e3,sender:is.sender});break}case"bot_message":{$(V,{isTyping:!1});const ys=fe.current.get(V)||new Set,rt=`bot-${is.content}-${Math.floor((is.timestamp||0)*1e3)}`;if(ys.has(rt))break;if(ys.add(rt),fe.current.set(V,ys),ys.size>100){const jt=ys.values().next().value;jt&&ys.delete(jt)}c(jt=>jt.map(Ae=>{if(Ae.id!==V)return Ae;const Qe=Ae.messages.filter(mt=>mt.type!=="thinking"),As={id:G("bot"),type:"bot",content:is.content||"",message_type:is.message_type==="rich"?"rich":"text",segments:is.segments,timestamp:is.timestamp||Date.now()/1e3,sender:is.sender};return{...Ae,messages:[...Qe,As]}}));break}case"typing":$(V,{isTyping:is.is_typing||!1});break;case"error":c(ys=>ys.map(rt=>{if(rt.id!==V)return rt;const jt=rt.messages.filter(Ae=>Ae.type!=="thinking");return{...rt,messages:[...jt,{id:G("error"),type:"error",content:is.content||"ๅ‘็”Ÿ้”™่ฏฏ",timestamp:is.timestamp||Date.now()/1e3}]}})),Ee({title:"้”™่ฏฏ",description:is.content,variant:"destructive"});break;case"pong":break;case"history":{const ys=is.messages||[];if(ys.length>0){const rt=fe.current.get(V)||new Set,jt=ys.map(Ae=>{const Qe=Ae.is_bot||!1,As=Ae.id||G(Qe?"bot":"user"),mt=`${Qe?"bot":"user"}-${Ae.content}-${Math.floor(Ae.timestamp*1e3)}`;return rt.add(mt),{id:As,type:Qe?"bot":"user",content:Ae.content,timestamp:Ae.timestamp,sender:{name:Ae.sender_name||(Qe?"้บฆ้บฆ":"็”จๆˆท"),user_id:Ae.sender_id,is_bot:Qe}}});fe.current.set(V,rt),$(V,{messages:jt}),console.log(`[Tab ${V}] ๅทฒๅŠ ่ฝฝ ${jt.length} ๆกๅކๅฒๆถˆๆฏ`)}break}default:console.log("ๆœช็Ÿฅๆถˆๆฏ็ฑปๅž‹:",is.type)}}catch(is){console.error("่งฃๆžๆถˆๆฏๅคฑ่ดฅ:",is)}},Cs.onclose=()=>{$(V,{isConnected:!1}),N(!1),B.current.delete(V),console.log(`[Tab ${V}] WebSocket ๅทฒๆ–ญๅผ€`);const rs=Y.current.get(V);rs&&clearTimeout(rs);const is=window.setTimeout(()=>{if(!J.current){const ys=r.find(rt=>rt.id===V);ys&&cs(V,ys.type,ys.virtualConfig)}},5e3);Y.current.set(V,is)},Cs.onerror=rs=>{console.error(`[Tab ${V}] WebSocket ้”™่ฏฏ:`,rs),N(!1)}}catch(Cs){console.error(`[Tab ${V}] ๅˆ›ๅปบ WebSocket ๅคฑ่ดฅ:`,Cs),N(!1)}},[y,$,A,Ee,r]),J=u.useRef(!1);u.useEffect(()=>{J.current=!1;const V=B.current,Ke=Y.current,He=fe.current;$e("webui-default");const Je=setTimeout(()=>{J.current||(cs("webui-default","webui"),r.forEach(ms=>{ms.type==="virtual"&&ms.virtualConfig&&(He.set(ms.id,new Set),setTimeout(()=>{J.current||cs(ms.id,"virtual",ms.virtualConfig)},200))}))},100),Es=setInterval(()=>{V.forEach(ms=>{ms.readyState===WebSocket.OPEN&&ms.send(JSON.stringify({type:"ping"}))})},3e4);return()=>{J.current=!0,clearTimeout(Je),clearInterval(Es),Ke.forEach(ms=>{clearTimeout(ms)}),Ke.clear(),V.forEach(ms=>{ms.close()}),V.clear()}},[]);const Z=u.useCallback(()=>{const V=B.current.get(d);if(!f.trim()||!V||V.readyState!==WebSocket.OPEN)return;const Ke=h?.type==="virtual"&&h.virtualConfig?.userName||y,He=f.trim(),Je=Date.now()/1e3;V.send(JSON.stringify({type:"message",content:He,user_name:Ke}));const Es=fe.current.get(d)||new Set,ms=`user-${He}-${Math.floor(Je*1e3)}`;if(Es.add(ms),fe.current.set(d,Es),Es.size>100){const Cs=Es.values().next().value;Cs&&Es.delete(Cs)}const Ms={id:G("user"),type:"user",content:He,timestamp:Je,sender:{name:Ke,is_bot:!1}};A(d,Ms);const We={id:G("thinking"),type:"thinking",content:"",timestamp:Je+.001,sender:{name:h?.sessionInfo.bot_name||"้บฆ้บฆ",is_bot:!0}};A(d,We),p("")},[f,y,d,h,A]),Le=V=>{V.key==="Enter"&&!V.shiftKey&&(V.preventDefault(),Z())},le=()=>{F(y),M(!0)},De=()=>{const V=S.trim()||"WebUI็”จๆˆท";w(V),OC(V),M(!1);const Ke=B.current.get(d);Ke?.readyState===WebSocket.OPEN&&Ke.send(JSON.stringify({type:"update_nickname",user_name:V}))},xe=()=>{F(""),M(!1)},Me=V=>new Date(V*1e3).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}),ds=()=>{const V=B.current.get(d);V&&(V.close(),B.current.delete(d)),cs(d,h?.type||"webui",h?.virtualConfig)},Ts=()=>{D({platform:"",personId:"",userId:"",userName:"",groupName:"",groupId:""}),ge(""),Re(),C(!0)},Ct=()=>{if(!pe.platform||!pe.personId){Ee({title:"้…็ฝฎไธๅฎŒๆ•ด",description:"่ฏท้€‰ๆ‹ฉๅนณๅฐๅ’Œ็”จๆˆท",variant:"destructive"});return}const V=`webui_virtual_group_${pe.platform}_${pe.userId}`,Ke=`virtual-${pe.platform}-${pe.userId}-${Date.now()}`,He=pe.userName||pe.userId,Je={id:Ke,type:"virtual",label:He,virtualConfig:{...pe,groupId:V},messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}};c(Es=>{const ms=[...Es,Je],Ms=ms.filter(We=>We.type==="virtual"&&We.virtualConfig).map(We=>({id:We.id,label:We.label,virtualConfig:We.virtualConfig,createdAt:Date.now()}));return nj(Ms),ms}),m(Ke),C(!1),fe.current.set(Ke,new Set),setTimeout(()=>{cs(Ke,"virtual",pe)},100),Ee({title:"่™šๆ‹Ÿ่บซไปฝๆ ‡็ญพ้กต",description:`ๅทฒๅˆ›ๅปบ ${He} ็š„ๅฏน่ฏ`})},ia=(V,Ke)=>{if(Ke?.stopPropagation(),V==="webui-default")return;const He=B.current.get(V);He&&(He.close(),B.current.delete(V));const Je=Y.current.get(V);Je&&(clearTimeout(Je),Y.current.delete(V)),fe.current.delete(V),c(Es=>{const ms=Es.filter(We=>We.id!==V),Ms=ms.filter(We=>We.type==="virtual"&&We.virtualConfig).map(We=>({id:We.id,label:We.label,virtualConfig:We.virtualConfig,createdAt:Date.now()}));return nj(Ms),ms}),d===V&&m("webui-default")},ut=V=>{m(V)},Is=V=>{D(Ke=>({...Ke,personId:V.person_id,userId:V.user_id,userName:V.nickname||V.person_name}))};return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(Qs,{open:E,onOpenChange:C,children:e.jsxs(Hs,{className:"sm:max-w-[500px] max-h-[85vh] overflow-hidden flex flex-col",children:[e.jsxs(qs,{children:[e.jsxs(Vs,{className:"flex items-center gap-2",children:[e.jsx(Am,{className:"h-5 w-5"}),"ๆ–ฐๅปบ่™šๆ‹Ÿ่บซไปฝๅฏน่ฏ"]}),e.jsx(at,{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(Go,{className:"h-4 w-4"}),"้€‰ๆ‹ฉๅนณๅฐ"]}),e.jsxs(Pe,{value:pe.platform,onValueChange:V=>{D(Ke=>({...Ke,platform:V,personId:"",userId:"",userName:""})),X([])},children:[e.jsx(Be,{disabled:L,children:e.jsx(Fe,{placeholder:L?"ๅŠ ่ฝฝไธญ...":"้€‰ๆ‹ฉๅนณๅฐ"})}),e.jsx(Ie,{children:R.map(V=>e.jsxs(W,{value:V.platform,children:[V.platform," (",V.count," ไบบ)"]},V.platform))})]})]}),pe.platform&&e.jsxs("div",{className:"space-y-2 flex-1 overflow-hidden flex flex-col",children:[e.jsxs(T,{className:"flex items-center gap-2",children:[e.jsx(oc,{className:"h-4 w-4"}),"้€‰ๆ‹ฉ็”จๆˆท"]}),e.jsxs("div",{className:"relative",children:[e.jsx($t,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ne,{placeholder:"ๆœ็ดข็”จๆˆทๅ...",value:ce,onChange:V=>ge(V.target.value),className:"pl-9"})]}),e.jsx(ts,{className:"h-[250px] border rounded-md",children:e.jsx("div",{className:"p-2",children:Ne?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Fs,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):O.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground",children:[e.jsx(oc,{className:"h-8 w-8 mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"ๆฒกๆœ‰ๆ‰พๅˆฐ็”จๆˆท"})]}):e.jsx("div",{className:"space-y-1",children:O.map(V=>e.jsxs("button",{onClick:()=>Is(V),className:P("w-full flex items-center gap-3 p-2 rounded-md text-left transition-colors",pe.personId===V.person_id?"bg-primary text-primary-foreground":"hover:bg-muted"),children:[e.jsx(ec,{className:"h-8 w-8 shrink-0",children:e.jsx(sc,{className:P("text-xs",pe.personId===V.person_id?"bg-primary-foreground/20":"bg-muted"),children:(V.nickname||V.person_name||"?").charAt(0)})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-medium truncate",children:V.nickname||V.person_name}),e.jsxs("div",{className:P("text-xs truncate",pe.personId===V.person_id?"text-primary-foreground/70":"text-muted-foreground"),children:["ID: ",V.user_id,V.is_known&&" ยท ๅทฒ่ฎค่ฏ†"]})]})]},V.person_id))})})})]}),pe.personId&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"่™šๆ‹Ÿ็พคๅ๏ผˆๅฏ้€‰๏ผ‰"}),e.jsx(ne,{placeholder:"WebUI่™šๆ‹Ÿ็พค่Š",value:pe.groupName,onChange:V=>D(Ke=>({...Ke,groupName:V.target.value}))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"้บฆ้บฆไผš่ฎคไธบ่ฟ™ๆ˜ฏไธ€ไธชๅไธบๆญคๅ็งฐ็š„็พค่Š"})]})]}),e.jsxs(gt,{className:"gap-2 sm:gap-0",children:[e.jsx(_,{variant:"outline",onClick:()=>C(!1),children:"ๅ–ๆถˆ"}),e.jsx(_,{onClick:Ct,disabled:!pe.platform||!pe.personId,children:"ๅˆ›ๅปบๅฏน่ฏ"})]})]})}),e.jsx("div",{className:"shrink-0 border-b bg-muted/30",children:e.jsx("div",{className:"max-w-4xl mx-auto px-2 sm:px-4",children:e.jsxs("div",{className:"flex items-center gap-1 overflow-x-auto py-1.5 scrollbar-thin",children:[r.map(V=>e.jsxs("div",{className:P("flex items-center gap-1.5 px-3 py-1.5 rounded-md text-sm whitespace-nowrap transition-colors cursor-pointer","hover:bg-muted",d===V.id?"bg-background shadow-sm border":"text-muted-foreground"),onClick:()=>ut(V.id),children:[V.type==="webui"?e.jsx(Ia,{className:"h-3.5 w-3.5"}):e.jsx(Am,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"max-w-[100px] truncate",children:V.label}),e.jsx("span",{className:P("w-1.5 h-1.5 rounded-full",V.isConnected?"bg-green-500":"bg-muted-foreground/50")}),V.id!=="webui-default"&&e.jsx("span",{onClick:Ke=>ia(V.id,Ke),className:"ml-0.5 p-0.5 rounded hover:bg-muted-foreground/20 cursor-pointer",role:"button",tabIndex:0,onKeyDown:Ke=>{(Ke.key==="Enter"||Ke.key===" ")&&(Ke.preventDefault(),ia(V.id,Ke))},children:e.jsx(Sa,{className:"h-3 w-3"})})]},V.id)),e.jsx("button",{onClick:Ts,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(Xs,{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(ec,{className:"h-8 w-8 sm:h-10 sm:w-10 shrink-0",children:e.jsx(sc,{className:"bg-primary/10 text-primary",children:e.jsx(Yn,{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(Y1,{className:"h-3 w-3 text-green-500"}),e.jsx("span",{className:"text-green-600 dark:text-green-400",children:"ๅทฒ่ฟžๆŽฅ"})]}):g?e.jsxs(e.Fragment,{children:[e.jsx(Fs,{className:"h-3 w-3 animate-spin"}),e.jsx("span",{children:"่ฟžๆŽฅไธญ..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(J1,{className:"h-3 w-3 text-red-500"}),e.jsx("span",{className:"text-red-600 dark:text-red-400",children:"ๆœช่ฟžๆŽฅ"})]})})]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[j&&e.jsx(Fs,{className:"h-4 w-4 animate-spin text-muted-foreground"}),e.jsx(_,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:ds,disabled:g,title:"้‡ๆ–ฐ่ฟžๆŽฅ",children:e.jsx(dt,{className:P("h-4 w-4",g&&"animate-spin")})})]})]}),e.jsx("div",{className:"hidden sm:flex items-center gap-2 mt-2 text-sm text-muted-foreground",children:h?.type==="virtual"&&h.virtualConfig?e.jsxs(e.Fragment,{children:[e.jsx(Am,{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(Fl,{className:"h-3 w-3"}),e.jsx("span",{children:"ๅฝ“ๅ‰่บซไปฝ๏ผš"}),z?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{value:S,onChange:V=>F(V.target.value),onKeyDown:V=>{V.key==="Enter"&&De(),V.key==="Escape"&&xe()},className:"h-7 w-32",placeholder:"่พ“ๅ…ฅๆ˜ต็งฐ",autoFocus:!0}),e.jsx(_,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:De,children:"ไฟๅญ˜"}),e.jsx(_,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:xe,children:"ๅ–ๆถˆ"})]}):e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"font-medium text-foreground",children:y}),e.jsx(_,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:le,title:"ไฟฎๆ”นๆ˜ต็งฐ",children:e.jsx(X1,{className:"h-3 w-3"})})]})]})})]})}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(ts,{className:"h-full",children:e.jsxs("div",{className:"p-3 sm:p-4 max-w-4xl mx-auto space-y-3 sm:space-y-4",children:[h?.messages.length===0&&!j&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[e.jsx(Yn,{className:"h-12 w-12 mb-4 opacity-50"}),e.jsxs("p",{className:"text-sm",children:["ๅผ€ๅง‹ไธŽ ",h?.sessionInfo.bot_name||"้บฆ้บฆ"," ๅฏน่ฏๅง๏ผ"]})]}),h?.messages.map(V=>e.jsxs("div",{className:P("flex gap-2 sm:gap-3",V.type==="user"&&"flex-row-reverse",V.type==="system"&&"justify-center",V.type==="error"&&"justify-center"),children:[V.type==="system"&&e.jsx("div",{className:"text-xs text-muted-foreground bg-muted/50 px-3 py-1 rounded-full max-w-[90%]",children:V.content}),V.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:V.content}),V.type==="thinking"&&e.jsxs(e.Fragment,{children:[e.jsx(ec,{className:"h-7 w-7 sm:h-8 sm:w-8 shrink-0",children:e.jsx(sc,{className:"bg-primary/10 text-primary",children:e.jsx(Yn,{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:V.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:"ๆ€่€ƒไธญ..."})]})})]})]}),(V.type==="user"||V.type==="bot")&&e.jsxs(e.Fragment,{children:[e.jsx(ec,{className:"h-7 w-7 sm:h-8 sm:w-8 shrink-0",children:e.jsx(sc,{className:P("text-xs",V.type==="bot"?"bg-primary/10 text-primary":"bg-secondary text-secondary-foreground"),children:V.type==="bot"?e.jsx(Yn,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"}):e.jsx(Fl,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"})})}),e.jsxs("div",{className:P("flex flex-col gap-1 max-w-[75%] sm:max-w-[70%]",V.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:V.sender?.name||(V.type==="bot"?h?.sessionInfo.bot_name:y)}),e.jsx("span",{children:Me(V.timestamp)})]}),e.jsx("div",{className:P("rounded-2xl px-3 py-2 text-sm break-words",V.type==="bot"?"bg-muted rounded-tl-sm":"bg-primary text-primary-foreground rounded-tr-sm"),children:e.jsx($C,{message:V,isBot:V.type==="bot"})})]})]})]},V.id)),e.jsx("div",{ref:ue})]})})}),e.jsx("div",{className:"shrink-0 border-t bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:e.jsx("div",{className:"p-3 sm:p-4 max-w-4xl mx-auto",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{value:f,onChange:V=>p(V.target.value),onKeyDown:Le,placeholder:h?.isConnected?"่พ“ๅ…ฅๆถˆๆฏ...":"็ญ‰ๅพ…่ฟžๆŽฅ...",disabled:!h?.isConnected,className:"flex-1 h-10 sm:h-10"}),e.jsx(_,{onClick:Z,disabled:!h?.isConnected||!f.trim(),size:"icon",className:"h-10 w-10 shrink-0",children:e.jsx(Z1,{className:"h-4 w-4"})})]})})})]})}var zx="Radio",[IC,_N]=ld(zx),[PC,FC]=IC(zx),SN=u.forwardRef((a,l)=>{const{__scopeRadio:r,name:c,checked:d=!1,required:m,disabled:h,value:f="on",onCheck:p,form:g,...N}=a,[j,b]=u.useState(null),y=nd(l,M=>b(M)),w=u.useRef(!1),z=j?g||!!j.closest("form"):!0;return e.jsxs(PC,{scope:r,checked:d,disabled:h,children:[e.jsx(ar.button,{type:"button",role:"radio","aria-checked":d,"data-state":EN(d),"data-disabled":h?"":void 0,disabled:h,value:f,...N,ref:y,onClick:_n(a.onClick,M=>{d||p?.(),z&&(w.current=M.isPropagationStopped(),w.current||M.stopPropagation())})}),z&&e.jsx(TN,{control:j,bubbles:!w.current,name:c,value:f,checked:d,required:m,disabled:h,form:g,style:{transform:"translateX(-100%)"}})]})});SN.displayName=zx;var kN="RadioIndicator",CN=u.forwardRef((a,l)=>{const{__scopeRadio:r,forceMount:c,...d}=a,m=FC(kN,r);return e.jsx(b1,{present:c||m.checked,children:e.jsx(ar.span,{"data-state":EN(m.checked),"data-disabled":m.disabled?"":void 0,...d,ref:l})})});CN.displayName=kN;var HC="RadioBubbleInput",TN=u.forwardRef(({__scopeRadio:a,control:l,checked:r,bubbles:c=!0,...d},m)=>{const h=u.useRef(null),f=nd(h,m),p=y1(r),g=w1(l);return u.useEffect(()=>{const N=h.current;if(!N)return;const j=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(j,"checked").set;if(p!==r&&y){const w=new Event("click",{bubbles:c});y.call(N,r),N.dispatchEvent(w)}},[p,r,c]),e.jsx(ar.input,{type:"radio","aria-hidden":!0,defaultChecked:r,...d,tabIndex:-1,ref:f,style:{...d.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});TN.displayName=HC;function EN(a){return a?"checked":"unchecked"}var qC=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],gd="RadioGroup",[VC]=ld(gd,[Dj,_N]),MN=Dj(),AN=_N(),[GC,KC]=VC(gd),zN=u.forwardRef((a,l)=>{const{__scopeRadioGroup:r,name:c,defaultValue:d,value:m,required:h=!1,disabled:f=!1,orientation:p,dir:g,loop:N=!0,onValueChange:j,...b}=a,y=MN(r),w=Wj(g),[z,M]=ad({prop:m,defaultProp:d??null,onChange:j,caller:gd});return e.jsx(GC,{scope:r,name:c,required:h,disabled:f,value:z,onValueChange:M,children:e.jsx(Rw,{asChild:!0,...y,orientation:p,dir:w,loop:N,children:e.jsx(ar.div,{role:"radiogroup","aria-required":h,"aria-orientation":p,"data-disabled":f?"":void 0,dir:w,...b,ref:l})})})});zN.displayName=gd;var RN="RadioGroupItem",DN=u.forwardRef((a,l)=>{const{__scopeRadioGroup:r,disabled:c,...d}=a,m=KC(RN,r),h=m.disabled||c,f=MN(r),p=AN(r),g=u.useRef(null),N=nd(l,g),j=m.value===d.value,b=u.useRef(!1);return u.useEffect(()=>{const y=z=>{qC.includes(z.key)&&(b.current=!0)},w=()=>b.current=!1;return document.addEventListener("keydown",y),document.addEventListener("keyup",w),()=>{document.removeEventListener("keydown",y),document.removeEventListener("keyup",w)}},[]),e.jsx(Dw,{asChild:!0,...f,focusable:!h,active:j,children:e.jsx(SN,{disabled:h,required:m.required,checked:j,...p,...d,name:m.name,ref:N,onCheck:()=>m.onValueChange(d.value),onKeyDown:_n(y=>{y.key==="Enter"&&y.preventDefault()}),onFocus:_n(d.onFocus,()=>{b.current&&g.current?.click()})})})});DN.displayName=RN;var QC="RadioGroupIndicator",ON=u.forwardRef((a,l)=>{const{__scopeRadioGroup:r,...c}=a,d=AN(r);return e.jsx(CN,{...d,...c,ref:l})});ON.displayName=QC;var LN=zN,UN=DN,YC=ON;const Rx=u.forwardRef(({className:a,...l},r)=>e.jsx(LN,{className:P("grid gap-2",a),...l,ref:r}));Rx.displayName=LN.displayName;const Wo=u.forwardRef(({className:a,...l},r)=>e.jsx(UN,{ref:r,className:P("aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",a),...l,children:e.jsx(YC,{className:"flex items-center justify-center",children:e.jsx(Vo,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Wo.displayName=UN.displayName;function JC({question:a,value:l,onChange:r,error:c,disabled:d=!1}){const[m,h]=u.useState(null),f=d||a.readOnly,p=()=>{switch(a.type){case"single":return e.jsx(Rx,{value:l||"",onValueChange:r,disabled:f,className:"space-y-2",children:a.options?.map(g=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Wo,{value:g.value,id:`${a.id}-${g.id}`}),e.jsx(T,{htmlFor:`${a.id}-${g.id}`,className:"cursor-pointer font-normal",children:g.label})]},g.id))});case"multiple":{const g=l||[];return e.jsxs("div",{className:"space-y-2",children:[a.options?.map(N=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(tt,{id:`${a.id}-${N.id}`,checked:g.includes(N.value),disabled:f||a.maxSelections!==void 0&&g.length>=a.maxSelections&&!g.includes(N.value),onCheckedChange:j=>{r(j?[...g,N.value]:g.filter(b=>b!==N.value))}}),e.jsx(T,{htmlFor:`${a.id}-${N.id}`,className:"cursor-pointer font-normal",children:N.label})]},N.id)),a.maxSelections&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["ๆœ€ๅคš้€‰ๆ‹ฉ ",a.maxSelections," ้กน"]})]})}case"text":return e.jsx(ne,{value:l||"",onChange:g=>r(g.target.value),placeholder:a.placeholder||"่ฏท่พ“ๅ…ฅ...",disabled:f,readOnly:a.readOnly,maxLength:a.maxLength,className:P(a.readOnly&&"bg-muted cursor-not-allowed")});case"textarea":return e.jsxs("div",{className:"space-y-1",children:[e.jsx(pt,{value:l||"",onChange:g=>r(g.target.value),placeholder:a.placeholder||"่ฏท่พ“ๅ…ฅ...",disabled:f,readOnly:a.readOnly,maxLength:a.maxLength,rows:4,className:P(a.readOnly&&"bg-muted cursor-not-allowed")}),a.maxLength&&e.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[(l||"").length," / ",a.maxLength]})]});case"rating":{const g=l||0,N=m!==null?m:g;return e.jsxs("div",{className:"flex items-center gap-1",children:[[1,2,3,4,5].map(j=>e.jsx("button",{type:"button",disabled:f,className:P("p-1 transition-colors focus:outline-none focus:ring-2 focus:ring-ring rounded",f&&"cursor-not-allowed opacity-50"),onMouseEnter:()=>!f&&h(j),onMouseLeave:()=>h(null),onClick:()=>!f&&r(j),children:e.jsx(vn,{className:P("h-6 w-6 transition-colors",j<=N?"fill-yellow-400 text-yellow-400":"text-muted-foreground")})},j)),g>0&&e.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:[g," / 5"]})]})}case"scale":{const g=a.min??1,N=a.max??10,j=a.step??1,b=l??g;return e.jsxs("div",{className:"space-y-4",children:[e.jsx(el,{value:[b],onValueChange:([y])=>r(y),min:g,max:N,step:j,disabled:f}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:a.minLabel||g}),e.jsx("span",{className:"font-medium text-foreground",children:b}),e.jsx("span",{children:a.maxLabel||N})]})]})}case"dropdown":return e.jsxs(Pe,{value:l||"",onValueChange:r,disabled:f,children:[e.jsx(Be,{children:e.jsx(Fe,{placeholder:a.placeholder||"่ฏท้€‰ๆ‹ฉ..."})}),e.jsx(Ie,{children:a.options?.map(g=>e.jsx(W,{value:g.value,children:g.label},g.id))})]});default:return e.jsx("div",{className:"text-muted-foreground",children:"ไธๆ”ฏๆŒ็š„้—ฎ้ข˜็ฑปๅž‹"})}};return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(T,{className:"text-base font-medium",children:[a.title,a.required&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.description&&e.jsx("p",{className:"text-sm text-muted-foreground",children:a.description})]}),p(),c&&e.jsx("p",{className:"text-sm text-destructive",children:c})]})}const $N="https://maibot-plugin-stats.maibot-webui.workers.dev";function BN(){const a="maibot_user_id";let l=localStorage.getItem(a);if(!l){const r=Math.random().toString(36).substring(2,10),c=Date.now().toString(36),d=Math.random().toString(36).substring(2,10);l=`fp_${r}_${c}_${d}`,localStorage.setItem(a,l)}return l}async function XC(a,l,r,c){try{const d=c?.userId||BN(),m={surveyId:a,surveyVersion:l,userId:d,answers:r,submittedAt:new Date().toISOString(),allowMultiple:c?.allowMultiple,metadata:{userAgent:navigator.userAgent,language:navigator.language}},h=await fetch(`${$N}/survey/submit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(m)}),f=await h.json();return h.status===429?{success:!1,error:"ๆไบค่ฟ‡ไบŽ้ข‘็น๏ผŒ่ฏท็จๅŽๅ†่ฏ•"}:h.status===409?{success:!1,error:f.error||"ไฝ ๅทฒ็ปๆไบค่ฟ‡่ฟ™ไปฝ้—ฎๅทไบ†"}:h.ok?{success:!0,submissionId:f.submissionId,message:f.message}:{success:!1,error:f.error||"ๆไบคๅคฑ่ดฅ"}}catch(d){return console.error("Error submitting survey:",d),{success:!1,error:"็ฝ‘็ปœ้”™่ฏฏ"}}}async function ZC(a,l){try{const r=l||BN(),c=new URLSearchParams({user_id:r,survey_id:a}),d=await fetch(`${$N}/survey/check?${c}`);return d.ok?{success:!0,hasSubmitted:(await d.json()).hasSubmitted}:{success:!1,error:(await d.json()).error||"ๆฃ€ๆŸฅๅคฑ่ดฅ"}}catch(r){return console.error("Error checking submission:",r),{success:!1,error:"็ฝ‘็ปœ้”™่ฏฏ"}}}function IN({config:a,initialAnswers:l,onSubmitSuccess:r,onSubmitError:c,showProgress:d=!0,paginateQuestions:m=!1,className:h}){const f=u.useCallback(()=>!l||l.length===0?{}:l.reduce((B,ue)=>(B[ue.questionId]=ue.value,B),{}),[l]),[p,g]=u.useState(()=>f()),[N,j]=u.useState({}),[b,y]=u.useState(0),[w,z]=u.useState(!1),[M,S]=u.useState(!1),[F,E]=u.useState(null),[C,R]=u.useState(null),[H,O]=u.useState(!1),[X,L]=u.useState(!0);u.useEffect(()=>{l&&l.length>0&&g(B=>({...B,...f()}))},[l,f]),u.useEffect(()=>{(async()=>{if(!a.settings?.allowMultiple){const ue=await ZC(a.id);ue.success&&ue.hasSubmitted&&O(!0)}L(!1)})()},[a.id,a.settings?.allowMultiple]);const me=u.useCallback(()=>{const B=new Date;return!(a.settings?.startTime&&new Date(a.settings.startTime)>B||a.settings?.endTime&&new Date(a.settings.endTime){const ue=p[B.id];return ue==null?!1:Array.isArray(ue)?ue.length>0:typeof ue=="string"?ue.trim()!=="":!0}).length,je=Ne/a.questions.length*100,ce=u.useCallback((B,ue)=>{g(Y=>({...Y,[B]:ue})),j(Y=>{const we={...Y};return delete we[B],we})},[]),ge=u.useCallback(()=>{const B={};for(const ue of a.questions){if(ue.required){const Y=p[ue.id];if(Y==null){B[ue.id]="ๆญค้ข˜ไธบๅฟ…ๅกซ้กน";continue}if(Array.isArray(Y)&&Y.length===0){B[ue.id]="่ฏท่‡ณๅฐ‘้€‰ๆ‹ฉไธ€้กน";continue}if(typeof Y=="string"&&Y.trim()===""){B[ue.id]="ๆญค้ข˜ไธบๅฟ…ๅกซ้กน";continue}}ue.minLength&&typeof p[ue.id]=="string"&&p[ue.id].length{if(!ge()){if(m){const B=a.questions.findIndex(ue=>N[ue.id]);B>=0&&y(B)}return}z(!0),E(null);try{const B=a.questions.filter(Y=>p[Y.id]!==void 0).map(Y=>({questionId:Y.id,value:p[Y.id]})),ue=await XC(a.id,a.version,B,{allowMultiple:a.settings?.allowMultiple});if(ue.success&&ue.submissionId)S(!0),R(ue.submissionId),r?.(ue.submissionId);else{const Y=ue.error||"ๆไบคๅคฑ่ดฅ";E(Y),c?.(Y)}}catch(B){const ue=B instanceof Error?B.message:"ๆไบคๅคฑ่ดฅ";E(ue),c?.(ue)}finally{z(!1)}},[ge,m,a,p,N,r,c]),D=u.useCallback(B=>{B>=0&&Be.jsxs("div",{className:P("p-4 rounded-lg border bg-card",N[B.id]?"border-destructive bg-destructive/5":"border-border"),children:[m&&e.jsxs("div",{className:"text-xs text-muted-foreground mb-2",children:["้—ฎ้ข˜ ",b+1," / ",a.questions.length]}),!m&&e.jsxs("div",{className:"text-xs text-muted-foreground mb-2",children:[ue+1,"."]}),e.jsx(JC,{question:B,value:p[B.id],onChange:Y=>ce(B.id,Y),error:N[B.id],disabled:w})]},B.id)),F&&e.jsxs(ht,{variant:"destructive",children:[e.jsx(Ut,{className:"h-4 w-4"}),e.jsx(ft,{children:F})]}),e.jsx("div",{className:"flex justify-between items-center py-4",children:m?e.jsxs(e.Fragment,{children:[e.jsxs(_,{variant:"outline",onClick:()=>D(b-1),disabled:b===0||w,children:[e.jsx(Pa,{className:"h-4 w-4 mr-1"}),"ไธŠไธ€้ข˜"]}),b===a.questions.length-1?e.jsxs(_,{onClick:pe,disabled:w,children:[w&&e.jsx(Fs,{className:"h-4 w-4 mr-2 animate-spin"}),"ๆไบค้—ฎๅท"]}):e.jsxs(_,{onClick:()=>D(b+1),disabled:w,children:["ไธ‹ไธ€้ข˜",e.jsx(ra,{className:"h-4 w-4 ml-1"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:Object.keys(N).length>0&&e.jsxs("span",{className:"text-destructive",children:["่ฟ˜ๆœ‰ ",Object.keys(N).length," ไธชๅฟ…ๅกซ้กนๆœชๅฎŒๆˆ"]})}),e.jsxs(_,{onClick:pe,disabled:w,size:"lg",children:[w&&e.jsx(Fs,{className:"h-4 w-4 mr-2 animate-spin"}),"ๆไบค้—ฎๅท"]})]})})]})})]})}const WC={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:"ๆ„Ÿ่ฐขไฝ ็š„ๅ้ฆˆ๏ผไฝ ็š„ๆ„่งๅฏนๆˆ‘ไปฌ้žๅธธ้‡่ฆ๏ผŒๆˆ‘ไปฌไผš่ฎค็œŸ่€ƒ่™‘ๆฏไธ€ๆกๅปบ่ฎฎใ€‚"}},e3={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 s3(){const[a,l]=u.useState(!0),r=u.useMemo(()=>JSON.parse(JSON.stringify(WC)),[]);u.useEffect(()=>{l(!1)},[]);const c=u.useMemo(()=>[{questionId:"webui_version",value:`v${ud}`}],[]),d=u.useCallback(h=>{console.log("WebUI Survey submitted:",h)},[]),m=u.useCallback(h=>{console.error("WebUI Survey submission error:",h)},[]);return a?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx(Fs,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r?e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsxs("div",{className:"mb-4 sm:mb-6 shrink-0",children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(pv,{className:"h-8 w-8",strokeWidth:2}),"WebUI ไฝฟ็”จๅ้ฆˆ้—ฎๅท"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"ๆ„Ÿ่ฐขๆ‚จ็š„ๅ้ฆˆ๏ผŒๅธฎๅŠฉๆˆ‘ไปฌๆŒ็ปญๆ”น่ฟ›ไบงๅ“ไฝ“้ชŒ"})]}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(IN,{config:r,initialAnswers:c,showProgress:!0,paginateQuestions:!1,onSubmitSuccess:d,onSubmitError:m})})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-4",children:[e.jsxs(ht,{variant:"destructive",className:"max-w-md",children:[e.jsx(Ut,{className:"h-4 w-4"}),e.jsx(ft,{children:"ๆ— ๆณ•ๅŠ ่ฝฝ้—ฎๅท้…็ฝฎ"})]}),e.jsx(_,{variant:"outline",onClick:()=>window.location.reload(),children:"้‡่ฏ•"})]})}function t3(){const[a,l]=u.useState(null),[r,c]=u.useState(!0),[d,m]=u.useState("ๆœช็Ÿฅ็‰ˆๆœฌ");u.useEffect(()=>{(async()=>{try{const j=await V_();m(j.version||"ๆœช็Ÿฅ็‰ˆๆœฌ")}catch(j){console.error("Failed to get MaiBot version:",j),m("่Žทๅ–ๅคฑ่ดฅ")}const N=JSON.parse(JSON.stringify(e3));l(N),c(!1)})()},[]);const h=u.useMemo(()=>[{questionId:"maibot_version",value:d}],[d]),f=u.useCallback(g=>{console.log("MaiBot Survey submitted:",g)},[]),p=u.useCallback(g=>{console.error("MaiBot Survey submission error:",g)},[]);return r?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx(Fs,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):a?e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsxs("div",{className:"mb-4 sm:mb-6 shrink-0",children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(pv,{className:"h-8 w-8",strokeWidth:2}),"้บฆ้บฆไฝฟ็”จไฝ“้ชŒๅ้ฆˆ้—ฎๅท"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"ๆ„Ÿ่ฐขๆ‚จ็š„ๅ้ฆˆ๏ผŒๅธฎๅŠฉๆˆ‘ไปฌๆ‰“้€ ๆ›ดๅฅฝ็š„ AI ไผ™ไผด"})]}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(IN,{config:a,initialAnswers:h,showProgress:!0,paginateQuestions:!1,onSubmitSuccess:f,onSubmitError:p})})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-4",children:[e.jsxs(ht,{variant:"destructive",className:"max-w-md",children:[e.jsx(Ut,{className:"h-4 w-4"}),e.jsx(ft,{children:"ๆ— ๆณ•ๅŠ ่ฝฝ้—ฎๅท้…็ฝฎ"})]}),e.jsx(_,{variant:"outline",onClick:()=>window.location.reload(),children:"้‡่ฏ•"})]})}async function a3(a=2025){const l=await ke(`/api/webui/annual-report/full?year=${a}`);if(!l.ok){const r=await l.json();throw new Error(r.detail||"่Žทๅ–ๅนดๅบฆๆŠฅๅ‘Šๅคฑ่ดฅ")}return l.json()}function l3(a,l){if(a.match(/^[a-z]+:\/\//i))return a;if(a.match(/^\/\//))return window.location.protocol+a;if(a.match(/^[a-z]+:/i))return a;const r=document.implementation.createHTMLDocument(),c=r.createElement("base"),d=r.createElement("a");return r.head.appendChild(c),r.body.appendChild(d),l&&(c.href=l),d.href=a,d.href}const n3=(()=>{let a=0;const l=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(a+=1,`u${l()}${a}`)})();function wn(a){const l=[];for(let r=0,c=a.length;rOa||a.height>Oa)&&(a.width>Oa&&a.height>Oa?a.width>a.height?(a.height*=Oa/a.width,a.width=Oa):(a.width*=Oa/a.height,a.height=Oa):a.width>Oa?(a.height*=Oa/a.width,a.width=Oa):(a.width*=Oa/a.height,a.height=Oa))}function sd(a){return new Promise((l,r)=>{const c=new Image;c.onload=()=>{c.decode().then(()=>{requestAnimationFrame(()=>l(c))})},c.onerror=r,c.crossOrigin="anonymous",c.decoding="async",c.src=a})}async function d3(a){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(a)).then(encodeURIComponent).then(l=>`data:image/svg+xml;charset=utf-8,${l}`)}async function u3(a,l,r){const c="http://www.w3.org/2000/svg",d=document.createElementNS(c,"svg"),m=document.createElementNS(c,"foreignObject");return d.setAttribute("width",`${l}`),d.setAttribute("height",`${r}`),d.setAttribute("viewBox",`0 0 ${l} ${r}`),m.setAttribute("width","100%"),m.setAttribute("height","100%"),m.setAttribute("x","0"),m.setAttribute("y","0"),m.setAttribute("externalResourcesRequired","true"),d.appendChild(m),m.appendChild(a),d3(d)}const _a=(a,l)=>{if(a instanceof l)return!0;const r=Object.getPrototypeOf(a);return r===null?!1:r.constructor.name===l.name||_a(r,l)};function m3(a){const l=a.getPropertyValue("content");return`${a.cssText} content: '${l.replace(/'|"/g,"")}';`}function x3(a,l){return PN(l).map(r=>{const c=a.getPropertyValue(r),d=a.getPropertyPriority(r);return`${r}: ${c}${d?" !important":""};`}).join(" ")}function h3(a,l,r,c){const d=`.${a}:${l}`,m=r.cssText?m3(r):x3(r,c);return document.createTextNode(`${d}{${m}}`)}function rj(a,l,r,c){const d=window.getComputedStyle(a,r),m=d.getPropertyValue("content");if(m===""||m==="none")return;const h=n3();try{l.className=`${l.className} ${h}`}catch{return}const f=document.createElement("style");f.appendChild(h3(h,r,d,c)),l.appendChild(f)}function f3(a,l,r){rj(a,l,":before",r),rj(a,l,":after",r)}const ij="application/font-woff",cj="image/jpeg",p3={woff:ij,woff2:ij,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:cj,jpeg:cj,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function g3(a){const l=/\.([^./]*?)$/g.exec(a);return l?l[1]:""}function Dx(a){const l=g3(a).toLowerCase();return p3[l]||""}function j3(a){return a.split(/,/)[1]}function ax(a){return a.search(/^(data:)/)!==-1}function v3(a,l){return`data:${l};base64,${a}`}async function HN(a,l,r){const c=await fetch(a,l);if(c.status===404)throw new Error(`Resource "${c.url}" not found`);const d=await c.blob();return new Promise((m,h)=>{const f=new FileReader;f.onerror=h,f.onloadend=()=>{try{m(r({res:c,result:f.result}))}catch(p){h(p)}},f.readAsDataURL(d)})}const Km={};function N3(a,l,r){let c=a.replace(/\?.*/,"");return r&&(c=a),/ttf|otf|eot|woff2?/i.test(c)&&(c=c.replace(/.*\//,"")),l?`[${l}]${c}`:c}async function Ox(a,l,r){const c=N3(a,l,r.includeQueryParams);if(Km[c]!=null)return Km[c];r.cacheBust&&(a+=(/\?/.test(a)?"&":"?")+new Date().getTime());let d;try{const m=await HN(a,r.fetchRequestInit,({res:h,result:f})=>(l||(l=h.headers.get("Content-Type")||""),j3(f)));d=v3(m,l)}catch(m){d=r.imagePlaceholder||"";let h=`Failed to fetch resource: ${a}`;m&&(h=typeof m=="string"?m:m.message),h&&console.warn(h)}return Km[c]=d,d}async function b3(a){const l=a.toDataURL();return l==="data:,"?a.cloneNode(!1):sd(l)}async function y3(a,l){if(a.currentSrc){const m=document.createElement("canvas"),h=m.getContext("2d");m.width=a.clientWidth,m.height=a.clientHeight,h?.drawImage(a,0,0,m.width,m.height);const f=m.toDataURL();return sd(f)}const r=a.poster,c=Dx(r),d=await Ox(r,c,l);return sd(d)}async function w3(a,l){var r;try{if(!((r=a?.contentDocument)===null||r===void 0)&&r.body)return await jd(a.contentDocument.body,l,!0)}catch{}return a.cloneNode(!1)}async function _3(a,l){return _a(a,HTMLCanvasElement)?b3(a):_a(a,HTMLVideoElement)?y3(a,l):_a(a,HTMLIFrameElement)?w3(a,l):a.cloneNode(qN(a))}const S3=a=>a.tagName!=null&&a.tagName.toUpperCase()==="SLOT",qN=a=>a.tagName!=null&&a.tagName.toUpperCase()==="SVG";async function k3(a,l,r){var c,d;if(qN(l))return l;let m=[];return S3(a)&&a.assignedNodes?m=wn(a.assignedNodes()):_a(a,HTMLIFrameElement)&&(!((c=a.contentDocument)===null||c===void 0)&&c.body)?m=wn(a.contentDocument.body.childNodes):m=wn(((d=a.shadowRoot)!==null&&d!==void 0?d:a).childNodes),m.length===0||_a(a,HTMLVideoElement)||await m.reduce((h,f)=>h.then(()=>jd(f,r)).then(p=>{p&&l.appendChild(p)}),Promise.resolve()),l}function C3(a,l,r){const c=l.style;if(!c)return;const d=window.getComputedStyle(a);d.cssText?(c.cssText=d.cssText,c.transformOrigin=d.transformOrigin):PN(r).forEach(m=>{let h=d.getPropertyValue(m);m==="font-size"&&h.endsWith("px")&&(h=`${Math.floor(parseFloat(h.substring(0,h.length-2)))-.1}px`),_a(a,HTMLIFrameElement)&&m==="display"&&h==="inline"&&(h="block"),m==="d"&&l.getAttribute("d")&&(h=`path(${l.getAttribute("d")})`),c.setProperty(m,h,d.getPropertyPriority(m))})}function T3(a,l){_a(a,HTMLTextAreaElement)&&(l.innerHTML=a.value),_a(a,HTMLInputElement)&&l.setAttribute("value",a.value)}function E3(a,l){if(_a(a,HTMLSelectElement)){const c=Array.from(l.children).find(d=>a.value===d.getAttribute("value"));c&&c.setAttribute("selected","")}}function M3(a,l,r){return _a(l,Element)&&(C3(a,l,r),f3(a,l,r),T3(a,l),E3(a,l)),l}async function A3(a,l){const r=a.querySelectorAll?a.querySelectorAll("use"):[];if(r.length===0)return a;const c={};for(let m=0;m_3(c,l)).then(c=>k3(a,c,l)).then(c=>M3(a,c,l)).then(c=>A3(c,l))}const VN=/url\((['"]?)([^'"]+?)\1\)/g,z3=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,R3=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function D3(a){const l=a.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${l})(['"]?\\))`,"g")}function O3(a){const l=[];return a.replace(VN,(r,c,d)=>(l.push(d),r)),l.filter(r=>!ax(r))}async function L3(a,l,r,c,d){try{const m=r?l3(l,r):l,h=Dx(l);let f;return d||(f=await Ox(m,h,c)),a.replace(D3(l),`$1${f}$3`)}catch{}return a}function U3(a,{preferredFontFormat:l}){return l?a.replace(R3,r=>{for(;;){const[c,,d]=z3.exec(r)||[];if(!d)return"";if(d===l)return`src: ${c};`}}):a}function GN(a){return a.search(VN)!==-1}async function KN(a,l,r){if(!GN(a))return a;const c=U3(a,r);return O3(c).reduce((m,h)=>m.then(f=>L3(f,h,l,r)),Promise.resolve(c))}async function Vr(a,l,r){var c;const d=(c=l.style)===null||c===void 0?void 0:c.getPropertyValue(a);if(d){const m=await KN(d,null,r);return l.style.setProperty(a,m,l.style.getPropertyPriority(a)),!0}return!1}async function $3(a,l){await Vr("background",a,l)||await Vr("background-image",a,l),await Vr("mask",a,l)||await Vr("-webkit-mask",a,l)||await Vr("mask-image",a,l)||await Vr("-webkit-mask-image",a,l)}async function B3(a,l){const r=_a(a,HTMLImageElement);if(!(r&&!ax(a.src))&&!(_a(a,SVGImageElement)&&!ax(a.href.baseVal)))return;const c=r?a.src:a.href.baseVal,d=await Ox(c,Dx(c),l);await new Promise((m,h)=>{a.onload=m,a.onerror=l.onImageErrorHandler?(...p)=>{try{m(l.onImageErrorHandler(...p))}catch(g){h(g)}}:h;const f=a;f.decode&&(f.decode=m),f.loading==="lazy"&&(f.loading="eager"),r?(a.srcset="",a.src=d):a.href.baseVal=d})}async function I3(a,l){const c=wn(a.childNodes).map(d=>QN(d,l));await Promise.all(c).then(()=>a)}async function QN(a,l){_a(a,Element)&&(await $3(a,l),await B3(a,l),await I3(a,l))}function P3(a,l){const{style:r}=a;l.backgroundColor&&(r.backgroundColor=l.backgroundColor),l.width&&(r.width=`${l.width}px`),l.height&&(r.height=`${l.height}px`);const c=l.style;return c!=null&&Object.keys(c).forEach(d=>{r[d]=c[d]}),a}const oj={};async function dj(a){let l=oj[a];if(l!=null)return l;const c=await(await fetch(a)).text();return l={url:a,cssText:c},oj[a]=l,l}async function uj(a,l){let r=a.cssText;const c=/url\(["']?([^"')]+)["']?\)/g,m=(r.match(/url\([^)]+\)/g)||[]).map(async h=>{let f=h.replace(c,"$1");return f.startsWith("https://")||(f=new URL(f,a.url).href),HN(f,l.fetchRequestInit,({result:p})=>(r=r.replace(h,`url(${p})`),[h,p]))});return Promise.all(m).then(()=>r)}function mj(a){if(a==null)return[];const l=[],r=/(\/\*[\s\S]*?\*\/)/gi;let c=a.replace(r,"");const d=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const p=d.exec(c);if(p===null)break;l.push(p[0])}c=c.replace(d,"");const m=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,h="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",f=new RegExp(h,"gi");for(;;){let p=m.exec(c);if(p===null){if(p=f.exec(c),p===null)break;m.lastIndex=f.lastIndex}else f.lastIndex=m.lastIndex;l.push(p[0])}return l}async function F3(a,l){const r=[],c=[];return a.forEach(d=>{if("cssRules"in d)try{wn(d.cssRules||[]).forEach((m,h)=>{if(m.type===CSSRule.IMPORT_RULE){let f=h+1;const p=m.href,g=dj(p).then(N=>uj(N,l)).then(N=>mj(N).forEach(j=>{try{d.insertRule(j,j.startsWith("@import")?f+=1:d.cssRules.length)}catch(b){console.error("Error inserting rule from remote css",{rule:j,error:b})}})).catch(N=>{console.error("Error loading remote css",N.toString())});c.push(g)}})}catch(m){const h=a.find(f=>f.href==null)||document.styleSheets[0];d.href!=null&&c.push(dj(d.href).then(f=>uj(f,l)).then(f=>mj(f).forEach(p=>{h.insertRule(p,h.cssRules.length)})).catch(f=>{console.error("Error loading remote stylesheet",f)})),console.error("Error inlining remote css file",m)}}),Promise.all(c).then(()=>(a.forEach(d=>{if("cssRules"in d)try{wn(d.cssRules||[]).forEach(m=>{r.push(m)})}catch(m){console.error(`Error while reading CSS rules from ${d.href}`,m)}}),r))}function H3(a){return a.filter(l=>l.type===CSSRule.FONT_FACE_RULE).filter(l=>GN(l.style.getPropertyValue("src")))}async function q3(a,l){if(a.ownerDocument==null)throw new Error("Provided element is not within a Document");const r=wn(a.ownerDocument.styleSheets),c=await F3(r,l);return H3(c)}function YN(a){return a.trim().replace(/["']/g,"")}function V3(a){const l=new Set;function r(c){(c.style.fontFamily||getComputedStyle(c).fontFamily).split(",").forEach(m=>{l.add(YN(m))}),Array.from(c.children).forEach(m=>{m instanceof HTMLElement&&r(m)})}return r(a),l}async function G3(a,l){const r=await q3(a,l),c=V3(a);return(await Promise.all(r.filter(m=>c.has(YN(m.style.fontFamily))).map(m=>{const h=m.parentStyleSheet?m.parentStyleSheet.href:null;return KN(m.cssText,h,l)}))).join(` -`)}async function K3(a,l){const r=l.fontEmbedCSS!=null?l.fontEmbedCSS:l.skipFonts?null:await G3(a,l);if(r){const c=document.createElement("style"),d=document.createTextNode(r);c.appendChild(d),a.firstChild?a.insertBefore(c,a.firstChild):a.appendChild(c)}}async function Q3(a,l={}){const{width:r,height:c}=FN(a,l),d=await jd(a,l,!0);return await K3(d,l),await QN(d,l),P3(d,l),await u3(d,r,c)}async function Y3(a,l={}){const{width:r,height:c}=FN(a,l),d=await Q3(a,l),m=await sd(d),h=document.createElement("canvas"),f=h.getContext("2d"),p=l.pixelRatio||c3(),g=l.canvasWidth||r,N=l.canvasHeight||c;return h.width=g*p,h.height=N*p,l.skipAutoScale||o3(h),h.style.width=`${g}`,h.style.height=`${N}`,l.backgroundColor&&(f.fillStyle=l.backgroundColor,f.fillRect(0,0,h.width,h.height)),f.drawImage(m,0,0,h.width,h.height),h}async function J3(a,l={}){return(await Y3(a,l)).toDataURL()}const $o=["#0088FE","#00C49F","#FFBB28","#FF8042","#8884d8","#82ca9d"];function X3(a){return a>=8760?"็›ธๅฝ“ไบŽๅ…จๅนดๆ— ไผ‘๏ผŒ7x24ๅฐๆ—ถๅœจ็บฟ๏ผ":a>=5e3?"็›ธๅฝ“ไบŽไธ€ไฝๅ…จ่Œๅ‘˜ๅทฅ็š„ๅนดๅทฅไฝœๆ—ถ้•ฟ":a>=2e3?"็›ธๅฝ“ไบŽ็œ‹ๅฎŒไบ† 1000 ้ƒจ็”ตๅฝฑ":a>=1e3?"็›ธๅฝ“ไบŽ็Žฏ็ƒ้ฃž่กŒ 80 ๆฌก":a>=500?"็›ธๅฝ“ไบŽ่ฏปๅฎŒไบ† 100 ๆœฌไนฆ":a>=100?"็›ธๅฝ“ไบŽ้ฉฌๆ‹‰ๆพ่ท‘ไบ† 25 ๆฌก":"่™ฝ็„ถไธๅคš๏ผŒไฝ†ๆฏไธ€ๅˆป้ƒฝๅพˆ็่ดต"}function Z3(a){return a>=1e3?"ๅคœๆทฑไบบ้™ๆ—ถ็š„็Ÿฅๅฟƒๅฅฝๅ‹":a>=500?"ๅˆๅคœๅœบ็š„ๅธธๅฎข":a>=100?"ๅถๅฐ”็†ฌๅคœ็š„ๅฐไผ™ไผด":a>=50?"ๆทฑๅคœๆœ‰ๆ—ถไนŸไผš้™ชไฝ ่Š่Š":"ๆ—ฉ็กๆ—ฉ่ตท๏ผŒๅฅๅบทไฝœๆฏ"}function W3(a){const l=a/1e6;return l>=100?"ๆ€่€ƒ้‡ๅ ชๆฏ”ไธ€ๅบงๅ›พไนฆ้ฆ†":l>=50?"็›ธๅฝ“ไบŽๅ†™ไบ†ไธ€้ƒจ็™พ็ง‘ๅ…จไนฆ":l>=10?"่„‘็ป†่ƒžไผฐ่ฎกๆถˆ่€—ไบ†ไธๅฐ‘":l>=1?"ไนŸ็ฎ—ๆ˜ฏ่ดนไบ†ไธ€็•ช่„‘็ญ‹":"่ฝป่ฝปๆพๆพ๏ผŒๆธธๅˆƒๆœ‰ไฝ™"}function e5(a){return a>=1e3?"่ฟ™้’ฑๅคŸๅƒไธ€ๅนด็š„ๆณก้ขไบ†":a>=500?"็›ธๅฝ“ไบŽไนฐไบ†ไธ€ๅฐๆธธๆˆๆœบ":a>=100?"ๅคŸ่ฏทๅคงๅฎถๅ–ๅ‡ ๆฏๅฅถ่Œถ":a>=50?"ไธ€้กฟ็ซ้”…็š„้’ฑ":a>=10?"ๅ‡ ๆฏๅ’–ๅ•ก็š„ไปทๆ ผ":"็œ้’ฑๅฐ่ƒฝๆ‰‹"}function s5(a){return a>=80?"ๆฒ‰้ป˜ๆ˜ฏ้‡‘๏ผŒๆƒœๅญ—ๅฆ‚้‡‘":a>=60?"่ฏไธๅคšไฝ†ๅฅๅฅๅˆฐไฝ":a>=40?"่ฏฅ่ฏด็š„ๆ—ถๅ€™ๆ‰ๅผ€ๅฃ":a>=20?"่ƒฝ่Š็š„้ƒฝ่Šไบ†":"่ฏ็—จๆœฌ็—จ๏ผŒๆœ‰้—ฎๅฟ…็ญ”"}function t5(a){return a>=1e4?"็œผ็›้ƒฝๅฟซ็œ‹่Šฑไบ†":a>=5e3?"ๅ ชๆฏ”ไธ“ไธšๆ‘„ๅฝฑๅธˆ็š„้˜…็‰‡้‡":a>=1e3?"็œ‹ๅ›พๅฐ่พพไบบ":a>=500?"ๅ›พ็‰‡้‰ด่ตๅฎถ":a>=100?"ๅถๅฐ”ๆฌฃ่ตไธ€ไธ‹็พŽๅ›พ":"ๅ›พ็‰‡๏ผŸๆœ‰็ฉบๅ†็œ‹"}function a5(a){return a>=500?"ๅœจไธๆ–ญ็š„็บ ๆญฃไธญๆˆ้•ฟ":a>=200?"ๅญฆไน ๆฐธๆ— ๆญขๅขƒ":a>=100?"่™šๅฟƒๆŽฅๅ—๏ผŒ็งฏๆžๆ”นๆญฃ":a>=50?"ๅถๅฐ”ไนŸไผš็Šฏ้”™":a>=10?"่กจ็Žฐ่ฟ˜็ฎ—ไธ้”™":"ๅฎŒ็พŽ่กจ่พพ๏ผŒๆ— ้œ€็บ ๆญฃ"}function l5(a){return a>=1?"่ฟ™ๆฌกๆ€่€ƒ็š„ไปทๅ€ผๅ ชๆฏ”ไธ€้กฟๅคง้ค๏ผ":a>=.5?"ไธบไบ†่ฟ™ไธช้—ฎ้ข˜๏ผŒๆˆ‘ๅฏๆ˜ฏ่ฎค็œŸๆ€่€ƒไบ†๏ผ":a>=.1?"ไธ‹ไบ†็‚นๅŠŸๅคซ๏ผŒๅ€ผๅพ—็š„๏ผ":a>=.01?"่Šฑไบ†็‚นๅฐ้’ฑ๏ผŒไฝ†ๅพˆๅ€ผๅพ—":"ๅฐๅฐๆ€่€ƒ๏ผŒไธ่ถณๆŒ‚้ฝฟ"}function n5(a,l){return a>=100?"่ฟ™ๅฅ่ฏ็ฎ€็›ดๆ˜ฏไธ‡่ƒฝ้’ฅๅŒ™๏ผ":a>=50?"็™พ่ฏ•ไธ็ˆฝ็š„็ปๅ…ธๅ›žๅค":a>=20?`${l}็š„ๅฃๅคด็ฆ…`:a>=10?"ๅธธ็”จ่ฏญๅฝ•ไน‹ไธ€":"ๅถๅฐ”็”จ็”จ็š„ๅฐ็กฎๅนธ"}function r5(a,l){return a?l>=1e3?"ๆทฑๅคœ็š„ๅฎˆๆŠค่€…๏ผŒ้ป‘ๆš—ไธญ็š„ๅ…‰่Š’":l>=500?"ๆœˆไบฎๆ˜ฏๆˆ‘็š„ๅฅฝๆœ‹ๅ‹":l>=100?"่ถŠๅคœ่ถŠ็ฒพ็ฅž๏ผŒๅคœๆ™šๆ‰ๆ˜ฏไธปๅœบ":"ๅถๅฐ”็†ฌๅคœ๏ผŒไบซๅ—ๅฎ้™ๆ—ถๅ…‰":l<=10?"ไฝœๆฏ่ง„ๅพ‹๏ผŒๅฅๅบท็”Ÿๆดป็š„ๅ…ธ่Œƒ":l<=50?"ๆ—ฉ็กๆ—ฉ่ตท๏ผŒๅถๅฐ”ไนŸไผš็†ฌไธชๅคœ":"่™ฝ็„ถๆ˜ฏๆ—ฉ่ตท้ธŸ๏ผŒไฝ†ไนŸไผšๅฎˆๅ€™ๆทฑๅคœ"}function i5(a){return a>=1e3?"ๅฟ™ๅˆฐ้ฃž่ตท๏ผŒ้”ฎ็›˜้ƒฝ่ฆๅ†’็ƒŸไบ†":a>=500?"่ฟ™ๅคฉ็ฎ€็›ดๆ˜ฏ่ฏ็—จ้™„ไฝ“":a>=200?"็คพไบค่พพไบบไธŠ็บฟ":a>=100?"ๆฏ”ๅนณๆ—ถๆดป่ทƒไธๅฐ‘":a>=50?"ๅฐๅฟ™ไธ€ไธ‹":"่ฟ˜็ฎ—่ฝปๆพ็š„ไธ€ๅคฉ"}function c5(){const[a]=u.useState(2025),[l,r]=u.useState(null),[c,d]=u.useState(!0),[m,h]=u.useState(!1),[f,p]=u.useState(null),g=u.useRef(null),{toast:N}=nt(),j=u.useCallback(async()=>{try{d(!0),p(null);const y=await a3(a);r(y)}catch(y){p(y instanceof Error?y:new Error("่Žทๅ–ๅนดๅบฆๆŠฅๅ‘Šๅคฑ่ดฅ"))}finally{d(!1)}},[a]),b=u.useCallback(async()=>{if(!(!g.current||!l)){h(!0),N({title:"ๆญฃๅœจ็”Ÿๆˆๅ›พ็‰‡",description:"่ฏท็จๅ€™..."});try{const y=g.current,w=getComputedStyle(document.documentElement),z=w.getPropertyValue("--background").trim()?`hsl(${w.getPropertyValue("--background").trim()})`:document.documentElement.classList.contains("dark")?"#0a0a0a":"#ffffff",M=y.style.width,S=y.style.maxWidth;y.style.width="1024px",y.style.maxWidth="1024px";const F=await J3(y,{quality:1,pixelRatio:2,backgroundColor:z,cacheBust:!0,filter:C=>!(C instanceof HTMLElement&&C.hasAttribute("data-export-btn"))});y.style.width=M,y.style.maxWidth=S;const E=document.createElement("a");E.download=`${l.bot_name}_${l.year}_ๅนดๅบฆๆ€ป็ป“.png`,E.href=F,E.click(),N({title:"ๅฏผๅ‡บๆˆๅŠŸ",description:"ๅนดๅบฆๆŠฅๅ‘Šๅทฒไฟๅญ˜ไธบๅ›พ็‰‡"})}catch(y){console.error("ๅฏผๅ‡บๅ›พ็‰‡ๅคฑ่ดฅ:",y),N({title:"ๅฏผๅ‡บๅคฑ่ดฅ",description:"่ฏท้‡่ฏ•",variant:"destructive"})}finally{h(!1)}}},[l,N]);return u.useEffect(()=>{j()},[j]),c?e.jsx(o5,{}):f?e.jsxs("div",{className:"flex h-screen items-center justify-center text-red-500",children:["่Žทๅ–ๅนดๅบฆๆŠฅๅ‘Šๅคฑ่ดฅ: ",f.message]}):l?e.jsx(ts,{className:"h-[calc(100vh-4rem)]",children:e.jsx("div",{className:"min-h-screen bg-gradient-to-b from-background to-muted/50 p-4 md:p-8 print:p-0",ref:g,children:e.jsxs("div",{className:"mx-auto max-w-5xl space-y-8 print:space-y-4",children:[e.jsxs("header",{className:"relative overflow-hidden rounded-3xl bg-primary p-8 text-primary-foreground shadow-2xl print:rounded-none print:shadow-none",children:[e.jsx("div",{className:"absolute right-4 top-4 z-20 print:hidden","data-export-btn":!0,children:e.jsx(_,{variant:"secondary",size:"sm",onClick:b,disabled:m,className:"gap-2 bg-white/20 hover:bg-white/30 text-white border-white/30",children:m?e.jsxs(e.Fragment,{children:[e.jsx(Fs,{className:"h-4 w-4 animate-spin"}),"ๅฏผๅ‡บไธญ..."]}):e.jsxs(e.Fragment,{children:[e.jsx(na,{className:"h-4 w-4"}),"ไฟๅญ˜ๅ›พ็‰‡"]})})}),e.jsxs("div",{className:"relative z-10 flex flex-col items-center text-center",children:[e.jsx(Yn,{className:"mb-4 h-16 w-16 animate-bounce"}),e.jsxs("h1",{className:"text-4xl font-bold tracking-tighter sm:text-6xl",children:[l.bot_name," ",l.year," ๅนดๅบฆๆ€ป็ป“"]}),e.jsx("p",{className:"mt-4 max-w-2xl text-lg opacity-90",children:"่ฟžๆŽฅไธŽๆˆ้•ฟ ยท Connection & Growth"}),e.jsxs("div",{className:"mt-6 flex items-center gap-2 text-sm opacity-75",children:[e.jsx(Ko,{className:"h-4 w-4"}),e.jsxs("span",{children:["็”Ÿๆˆๆ—ถ้—ด: ",l.generated_at]})]})]}),e.jsx("div",{className:"absolute -right-20 -top-20 h-64 w-64 rounded-full bg-white/10 blur-3xl"}),e.jsx("div",{className:"absolute -bottom-20 -left-20 h-64 w-64 rounded-full bg-white/10 blur-3xl"})]}),e.jsxs("section",{className:"space-y-4 break-inside-avoid",children:[e.jsxs("div",{className:"flex items-center gap-2 text-2xl font-bold text-primary",children:[e.jsx(da,{className:"h-8 w-8"}),e.jsx("h2",{children:"ๆ—ถๅ…‰่ถณ่ฟน"})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[e.jsx(La,{title:"ๅนดๅบฆๅœจ็บฟๆ—ถ้•ฟ",value:`${l.time_footprint.total_online_hours} ๅฐๆ—ถ`,description:X3(l.time_footprint.total_online_hours),icon:e.jsx(da,{className:"h-4 w-4"})}),e.jsx(La,{title:"ๆœ€ๅฟ™็ขŒ็š„ไธ€ๅคฉ",value:l.time_footprint.busiest_day||"N/A",description:i5(l.time_footprint.busiest_day_count),icon:e.jsx(Ko,{className:"h-4 w-4"})}),e.jsx(La,{title:"ๆทฑๅคœไบ’ๅŠจ (0-4็‚น)",value:`${l.time_footprint.midnight_chat_count} ๆฌก`,description:Z3(l.time_footprint.midnight_chat_count),icon:e.jsx(tc,{className:"h-4 w-4"})}),e.jsx(La,{title:"ไฝœๆฏๅฑžๆ€ง",value:l.time_footprint.is_night_owl?"ๅคœ็Œซๅญ":"ๆ—ฉ่ตท้ธŸ",description:r5(l.time_footprint.is_night_owl,l.time_footprint.midnight_chat_count),icon:l.time_footprint.is_night_owl?e.jsx(tc,{className:"h-4 w-4"}):e.jsx(ix,{className:"h-4 w-4"})})]}),e.jsxs(Te,{className:"overflow-hidden",children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"24ๅฐๆ—ถๆดป่ทƒๆ—ถ้’Ÿ"}),e.jsxs(Ns,{children:[l.bot_name,"ๅœจไธ€ๅคฉไธญๅ„ไธชๆ—ถๆฎต็š„ๆดป่ทƒ็จ‹ๅบฆ"]})]}),e.jsx(ze,{className:"h-[300px]",children:e.jsx(Uj,{width:"100%",height:"100%",children:e.jsxs(Bo,{data:l.time_footprint.hourly_distribution.map((y,w)=>({hour:`${w}็‚น`,count:y})),children:[e.jsx(Ji,{strokeDasharray:"3 3",vertical:!1}),e.jsx(Xi,{dataKey:"hour"}),e.jsx(Gr,{}),e.jsx($j,{contentStyle:{borderRadius:"8px",border:"none",boxShadow:"0 4px 12px rgba(0,0,0,0.1)"},cursor:{fill:"transparent"}}),e.jsx(Zi,{dataKey:"count",fill:"hsl(var(--primary))",radius:[4,4,0,0]})]})})})]}),l.time_footprint.first_message_time&&e.jsx(Te,{className:"bg-muted/30 border-dashed",children:e.jsxs(ze,{className:"flex flex-col items-center justify-center p-6 text-center",children:[e.jsx("p",{className:"text-muted-foreground mb-2",children:"2025ๅนด็š„ๆ•…ไบ‹ๅผ€ๅง‹ไบŽ"}),e.jsx("div",{className:"text-xl font-bold text-primary mb-1",children:l.time_footprint.first_message_time}),e.jsxs("p",{className:"text-lg",children:[e.jsx("span",{className:"font-semibold text-foreground",children:l.time_footprint.first_message_user})," ่ฏด๏ผš",e.jsxs("span",{className:"italic text-muted-foreground",children:['"',l.time_footprint.first_message_content,'"']})]})]})})]}),e.jsxs("section",{className:"space-y-4 break-inside-avoid",children:[e.jsxs("div",{className:"flex items-center gap-2 text-2xl font-bold text-primary",children:[e.jsx(oc,{className:"h-8 w-8"}),e.jsx("h2",{children:"็คพไบค็ฝ‘็ปœ"})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsx(La,{title:"็คพไบคๅœˆๅญ",value:`${l.social_network.total_groups} ไธช็พค็ป„`,description:`${l.bot_name}ๅŠ ๅ…ฅ็š„็พค็ป„ๆ€ปๆ•ฐ`,icon:e.jsx(oc,{className:"h-4 w-4"})}),e.jsx(La,{title:"่ขซๅ‘ผๅซๆฌกๆ•ฐ",value:`${l.social_network.at_count+l.social_network.mentioned_count} ๆฌก`,description:"ๆˆ‘็š„ๅๅญ—่ขซๅคงๅฎถ้ข‘็นๆ่ตท",icon:e.jsx(W1,{className:"h-4 w-4"})}),e.jsx(La,{title:"ๆœ€้•ฟๆƒ…้™ชไผด",value:l.social_network.longest_companion_user||"N/A",description:`ๅง‹็ปˆ้ƒฝๅœจ๏ผŒๅทฒ้™ชไผด ${l.social_network.longest_companion_days} ๅคฉ`,icon:e.jsx(ei,{className:"h-4 w-4 text-red-500"})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(Te,{children:[e.jsx(Oe,{children:e.jsx(Ue,{children:"่ฏ็—จ็พค็ป„ TOP5"})}),e.jsx(ze,{children:e.jsx("div",{className:"space-y-3",children:l.social_network.top_groups.length>0?l.social_network.top_groups.map((y,w)=>e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ce,{variant:w===0?"default":"secondary",className:"h-6 w-6 rounded-full p-0 flex items-center justify-center shrink-0",children:w+1}),e.jsx("span",{className:"font-medium truncate max-w-[120px]",children:y.group_name}),y.is_webui&&e.jsx(Ce,{variant:"outline",className:"text-xs px-1.5 py-0 h-5 bg-blue-50 text-blue-600 border-blue-200",children:"WebUI"})]}),e.jsxs("span",{className:"text-muted-foreground text-sm shrink-0",children:[y.message_count," ๆกๆถˆๆฏ"]})]},y.group_id)):e.jsx("div",{className:"text-center text-muted-foreground py-4",children:"ๆš‚ๆ— ๆ•ฐๆฎ"})})})]}),e.jsxs(Te,{children:[e.jsx(Oe,{children:e.jsx(Ue,{children:"ๅนดๅบฆๆœ€ไฝณๆŸๅ‹ TOP5"})}),e.jsx(ze,{children:e.jsx("div",{className:"space-y-3",children:l.social_network.top_users.length>0?l.social_network.top_users.map((y,w)=>e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ce,{variant:w===0?"default":"secondary",className:"h-6 w-6 rounded-full p-0 flex items-center justify-center shrink-0",children:w+1}),e.jsx("span",{className:"font-medium truncate max-w-[120px]",children:y.user_nickname}),y.is_webui&&e.jsx(Ce,{variant:"outline",className:"text-xs px-1.5 py-0 h-5 bg-blue-50 text-blue-600 border-blue-200",children:"WebUI"})]}),e.jsxs("span",{className:"text-muted-foreground text-sm shrink-0",children:[y.message_count," ๆฌกไบ’ๅŠจ"]})]},y.user_id)):e.jsx("div",{className:"text-center text-muted-foreground py-4",children:"ๆš‚ๆ— ๆ•ฐๆฎ"})})})]})]})]}),e.jsxs("section",{className:"space-y-4 break-inside-avoid",children:[e.jsxs("div",{className:"flex items-center gap-2 text-2xl font-bold text-primary",children:[e.jsx(hx,{className:"h-8 w-8"}),e.jsx("h2",{children:"ๆœ€ๅผบๅคง่„‘"})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[e.jsx(La,{title:"ๅนดๅบฆ Token ๆถˆ่€—",value:(l.brain_power.total_tokens/1e6).toFixed(2)+" M",description:W3(l.brain_power.total_tokens),icon:e.jsx(sl,{className:"h-4 w-4"})}),e.jsx(La,{title:"ๅนดๅบฆๆ€ป่Šฑ่ดน",value:`$${l.brain_power.total_cost.toFixed(2)}`,description:e5(l.brain_power.total_cost),icon:e.jsx("span",{className:"font-bold",children:"$"})}),e.jsx(La,{title:"้ซ˜ๅ†ทๆŒ‡ๆ•ฐ",value:`${l.brain_power.silence_rate}%`,description:s5(l.brain_power.silence_rate),icon:e.jsx(tc,{className:"h-4 w-4"})}),e.jsx(La,{title:"ๆœ€้ซ˜ๅ…ด่ถฃๅ€ผ",value:l.brain_power.max_interest_value??"N/A",description:l.brain_power.max_interest_time?`ๅ‡บ็Žฐๅœจ ${l.brain_power.max_interest_time}`:"ๆš‚ๆ— ๆ•ฐๆฎ",icon:e.jsx(ei,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(Te,{children:[e.jsx(Oe,{children:e.jsx(Ue,{children:"ๆจกๅž‹ๅๅฅฝๅˆ†ๅธƒ"})}),e.jsx(ze,{children:e.jsx("div",{className:"space-y-3",children:l.brain_power.model_distribution.slice(0,5).map((y,w)=>{const z=l.brain_power.model_distribution[0]?.count||1,M=Math.round(y.count/z*100);return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"font-medium truncate max-w-[200px]",children:y.model}),e.jsxs("span",{className:"text-muted-foreground",children:[y.count.toLocaleString()," ๆฌก"]})]}),e.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-secondary",children:e.jsx("div",{className:"h-full transition-all duration-500",style:{width:`${M}%`,backgroundColor:$o[w%$o.length]}})})]},y.model)})})})]}),l.brain_power.top_reply_models&&l.brain_power.top_reply_models.length>0&&e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"ๆœ€ๅ–œๆฌข็š„ๅ›žๅคๆจกๅž‹ TOP5"}),e.jsxs(Ns,{children:[l.bot_name,"็”จๆฅๅ›žๅคๆถˆๆฏ็š„ๆจกๅž‹ๅๅฅฝ"]})]}),e.jsx(ze,{children:e.jsx("div",{className:"space-y-3",children:l.brain_power.top_reply_models.map((y,w)=>{const z=l.brain_power.top_reply_models[0]?.count||1,M=Math.round(y.count/z*100);return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"font-medium truncate max-w-[200px]",children:y.model}),e.jsxs("span",{className:"text-muted-foreground",children:[y.count.toLocaleString()," ๆฌก"]})]}),e.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-secondary",children:e.jsx("div",{className:"h-full transition-all duration-500",style:{width:`${M}%`,backgroundColor:$o[w%$o.length]}})})]},y.model)})})})]}),l.brain_power.top_token_consumers&&l.brain_power.top_token_consumers.length>0&&e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"็ƒง้’ฑๅคงๆˆท TOP3"}),e.jsx(Ns,{children:"่ฐๆถˆ่€—ไบ†ๆœ€ๅคš็š„ API ้ขๅบฆ"})]}),e.jsx(ze,{children:e.jsx("div",{className:"space-y-6",children:l.brain_power.top_token_consumers.map(y=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between text-sm font-medium",children:[e.jsxs("span",{children:["็”จๆˆท ",y.user_id]}),e.jsxs("span",{children:["$",y.cost.toFixed(2)]})]}),e.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-secondary",children:e.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${y.cost/(l.brain_power.top_token_consumers[0]?.cost||1)*100}%`}})})]},y.user_id))})})]})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(Te,{className:"bg-gradient-to-br from-amber-50 to-orange-50 dark:from-amber-950/20 dark:to-orange-950/20",children:[e.jsx(Oe,{children:e.jsxs(Ue,{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-2xl",children:"๐Ÿ’ฐ"}),"ๆœ€ๆ˜‚่ดต็š„ไธ€ๆฌกๆ€่€ƒ"]})}),e.jsxs(ze,{className:"text-center",children:[e.jsxs("div",{className:"text-4xl font-bold text-amber-600 dark:text-amber-400",children:["$",l.brain_power.most_expensive_cost.toFixed(4)]}),l.brain_power.most_expensive_time&&e.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:["ๅ‘็”Ÿๅœจ ",l.brain_power.most_expensive_time]}),e.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:l5(l.brain_power.most_expensive_cost)})]})]}),e.jsxs(Te,{className:"bg-gradient-to-br from-indigo-50 to-blue-50 dark:from-indigo-950/20 dark:to-blue-950/20",children:[e.jsx(Oe,{children:e.jsxs(Ue,{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-2xl",children:"๐Ÿง "}),"ๆ€่€ƒๆทฑๅบฆ"]})}),e.jsxs(ze,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-center",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-bold text-indigo-600 dark:text-indigo-400",children:l.brain_power.avg_reasoning_length?.toFixed(0)||0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"ๅนณๅ‡ๆ€่€ƒๅญ—ๆ•ฐ"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-bold text-blue-600 dark:text-blue-400",children:l.brain_power.max_reasoning_length?.toLocaleString()||0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"ๆœ€้•ฟๆ€่€ƒๅญ—ๆ•ฐ"})]})]}),l.brain_power.max_reasoning_time&&e.jsxs("p",{className:"mt-4 text-center text-xs text-muted-foreground",children:["ๆœ€ๆทฑๆฒ‰็š„ๆ€่€ƒๅ‘็”Ÿๅœจ ",l.brain_power.max_reasoning_time]})]})]})]})]}),e.jsxs("section",{className:"space-y-4 break-inside-avoid",children:[e.jsxs("div",{className:"flex items-center gap-2 text-2xl font-bold text-primary",children:[e.jsx(rd,{className:"h-8 w-8"}),e.jsx("h2",{children:"ไธชๆ€งไธŽ่กจ่พพ"})]}),(l.expression_vibe.late_night_reply||l.expression_vibe.favorite_reply)&&e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[l.expression_vibe.late_night_reply&&e.jsxs(Te,{className:"bg-gradient-to-br from-indigo-50 to-violet-50 dark:from-indigo-950/20 dark:to-violet-950/20",children:[e.jsxs(Oe,{children:[e.jsxs(Ue,{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-2xl",children:"๐ŸŒ™"}),"ๆทฑๅคœ่ฟ˜ๅœจๅ›žๅค"]}),e.jsxs(Ns,{children:["ๅ‡Œๆ™จ ",l.expression_vibe.late_night_reply.time,"๏ผŒ",l.bot_name,"่ฟ˜ๅœจๅ›žๅค..."]})]}),e.jsxs(ze,{className:"text-center",children:[e.jsxs("p",{className:"text-lg italic text-muted-foreground",children:['"',l.expression_vibe.late_night_reply.content,'"']}),e.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"ๆ˜ฏๆœ‰ไป€ไนˆๅฟƒไบ‹ๅ—๏ผŸ"})]})]}),l.expression_vibe.favorite_reply&&e.jsxs(Te,{className:"bg-gradient-to-br from-rose-50 to-pink-50 dark:from-rose-950/20 dark:to-pink-950/20",children:[e.jsxs(Oe,{children:[e.jsxs(Ue,{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-2xl",children:"๐Ÿ’ฌ"}),"ๆœ€ๅ–œๆฌข็š„ๅ›žๅค"]}),e.jsxs(Ns,{children:["ไฝฟ็”จไบ† ",l.expression_vibe.favorite_reply.count," ๆฌก"]})]}),e.jsxs(ze,{className:"text-center",children:[e.jsxs("p",{className:"text-lg font-medium text-primary",children:['"',l.expression_vibe.favorite_reply.content,'"']}),e.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:n5(l.expression_vibe.favorite_reply.count,l.bot_name)})]})]})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(Te,{className:"bg-gradient-to-br from-pink-50 to-purple-50 dark:from-pink-950/20 dark:to-purple-950/20",children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"ไฝฟ็”จๆœ€ๅคš็š„่กจๆƒ…ๅŒ… TOP3"}),e.jsx(Ns,{children:"ๅนดๅบฆๆœ€็ˆฑ็š„่กจๆƒ…ๅŒ…ไปฌ"})]}),e.jsx(ze,{children:l.expression_vibe.top_emojis&&l.expression_vibe.top_emojis.length>0?e.jsx("div",{className:"flex justify-center gap-4",children:l.expression_vibe.top_emojis.slice(0,3).map((y,w)=>e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsxs("div",{className:"relative",children:[e.jsx("img",{src:`/api/webui/emoji/${y.id}/thumbnail?original=true`,alt:`TOP ${w+1}`,className:"h-24 w-24 rounded-lg object-cover shadow-md transition-transform hover:scale-105"}),e.jsx(Ce,{className:P("absolute -top-2 -right-2",w===0?"bg-yellow-500":w===1?"bg-gray-400":"bg-amber-700"),children:w+1})]}),e.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:[y.usage_count," ๆฌก"]})]},y.id))}):e.jsx("div",{className:"flex h-32 items-center justify-center text-muted-foreground",children:"ๆš‚ๆ— ๆ•ฐๆฎ"})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"ๅฐ่ฑกๆœ€ๆทฑๅˆป็š„่กจ่พพ้ฃŽๆ ผ"}),e.jsxs(Ns,{children:[l.bot_name,"ๆœ€ๅธธไฝฟ็”จ็š„่กจ่พพๆ–นๅผ"]})]}),e.jsx(ze,{children:e.jsx("div",{className:"flex flex-wrap gap-2",children:l.expression_vibe.top_expressions.map((y,w)=>e.jsxs(Ce,{variant:"outline",className:P("px-3 py-1 text-sm",w===0&&"border-primary bg-primary/10 text-primary text-base px-4 py-2"),children:[y.style," (",y.count,")"]},y.style))})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(La,{title:"ๅ›พ็‰‡้‰ด่ต",value:`${l.expression_vibe.image_processed_count} ๅผ `,description:t5(l.expression_vibe.image_processed_count),icon:e.jsx(xx,{className:"h-4 w-4"})}),e.jsx(La,{title:"ๆˆ้•ฟ็š„่ถณ่ฟน",value:`${l.expression_vibe.rejected_expression_count} ๆฌก`,description:a5(l.expression_vibe.rejected_expression_count),icon:e.jsx(sl,{className:"h-4 w-4"})})]})]})]}),l.expression_vibe.action_types.length>0&&e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsxs(Ue,{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-2xl",children:"โšก"}),"่กŒๅŠจๆดพ"]}),e.jsx(Ns,{children:"้™คไบ†่Šๅคฉ๏ผŒๆˆ‘่ฟ˜ๅธฎๅคงๅฎถๅšไบ†่ฟ™ไบ›ไบ‹"})]}),e.jsx(ze,{children:e.jsx("div",{className:"flex flex-wrap gap-3",children:l.expression_vibe.action_types.map(y=>e.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-primary/10 px-4 py-2",children:[e.jsx("span",{className:"font-medium text-primary",children:y.action}),e.jsxs(Ce,{variant:"secondary",children:[y.count," ๆฌก"]})]},y.action))})})]})]}),e.jsxs("section",{className:"space-y-4 break-inside-avoid",children:[e.jsxs("div",{className:"flex items-center gap-2 text-2xl font-bold text-primary",children:[e.jsx(e_,{className:"h-8 w-8"}),e.jsx("h2",{children:"่ถฃๅ‘ณๆˆๅฐฑ"})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsxs(Te,{className:"col-span-1 md:col-span-2",children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:'ๆ–ฐๅญฆๅˆฐ็š„"้ป‘่ฏ"'}),e.jsxs(Ns,{children:["ไปŠๅนดๆˆ‘ๅญฆไผšไบ† ",l.achievements.new_jargon_count," ไธชๆ–ฐ่ฏ"]})]}),e.jsx(ze,{children:e.jsx("div",{className:"flex flex-wrap gap-3",children:l.achievements.sample_jargons.map(y=>e.jsxs("div",{className:"group relative rounded-lg border bg-card p-3 shadow-sm transition-all hover:shadow-md",children:[e.jsx("div",{className:"font-bold text-primary",children:y.content}),e.jsx("div",{className:"text-xs text-muted-foreground mt-1 line-clamp-2 max-w-[200px]",children:y.meaning||"ๆš‚ๆ— ่งฃ้‡Š"})]},y.content))})})]}),e.jsx(Te,{className:"flex flex-col justify-center items-center bg-primary text-primary-foreground",children:e.jsxs(ze,{className:"flex flex-col items-center justify-center p-6 text-center",children:[e.jsx(Ia,{className:"h-12 w-12 mb-4 opacity-80"}),e.jsx("div",{className:"text-4xl font-bold mb-2",children:l.achievements.total_messages.toLocaleString()}),e.jsx("div",{className:"text-sm opacity-80",children:"ๅนดๅบฆๆ€ปๆถˆๆฏๆ•ฐ"}),e.jsxs("div",{className:"mt-4 text-xs opacity-60",children:["ๅ…ถไธญๅ›žๅคไบ† ",l.achievements.total_replies.toLocaleString()," ๆฌก"]})]})})]})]}),e.jsxs("footer",{className:"mt-12 text-center text-muted-foreground",children:[e.jsx("p",{children:"MaiBot 2025 Annual Report"}),e.jsx("p",{className:"text-sm",children:"Generated with โค๏ธ by MaiBot Team"})]})]})})}):null}function La({title:a,value:l,description:r,icon:c}){return e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:a}),e.jsx("div",{className:"text-muted-foreground",children:c})]}),e.jsxs(ze,{children:[e.jsx("div",{className:"text-2xl font-bold",children:l}),e.jsx("p",{className:"text-xs text-muted-foreground",children:r})]})]})}function o5(){return e.jsxs("div",{className:"container mx-auto space-y-8 p-8",children:[e.jsx(ks,{className:"h-64 w-full rounded-3xl"}),e.jsx("div",{className:"grid gap-4 md:grid-cols-4",children:[...Array(4)].map((a,l)=>e.jsx(ks,{className:"h-32 w-full"},l))}),e.jsx(ks,{className:"h-96 w-full"})]})}var vd="DropdownMenu",[d5]=ld(vd,[Oj]),fa=Oj(),[u5,JN]=d5(vd),XN=a=>{const{__scopeDropdownMenu:l,children:r,dir:c,open:d,defaultOpen:m,onOpenChange:h,modal:f=!0}=a,p=fa(l),g=u.useRef(null),[N,j]=ad({prop:d,defaultProp:m??!1,onChange:h,caller:vd});return e.jsx(u5,{scope:l,triggerId:Ym(),triggerRef:g,contentId:Ym(),open:N,onOpenChange:j,onOpenToggle:u.useCallback(()=>j(b=>!b),[j]),modal:f,children:e.jsx(Vw,{...p,open:N,onOpenChange:j,dir:c,modal:f,children:r})})};XN.displayName=vd;var ZN="DropdownMenuTrigger",WN=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,disabled:c=!1,...d}=a,m=JN(ZN,r),h=fa(r);return e.jsx(Gw,{asChild:!0,...h,children:e.jsx(ar.button,{type:"button",id:m.triggerId,"aria-haspopup":"menu","aria-expanded":m.open,"aria-controls":m.open?m.contentId:void 0,"data-state":m.open?"open":"closed","data-disabled":c?"":void 0,disabled:c,...d,ref:_1(l,m.triggerRef),onPointerDown:_n(a.onPointerDown,f=>{!c&&f.button===0&&f.ctrlKey===!1&&(m.onOpenToggle(),m.open||f.preventDefault())}),onKeyDown:_n(a.onKeyDown,f=>{c||(["Enter"," "].includes(f.key)&&m.onOpenToggle(),f.key==="ArrowDown"&&m.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(f.key)&&f.preventDefault())})})})});WN.displayName=ZN;var m5="DropdownMenuPortal",eb=a=>{const{__scopeDropdownMenu:l,...r}=a,c=fa(l);return e.jsx(Uw,{...c,...r})};eb.displayName=m5;var sb="DropdownMenuContent",tb=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=JN(sb,r),m=fa(r),h=u.useRef(!1);return e.jsx($w,{id:d.contentId,"aria-labelledby":d.triggerId,...m,...c,ref:l,onCloseAutoFocus:_n(a.onCloseAutoFocus,f=>{h.current||d.triggerRef.current?.focus(),h.current=!1,f.preventDefault()}),onInteractOutside:_n(a.onInteractOutside,f=>{const p=f.detail.originalEvent,g=p.button===0&&p.ctrlKey===!0,N=p.button===2||g;(!d.modal||N)&&(h.current=!0)}),style:{...a.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});tb.displayName=sb;var x5="DropdownMenuGroup",h5=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=fa(r);return e.jsx(Kw,{...d,...c,ref:l})});h5.displayName=x5;var f5="DropdownMenuLabel",ab=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=fa(r);return e.jsx(Hw,{...d,...c,ref:l})});ab.displayName=f5;var p5="DropdownMenuItem",lb=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=fa(r);return e.jsx(Bw,{...d,...c,ref:l})});lb.displayName=p5;var g5="DropdownMenuCheckboxItem",nb=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=fa(r);return e.jsx(Iw,{...d,...c,ref:l})});nb.displayName=g5;var j5="DropdownMenuRadioGroup",v5=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=fa(r);return e.jsx(Qw,{...d,...c,ref:l})});v5.displayName=j5;var N5="DropdownMenuRadioItem",rb=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=fa(r);return e.jsx(Fw,{...d,...c,ref:l})});rb.displayName=N5;var b5="DropdownMenuItemIndicator",ib=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=fa(r);return e.jsx(Pw,{...d,...c,ref:l})});ib.displayName=b5;var y5="DropdownMenuSeparator",cb=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=fa(r);return e.jsx(qw,{...d,...c,ref:l})});cb.displayName=y5;var w5="DropdownMenuArrow",_5=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=fa(r);return e.jsx(Yw,{...d,...c,ref:l})});_5.displayName=w5;var S5="DropdownMenuSubTrigger",ob=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=fa(r);return e.jsx(Ow,{...d,...c,ref:l})});ob.displayName=S5;var k5="DropdownMenuSubContent",db=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=fa(r);return e.jsx(Lw,{...d,...c,ref:l,style:{...a.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});db.displayName=k5;var C5=XN,T5=WN,E5=eb,ub=tb,mb=ab,xb=lb,hb=nb,fb=rb,pb=ib,gb=cb,jb=ob,vb=db;const M5=C5,A5=T5,z5=u.forwardRef(({className:a,inset:l,children:r,...c},d)=>e.jsxs(jb,{ref:d,className:P("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",l&&"pl-8",a),...c,children:[r,e.jsx(ra,{className:"ml-auto h-4 w-4"})]}));z5.displayName=jb.displayName;const R5=u.forwardRef(({className:a,...l},r)=>e.jsx(vb,{ref:r,className:P("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a),...l}));R5.displayName=vb.displayName;const Nb=u.forwardRef(({className:a,sideOffset:l=4,...r},c)=>e.jsx(E5,{children:e.jsx(ub,{ref:c,sideOffset:l,className:P("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a),...r})}));Nb.displayName=ub.displayName;const bb=u.forwardRef(({className:a,inset:l,...r},c)=>e.jsx(xb,{ref:c,className:P("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",l&&"pl-8",a),...r}));bb.displayName=xb.displayName;const D5=u.forwardRef(({className:a,children:l,checked:r,...c},d)=>e.jsxs(hb,{ref:d,className:P("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),checked:r,...c,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(pb,{children:e.jsx(Ot,{className:"h-4 w-4"})})}),l]}));D5.displayName=hb.displayName;const O5=u.forwardRef(({className:a,children:l,...r},c)=>e.jsxs(fb,{ref:c,className:P("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),...r,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(pb,{children:e.jsx(Vo,{className:"h-2 w-2 fill-current"})})}),l]}));O5.displayName=fb.displayName;const L5=u.forwardRef(({className:a,inset:l,...r},c)=>e.jsx(mb,{ref:c,className:P("px-2 py-1.5 text-sm font-semibold",l&&"pl-8",a),...r}));L5.displayName=mb.displayName;const U5=u.forwardRef(({className:a,...l},r)=>e.jsx(gb,{ref:r,className:P("-mx-1 my-1 h-px bg-muted",a),...l}));U5.displayName=gb.displayName;const Qm=[{value:"created_at",label:"ๆœ€ๆ–ฐๅ‘ๅธƒ",icon:da},{value:"downloads",label:"ไธ‹่ฝฝๆœ€ๅคš",icon:na},{value:"likes",label:"ๆœ€ๅ—ๆฌข่ฟŽ",icon:ei}];function $5(){const a=ha(),[l,r]=u.useState([]),[c,d]=u.useState(!0),[m,h]=u.useState(""),[f,p]=u.useState("downloads"),[g,N]=u.useState(1),[j,b]=u.useState(1),[y,w]=u.useState(0),[z,M]=u.useState(new Set),[S,F]=u.useState(new Set),E=cN(),C=u.useCallback(async()=>{d(!0);try{const L=await m4({status:"approved",page:g,page_size:12,search:m||void 0,sort_by:f,sort_order:"desc"});r(L.packs),b(L.total_pages),w(L.total);const me=new Set;for(const Ne of L.packs)await iN(Ne.id,E)&&me.add(Ne.id);M(me)}catch(L){console.error("ๅŠ ่ฝฝ Pack ๅˆ—่กจๅคฑ่ดฅ:",L),aa({title:"ๅŠ ่ฝฝ Pack ๅˆ—่กจๅคฑ่ดฅ",variant:"destructive"})}finally{d(!1)}},[g,m,f,E]);u.useEffect(()=>{C()},[C]);const R=L=>{L.preventDefault(),N(1),C()},H=async L=>{if(!S.has(L)){F(me=>new Set(me).add(L));try{const me=await rN(L,E);M(Ne=>{const je=new Set(Ne);return me.liked?je.add(L):je.delete(L),je}),r(Ne=>Ne.map(je=>je.id===L?{...je,likes:me.likes}:je))}catch(me){console.error("็‚น่ตžๅคฑ่ดฅ:",me),aa({title:"็‚น่ตžๅคฑ่ดฅ",variant:"destructive"})}finally{F(me=>{const Ne=new Set(me);return Ne.delete(L),Ne})}}},O=L=>{a({to:"/config/pack-market/$packId",params:{packId:L}})},X=Qm.find(L=>L.value===f)||Qm[0];return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsx("div",{className:"mb-4 sm:mb-6",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(xa,{className:"h-8 w-8",strokeWidth:2}),"้…็ฝฎๆจกๆฟๅธ‚ๅœบ"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"ๆต่งˆๅ’Œๅบ”็”จ็คพๅŒบๅˆ†ไบซ็š„ๆจกๅž‹้…็ฝฎๆจกๆฟ๏ผŒๅฟซ้€Ÿ้…็ฝฎไฝ ็š„ MaiBot"})]}),e.jsxs(_,{variant:"outline",onClick:C,disabled:c,className:"gap-2",children:[e.jsx(dt,{className:`h-4 w-4 ${c?"animate-spin":""}`}),"ๅˆทๆ–ฐ"]})]})}),e.jsx(ts,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-4 flex-wrap",children:[e.jsx("form",{onSubmit:R,className:"flex-1 min-w-[200px] max-w-md",children:e.jsxs("div",{className:"relative",children:[e.jsx($t,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(ne,{placeholder:"ๆœ็ดขๆจกๆฟๅ็งฐใ€ๆ่ฟฐ...",value:m,onChange:L=>h(L.target.value),className:"pl-10"})]})}),e.jsxs(M5,{children:[e.jsx(A5,{asChild:!0,children:e.jsxs(_,{variant:"outline",className:"min-w-[140px] gap-2",children:[e.jsx(s_,{className:"w-4 h-4"}),X.label,e.jsx(Ba,{className:"w-4 h-4 ml-auto"})]})}),e.jsx(Nb,{align:"end",children:Qm.map(L=>e.jsxs(bb,{onClick:()=>{p(L.value),N(1)},children:[e.jsx(L.icon,{className:"w-4 h-4 mr-2"}),L.label]},L.value))})]})]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:["ๅ…ฑๆ‰พๅˆฐ ",e.jsx("span",{className:"font-medium text-foreground",children:y})," ไธชๆจกๆฟ"]}),c?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Array.from({length:6}).map((L,me)=>e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(ks,{className:"h-6 w-3/4"}),e.jsx(ks,{className:"h-4 w-full mt-2"})]}),e.jsx(ze,{children:e.jsx(ks,{className:"h-20 w-full"})}),e.jsx(od,{children:e.jsx(ks,{className:"h-9 w-full"})})]},me))}):l.length===0?e.jsx(Te,{className:"py-12",children:e.jsxs(ze,{className:"text-center text-muted-foreground",children:[e.jsx(xa,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{className:"text-lg font-medium",children:"ๆš‚ๆ— ๆจกๆฟ"}),e.jsx("p",{className:"mt-1",children:"่ฟ˜ๆฒกๆœ‰ไบบๅˆ†ไบซ้…็ฝฎๆจกๆฟ๏ผŒๅฟซๆฅๅˆ†ไบซ็ฌฌไธ€ไธชๅง๏ผ"})]})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:l.map(L=>e.jsx(B5,{pack:L,liked:z.has(L.id),liking:S.has(L.id),onLike:()=>H(L.id),onView:()=>O(L.id)},L.id))}),j>1&&e.jsx(fx,{children:e.jsxs(px,{children:[e.jsx(Xn,{children:e.jsx($v,{onClick:()=>N(L=>Math.max(1,L-1)),className:g===1?"pointer-events-none opacity-50":"cursor-pointer"})}),Array.from({length:j},(L,me)=>me+1).filter(L=>L===1||L===j||Math.abs(L-g)<=1).map((L,me,Ne)=>{const je=me>0&&L-Ne[me-1]>1;return e.jsxs(Xn,{children:[je&&e.jsx("span",{className:"px-2",children:"..."}),e.jsx(jc,{onClick:()=>N(L),isActive:L===g,className:"cursor-pointer",children:L})]},L)}),e.jsx(Xn,{children:e.jsx(Bv,{onClick:()=>N(L=>Math.min(j,L+1)),className:g===j?"pointer-events-none opacity-50":"cursor-pointer"})})]})})]})})]})}function B5({pack:a,liked:l,liking:r,onLike:c,onView:d}){const m=h=>new Date(h).toLocaleDateString("zh-CN",{year:"numeric",month:"short",day:"numeric"});return e.jsxs(Te,{className:"flex flex-col hover:shadow-md transition-shadow",children:[e.jsxs(Oe,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx(Ue,{className:"text-lg line-clamp-1",children:a.name}),e.jsxs(Ce,{variant:"secondary",className:"text-xs",children:["v",a.version]})]}),e.jsx(Ns,{className:"line-clamp-2 min-h-[40px]",children:a.description})]}),e.jsxs(ze,{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(Fl,{className:"w-3.5 h-3.5"}),a.author]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(da,{className:"w-3.5 h-3.5"}),m(a.created_at)]})]}),e.jsxs("div",{className:"flex gap-4 text-sm",children:[e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",title:"ๆไพ›ๅ•†ๆ•ฐ้‡",children:[e.jsx(Hl,{className:"w-3.5 h-3.5"}),a.provider_count]}),e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",title:"ๆจกๅž‹ๆ•ฐ้‡",children:[e.jsx(Wn,{className:"w-3.5 h-3.5"}),a.model_count]}),e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",title:"ไปปๅŠก้…็ฝฎๆ•ฐ",children:[e.jsx(er,{className:"w-3.5 h-3.5"}),a.task_count]})]}),a.tags&&a.tags.length>0&&e.jsxs("div",{className:"flex flex-wrap gap-1",children:[a.tags.slice(0,3).map(h=>e.jsxs(Ce,{variant:"outline",className:"text-xs",children:[e.jsx(cd,{className:"w-2.5 h-2.5 mr-1"}),h]},h)),a.tags.length>3&&e.jsxs(Ce,{variant:"outline",className:"text-xs",children:["+",a.tags.length-3]})]})]}),e.jsx(od,{className:"pt-3 border-t",children:e.jsxs("div",{className:"flex items-center justify-between w-full",children:[e.jsxs("div",{className:"flex items-center gap-3 text-sm text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(na,{className:"w-4 h-4"}),a.downloads]}),e.jsxs("button",{onClick:h=>{h.stopPropagation(),c()},disabled:r,className:`flex items-center gap-1 transition-colors ${l?"text-red-500":"hover:text-red-500"} ${r?"opacity-50":""}`,children:[e.jsx(ei,{className:`w-4 h-4 ${l?"fill-current":""}`}),a.likes]})]}),e.jsx(_,{size:"sm",onClick:d,children:"ๆŸฅ็œ‹่ฏฆๆƒ…"})]})})]})}var ul="Accordion",I5=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Lx,P5,F5]=S1(ul),[Nd]=ld(ul,[F5,Lj]),Ux=Lj(),yb=Bs.forwardRef((a,l)=>{const{type:r,...c}=a,d=c,m=c;return e.jsx(Lx.Provider,{scope:a.__scopeAccordion,children:r==="multiple"?e.jsx(G5,{...m,ref:l}):e.jsx(V5,{...d,ref:l})})});yb.displayName=ul;var[wb,H5]=Nd(ul),[_b,q5]=Nd(ul,{collapsible:!1}),V5=Bs.forwardRef((a,l)=>{const{value:r,defaultValue:c,onValueChange:d=()=>{},collapsible:m=!1,...h}=a,[f,p]=ad({prop:r,defaultProp:c??"",onChange:d,caller:ul});return e.jsx(wb,{scope:a.__scopeAccordion,value:Bs.useMemo(()=>f?[f]:[],[f]),onItemOpen:p,onItemClose:Bs.useCallback(()=>m&&p(""),[m,p]),children:e.jsx(_b,{scope:a.__scopeAccordion,collapsible:m,children:e.jsx(Sb,{...h,ref:l})})})}),G5=Bs.forwardRef((a,l)=>{const{value:r,defaultValue:c,onValueChange:d=()=>{},...m}=a,[h,f]=ad({prop:r,defaultProp:c??[],onChange:d,caller:ul}),p=Bs.useCallback(N=>f((j=[])=>[...j,N]),[f]),g=Bs.useCallback(N=>f((j=[])=>j.filter(b=>b!==N)),[f]);return e.jsx(wb,{scope:a.__scopeAccordion,value:h,onItemOpen:p,onItemClose:g,children:e.jsx(_b,{scope:a.__scopeAccordion,collapsible:!0,children:e.jsx(Sb,{...m,ref:l})})})}),[K5,bd]=Nd(ul),Sb=Bs.forwardRef((a,l)=>{const{__scopeAccordion:r,disabled:c,dir:d,orientation:m="vertical",...h}=a,f=Bs.useRef(null),p=nd(f,l),g=P5(r),j=Wj(d)==="ltr",b=_n(a.onKeyDown,y=>{if(!I5.includes(y.key))return;const w=y.target,z=g().filter(X=>!X.ref.current?.disabled),M=z.findIndex(X=>X.ref.current===w),S=z.length;if(M===-1)return;y.preventDefault();let F=M;const E=0,C=S-1,R=()=>{F=M+1,F>C&&(F=E)},H=()=>{F=M-1,F{const{__scopeAccordion:r,value:c,...d}=a,m=bd(td,r),h=H5(td,r),f=Ux(r),p=Ym(),g=c&&h.value.includes(c)||!1,N=m.disabled||a.disabled;return e.jsx(Q5,{scope:r,open:g,disabled:N,triggerId:p,children:e.jsx(Mj,{"data-orientation":m.orientation,"data-state":zb(g),...f,...d,ref:l,disabled:N,open:g,onOpenChange:j=>{j?h.onItemOpen(c):h.onItemClose(c)}})})});kb.displayName=td;var Cb="AccordionHeader",Tb=Bs.forwardRef((a,l)=>{const{__scopeAccordion:r,...c}=a,d=bd(ul,r),m=$x(Cb,r);return e.jsx(ar.h3,{"data-orientation":d.orientation,"data-state":zb(m.open),"data-disabled":m.disabled?"":void 0,...c,ref:l})});Tb.displayName=Cb;var lx="AccordionTrigger",Eb=Bs.forwardRef((a,l)=>{const{__scopeAccordion:r,...c}=a,d=bd(ul,r),m=$x(lx,r),h=q5(lx,r),f=Ux(r);return e.jsx(Lx.ItemSlot,{scope:r,children:e.jsx(Jw,{"aria-disabled":m.open&&!h.collapsible||void 0,"data-orientation":d.orientation,id:m.triggerId,...f,...c,ref:l})})});Eb.displayName=lx;var Mb="AccordionContent",Ab=Bs.forwardRef((a,l)=>{const{__scopeAccordion:r,...c}=a,d=bd(ul,r),m=$x(Mb,r),h=Ux(r);return e.jsx(Xw,{role:"region","aria-labelledby":m.triggerId,"data-orientation":d.orientation,...h,...c,ref:l,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...a.style}})});Ab.displayName=Mb;function zb(a){return a?"open":"closed"}var Y5=yb,J5=kb,X5=Tb,Rb=Eb,Db=Ab;const Z5=Y5,Ob=u.forwardRef(({className:a,...l},r)=>e.jsx(J5,{ref:r,className:P("border-b",a),...l}));Ob.displayName="AccordionItem";const Lb=u.forwardRef(({className:a,children:l,...r},c)=>e.jsx(X5,{className:"flex",children:e.jsxs(Rb,{ref:c,className:P("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",a),...r,children:[l,e.jsx(Ba,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));Lb.displayName=Rb.displayName;const Ub=u.forwardRef(({className:a,children:l,...r},c)=>e.jsx(Db,{ref:c,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...r,children:e.jsx("div",{className:P("pb-4 pt-0",a),children:l})}));Ub.displayName=Db.displayName;const W5={utils:"้€š็”จๅทฅๅ…ท",utils_small:"่ฝป้‡ๅทฅๅ…ท",tool_use:"ๅทฅๅ…ท่ฐƒ็”จ",replyer:"ๅ›žๅค็”Ÿๆˆ",planner:"่ง„ๅˆ’ๆŽจ็†",vlm:"่ง†่ง‰ๆจกๅž‹",voice:"่ฏญ้Ÿณๅค„็†",embedding:"ๅ‘้‡ๅตŒๅ…ฅ",lpmm_entity_extract:"ๅฎžไฝ“ๆๅ–",lpmm_rdf_build:"RDFๆž„ๅปบ",lpmm_qa:"้—ฎ็ญ”ๆจกๅž‹"};function eT(){const{packId:a}=Pb.useParams(),l=ha(),[r,c]=u.useState(null),[d,m]=u.useState(!0),[h,f]=u.useState(!1),[p,g]=u.useState(!1),[N,j]=u.useState(!1),[b,y]=u.useState(1),[w,z]=u.useState(null),[M,S]=u.useState(!1),[F,E]=u.useState(!1),[C,R]=u.useState({apply_providers:!0,apply_models:!0,apply_task_config:!0,task_mode:"append",selected_providers:void 0,selected_models:void 0,selected_tasks:void 0}),[H,O]=u.useState({}),[X,L]=u.useState({}),me=cN(),Ne=u.useCallback(async()=>{if(a){m(!0);try{const D=await x4(a);c(D);const Q=await iN(a,me);f(Q)}catch(D){console.error("ๅŠ ่ฝฝ Pack ๅคฑ่ดฅ:",D),aa({title:"ๅŠ ่ฝฝๆจกๆฟๅคฑ่ดฅ",variant:"destructive"})}finally{m(!1)}}},[a,me]);u.useEffect(()=>{Ne()},[Ne]);const je=async()=>{if(!(!a||p)){g(!0);try{const D=await rN(a,me);f(D.liked),r&&c({...r,likes:D.likes})}catch(D){console.error("็‚น่ตžๅคฑ่ดฅ:",D),aa({title:"็‚น่ตžๅคฑ่ดฅ",variant:"destructive"})}finally{g(!1)}}},ce=async()=>{if(r){j(!0),y(1),S(!0);try{const D=await p4(r);z(D);const Q={};for(const ue of D.existing_providers)Q[ue.pack_provider.name]=ue.local_providers[0].name;O(Q);const B={};for(const ue of D.new_providers)B[ue.name]="";L(B)}catch(D){console.error("ๆฃ€ๆต‹ๅ†ฒ็ชๅคฑ่ดฅ:",D),aa({title:"ๆฃ€ๆต‹้…็ฝฎๅ†ฒ็ชๅคฑ่ดฅ",variant:"destructive"}),j(!1)}finally{S(!1)}}},ge=async()=>{if(r){if(C.apply_providers&&w){for(const D of w.new_providers)if(!X[D.name]){aa({title:`่ฏทๅกซๅ†™ๆไพ›ๅ•† "${D.name}" ็š„ API Key`,variant:"destructive"});return}}E(!0);try{await g4(r,C,H,X),await f4(r.id,me),c({...r,downloads:r.downloads+1}),aa({title:"้…็ฝฎๆจกๆฟๅบ”็”จๆˆๅŠŸ๏ผ"}),j(!1)}catch(D){console.error("ๅบ”็”จ Pack ๅคฑ่ดฅ:",D),aa({title:D instanceof Error?D.message:"ๅบ”็”จ้…็ฝฎๅคฑ่ดฅ",variant:"destructive"})}finally{E(!1)}}},pe=D=>new Date(D).toLocaleDateString("zh-CN",{year:"numeric",month:"long",day:"numeric"});return d?e.jsx(tT,{}):r?e.jsx("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:e.jsx(ts,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsxs(_,{variant:"ghost",size:"sm",onClick:()=>l({to:"/config/pack-market"}),className:"gap-2",children:[e.jsx($a,{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(xa,{className:"w-10 h-10 text-primary mt-1"}),e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[r.name,e.jsxs(Ce,{variant:"secondary",children:["v",r.version]})]}),e.jsx("p",{className:"text-muted-foreground mt-1",children:r.description})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-4 text-sm text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Fl,{className:"w-4 h-4"}),r.author]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(da,{className:"w-4 h-4"}),pe(r.created_at)]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(na,{className:"w-4 h-4"}),r.downloads," ๆฌกไธ‹่ฝฝ"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ei,{className:`w-4 h-4 ${h?"fill-red-500 text-red-500":""}`}),r.likes," ่ตž"]})]}),r.tags&&r.tags.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:r.tags.map(D=>e.jsxs(Ce,{variant:"outline",children:[e.jsx(cd,{className:"w-3 h-3 mr-1"}),D]},D))})]}),e.jsxs("div",{className:"flex flex-col gap-2 min-w-[160px]",children:[e.jsxs(_,{size:"lg",onClick:ce,children:[e.jsx(na,{className:"w-4 h-4 mr-2"}),"ๅบ”็”จๆจกๆฟ"]}),e.jsxs(_,{variant:"outline",onClick:je,disabled:p,className:h?"text-red-500 border-red-200":"",children:[e.jsx(ei,{className:`w-4 h-4 mr-2 ${h?"fill-current":""}`}),h?"ๅทฒ็‚น่ตž":"็‚น่ตž"]})]})]}),e.jsx(la,{}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsx(Te,{children:e.jsxs(ze,{className:"flex items-center gap-3 py-4",children:[e.jsx(Hl,{className:"w-8 h-8 text-blue-500 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:r.providers.length}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"API ๆไพ›ๅ•†"})]})]})}),e.jsx(Te,{children:e.jsxs(ze,{className:"flex items-center gap-3 py-4",children:[e.jsx(Wn,{className:"w-8 h-8 text-green-500 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:r.models.length}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๆจกๅž‹้…็ฝฎ"})]})]})}),e.jsx(Te,{children:e.jsxs(ze,{className:"flex items-center gap-3 py-4",children:[e.jsx(er,{className:"w-8 h-8 text-purple-500 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:Object.keys(r.task_config).length}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"ไปปๅŠก้…็ฝฎ"})]})]})})]}),e.jsxs(Jt,{defaultValue:"providers",className:"space-y-4",children:[e.jsxs(Gt,{className:"w-full sm:w-auto grid grid-cols-3 sm:flex",children:[e.jsxs(Xe,{value:"providers",className:"gap-1 sm:gap-2",children:[e.jsx(Hl,{className:"w-4 h-4"}),e.jsx("span",{className:"hidden sm:inline",children:"ๆไพ›ๅ•†"}),e.jsx("span",{className:"sm:hidden",children:"ๆไพ›ๅ•†"}),e.jsxs("span",{className:"hidden sm:inline",children:["(",r.providers.length,")"]})]}),e.jsxs(Xe,{value:"models",className:"gap-1 sm:gap-2",children:[e.jsx(Wn,{className:"w-4 h-4"}),e.jsx("span",{className:"hidden sm:inline",children:"ๆจกๅž‹"}),e.jsx("span",{className:"sm:hidden",children:"ๆจกๅž‹"}),e.jsxs("span",{className:"hidden sm:inline",children:["(",r.models.length,")"]})]}),e.jsxs(Xe,{value:"tasks",className:"gap-1 sm:gap-2",children:[e.jsx(er,{className:"w-4 h-4"}),e.jsx("span",{className:"hidden sm:inline",children:"ไปปๅŠก้…็ฝฎ"}),e.jsx("span",{className:"sm:hidden",children:"ไปปๅŠก"}),e.jsxs("span",{className:"hidden sm:inline",children:["(",Object.keys(r.task_config).length,")"]})]})]}),e.jsx(Ss,{value:"providers",children:e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"API ๆไพ›ๅ•†"}),e.jsx(Ns,{children:"ๆจกๆฟไธญๅŒ…ๅซ็š„ API ๆไพ›ๅ•†้…็ฝฎ๏ผˆไธๅซ API Key๏ผ‰"})]}),e.jsx(ze,{children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(ql,{children:[e.jsx(Vl,{children:e.jsxs(_t,{children:[e.jsx(ns,{children:"ๅ็งฐ"}),e.jsx(ns,{children:"Base URL"}),e.jsx(ns,{children:"็ฑปๅž‹"})]})}),e.jsx(Gl,{children:r.providers.map(D=>e.jsxs(_t,{children:[e.jsx(Ze,{className:"font-medium whitespace-nowrap",children:D.name}),e.jsx(Ze,{className:"text-muted-foreground font-mono text-sm max-w-[200px] truncate",children:D.base_url}),e.jsx(Ze,{children:e.jsx(Ce,{variant:"outline",children:D.client_type})})]},D.name))})]})})})]})}),e.jsx(Ss,{value:"models",children:e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"ๆจกๅž‹้…็ฝฎ"}),e.jsx(Ns,{children:"ๆจกๆฟไธญๅŒ…ๅซ็š„ๆจกๅž‹้…็ฝฎ"})]}),e.jsx(ze,{children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(ql,{children:[e.jsx(Vl,{children:e.jsxs(_t,{children:[e.jsx(ns,{children:"ๆจกๅž‹ๅ็งฐ"}),e.jsx(ns,{children:"ๆ ‡่ฏ†็ฌฆ"}),e.jsx(ns,{children:"ๆไพ›ๅ•†"}),e.jsx(ns,{className:"text-right",children:"ไปทๆ ผ (ๅ…ฅ/ๅ‡บ)"})]})}),e.jsx(Gl,{children:r.models.map(D=>e.jsxs(_t,{children:[e.jsx(Ze,{className:"font-medium whitespace-nowrap",children:D.name}),e.jsx(Ze,{className:"text-muted-foreground font-mono text-sm max-w-[150px] truncate",children:D.model_identifier}),e.jsx(Ze,{className:"whitespace-nowrap",children:D.api_provider}),e.jsxs(Ze,{className:"text-right text-muted-foreground whitespace-nowrap",children:["ยฅ",D.price_in," / ยฅ",D.price_out]})]},D.name))})]})})})]})}),e.jsx(Ss,{value:"tasks",children:e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"ไปปๅŠก้…็ฝฎ"}),e.jsx(Ns,{children:"ๆจกๆฟไธญๅ„ไปปๅŠก็ฑปๅž‹็š„ๆจกๅž‹ๅˆ†้…"})]}),e.jsx(ze,{children:e.jsx(Z5,{type:"multiple",className:"w-full",children:Object.entries(r.task_config).map(([D,Q])=>e.jsxs(Ob,{value:D,children:[e.jsx(Lb,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Sn,{className:"w-4 h-4"}),W5[D]||D,e.jsxs(Ce,{variant:"secondary",className:"ml-2",children:[Q.model_list.length," ไธชๆจกๅž‹"]})]})}),e.jsx(Ub,{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(B=>e.jsx(Ce,{variant:"outline",children:B},B))}),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})]})]})})]},D))})})]})})]}),e.jsx(sT,{open:N,onOpenChange:j,pack:r,step:b,setStep:y,conflicts:w,detectingConflicts:M,applying:F,options:C,setOptions:R,_providerMapping:H,_setProviderMapping:O,newProviderApiKeys:X,setNewProviderApiKeys:L,onApply:ge})]})})}):e.jsxs("div",{className:"text-center py-12",children:[e.jsx(xa,{className:"w-16 h-16 mx-auto mb-4 opacity-50"}),e.jsx("h2",{className:"text-xl font-semibold",children:"ๆจกๆฟไธๅญ˜ๅœจ"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"่ฏฅ้…็ฝฎๆจกๆฟๅฏ่ƒฝๅทฒ่ขซๅˆ ้™คๆˆ–ๅฐšๆœช้€š่ฟ‡ๅฎกๆ ธ"}),e.jsxs(_,{className:"mt-4",onClick:()=>l({to:"/config/pack-market"}),children:[e.jsx($a,{className:"w-4 h-4 mr-2"}),"่ฟ”ๅ›žๅธ‚ๅœบ"]})]})}function sT({open:a,onOpenChange:l,pack:r,step:c,setStep:d,conflicts:m,detectingConflicts:h,applying:f,options:p,setOptions:g,_providerMapping:N,_setProviderMapping:j,newProviderApiKeys:b,setNewProviderApiKeys:y,onApply:w}){return e.jsx(Qs,{open:a,onOpenChange:l,children:e.jsxs(Hs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(qs,{children:[e.jsxs(Vs,{className:"flex items-center gap-2",children:[e.jsx(xa,{className:"w-5 h-5"}),"ๅบ”็”จ้…็ฝฎๆจกๆฟ"]}),e.jsxs(at,{children:["ๆญฅ้ชค ",c," / ",3,"๏ผš",c===1&&"้€‰ๆ‹ฉ่ฆๅบ”็”จ็š„ๅ†…ๅฎน",c===2&&"้…็ฝฎๆไพ›ๅ•†ๆ˜ ๅฐ„",c===3&&"็กฎ่ฎคๅนถๅบ”็”จ"]})]}),h?e.jsxs("div",{className:"py-8 text-center",children:[e.jsx(Fs,{className:"w-8 h-8 mx-auto animate-spin text-primary"}),e.jsx("p",{className:"mt-4 text-muted-foreground",children:"ๆญฃๅœจๆฃ€ๆต‹้…็ฝฎๅ†ฒ็ช..."})]}):e.jsxs(e.Fragment,{children:[c===1&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(tt,{id:"apply_providers",checked:p.apply_providers,onCheckedChange:M=>g({...p,apply_providers:M})}),e.jsxs(T,{htmlFor:"apply_providers",className:"flex items-center gap-2",children:[e.jsx(Hl,{className:"w-4 h-4"}),"ๅบ”็”จๆไพ›ๅ•†้…็ฝฎ (",r.providers.length," ไธช)"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(tt,{id:"apply_models",checked:p.apply_models,onCheckedChange:M=>g({...p,apply_models:M})}),e.jsxs(T,{htmlFor:"apply_models",className:"flex items-center gap-2",children:[e.jsx(Wn,{className:"w-4 h-4"}),"ๅบ”็”จๆจกๅž‹้…็ฝฎ (",r.models.length," ไธช)"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(tt,{id:"apply_task_config",checked:p.apply_task_config,onCheckedChange:M=>g({...p,apply_task_config:M})}),e.jsxs(T,{htmlFor:"apply_task_config",className:"flex items-center gap-2",children:[e.jsx(er,{className:"w-4 h-4"}),"ๅบ”็”จไปปๅŠก้…็ฝฎ (",Object.keys(r.task_config).length," ไธช)"]})]})]}),p.apply_task_config&&e.jsxs("div",{className:"pl-6 space-y-2 border-l-2 border-muted",children:[e.jsx(T,{className:"text-sm font-medium",children:"ไปปๅŠก้…็ฝฎๅบ”็”จๆจกๅผ"}),e.jsxs(Rx,{value:p.task_mode,onValueChange:M=>g({...p,task_mode:M}),children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Wo,{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(Wo,{value:"replace",id:"mode_replace"}),e.jsx(T,{htmlFor:"mode_replace",className:"font-normal",children:"ๆ›ฟๆขๆจกๅผ - ็”จๆจกๆฟ้…็ฝฎๅฎŒๅ…จๆ›ฟๆข็Žฐๆœ‰้…็ฝฎ"})]})]})]})]}),c===2&&m&&e.jsxs("div",{className:"space-y-4",children:[p.apply_providers&&m.existing_providers.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs(ht,{children:[e.jsx(Yt,{className:"h-4 w-4"}),e.jsx(Jn,{children:"ๅ‘็Žฐๅทฒๆœ‰็š„ๆไพ›ๅ•†"}),e.jsx(ft,{children:"ไปฅไธ‹ๆไพ›ๅ•†็š„ URL ไธŽๆ‚จๆœฌๅœฐ้…็ฝฎไธญ็š„ๆไพ›ๅ•†ๅŒน้…๏ผŒๅฐ†่‡ชๅŠจไฝฟ็”จๆœฌๅœฐๆไพ›ๅ•†๏ผš"})]}),e.jsx("div",{className:"space-y-2",children:m.existing_providers.map(({pack_provider:M,local_providers:S})=>e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-lg",children:[e.jsx(Ot,{className:"w-4 h-4 text-green-500 flex-shrink-0"}),e.jsx("span",{className:"font-medium flex-shrink-0",children:M.name}),e.jsx(ra,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),S.length===1?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-muted-foreground",children:S[0].name}),e.jsx(Ce,{variant:"outline",className:"ml-auto",children:"URL ๅŒน้…"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(Pe,{value:N[M.name]||S[0].name,onValueChange:F=>j({...N,[M.name]:F}),children:[e.jsx(Be,{className:"w-[200px]",children:e.jsx(Fe,{})}),e.jsx(Ie,{children:S.map(F=>e.jsx(W,{value:F.name,children:F.name},F.name))})]}),e.jsxs(Ce,{variant:"outline",className:"ml-auto",children:[S.length," ไธชๅŒน้…"]})]})]},M.name))})]}),p.apply_providers&&m.new_providers.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs(ht,{variant:"destructive",children:[e.jsx(Lt,{className:"h-4 w-4"}),e.jsx(Jn,{children:"้œ€่ฆ้…็ฝฎ API Key"}),e.jsx(ft,{children:"ไปฅไธ‹ๆไพ›ๅ•†ๅœจๆ‚จ็š„ๆœฌๅœฐ้…็ฝฎไธญไธๅญ˜ๅœจ๏ผŒ้œ€่ฆๅกซๅ†™ API Key๏ผš"})]}),e.jsx("div",{className:"space-y-4",children:m.new_providers.map(M=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(cx,{className:"w-4 h-4 text-amber-500"}),e.jsx("span",{className:"font-medium",children:M.name}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",M.base_url,")"]})]}),e.jsx(ne,{type:"password",placeholder:`่พ“ๅ…ฅ ${M.name} ็š„ API Key`,value:b[M.name]||"",onChange:S=>y({...b,[M.name]:S.target.value})})]},M.name))})]}),(!p.apply_providers||m.existing_providers.length===0&&m.new_providers.length===0)&&e.jsxs(ht,{children:[e.jsx(Ot,{className:"h-4 w-4"}),e.jsx(Jn,{children:"ๆ— ้œ€้…็ฝฎ"}),e.jsx(ft,{children:"ๆจกๆฟไธญๆฒกๆœ‰ๆไพ›ๅ•†้…็ฝฎ๏ผŒๆˆ–ๆ‚จ้€‰ๆ‹ฉไธๅบ”็”จๆไพ›ๅ•†ใ€‚"})]})]}),c===3&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(ht,{children:[e.jsx(Yt,{className:"h-4 w-4"}),e.jsx(Jn,{children:"็กฎ่ฎคๅบ”็”จ"}),e.jsx(ft,{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(Ot,{className:"w-4 h-4 text-green-500"}),e.jsx(Hl,{className:"w-4 h-4"}),e.jsxs("span",{children:["ๅบ”็”จ ",r.providers.length," ไธชๆไพ›ๅ•†้…็ฝฎ"]})]}),p.apply_models&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Ot,{className:"w-4 h-4 text-green-500"}),e.jsx(Wn,{className:"w-4 h-4"}),e.jsxs("span",{children:["ๅบ”็”จ ",r.models.length," ไธชๆจกๅž‹้…็ฝฎ"]})]}),p.apply_task_config&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Ot,{className:"w-4 h-4 text-green-500"}),e.jsx(er,{className:"w-4 h-4"}),e.jsxs("span",{children:[p.task_mode==="append"?"่ฟฝๅŠ ":"ๆ›ฟๆข"," ",Object.keys(r.task_config).length," ไธชไปปๅŠก้…็ฝฎ"]})]})]}),m&&m.new_providers.length>0&&e.jsxs(ht,{variant:"destructive",children:[e.jsx(Lt,{className:"h-4 w-4"}),e.jsxs(ft,{children:["ๅฐ†ๆทปๅŠ  ",m.new_providers.length," ไธชๆ–ฐๆไพ›ๅ•†๏ผŒ่ฏท็กฎไฟๅทฒๅกซๅ†™ๆญฃ็กฎ็š„ API Keyใ€‚"]})]})]})]}),e.jsxs(gt,{className:"flex justify-between",children:[e.jsx("div",{children:c>1&&!h&&e.jsx(_,{variant:"outline",onClick:()=>d(c-1),disabled:f,children:"ไธŠไธ€ๆญฅ"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(_,{variant:"outline",onClick:()=>l(!1),disabled:f,children:"ๅ–ๆถˆ"}),c<3?e.jsx(_,{onClick:()=>d(c+1),disabled:h,children:"ไธ‹ไธ€ๆญฅ"}):e.jsxs(_,{onClick:w,disabled:f,children:[f&&e.jsx(Fs,{className:"w-4 h-4 mr-2 animate-spin"}),"ๅบ”็”จๆจกๆฟ"]})]})]})]})})}function tT(){return e.jsx("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:e.jsx(ts,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsx(ks,{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(ks,{className:"w-10 h-10"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(ks,{className:"h-8 w-2/3"}),e.jsx(ks,{className:"h-4 w-full"})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-4",children:[e.jsx(ks,{className:"h-4 w-24"}),e.jsx(ks,{className:"h-4 w-32"}),e.jsx(ks,{className:"h-4 w-28"}),e.jsx(ks,{className:"h-4 w-20"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(ks,{className:"h-6 w-20"}),e.jsx(ks,{className:"h-6 w-24"}),e.jsx(ks,{className:"h-6 w-16"})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 min-w-[160px]",children:[e.jsx(ks,{className:"h-10 w-full"}),e.jsx(ks,{className:"h-10 w-full"})]})]}),e.jsx(ks,{className:"h-px w-full"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsx(ks,{className:"h-24"}),e.jsx(ks,{className:"h-24"}),e.jsx(ks,{className:"h-24"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ks,{className:"h-10 w-32"}),e.jsx(ks,{className:"h-10 w-32"}),e.jsx(ks,{className:"h-10 w-32"})]}),e.jsx(ks,{className:"h-96 w-full"})]})]})})})}function aT(){const a=ha(),[l,r]=u.useState(!0);return u.useEffect(()=>{let c=!1;return(async()=>{try{const m=await dc();!c&&!m&&a({to:"/auth"})}catch{c||a({to:"/auth"})}finally{c||r(!1)}})(),()=>{c=!0}},[a]),{checking:l}}async function lT(){return await dc()}const nT=ti("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"}}),$b=u.forwardRef(({className:a,size:l,abbrTitle:r,children:c,...d},m)=>e.jsx("kbd",{className:P(nT({size:l,className:a})),ref:m,...d,children:r?e.jsx("abbr",{title:r,children:c}):c}));$b.displayName="Kbd";const rT=[{icon:id,title:"้ฆ–้กต",description:"ๆŸฅ็œ‹ไปช่กจๆฟๆฆ‚่งˆ",path:"/",category:"ๆฆ‚่งˆ"},{icon:Ua,title:"้บฆ้บฆไธป็จ‹ๅบ้…็ฝฎ",description:"้…็ฝฎ้บฆ้บฆ็š„ๆ ธๅฟƒ่ฎพ็ฝฎ",path:"/config/bot",category:"้…็ฝฎ"},{icon:Hl,title:"้บฆ้บฆๆจกๅž‹ๆไพ›ๅ•†้…็ฝฎ",description:"้…็ฝฎๆจกๅž‹ๆไพ›ๅ•†",path:"/config/modelProvider",category:"้…็ฝฎ"},{icon:gv,title:"้บฆ้บฆๆจกๅž‹้…็ฝฎ",description:"้…็ฝฎๆจกๅž‹ๅ‚ๆ•ฐ",path:"/config/model",category:"้…็ฝฎ"},{icon:rd,title:"่กจๆƒ…ๅŒ…็ฎก็†",description:"็ฎก็†้บฆ้บฆ็š„่กจๆƒ…ๅŒ…",path:"/resource/emoji",category:"่ต„ๆบ"},{icon:Ia,title:"่กจ่พพๆ–นๅผ็ฎก็†",description:"็ฎก็†้บฆ้บฆ็š„่กจ่พพๆ–นๅผ",path:"/resource/expression",category:"่ต„ๆบ"},{icon:jv,title:"ไบบ็‰ฉไฟกๆฏ็ฎก็†",description:"็ฎก็†ไบบ็‰ฉไฟกๆฏ",path:"/resource/person",category:"่ต„ๆบ"},{icon:Wr,title:"้ป‘่ฏ็ฎก็†",description:"็ฎก็†้บฆ้บฆๅญฆไน ๅˆฐ็š„้ป‘่ฏๅ’Œไฟš่ฏญ",path:"/resource/jargon",category:"่ต„ๆบ"},{icon:t_,title:"็ปŸ่ฎกไฟกๆฏ",description:"ๆŸฅ็œ‹ไฝฟ็”จ็ปŸ่ฎก",path:"/statistics",category:"็›‘ๆŽง"},{icon:xa,title:"ๆ’ไปถๅธ‚ๅœบ",description:"ๆต่งˆๅ’Œๅฎ‰่ฃ…ๆ’ไปถ",path:"/plugins",category:"ๆ‰ฉๅฑ•"},{icon:ux,title:"ๆ—ฅๅฟ—ๆŸฅ็œ‹ๅ™จ",description:"ๆŸฅ็œ‹็ณป็ปŸๆ—ฅๅฟ—",path:"/logs",category:"็›‘ๆŽง"},{icon:Sn,title:"็ณป็ปŸ่ฎพ็ฝฎ",description:"้…็ฝฎ็ณป็ปŸๅ‚ๆ•ฐ",path:"/settings",category:"็ณป็ปŸ"}];function iT({open:a,onOpenChange:l}){const[r,c]=u.useState(""),[d,m]=u.useState(0),h=ha(),f=rT.filter(N=>N.title.toLowerCase().includes(r.toLowerCase())||N.description.toLowerCase().includes(r.toLowerCase())||N.category.toLowerCase().includes(r.toLowerCase())),p=u.useCallback(N=>{h({to:N}),l(!1),c(""),m(0)},[h,l]),g=u.useCallback(N=>{N.key==="ArrowDown"?(N.preventDefault(),m(j=>(j+1)%f.length)):N.key==="ArrowUp"?(N.preventDefault(),m(j=>(j-1+f.length)%f.length)):N.key==="Enter"&&f[d]&&(N.preventDefault(),p(f[d].path))},[f,d,p]);return e.jsx(Qs,{open:a,onOpenChange:l,children:e.jsxs(Hs,{className:"max-w-2xl p-0 gap-0",children:[e.jsxs(qs,{className:"px-4 pt-4 pb-0",children:[e.jsx(Vs,{className:"sr-only",children:"ๆœ็ดข"}),e.jsxs("div",{className:"relative",children:[e.jsx($t,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground"}),e.jsx(ne,{value:r,onChange:N=>{c(N.target.value),m(0)},onKeyDown:g,placeholder:"ๆœ็ดข้กต้ข...",className:"h-12 pl-11 text-base border-0 focus-visible:ring-0 shadow-none",autoFocus:!0})]})]}),e.jsx("div",{className:"border-t",children:e.jsx(ts,{className:"h-[400px]",children:f.length>0?e.jsx("div",{className:"p-2",children:f.map((N,j)=>{const b=N.icon;return e.jsxs("button",{onClick:()=>p(N.path),onMouseEnter:()=>m(j),className:P("w-full flex items-center gap-3 px-3 py-2.5 rounded-md text-left transition-colors",j===d?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:[e.jsx(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($t,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:r?"ๆœชๆ‰พๅˆฐๅŒน้…็š„้กต้ข":"่พ“ๅ…ฅๅ…ณ้”ฎ่ฏๅผ€ๅง‹ๆœ็ดข"})]})})}),e.jsx("div",{className:"border-t px-4 py-3 flex items-center justify-between text-xs text-muted-foreground",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"โ†‘"}),e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"โ†“"}),"ๅฏผ่ˆช"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Enter"}),"้€‰ๆ‹ฉ"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Esc"}),"ๅ…ณ้—ญ"]})]})})]})})}function cT(){const a=window.location.protocol==="http:",l=window.location.hostname.toLowerCase(),r=l==="localhost"||l==="127.0.0.1"||l==="::1",c=sessionStorage.getItem("http-warning-dismissed")==="true",[d,m]=u.useState(a&&!r&&!c),[h,f]=u.useState(!1),p=()=>{f(!0),m(!1),sessionStorage.setItem("http-warning-dismissed","true")};return!d||h?null:e.jsx("div",{className:"relative bg-amber-500/10 border-b border-amber-500/20 backdrop-blur-sm",children:e.jsx("div",{className:"container mx-auto px-4 py-3",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e.jsx(Lt,{className:"h-5 w-5 text-amber-600 dark:text-amber-500 flex-shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("p",{className:"text-sm font-medium text-amber-900 dark:text-amber-100",children:[e.jsx("span",{className:"font-semibold",children:"ๅฎ‰ๅ…จ่ญฆๅ‘Š๏ผš"}),"ๆ‚จๆญฃๅœจไฝฟ็”จ ",e.jsx("strong",{children:"HTTP"})," ่ฎฟ้—ฎ MaiBot WebUI"]}),e.jsx("p",{className:"text-xs text-amber-800 dark:text-amber-200 mt-1",children:"ๅฆ‚ๆžœ่ฟ™ๆ˜ฏๅ…ฌ็ฝ‘ๆœๅŠกๅ™จ๏ผŒๆ‚จ็š„ๆ•ฐๆฎ๏ผˆๅŒ…ๆ‹ฌ Tokenใ€่Šๅคฉ่ฎฐๅฝ•็ญ‰๏ผ‰ๅฏ่ƒฝๅœจไผ ่พ“่ฟ‡็จ‹ไธญ่ขซ็ชƒๅ–ใ€‚ๅผบ็ƒˆๅปบ่ฎฎไฝฟ็”จ HTTPS ่ฎฟ้—ฎๆˆ–ไป…ๅœจๆœฌๅœฐ็ฝ‘็ปœไฝฟ็”จใ€‚"})]})]}),e.jsx(_,{variant:"ghost",size:"icon",onClick:p,className:"h-8 w-8 text-amber-700 hover:text-amber-900 dark:text-amber-400 dark:hover:text-amber-200 flex-shrink-0","aria-label":"ๅ…ณ้—ญ่ญฆๅ‘Š",children:e.jsx(Sa,{className:"h-4 w-4"})})]})})})}function oT(){const[a,l]=u.useState(0),[r,c]=u.useState(!1),d=u.useRef(null);u.useEffect(()=>{const g=N=>{const j=N.target;if(j.scrollHeight>j.clientHeight+100){d.current=j;const b=j.scrollTop,y=j.scrollHeight-j.clientHeight,w=y>0?b/y*100:0;l(w),c(b>300)}};return window.addEventListener("scroll",g,{capture:!0,passive:!0}),()=>window.removeEventListener("scroll",g,{capture:!0})},[]);const m=()=>{d.current?.scrollTo({top:0,behavior:"smooth"})},h=18,f=2*Math.PI*h,p=f-a/100*f;return e.jsx("div",{className:P("fixed bottom-24 right-8 z-50 transition-all duration-500 ease-in-out transform",r?"translate-x-0 opacity-100":"translate-x-32 opacity-0 pointer-events-none"),children:e.jsxs(_,{variant:"outline",size:"icon",className:P("relative h-12 w-12 rounded-full shadow-xl","bg-background/80 backdrop-blur-md border-border/50","hover:bg-accent hover:scale-110 hover:shadow-2xl hover:border-primary/50","transition-all duration-300","group"),onClick:m,"aria-label":"ๅ›žๅˆฐ้กถ้ƒจ",children:[e.jsxs("svg",{className:"absolute inset-0 h-full w-full -rotate-90 transform p-1",viewBox:"0 0 44 44",children:[e.jsx("circle",{className:"text-muted-foreground/10",strokeWidth:"3",stroke:"currentColor",fill:"transparent",r:h,cx:"22",cy:"22"}),e.jsx("circle",{className:"text-primary transition-all duration-100 ease-out",strokeWidth:"3",strokeDasharray:f,strokeDashoffset:p,strokeLinecap:"round",stroke:"currentColor",fill:"transparent",r:h,cx:"22",cy:"22"})]}),e.jsx(a_,{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"})]})})}function dT({children:a}){const{checking:l}=aT(),[r,c]=u.useState(!0),[d,m]=u.useState(!1),[h,f]=u.useState(!1),[p,g]=u.useState(!1),{theme:N,setTheme:j}=vx(),b=nw();if(u.useEffect(()=>{if(r)g(!1);else{const S=setTimeout(()=>{g(!0)},350);return()=>clearTimeout(S)}},[r]),u.useEffect(()=>{const S=F=>{(F.metaKey||F.ctrlKey)&&F.key==="k"&&(F.preventDefault(),f(!0))};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[]),l)return e.jsx("div",{className:"flex h-screen items-center justify-center bg-background",children:e.jsx("div",{className:"text-muted-foreground",children:"ๆญฃๅœจ้ชŒ่ฏ็™ปๅฝ•็Šถๆ€..."})});const y=[{title:"ๆฆ‚่งˆ",items:[{icon:id,label:"้ฆ–้กต",path:"/"}]},{title:"้บฆ้บฆ้…็ฝฎ็ผ–่พ‘",items:[{icon:Ua,label:"้บฆ้บฆไธป็จ‹ๅบ้…็ฝฎ",path:"/config/bot"},{icon:Hl,label:"AIๆจกๅž‹ๅŽ‚ๅ•†้…็ฝฎ",path:"/config/modelProvider",tourId:"sidebar-model-provider"},{icon:gv,label:"ๆจกๅž‹็ฎก็†ไธŽๅˆ†้…",path:"/config/model",tourId:"sidebar-model-management"},{icon:zg,label:"้บฆ้บฆ้€‚้…ๅ™จ้…็ฝฎ",path:"/config/adapter"}]},{title:"้บฆ้บฆ่ต„ๆบ็ฎก็†",items:[{icon:rd,label:"่กจๆƒ…ๅŒ…็ฎก็†",path:"/resource/emoji"},{icon:Ia,label:"่กจ่พพๆ–นๅผ็ฎก็†",path:"/resource/expression"},{icon:Wr,label:"้ป‘่ฏ็ฎก็†",path:"/resource/jargon"},{icon:jv,label:"ไบบ็‰ฉไฟกๆฏ็ฎก็†",path:"/resource/person"},{icon:xv,label:"็Ÿฅ่ฏ†ๅบ“ๅ›พ่ฐฑๅฏ่ง†ๅŒ–",path:"/resource/knowledge-graph"},{icon:Zr,label:"้บฆ้บฆ็Ÿฅ่ฏ†ๅบ“็ฎก็†",path:"/resource/knowledge-base"}]},{title:"ๆ‰ฉๅฑ•ไธŽ็›‘ๆŽง",items:[{icon:xa,label:"ๆ’ไปถๅธ‚ๅœบ",path:"/plugins"},{icon:fv,label:"้…็ฝฎๆจกๆฟๅธ‚ๅœบ",path:"/config/pack-market"},{icon:zg,label:"ๆ’ไปถ้…็ฝฎ",path:"/plugin-config"},{icon:ux,label:"ๆ—ฅๅฟ—ๆŸฅ็œ‹ๅ™จ",path:"/logs"},{icon:nx,label:"่ฎกๅˆ’ๅ™จ&ๅ›žๅคๅ™จ็›‘ๆŽง",path:"/planner-monitor"},{icon:Ia,label:"ๆœฌๅœฐ่Šๅคฉๅฎค",path:"/chat"}]},{title:"็ณป็ปŸ",items:[{icon:Sn,label:"็ณป็ปŸ่ฎพ็ฝฎ",path:"/settings"}]}],z=N==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":N,M=async()=>{await B_()};return e.jsx(Zv,{delayDuration:300,children:e.jsxs("div",{className:"flex h-screen overflow-hidden",children:[e.jsxs("aside",{className:P("fixed inset-y-0 left-0 z-50 flex flex-col border-r bg-card transition-all duration-300 lg:relative lg:z-0","w-64 lg:w-auto",r?"lg:w-64":"lg:w-16",d?"translate-x-0":"-translate-x-full lg:translate-x-0"),children:[e.jsx("div",{className:"flex h-16 items-center border-b px-4",children:e.jsxs("div",{className:P("relative flex items-center justify-center flex-1 transition-all overflow-hidden","lg:flex-1",!r&&"lg:flex-none lg:w-8"),children:[e.jsxs("div",{className:P("flex items-baseline gap-2",!r&&"lg:hidden"),children:[e.jsx("span",{className:"font-bold text-xl text-primary-gradient whitespace-nowrap",children:"MaiBot WebUI"}),e.jsx("span",{className:"text-xs text-primary/60 whitespace-nowrap",children:v2()})]}),!r&&e.jsx("span",{className:"hidden lg:block font-bold text-primary-gradient text-2xl",children:"M"})]})}),e.jsx(ts,{className:P("flex-1 overflow-x-hidden",!r&&"lg:w-16"),children:e.jsx("nav",{className:P("p-4",!r&&"lg:p-2 lg:w-16"),children:e.jsx("ul",{className:P("space-y-6",!r&&"lg:space-y-3 lg:w-full"),children:y.map((S,F)=>e.jsxs("li",{children:[e.jsx("div",{className:P("px-3 h-[1.25rem]","mb-2",!r&&"lg:mb-1 lg:invisible"),children:e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground/60 whitespace-nowrap",children:S.title})}),!r&&F>0&&e.jsx("div",{className:"hidden lg:block mb-2 border-t border-border"}),e.jsx("ul",{className:"space-y-1",children:S.items.map(E=>{const C=b({to:E.path}),R=E.icon,H=e.jsxs(e.Fragment,{children:[C&&e.jsx("div",{className:"absolute left-0 top-1/2 h-8 w-1 -translate-y-1/2 rounded-r-full bg-primary transition-opacity duration-300"}),e.jsxs("div",{className:P("flex items-center transition-all duration-300",r?"gap-3":"gap-3 lg:gap-0"),children:[e.jsx(R,{className:P("h-5 w-5 flex-shrink-0",C&&"text-primary"),strokeWidth:2,fill:"none"}),e.jsx("span",{className:P("text-sm font-medium whitespace-nowrap transition-all duration-300",C&&"font-semibold",r?"opacity-100 max-w-[200px]":"opacity-100 max-w-[200px] lg:opacity-0 lg:max-w-0 lg:overflow-hidden"),children:E.label})]})]});return e.jsx("li",{className:"relative",children:e.jsxs(Wv,{children:[e.jsx(eN,{asChild:!0,children:e.jsx(Kn,{to:E.path,"data-tour":E.tourId,className:P("relative flex items-center rounded-lg py-2 transition-all duration-300","hover:bg-accent hover:text-accent-foreground",C?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground",r?"px-3":"px-3 lg:px-0 lg:justify-center lg:w-12 lg:mx-auto"),onClick:()=>m(!1),children:H})}),p&&e.jsx(Tx,{side:"right",className:"hidden lg:block",children:e.jsx("p",{children:E.label})})]})},E.path)})})]},S.title))})})})]}),d&&e.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 lg:hidden",onClick:()=>m(!1)}),e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[e.jsx(cT,{}),e.jsxs("header",{className:"flex h-16 items-center justify-between border-b bg-card/80 backdrop-blur-md px-4 sticky top-0 z-10",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("button",{onClick:()=>m(!d),className:"rounded-lg p-2 hover:bg-accent lg:hidden",children:e.jsx(l_,{className:"h-5 w-5"})}),e.jsx("button",{onClick:()=>c(!r),className:"hidden rounded-lg p-2 hover:bg-accent lg:block",title:r?"ๆ”ถ่ตทไพง่พนๆ ":"ๅฑ•ๅผ€ไพง่พนๆ ",children:e.jsx(Pa,{className:P("h-5 w-5 transition-transform",!r&&"rotate-180")})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Kn,{to:"/annual-report",children:e.jsxs(_,{variant:"ghost",size:"sm",className:"gap-2 bg-gradient-to-r from-pink-500/10 to-purple-500/10 hover:from-pink-500/20 hover:to-purple-500/20 border border-pink-500/20",title:"ๆŸฅ็œ‹ๅนดๅบฆๆ€ป็ป“",children:[e.jsx(n_,{className:"h-4 w-4 text-pink-500"}),e.jsx("span",{className:"hidden sm:inline bg-gradient-to-r from-pink-500 to-purple-500 bg-clip-text text-transparent font-medium",children:"2025 ๅนดๅบฆๆ€ป็ป“"})]})}),e.jsxs("button",{onClick:()=>f(!0),className:"relative hidden md:flex items-center w-64 h-9 pl-9 pr-16 bg-background/50 border rounded-md hover:bg-accent/50 transition-colors text-left",children:[e.jsx($t,{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($b,{size:"sm",className:"absolute right-2 top-1/2 -translate-y-1/2",children:[e.jsx("span",{className:"text-xs",children:"โŒ˜"}),"K"]})]}),e.jsx(iT,{open:h,onOpenChange:f}),e.jsxs(_,{variant:"ghost",size:"sm",onClick:()=>window.open("https://docs.mai-mai.org","_blank"),className:"gap-2",title:"ๆŸฅ็œ‹้บฆ้บฆๆ–‡ๆกฃ",children:[e.jsx(r_,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"้บฆ้บฆๆ–‡ๆกฃ"})]}),e.jsx("button",{onClick:S=>{h2(z==="dark"?"light":"dark",j,S)},className:"rounded-lg p-2 hover:bg-accent",title:z==="dark"?"ๅˆ‡ๆขๅˆฐๆต…่‰ฒๆจกๅผ":"ๅˆ‡ๆขๅˆฐๆทฑ่‰ฒๆจกๅผ",children:z==="dark"?e.jsx(ix,{className:"h-5 w-5"}):e.jsx(tc,{className:"h-5 w-5"})}),e.jsx("div",{className:"h-6 w-px bg-border"}),e.jsxs(_,{variant:"ghost",size:"sm",onClick:M,className:"gap-2",title:"็™ปๅ‡บ็ณป็ปŸ",children:[e.jsx(i_,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"็™ปๅ‡บ"})]})]})]}),e.jsx("main",{className:"flex-1 overflow-hidden bg-background",children:a}),e.jsx(oT,{})]})]})})}function uT(a){const l=a.split(` + `,children:[e.jsx("div",{className:"w-12 h-12 rounded border overflow-hidden bg-muted flex-shrink-0 flex items-center justify-center",children:e.jsx("img",{src:X.previewUrl,alt:X.name,className:"max-w-full max-h-full object-contain"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:X.name}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:X.emotion||"ๆœชๅกซๅ†™ๆƒ…ๆ„Ÿๆ ‡็ญพ"})]}),L?e.jsx(st,{className:"h-5 w-5 text-green-500 flex-shrink-0"}):e.jsx("div",{className:"h-5 w-5 rounded-full border-2 border-muted-foreground/30 flex-shrink-0"})]},X.id)})})}),e.jsx("div",{className:"border rounded-lg p-4",children:M?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-16 h-16 rounded border overflow-hidden bg-muted flex items-center justify-center",children:e.jsx("img",{src:M.previewUrl,alt:M.name,className:"max-w-full max-h-full object-contain"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium truncate",children:M.name}),w(M)&&e.jsxs(Ce,{variant:"outline",className:"text-green-600 border-green-600",children:[e.jsx(Ot,{className:"h-3 w-3 mr-1"}),"ๅทฒๅฎŒๆˆ"]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"multi-emotion",children:["ๆƒ…ๆ„Ÿๆ ‡็ญพ ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ae,{id:"multi-emotion",value:M.emotion,onChange:X=>y(M.id,{emotion:X.target.value}),placeholder:"ๅคšไธชๆ ‡็ญพ็”จ้€—ๅทๅˆ†้š”๏ผŒๅฆ‚๏ผšๅผ€ๅฟƒ,้ซ˜ๅ…ด",className:M.emotion.trim()?"":"border-destructive"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"multi-description",children:"ๆ่ฟฐ"}),e.jsx(ae,{id:"multi-description",value:M.description,onChange:X=>y(M.id,{description:X.target.value}),placeholder:"่พ“ๅ…ฅ่กจๆƒ…ๅŒ…ๆ่ฟฐ..."})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(tt,{id:"multi-is-registered",checked:M.isRegistered,onCheckedChange:X=>y(M.id,{isRegistered:X===!0})}),e.jsx(T,{htmlFor:"multi-is-registered",className:"cursor-pointer text-sm",children:"ไธŠไผ ๅŽ็ซ‹ๅณๆณจๅ†Œ"})]})]}):e.jsx("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:e.jsxs("div",{className:"text-center",children:[e.jsx(xx,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"็‚นๅ‡ปๅทฆไพงๅก็‰‡็ผ–่พ‘"})]})})})]}),e.jsx(gt,{children:e.jsx(_,{onClick:F,disabled:!z||g,children:g?"ไธŠไผ ไธญ...":`ไธŠไผ ๅ…จ้ƒจ (${O})`})})]})};return e.jsx(Qs,{open:a,onOpenChange:l,children:e.jsxs(Hs,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[e.jsxs(qs,{children:[e.jsxs(Vs,{className:"flex items-center gap-2",children:[e.jsx(cc,{className:"h-5 w-5"}),c==="select"&&"ไธŠไผ ่กจๆƒ…ๅŒ… - ้€‰ๆ‹ฉๆ–‡ไปถ",c==="edit-single"&&"ไธŠไผ ่กจๆƒ…ๅŒ… - ๅกซๅ†™ไฟกๆฏ",c==="edit-multiple"&&"ไธŠไผ ่กจๆƒ…ๅŒ… - ๆ‰น้‡็ผ–่พ‘"]}),e.jsxs(at,{children:[c==="select"&&"ๆ”ฏๆŒ JPGใ€PNGใ€GIFใ€WebP ๆ ผๅผ๏ผŒๅ•ไธชๆ–‡ไปถๆœ€ๅคง 10MB๏ผŒๅฏๅŒๆ—ถไธŠไผ ๅคšไธชๆ–‡ไปถ",c==="edit-single"&&"่ฏทๅกซๅ†™่กจๆƒ…ๅŒ…็š„ๆƒ…ๆ„Ÿๆ ‡็ญพ๏ผˆๅฟ…ๅกซ๏ผ‰ๅ’Œๆ่ฟฐ",c==="edit-multiple"&&"็‚นๅ‡ปๅทฆไพงๅก็‰‡็ผ–่พ‘ๆฏไธช่กจๆƒ…ๅŒ…็š„ไฟกๆฏ๏ผŒๆƒ…ๆ„Ÿๆ ‡็ญพไธบๅฟ…ๅกซ้กน"]})]}),e.jsxs("div",{className:"overflow-y-auto pr-1",children:[c==="select"&&E(),c==="edit-single"&&C(),c==="edit-multiple"&&R()]})]})})}function ok(){const[a,l]=u.useState([]),[r,c]=u.useState(!0),[d,m]=u.useState(0),[h,f]=u.useState(1),[p,g]=u.useState(20),[N,j]=u.useState(""),[b,y]=u.useState(null),[w,z]=u.useState(!1),[M,S]=u.useState(!1),[F,E]=u.useState(!1),[C,R]=u.useState(null),[H,O]=u.useState(new Set),[X,L]=u.useState(!1),[me,Ne]=u.useState(""),[je,re]=u.useState({total:0,recent_7days:0,chat_count:0,top_chats:{}}),[ge,pe]=u.useState([]),[D,Q]=u.useState(new Map),[I,ue]=u.useState(!1),[Y,we]=u.useState(0),{toast:fe}=nt(),Ee=async()=>{try{c(!0);const ne=await a2({page:h,page_size:p,search:N||void 0});l(ne.data),m(ne.total)}catch(ne){fe({title:"ๅŠ ่ฝฝๅคฑ่ดฅ",description:ne instanceof Error?ne.message:"ๆ— ๆณ•ๅŠ ่ฝฝ่กจ่พพๆ–นๅผ",variant:"destructive"})}finally{c(!1)}},G=async()=>{try{const ne=await o2();ne?.data&&re(ne.data)}catch(ne){console.error("ๅŠ ่ฝฝ็ปŸ่ฎกๆ•ฐๆฎๅคฑ่ดฅ:",ne)}},$=async()=>{try{const ne=await jx();we(ne.unchecked)}catch(ne){console.error("ๅŠ ่ฝฝๅฎกๆ ธ็ปŸ่ฎกๅคฑ่ดฅ:",ne)}},A=async()=>{try{const ne=await gx();if(ne?.data){pe(ne.data);const De=new Map;ne.data.forEach(xe=>{De.set(xe.chat_id,xe.chat_name)}),Q(De)}}catch(ne){console.error("ๅŠ ่ฝฝ่Šๅคฉๅˆ—่กจๅคฑ่ดฅ:",ne)}},K=ne=>D.get(ne)||ne;u.useEffect(()=>{Ee(),$(),G(),A()},[h,p,N]);const Re=async ne=>{try{const De=await l2(ne.id);y(De.data),z(!0)}catch(De){fe({title:"ๅŠ ่ฝฝ่ฏฆๆƒ…ๅคฑ่ดฅ",description:De instanceof Error?De.message:"ๆ— ๆณ•ๅŠ ่ฝฝ่กจ่พพๆ–นๅผ่ฏฆๆƒ…",variant:"destructive"})}},se=ne=>{y(ne),S(!0)},$e=async ne=>{try{await i2(ne.id),fe({title:"ๅˆ ้™คๆˆๅŠŸ",description:`ๅทฒๅˆ ้™ค่กจ่พพๆ–นๅผ: ${ne.situation}`}),R(null),Ee(),G()}catch(De){fe({title:"ๅˆ ้™คๅคฑ่ดฅ",description:De instanceof Error?De.message:"ๆ— ๆณ•ๅˆ ้™ค่กจ่พพๆ–นๅผ",variant:"destructive"})}},cs=ne=>{const De=new Set(H);De.has(ne)?De.delete(ne):De.add(ne),O(De)},J=()=>{H.size===a.length&&a.length>0?O(new Set):O(new Set(a.map(ne=>ne.id)))},Z=async()=>{try{await c2(Array.from(H)),fe({title:"ๆ‰น้‡ๅˆ ้™คๆˆๅŠŸ",description:`ๅทฒๅˆ ้™ค ${H.size} ไธช่กจ่พพๆ–นๅผ`}),O(new Set),L(!1),Ee(),G()}catch(ne){fe({title:"ๆ‰น้‡ๅˆ ้™คๅคฑ่ดฅ",description:ne instanceof Error?ne.message:"ๆ— ๆณ•ๆ‰น้‡ๅˆ ้™ค่กจ่พพๆ–นๅผ",variant:"destructive"})}},Le=()=>{const ne=parseInt(me),De=Math.ceil(d/p);ne>=1&&ne<=De?(f(ne),Ne("")):fe({title:"ๆ— ๆ•ˆ็š„้กต็ ",description:`่ฏท่พ“ๅ…ฅ1-${De}ไน‹้—ด็š„้กต็ `,variant:"destructive"})};return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsx("div",{className:"mb-4 sm:mb-6",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(Ba,{className:"h-8 w-8",strokeWidth:2}),"่กจ่พพๆ–นๅผ็ฎก็†"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"็ฎก็†้บฆ้บฆ็š„่กจ่พพๆ–นๅผๅ’Œ่ฏๆœฏๆจกๆฟ"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(_,{variant:"outline",onClick:()=>ue(!0),className:"gap-2",children:[e.jsx(cv,{className:"h-4 w-4"}),"ไบบๅทฅๅฎกๆ ธ",Y>0&&e.jsx("span",{className:"ml-1 px-1.5 py-0.5 text-xs rounded-full bg-orange-500 text-white",children:Y>99?"99+":Y})]}),e.jsxs(_,{onClick:()=>E(!0),className:"gap-2",children:[e.jsx(Xs,{className:"h-4 w-4"}),"ๆ–ฐๅขž่กจ่พพๆ–นๅผ"]})]})]})}),e.jsx(ts,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"ๆ€ปๆ•ฐ้‡"}),e.jsx("div",{className:"text-2xl font-bold mt-1",children:je.total})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"่ฟ‘7ๅคฉๆ–ฐๅขž"}),e.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:je.recent_7days})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"ๅ…ณ่”่Šๅคฉๆ•ฐ"}),e.jsx("div",{className:"text-2xl font-bold mt-1 text-blue-600",children:je.chat_count})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx(T,{htmlFor:"search",children:"ๆœ็ดข"}),e.jsx("div",{className:"flex flex-col sm:flex-row gap-2 mt-1.5",children:e.jsxs("div",{className:"flex-1 relative",children:[e.jsx($t,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(ae,{id:"search",placeholder:"ๆœ็ดขๆƒ…ๅขƒใ€้ฃŽๆ ผๆˆ–ไธŠไธ‹ๆ–‡...",value:N,onChange:ne=>j(ne.target.value),className:"pl-9"})]})}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[e.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:H.size>0&&e.jsxs("span",{children:["ๅทฒ้€‰ๆ‹ฉ ",H.size," ไธช่กจ่พพๆ–นๅผ"]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"ๆฏ้กตๆ˜พ็คบ"}),e.jsxs(Pe,{value:p.toString(),onValueChange:ne=>{g(parseInt(ne)),f(1),O(new Set)},children:[e.jsx(Ie,{id:"page-size",className:"w-20",children:e.jsx(Fe,{})}),e.jsxs(Be,{children:[e.jsx(W,{value:"10",children:"10"}),e.jsx(W,{value:"20",children:"20"}),e.jsx(W,{value:"50",children:"50"}),e.jsx(W,{value:"100",children:"100"})]})]}),H.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>O(new Set),children:"ๅ–ๆถˆ้€‰ๆ‹ฉ"}),e.jsxs(_,{variant:"destructive",size:"sm",onClick:()=>L(!0),children:[e.jsx(os,{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(ql,{children:[e.jsx(Vl,{children:e.jsxs(_t,{children:[e.jsx(ns,{className:"w-12",children:e.jsx(tt,{checked:H.size===a.length&&a.length>0,onCheckedChange:J})}),e.jsx(ns,{children:"ๆƒ…ๅขƒ"}),e.jsx(ns,{children:"้ฃŽๆ ผ"}),e.jsx(ns,{children:"่Šๅคฉ"}),e.jsx(ns,{className:"text-right",children:"ๆ“ไฝœ"})]})}),e.jsx(Gl,{children:r?e.jsx(_t,{children:e.jsx(Ze,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"ๅŠ ่ฝฝไธญ..."})}):a.length===0?e.jsx(_t,{children:e.jsx(Ze,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"ๆš‚ๆ— ๆ•ฐๆฎ"})}):a.map(ne=>e.jsxs(_t,{children:[e.jsx(Ze,{children:e.jsx(tt,{checked:H.has(ne.id),onCheckedChange:()=>cs(ne.id)})}),e.jsx(Ze,{className:"font-medium max-w-xs truncate",children:ne.situation}),e.jsx(Ze,{className:"max-w-xs truncate",children:ne.style}),e.jsx(Ze,{className:"max-w-[200px] truncate",title:K(ne.chat_id),style:{wordBreak:"keep-all"},children:e.jsx("span",{className:"whitespace-nowrap overflow-hidden text-ellipsis block",children:K(ne.chat_id)})}),e.jsx(Ze,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>se(ne),children:[e.jsx(sr,{className:"h-4 w-4 mr-1"}),"็ผ–่พ‘"]}),e.jsx(_,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>Re(ne),title:"ๆŸฅ็œ‹่ฏฆๆƒ…",children:e.jsx(ua,{className:"h-4 w-4"})}),e.jsxs(_,{size:"sm",onClick:()=>R(ne),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(os,{className:"h-4 w-4 mr-1"}),"ๅˆ ้™ค"]})]})})]},ne.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3 p-4",children:r?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"ๅŠ ่ฝฝไธญ..."}):a.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"ๆš‚ๆ— ๆ•ฐๆฎ"}):a.map(ne=>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(tt,{checked:H.has(ne.id),onCheckedChange:()=>cs(ne.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:ne.situation,children:ne.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:ne.style,children:ne.style})]})]})]}),e.jsxs("div",{className:"text-sm",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"่Šๅคฉ"}),e.jsx("p",{className:"text-sm truncate",title:K(ne.chat_id),style:{wordBreak:"keep-all"},children:K(ne.chat_id)})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>se(ne),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(sr,{className:"h-3 w-3 mr-1"}),"็ผ–่พ‘"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>Re(ne),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:e.jsx(ua,{className:"h-3 w-3"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>R(ne),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[e.jsx(os,{className:"h-3 w-3 mr-1"}),"ๅˆ ้™ค"]})]})]},ne.id))}),d>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["ๅ…ฑ ",d," ๆก่ฎฐๅฝ•๏ผŒ็ฌฌ ",h," / ",Math.ceil(d/p)," ้กต"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(kn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h-1),disabled:h===1,children:[e.jsx(Pa,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"ไธŠไธ€้กต"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae,{type:"number",value:me,onChange:ne=>Ne(ne.target.value),onKeyDown:ne=>ne.key==="Enter"&&Le(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(d/p)}),e.jsx(_,{variant:"outline",size:"sm",onClick:Le,disabled:!me,className:"h-8",children:"่ทณ่ฝฌ"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h+1),disabled:h>=Math.ceil(d/p),children:[e.jsx("span",{className:"hidden sm:inline",children:"ไธ‹ไธ€้กต"}),e.jsx(ra,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(d/p)),disabled:h>=Math.ceil(d/p),className:"hidden sm:flex",children:e.jsx(Cn,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(dk,{expression:b,open:w,onOpenChange:z,chatNameMap:D}),e.jsx(uk,{open:F,onOpenChange:E,chatList:ge,onSuccess:()=>{Ee(),G(),E(!1)}}),e.jsx(mk,{expression:b,open:M,onOpenChange:S,chatList:ge,onSuccess:()=>{Ee(),G(),S(!1)}}),e.jsx(bs,{open:!!C,onOpenChange:()=>R(null),children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsxs(gs,{children:['็กฎๅฎš่ฆๅˆ ้™ค่กจ่พพๆ–นๅผ "',C?.situation,'" ๅ—๏ผŸ ๆญคๆ“ไฝœไธๅฏๆ’ค้”€ใ€‚']})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:()=>C&&$e(C),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"ๅˆ ้™ค"})]})]})}),e.jsx(xk,{open:X,onOpenChange:L,onConfirm:Z,count:H.size}),e.jsx(Pv,{open:I,onOpenChange:ne=>{ue(ne),ne||(Ee(),G(),$())}})]})}function dk({expression:a,open:l,onOpenChange:r,chatNameMap:c}){if(!a)return null;const d=h=>h?new Date(h*1e3).toLocaleString("zh-CN"):"-",m=h=>c.get(h)||h;return e.jsx(Qs,{open:l,onOpenChange:r,children:e.jsxs(Hs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"่กจ่พพๆ–นๅผ่ฏฆๆƒ…"}),e.jsx(at,{children:"ๆŸฅ็œ‹่กจ่พพๆ–นๅผ็š„ๅฎŒๆ•ดไฟกๆฏ"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Yi,{label:"ๆƒ…ๅขƒ",value:a.situation}),e.jsx(Yi,{label:"้ฃŽๆ ผ",value:a.style}),e.jsx(Yi,{label:"่Šๅคฉ",value:m(a.chat_id)}),e.jsx(Yi,{icon:Wr,label:"่ฎฐๅฝ•ID",value:a.id.toString(),mono:!0})]}),e.jsx("div",{className:"grid grid-cols-2 gap-4",children:e.jsx(Yi,{icon:da,label:"ๅˆ›ๅปบๆ—ถ้—ด",value:d(a.create_date)})}),e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-4",children:[e.jsx(T,{className:"text-xs text-muted-foreground mb-3 block",children:"็Šถๆ€ๆ ‡่ฎฐ"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:P("flex h-8 w-8 items-center justify-center rounded-full",a.checked?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-400 dark:bg-gray-800 dark:text-gray-600"),children:a.checked?e.jsx(st,{className:"h-5 w-5"}):e.jsx(Vo,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"ๅทฒๆฃ€ๆŸฅ"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a.checked?"ๅทฒ้€š่ฟ‡ๅฎกๆ ธ":"ๆœชๅฎกๆ ธ"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:P("flex h-8 w-8 items-center justify-center rounded-full",a.rejected?"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400":"bg-gray-100 text-gray-400 dark:bg-gray-800 dark:text-gray-600"),children:a.rejected?e.jsx(ta,{className:"h-5 w-5"}):e.jsx(Vo,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"ๅทฒๆ‹’็ป"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a.rejected?"ไธไผš่ขซไฝฟ็”จ":"ๆญฃๅธธ"})]})]})]})]})]}),e.jsx(gt,{children:e.jsx(_,{onClick:()=>r(!1),children:"ๅ…ณ้—ญ"})})]})})}function Yi({icon:a,label:l,value:r,mono:c=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(T,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[a&&e.jsx(a,{className:"h-3 w-3"}),l]}),e.jsx("div",{className:P("text-sm",c&&"font-mono",!r&&"text-muted-foreground"),children:r||"-"})]})}function uk({open:a,onOpenChange:l,chatList:r,onSuccess:c}){const[d,m]=u.useState({situation:"",style:"",chat_id:""}),[h,f]=u.useState(!1),{toast:p}=nt(),g=async()=>{if(!d.situation||!d.style||!d.chat_id){p({title:"้ชŒ่ฏๅคฑ่ดฅ",description:"่ฏทๅกซๅ†™ๅฟ…ๅกซๅญ—ๆฎต๏ผšๆƒ…ๅขƒใ€้ฃŽๆ ผๅ’Œ่Šๅคฉ",variant:"destructive"});return}try{f(!0),await n2(d),p({title:"ๅˆ›ๅปบๆˆๅŠŸ",description:"่กจ่พพๆ–นๅผๅทฒๅˆ›ๅปบ"}),m({situation:"",style:"",chat_id:""}),c()}catch(N){p({title:"ๅˆ›ๅปบๅคฑ่ดฅ",description:N instanceof Error?N.message:"ๆ— ๆณ•ๅˆ›ๅปบ่กจ่พพๆ–นๅผ",variant:"destructive"})}finally{f(!1)}};return e.jsx(Qs,{open:a,onOpenChange:l,children:e.jsxs(Hs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"ๆ–ฐๅขž่กจ่พพๆ–นๅผ"}),e.jsx(at,{children:"ๅˆ›ๅปบๆ–ฐ็š„่กจ่พพๆ–นๅผ่ฎฐๅฝ•"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"situation",children:["ๆƒ…ๅขƒ ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ae,{id:"situation",value:d.situation,onChange:N=>m({...d,situation:N.target.value}),placeholder:"ๆ่ฟฐไฝฟ็”จๅœบๆ™ฏ"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"style",children:["้ฃŽๆ ผ ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ae,{id:"style",value:d.style,onChange:N=>m({...d,style:N.target.value}),placeholder:"ๆ่ฟฐ่กจ่พพ้ฃŽๆ ผ"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"chat_id",children:["่Šๅคฉ ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs(Pe,{value:d.chat_id,onValueChange:N=>m({...d,chat_id:N}),children:[e.jsx(Ie,{children:e.jsx(Fe,{placeholder:"้€‰ๆ‹ฉๅ…ณ่”็š„่Šๅคฉ"})}),e.jsx(Be,{children:r.map(N=>e.jsx(W,{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(gt,{children:[e.jsx(_,{variant:"outline",onClick:()=>l(!1),children:"ๅ–ๆถˆ"}),e.jsx(_,{onClick:g,disabled:h,children:h?"ๅˆ›ๅปบไธญ...":"ๅˆ›ๅปบ"})]})]})})}function mk({expression:a,open:l,onOpenChange:r,chatList:c,onSuccess:d}){const[m,h]=u.useState({}),[f,p]=u.useState(!1),{toast:g}=nt();u.useEffect(()=>{a&&h({situation:a.situation,style:a.style,chat_id:a.chat_id,checked:a.checked,rejected:a.rejected})},[a]);const N=async()=>{if(a)try{p(!0),await r2(a.id,m),g({title:"ไฟๅญ˜ๆˆๅŠŸ",description:"่กจ่พพๆ–นๅผๅทฒๆ›ดๆ–ฐ"}),d()}catch(j){g({title:"ไฟๅญ˜ๅคฑ่ดฅ",description:j instanceof Error?j.message:"ๆ— ๆณ•ๆ›ดๆ–ฐ่กจ่พพๆ–นๅผ",variant:"destructive"})}finally{p(!1)}};return a?e.jsx(Qs,{open:l,onOpenChange:r,children:e.jsxs(Hs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"็ผ–่พ‘่กจ่พพๆ–นๅผ"}),e.jsx(at,{children:"ไฟฎๆ”น่กจ่พพๆ–นๅผ็š„ไฟกๆฏ"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_situation",children:"ๆƒ…ๅขƒ"}),e.jsx(ae,{id:"edit_situation",value:m.situation||"",onChange:j=>h({...m,situation:j.target.value}),placeholder:"ๆ่ฟฐไฝฟ็”จๅœบๆ™ฏ"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_style",children:"้ฃŽๆ ผ"}),e.jsx(ae,{id:"edit_style",value:m.style||"",onChange:j=>h({...m,style:j.target.value}),placeholder:"ๆ่ฟฐ่กจ่พพ้ฃŽๆ ผ"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_chat_id",children:"่Šๅคฉ"}),e.jsxs(Pe,{value:m.chat_id||"",onValueChange:j=>h({...m,chat_id:j}),children:[e.jsx(Ie,{children:e.jsx(Fe,{placeholder:"้€‰ๆ‹ฉๅ…ณ่”็š„่Šๅคฉ"})}),e.jsx(Be,{children:c.map(j=>e.jsx(W,{value:j.chat_id,children:e.jsxs("span",{className:"truncate",style:{wordBreak:"keep-all"},children:[j.chat_name,j.is_group&&e.jsx("span",{className:"text-muted-foreground ml-1",children:"(็พค่Š)"})]})},j.chat_id))})]})]}),e.jsxs(ht,{children:[e.jsx(Yt,{className:"h-4 w-4"}),e.jsx(ft,{className:"text-xs",children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{children:e.jsx("strong",{children:"็Šถๆ€ๆ ‡่ฎฐ่ฏดๆ˜Ž๏ผš"})}),e.jsx("p",{children:"โ€ข ๅทฒๆฃ€ๆŸฅ๏ผš่กจ็คบ่ฏฅ่กจ่พพๆ–นๅผๅทฒ้€š่ฟ‡ๅฎกๆ ธ๏ผˆๅฏ็”ฑAI่‡ชๅŠจๆฃ€ๆŸฅๆˆ–ไบบๅทฅๅฎกๆ ธ๏ผ‰"}),e.jsx("p",{children:"โ€ข ๅทฒๆ‹’็ป๏ผš่กจ็คบ่ฏฅ่กจ่พพๆ–นๅผ่ขซๆ ‡่ฎฐไธบไธๅˆ้€‚๏ผŒๅฐ†ๆฐธ่ฟœไธไผš่ขซไฝฟ็”จ"}),e.jsxs("p",{className:"text-muted-foreground mt-2",children:['ๆ นๆฎ้…็ฝฎไธญ"ไป…ไฝฟ็”จๅทฒๅฎกๆ ธ้€š่ฟ‡็š„่กจ่พพๆ–นๅผ"่ฎพ็ฝฎ๏ผš',e.jsx("br",{}),"โ€ข ๅผ€ๅฏๆ—ถ๏ผšๅชๆœ‰้€š่ฟ‡ๅฎกๆ ธ๏ผˆๅทฒๆฃ€ๆŸฅ๏ผ‰็š„้กน็›ฎไผš่ขซไฝฟ็”จ",e.jsx("br",{}),"โ€ข ๅ…ณ้—ญๆ—ถ๏ผšๆœชๅฎกๆ ธ็š„้กน็›ฎไนŸไผš่ขซไฝฟ็”จ"]})]})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"flex items-center justify-between space-x-2 rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{htmlFor:"edit_checked",className:"text-sm font-medium",children:"ๅทฒๆฃ€ๆŸฅ"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๅทฒ้€š่ฟ‡ๅฎกๆ ธ"})]}),e.jsx(qe,{id:"edit_checked",checked:m.checked??!1,onCheckedChange:j=>h({...m,checked:j})})]}),e.jsxs("div",{className:"flex items-center justify-between space-x-2 rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{htmlFor:"edit_rejected",className:"text-sm font-medium",children:"ๅทฒๆ‹’็ป"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ไธไผš่ขซไฝฟ็”จ"})]}),e.jsx(qe,{id:"edit_rejected",checked:m.rejected??!1,onCheckedChange:j=>h({...m,rejected:j})})]})]})]}),e.jsxs(gt,{children:[e.jsx(_,{variant:"outline",onClick:()=>r(!1),children:"ๅ–ๆถˆ"}),e.jsx(_,{onClick:N,disabled:f,children:f?"ไฟๅญ˜ไธญ...":"ไฟๅญ˜"})]})]})}):null}function xk({open:a,onOpenChange:l,onConfirm:r,count:c}){return e.jsx(bs,{open:a,onOpenChange:l,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๆ‰น้‡ๅˆ ้™ค"}),e.jsxs(gs,{children:["ๆ‚จๅณๅฐ†ๅˆ ้™ค ",c," ไธช่กจ่พพๆ–นๅผ๏ผŒๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚็กฎๅฎš่ฆ็ปง็ปญๅ—๏ผŸ"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:r,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"็กฎ่ฎคๅˆ ้™ค"})]})]})})}const Kl="/api/webui/jargon";async function hk(){const a=await ke(`${Kl}/chats`,{});if(!a.ok){const l=await a.json();throw new Error(l.detail||"่Žทๅ–่Šๅคฉๅˆ—่กจๅคฑ่ดฅ")}return a.json()}async function fk(a){const l=new URLSearchParams;a.page&&l.append("page",a.page.toString()),a.page_size&&l.append("page_size",a.page_size.toString()),a.search&&l.append("search",a.search),a.chat_id&&l.append("chat_id",a.chat_id),a.is_jargon!==void 0&&a.is_jargon!==null&&l.append("is_jargon",a.is_jargon.toString()),a.is_global!==void 0&&l.append("is_global",a.is_global.toString());const r=await ke(`${Kl}/list?${l}`,{});if(!r.ok){const c=await r.json();throw new Error(c.detail||"่Žทๅ–้ป‘่ฏๅˆ—่กจๅคฑ่ดฅ")}return r.json()}async function pk(a){const l=await ke(`${Kl}/${a}`,{});if(!l.ok){const r=await l.json();throw new Error(r.detail||"่Žทๅ–้ป‘่ฏ่ฏฆๆƒ…ๅคฑ่ดฅ")}return l.json()}async function gk(a){const l=await ke(`${Kl}/`,{method:"POST",body:JSON.stringify(a)});if(!l.ok){const r=await l.json();throw new Error(r.detail||"ๅˆ›ๅปบ้ป‘่ฏๅคฑ่ดฅ")}return l.json()}async function jk(a,l){const r=await ke(`${Kl}/${a}`,{method:"PATCH",body:JSON.stringify(l)});if(!r.ok){const c=await r.json();throw new Error(c.detail||"ๆ›ดๆ–ฐ้ป‘่ฏๅคฑ่ดฅ")}return r.json()}async function vk(a){const l=await ke(`${Kl}/${a}`,{method:"DELETE"});if(!l.ok){const r=await l.json();throw new Error(r.detail||"ๅˆ ้™ค้ป‘่ฏๅคฑ่ดฅ")}return l.json()}async function Nk(a){const l=await ke(`${Kl}/batch/delete`,{method:"POST",body:JSON.stringify({ids:a})});if(!l.ok){const r=await l.json();throw new Error(r.detail||"ๆ‰น้‡ๅˆ ้™ค้ป‘่ฏๅคฑ่ดฅ")}return l.json()}async function bk(){const a=await ke(`${Kl}/stats/summary`,{});if(!a.ok){const l=await a.json();throw new Error(l.detail||"่Žทๅ–้ป‘่ฏ็ปŸ่ฎกๅคฑ่ดฅ")}return a.json()}async function yk(a,l){const r=new URLSearchParams;a.forEach(d=>r.append("ids",d.toString())),r.append("is_jargon",l.toString());const c=await ke(`${Kl}/batch/set-jargon?${r}`,{method:"POST"});if(!c.ok){const d=await c.json();throw new Error(d.detail||"ๆ‰น้‡่ฎพ็ฝฎ้ป‘่ฏ็Šถๆ€ๅคฑ่ดฅ")}return c.json()}function wk(){const[a,l]=u.useState([]),[r,c]=u.useState(!0),[d,m]=u.useState(0),[h,f]=u.useState(1),[p,g]=u.useState(20),[N,j]=u.useState(""),[b,y]=u.useState("all"),[w,z]=u.useState("all"),[M,S]=u.useState(null),[F,E]=u.useState(!1),[C,R]=u.useState(!1),[H,O]=u.useState(!1),[X,L]=u.useState(null),[me,Ne]=u.useState(new Set),[je,re]=u.useState(!1),[ge,pe]=u.useState(""),[D,Q]=u.useState({total:0,confirmed_jargon:0,confirmed_not_jargon:0,pending:0,global_count:0,complete_count:0,chat_count:0,top_chats:{}}),[I,ue]=u.useState([]),{toast:Y}=nt(),we=async()=>{try{c(!0);const Z=await fk({page:h,page_size:p,search:N||void 0,chat_id:b==="all"?void 0:b,is_jargon:w==="all"?void 0:w==="true"?!0:w==="false"?!1:void 0});l(Z.data),m(Z.total)}catch(Z){Y({title:"ๅŠ ่ฝฝๅคฑ่ดฅ",description:Z instanceof Error?Z.message:"ๆ— ๆณ•ๅŠ ่ฝฝ้ป‘่ฏๅˆ—่กจ",variant:"destructive"})}finally{c(!1)}},fe=async()=>{try{const Z=await bk();Z?.data&&Q(Z.data)}catch(Z){console.error("ๅŠ ่ฝฝ็ปŸ่ฎกๆ•ฐๆฎๅคฑ่ดฅ:",Z)}},Ee=async()=>{try{const Z=await hk();Z?.data&&ue(Z.data)}catch(Z){console.error("ๅŠ ่ฝฝ่Šๅคฉๅˆ—่กจๅคฑ่ดฅ:",Z)}};u.useEffect(()=>{we(),fe(),Ee()},[h,p,N,b,w]);const G=async Z=>{try{const Le=await pk(Z.id);S(Le.data),E(!0)}catch(Le){Y({title:"ๅŠ ่ฝฝ่ฏฆๆƒ…ๅคฑ่ดฅ",description:Le instanceof Error?Le.message:"ๆ— ๆณ•ๅŠ ่ฝฝ้ป‘่ฏ่ฏฆๆƒ…",variant:"destructive"})}},$=Z=>{S(Z),R(!0)},A=async Z=>{try{await vk(Z.id),Y({title:"ๅˆ ้™คๆˆๅŠŸ",description:`ๅทฒๅˆ ้™ค้ป‘่ฏ: ${Z.content}`}),L(null),we(),fe()}catch(Le){Y({title:"ๅˆ ้™คๅคฑ่ดฅ",description:Le instanceof Error?Le.message:"ๆ— ๆณ•ๅˆ ้™ค้ป‘่ฏ",variant:"destructive"})}},K=Z=>{const Le=new Set(me);Le.has(Z)?Le.delete(Z):Le.add(Z),Ne(Le)},Re=()=>{me.size===a.length&&a.length>0?Ne(new Set):Ne(new Set(a.map(Z=>Z.id)))},se=async()=>{try{await Nk(Array.from(me)),Y({title:"ๆ‰น้‡ๅˆ ้™คๆˆๅŠŸ",description:`ๅทฒๅˆ ้™ค ${me.size} ไธช้ป‘่ฏ`}),Ne(new Set),re(!1),we(),fe()}catch(Z){Y({title:"ๆ‰น้‡ๅˆ ้™คๅคฑ่ดฅ",description:Z instanceof Error?Z.message:"ๆ— ๆณ•ๆ‰น้‡ๅˆ ้™ค้ป‘่ฏ",variant:"destructive"})}},$e=async Z=>{try{await yk(Array.from(me),Z),Y({title:"ๆ“ไฝœๆˆๅŠŸ",description:`ๅทฒๅฐ† ${me.size} ไธช่ฏๆก่ฎพไธบ${Z?"้ป‘่ฏ":"้ž้ป‘่ฏ"}`}),Ne(new Set),we(),fe()}catch(Le){Y({title:"ๆ“ไฝœๅคฑ่ดฅ",description:Le instanceof Error?Le.message:"ๆ‰น้‡่ฎพ็ฝฎๅคฑ่ดฅ",variant:"destructive"})}},cs=()=>{const Z=parseInt(ge),Le=Math.ceil(d/p);Z>=1&&Z<=Le?(f(Z),pe("")):Y({title:"ๆ— ๆ•ˆ็š„้กต็ ",description:`่ฏท่พ“ๅ…ฅ1-${Le}ไน‹้—ด็š„้กต็ `,variant:"destructive"})},J=Z=>Z===!0?e.jsxs(Ce,{variant:"default",className:"bg-green-600 hover:bg-green-700",children:[e.jsx(Ot,{className:"h-3 w-3 mr-1"}),"ๆ˜ฏ้ป‘่ฏ"]}):Z===!1?e.jsxs(Ce,{variant:"secondary",children:[e.jsx(Sa,{className:"h-3 w-3 mr-1"}),"้ž้ป‘่ฏ"]}):e.jsxs(Ce,{variant:"outline",children:[e.jsx(ox,{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(P_,{className:"h-8 w-8",strokeWidth:2}),"้ป‘่ฏ็ฎก็†"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"็ฎก็†้บฆ้บฆๅญฆไน ๅˆฐ็š„้ป‘่ฏๅ’Œไฟš่ฏญ"})]}),e.jsxs(_,{onClick:()=>O(!0),className:"gap-2",children:[e.jsx(Xs,{className:"h-4 w-4"}),"ๆ–ฐๅขž้ป‘่ฏ"]})]})}),e.jsx(ts,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 lg:grid-cols-7 gap-3",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"ๆ€ปๆ•ฐ้‡"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1",children:D.total})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"ๅทฒ็กฎ่ฎค้ป‘่ฏ"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-green-600",children:D.confirmed_jargon})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"็กฎ่ฎค้ž้ป‘่ฏ"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-gray-500",children:D.confirmed_not_jargon})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"ๅพ…ๅˆคๅฎš"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-yellow-600",children:D.pending})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"ๅ…จๅฑ€้ป‘่ฏ"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-blue-600",children:D.global_count})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"ๆŽจๆ–ญๅฎŒๆˆ"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-purple-600",children:D.complete_count})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"ๅ…ณ่”่Šๅคฉๆ•ฐ"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1",children:D.chat_count})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(T,{htmlFor:"search",children:"ๆœ็ดข"}),e.jsxs("div",{className:"relative",children:[e.jsx($t,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(ae,{id:"search",placeholder:"ๆœ็ดขๅ†…ๅฎนใ€ๅซไน‰...",value:N,onChange:Z=>j(Z.target.value),className:"pl-9"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(T,{children:"่Šๅคฉ็ญ›้€‰"}),e.jsxs(Pe,{value:b,onValueChange:y,children:[e.jsx(Ie,{children:e.jsx(Fe,{placeholder:"ๅ…จ้ƒจ่Šๅคฉ"})}),e.jsxs(Be,{children:[e.jsx(W,{value:"all",children:"ๅ…จ้ƒจ่Šๅคฉ"}),I.map(Z=>e.jsx(W,{value:Z.chat_id,children:Z.chat_name},Z.chat_id))]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(T,{children:"็Šถๆ€็ญ›้€‰"}),e.jsxs(Pe,{value:w,onValueChange:z,children:[e.jsx(Ie,{children:e.jsx(Fe,{placeholder:"ๅ…จ้ƒจ็Šถๆ€"})}),e.jsxs(Be,{children:[e.jsx(W,{value:"all",children:"ๅ…จ้ƒจ็Šถๆ€"}),e.jsx(W,{value:"true",children:"ๆ˜ฏ้ป‘่ฏ"}),e.jsx(W,{value:"false",children:"้ž้ป‘่ฏ"})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(T,{htmlFor:"page-size",children:"ๆฏ้กตๆ˜พ็คบ"}),e.jsxs(Pe,{value:p.toString(),onValueChange:Z=>{g(parseInt(Z)),f(1),Ne(new Set)},children:[e.jsx(Ie,{id:"page-size",children:e.jsx(Fe,{})}),e.jsxs(Be,{children:[e.jsx(W,{value:"10",children:"10"}),e.jsx(W,{value:"20",children:"20"}),e.jsx(W,{value:"50",children:"50"}),e.jsx(W,{value:"100",children:"100"})]})]})]})]}),me.size>0&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mt-4 pt-4 border-t",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:["ๅทฒ้€‰ๆ‹ฉ ",me.size," ไธช"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>$e(!0),children:[e.jsx(Ot,{className:"h-4 w-4 mr-1"}),"ๆ ‡่ฎฐไธบ้ป‘่ฏ"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>$e(!1),children:[e.jsx(Sa,{className:"h-4 w-4 mr-1"}),"ๆ ‡่ฎฐไธบ้ž้ป‘่ฏ"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>Ne(new Set),children:"ๅ–ๆถˆ้€‰ๆ‹ฉ"}),e.jsxs(_,{variant:"destructive",size:"sm",onClick:()=>re(!0),children:[e.jsx(os,{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(ql,{children:[e.jsx(Vl,{children:e.jsxs(_t,{children:[e.jsx(ns,{className:"w-12",children:e.jsx(tt,{checked:me.size===a.length&&a.length>0,onCheckedChange:Re})}),e.jsx(ns,{children:"ๅ†…ๅฎน"}),e.jsx(ns,{children:"ๅซไน‰"}),e.jsx(ns,{children:"่Šๅคฉ"}),e.jsx(ns,{children:"็Šถๆ€"}),e.jsx(ns,{className:"text-center",children:"ๆฌกๆ•ฐ"}),e.jsx(ns,{className:"text-right",children:"ๆ“ไฝœ"})]})}),e.jsx(Gl,{children:r?e.jsx(_t,{children:e.jsx(Ze,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"ๅŠ ่ฝฝไธญ..."})}):a.length===0?e.jsx(_t,{children:e.jsx(Ze,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"ๆš‚ๆ— ๆ•ฐๆฎ"})}):a.map(Z=>e.jsxs(_t,{children:[e.jsx(Ze,{children:e.jsx(tt,{checked:me.has(Z.id),onCheckedChange:()=>K(Z.id)})}),e.jsx(Ze,{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(Go,{className:"h-4 w-4 text-blue-500 flex-shrink-0"})}),e.jsx("span",{className:"truncate",title:Z.content,children:Z.content})]})}),e.jsx(Ze,{className:"max-w-[200px] truncate",title:Z.meaning||"",children:Z.meaning||e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx(Ze,{className:"max-w-[150px] truncate",title:Z.chat_name||Z.chat_id,children:Z.chat_name||Z.chat_id}),e.jsx(Ze,{children:J(Z.is_jargon)}),e.jsx(Ze,{className:"text-center",children:Z.count}),e.jsx(Ze,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>$(Z),children:[e.jsx(sr,{className:"h-4 w-4 mr-1"}),"็ผ–่พ‘"]}),e.jsx(_,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>G(Z),title:"ๆŸฅ็œ‹่ฏฆๆƒ…",children:e.jsx(ua,{className:"h-4 w-4"})}),e.jsxs(_,{size:"sm",onClick:()=>L(Z),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(os,{className:"h-4 w-4 mr-1"}),"ๅˆ ้™ค"]})]})})]},Z.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3 p-4",children:r?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"ๅŠ ่ฝฝไธญ..."}):a.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"ๆš‚ๆ— ๆ•ฐๆฎ"}):a.map(Z=>e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(tt,{checked:me.has(Z.id),onCheckedChange:()=>K(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(Go,{className:"h-4 w-4 text-blue-500 flex-shrink-0"}),e.jsx("h3",{className:"font-semibold text-sm break-all",children:Z.content})]}),Z.meaning&&e.jsx("p",{className:"text-sm text-muted-foreground break-all",children:Z.meaning}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[J(Z.is_jargon),e.jsxs("span",{className:"text-muted-foreground",children:["ๆฌกๆ•ฐ: ",Z.count]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground truncate",children:["่Šๅคฉ: ",Z.chat_name||Z.chat_id]})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>$(Z),className:"text-xs px-2 py-1 h-auto",children:[e.jsx(sr,{className:"h-3 w-3 mr-1"}),"็ผ–่พ‘"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>G(Z),className:"text-xs px-2 py-1 h-auto",children:e.jsx(ua,{className:"h-3 w-3"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>L(Z),className:"text-xs px-2 py-1 h-auto text-destructive hover:text-destructive",children:[e.jsx(os,{className:"h-3 w-3 mr-1"}),"ๅˆ ้™ค"]})]})]},Z.id))}),d>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["ๅ…ฑ ",d," ๆก่ฎฐๅฝ•๏ผŒ็ฌฌ ",h," / ",Math.ceil(d/p)," ้กต"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(kn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h-1),disabled:h===1,children:[e.jsx(Pa,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"ไธŠไธ€้กต"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae,{type:"number",value:ge,onChange:Z=>pe(Z.target.value),onKeyDown:Z=>Z.key==="Enter"&&cs(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(d/p)}),e.jsx(_,{variant:"outline",size:"sm",onClick:cs,disabled:!ge,className:"h-8",children:"่ทณ่ฝฌ"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h+1),disabled:h>=Math.ceil(d/p),children:[e.jsx("span",{className:"hidden sm:inline",children:"ไธ‹ไธ€้กต"}),e.jsx(ra,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(d/p)),disabled:h>=Math.ceil(d/p),className:"hidden sm:flex",children:e.jsx(Cn,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(_k,{jargon:M,open:F,onOpenChange:E}),e.jsx(Sk,{open:H,onOpenChange:O,chatList:I,onSuccess:()=>{we(),fe(),O(!1)}}),e.jsx(kk,{jargon:M,open:C,onOpenChange:R,chatList:I,onSuccess:()=>{we(),fe(),R(!1)}}),e.jsx(bs,{open:!!X,onOpenChange:()=>L(null),children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsxs(gs,{children:['็กฎๅฎš่ฆๅˆ ้™ค้ป‘่ฏ "',X?.content,'" ๅ—๏ผŸๆญคๆ“ไฝœไธๅฏๆ’ค้”€ใ€‚']})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:()=>X&&A(X),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"ๅˆ ้™ค"})]})]})}),e.jsx(bs,{open:je,onOpenChange:re,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๆ‰น้‡ๅˆ ้™ค"}),e.jsxs(gs,{children:["ๆ‚จๅณๅฐ†ๅˆ ้™ค ",me.size," ไธช้ป‘่ฏ๏ผŒๆญคๆ“ไฝœๆ— ๆณ•ๆ’ค้”€ใ€‚็กฎๅฎš่ฆ็ปง็ปญๅ—๏ผŸ"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:se,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"็กฎ่ฎคๅˆ ้™ค"})]})]})})]})}function _k({jargon:a,open:l,onOpenChange:r}){return a?e.jsx(Qs,{open:l,onOpenChange:r,children:e.jsxs(Hs,{className:"max-w-2xl max-h-[80vh] grid grid-rows-[auto_1fr_auto] overflow-hidden",children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"้ป‘่ฏ่ฏฆๆƒ…"}),e.jsx(at,{children:"ๆŸฅ็œ‹้ป‘่ฏ็š„ๅฎŒๆ•ดไฟกๆฏ"})]}),e.jsx(ts,{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(Gm,{icon:Wr,label:"่ฎฐๅฝ•ID",value:a.id.toString(),mono:!0}),e.jsx(Gm,{label:"ไฝฟ็”จๆฌกๆ•ฐ",value:a.count.toString()})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"ๅ†…ๅฎน"}),e.jsx("div",{className:"text-sm p-2 bg-muted rounded break-all whitespace-pre-wrap",children:a.content})]}),a.raw_content&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"ๅŽŸๅง‹ๅ†…ๅฎน"}),e.jsx("div",{className:"text-sm p-2 bg-muted rounded break-all",children:(()=>{try{const c=JSON.parse(a.raw_content);return Array.isArray(c)?c.map((d,m)=>e.jsxs("div",{children:[m>0&&e.jsx("hr",{className:"my-3 border-border"}),e.jsx("div",{className:"whitespace-pre-wrap",children:d})]},m)):e.jsx("div",{className:"whitespace-pre-wrap",children:a.raw_content})}catch{return e.jsx("div",{className:"whitespace-pre-wrap",children:a.raw_content})}})()})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"ๅซไน‰"}),e.jsx("div",{className:"text-sm p-2 bg-muted rounded break-all",children:a.meaning?e.jsx(bx,{content:a.meaning}):"-"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Gm,{label:"่Šๅคฉ",value:a.chat_name||a.chat_id}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"็Šถๆ€"}),e.jsxs("div",{className:"flex items-center gap-2",children:[a.is_jargon===!0&&e.jsx(Ce,{variant:"default",className:"bg-green-600",children:"ๆ˜ฏ้ป‘่ฏ"}),a.is_jargon===!1&&e.jsx(Ce,{variant:"secondary",children:"้ž้ป‘่ฏ"}),a.is_jargon===null&&e.jsx(Ce,{variant:"outline",children:"ๆœชๅˆคๅฎš"}),a.is_global&&e.jsx(Ce,{variant:"outline",className:"border-blue-500 text-blue-500",children:"ๅ…จๅฑ€"}),a.is_complete&&e.jsx(Ce,{variant:"outline",className:"border-purple-500 text-purple-500",children:"ๆŽจๆ–ญๅฎŒๆˆ"})]})]})]}),a.inference_with_context&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"ไธŠไธ‹ๆ–‡ๆŽจๆ–ญ็ป“ๆžœ"}),e.jsx("div",{className:"p-2 bg-muted rounded break-all whitespace-pre-wrap font-mono text-xs max-h-[200px] overflow-y-auto",children:a.inference_with_context})]}),a.inference_content_only&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"็บฏ่ฏๆกๆŽจๆ–ญ็ป“ๆžœ"}),e.jsx("div",{className:"p-2 bg-muted rounded break-all whitespace-pre-wrap font-mono text-xs max-h-[200px] overflow-y-auto",children:a.inference_content_only})]})]})}),e.jsx(gt,{className:"flex-shrink-0",children:e.jsx(_,{onClick:()=>r(!1),children:"ๅ…ณ้—ญ"})})]})}):null}function Gm({icon:a,label:l,value:r,mono:c=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(T,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[a&&e.jsx(a,{className:"h-3 w-3"}),l]}),e.jsx("div",{className:P("text-sm",c&&"font-mono",!r&&"text-muted-foreground"),children:r||"-"})]})}function Sk({open:a,onOpenChange:l,chatList:r,onSuccess:c}){const[d,m]=u.useState({content:"",meaning:"",chat_id:"",is_global:!1}),[h,f]=u.useState(!1),{toast:p}=nt(),g=async()=>{if(!d.content||!d.chat_id){p({title:"้ชŒ่ฏๅคฑ่ดฅ",description:"่ฏทๅกซๅ†™ๅฟ…ๅกซๅญ—ๆฎต๏ผšๅ†…ๅฎนๅ’Œ่Šๅคฉ",variant:"destructive"});return}try{f(!0),await gk(d),p({title:"ๅˆ›ๅปบๆˆๅŠŸ",description:"้ป‘่ฏๅทฒๅˆ›ๅปบ"}),m({content:"",meaning:"",chat_id:"",is_global:!1}),c()}catch(N){p({title:"ๅˆ›ๅปบๅคฑ่ดฅ",description:N instanceof Error?N.message:"ๆ— ๆณ•ๅˆ›ๅปบ้ป‘่ฏ",variant:"destructive"})}finally{f(!1)}};return e.jsx(Qs,{open:a,onOpenChange:l,children:e.jsxs(Hs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"ๆ–ฐๅขž้ป‘่ฏ"}),e.jsx(at,{children:"ๅˆ›ๅปบๆ–ฐ็š„้ป‘่ฏ่ฎฐๅฝ•"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"content",children:["ๅ†…ๅฎน ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ae,{id:"content",value:d.content,onChange:N=>m({...d,content:N.target.value}),placeholder:"่พ“ๅ…ฅ้ป‘่ฏๅ†…ๅฎน"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"meaning",children:"ๅซไน‰"}),e.jsx(pt,{id:"meaning",value:d.meaning||"",onChange:N=>m({...d,meaning:N.target.value}),placeholder:"่พ“ๅ…ฅ้ป‘่ฏๅซไน‰๏ผˆๅฏ้€‰๏ผ‰",rows:3})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(T,{htmlFor:"chat_id",children:["่Šๅคฉ ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs(Pe,{value:d.chat_id,onValueChange:N=>m({...d,chat_id:N}),children:[e.jsx(Ie,{children:e.jsx(Fe,{placeholder:"้€‰ๆ‹ฉๅ…ณ่”็š„่Šๅคฉ"})}),e.jsx(Be,{children:r.map(N=>e.jsx(W,{value:N.chat_id,children:N.chat_name},N.chat_id))})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qe,{id:"is_global",checked:d.is_global,onCheckedChange:N=>m({...d,is_global:N})}),e.jsx(T,{htmlFor:"is_global",children:"่ฎพไธบๅ…จๅฑ€้ป‘่ฏ"})]})]}),e.jsxs(gt,{children:[e.jsx(_,{variant:"outline",onClick:()=>l(!1),children:"ๅ–ๆถˆ"}),e.jsx(_,{onClick:g,disabled:h,children:h?"ๅˆ›ๅปบไธญ...":"ๅˆ›ๅปบ"})]})]})})}function kk({jargon:a,open:l,onOpenChange:r,chatList:c,onSuccess:d}){const[m,h]=u.useState({}),[f,p]=u.useState(!1),{toast:g}=nt();u.useEffect(()=>{a&&h({content:a.content,meaning:a.meaning||"",chat_id:a.stream_id||a.chat_id,is_global:a.is_global,is_jargon:a.is_jargon})},[a]);const N=async()=>{if(a)try{p(!0),await jk(a.id,m),g({title:"ไฟๅญ˜ๆˆๅŠŸ",description:"้ป‘่ฏๅทฒๆ›ดๆ–ฐ"}),d()}catch(j){g({title:"ไฟๅญ˜ๅคฑ่ดฅ",description:j instanceof Error?j.message:"ๆ— ๆณ•ๆ›ดๆ–ฐ้ป‘่ฏ",variant:"destructive"})}finally{p(!1)}};return a?e.jsx(Qs,{open:l,onOpenChange:r,children:e.jsxs(Hs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"็ผ–่พ‘้ป‘่ฏ"}),e.jsx(at,{children:"ไฟฎๆ”น้ป‘่ฏ็š„ไฟกๆฏ"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_content",children:"ๅ†…ๅฎน"}),e.jsx(ae,{id:"edit_content",value:m.content||"",onChange:j=>h({...m,content:j.target.value}),placeholder:"่พ“ๅ…ฅ้ป‘่ฏๅ†…ๅฎน"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_meaning",children:"ๅซไน‰"}),e.jsx(pt,{id:"edit_meaning",value:m.meaning||"",onChange:j=>h({...m,meaning:j.target.value}),placeholder:"่พ“ๅ…ฅ้ป‘่ฏๅซไน‰",rows:3})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit_chat_id",children:"่Šๅคฉ"}),e.jsxs(Pe,{value:m.chat_id||"",onValueChange:j=>h({...m,chat_id:j}),children:[e.jsx(Ie,{children:e.jsx(Fe,{placeholder:"้€‰ๆ‹ฉๅ…ณ่”็š„่Šๅคฉ"})}),e.jsx(Be,{children:c.map(j=>e.jsx(W,{value:j.chat_id,children:j.chat_name},j.chat_id))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"้ป‘่ฏ็Šถๆ€"}),e.jsxs(Pe,{value:m.is_jargon===null?"null":m.is_jargon?.toString()||"null",onValueChange:j=>h({...m,is_jargon:j==="null"?null:j==="true"}),children:[e.jsx(Ie,{children:e.jsx(Fe,{})}),e.jsxs(Be,{children:[e.jsx(W,{value:"null",children:"ๆœชๅˆคๅฎš"}),e.jsx(W,{value:"true",children:"ๆ˜ฏ้ป‘่ฏ"}),e.jsx(W,{value:"false",children:"้ž้ป‘่ฏ"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qe,{id:"edit_is_global",checked:m.is_global,onCheckedChange:j=>h({...m,is_global:j})}),e.jsx(T,{htmlFor:"edit_is_global",children:"ๅ…จๅฑ€้ป‘่ฏ"})]})]}),e.jsxs(gt,{children:[e.jsx(_,{variant:"outline",onClick:()=>r(!1),children:"ๅ–ๆถˆ"}),e.jsx(_,{onClick:N,disabled:f,children:f?"ไฟๅญ˜ไธญ...":"ไฟๅญ˜"})]})]})}):null}const li="/api/webui/person";async function Ck(a){const l=new URLSearchParams;a.page&&l.append("page",a.page.toString()),a.page_size&&l.append("page_size",a.page_size.toString()),a.search&&l.append("search",a.search),a.is_known!==void 0&&l.append("is_known",a.is_known.toString()),a.platform&&l.append("platform",a.platform);const r=await ke(`${li}/list?${l}`,{headers:Zs()});if(!r.ok){const c=await r.json();throw new Error(c.detail||"่Žทๅ–ไบบ็‰ฉๅˆ—่กจๅคฑ่ดฅ")}return r.json()}async function Tk(a){const l=await ke(`${li}/${a}`,{headers:Zs()});if(!l.ok){const r=await l.json();throw new Error(r.detail||"่Žทๅ–ไบบ็‰ฉ่ฏฆๆƒ…ๅคฑ่ดฅ")}return l.json()}async function Ek(a,l){const r=await ke(`${li}/${a}`,{method:"PATCH",headers:Zs(),body:JSON.stringify(l)});if(!r.ok){const c=await r.json();throw new Error(c.detail||"ๆ›ดๆ–ฐไบบ็‰ฉไฟกๆฏๅคฑ่ดฅ")}return r.json()}async function Mk(a){const l=await ke(`${li}/${a}`,{method:"DELETE",headers:Zs()});if(!l.ok){const r=await l.json();throw new Error(r.detail||"ๅˆ ้™คไบบ็‰ฉไฟกๆฏๅคฑ่ดฅ")}return l.json()}async function Ak(){const a=await ke(`${li}/stats/summary`,{headers:Zs()});if(!a.ok){const l=await a.json();throw new Error(l.detail||"่Žทๅ–็ปŸ่ฎกๆ•ฐๆฎๅคฑ่ดฅ")}return a.json()}async function zk(a){const l=await ke(`${li}/batch/delete`,{method:"POST",headers:Zs(),body:JSON.stringify({person_ids:a})});if(!l.ok){const r=await l.json();throw new Error(r.detail||"ๆ‰น้‡ๅˆ ้™คๅคฑ่ดฅ")}return l.json()}function Rk(){const[a,l]=u.useState([]),[r,c]=u.useState(!0),[d,m]=u.useState(0),[h,f]=u.useState(1),[p,g]=u.useState(20),[N,j]=u.useState(""),[b,y]=u.useState(void 0),[w,z]=u.useState(void 0),[M,S]=u.useState(null),[F,E]=u.useState(!1),[C,R]=u.useState(!1),[H,O]=u.useState(null),[X,L]=u.useState({total:0,known:0,unknown:0,platforms:{}}),[me,Ne]=u.useState(new Set),[je,re]=u.useState(!1),[ge,pe]=u.useState(""),{toast:D}=nt(),Q=async()=>{try{c(!0);const se=await Ck({page:h,page_size:p,search:N||void 0,is_known:b,platform:w});l(se.data),m(se.total)}catch(se){D({title:"ๅŠ ่ฝฝๅคฑ่ดฅ",description:se instanceof Error?se.message:"ๆ— ๆณ•ๅŠ ่ฝฝไบบ็‰ฉไฟกๆฏ",variant:"destructive"})}finally{c(!1)}},I=async()=>{try{const se=await Ak();se?.data&&L(se.data)}catch(se){console.error("ๅŠ ่ฝฝ็ปŸ่ฎกๆ•ฐๆฎๅคฑ่ดฅ:",se)}};u.useEffect(()=>{Q(),I()},[h,p,N,b,w]);const ue=async se=>{try{const $e=await Tk(se.person_id);S($e.data),E(!0)}catch($e){D({title:"ๅŠ ่ฝฝ่ฏฆๆƒ…ๅคฑ่ดฅ",description:$e instanceof Error?$e.message:"ๆ— ๆณ•ๅŠ ่ฝฝไบบ็‰ฉ่ฏฆๆƒ…",variant:"destructive"})}},Y=se=>{S(se),R(!0)},we=async se=>{try{await Mk(se.person_id),D({title:"ๅˆ ้™คๆˆๅŠŸ",description:`ๅทฒๅˆ ้™คไบบ็‰ฉไฟกๆฏ: ${se.person_name||se.nickname||se.user_id}`}),O(null),Q(),I()}catch($e){D({title:"ๅˆ ้™คๅคฑ่ดฅ",description:$e instanceof Error?$e.message:"ๆ— ๆณ•ๅˆ ้™คไบบ็‰ฉไฟกๆฏ",variant:"destructive"})}},fe=u.useMemo(()=>Object.keys(X.platforms),[X.platforms]),Ee=se=>{const $e=new Set(me);$e.has(se)?$e.delete(se):$e.add(se),Ne($e)},G=()=>{me.size===a.length&&a.length>0?Ne(new Set):Ne(new Set(a.map(se=>se.person_id)))},$=()=>{if(me.size===0){D({title:"ๆœช้€‰ๆ‹ฉไปปไฝ•ไบบ็‰ฉ",description:"่ฏทๅ…ˆ้€‰ๆ‹ฉ่ฆๅˆ ้™ค็š„ไบบ็‰ฉ",variant:"destructive"});return}re(!0)},A=async()=>{try{const se=await zk(Array.from(me));D({title:"ๆ‰น้‡ๅˆ ้™คๅฎŒๆˆ",description:se.message}),Ne(new Set),re(!1),Q(),I()}catch(se){D({title:"ๆ‰น้‡ๅˆ ้™คๅคฑ่ดฅ",description:se instanceof Error?se.message:"ๆ‰น้‡ๅˆ ้™คๅคฑ่ดฅ",variant:"destructive"})}},K=()=>{const se=parseInt(ge),$e=Math.ceil(d/p);se>=1&&se<=$e?(f(se),pe("")):D({title:"ๆ— ๆ•ˆ็š„้กต็ ",description:`่ฏท่พ“ๅ…ฅ1-${$e}ไน‹้—ด็š„้กต็ `,variant:"destructive"})},Re=se=>se?new Date(se*1e3).toLocaleString("zh-CN"):"-";return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsx("div",{className:"mb-4 sm:mb-6",children:e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(oc,{className:"h-8 w-8",strokeWidth:2}),"ไบบ็‰ฉไฟกๆฏ็ฎก็†"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"็ฎก็†้บฆ้บฆ่ฎค่ฏ†็š„ๆ‰€ๆœ‰ไบบ็‰ฉไฟกๆฏ"})]})})}),e.jsx(ts,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"ๆ€ปไบบๆ•ฐ"}),e.jsx("div",{className:"text-2xl font-bold mt-1",children:X.total})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"ๅทฒ่ฎค่ฏ†"}),e.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:X.known})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"ๆœช่ฎค่ฏ†"}),e.jsx("div",{className:"text-2xl font-bold mt-1 text-muted-foreground",children:X.unknown})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"sm:col-span-2",children:[e.jsx(T,{htmlFor:"search",children:"ๆœ็ดข"}),e.jsxs("div",{className:"relative mt-1.5",children:[e.jsx($t,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(ae,{id:"search",placeholder:"ๆœ็ดขๅ็งฐใ€ๆ˜ต็งฐๆˆ–็”จๆˆทID...",value:N,onChange:se=>j(se.target.value),className:"pl-9"})]})]}),e.jsxs("div",{children:[e.jsx(T,{htmlFor:"filter-known",children:"่ฎค่ฏ†็Šถๆ€"}),e.jsxs(Pe,{value:b===void 0?"all":b.toString(),onValueChange:se=>{y(se==="all"?void 0:se==="true"),f(1)},children:[e.jsx(Ie,{id:"filter-known",className:"mt-1.5",children:e.jsx(Fe,{})}),e.jsxs(Be,{children:[e.jsx(W,{value:"all",children:"ๅ…จ้ƒจ"}),e.jsx(W,{value:"true",children:"ๅทฒ่ฎค่ฏ†"}),e.jsx(W,{value:"false",children:"ๆœช่ฎค่ฏ†"})]})]})]}),e.jsxs("div",{children:[e.jsx(T,{htmlFor:"filter-platform",children:"ๅนณๅฐ"}),e.jsxs(Pe,{value:w||"all",onValueChange:se=>{z(se==="all"?void 0:se),f(1)},children:[e.jsx(Ie,{id:"filter-platform",className:"mt-1.5",children:e.jsx(Fe,{})}),e.jsxs(Be,{children:[e.jsx(W,{value:"all",children:"ๅ…จ้ƒจๅนณๅฐ"}),fe.map(se=>e.jsxs(W,{value:se,children:[se," (",X.platforms[se],")"]},se))]})]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[e.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:me.size>0&&e.jsxs("span",{children:["ๅทฒ้€‰ๆ‹ฉ ",me.size," ไธชไบบ็‰ฉ"]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"ๆฏ้กตๆ˜พ็คบ"}),e.jsxs(Pe,{value:p.toString(),onValueChange:se=>{g(parseInt(se)),f(1),Ne(new Set)},children:[e.jsx(Ie,{id:"page-size",className:"w-20",children:e.jsx(Fe,{})}),e.jsxs(Be,{children:[e.jsx(W,{value:"10",children:"10"}),e.jsx(W,{value:"20",children:"20"}),e.jsx(W,{value:"50",children:"50"}),e.jsx(W,{value:"100",children:"100"})]})]}),me.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>Ne(new Set),children:"ๅ–ๆถˆ้€‰ๆ‹ฉ"}),e.jsxs(_,{variant:"destructive",size:"sm",onClick:$,children:[e.jsx(os,{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(ql,{children:[e.jsx(Vl,{children:e.jsxs(_t,{children:[e.jsx(ns,{className:"w-12",children:e.jsx(tt,{checked:a.length>0&&me.size===a.length,onCheckedChange:G,"aria-label":"ๅ…จ้€‰"})}),e.jsx(ns,{children:"็Šถๆ€"}),e.jsx(ns,{children:"ๅ็งฐ"}),e.jsx(ns,{children:"ๆ˜ต็งฐ"}),e.jsx(ns,{children:"ๅนณๅฐ"}),e.jsx(ns,{children:"็”จๆˆทID"}),e.jsx(ns,{children:"ๆœ€ๅŽๆ›ดๆ–ฐ"}),e.jsx(ns,{className:"text-right",children:"ๆ“ไฝœ"})]})}),e.jsx(Gl,{children:r?e.jsx(_t,{children:e.jsx(Ze,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"ๅŠ ่ฝฝไธญ..."})}):a.length===0?e.jsx(_t,{children:e.jsx(Ze,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"ๆš‚ๆ— ๆ•ฐๆฎ"})}):a.map(se=>e.jsxs(_t,{children:[e.jsx(Ze,{children:e.jsx(tt,{checked:me.has(se.person_id),onCheckedChange:()=>Ee(se.person_id),"aria-label":`้€‰ๆ‹ฉ ${se.person_name||se.nickname||se.user_id}`})}),e.jsx(Ze,{children:e.jsx("div",{className:P("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",se.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:se.is_known?"ๅทฒ่ฎค่ฏ†":"ๆœช่ฎค่ฏ†"})}),e.jsx(Ze,{className:"font-medium",children:se.person_name||e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx(Ze,{children:se.nickname||"-"}),e.jsx(Ze,{children:se.platform}),e.jsx(Ze,{className:"font-mono text-sm",children:se.user_id}),e.jsx(Ze,{className:"text-sm text-muted-foreground",children:Re(se.last_know)}),e.jsx(Ze,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>ue(se),children:[e.jsx(ua,{className:"h-4 w-4 mr-1"}),"่ฏฆๆƒ…"]}),e.jsxs(_,{variant:"default",size:"sm",onClick:()=>Y(se),children:[e.jsx(sr,{className:"h-4 w-4 mr-1"}),"็ผ–่พ‘"]}),e.jsxs(_,{size:"sm",onClick:()=>O(se),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(os,{className:"h-4 w-4 mr-1"}),"ๅˆ ้™ค"]})]})})]},se.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3 p-4",children:r?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"ๅŠ ่ฝฝไธญ..."}):a.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"ๆš‚ๆ— ๆ•ฐๆฎ"}):a.map(se=>e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(tt,{checked:me.has(se.person_id),onCheckedChange:()=>Ee(se.person_id),className:"mt-1"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:P("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium mb-2",se.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:se.is_known?"ๅทฒ่ฎค่ฏ†":"ๆœช่ฎค่ฏ†"}),e.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",children:se.person_name||e.jsx("span",{className:"text-muted-foreground",children:"ๆœชๅ‘ฝๅ"})}),se.nickname&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-1 w-full break-all",children:["ๆ˜ต็งฐ: ",se.nickname]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"ๅนณๅฐ"}),e.jsx("p",{className:"font-medium text-xs",children:se.platform})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"็”จๆˆทID"}),e.jsx("p",{className:"font-mono text-xs truncate",title:se.user_id,children:se.user_id})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"ๆœ€ๅŽๆ›ดๆ–ฐ"}),e.jsx("p",{className:"text-xs",children:Re(se.last_know)})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>ue(se),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(ua,{className:"h-3 w-3 mr-1"}),"ๆŸฅ็œ‹"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>Y(se),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(sr,{className:"h-3 w-3 mr-1"}),"็ผ–่พ‘"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>O(se),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[e.jsx(os,{className:"h-3 w-3 mr-1"}),"ๅˆ ้™ค"]})]})]},se.id))}),d>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["ๅ…ฑ ",d," ๆก่ฎฐๅฝ•๏ผŒ็ฌฌ ",h," / ",Math.ceil(d/p)," ้กต"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(kn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h-1),disabled:h===1,children:[e.jsx(Pa,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"ไธŠไธ€้กต"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae,{type:"number",value:ge,onChange:se=>pe(se.target.value),onKeyDown:se=>se.key==="Enter"&&K(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(d/p)}),e.jsx(_,{variant:"outline",size:"sm",onClick:K,disabled:!ge,className:"h-8",children:"่ทณ่ฝฌ"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h+1),disabled:h>=Math.ceil(d/p),children:[e.jsx("span",{className:"hidden sm:inline",children:"ไธ‹ไธ€้กต"}),e.jsx(ra,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(d/p)),disabled:h>=Math.ceil(d/p),className:"hidden sm:flex",children:e.jsx(Cn,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(Dk,{person:M,open:F,onOpenChange:E}),e.jsx(Ok,{person:M,open:C,onOpenChange:R,onSuccess:()=>{Q(),I(),R(!1)}}),e.jsx(bs,{open:!!H,onOpenChange:()=>O(null),children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๅˆ ้™ค"}),e.jsxs(gs,{children:['็กฎๅฎš่ฆๅˆ ้™คไบบ็‰ฉไฟกๆฏ "',H?.person_name||H?.nickname||H?.user_id,'" ๅ—๏ผŸ ๆญคๆ“ไฝœไธๅฏๆ’ค้”€ใ€‚']})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:()=>H&&we(H),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"ๅˆ ้™ค"})]})]})}),e.jsx(bs,{open:je,onOpenChange:re,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"็กฎ่ฎคๆ‰น้‡ๅˆ ้™ค"}),e.jsxs(gs,{children:["็กฎๅฎš่ฆๅˆ ้™ค้€‰ไธญ็š„ ",me.size," ไธชไบบ็‰ฉไฟกๆฏๅ—๏ผŸ ๆญคๆ“ไฝœไธๅฏๆ’ค้”€ใ€‚"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:A,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"ๆ‰น้‡ๅˆ ้™ค"})]})]})})]})}function Dk({person:a,open:l,onOpenChange:r}){if(!a)return null;const c=d=>d?new Date(d*1e3).toLocaleString("zh-CN"):"-";return e.jsx(Qs,{open:l,onOpenChange:r,children:e.jsxs(Hs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"ไบบ็‰ฉ่ฏฆๆƒ…"}),e.jsxs(at,{children:["ๆŸฅ็œ‹ ",a.person_name||a.nickname||a.user_id," ็š„ๅฎŒๆ•ดไฟกๆฏ"]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx($l,{icon:Fl,label:"ไบบ็‰ฉๅ็งฐ",value:a.person_name}),e.jsx($l,{icon:Ba,label:"ๆ˜ต็งฐ",value:a.nickname}),e.jsx($l,{icon:Wr,label:"็”จๆˆทID",value:a.user_id,mono:!0}),e.jsx($l,{icon:Wr,label:"ไบบ็‰ฉID",value:a.person_id,mono:!0}),e.jsx($l,{label:"ๅนณๅฐ",value:a.platform}),e.jsx($l,{label:"็Šถๆ€",value:a.is_known?"ๅทฒ่ฎค่ฏ†":"ๆœช่ฎค่ฏ†"})]}),a.name_reason&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"ๅ็งฐ่ฎพๅฎšๅŽŸๅ› "}),e.jsx("p",{className:"mt-1 text-sm",children:a.name_reason})]}),a.memory_points&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"ไธชไบบๅฐ่ฑก"}),e.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:a.memory_points})]}),a.group_nick_name&&a.group_nick_name.length>0&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"็พคๆ˜ต็งฐ"}),e.jsx("div",{className:"mt-2 space-y-1",children:a.group_nick_name.map((d,m)=>e.jsxs("div",{className:"text-sm flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:d.group_id}),e.jsx("span",{children:"โ†’"}),e.jsx("span",{children:d.group_nick_name})]},m))})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx($l,{icon:da,label:"่ฎค่ฏ†ๆ—ถ้—ด",value:c(a.know_times)}),e.jsx($l,{icon:da,label:"้ฆ–ๆฌก่ฎฐๅฝ•",value:c(a.know_since)}),e.jsx($l,{icon:da,label:"ๆœ€ๅŽๆ›ดๆ–ฐ",value:c(a.last_know)})]})]}),e.jsx(gt,{children:e.jsx(_,{onClick:()=>r(!1),children:"ๅ…ณ้—ญ"})})]})})}function $l({icon:a,label:l,value:r,mono:c=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(T,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[a&&e.jsx(a,{className:"h-3 w-3"}),l]}),e.jsx("div",{className:P("text-sm",c&&"font-mono",!r&&"text-muted-foreground"),children:r||"-"})]})}function Ok({person:a,open:l,onOpenChange:r,onSuccess:c}){const[d,m]=u.useState({}),[h,f]=u.useState(!1),{toast:p}=nt();u.useEffect(()=>{a&&m({person_name:a.person_name||"",name_reason:a.name_reason||"",nickname:a.nickname||"",is_known:a.is_known})},[a]);const g=async()=>{if(a)try{f(!0),await Ek(a.person_id,d),p({title:"ไฟๅญ˜ๆˆๅŠŸ",description:"ไบบ็‰ฉไฟกๆฏๅทฒๆ›ดๆ–ฐ"}),c()}catch(N){p({title:"ไฟๅญ˜ๅคฑ่ดฅ",description:N instanceof Error?N.message:"ๆ— ๆณ•ๆ›ดๆ–ฐไบบ็‰ฉไฟกๆฏ",variant:"destructive"})}finally{f(!1)}};return a?e.jsx(Qs,{open:l,onOpenChange:r,children:e.jsxs(Hs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"็ผ–่พ‘ไบบ็‰ฉไฟกๆฏ"}),e.jsxs(at,{children:["ไฟฎๆ”น ",a.person_name||a.nickname||a.user_id," ็š„ไฟกๆฏ"]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"person_name",children:"ไบบ็‰ฉๅ็งฐ"}),e.jsx(ae,{id:"person_name",value:d.person_name||"",onChange:N=>m({...d,person_name:N.target.value}),placeholder:"ไธบ่ฟ™ไธชไบบ่ฎพ็ฝฎไธ€ไธชๅ็งฐ"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"nickname",children:"ๆ˜ต็งฐ"}),e.jsx(ae,{id:"nickname",value:d.nickname||"",onChange:N=>m({...d,nickname:N.target.value}),placeholder:"ๆ˜ต็งฐ"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"name_reason",children:"ๅ็งฐ่ฎพๅฎšๅŽŸๅ› "}),e.jsx(pt,{id:"name_reason",value:d.name_reason||"",onChange:N=>m({...d,name_reason:N.target.value}),placeholder:"ไธบไป€ไนˆ่ฟ™ๆ ท็งฐๅ‘ผ่ฟ™ไธชไบบ๏ผŸ",rows:2})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{children:[e.jsx(T,{htmlFor:"is_known",className:"text-base font-medium",children:"ๅทฒ่ฎค่ฏ†"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๆ ‡่ฎฐๆ˜ฏๅฆๅทฒ็ป่ฎค่ฏ†่ฟ™ไธชไบบ"})]}),e.jsx(qe,{id:"is_known",checked:d.is_known,onCheckedChange:N=>m({...d,is_known:N})})]})]}),e.jsxs(gt,{children:[e.jsx(_,{variant:"outline",onClick:()=>r(!1),children:"ๅ–ๆถˆ"}),e.jsx(_,{onClick:g,disabled:h,children:h?"ไฟๅญ˜ไธญ...":"ไฟๅญ˜"})]})]})}):null}var Lk=S1();const tj=mw(Lk),Mx="/api/webui";async function Uk(a=100,l="all"){const r=`${Mx}/knowledge/graph?limit=${a}&node_type=${l}`,c=await fetch(r);if(!c.ok)throw new Error(`่Žทๅ–็Ÿฅ่ฏ†ๅ›พ่ฐฑๅคฑ่ดฅ: ${c.status}`);return c.json()}async function $k(){const a=await fetch(`${Mx}/knowledge/stats`);if(!a.ok)throw new Error("่Žทๅ–็Ÿฅ่ฏ†ๅ›พ่ฐฑ็ปŸ่ฎกไฟกๆฏๅคฑ่ดฅ");return a.json()}async function Ik(a){const l=await fetch(`${Mx}/knowledge/search?query=${encodeURIComponent(a)}`);if(!l.ok)throw new Error("ๆœ็ดข็Ÿฅ่ฏ†่Š‚็‚นๅคฑ่ดฅ");return l.json()}const dN=u.memo(({data:a})=>e.jsxs("div",{className:"px-4 py-2 shadow-md rounded-lg bg-gradient-to-br from-blue-500 to-blue-600 border-2 border-blue-700 min-w-[120px]",children:[e.jsx(Yo,{type:"target",position:Jo.Top}),e.jsx("div",{className:"font-semibold text-white text-sm truncate max-w-[200px]",title:a.content,children:a.label}),e.jsx(Yo,{type:"source",position:Jo.Bottom})]}));dN.displayName="EntityNode";const uN=u.memo(({data:a})=>e.jsxs("div",{className:"px-3 py-2 shadow-md rounded-md bg-gradient-to-br from-green-500 to-green-600 border-2 border-green-700 min-w-[100px]",children:[e.jsx(Yo,{type:"target",position:Jo.Top}),e.jsx("div",{className:"font-medium text-white text-xs truncate max-w-[150px]",title:a.content,children:a.label}),e.jsx(Yo,{type:"source",position:Jo.Bottom})]}));uN.displayName="ParagraphNode";const Bk={entity:dN,paragraph:uN};function Pk(a,l){const r=new tj.graphlib.Graph;r.setDefaultEdgeLabel(()=>({})),r.setGraph({rankdir:"TB",ranksep:100,nodesep:80});const c=[],d=[];return a.forEach(m=>{r.setNode(m.id,{width:150,height:50})}),l.forEach(m=>{r.setEdge(m.source,m.target)}),tj.layout(r),a.forEach(m=>{const h=r.node(m.id);c.push({id:m.id,type:m.type,position:{x:h.x-75,y:h.y-25},data:{label:m.content.slice(0,20)+(m.content.length>20?"...":""),content:m.content}})}),l.forEach((m,h)=>{const f={id:`edge-${h}`,source:m.source,target:m.target,animated:a.length<=200&&m.weight>5,style:{strokeWidth:Math.min(m.weight/2,5),opacity:.6}};m.weight>10&&a.length<100&&(f.label=`${m.weight.toFixed(0)}`),d.push(f)}),{nodes:c,edges:d}}function Fk(){const a=ha(),[l,r]=u.useState(!1),[c,d]=u.useState(null),[m,h]=u.useState(""),[f,p]=u.useState("all"),[g,N]=u.useState(50),[j,b]=u.useState("50"),[y,w]=u.useState(!1),[z,M]=u.useState(!0),[S,F]=u.useState(!1),[E,C]=u.useState(!1),[R,H,O]=k1([]),[X,L,me]=C1([]),[Ne,je]=u.useState(0),[re,ge]=u.useState(null),[pe,D]=u.useState(null),{toast:Q}=nt(),I=u.useCallback(A=>A.type==="entity"?"#6366f1":A.type==="paragraph"?"#10b981":"#6b7280",[]),ue=u.useCallback(async(A=!1)=>{try{if(!A&&g>200){C(!0);return}r(!0);const[K,Re]=await Promise.all([Uk(g,f),$k()]);if(d(Re),K.nodes.length===0){Q({title:"ๆ็คบ",description:"็Ÿฅ่ฏ†ๅบ“ไธบ็ฉบ๏ผŒ่ฏทๅ…ˆๅฏผๅ…ฅ็Ÿฅ่ฏ†ๆ•ฐๆฎ"}),H([]),L([]);return}const{nodes:se,edges:$e}=Pk(K.nodes,K.edges);H(se),L($e),je(se.length),Re&&Re.total_nodes>g&&Q({title:"ๆ็คบ",description:`็Ÿฅ่ฏ†ๅ›พ่ฐฑๅŒ…ๅซ ${Re.total_nodes} ไธช่Š‚็‚น๏ผŒๅฝ“ๅ‰ๆ˜พ็คบ ${se.length} ไธช`}),Q({title:"ๅŠ ่ฝฝๆˆๅŠŸ",description:`ๅทฒๅŠ ่ฝฝ ${se.length} ไธช่Š‚็‚น๏ผŒ${$e.length} ๆก่พน`})}catch(K){console.error("ๅŠ ่ฝฝ็Ÿฅ่ฏ†ๅ›พ่ฐฑๅคฑ่ดฅ:",K),Q({title:"ๅŠ ่ฝฝๅคฑ่ดฅ",description:K instanceof Error?K.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}finally{r(!1)}},[g,f,Q]),Y=u.useCallback(async()=>{if(!m.trim()){Q({title:"ๆ็คบ",description:"่ฏท่พ“ๅ…ฅๆœ็ดขๅ…ณ้”ฎ่ฏ"});return}try{const A=await Ik(m);if(A.length===0){Q({title:"ๆœชๆ‰พๅˆฐ",description:"ๆฒกๆœ‰ๆ‰พๅˆฐๅŒน้…็š„่Š‚็‚น"});return}const K=new Set(A.map(Re=>Re.id));H(Re=>Re.map(se=>({...se,style:{...se.style,opacity:K.has(se.id)?1:.3,filter:K.has(se.id)?"brightness(1.2)":"brightness(0.8)"}}))),Q({title:"ๆœ็ดขๅฎŒๆˆ",description:`ๆ‰พๅˆฐ ${A.length} ไธชๅŒน้…่Š‚็‚น`})}catch(A){console.error("ๆœ็ดขๅคฑ่ดฅ:",A),Q({title:"ๆœ็ดขๅคฑ่ดฅ",description:A instanceof Error?A.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}},[m,Q]),we=u.useCallback(()=>{H(A=>A.map(K=>({...K,style:{...K.style,opacity:1,filter:"brightness(1)"}})))},[]),fe=u.useCallback(()=>{M(!1),F(!0),ue()},[ue]),Ee=u.useCallback(()=>{C(!1),setTimeout(()=>{ue(!0)},0)},[ue]),G=u.useCallback((A,K)=>{ge({id:K.id,type:K.type,content:K.data.content})},[]);u.useEffect(()=>{z||S&&ue()},[g,f,z,S]);const $=u.useCallback((A,K)=>{const Re=R.find(cs=>cs.id===K.source),se=R.find(cs=>cs.id===K.target),$e=X.find(cs=>cs.id===K.id);Re&&se&&$e&&D({source:{id:Re.id,type:Re.type,content:Re.data.content},target:{id:se.id,type:se.type,content:se.data.content},edge:{source:K.source,target:K.target,weight:parseFloat(K.label||"0")}})},[R,X]);return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex-shrink-0 p-4 border-b bg-background",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"้บฆ้บฆ็Ÿฅ่ฏ†ๅบ“ๅ›พ่ฐฑ"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"ๅฏ่ง†ๅŒ–็Ÿฅ่ฏ†ๅฎžไฝ“ไธŽๅ…ณ็ณป็ฝ‘็ปœ"})]}),c&&e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.jsxs(Ce,{variant:"outline",className:"gap-1",children:[e.jsx(Zr,{className:"h-3 w-3"}),"่Š‚็‚น: ",c.total_nodes]}),e.jsxs(Ce,{variant:"outline",className:"gap-1",children:[e.jsx(xv,{className:"h-3 w-3"}),"่พน: ",c.total_edges]}),e.jsxs(Ce,{variant:"outline",className:"gap-1",children:[e.jsx(Yt,{className:"h-3 w-3"}),"ๅฎžไฝ“: ",c.entity_nodes]}),e.jsxs(Ce,{variant:"outline",className:"gap-1",children:[e.jsx(Ua,{className:"h-3 w-3"}),"ๆฎต่ฝ: ",c.paragraph_nodes]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 mt-4",children:[e.jsxs("div",{className:"flex-1 flex gap-2",children:[e.jsx(ae,{placeholder:"ๆœ็ดข่Š‚็‚นๅ†…ๅฎน...",value:m,onChange:A=>h(A.target.value),onKeyDown:A=>A.key==="Enter"&&Y(),className:"flex-1"}),e.jsx(_,{onClick:Y,size:"sm",children:e.jsx($t,{className:"h-4 w-4"})}),e.jsx(_,{onClick:we,variant:"outline",size:"sm",children:"้‡็ฝฎ"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(Pe,{value:f,onValueChange:A=>p(A),children:[e.jsx(Ie,{className:"w-[120px]",children:e.jsx(Fe,{})}),e.jsxs(Be,{children:[e.jsx(W,{value:"all",children:"ๅ…จ้ƒจ่Š‚็‚น"}),e.jsx(W,{value:"entity",children:"ไป…ๅฎžไฝ“"}),e.jsx(W,{value:"paragraph",children:"ไป…ๆฎต่ฝ"})]})]}),e.jsxs(Pe,{value:g===1e4?"all":y?"custom":g.toString(),onValueChange:A=>{A==="custom"?(w(!0),b(g.toString())):A==="all"?(w(!1),N(1e4)):(w(!1),N(Number(A)))},children:[e.jsx(Ie,{className:"w-[120px]",children:e.jsx(Fe,{})}),e.jsxs(Be,{children:[e.jsx(W,{value:"50",children:"50 ่Š‚็‚น"}),e.jsx(W,{value:"100",children:"100 ่Š‚็‚น"}),e.jsx(W,{value:"200",children:"200 ่Š‚็‚น"}),e.jsx(W,{value:"500",children:"500 ่Š‚็‚น"}),e.jsx(W,{value:"1000",children:"1000 ่Š‚็‚น"}),e.jsx(W,{value:"all",children:"ๅ…จ้ƒจ (ๆœ€ๅคš10000)"}),e.jsx(W,{value:"custom",children:"่‡ชๅฎšไน‰..."})]})]}),y&&e.jsx(ae,{type:"number",min:"50",value:j,onChange:A=>b(A.target.value),onBlur:()=>{const A=parseInt(j);!isNaN(A)&&A>=50?N(A):(b("50"),N(50))},onKeyDown:A=>{if(A.key==="Enter"){const K=parseInt(j);!isNaN(K)&&K>=50?N(K):(b("50"),N(50))}},placeholder:"ๆœ€ๅฐ‘50ไธช",className:"w-[120px]"}),e.jsx(_,{onClick:()=>ue(),variant:"outline",size:"sm",disabled:l,children:e.jsx(dt,{className:P("h-4 w-4",l&&"animate-spin")})})]})]})]}),e.jsx("div",{className:"flex-1 relative",children:l?e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(dt,{className:"h-8 w-8 animate-spin mx-auto mb-2 text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground",children:"ๅŠ ่ฝฝ็Ÿฅ่ฏ†ๅ›พ่ฐฑไธญ..."})]})}):R.length===0?e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(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(T1,{nodes:R,edges:X,onNodesChange:O,onEdgesChange:me,onNodeClick:G,onEdgeClick:$,nodeTypes:Bk,fitView:!0,minZoom:.05,maxZoom:1.5,defaultViewport:{x:0,y:0,zoom:.5},elevateNodesOnSelect:Ne<=500,nodesDraggable:Ne<=1e3,attributionPosition:"bottom-left",children:[e.jsx(E1,{variant:M1.Dots,gap:12,size:1}),e.jsx(A1,{}),Ne<=500&&e.jsx(z1,{nodeColor:I,nodeBorderRadius:8,pannable:!0,zoomable:!0}),e.jsxs(R1,{position:"top-right",className:"bg-background/95 backdrop-blur-sm rounded-lg border p-3 shadow-lg",children:[e.jsx("div",{className:"text-sm font-semibold mb-2",children:"ๅ›พไพ‹"}),e.jsxs("div",{className:"space-y-2 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-blue-500 to-blue-600 border-2 border-blue-700"}),e.jsx("span",{children:"ๅฎžไฝ“่Š‚็‚น"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-green-500 to-green-600 border-2 border-green-700"}),e.jsx("span",{children:"ๆฎต่ฝ่Š‚็‚น"})]}),Ne>200&&e.jsxs("div",{className:"mt-2 pt-2 border-t text-yellow-600 dark:text-yellow-500",children:[e.jsx("div",{className:"font-semibold",children:"ๆ€ง่ƒฝๆจกๅผ"}),e.jsx("div",{children:"ๅทฒ็ฆ็”จๅŠจ็”ป"}),Ne>500&&e.jsx("div",{children:"ๅทฒ็ฆ็”จ็ผฉ็•ฅๅ›พ"})]})]})]})]})}),e.jsx(Qs,{open:!!re,onOpenChange:A=>!A&&ge(null),children:e.jsxs(Hs,{className:"max-w-2xl max-h-[80vh] grid grid-rows-[auto_1fr_auto] overflow-hidden",children:[e.jsx(qs,{children:e.jsx(Vs,{children:"่Š‚็‚น่ฏฆๆƒ…"})}),re&&e.jsx(ts,{className:"h-full pr-4",children:e.jsxs("div",{className:"space-y-4 pb-2",children:[e.jsx("div",{className:"grid grid-cols-2 gap-4",children:e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"็ฑปๅž‹"}),e.jsx("div",{className:"mt-1",children:e.jsx(Ce,{variant:re.type==="entity"?"default":"secondary",children:re.type==="entity"?"๐Ÿท๏ธ ๅฎžไฝ“":"๐Ÿ“„ ๆฎต่ฝ"})})]})}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"ID"}),e.jsx("code",{className:"mt-1 block p-2 bg-muted rounded text-xs break-all",children:re.id})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"ๅ†…ๅฎน"}),e.jsx("div",{className:"mt-1 p-3 bg-muted rounded border",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap break-words",children:re.content})}),re.type==="paragraph"&&re.content&&re.content.length<20&&e.jsx("div",{className:"mt-2 p-3 bg-yellow-50 dark:bg-yellow-950 border border-yellow-200 dark:border-yellow-800 rounded",children:e.jsxs("p",{className:"text-xs text-yellow-800 dark:text-yellow-200",children:["๐Ÿ’ก ",e.jsx("strong",{children:"ๆ็คบ๏ผš"}),"ๆฎต่ฝๅ†…ๅฎนๆ˜พ็คบไธๅฎŒๆ•ด๏ผŸ",e.jsx("br",{}),"ๆ‚จๅฏไปฅๅœจ ",e.jsx("strong",{children:"้…็ฝฎ โ†’ WebUI ๆœๅŠก้…็ฝฎ"}),' ไธญๅฏ็”จ "ๅœจ็Ÿฅ่ฏ†ๅ›พ่ฐฑไธญๅŠ ่ฝฝๆฎต่ฝๅฎŒๆ•ดๅ†…ๅฎน" ้€‰้กน๏ผŒไปฅๆ˜พ็คบๆฎต่ฝ็š„ๅฎŒๆ•ดๆ–‡ๆœฌใ€‚',e.jsx("br",{}),"ๆณจๆ„๏ผšๆญคๅŠŸ่ƒฝไผš้ขๅค–ๅ†ๆฌกๅŠ ่ฝฝ embedding store๏ผŒๅ ็”จ็บฆๆ•ฐ็™พMBๅ†…ๅญ˜ใ€‚ไธๅปบ่ฎฎๅœจ็”Ÿไบง็Žฏๅขƒไธญ้•ฟๆœŸๅผ€ๅฏใ€‚"]})})]})]})})]})}),e.jsx(Qs,{open:!!pe,onOpenChange:A=>!A&&D(null),children:e.jsxs(Hs,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[e.jsx(qs,{children:e.jsx(Vs,{children:"่พน่ฏฆๆƒ…"})}),pe&&e.jsx(ts,{className:"flex-1 pr-4",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0 p-3 bg-blue-50 dark:bg-blue-950 rounded border-2 border-blue-200 dark:border-blue-800",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"ๆบ่Š‚็‚น"}),e.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:pe.source.content}),e.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[pe.source.id.slice(0,40),"..."]})]}),e.jsx("div",{className:"text-2xl text-muted-foreground flex-shrink-0",children:"โ†’"}),e.jsxs("div",{className:"flex-1 min-w-0 p-3 bg-green-50 dark:bg-green-950 rounded border-2 border-green-200 dark:border-green-800",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"็›ฎๆ ‡่Š‚็‚น"}),e.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:pe.target.content}),e.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[pe.target.id.slice(0,40),"..."]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"ๆƒ้‡"}),e.jsx("div",{className:"mt-1",children:e.jsx(Ce,{variant:"outline",className:"text-base font-mono",children:pe.edge.weight.toFixed(4)})})]})]})})]})}),e.jsx(bs,{open:z,onOpenChange:M,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"ๅŠ ่ฝฝ็Ÿฅ่ฏ†ๅ›พ่ฐฑ"}),e.jsxs(gs,{children:["็Ÿฅ่ฏ†ๅ›พ่ฐฑ็š„ๅŠจๆ€ๅฑ•็คบไผšๆถˆ่€—่พƒๅคš็ณป็ปŸ่ต„ๆบใ€‚",e.jsx("br",{}),"็กฎๅฎš่ฆๅŠ ่ฝฝ็Ÿฅ่ฏ†ๅ›พ่ฐฑๅ—?"]})]}),e.jsxs(fs,{children:[e.jsx(vs,{onClick:()=>a({to:"/"}),children:"ๅ–ๆถˆ (่ฟ”ๅ›ž้ฆ–้กต)"}),e.jsx(js,{onClick:fe,children:"็กฎ่ฎคๅŠ ่ฝฝ"})]})]})}),e.jsx(bs,{open:E,onOpenChange:C,children:e.jsxs(xs,{children:[e.jsxs(hs,{children:[e.jsx(ps,{children:"โš ๏ธ ่Š‚็‚นๆ•ฐ้‡่พƒๅคš"}),e.jsx(gs,{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(fs,{children:[e.jsx(vs,{onClick:()=>{C(!1),g>200&&(N(50),w(!1))},children:"ๅ–ๆถˆ"}),e.jsx(js,{onClick:Ee,className:"bg-orange-600 hover:bg-orange-700",children:"ๆˆ‘ไบ†่งฃ้ฃŽ้™ฉ๏ผŒ็ปง็ปญๅŠ ่ฝฝ"})]})]})})]})}function Hk(){return e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsx("div",{className:"flex-none border-b bg-card/50 px-6 py-4",children:e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"้บฆ้บฆ็Ÿฅ่ฏ†ๅบ“็ฎก็†"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"็ฎก็†ๅ’Œ็ป„็ป‡้บฆ้บฆ็š„็Ÿฅ่ฏ†ๅบ“ๅ†…ๅฎน"})]})})}),e.jsx("div",{className:"flex-1 overflow-auto p-6",children:e.jsx("div",{className:"mx-auto max-w-4xl",children:e.jsxs(Te,{children:[e.jsxs(Oe,{className:"text-center",children:[e.jsx("div",{className:"mx-auto mb-4 flex h-20 w-20 items-center justify-center rounded-full bg-primary/10",children:e.jsx(Zr,{className:"h-10 w-10 text-primary"})}),e.jsx(Ue,{className:"text-2xl",children:"้บฆ้บฆ็Ÿฅ่ฏ†ๅบ“็ฎก็†"}),e.jsx(Ns,{className:"text-base",children:"ๅŠŸ่ƒฝๅผ€ๅ‘ไธญ๏ผŒๆ•ฌ่ฏทๆœŸๅพ…"})]}),e.jsx(ze,{className:"text-center text-sm text-muted-foreground",children:e.jsx("p",{children:"ๆญคๅŠŸ่ƒฝๅฐ†ๆไพ›็Ÿฅ่ฏ†ๅบ“็š„ๅˆ›ๅปบใ€็ผ–่พ‘ใ€ๅฏผๅ…ฅๅ’Œ็ฎก็†่ƒฝๅŠ›"})})]})})})]})}function aj({className:a,classNames:l,showOutsideDays:r=!0,captionLayout:c="label",buttonVariant:d="ghost",formatters:m,components:h,...f}){const p=Ev();return e.jsx(j1,{showOutsideDays:r,className:P("bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,a),captionLayout:c,formatters:{formatMonthDropdown:g=>g.toLocaleString("default",{month:"short"}),...m},classNames:{root:P("w-fit",p.root),months:P("relative flex flex-col gap-4 md:flex-row",p.months),month:P("flex w-full flex-col gap-4",p.month),nav:P("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",p.nav),button_previous:P(si({variant:d}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",p.button_previous),button_next:P(si({variant:d}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",p.button_next),month_caption:P("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",p.month_caption),dropdowns:P("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",p.dropdowns),dropdown_root:P("has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",p.dropdown_root),dropdown:P("bg-popover absolute inset-0 opacity-0",p.dropdown),caption_label:P("select-none font-medium",c==="label"?"text-sm":"[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5",p.caption_label),table:"w-full border-collapse",weekdays:P("flex",p.weekdays),weekday:P("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",p.weekday),week:P("mt-2 flex w-full",p.week),week_number_header:P("w-[--cell-size] select-none",p.week_number_header),week_number:P("text-muted-foreground select-none text-[0.8rem]",p.week_number),day:P("group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",p.day),range_start:P("bg-accent rounded-l-md",p.range_start),range_middle:P("rounded-none",p.range_middle),range_end:P("bg-accent rounded-r-md",p.range_end),today:P("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",p.today),outside:P("text-muted-foreground aria-selected:text-muted-foreground",p.outside),disabled:P("text-muted-foreground opacity-50",p.disabled),hidden:P("invisible",p.hidden),...l},components:{Root:({className:g,rootRef:N,...j})=>e.jsx("div",{"data-slot":"calendar",ref:N,className:P(g),...j}),Chevron:({className:g,orientation:N,...j})=>N==="left"?e.jsx(Pa,{className:P("size-4",g),...j}):N==="right"?e.jsx(ra,{className:P("size-4",g),...j}):e.jsx(Ia,{className:P("size-4",g),...j}),DayButton:qk,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 qk({className:a,day:l,modifiers:r,...c}){const d=Ev(),m=u.useRef(null);return u.useEffect(()=>{r.focused&&m.current?.focus()},[r.focused]),e.jsx(_,{ref:m,variant:"ghost",size:"icon","data-day":l.date.toLocaleDateString(),"data-selected-single":r.selected&&!r.range_start&&!r.range_end&&!r.range_middle,"data-range-start":r.range_start,"data-range-end":r.range_end,"data-range-middle":r.range_middle,className:P("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70",d.day,a),...c})}const Uo={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 Vk(){const[a,l]=u.useState([]),[r,c]=u.useState(""),[d,m]=u.useState("all"),[h,f]=u.useState("all"),[p,g]=u.useState(void 0),[N,j]=u.useState(void 0),[b,y]=u.useState(!0),[w,z]=u.useState(!1),[M,S]=u.useState("xs"),[F,E]=u.useState(4),[C,R]=u.useState(!1),H=u.useRef(null);u.useEffect(()=>{const Y=Qn.getAllLogs();l(Y);const we=Qn.onLog(()=>{l(Qn.getAllLogs())}),fe=Qn.onConnectionChange(Ee=>{z(Ee)});return()=>{we(),fe()}},[]);const O=u.useMemo(()=>{const Y=new Set(a.map(we=>we.module).filter(we=>we&&we.trim()!==""));return Array.from(Y).sort()},[a]),X=Y=>{switch(Y){case"DEBUG":return"text-muted-foreground";case"INFO":return"text-blue-500 dark:text-blue-400";case"WARNING":return"text-yellow-600 dark:text-yellow-500";case"ERROR":return"text-red-600 dark:text-red-500";case"CRITICAL":return"text-red-700 dark:text-red-400 font-bold";default:return"text-foreground"}},L=Y=>{switch(Y){case"DEBUG":return"bg-gray-800/30 dark:bg-gray-800/50";case"INFO":return"bg-blue-900/20 dark:bg-blue-500/20";case"WARNING":return"bg-yellow-900/20 dark:bg-yellow-500/20";case"ERROR":return"bg-red-900/20 dark:bg-red-500/20";case"CRITICAL":return"bg-red-900/30 dark:bg-red-600/30";default:return"bg-gray-800/20 dark:bg-gray-800/30"}},me=()=>{window.location.reload()},Ne=()=>{Qn.clearLogs(),l([])},je=()=>{const Y=pe.map(G=>`${G.timestamp} [${G.level.padEnd(8)}] [${G.module}] ${G.message}`).join(` +`),we=new Blob([Y],{type:"text/plain;charset=utf-8"}),fe=URL.createObjectURL(we),Ee=document.createElement("a");Ee.href=fe,Ee.download=`logs-${Em(new Date,"yyyy-MM-dd-HHmmss")}.txt`,Ee.click(),URL.revokeObjectURL(fe)},re=()=>{y(!b)},ge=()=>{g(void 0),j(void 0)},pe=u.useMemo(()=>a.filter(Y=>{const we=r===""||Y.message.toLowerCase().includes(r.toLowerCase())||Y.module.toLowerCase().includes(r.toLowerCase()),fe=d==="all"||Y.level===d,Ee=h==="all"||Y.module===h;let G=!0;if(p||N){const $=new Date(Y.timestamp);if(p){const A=new Date(p);A.setHours(0,0,0,0),G=G&&$>=A}if(N){const A=new Date(N);A.setHours(23,59,59,999),G=G&&$<=A}}return we&&fe&&Ee&&G}),[a,r,d,h,p,N]),D=Uo[M].rowHeight+F,Q=aw({count:pe.length,getScrollElement:()=>H.current,estimateSize:()=>D,overscan:50}),I=u.useRef(!1),ue=u.useRef(pe.length);return u.useEffect(()=>{const Y=H.current;if(!Y)return;const we=()=>{if(I.current)return;const{scrollTop:fe,scrollHeight:Ee,clientHeight:G}=Y,$=Ee-fe-G;$>100&&b?y(!1):$<50&&!b&&y(!0)};return Y.addEventListener("scroll",we,{passive:!0}),()=>Y.removeEventListener("scroll",we)},[b]),u.useEffect(()=>{const Y=pe.length>ue.current;ue.current=pe.length,b&&pe.length>0&&Y&&(I.current=!0,Q.scrollToIndex(pe.length-1,{align:"end",behavior:"auto"}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{I.current=!1})}))},[pe.length,b,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:P("h-2 w-2 sm:h-2.5 sm:w-2.5 rounded-full",w?"bg-green-500 animate-pulse":"bg-red-500")}),e.jsx("span",{className:"text-xs text-muted-foreground",children:w?"ๅทฒ่ฟžๆŽฅ":"ๆœช่ฟžๆŽฅ"})]})]}),e.jsx(Te,{className:"p-2 sm:p-3",children:e.jsx(xc,{open:C,onOpenChange:R,children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"flex-1 relative min-w-0",children:[e.jsx($t,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),e.jsx(ae,{placeholder:"ๆœ็ดขๆ—ฅๅฟ—...",value:r,onChange:Y=>c(Y.target.value),className:"pl-8 h-8 text-xs sm:text-sm"})]}),e.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[e.jsxs(_,{variant:b?"default":"outline",size:"sm",onClick:re,className:"h-8 px-2",title:b?"่‡ชๅŠจๆปšๅŠจ":"ๅทฒๆš‚ๅœ",children:[b?e.jsx(F_,{className:"h-3.5 w-3.5"}):e.jsx(H_,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"ml-1 text-xs hidden sm:inline",children:b?"ๆปšๅŠจ":"ๆš‚ๅœ"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:Ne,className:"h-8 px-2",title:"ๆธ…็ฉบๆ—ฅๅฟ—",children:[e.jsx(os,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"ml-1 text-xs hidden md:inline",children:"ๆธ…็ฉบ"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:je,className:"h-8 px-2 hidden sm:flex",title:"ๅฏผๅ‡บๆ—ฅๅฟ—",children:[e.jsx(na,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"ml-1 text-xs hidden lg:inline",children:"ๅฏผๅ‡บ"})]}),e.jsx(hc,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:"h-8 px-2",title:C?"ๆ”ถ่ตท็ญ›้€‰":"ๅฑ•ๅผ€็ญ›้€‰",children:[e.jsx(Po,{className:"h-3.5 w-3.5"}),C?e.jsx(Xr,{className:"h-3.5 w-3.5 ml-1"}):e.jsx(Ia,{className:"h-3.5 w-3.5 ml-1"})]})})]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground text-center sm:text-right -mt-1",children:[e.jsxs("span",{className:"font-mono",children:[pe.length," / ",a.length]}),e.jsx("span",{className:"ml-1",children:"ๆกๆ—ฅๅฟ—"})]}),e.jsxs(fc,{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-2",children:[e.jsxs(Pe,{value:d,onValueChange:m,children:[e.jsxs(Ie,{className:"w-full sm:flex-1 h-8 text-xs",children:[e.jsx(Po,{className:"h-3.5 w-3.5 mr-1.5"}),e.jsx(Fe,{placeholder:"็บงๅˆซ"})]}),e.jsxs(Be,{children:[e.jsx(W,{value:"all",children:"ๅ…จ้ƒจ็บงๅˆซ"}),e.jsx(W,{value:"DEBUG",children:"DEBUG"}),e.jsx(W,{value:"INFO",children:"INFO"}),e.jsx(W,{value:"WARNING",children:"WARNING"}),e.jsx(W,{value:"ERROR",children:"ERROR"}),e.jsx(W,{value:"CRITICAL",children:"CRITICAL"})]})]}),e.jsxs(Pe,{value:h,onValueChange:f,children:[e.jsxs(Ie,{className:"w-full sm:flex-1 h-8 text-xs",children:[e.jsx(Po,{className:"h-3.5 w-3.5 mr-1.5"}),e.jsx(Fe,{placeholder:"ๆจกๅ—"})]}),e.jsxs(Be,{children:[e.jsx(W,{value:"all",children:"ๅ…จ้ƒจๆจกๅ—"}),O.map(Y=>e.jsx(W,{value:Y,children:Y},Y))]})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-2",children:[e.jsxs(cl,{children:[e.jsx(ol,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:P("w-full sm:flex-1 justify-start text-left font-normal h-8",!p&&"text-muted-foreground"),children:[e.jsx(Ko,{className:"mr-1.5 h-3.5 w-3.5"}),e.jsx("span",{className:"text-xs",children:p?Em(p,"PP",{locale:Oo}):"ๅผ€ๅง‹ๆ—ฅๆœŸ"})]})}),e.jsx(tl,{className:"w-auto p-0",align:"start",children:e.jsx(aj,{mode:"single",selected:p,onSelect:g,initialFocus:!0,locale:Oo})})]}),e.jsxs(cl,{children:[e.jsx(ol,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:P("w-full sm:flex-1 justify-start text-left font-normal h-8",!N&&"text-muted-foreground"),children:[e.jsx(Ko,{className:"mr-1.5 h-3.5 w-3.5"}),e.jsx("span",{className:"text-xs",children:N?Em(N,"PP",{locale:Oo}):"็ป“ๆŸๆ—ฅๆœŸ"})]})}),e.jsx(tl,{className:"w-auto p-0",align:"start",children:e.jsx(aj,{mode:"single",selected:N,onSelect:j,initialFocus:!0,locale:Oo})})]}),(p||N)&&e.jsxs(_,{variant:"outline",size:"sm",onClick:ge,className:"w-full sm:w-auto h-8",children:[e.jsx(Sa,{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(q_,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"ๅญ—ๅท"})]}),e.jsx("div",{className:"flex gap-1",children:Object.keys(Uo).map(Y=>e.jsx(_,{variant:M===Y?"default":"outline",size:"sm",onClick:()=>S(Y),className:"h-6 px-2 text-xs",children:Uo[Y].label},Y))})]}),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(el,{value:[F],onValueChange:([Y])=>E(Y),min:0,max:12,step:2,className:"flex-1"}),e.jsxs("span",{className:"text-xs text-muted-foreground w-7",children:[F,"px"]})]}),e.jsxs("div",{className:"flex gap-2 sm:hidden",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:me,className:"flex-1 h-8",children:[e.jsx(dt,{className:"h-3.5 w-3.5 mr-1"}),e.jsx("span",{className:"text-xs",children:"ๅˆทๆ–ฐ"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:je,className:"flex-1 h-8",children:[e.jsx(na,{className:"h-3.5 w-3.5 mr-1"}),e.jsx("span",{className:"text-xs",children:"ๅฏผๅ‡บ"})]})]})]})]})]})})})]}),e.jsx("div",{className:"flex-1 min-h-0 px-2 sm:px-3 lg:px-4 pb-2 sm:pb-3 lg:pb-4",children:e.jsx(Te,{className:"bg-black dark:bg-gray-950 border-gray-800 dark:border-gray-900 h-full overflow-hidden",children:e.jsx("div",{ref:H,className:P("h-full overflow-auto","[&::-webkit-scrollbar]:w-2.5","[&::-webkit-scrollbar-track]:bg-transparent","[&::-webkit-scrollbar-thumb]:bg-border [&::-webkit-scrollbar-thumb]:rounded-full","[&::-webkit-scrollbar-thumb:hover]:bg-border/80"),children:e.jsx("div",{className:P("p-2 sm:p-3 font-mono relative",Uo[M].class),style:{height:`${Q.getTotalSize()}px`},children:pe.length===0?e.jsx("div",{className:"text-gray-500 dark:text-gray-600 text-center py-8 text-xs sm:text-sm",children:"ๆš‚ๆ— ๆ—ฅๅฟ—ๆ•ฐๆฎ"}):Q.getVirtualItems().map(Y=>{const we=pe[Y.index];return e.jsxs("div",{"data-index":Y.index,ref:Q.measureElement,className:P("absolute top-0 left-0 w-full px-2 sm:px-3 rounded hover:bg-white/5 transition-colors",L(we.level)),style:{transform:`translateY(${Y.start}px)`,paddingTop:`${F/2}px`,paddingBottom:`${F/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:we.timestamp}),e.jsxs("span",{className:P("font-semibold text-[10px]",X(we.level)),children:["[",we.level,"]"]})]}),e.jsx("div",{className:"text-cyan-400 dark:text-cyan-500 truncate text-[10px]",children:we.module}),e.jsx("div",{className:"text-gray-300 dark:text-gray-400 whitespace-pre-wrap break-words text-[10px]",children:we.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:we.timestamp}),e.jsxs("span",{className:P("flex-shrink-0 w-[65px] lg:w-[75px] font-semibold",X(we.level)),children:["[",we.level,"]"]}),e.jsx("span",{className:"text-cyan-400 dark:text-cyan-500 flex-shrink-0 w-[100px] lg:w-[130px] truncate",children:we.module}),e.jsx("span",{className:"text-gray-300 dark:text-gray-400 flex-1 whitespace-pre-wrap break-words",children:we.message})]})]},Y.key)})})})})})]})}async function Gk(){return(await ke("/api/planner/overview")).json()}async function Kk(a,l=1,r=20,c){const d=new URLSearchParams({page:l.toString(),page_size:r.toString()});return c&&d.append("search",c),(await ke(`/api/planner/chat/${a}/logs?${d}`)).json()}async function Qk(a,l){return(await ke(`/api/planner/log/${a}/${l}`)).json()}async function Yk(){return(await ke("/api/replier/overview")).json()}async function Jk(a,l=1,r=20,c){const d=new URLSearchParams({page:l.toString(),page_size:r.toString()});return c&&d.append("search",c),(await ke(`/api/replier/chat/${a}/logs?${d}`)).json()}async function Xk(a,l){return(await ke(`/api/replier/log/${a}/${l}`)).json()}function mN(){const[a,l]=u.useState(new Map),[r,c]=u.useState(!0),d=u.useCallback(async()=>{try{c(!0);const h=await gx();if(h?.data){const f=new Map;h.data.forEach(p=>{f.set(p.chat_id,p.chat_name)}),l(f)}}catch(h){console.error("ๅŠ ่ฝฝ่Šๅคฉๅˆ—่กจๅคฑ่ดฅ:",h)}finally{c(!1)}},[]);u.useEffect(()=>{d()},[d]);const m=u.useCallback(h=>a.get(h)||h,[a]);return{chatNameMap:a,getChatName:m,loading:r,reload:d}}function Zo(a){return new Date(a*1e3).toLocaleString("zh-CN")}function xN(a){const r=Date.now()/1e3-a;return r<60?"ๅˆšๅˆš":r<3600?`${Math.floor(r/60)} ๅˆ†้’Ÿๅ‰`:r<86400?`${Math.floor(r/3600)} ๅฐๆ—ถๅ‰`:`${Math.floor(r/86400)} ๅคฉๅ‰`}function hN(a,l,r=1e4){u.useEffect(()=>{if(!a)return;const c=setInterval(l,r);return()=>clearInterval(c)},[a,l,r])}function Zk({autoRefresh:a,refreshKey:l}){const[r,c]=u.useState("overview"),[d,m]=u.useState(null),{getChatName:h}=mN(),[f,p]=u.useState(null),[g,N]=u.useState(!0),[j,b]=u.useState(null),[y,w]=u.useState(!1),[z,M]=u.useState(1),[S,F]=u.useState(20),[E,C]=u.useState(""),[R,H]=u.useState(""),[O,X]=u.useState(""),[L,me]=u.useState(null),[Ne,je]=u.useState(!1),[re,ge]=u.useState(!1),pe=u.useCallback(async()=>{try{N(!0);const $=await Gk();p($)}catch($){console.error("ๅŠ ่ฝฝ่ง„ๅˆ’ๅ™จๆ€ป่งˆๅคฑ่ดฅ:",$)}finally{N(!1)}},[]),D=u.useCallback(async()=>{if(d)try{w(!0);const $=await Kk(d.chat_id,z,S,R||void 0);b($)}catch($){console.error("ๅŠ ่ฝฝ่Šๅคฉๆ—ฅๅฟ—ๅคฑ่ดฅ:",$)}finally{w(!1)}},[d,z,S,R]);u.useEffect(()=>{pe()},[pe]),u.useEffect(()=>{l>0&&(r==="overview"?pe():D())},[l,r,pe,D]),u.useEffect(()=>{r==="chat-logs"&&d&&D()},[r,d,D]),hN(a,u.useCallback(()=>{r==="overview"?pe():D()},[r,pe,D]));const Q=$=>{m($),M(1),H(""),X(""),c("chat-logs")},I=()=>{c("overview"),m(null),b(null),H(""),X("")},ue=()=>{H(O),M(1)},Y=()=>{X(""),H(""),M(1)},we=async($,A)=>{try{ge(!0),je(!0);const K=await Qk($,A);me(K)}catch(K){console.error("ๅŠ ่ฝฝ่ฎกๅˆ’่ฏฆๆƒ…ๅคฑ่ดฅ:",K)}finally{ge(!1)}},fe=$=>{F(Number($)),M(1)},Ee=()=>{const $=parseInt(E),A=j?Math.ceil(j.total/j.page_size):0;!isNaN($)&&$>=1&&$<=A&&(M($),C(""))},G=j?Math.ceil(j.total/j.page_size):0;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-4",children:r==="overview"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"่Šๅคฉๆ•ฐ้‡"}),e.jsx(Ba,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(ze,{children:g?e.jsx(ks,{className:"h-8 w-16"}):e.jsx("div",{className:"text-2xl font-bold",children:f?.total_chats||0})})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"่ฎกๅˆ’ๆ€ปๆ•ฐ"}),e.jsx(rx,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(ze,{children:g?e.jsx(ks,{className:"h-8 w-16"}):e.jsx("div",{className:"text-2xl font-bold",children:f?.total_plans||0})})]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"่Šๅคฉๅˆ—่กจ"}),e.jsx(Ns,{children:"็‚นๅ‡ปๆŸฅ็œ‹่ฏฅ่Šๅคฉ็š„ๆ‰€ๆœ‰่ฎกๅˆ’่ฎฐๅฝ•"})]}),e.jsx(ze,{children:g?e.jsx("div",{className:"grid gap-3 md:grid-cols-2 lg:grid-cols-3",children:[...Array(6)].map(($,A)=>e.jsx(ks,{className:"h-24 w-full"},A))}):f?.chats&&f.chats.length>0?e.jsx("div",{className:"grid gap-3 md:grid-cols-2 lg:grid-cols-3",children:f.chats.map($=>e.jsxs("div",{className:"border rounded-lg p-4 hover:bg-accent/50 transition-colors cursor-pointer",onClick:()=>Q($),children:[e.jsxs("div",{className:"flex items-start justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ba,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm truncate max-w-[180px]",title:h($.chat_id),children:h($.chat_id)})]}),e.jsx(Ce,{variant:"secondary",children:$.plan_count})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["ๆœ€ๅŽๆดปๅŠจ: ",xN($.latest_timestamp)]})]},$.chat_id))}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"ๆš‚ๆ— ่Šๅคฉ่ฎฐๅฝ•"})})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-4 mb-4",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:I,children:[e.jsx($a,{className:"h-4 w-4 mr-2"}),"่ฟ”ๅ›ž่Šๅคฉๅˆ—่กจ"]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:["ๅฝ“ๅ‰่Šๅคฉ: ",e.jsx("span",{className:"font-medium",children:d?h(d.chat_id):""}),e.jsx("span",{className:"mx-2",children:"โ€ข"}),"ๅ…ฑ ",j?.total||0," ๆก่ฎกๅˆ’่ฎฐๅฝ•"]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(Ue,{children:"่ฎกๅˆ’ๆ‰ง่กŒ่ฎฐๅฝ•"}),e.jsx(Ns,{children:d?h(d.chat_id):""})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ae,{placeholder:"ๆœ็ดขๆ็คบ่ฏๅ†…ๅฎน...",value:O,onChange:$=>X($.target.value),onKeyDown:$=>$.key==="Enter"&&ue(),className:"w-full sm:w-48"}),e.jsx(_,{variant:"outline",size:"icon",onClick:ue,children:e.jsx($t,{className:"h-4 w-4"})}),R&&e.jsx(_,{variant:"ghost",size:"sm",onClick:Y,children:"ๆธ…้™ค"})]}),e.jsxs(Pe,{value:S.toString(),onValueChange:fe,children:[e.jsx(Ie,{className:"w-full sm:w-32",children:e.jsx(Fe,{})}),e.jsxs(Be,{children:[e.jsx(W,{value:"10",children:"10ๆก/้กต"}),e.jsx(W,{value:"20",children:"20ๆก/้กต"}),e.jsx(W,{value:"50",children:"50ๆก/้กต"}),e.jsx(W,{value:"100",children:"100ๆก/้กต"})]})]})]})]}),R&&e.jsxs("div",{className:"text-sm text-muted-foreground mt-2",children:["ๆœ็ดขๅ…ณ้”ฎ่ฏ: ",e.jsxs("span",{className:"font-medium",children:['"',R,'"']})]})]}),e.jsx(ze,{children:y?e.jsx("div",{className:"space-y-2",children:[...Array(5)].map(($,A)=>e.jsx(ks,{className:"h-20 w-full"},A))}):j?.data&&j.data.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-2",children:j.data.map($=>e.jsxs("div",{className:"border rounded-lg p-3 hover:bg-accent/50 transition-colors cursor-pointer",onClick:()=>we($.chat_id,$.filename),children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:Zo($.timestamp)}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsxs(Ce,{variant:"secondary",className:"text-xs",children:[$.action_count," ไธชๅŠจไฝœ"]}),e.jsxs(Ce,{variant:"outline",className:"text-xs",children:[$.total_plan_ms.toFixed(0),"ms"]})]})]}),$.action_types&&$.action_types.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:$.action_types.map((A,K)=>e.jsx(Ce,{variant:"outline",className:"text-xs bg-blue-50 dark:bg-blue-950 text-blue-700 dark:text-blue-300 border-blue-200 dark:border-blue-800",children:A},K))}),e.jsx("p",{className:"text-sm line-clamp-2",children:$.reasoning_preview||"ๆ— ๆŽจ็†ๅ†…ๅฎน"})]},$.filename))}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-3 mt-4 pt-4 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["ๅ…ฑ ",j.total," ๆก่ฎฐๅฝ•๏ผŒ็ฌฌ ",z," / ",G," ้กต"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>M(1),disabled:z===1,className:"hidden sm:flex",children:e.jsx(kn,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>M($=>Math.max(1,$-1)),disabled:z===1,children:e.jsx(Pa,{className:"h-4 w-4"})}),e.jsxs("div",{className:"hidden sm:flex items-center gap-2",children:[e.jsx(ae,{type:"number",min:1,max:G,value:E,onChange:$=>C($.target.value),onKeyDown:$=>$.key==="Enter"&&Ee(),placeholder:"่ทณ่ฝฌ",className:"w-20 h-8"}),e.jsx(_,{size:"sm",variant:"outline",onClick:Ee,children:"่ทณ่ฝฌ"})]}),e.jsxs("span",{className:"sm:hidden text-sm text-muted-foreground",children:[z,"/",G]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>M($=>Math.min(G,$+1)),disabled:z===G,children:e.jsx(ra,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>M(G),disabled:z===G,className:"hidden sm:flex",children:e.jsx(Cn,{className:"h-4 w-4"})})]})]})]}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"ๆš‚ๆ— ่ฎกๅˆ’่ฎฐๅฝ•"})})]})]})}),e.jsx(Qs,{open:Ne,onOpenChange:je,children:e.jsxs(Hs,{className:"max-w-4xl max-h-[80vh] grid grid-rows-[auto_1fr_auto] overflow-hidden",children:[e.jsxs(qs,{children:[e.jsxs(Vs,{className:"flex items-center gap-2",children:[e.jsx(Ua,{className:"h-5 w-5"}),"่ฎกๅˆ’ๆ‰ง่กŒ่ฏฆๆƒ…"]}),e.jsx(at,{children:"ๆŸฅ็œ‹้บฆ้บฆ็š„่ฏฆ็ป†่ฎกๅˆ’ๆŽจ็†่ฟ‡็จ‹ๅ’Œๆ‰ง่กŒๅŠจไฝœ"})]}),e.jsx(ts,{className:"h-full pr-4",children:e.jsx("div",{className:"space-y-6 pb-4",children:re?e.jsx("div",{className:"space-y-4",children:[...Array(5)].map(($,A)=>e.jsx(ks,{className:"h-24 w-full"},A))}):L?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(da,{className:"h-4 w-4"}),"ๅŸบๆœฌไฟกๆฏ"]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 p-4 bg-muted/50 rounded-lg",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"่Šๅคฉ"}),e.jsx("div",{className:"text-sm",title:L.chat_id,children:h(L.chat_id)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"ๆ—ถ้—ดๆˆณ"}),e.jsx("div",{className:"text-sm",children:Zo(L.timestamp)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"็ฑปๅž‹"}),e.jsx(Ce,{variant:"outline",children:L.type})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"ๅŠจไฝœๆ•ฐ้‡"}),e.jsxs(Ce,{children:[L.actions.length," ไธชๅŠจไฝœ"]})]})]})]}),e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(sl,{className:"h-4 w-4"}),"ๆ€ง่ƒฝ็ปŸ่ฎก"]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs(Te,{children:[e.jsx(Oe,{className:"p-4 pb-2",children:e.jsx(Ue,{className:"text-xs text-muted-foreground",children:"ๆ็คบ่ฏๆž„ๅปบ"})}),e.jsx(ze,{className:"p-4 pt-0",children:e.jsxs("div",{className:"text-xl font-bold",children:[L.timing.prompt_build_ms?.toFixed(2)||0,"ms"]})})]}),e.jsxs(Te,{children:[e.jsx(Oe,{className:"p-4 pb-2",children:e.jsx(Ue,{className:"text-xs text-muted-foreground",children:"LLM ๆŽจ็†"})}),e.jsx(ze,{className:"p-4 pt-0",children:e.jsxs("div",{className:"text-xl font-bold",children:[L.timing.llm_duration_ms?.toFixed(2)||0,"ms"]})})]}),e.jsxs(Te,{children:[e.jsx(Oe,{className:"p-4 pb-2",children:e.jsx(Ue,{className:"text-xs text-muted-foreground",children:"ๆ€ป่ฎกๅˆ’ๆ—ถ้—ด"})}),e.jsx(ze,{className:"p-4 pt-0",children:e.jsxs("div",{className:"text-xl font-bold",children:[L.timing.total_plan_ms?.toFixed(2)||0,"ms"]})})]})]})]}),e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(hx,{className:"h-4 w-4"}),"ๆŽจ็†่ฟ‡็จ‹"]}),e.jsx("div",{className:"p-4 bg-muted/50 rounded-lg",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap leading-relaxed",children:L.reasoning||"ๆ— ๆŽจ็†ๅ†…ๅฎน"})})]}),e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(rv,{className:"h-4 w-4"}),"ๆ‰ง่กŒๅŠจไฝœ (",L.actions.length,")"]}),e.jsx("div",{className:"space-y-3",children:L.actions.map(($,A)=>e.jsxs(Te,{children:[e.jsx(Oe,{className:"p-4 pb-3",children:e.jsx("div",{className:"flex items-start justify-between",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(Ce,{variant:"default",children:["ๅŠจไฝœ ",A+1]}),e.jsx(Ce,{variant:"outline",children:$.action_type})]})})}),e.jsxs(ze,{className:"p-4 pt-0 space-y-3",children:[$.reasoning&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:"ๆŽจ็†ไพๆฎ"}),e.jsx("p",{className:"text-sm bg-muted/30 p-2 rounded",children:typeof $.reasoning=="string"?$.reasoning:JSON.stringify($.reasoning)})]}),$.action_message&&e.jsxs("div",{className:"overflow-hidden",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:"ๅŠจไฝœๆถˆๆฏ"}),typeof $.action_message=="string"?e.jsx("p",{className:"text-sm bg-muted/30 p-2 rounded break-all whitespace-pre-wrap",children:$.action_message}):e.jsx("pre",{className:"text-xs bg-muted/30 p-2 rounded overflow-x-auto whitespace-pre-wrap break-all",children:JSON.stringify($.action_message,null,2)})]}),$.action_data&&Object.keys($.action_data).length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:"ๅŠจไฝœๆ•ฐๆฎ"}),e.jsx("pre",{className:"text-xs bg-muted/30 p-2 rounded overflow-x-auto",children:JSON.stringify($.action_data,null,2)})]}),$.action_reasoning&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:"ๅŠจไฝœๆŽจ็†"}),e.jsx("p",{className:"text-sm bg-muted/30 p-2 rounded",children:typeof $.action_reasoning=="string"?$.action_reasoning:JSON.stringify($.action_reasoning)})]})]})]},A))})]}),e.jsx(la,{}),L.raw_output&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"ๅŽŸๅง‹่พ“ๅ‡บ"}),e.jsxs("details",{className:"group",children:[e.jsx("summary",{className:"cursor-pointer text-sm text-muted-foreground hover:text-foreground",children:"็‚นๅ‡ปๅฑ•ๅผ€ๆŸฅ็œ‹ๅฎŒๆ•ดๅŽŸๅง‹่พ“ๅ‡บ"}),e.jsx("div",{className:"mt-2 p-4 bg-muted/50 rounded-lg",children:e.jsx("pre",{className:"text-xs whitespace-pre-wrap break-words",children:L.raw_output})})]})]}),L.prompt&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"ๅฎŒๆ•ดๆ็คบ่ฏ"}),e.jsxs("details",{className:"group",children:[e.jsx("summary",{className:"cursor-pointer text-sm text-muted-foreground hover:text-foreground",children:"็‚นๅ‡ปๅฑ•ๅผ€ๆŸฅ็œ‹ๅฎŒๆ•ดๆ็คบ่ฏ"}),e.jsx("div",{className:"mt-2 p-4 bg-muted/50 rounded-lg",children:e.jsx("pre",{className:"text-xs whitespace-pre-wrap break-words",children:L.prompt})})]})]})]}):e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("p",{className:"text-muted-foreground",children:"ๆ— ๆ•ฐๆฎ"})})})}),e.jsx(gt,{className:"flex-shrink-0",children:e.jsx(_,{onClick:()=>je(!1),children:"ๅ…ณ้—ญ"})})]})})]})}function Wk({autoRefresh:a,refreshKey:l}){const[r,c]=u.useState("overview"),[d,m]=u.useState(null),{getChatName:h}=mN(),[f,p]=u.useState(null),[g,N]=u.useState(!0),[j,b]=u.useState(null),[y,w]=u.useState(!1),[z,M]=u.useState(1),[S,F]=u.useState(20),[E,C]=u.useState(""),[R,H]=u.useState(""),[O,X]=u.useState(""),[L,me]=u.useState(null),[Ne,je]=u.useState(!1),[re,ge]=u.useState(!1),pe=u.useCallback(async()=>{try{N(!0);const $=await Yk();p($)}catch($){console.error("ๅŠ ่ฝฝๅ›žๅคๅ™จๆ€ป่งˆๅคฑ่ดฅ:",$)}finally{N(!1)}},[]),D=u.useCallback(async()=>{if(d)try{w(!0);const $=await Jk(d.chat_id,z,S,R||void 0);b($)}catch($){console.error("ๅŠ ่ฝฝ่Šๅคฉๆ—ฅๅฟ—ๅคฑ่ดฅ:",$)}finally{w(!1)}},[d,z,S,R]);u.useEffect(()=>{pe()},[pe]),u.useEffect(()=>{l>0&&(r==="overview"?pe():D())},[l,r,pe,D]),u.useEffect(()=>{r==="chat-logs"&&d&&D()},[r,d,D]),hN(a,u.useCallback(()=>{r==="overview"?pe():D()},[r,pe,D]));const Q=$=>{m($),M(1),H(""),X(""),c("chat-logs")},I=()=>{c("overview"),m(null),b(null),H(""),X("")},ue=()=>{H(O),M(1)},Y=()=>{X(""),H(""),M(1)},we=async($,A)=>{try{ge(!0),je(!0);const K=await Xk($,A);me(K)}catch(K){console.error("ๅŠ ่ฝฝๅ›žๅค่ฏฆๆƒ…ๅคฑ่ดฅ:",K)}finally{ge(!1)}},fe=$=>{F(Number($)),M(1)},Ee=()=>{const $=parseInt(E),A=j?Math.ceil(j.total/j.page_size):0;!isNaN($)&&$>=1&&$<=A&&(M($),C(""))},G=j?Math.ceil(j.total/j.page_size):0;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-4",children:r==="overview"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"่Šๅคฉๆ•ฐ้‡"}),e.jsx(Ba,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(ze,{children:g?e.jsx(ks,{className:"h-8 w-16"}):e.jsx("div",{className:"text-2xl font-bold",children:f?.total_chats||0})})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"ๅ›žๅคๆ€ปๆ•ฐ"}),e.jsx(rx,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(ze,{children:g?e.jsx(ks,{className:"h-8 w-16"}):e.jsx("div",{className:"text-2xl font-bold",children:f?.total_replies||0})})]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"่Šๅคฉๅˆ—่กจ"}),e.jsx(Ns,{children:"็‚นๅ‡ปๆŸฅ็œ‹่ฏฅ่Šๅคฉ็š„ๆ‰€ๆœ‰ๅ›žๅค่ฎฐๅฝ•"})]}),e.jsx(ze,{children:g?e.jsx("div",{className:"grid gap-3 md:grid-cols-2 lg:grid-cols-3",children:[...Array(6)].map(($,A)=>e.jsx(ks,{className:"h-24 w-full"},A))}):f?.chats&&f.chats.length>0?e.jsx("div",{className:"grid gap-3 md:grid-cols-2 lg:grid-cols-3",children:f.chats.map($=>e.jsxs("div",{className:"border rounded-lg p-4 hover:bg-accent/50 transition-colors cursor-pointer",onClick:()=>Q($),children:[e.jsxs("div",{className:"flex items-start justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ba,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm truncate max-w-[180px]",title:h($.chat_id),children:h($.chat_id)})]}),e.jsx(Ce,{variant:"secondary",children:$.reply_count})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["ๆœ€ๅŽๆดปๅŠจ: ",xN($.latest_timestamp)]})]},$.chat_id))}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"ๆš‚ๆ— ่Šๅคฉ่ฎฐๅฝ•"})})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-4 mb-4",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:I,children:[e.jsx($a,{className:"h-4 w-4 mr-2"}),"่ฟ”ๅ›ž่Šๅคฉๅˆ—่กจ"]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:["ๅฝ“ๅ‰่Šๅคฉ: ",e.jsx("span",{className:"font-medium",children:d?h(d.chat_id):""}),e.jsx("span",{className:"mx-2",children:"โ€ข"}),"ๅ…ฑ ",j?.total||0," ๆกๅ›žๅค่ฎฐๅฝ•"]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(Ue,{children:"ๅ›žๅค็”Ÿๆˆ่ฎฐๅฝ•"}),e.jsx(Ns,{children:d?h(d.chat_id):""})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ae,{placeholder:"ๆœ็ดขๆ็คบ่ฏๅ†…ๅฎน...",value:O,onChange:$=>X($.target.value),onKeyDown:$=>$.key==="Enter"&&ue(),className:"w-full sm:w-48"}),e.jsx(_,{variant:"outline",size:"icon",onClick:ue,children:e.jsx($t,{className:"h-4 w-4"})}),R&&e.jsx(_,{variant:"ghost",size:"sm",onClick:Y,children:"ๆธ…้™ค"})]}),e.jsxs(Pe,{value:S.toString(),onValueChange:fe,children:[e.jsx(Ie,{className:"w-full sm:w-32",children:e.jsx(Fe,{})}),e.jsxs(Be,{children:[e.jsx(W,{value:"10",children:"10ๆก/้กต"}),e.jsx(W,{value:"20",children:"20ๆก/้กต"}),e.jsx(W,{value:"50",children:"50ๆก/้กต"}),e.jsx(W,{value:"100",children:"100ๆก/้กต"})]})]})]})]}),R&&e.jsxs("div",{className:"text-sm text-muted-foreground mt-2",children:["ๆœ็ดขๅ…ณ้”ฎ่ฏ: ",e.jsxs("span",{className:"font-medium",children:['"',R,'"']})]})]}),e.jsx(ze,{children:y?e.jsx("div",{className:"space-y-2",children:[...Array(5)].map(($,A)=>e.jsx(ks,{className:"h-20 w-full"},A))}):j?.data&&j.data.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-2",children:j.data.map($=>e.jsxs("div",{className:"border rounded-lg p-3 hover:bg-accent/50 transition-colors cursor-pointer",onClick:()=>we($.chat_id,$.filename),children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:Zo($.timestamp)}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[$.success?e.jsxs(Ce,{variant:"default",className:"text-xs bg-green-600",children:[e.jsx(Mg,{className:"h-3 w-3 mr-1"}),"ๆˆๅŠŸ"]}):e.jsxs(Ce,{variant:"destructive",className:"text-xs",children:[e.jsx(ta,{className:"h-3 w-3 mr-1"}),"ๅคฑ่ดฅ"]}),e.jsx(Ce,{variant:"outline",className:"text-xs",children:$.model}),e.jsxs(Ce,{variant:"secondary",className:"text-xs",children:[$.overall_ms.toFixed(0),"ms"]})]})]}),e.jsx("p",{className:"text-sm line-clamp-2",children:$.output_preview||"ๆ— ่พ“ๅ‡บๅ†…ๅฎน"})]},$.filename))}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-3 mt-4 pt-4 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["ๅ…ฑ ",j.total," ๆก่ฎฐๅฝ•๏ผŒ็ฌฌ ",z," / ",G," ้กต"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>M(1),disabled:z===1,className:"hidden sm:flex",children:e.jsx(kn,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>M($=>Math.max(1,$-1)),disabled:z===1,children:e.jsx(Pa,{className:"h-4 w-4"})}),e.jsxs("div",{className:"hidden sm:flex items-center gap-2",children:[e.jsx(ae,{type:"number",min:1,max:G,value:E,onChange:$=>C($.target.value),onKeyDown:$=>$.key==="Enter"&&Ee(),placeholder:"่ทณ่ฝฌ",className:"w-20 h-8"}),e.jsx(_,{size:"sm",variant:"outline",onClick:Ee,children:"่ทณ่ฝฌ"})]}),e.jsxs("span",{className:"sm:hidden text-sm text-muted-foreground",children:[z,"/",G]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>M($=>Math.min(G,$+1)),disabled:z===G,children:e.jsx(ra,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>M(G),disabled:z===G,className:"hidden sm:flex",children:e.jsx(Cn,{className:"h-4 w-4"})})]})]})]}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"ๆš‚ๆ— ๅ›žๅค่ฎฐๅฝ•"})})]})]})}),e.jsx(Qs,{open:Ne,onOpenChange:je,children:e.jsxs(Hs,{className:"max-w-4xl max-h-[80vh] grid grid-rows-[auto_1fr_auto] overflow-hidden",children:[e.jsxs(qs,{children:[e.jsxs(Vs,{className:"flex items-center gap-2",children:[e.jsx(Ua,{className:"h-5 w-5"}),"ๅ›žๅค็”Ÿๆˆ่ฏฆๆƒ…"]}),e.jsx(at,{children:"ๆŸฅ็œ‹้บฆ้บฆ็š„่ฏฆ็ป†ๅ›žๅค็”Ÿๆˆ่ฟ‡็จ‹"})]}),e.jsx(ts,{className:"h-full pr-4",children:e.jsx("div",{className:"space-y-6 pb-4",children:re?e.jsx("div",{className:"space-y-4",children:[...Array(5)].map(($,A)=>e.jsx(ks,{className:"h-24 w-full"},A))}):L?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(da,{className:"h-4 w-4"}),"ๅŸบๆœฌไฟกๆฏ"]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 p-4 bg-muted/50 rounded-lg",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"่Šๅคฉ"}),e.jsx("div",{className:"text-sm",title:L.chat_id,children:h(L.chat_id)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"ๆ—ถ้—ดๆˆณ"}),e.jsx("div",{className:"text-sm",children:Zo(L.timestamp)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"็Šถๆ€"}),L.success?e.jsxs(Ce,{variant:"default",className:"bg-green-600",children:[e.jsx(Mg,{className:"h-3 w-3 mr-1"}),"ๆˆๅŠŸ"]}):e.jsxs(Ce,{variant:"destructive",children:[e.jsx(ta,{className:"h-3 w-3 mr-1"}),"ๅคฑ่ดฅ"]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"ๆ€่€ƒๆทฑๅบฆ"}),e.jsxs(Ce,{variant:"outline",children:["Level ",L.think_level]})]})]})]}),e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(V_,{className:"h-4 w-4"}),"ๆจกๅž‹ไฟกๆฏ"]}),e.jsx("div",{className:"p-4 bg-muted/50 rounded-lg",children:e.jsx(Ce,{variant:"secondary",className:"text-sm",children:L.model})})]}),e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(sl,{className:"h-4 w-4"}),"ๆ€ง่ƒฝ็ปŸ่ฎก"]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs(Te,{children:[e.jsx(Oe,{className:"p-4 pb-2",children:e.jsx(Ue,{className:"text-xs text-muted-foreground",children:"ๆ็คบ่ฏๆž„ๅปบ"})}),e.jsx(ze,{className:"p-4 pt-0",children:e.jsxs("div",{className:"text-xl font-bold",children:[L.timing.prompt_ms?.toFixed(2)||0,"ms"]})})]}),e.jsxs(Te,{children:[e.jsx(Oe,{className:"p-4 pb-2",children:e.jsx(Ue,{className:"text-xs text-muted-foreground",children:"LLM ๆŽจ็†"})}),e.jsx(ze,{className:"p-4 pt-0",children:e.jsxs("div",{className:"text-xl font-bold",children:[L.timing.llm_ms?.toFixed(2)||0,"ms"]})})]}),e.jsxs(Te,{children:[e.jsx(Oe,{className:"p-4 pb-2",children:e.jsx(Ue,{className:"text-xs text-muted-foreground",children:"ๆ€ป่€—ๆ—ถ"})}),e.jsx(ze,{className:"p-4 pt-0",children:e.jsxs("div",{className:"text-xl font-bold",children:[L.timing.overall_ms?.toFixed(2)||0,"ms"]})})]})]}),L.timing.timing_logs&&L.timing.timing_logs.length>0&&e.jsxs("div",{className:"mt-3 p-3 bg-muted/30 rounded-lg",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-2",children:"่€—ๆ—ถ่ฏฆๆƒ…"}),e.jsx("div",{className:"space-y-1",children:L.timing.timing_logs.map(($,A)=>e.jsx("div",{className:"text-xs text-muted-foreground",children:$},A))})]}),L.timing.almost_zero&&e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:[e.jsx("span",{className:"font-medium",children:"่ฟ‘ไนŽ้›ถ่€—ๆ—ถ: "}),L.timing.almost_zero]})]}),e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(hx,{className:"h-4 w-4"}),"ๅ›žๅค่พ“ๅ‡บ"]}),e.jsx("div",{className:"p-4 bg-muted/50 rounded-lg",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap leading-relaxed",children:L.output||"ๆ— ่พ“ๅ‡บๅ†…ๅฎน"})})]}),L.processed_output&&L.processed_output.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"ๅค„็†ๅŽ็š„่พ“ๅ‡บ"}),e.jsx("div",{className:"space-y-2",children:L.processed_output.map(($,A)=>e.jsx("div",{className:"p-3 bg-muted/30 rounded-lg",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:$})},A))})]})]}),L.reasoning&&e.jsxs(e.Fragment,{children:[e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"ๆŽจ็†่ฟ‡็จ‹"}),e.jsx("div",{className:"p-4 bg-muted/50 rounded-lg",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap leading-relaxed",children:L.reasoning})})]})]}),L.error&&e.jsxs(e.Fragment,{children:[e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold text-destructive",children:"้”™่ฏฏไฟกๆฏ"}),e.jsx("div",{className:"p-4 bg-destructive/10 rounded-lg border border-destructive/20",children:e.jsx("p",{className:"text-sm text-destructive whitespace-pre-wrap",children:L.error})})]})]}),L.prompt&&e.jsxs(e.Fragment,{children:[e.jsx(la,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"ๅฎŒๆ•ดๆ็คบ่ฏ"}),e.jsxs("details",{className:"group",children:[e.jsx("summary",{className:"cursor-pointer text-sm text-muted-foreground hover:text-foreground",children:"็‚นๅ‡ปๅฑ•ๅผ€ๆŸฅ็œ‹ๅฎŒๆ•ดๆ็คบ่ฏ"}),e.jsx("div",{className:"mt-2 p-4 bg-muted/50 rounded-lg",children:e.jsx("pre",{className:"text-xs whitespace-pre-wrap break-words",children:L.prompt})})]})]})]})]}):e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("p",{className:"text-muted-foreground",children:"ๆ— ๆ•ฐๆฎ"})})})}),e.jsx(gt,{className:"flex-shrink-0",children:e.jsx(_,{onClick:()=>je(!1),children:"ๅ…ณ้—ญ"})})]})})]})}function eC(){const[a,l]=u.useState("planner"),[r,c]=u.useState(!1),[d,m]=u.useState(0),h=u.useCallback(()=>{m(f=>f+1)},[]);return e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"่ฎกๅˆ’ๅ™จ & ๅ›žๅคๅ™จ็›‘ๆŽง"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"ๅฎžๆ—ถ็›‘ๆŽง้บฆ้บฆ็š„ไปปๅŠก่ฎกๅˆ’ๅ™จๅ’Œๅ›žๅค็”Ÿๆˆๅ™จ่ฟ่กŒ็Šถๆ€"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(_,{variant:r?"default":"outline",size:"sm",onClick:()=>c(!r),children:[e.jsx(dt,{className:`h-4 w-4 mr-2 ${r?"animate-spin":""}`}),r?"่‡ชๅŠจๅˆทๆ–ฐไธญ":"่‡ชๅŠจๅˆทๆ–ฐ"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:h,children:e.jsx(dt,{className:"h-4 w-4"})})]})]}),e.jsxs(Jt,{value:a,onValueChange:f=>l(f),className:"w-full",children:[e.jsxs(Gt,{className:"grid w-full grid-cols-2 gap-0.5 sm:gap-1 h-auto p-1",children:[e.jsxs(Xe,{value:"planner",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(nx,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"่ฎกๅˆ’ๅ™จ็›‘ๆŽง"})]}),e.jsxs(Xe,{value:"replier",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(G_,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"ๅ›žๅคๅ™จ็›‘ๆŽง"})]})]}),e.jsxs(ts,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[e.jsx(Ss,{value:"planner",className:"mt-0",children:e.jsx(Zk,{autoRefresh:r,refreshKey:d})}),e.jsx(Ss,{value:"replier",className:"mt-0",children:e.jsx(Wk,{autoRefresh:r,refreshKey:d})})]})]})]})}const sC="Mai-with-u",tC="plugin-repo",aC="main",lC="plugin_details.json";async function nC(){try{const a=await ke("/api/webui/plugins/fetch-raw",{method:"POST",body:JSON.stringify({owner:sC,repo:tC,branch:aC,file_path:lC})});if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);const l=await a.json();if(!l.success||!l.data)throw new Error(l.error||"่Žทๅ–ๆ’ไปถๅˆ—่กจๅคฑ่ดฅ");return JSON.parse(l.data).filter(d=>!d?.id||!d?.manifest?(console.warn("่ทณ่ฟ‡ๆ— ๆ•ˆๆ’ไปถๆ•ฐๆฎ:",d),!1):!d.manifest.name||!d.manifest.version?(console.warn("่ทณ่ฟ‡็ผบๅฐ‘ๅฟ…้œ€ๅญ—ๆฎต็š„ๆ’ไปถ:",d.id),!1):!0).map(d=>({id:d.id,manifest:{manifest_version:d.manifest.manifest_version||1,name:d.manifest.name,version:d.manifest.version,description:d.manifest.description||"",author:d.manifest.author||{name:"Unknown"},license:d.manifest.license||"Unknown",host_application:d.manifest.host_application||{min_version:"0.0.0"},homepage_url:d.manifest.homepage_url,repository_url:d.manifest.repository_url,keywords:d.manifest.keywords||[],categories:d.manifest.categories||[],default_locale:d.manifest.default_locale||"zh-CN",locales_path:d.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!1,published_at:new Date().toISOString(),updated_at:new Date().toISOString()}))}catch(a){throw console.error("Failed to fetch plugin list:",a),a}}async function fN(){try{const a=await ke("/api/webui/plugins/git-status");if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);return await a.json()}catch(a){return console.error("Failed to check Git status:",a),{installed:!1,error:"ๆ— ๆณ•ๆฃ€ๆต‹ Git ๅฎ‰่ฃ…็Šถๆ€"}}}async function pN(){try{const a=await ke("/api/webui/plugins/version");if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);return await a.json()}catch(a){return console.error("Failed to get Maimai version:",a),{version:"0.0.0",version_major:0,version_minor:0,version_patch:0}}}function gN(a,l,r){const c=a.split(".").map(f=>parseInt(f)||0),d=c[0]||0,m=c[1]||0,h=c[2]||0;if(r.version_majorparseInt(j)||0),p=f[0]||0,g=f[1]||0,N=f[2]||0;if(r.version_major>p||r.version_major===p&&r.version_minor>g||r.version_major===p&&r.version_minor===g&&r.version_patch>N)return!1}return!0}async function rC(){try{const a=await ke("/api/webui/ws-token");if(!a.ok)return console.error("่Žทๅ– WebSocket token ๅคฑ่ดฅ:",a.status),null;const l=await a.json();return l.success&&l.token?l.token:null}catch(a){return console.error("่Žทๅ– WebSocket token ๅคฑ่ดฅ:",a),null}}async function iC(a,l){const r=await rC();if(!r)return console.warn("ๆ— ๆณ•่Žทๅ– WebSocket token๏ผŒๅฏ่ƒฝๆœช็™ปๅฝ•"),null;const c=window.location.protocol==="https:"?"wss:":"ws:",d=window.location.host,m=`${c}//${d}/api/webui/ws/plugin-progress?token=${encodeURIComponent(r)}`;try{const h=new WebSocket(m);return h.onopen=()=>{console.log("Plugin progress WebSocket connected");const f=setInterval(()=>{h.readyState===WebSocket.OPEN?h.send("ping"):clearInterval(f)},3e4)},h.onmessage=f=>{try{if(f.data==="pong")return;const p=JSON.parse(f.data);a(p)}catch(p){console.error("Failed to parse progress data:",p)}},h.onerror=f=>{console.error("Plugin progress WebSocket error:",f),l?.(f)},h.onclose=()=>{console.log("Plugin progress WebSocket disconnected")},h}catch(h){return console.error("ๅˆ›ๅปบ WebSocket ่ฟžๆŽฅๅคฑ่ดฅ:",h),null}}async function Bl(){try{const a=await ke("/api/webui/plugins/installed",{headers:Zs()});if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);const l=await a.json();if(!l.success)throw new Error(l.message||"่Žทๅ–ๅทฒๅฎ‰่ฃ…ๆ’ไปถๅˆ—่กจๅคฑ่ดฅ");return l.plugins||[]}catch(a){return console.error("Failed to get installed plugins:",a),[]}}function bn(a,l){return l.some(r=>r.id===a)}function yn(a,l){const r=l.find(c=>c.id===a);if(r)return r.manifest?.version||r.version}async function jN(a,l,r="main"){const c=await ke("/api/webui/plugins/install",{method:"POST",body:JSON.stringify({plugin_id:a,repository_url:l,branch:r})});if(!c.ok){const d=await c.json();throw new Error(d.detail||"ๅฎ‰่ฃ…ๅคฑ่ดฅ")}return await c.json()}async function vN(a){const l=await ke("/api/webui/plugins/uninstall",{method:"POST",body:JSON.stringify({plugin_id:a})});if(!l.ok){const r=await l.json();throw new Error(r.detail||"ๅธ่ฝฝๅคฑ่ดฅ")}return await l.json()}async function NN(a,l,r="main"){const c=await ke("/api/webui/plugins/update",{method:"POST",body:JSON.stringify({plugin_id:a,repository_url:l,branch:r})});if(!c.ok){const d=await c.json();throw new Error(d.detail||"ๆ›ดๆ–ฐๅคฑ่ดฅ")}return await c.json()}async function cC(a){const l=await ke(`/api/webui/plugins/config/${a}/schema`,{headers:Zs()});if(!l.ok){const c=await l.text();try{const d=JSON.parse(c);throw new Error(d.detail||"่Žทๅ–้…็ฝฎ Schema ๅคฑ่ดฅ")}catch{throw new Error(`่Žทๅ–้…็ฝฎ Schema ๅคฑ่ดฅ (${l.status})`)}}const r=await l.json();if(!r.success)throw new Error(r.message||"่Žทๅ–้…็ฝฎ Schema ๅคฑ่ดฅ");return r.schema}async function oC(a){const l=await ke(`/api/webui/plugins/config/${a}`,{headers:Zs()});if(!l.ok){const c=await l.text();try{const d=JSON.parse(c);throw new Error(d.detail||"่Žทๅ–้…็ฝฎๅคฑ่ดฅ")}catch{throw new Error(`่Žทๅ–้…็ฝฎๅคฑ่ดฅ (${l.status})`)}}const r=await l.json();if(!r.success)throw new Error(r.message||"่Žทๅ–้…็ฝฎๅคฑ่ดฅ");return r.config}async function dC(a){const l=await ke(`/api/webui/plugins/config/${a}/raw`,{headers:Zs()});if(!l.ok){const c=await l.text();try{const d=JSON.parse(c);throw new Error(d.detail||"่Žทๅ–้…็ฝฎๅคฑ่ดฅ")}catch{throw new Error(`่Žทๅ–้…็ฝฎๅคฑ่ดฅ (${l.status})`)}}const r=await l.json();if(!r.success)throw new Error(r.message||"่Žทๅ–้…็ฝฎๅคฑ่ดฅ");return r.config}async function uC(a,l){const r=await ke(`/api/webui/plugins/config/${a}`,{method:"PUT",headers:Zs(),body:JSON.stringify({config:l})});if(!r.ok){const c=await r.json();throw new Error(c.detail||"ไฟๅญ˜้…็ฝฎๅคฑ่ดฅ")}return await r.json()}async function mC(a,l){const r=await ke(`/api/webui/plugins/config/${a}/raw`,{method:"PUT",headers:Zs(),body:JSON.stringify({config:l})});if(!r.ok){const c=await r.json();throw new Error(c.detail||"ไฟๅญ˜้…็ฝฎๅคฑ่ดฅ")}return await r.json()}async function xC(a){const l=await ke(`/api/webui/plugins/config/${a}/reset`,{method:"POST",headers:Zs()});if(!l.ok){const r=await l.json();throw new Error(r.detail||"้‡็ฝฎ้…็ฝฎๅคฑ่ดฅ")}return await l.json()}async function hC(a){const l=await ke(`/api/webui/plugins/config/${a}/toggle`,{method:"POST",headers:Zs()});if(!l.ok){const r=await l.json();throw new Error(r.detail||"ๅˆ‡ๆข็Šถๆ€ๅคฑ่ดฅ")}return await l.json()}const Nc="https://maibot-plugin-stats.maibot-webui.workers.dev";async function bN(a){try{const l=await fetch(`${Nc}/stats/${a}`);return l.ok?await l.json():(console.error("Failed to fetch plugin stats:",l.statusText),null)}catch(l){return console.error("Error fetching plugin stats:",l),null}}async function fC(a,l){try{const r=l||Ax(),c=await fetch(`${Nc}/stats/like`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:a,user_id:r})}),d=await c.json();return c.status===429?{success:!1,error:"ๆ“ไฝœ่ฟ‡ไบŽ้ข‘็น๏ผŒ่ฏท็จๅŽๅ†่ฏ•"}:c.ok?{success:!0,...d}:{success:!1,error:d.error||"็‚น่ตžๅคฑ่ดฅ"}}catch(r){return console.error("Error liking plugin:",r),{success:!1,error:"็ฝ‘็ปœ้”™่ฏฏ"}}}async function pC(a,l){try{const r=l||Ax(),c=await fetch(`${Nc}/stats/dislike`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:a,user_id:r})}),d=await c.json();return c.status===429?{success:!1,error:"ๆ“ไฝœ่ฟ‡ไบŽ้ข‘็น๏ผŒ่ฏท็จๅŽๅ†่ฏ•"}:c.ok?{success:!0,...d}:{success:!1,error:d.error||"็‚น่ธฉๅคฑ่ดฅ"}}catch(r){return console.error("Error disliking plugin:",r),{success:!1,error:"็ฝ‘็ปœ้”™่ฏฏ"}}}async function gC(a,l,r,c){if(l<1||l>5)return{success:!1,error:"่ฏ„ๅˆ†ๅฟ…้กปๅœจ 1-5 ไน‹้—ด"};try{const d=c||Ax(),m=await fetch(`${Nc}/stats/rate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:a,rating:l,comment:r,user_id:d})}),h=await m.json();return m.status===429?{success:!1,error:"ๆฏๅคฉๆœ€ๅคš่ฏ„ๅˆ† 3 ๆฌก"}:m.ok?{success:!0,...h}:{success:!1,error:h.error||"่ฏ„ๅˆ†ๅคฑ่ดฅ"}}catch(d){return console.error("Error rating plugin:",d),{success:!1,error:"็ฝ‘็ปœ้”™่ฏฏ"}}}async function yN(a){try{const l=await fetch(`${Nc}/stats/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:a})}),r=await l.json();return l.status===429?(console.warn("Download recording rate limited"),{success:!0}):l.ok?{success:!0,...r}:(console.error("Failed to record download:",r.error),{success:!1,error:r.error})}catch(l){return console.error("Error recording download:",l),{success:!1,error:"็ฝ‘็ปœ้”™่ฏฏ"}}}function jC(){const a=navigator,l=[navigator.userAgent,navigator.language,navigator.languages?.join(",")||"",navigator.platform,navigator.hardwareConcurrency||0,screen.width,screen.height,screen.colorDepth,screen.pixelDepth,new Date().getTimezoneOffset(),Intl.DateTimeFormat().resolvedOptions().timeZone,navigator.maxTouchPoints||0,a.deviceMemory||0].join("|");let r=0;for(let c=0;c{const Z=J.map(async De=>{try{const xe=await bN(De.id);return{id:De.id,stats:xe}}catch(xe){return console.warn(`Failed to load stats for ${De.id}:`,xe),{id:De.id,stats:null}}}),Le=await Promise.all(Z),ne={};Le.forEach(({id:De,stats:xe})=>{xe&&(ne[De]=xe)}),L(ne)};u.useEffect(()=>{let J=null,Z=!1;return(async()=>{if(J=await iC(ne=>{Z||(C(ne),ne.stage==="success"?setTimeout(()=>{Z||C(null)},2e3):ne.stage==="error"&&(w(!1),M(ne.error||"ๅŠ ่ฝฝๅคฑ่ดฅ")))},ne=>{console.error("WebSocket error:",ne),Z||fe({title:"WebSocket ่ฟžๆŽฅๅคฑ่ดฅ",description:"ๆ— ๆณ•ๅฎžๆ—ถๆ˜พ็คบๅŠ ่ฝฝ่ฟ›ๅบฆ",variant:"destructive"})}),await new Promise(ne=>{if(!J){ne();return}const De=()=>{J&&J.readyState===WebSocket.OPEN?(console.log("WebSocket connected, starting to load plugins"),ne()):J&&J.readyState===WebSocket.CLOSED?(console.warn("WebSocket closed before loading plugins"),ne()):setTimeout(De,100)};De()}),!Z){const ne=await fN();F(ne),ne.installed||fe({title:"Git ๆœชๅฎ‰่ฃ…",description:ne.error||"่ฏทๅ…ˆๅฎ‰่ฃ… Git ๆ‰่ƒฝไฝฟ็”จๆ’ไปถๅฎ‰่ฃ…ๅŠŸ่ƒฝ",variant:"destructive"})}if(!Z){const ne=await pN();H(ne)}if(!Z)try{w(!0),M(null);const ne=await nC();if(!Z){const De=await Bl();O(De);const xe=ne.map(Me=>{const ds=bn(Me.id,De),Ts=yn(Me.id,De);return{...Me,installed:ds,installed_version:Ts}});for(const Me of De)!xe.some(Ts=>Ts.id===Me.id)&&Me.manifest&&xe.push({id:Me.id,manifest:{manifest_version:Me.manifest.manifest_version||1,name:Me.manifest.name,version:Me.manifest.version,description:Me.manifest.description||"",author:Me.manifest.author,license:Me.manifest.license||"Unknown",host_application:Me.manifest.host_application,homepage_url:Me.manifest.homepage_url,repository_url:Me.manifest.repository_url,keywords:Me.manifest.keywords||[],categories:Me.manifest.categories||[],default_locale:Me.manifest.default_locale||"zh-CN",locales_path:Me.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!0,installed_version:Me.manifest.version,published_at:new Date().toISOString(),updated_at:new Date().toISOString()});b(xe),Ee(xe)}}catch(ne){if(!Z){const De=ne instanceof Error?ne.message:"ๅŠ ่ฝฝๆ’ไปถๅˆ—่กจๅคฑ่ดฅ";M(De),fe({title:"ๅŠ ่ฝฝๅคฑ่ดฅ",description:De,variant:"destructive"})}}finally{Z||w(!1)}})(),()=>{Z=!0,J&&J.close()}},[fe]);const G=J=>{if(!J.installed&&R&&!$(J))return e.jsxs(Ce,{variant:"destructive",className:"gap-1",children:[e.jsx(Ut,{className:"h-3 w-3"}),"ไธๅ…ผๅฎน"]});if(J.installed){const Z=J.installed_version?.trim(),Le=J.manifest.version?.trim();if(Z!==Le){const ne=Z?.split(".").map(Number)||[0,0,0],De=Le?.split(".").map(Number)||[0,0,0];for(let xe=0;xe<3;xe++){if((De[xe]||0)>(ne[xe]||0))return e.jsxs(Ce,{variant:"outline",className:"gap-1 text-orange-600 border-orange-600",children:[e.jsx(Ut,{className:"h-3 w-3"}),"ๅฏๆ›ดๆ–ฐ"]});if((De[xe]||0)<(ne[xe]||0))break}}return e.jsxs(Ce,{variant:"default",className:"gap-1",children:[e.jsx(st,{className:"h-3 w-3"}),"ๅทฒๅฎ‰่ฃ…"]})}return null},$=J=>!R||!J.manifest?.host_application?!0:gN(J.manifest.host_application.min_version,J.manifest.host_application.max_version,R),A=J=>{if(!J.installed||!J.installed_version||!J.manifest?.version)return!1;const Z=J.installed_version.trim(),Le=J.manifest.version.trim();if(Z===Le)return!1;const ne=Z.split(".").map(Number),De=Le.split(".").map(Number);for(let xe=0;xe<3;xe++){if((De[xe]||0)>(ne[xe]||0))return!0;if((De[xe]||0)<(ne[xe]||0))return!1}return!1},K=j.filter(J=>{if(!J.manifest)return console.warn("[่ฟ‡ๆปค] ่ทณ่ฟ‡ๆ—  manifest ็š„ๆ’ไปถ:",J.id),!1;const Z=c===""||J.manifest.name?.toLowerCase().includes(c.toLowerCase())||J.manifest.description?.toLowerCase().includes(c.toLowerCase())||J.manifest.keywords&&J.manifest.keywords.some(xe=>xe.toLowerCase().includes(c.toLowerCase())),Le=m==="all"||J.manifest.categories&&J.manifest.categories.includes(m);let ne=!0;f==="installed"?ne=J.installed===!0:f==="updates"&&(ne=J.installed===!0&&A(J));const De=!g||!R||$(J);return Z&&Le&&ne&&De}),Re=J=>{if(!S?.installed){fe({title:"ๆ— ๆณ•ๅฎ‰่ฃ…",description:"Git ๆœชๅฎ‰่ฃ…",variant:"destructive"});return}if(R&&!$(J)){fe({title:"ๆ— ๆณ•ๅฎ‰่ฃ…",description:"ๆ’ไปถไธŽๅฝ“ๅ‰้บฆ้บฆ็‰ˆๆœฌไธๅ…ผๅฎน",variant:"destructive"});return}re(J),pe("main"),Q(""),ue("preset"),we(!1),Ne(!0)},se=async()=>{if(!je)return;const J=I==="custom"?D:ge;if(!J||J.trim()===""){fe({title:"ๅˆ†ๆ”ฏๅ็งฐไธ่ƒฝไธบ็ฉบ",variant:"destructive"});return}try{Ne(!1),await jN(je.id,je.manifest.repository_url||"",J),yN(je.id).catch(Le=>{console.warn("Failed to record download:",Le)}),fe({title:"ๅฎ‰่ฃ…ๆˆๅŠŸ",description:`${je.manifest.name} ๅทฒๆˆๅŠŸๅฎ‰่ฃ…`});const Z=await Bl();O(Z),b(Le=>Le.map(ne=>{if(ne.id===je.id){const De=bn(ne.id,Z),xe=yn(ne.id,Z);return{...ne,installed:De,installed_version:xe}}return ne}))}catch(Z){fe({title:"ๅฎ‰่ฃ…ๅคฑ่ดฅ",description:Z instanceof Error?Z.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}finally{re(null)}},$e=async J=>{try{await vN(J.id),fe({title:"ๅธ่ฝฝๆˆๅŠŸ",description:`${J.manifest.name} ๅทฒๆˆๅŠŸๅธ่ฝฝ`});const Z=await Bl();O(Z),b(Le=>Le.map(ne=>{if(ne.id===J.id){const De=bn(ne.id,Z),xe=yn(ne.id,Z);return{...ne,installed:De,installed_version:xe}}return ne}))}catch(Z){fe({title:"ๅธ่ฝฝๅคฑ่ดฅ",description:Z instanceof Error?Z.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}},cs=async J=>{if(!S?.installed){fe({title:"ๆ— ๆณ•ๆ›ดๆ–ฐ",description:"Git ๆœชๅฎ‰่ฃ…",variant:"destructive"});return}try{const Z=await NN(J.id,J.manifest.repository_url||"","main");fe({title:"ๆ›ดๆ–ฐๆˆๅŠŸ",description:`${J.manifest.name} ๅทฒไปŽ ${Z.old_version} ๆ›ดๆ–ฐๅˆฐ ${Z.new_version}`});const Le=await Bl();O(Le),b(ne=>ne.map(De=>{if(De.id===J.id){const xe=bn(De.id,Le),Me=yn(De.id,Le);return{...De,installed:xe,installed_version:Me}}return De}))}catch(Z){fe({title:"ๆ›ดๆ–ฐๅคฑ่ดฅ",description:Z instanceof Error?Z.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}};return e.jsx(ts,{className:"h-full",children:e.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"ๆ’ไปถๅธ‚ๅœบ"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"ๆต่งˆๅ’Œ็ฎก็†้บฆ้บฆ็š„ๆ’ไปถ"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(_,{variant:"outline",onClick:()=>l(),disabled:r,children:[e.jsx(hv,{className:`h-4 w-4 mr-2 ${r?"animate-spin":""}`}),"้‡ๅฏ้บฆ้บฆ"]}),e.jsxs(_,{onClick:()=>a({to:"/plugin-mirrors"}),children:[e.jsx(K_,{className:"h-4 w-4 mr-2"}),"้…็ฝฎ้•œๅƒๆบ"]})]})]}),e.jsx(Te,{className:"border-blue-200 bg-blue-50 dark:bg-blue-950/20 dark:border-blue-900",children:e.jsx(ze,{className:"py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Yt,{className:"h-4 w-4 text-blue-600 flex-shrink-0"}),e.jsxs("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:["ๅฎ‰่ฃ…ใ€ๅธ่ฝฝๆˆ–ๆ›ดๆ–ฐๆ’ไปถๅŽ๏ผŒ้œ€่ฆ",e.jsx("span",{className:"font-semibold",children:"้‡ๅฏ้บฆ้บฆ"}),"ๆ‰่ƒฝไฝฟๆ›ดๆ”น็”Ÿๆ•ˆ"]})]})})}),S&&!S.installed&&e.jsxs(Te,{className:"border-orange-600 bg-orange-50 dark:bg-orange-950/20",children:[e.jsx(Oe,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Lt,{className:"h-5 w-5 text-orange-600"}),e.jsxs("div",{children:[e.jsx(Ue,{className:"text-lg text-orange-900 dark:text-orange-100",children:"Git ๆœชๅฎ‰่ฃ…"}),e.jsx(Ns,{className:"text-orange-800 dark:text-orange-200",children:S.error||"่ฏทๅ…ˆๅฎ‰่ฃ… Git ๆ‰่ƒฝไฝฟ็”จๆ’ไปถๅฎ‰่ฃ…ๅŠŸ่ƒฝ"})]})]})}),e.jsx(ze,{children:e.jsxs("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:["ๆ‚จๅฏไปฅไปŽ ",e.jsx("a",{href:"https://git-scm.com/downloads",target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:"git-scm.com"})," ไธ‹่ฝฝๅนถๅฎ‰่ฃ… Gitใ€‚ ๅฎ‰่ฃ…ๅฎŒๆˆๅŽ๏ผŒ่ฏท้‡ๅฏ้บฆ้บฆๅบ”็”จใ€‚"]})})]}),e.jsx(Te,{className:"p-4",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx($t,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ae,{placeholder:"ๆœ็ดขๆ’ไปถ...",value:c,onChange:J=>d(J.target.value),className:"pl-9"})]}),e.jsxs(Pe,{value:m,onValueChange:h,children:[e.jsx(Ie,{className:"w-full sm:w-[200px]",children:e.jsx(Fe,{placeholder:"้€‰ๆ‹ฉๅˆ†็ฑป"})}),e.jsxs(Be,{children:[e.jsx(W,{value:"all",children:"ๅ…จ้ƒจๅˆ†็ฑป"}),e.jsx(W,{value:"Group Management",children:"็พค็ป„็ฎก็†"}),e.jsx(W,{value:"Entertainment & Interaction",children:"ๅจฑไนไบ’ๅŠจ"}),e.jsx(W,{value:"Utility Tools",children:"ๅฎž็”จๅทฅๅ…ท"}),e.jsx(W,{value:"Content Generation",children:"ๅ†…ๅฎน็”Ÿๆˆ"}),e.jsx(W,{value:"Multimedia",children:"ๅคšๅช’ไฝ“"}),e.jsx(W,{value:"External Integration",children:"ๅค–้ƒจ้›†ๆˆ"}),e.jsx(W,{value:"Data Analysis & Insights",children:"ๆ•ฐๆฎๅˆ†ๆžไธŽๆดžๅฏŸ"}),e.jsx(W,{value:"Other",children:"ๅ…ถไป–"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(tt,{id:"compatible-only",checked:g,onCheckedChange:J=>N(J===!0)}),e.jsx("label",{htmlFor:"compatible-only",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"ๅชๆ˜พ็คบๅ…ผๅฎนๅฝ“ๅ‰็‰ˆๆœฌ็š„ๆ’ไปถ"})]})]})}),e.jsx(Jt,{value:f,onValueChange:p,className:"w-full",children:e.jsxs(Gt,{className:"grid w-full grid-cols-3",children:[e.jsxs(Xe,{value:"all",children:["ๅ…จ้ƒจๆ’ไปถ (",j.filter(J=>{if(!J.manifest)return!1;const Z=c===""||J.manifest.name?.toLowerCase().includes(c.toLowerCase())||J.manifest.description?.toLowerCase().includes(c.toLowerCase())||J.manifest.keywords&&J.manifest.keywords.some(De=>De.toLowerCase().includes(c.toLowerCase())),Le=m==="all"||J.manifest.categories&&J.manifest.categories.includes(m),ne=!g||!R||$(J);return Z&&Le&&ne}).length,")"]}),e.jsxs(Xe,{value:"installed",children:["ๅทฒๅฎ‰่ฃ… (",j.filter(J=>{if(!J.manifest)return!1;const Z=c===""||J.manifest.name?.toLowerCase().includes(c.toLowerCase())||J.manifest.description?.toLowerCase().includes(c.toLowerCase())||J.manifest.keywords&&J.manifest.keywords.some(De=>De.toLowerCase().includes(c.toLowerCase())),Le=m==="all"||J.manifest.categories&&J.manifest.categories.includes(m),ne=!g||!R||$(J);return J.installed&&Z&&Le&&ne}).length,")"]}),e.jsxs(Xe,{value:"updates",children:["ๅฏๆ›ดๆ–ฐ (",j.filter(J=>{if(!J.manifest)return!1;const Z=c===""||J.manifest.name?.toLowerCase().includes(c.toLowerCase())||J.manifest.description?.toLowerCase().includes(c.toLowerCase())||J.manifest.keywords&&J.manifest.keywords.some(De=>De.toLowerCase().includes(c.toLowerCase())),Le=m==="all"||J.manifest.categories&&J.manifest.categories.includes(m),ne=!g||!R||$(J);return J.installed&&A(J)&&Z&&Le&&ne}).length,")"]})]})}),E&&E.stage==="loading"&&E.operation==="fetch"&&e.jsx(Te,{className:"p-4",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Fs,{className:"h-4 w-4 animate-spin"}),e.jsx("span",{className:"text-sm font-medium",children:"ๅŠ ่ฝฝๆ’ไปถๅˆ—่กจ"})]}),e.jsxs("span",{className:"text-sm font-medium",children:[E.progress,"%"]})]}),e.jsx(tr,{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(Te,{className:"border-destructive bg-destructive/10",children:e.jsx(Oe,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Lt,{className:"h-5 w-5 text-destructive"}),e.jsxs("div",{children:[e.jsx(Ue,{className:"text-lg text-destructive",children:"ๅŠ ่ฝฝๅคฑ่ดฅ"}),e.jsx(Ns,{className:"text-destructive/80",children:E.error})]})]})})}),y?e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(Fs,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-muted-foreground",children:"ๅŠ ่ฝฝๆ’ไปถๅˆ—่กจไธญ..."})]}):z?e.jsx(Te,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Lt,{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:z}),e.jsx(_,{onClick:()=>window.location.reload(),children:"้‡ๆ–ฐๅŠ ่ฝฝ"})]})}):K.length===0?e.jsx(Te,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx($t,{className:"h-12 w-12 text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"ๆœชๆ‰พๅˆฐๆ’ไปถ"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:c||m!=="all"?"ๅฐ่ฏ•่ฐƒๆ•ดๆœ็ดขๆกไปถๆˆ–็ญ›้€‰ๅ™จ":"ๆš‚ๆ— ๅฏ็”จๆ’ไปถ"})]})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:K.map(J=>e.jsxs(Te,{className:"flex flex-col hover:shadow-lg transition-shadow h-full",children:[e.jsxs(Oe,{children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx(Ue,{className:"text-xl",children:J.manifest?.name||J.id}),e.jsxs("div",{className:"flex flex-col gap-1",children:[J.manifest?.categories&&J.manifest.categories[0]&&e.jsx(Ce,{variant:"secondary",className:"text-xs whitespace-nowrap",children:vC[J.manifest.categories[0]]||J.manifest.categories[0]}),G(J)]})]}),e.jsx(Ns,{className:"line-clamp-2",children:J.manifest?.description||"ๆ— ๆ่ฟฐ"})]}),e.jsx(ze,{className:"flex-1",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(na,{className:"h-4 w-4"}),e.jsx("span",{children:(X[J.id]?.downloads??J.downloads??0).toLocaleString()})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(vn,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),e.jsx("span",{children:(X[J.id]?.rating??J.rating??0).toFixed(1)})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[J.manifest?.keywords&&J.manifest.keywords.slice(0,3).map(Z=>e.jsx(Ce,{variant:"outline",className:"text-xs",children:Z},Z)),J.manifest?.keywords&&J.manifest.keywords.length>3&&e.jsxs(Ce,{variant:"outline",className:"text-xs",children:["+",J.manifest.keywords.length-3]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground pt-2 border-t space-y-1",children:[e.jsxs("div",{children:["v",J.manifest?.version||"unknown"," ยท ",J.manifest?.author?.name||"Unknown"]}),J.manifest?.host_application&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{children:"ๆ”ฏๆŒ:"}),e.jsxs("span",{className:"font-medium",children:[J.manifest.host_application.min_version,J.manifest.host_application.max_version?` - ${J.manifest.host_application.max_version}`:" - ๆœ€ๆ–ฐ็‰ˆๆœฌ"]})]})]})]})}),e.jsx(od,{className:"pt-4",children:e.jsxs("div",{className:"flex items-center justify-end gap-2 w-full",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>a({to:"/plugin-detail",search:{pluginId:J.id}}),children:"ๆŸฅ็œ‹่ฏฆๆƒ…"}),J.installed?A(J)?e.jsxs(_,{size:"sm",disabled:!S?.installed,title:S?.installed?void 0:"Git ๆœชๅฎ‰่ฃ…",onClick:()=>cs(J),children:[e.jsx(dt,{className:"h-4 w-4 mr-1"}),"ๆ›ดๆ–ฐ"]}):e.jsxs(_,{variant:"destructive",size:"sm",disabled:!S?.installed,title:S?.installed?void 0:"Git ๆœชๅฎ‰่ฃ…",onClick:()=>$e(J),children:[e.jsx(os,{className:"h-4 w-4 mr-1"}),"ๅธ่ฝฝ"]}):e.jsxs(_,{size:"sm",disabled:!S?.installed||E?.operation==="install"||R!==null&&!$(J),title:S?.installed?R!==null&&!$(J)?`ไธๅ…ผๅฎนๅฝ“ๅ‰็‰ˆๆœฌ (้œ€่ฆ ${J.manifest?.host_application?.min_version||"ๆœช็Ÿฅ"}${J.manifest?.host_application?.max_version?` - ${J.manifest.host_application.max_version}`:"+"}๏ผŒๅฝ“ๅ‰ ${R?.version})`:void 0:"Git ๆœชๅฎ‰่ฃ…",onClick:()=>Re(J),children:[e.jsx(na,{className:"h-4 w-4 mr-1"}),E?.operation==="install"&&E?.plugin_id===J.id?"ๅฎ‰่ฃ…ไธญ...":"ๅฎ‰่ฃ…"]})]})}),E&&(E.stage==="loading"||E.stage==="success"||E.stage==="error")&&E.operation!=="fetch"&&E.plugin_id===J.id&&e.jsx("div",{className:"px-6 pb-4 -mt-2",children:e.jsxs("div",{className:`space-y-2 p-3 rounded-lg border ${E.stage==="success"?"bg-green-50 dark:bg-green-950/20 border-green-200 dark:border-green-900":E.stage==="error"?"bg-red-50 dark:bg-red-950/20 border-red-200 dark:border-red-900":"bg-muted/50"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[E.stage==="loading"?e.jsx(Fs,{className:"h-3 w-3 animate-spin"}):E.stage==="success"?e.jsx(st,{className:"h-3 w-3 text-green-600"}):e.jsx(Ut,{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(tr,{value:E.progress,className:`h-1.5 ${E.stage==="success"?"[&>div]:bg-green-500":""}`}),e.jsx("div",{className:`text-xs ${E.stage==="success"?"text-green-600 dark:text-green-400 truncate":E.stage==="error"?"text-red-600 dark:text-red-400":"text-muted-foreground truncate"}`,children:E.stage==="error"?E.error||E.message||"ๆ“ไฝœๅคฑ่ดฅ":E.message})]})})]},J.id))}),e.jsx(Qs,{open:me,onOpenChange:Ne,children:e.jsxs(Hs,{children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"ๅฎ‰่ฃ…ๆ’ไปถ"}),e.jsxs(at,{children:["ๅฎ‰่ฃ… ",je?.manifest.name]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["็‰ˆๆœฌ: ",je?.manifest.version]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["ไฝœ่€…: ",typeof je?.manifest.author=="string"?je.manifest.author:je?.manifest.author?.name]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(tt,{id:"advanced-options",checked:Y,onCheckedChange:J=>we(J)}),e.jsx("label",{htmlFor:"advanced-options",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"้ซ˜็บง้€‰้กน"})]}),Y&&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(Jt,{value:I,onValueChange:J=>ue(J),children:[e.jsxs(Gt,{className:"grid w-full grid-cols-2",children:[e.jsx(Xe,{value:"preset",className:"text-xs",children:"้ข„่ฎพๅˆ†ๆ”ฏ"}),e.jsx(Xe,{value:"custom",className:"text-xs",children:"่‡ชๅฎšไน‰ๅˆ†ๆ”ฏ"})]}),I==="preset"&&e.jsx("div",{className:"mt-3",children:e.jsxs(Pe,{value:ge,onValueChange:pe,children:[e.jsx(Ie,{children:e.jsx(Fe,{placeholder:"้€‰ๆ‹ฉๅˆ†ๆ”ฏ"})}),e.jsxs(Be,{children:[e.jsx(W,{value:"main",children:"main (้ป˜่ฎค)"}),e.jsx(W,{value:"master",children:"master"}),e.jsx(W,{value:"dev",children:"dev (ๅผ€ๅ‘็‰ˆ)"}),e.jsx(W,{value:"develop",children:"develop"}),e.jsx(W,{value:"beta",children:"beta (ๆต‹่ฏ•็‰ˆ)"}),e.jsx(W,{value:"stable",children:"stable (็จณๅฎš็‰ˆ)"})]})]})}),I==="custom"&&e.jsxs("div",{className:"space-y-2 mt-3",children:[e.jsx("input",{type:"text",className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",placeholder:"่พ“ๅ…ฅๅˆ†ๆ”ฏๅ็งฐ๏ผŒไพ‹ๅฆ‚: feature/new-feature",value:D,onChange:J=>Q(J.target.value)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"่พ“ๅ…ฅ Git ๅˆ†ๆ”ฏๅ็งฐใ€ๆ ‡็ญพๆˆ–ๆไบคๅ“ˆๅธŒ"})]})]})]})}),!Y&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๅฐ†ไปŽ้ป˜่ฎคๅˆ†ๆ”ฏ (main) ๅฎ‰่ฃ…ๆ’ไปถ"})]}),e.jsxs(gt,{children:[e.jsx(_,{variant:"outline",onClick:()=>Ne(!1),children:"ๅ–ๆถˆ"}),e.jsxs(_,{onClick:se,children:[e.jsx(na,{className:"h-4 w-4 mr-2"}),"ๅฎ‰่ฃ…"]})]})]})}),e.jsx(nr,{})]})})}function yC(){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(fv,{className:"h-8 w-8",strokeWidth:2}),"ๆจกๅž‹ๅˆ†้…้ข„่ฎพๅธ‚ๅœบ"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"ๆต่งˆๅ’Œไธ‹่ฝฝ็คพๅŒบๅ…ฑไบซ็š„ๆจกๅž‹ๅˆ†้…้ข„่ฎพ้…็ฝฎ"})]})})}),e.jsx(ts,{className:"flex-1",children:e.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-12rem)]",children:e.jsxs(Te,{className:"max-w-2xl w-full border-dashed",children:[e.jsxs(Oe,{className:"text-center",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx(xa,{className:"h-16 w-16 text-muted-foreground"})}),e.jsx(Ue,{className:"text-2xl",children:"ๅŠŸ่ƒฝๅผ€ๅ‘ไธญ"}),e.jsx(Ns,{className:"text-base",children:"ๆจกๅž‹ๅˆ†้…้ข„่ฎพๅธ‚ๅœบๅŠŸ่ƒฝๆญฃๅœจๅผ€ๅ‘ไธญ๏ผŒๆ•ฌ่ฏทๆœŸๅพ…๏ผ"})]}),e.jsx(ze,{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 wC({field:a,value:l,onChange:r}){const[c,d]=u.useState(!1);switch(a.ui_type){case"switch":return e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{children:a.label}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]}),e.jsx(qe,{checked:!!l,onCheckedChange:r,disabled:a.disabled})]});case"number":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:a.label}),e.jsx(ae,{type:"number",value:l??a.default,onChange:m=>r(parseFloat(m.target.value)||0),min:a.min,max:a.max,step:a.step??1,placeholder:a.placeholder,disabled:a.disabled}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]});case"slider":return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(T,{children:a.label}),e.jsx("span",{className:"text-sm text-muted-foreground",children:l??a.default})]}),e.jsx(el,{value:[l??a.default],onValueChange:m=>r(m[0]),min:a.min??0,max:a.max??100,step:a.step??1,disabled:a.disabled}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]});case"select":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:a.label}),e.jsxs(Pe,{value:String(l??a.default),onValueChange:r,disabled:a.disabled,children:[e.jsx(Ie,{children:e.jsx(Fe,{placeholder:a.placeholder??"่ฏท้€‰ๆ‹ฉ"})}),e.jsx(Be,{children:a.choices?.map(m=>e.jsx(W,{value:String(m),children:String(m)},String(m)))})]}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]});case"textarea":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:a.label}),e.jsx(pt,{value:l??a.default,onChange:m=>r(m.target.value),placeholder:a.placeholder,rows:a.rows??3,disabled:a.disabled}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]});case"password":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:a.label}),e.jsxs("div",{className:"relative",children:[e.jsx(ae,{type:c?"text":"password",value:l??"",onChange:m=>r(m.target.value),placeholder:a.placeholder,disabled:a.disabled,className:"pr-10"}),e.jsx(_,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3",onClick:()=>d(!c),children:c?e.jsx(ic,{className:"h-4 w-4"}):e.jsx(ua,{className:"h-4 w-4"})})]}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]});case"list":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:a.label}),e.jsx(TS,{value:Array.isArray(l)?l:[],onChange:m=>r(m),itemType:a.item_type??"string",itemFields:a.item_fields,minItems:a.min_items,maxItems:a.max_items,disabled:a.disabled,placeholder:a.placeholder}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]});case"text":default:return e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:a.label}),e.jsx(ae,{type:"text",value:l??a.default??"",onChange:m=>r(m.target.value),placeholder:a.placeholder,maxLength:a.max_length,disabled:a.disabled}),a.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.hint})]})}}function lj({section:a,config:l,onChange:r}){const[c,d]=u.useState(!a.collapsed),m=Object.entries(a.fields).filter(([,h])=>!h.hidden).sort(([,h],[,f])=>h.order-f.order);return e.jsx(xc,{open:c,onOpenChange:d,children:e.jsxs(Te,{children:[e.jsx(hc,{asChild:!0,children:e.jsxs(Oe,{className:"cursor-pointer hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[c?e.jsx(Ia,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(ra,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(Ue,{className:"text-lg",children:a.title})]}),e.jsxs(Ce,{variant:"secondary",className:"text-xs",children:[m.length," ้กน"]})]}),a.description&&e.jsx(Ns,{className:"ml-6",children:a.description})]})}),e.jsx(fc,{children:e.jsx(ze,{className:"space-y-4 pt-0",children:m.map(([h,f])=>e.jsx(wC,{field:f,value:l[a.name]?.[h],onChange:p=>r(a.name,h,p),sectionName:a.name},h))})})]})})}function _C({plugin:a,onBack:l}){const{toast:r}=nt(),{triggerRestart:c,isRestarting:d}=Tn(),[m,h]=u.useState("visual"),[f,p]=u.useState(null),[g,N]=u.useState({}),[j,b]=u.useState({}),[y,w]=u.useState(""),[z,M]=u.useState(""),[S,F]=u.useState(!0),[E,C]=u.useState(!1),[R,H]=u.useState(!1),[O,X]=u.useState(!1),[L,me]=u.useState(!1),Ne=u.useCallback(async()=>{F(!0);try{const[I,ue,Y]=await Promise.all([cC(a.id),oC(a.id),dC(a.id)]);p(I),N(ue),b(JSON.parse(JSON.stringify(ue))),w(Y),M(Y)}catch(I){r({title:"ๅŠ ่ฝฝ้…็ฝฎๅคฑ่ดฅ",description:I instanceof Error?I.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}finally{F(!1)}},[a.id,r]);u.useEffect(()=>{Ne()},[Ne]),u.useEffect(()=>{H(m==="visual"?JSON.stringify(g)!==JSON.stringify(j):y!==z)},[g,j,y,z,m]);const je=(I,ue,Y)=>{N(we=>({...we,[I]:{...we[I]||{},[ue]:Y}}))},re=async()=>{C(!0);try{if(m==="source"){try{_x(y)}catch(I){X(!0),r({title:"TOML ๆ ผๅผ้”™่ฏฏ",description:I instanceof Error?I.message:"ๆ— ๆณ•่งฃๆž TOML ้…็ฝฎ๏ผŒ่ฏทๆฃ€ๆŸฅ่ฏญๆณ•",variant:"destructive"}),C(!1);return}await mC(a.id,y),M(y),X(!1)}else await uC(a.id,g),b(JSON.parse(JSON.stringify(g)));r({title:"้…็ฝฎๅทฒไฟๅญ˜",description:"ๆ›ดๆ”นๅฐ†ๅœจๆ’ไปถ้‡ๆ–ฐๅŠ ่ฝฝๅŽ็”Ÿๆ•ˆ"})}catch(I){r({title:"ไฟๅญ˜ๅคฑ่ดฅ",description:I instanceof Error?I.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}finally{C(!1)}},ge=async()=>{try{await xC(a.id),r({title:"้…็ฝฎๅทฒ้‡็ฝฎ",description:"ไธ‹ๆฌกๅŠ ่ฝฝๆ’ไปถๆ—ถๅฐ†ไฝฟ็”จ้ป˜่ฎค้…็ฝฎ"}),me(!1),Ne()}catch(I){r({title:"้‡็ฝฎๅคฑ่ดฅ",description:I instanceof Error?I.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}},pe=async()=>{try{const I=await hC(a.id);r({title:I.message,description:I.note}),Ne()}catch(I){r({title:"ๅˆ‡ๆข็Šถๆ€ๅคฑ่ดฅ",description:I instanceof Error?I.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}};if(S)return e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx(Fs,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(!f)return e.jsxs("div",{className:"flex flex-col items-center justify-center h-64 space-y-4",children:[e.jsx(Ut,{className:"h-12 w-12 text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground",children:"ๆ— ๆณ•ๅŠ ่ฝฝ้…็ฝฎ"}),e.jsxs(_,{onClick:l,variant:"outline",children:[e.jsx($a,{className:"h-4 w-4 mr-2"}),"่ฟ”ๅ›ž"]})]});const D=Object.values(f.sections).sort((I,ue)=>I.order-ue.order),Q=g.plugin?.enabled!==!1;return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(_,{variant:"ghost",size:"icon",onClick:l,children:e.jsx($a,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:f.plugin_info.name||a.manifest.name}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx(Ce,{variant:Q?"default":"secondary",children:Q?"ๅทฒๅฏ็”จ":"ๅทฒ็ฆ็”จ"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["v",f.plugin_info.version||a.manifest.version]})]})]})]}),e.jsxs("div",{className:"flex gap-2 ml-10 sm:ml-0",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>h(m==="visual"?"source":"visual"),children:m==="visual"?e.jsxs(e.Fragment,{children:[e.jsx(dx,{className:"h-4 w-4 mr-2"}),"ๆบไปฃ็ "]}):e.jsxs(e.Fragment,{children:[e.jsx(uv,{className:"h-4 w-4 mr-2"}),"ๅฏ่ง†ๅŒ–"]})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>c(),disabled:d,children:[e.jsx(hv,{className:`h-4 w-4 mr-2 ${d?"animate-spin":""}`}),"้‡ๅฏ้บฆ้บฆ"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:pe,children:[e.jsx(pc,{className:"h-4 w-4 mr-2"}),Q?"็ฆ็”จ":"ๅฏ็”จ"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>me(!0),children:[e.jsx(rc,{className:"h-4 w-4 mr-2"}),"้‡็ฝฎ"]}),e.jsxs(_,{size:"sm",onClick:re,disabled:!R||E,children:[E?e.jsx(Fs,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(gc,{className:"h-4 w-4 mr-2"}),"ไฟๅญ˜"]})]})]}),R&&e.jsx(Te,{className:"border-orange-200 bg-orange-50 dark:bg-orange-950/20 dark:border-orange-900",children:e.jsx(ze,{className:"py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Yt,{className:"h-4 w-4 text-orange-600"}),e.jsx("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:"ๆœ‰ๆœชไฟๅญ˜็š„ๆ›ดๆ”น"})]})})}),m==="source"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(ht,{children:[e.jsx(Ut,{className:"h-4 w-4"}),e.jsxs(ft,{children:[e.jsx("strong",{children:"ๆบไปฃ็ ๆจกๅผ๏ผˆ้ซ˜็บงๅŠŸ่ƒฝ๏ผ‰๏ผš"}),"็›ดๆŽฅ็ผ–่พ‘ TOML ้…็ฝฎๆ–‡ไปถใ€‚ไฟๅญ˜ๆ—ถไผš้ชŒ่ฏๆ ผๅผ๏ผŒๅชๆœ‰ๆ ผๅผๆญฃ็กฎๆ‰่ƒฝไฟๅญ˜ใ€‚",O&&e.jsx("span",{className:"text-destructive font-semibold ml-2",children:"โš ๏ธ ไธŠๆฌกไฟๅญ˜ๅคฑ่ดฅ๏ผŒ่ฏทๆฃ€ๆŸฅ TOML ๆ ผๅผ"})]})]}),e.jsx(Qv,{value:y,onChange:I=>{w(I),O&&X(!1)},language:"toml",theme:"dark",height:"calc(100vh - 350px)",minHeight:"500px",placeholder:"TOML ้…็ฝฎๅ†…ๅฎน"})]}),m==="visual"&&e.jsxs(e.Fragment,{children:[e.jsxs(ht,{children:[e.jsx(Yt,{className:"h-4 w-4"}),e.jsxs(ft,{children:[e.jsx("strong",{children:"ๆ็คบ๏ผš"}),"ๅฆ‚ๆžœๆ’ไปถๅฝ“ๅ‰ๆœชๅŠ ่ฝฝๆˆ–ๆœชๅฏ็”จ๏ผŒWebUI ้€‚้…ๅ™จ็š„้ซ˜็บงๆ’ไปถๅฏ่ง†ๅŒ–็ผ–่พ‘ๅŠŸ่ƒฝๅฏ่ƒฝไผšไธๅฏ็”จใ€‚ ่ฏท็กฎไฟๆ’ไปถๅทฒๅฏ็”จๅนถๆˆๅŠŸๅŠ ่ฝฝๅŽ๏ผŒๅ†่ฟ›่กŒ้…็ฝฎ็ผ–่พ‘ใ€‚"]})]}),f.layout.type==="tabs"&&f.layout.tabs.length>0?e.jsxs(Jt,{defaultValue:f.layout.tabs[0]?.id,children:[e.jsx(Gt,{children:f.layout.tabs.map(I=>e.jsxs(Xe,{value:I.id,children:[I.title,I.badge&&e.jsx(Ce,{variant:"secondary",className:"ml-2 text-xs",children:I.badge})]},I.id))}),f.layout.tabs.map(I=>e.jsx(Ss,{value:I.id,className:"space-y-4 mt-4",children:I.sections.map(ue=>{const Y=f.sections[ue];return Y?e.jsx(lj,{section:Y,config:g,onChange:je},ue):null})},I.id))]}):e.jsx("div",{className:"space-y-4",children:D.map(I=>e.jsx(lj,{section:I,config:g,onChange:je},I.name))})]}),e.jsx(Qs,{open:L,onOpenChange:me,children:e.jsxs(Hs,{children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"็กฎ่ฎค้‡็ฝฎ้…็ฝฎ"}),e.jsx(at,{children:"่ฟ™ๅฐ†ๅˆ ้™คๅฝ“ๅ‰้…็ฝฎๆ–‡ไปถ๏ผŒไธ‹ๆฌกๅŠ ่ฝฝๆ’ไปถๆ—ถๅฐ†ไฝฟ็”จ้ป˜่ฎค้…็ฝฎใ€‚ๆญคๆ“ไฝœไธๅฏๆ’ค้”€ใ€‚"})]}),e.jsxs(gt,{children:[e.jsx(_,{variant:"outline",onClick:()=>me(!1),children:"ๅ–ๆถˆ"}),e.jsx(_,{variant:"destructive",onClick:ge,children:"็กฎ่ฎค้‡็ฝฎ"})]})]})})]})}function SC(){return e.jsx(lr,{children:e.jsx(kC,{})})}function kC(){const{toast:a}=nt(),[l,r]=u.useState([]),[c,d]=u.useState(!0),[m,h]=u.useState(""),[f,p]=u.useState(null),g=async()=>{d(!0);try{const w=await Bl();r(w)}catch(w){a({title:"ๅŠ ่ฝฝๆ’ไปถๅˆ—่กจๅคฑ่ดฅ",description:w instanceof Error?w.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}finally{d(!1)}};u.useEffect(()=>{g()},[]);const j=l.filter(w=>{const z=m.toLowerCase();return w.id.toLowerCase().includes(z)||w.manifest.name.toLowerCase().includes(z)||w.manifest.description?.toLowerCase().includes(z)}).filter((w,z,M)=>z===M.findIndex(S=>S.id===w.id)),b=l.length,y=0;return f?e.jsxs(e.Fragment,{children:[e.jsx(ts,{className:"h-full",children:e.jsx("div",{className:"p-4 sm:p-6",children:e.jsx(_C,{plugin:f,onBack:()=>p(null)})})}),e.jsx(nr,{})]}):e.jsx(ts,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"ๆ’ไปถ้…็ฝฎ"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"็ฎก็†ๅ’Œ้…็ฝฎๅทฒๅฎ‰่ฃ…็š„ๆ’ไปถ"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:g,children:[e.jsx(dt,{className:`h-4 w-4 mr-2 ${c?"animate-spin":""}`}),"ๅˆทๆ–ฐ"]})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-3",children:[e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"ๅทฒๅฎ‰่ฃ…ๆ’ไปถ"}),e.jsx(xa,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(ze,{children:[e.jsx("div",{className:"text-2xl font-bold",children:l.length}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:c?"ๆญฃๅœจๅŠ ่ฝฝ...":"ไธชๆ’ไปถ"})]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"ๅทฒๅฏ็”จ"}),e.jsx(st,{className:"h-4 w-4 text-green-600"})]}),e.jsxs(ze,{children:[e.jsx("div",{className:"text-2xl font-bold",children:b}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"่ฟ่กŒไธญ็š„ๆ’ไปถ"})]})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:"ๅทฒ็ฆ็”จ"}),e.jsx(Ut,{className:"h-4 w-4 text-orange-600"})]}),e.jsxs(ze,{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("div",{className:"relative",children:[e.jsx($t,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ae,{placeholder:"ๆœ็ดขๆ’ไปถ...",value:m,onChange:w=>h(w.target.value),className:"pl-9"})]}),e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"ๅทฒๅฎ‰่ฃ…็š„ๆ’ไปถ"}),e.jsx(Ns,{children:"็‚นๅ‡ปๆ’ไปถๆŸฅ็œ‹ๅ’Œ็ผ–่พ‘้…็ฝฎ"})]}),e.jsx(ze,{children:c?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(Fs,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):j.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-4",children:[e.jsx(xa,{className:"h-16 w-16 text-muted-foreground/50"}),e.jsxs("div",{className:"text-center space-y-2",children:[e.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:m?"ๆฒกๆœ‰ๆ‰พๅˆฐๅŒน้…็š„ๆ’ไปถ":"ๆš‚ๆ— ๅทฒๅฎ‰่ฃ…็š„ๆ’ไปถ"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:m?"ๅฐ่ฏ•ๅ…ถไป–ๆœ็ดขๅ…ณ้”ฎ่ฏ":"ๅ‰ๅพ€ๆ’ไปถๅธ‚ๅœบๅฎ‰่ฃ…ๆ’ไปถ"})]})]}):e.jsx("div",{className:"space-y-2",children:j.map(w=>e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg border hover:bg-muted/50 cursor-pointer transition-colors",onClick:()=>p(w),children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"h-10 w-10 rounded-lg bg-primary/10 flex items-center justify-center flex-shrink-0",children:e.jsx(xa,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"font-medium truncate",children:w.manifest.name}),e.jsxs(Ce,{variant:"secondary",className:"text-xs flex-shrink-0",children:["v",w.manifest.version]})]}),e.jsx("p",{className:"text-sm text-muted-foreground truncate",children:w.manifest.description||"ๆš‚ๆ— ๆ่ฟฐ"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(_,{variant:"ghost",size:"sm",children:e.jsx(Sn,{className:"h-4 w-4"})}),e.jsx(ra,{className:"h-4 w-4 text-muted-foreground"})]})]},w.id))})})]})]})})}function CC(){const a=ha(),{toast:l}=nt(),[r,c]=u.useState([]),[d,m]=u.useState(!0),[h,f]=u.useState(null),[p,g]=u.useState(null),[N,j]=u.useState(!1),[b,y]=u.useState(!1),[w,z]=u.useState({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),M=u.useCallback(async()=>{try{m(!0),f(null);const O=await ke("/api/webui/plugins/mirrors");if(!O.ok)throw new Error("่Žทๅ–้•œๅƒๆบๅˆ—่กจๅคฑ่ดฅ");const X=await O.json();c(X.mirrors||[])}catch(O){const X=O instanceof Error?O.message:"ๅŠ ่ฝฝ้•œๅƒๆบๅคฑ่ดฅ";f(X),l({title:"ๅŠ ่ฝฝๅคฑ่ดฅ",description:X,variant:"destructive"})}finally{m(!1)}},[l]);u.useEffect(()=>{M()},[M]);const S=async()=>{try{const O=await ke("/api/webui/plugins/mirrors",{method:"POST",body:JSON.stringify(w)});if(!O.ok){const X=await O.json();throw new Error(X.detail||"ๆทปๅŠ ้•œๅƒๆบๅคฑ่ดฅ")}l({title:"ๆทปๅŠ ๆˆๅŠŸ",description:"้•œๅƒๆบๅทฒๆทปๅŠ "}),j(!1),z({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),M()}catch(O){l({title:"ๆทปๅŠ ๅคฑ่ดฅ",description:O instanceof Error?O.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}},F=async()=>{if(p)try{if(!(await ke(`/api/webui/plugins/mirrors/${p.id}`,{method:"PUT",body:JSON.stringify({name:w.name,raw_prefix:w.raw_prefix,clone_prefix:w.clone_prefix,enabled:w.enabled,priority:w.priority})})).ok)throw new Error("ๆ›ดๆ–ฐ้•œๅƒๆบๅคฑ่ดฅ");l({title:"ๆ›ดๆ–ฐๆˆๅŠŸ",description:"้•œๅƒๆบๅทฒๆ›ดๆ–ฐ"}),y(!1),g(null),M()}catch(O){l({title:"ๆ›ดๆ–ฐๅคฑ่ดฅ",description:O instanceof Error?O.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}},E=async O=>{if(confirm("็กฎๅฎš่ฆๅˆ ้™ค่ฟ™ไธช้•œๅƒๆบๅ—๏ผŸ"))try{if(!(await ke(`/api/webui/plugins/mirrors/${O}`,{method:"DELETE"})).ok)throw new Error("ๅˆ ้™ค้•œๅƒๆบๅคฑ่ดฅ");l({title:"ๅˆ ้™คๆˆๅŠŸ",description:"้•œๅƒๆบๅทฒๅˆ ้™ค"}),M()}catch(X){l({title:"ๅˆ ้™คๅคฑ่ดฅ",description:X instanceof Error?X.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}},C=async O=>{try{if(!(await ke(`/api/webui/plugins/mirrors/${O.id}`,{method:"PUT",body:JSON.stringify({enabled:!O.enabled})})).ok)throw new Error("ๆ›ดๆ–ฐ็Šถๆ€ๅคฑ่ดฅ");M()}catch(X){l({title:"ๆ›ดๆ–ฐๅคฑ่ดฅ",description:X instanceof Error?X.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}},R=O=>{g(O),z({id:O.id,name:O.name,raw_prefix:O.raw_prefix,clone_prefix:O.clone_prefix,enabled:O.enabled,priority:O.priority}),y(!0)},H=async(O,X)=>{const L=X==="up"?O.priority-1:O.priority+1;if(!(L<1))try{if(!(await ke(`/api/webui/plugins/mirrors/${O.id}`,{method:"PUT",body:JSON.stringify({priority:L})})).ok)throw new Error("ๆ›ดๆ–ฐไผ˜ๅ…ˆ็บงๅคฑ่ดฅ");M()}catch(me){l({title:"ๆ›ดๆ–ฐๅคฑ่ดฅ",description:me instanceof Error?me.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}};return e.jsx(ts,{className:"h-full",children:e.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>a({to:"/plugins"}),children:e.jsx($a,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"้•œๅƒๆบ้…็ฝฎ"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"็ฎก็† Git ๅ…‹้š†ๅ’Œๆ–‡ไปถไธ‹่ฝฝ็š„้•œๅƒๆบ"})]})]}),e.jsxs(_,{onClick:()=>j(!0),children:[e.jsx(Xs,{className:"h-4 w-4 mr-2"}),"ๆทปๅŠ ้•œๅƒๆบ"]})]}),d?e.jsx(Te,{className:"p-6",children:e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Fs,{className:"h-8 w-8 animate-spin text-primary"})})}):h?e.jsx(Te,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Lt,{className:"h-12 w-12 text-destructive mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"ๅŠ ่ฝฝๅคฑ่ดฅ"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:h}),e.jsx(_,{onClick:M,children:"้‡ๆ–ฐๅŠ ่ฝฝ"})]})}):e.jsxs(Te,{children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs(ql,{children:[e.jsx(Vl,{children:e.jsxs(_t,{children:[e.jsx(ns,{children:"็Šถๆ€"}),e.jsx(ns,{children:"ๅ็งฐ"}),e.jsx(ns,{children:"ID"}),e.jsx(ns,{children:"ไผ˜ๅ…ˆ็บง"}),e.jsx(ns,{className:"text-right",children:"ๆ“ไฝœ"})]})}),e.jsx(Gl,{children:r.map(O=>e.jsxs(_t,{children:[e.jsx(Ze,{children:e.jsx(qe,{checked:O.enabled,onCheckedChange:()=>C(O)})}),e.jsx(Ze,{children:e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:O.name}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Raw: ",O.raw_prefix]})]})}),e.jsx(Ze,{children:e.jsx(Ce,{variant:"outline",children:O.id})}),e.jsx(Ze,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-mono",children:O.priority}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(_,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>H(O,"up"),disabled:O.priority===1,children:e.jsx(Xr,{className:"h-3 w-3"})}),e.jsx(_,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>H(O,"down"),children:e.jsx(Ia,{className:"h-3 w-3"})})]})]})}),e.jsx(Ze,{className:"text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>R(O),children:e.jsx(Zn,{className:"h-4 w-4"})}),e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>E(O.id),children:e.jsx(os,{className:"h-4 w-4 text-destructive"})})]})})]},O.id))})]})}),e.jsx("div",{className:"md:hidden p-4 space-y-4",children:r.map(O=>e.jsx(Te,{className:"p-4",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"font-semibold",children:O.name}),O.enabled&&e.jsx(Ce,{variant:"default",className:"text-xs",children:"ๅฏ็”จ"})]}),e.jsx(Ce,{variant:"outline",className:"mt-1 text-xs",children:O.id})]}),e.jsx(qe,{checked:O.enabled,onCheckedChange:()=>C(O)})]}),e.jsxs("div",{className:"text-sm space-y-1",children:[e.jsxs("div",{className:"text-muted-foreground",children:[e.jsx("span",{className:"font-medium",children:"Raw: "}),e.jsx("span",{className:"break-all",children:O.raw_prefix})]}),e.jsxs("div",{className:"text-muted-foreground",children:[e.jsx("span",{className:"font-medium",children:"ไผ˜ๅ…ˆ็บง: "}),e.jsx("span",{className:"font-mono",children:O.priority})]})]}),e.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t",children:[e.jsxs(_,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>R(O),children:[e.jsx(Zn,{className:"h-4 w-4 mr-1"}),"็ผ–่พ‘"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>H(O,"up"),disabled:O.priority===1,children:e.jsx(Xr,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>H(O,"down"),children:e.jsx(Ia,{className:"h-4 w-4"})}),e.jsx(_,{variant:"destructive",size:"sm",onClick:()=>E(O.id),children:e.jsx(os,{className:"h-4 w-4"})})]})]})},O.id))})]}),e.jsx(Qs,{open:N,onOpenChange:j,children:e.jsxs(Hs,{className:"max-w-lg",children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"ๆทปๅŠ ้•œๅƒๆบ"}),e.jsx(at,{children:"ๆทปๅŠ ๆ–ฐ็š„ Git ้•œๅƒๆบ้…็ฝฎ"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"add-id",children:"้•œๅƒๆบ ID *"}),e.jsx(ae,{id:"add-id",placeholder:"ไพ‹ๅฆ‚: my-mirror",value:w.id,onChange:O=>z({...w,id:O.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"add-name",children:"ๅ็งฐ *"}),e.jsx(ae,{id:"add-name",placeholder:"ไพ‹ๅฆ‚: ๆˆ‘็š„้•œๅƒๆบ",value:w.name,onChange:O=>z({...w,name:O.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"add-raw",children:"Raw ๆ–‡ไปถๅ‰็ผ€ *"}),e.jsx(ae,{id:"add-raw",placeholder:"https://example.com/raw",value:w.raw_prefix,onChange:O=>z({...w,raw_prefix:O.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"add-clone",children:"ๅ…‹้š†ๅ‰็ผ€ *"}),e.jsx(ae,{id:"add-clone",placeholder:"https://example.com/clone",value:w.clone_prefix,onChange:O=>z({...w,clone_prefix:O.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"add-priority",children:"ไผ˜ๅ…ˆ็บง"}),e.jsx(ae,{id:"add-priority",type:"number",min:"1",value:w.priority,onChange:O=>z({...w,priority:parseInt(O.target.value)||1})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆ•ฐๅญ—่ถŠๅฐไผ˜ๅ…ˆ็บง่ถŠ้ซ˜"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qe,{id:"add-enabled",checked:w.enabled,onCheckedChange:O=>z({...w,enabled:O})}),e.jsx(T,{htmlFor:"add-enabled",children:"ๅฏ็”จๆญค้•œๅƒๆบ"})]})]}),e.jsxs(gt,{children:[e.jsx(_,{variant:"outline",onClick:()=>j(!1),children:"ๅ–ๆถˆ"}),e.jsx(_,{onClick:S,children:"ๆทปๅŠ "})]})]})}),e.jsx(Qs,{open:b,onOpenChange:y,children:e.jsxs(Hs,{className:"max-w-lg",children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"็ผ–่พ‘้•œๅƒๆบ"}),e.jsx(at,{children:"ไฟฎๆ”น้•œๅƒๆบ้…็ฝฎ"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"้•œๅƒๆบ ID"}),e.jsx(ae,{value:w.id,disabled:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit-name",children:"ๅ็งฐ *"}),e.jsx(ae,{id:"edit-name",value:w.name,onChange:O=>z({...w,name:O.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit-raw",children:"Raw ๆ–‡ไปถๅ‰็ผ€ *"}),e.jsx(ae,{id:"edit-raw",value:w.raw_prefix,onChange:O=>z({...w,raw_prefix:O.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit-clone",children:"ๅ…‹้š†ๅ‰็ผ€ *"}),e.jsx(ae,{id:"edit-clone",value:w.clone_prefix,onChange:O=>z({...w,clone_prefix:O.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"edit-priority",children:"ไผ˜ๅ…ˆ็บง"}),e.jsx(ae,{id:"edit-priority",type:"number",min:"1",value:w.priority,onChange:O=>z({...w,priority:parseInt(O.target.value)||1})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"ๆ•ฐๅญ—่ถŠๅฐไผ˜ๅ…ˆ็บง่ถŠ้ซ˜"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(qe,{id:"edit-enabled",checked:w.enabled,onCheckedChange:O=>z({...w,enabled:O})}),e.jsx(T,{htmlFor:"edit-enabled",children:"ๅฏ็”จๆญค้•œๅƒๆบ"})]})]}),e.jsxs(gt,{children:[e.jsx(_,{variant:"outline",onClick:()=>y(!1),children:"ๅ–ๆถˆ"}),e.jsx(_,{onClick:F,children:"ไฟๅญ˜"})]})]})})]})})}function TC({pluginId:a,compact:l=!1}){const[r,c]=u.useState(null),[d,m]=u.useState(!0),[h,f]=u.useState(0),[p,g]=u.useState(""),[N,j]=u.useState(!1),{toast:b}=nt(),y=async()=>{m(!0);const S=await bN(a);S&&c(S),m(!1)};u.useEffect(()=>{y()},[a]);const w=async()=>{const S=await fC(a);S.success?(b({title:"ๅทฒ็‚น่ตž",description:"ๆ„Ÿ่ฐขไฝ ็š„ๆ”ฏๆŒ๏ผ"}),y()):b({title:"็‚น่ตžๅคฑ่ดฅ",description:S.error||"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})},z=async()=>{const S=await pC(a);S.success?(b({title:"ๅทฒๅ้ฆˆ",description:"ๆ„Ÿ่ฐขไฝ ็š„ๅ้ฆˆ๏ผ"}),y()):b({title:"ๆ“ไฝœๅคฑ่ดฅ",description:S.error||"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})},M=async()=>{if(h===0){b({title:"่ฏท้€‰ๆ‹ฉ่ฏ„ๅˆ†",description:"่‡ณๅฐ‘้€‰ๆ‹ฉ 1 ้ข—ๆ˜Ÿ",variant:"destructive"});return}const S=await gC(a,h,p||void 0);S.success?(b({title:"่ฏ„ๅˆ†ๆˆๅŠŸ",description:"ๆ„Ÿ่ฐขไฝ ็š„่ฏ„ไปท๏ผ"}),j(!1),f(0),g(""),y()):b({title:"่ฏ„ๅˆ†ๅคฑ่ดฅ",description:S.error||"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})};return d?e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(na,{className:"h-4 w-4"}),e.jsx("span",{children:"-"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(vn,{className:"h-4 w-4"}),e.jsx("span",{children:"-"})]})]}):r?l?e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",title:`ไธ‹่ฝฝ้‡: ${r.downloads.toLocaleString()}`,children:[e.jsx(na,{className:"h-4 w-4"}),e.jsx("span",{children:r.downloads.toLocaleString()})]}),e.jsxs("div",{className:"flex items-center gap-1",title:`่ฏ„ๅˆ†: ${r.rating.toFixed(1)} (${r.rating_count} ๆก่ฏ„ไปท)`,children:[e.jsx(vn,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),e.jsx("span",{children:r.rating.toFixed(1)})]}),e.jsxs("div",{className:"flex items-center gap-1",title:`็‚น่ตžๆ•ฐ: ${r.likes}`,children:[e.jsx(Mm,{className:"h-4 w-4"}),e.jsx("span",{children:r.likes})]})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(na,{className:"h-5 w-5 text-muted-foreground mb-1"}),e.jsx("span",{className:"text-2xl font-bold",children:r.downloads.toLocaleString()}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"ไธ‹่ฝฝ้‡"})]}),e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(vn,{className:"h-5 w-5 text-yellow-400 mb-1 fill-yellow-400"}),e.jsx("span",{className:"text-2xl font-bold",children:r.rating.toFixed(1)}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[r.rating_count," ๆก่ฏ„ไปท"]})]}),e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(Mm,{className:"h-5 w-5 text-green-500 mb-1"}),e.jsx("span",{className:"text-2xl font-bold",children:r.likes}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"็‚น่ตž"})]}),e.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[e.jsx(Ag,{className:"h-5 w-5 text-red-500 mb-1"}),e.jsx("span",{className:"text-2xl font-bold",children:r.dislikes}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"็‚น่ธฉ"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:w,children:[e.jsx(Mm,{className:"h-4 w-4 mr-1"}),"็‚น่ตž"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:z,children:[e.jsx(Ag,{className:"h-4 w-4 mr-1"}),"็‚น่ธฉ"]}),e.jsxs(Qs,{open:N,onOpenChange:j,children:[e.jsx(dd,{asChild:!0,children:e.jsxs(_,{variant:"default",size:"sm",children:[e.jsx(vn,{className:"h-4 w-4 mr-1"}),"่ฏ„ๅˆ†"]})}),e.jsxs(Hs,{children:[e.jsxs(qs,{children:[e.jsx(Vs,{children:"ไธบๆ’ไปถ่ฏ„ๅˆ†"}),e.jsx(at,{children:"ๅˆ†ไบซไฝ ็š„ไฝฟ็”จไฝ“้ชŒ๏ผŒๅธฎๅŠฉๅ…ถไป–็”จๆˆท"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx("div",{className:"flex gap-2",children:[1,2,3,4,5].map(S=>e.jsx("button",{onClick:()=>f(S),className:"focus:outline-none",children:e.jsx(vn,{className:`h-8 w-8 transition-colors ${S<=h?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-300"}`})},S))}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[h===0&&"็‚นๅ‡ปๆ˜Ÿๆ˜Ÿ่ฟ›่กŒ่ฏ„ๅˆ†",h===1&&"ๅพˆๅทฎ",h===2&&"ไธ€่ˆฌ",h===3&&"่ฟ˜่กŒ",h===4&&"ไธ้”™",h===5&&"้žๅธธๅฅฝ"]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium mb-2 block",children:"่ฏ„่ฎบ๏ผˆๅฏ้€‰๏ผ‰"}),e.jsx(pt,{value:p,onChange:S=>g(S.target.value),placeholder:"ๅˆ†ไบซไฝ ็š„ไฝฟ็”จไฝ“้ชŒ...",rows:4,maxLength:500}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1 text-right",children:[p.length," / 500"]})]})]}),e.jsxs(gt,{children:[e.jsx(_,{variant:"outline",onClick:()=>j(!1),children:"ๅ–ๆถˆ"}),e.jsx(_,{onClick:M,disabled:h===0,children:"ๆไบค่ฏ„ๅˆ†"})]})]})]})]}),r.recent_ratings&&r.recent_ratings.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"text-sm font-semibold",children:"ๆœ€่ฟ‘่ฏ„ไปท"}),e.jsx("div",{className:"space-y-3",children:r.recent_ratings.map((S,F)=>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(vn,{className:`h-3 w-3 ${E<=S.rating?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},E))}),e.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(S.created_at).toLocaleDateString()})]}),S.comment&&e.jsx("p",{className:"text-sm text-muted-foreground",children:S.comment})]},F))})]})]}):null}const EC={"Group Management":"็พค็ป„็ฎก็†","Entertainment & Interaction":"ๅจฑไนไบ’ๅŠจ","Utility Tools":"ๅฎž็”จๅทฅๅ…ท","Content Generation":"ๅ†…ๅฎน็”Ÿๆˆ",Multimedia:"ๅคšๅช’ไฝ“","External Integration":"ๅค–้ƒจ้›†ๆˆ","Data Analysis & Insights":"ๆ•ฐๆฎๅˆ†ๆžไธŽๆดžๅฏŸ",Other:"ๅ…ถไป–"};function MC(){const a=ha(),l=lw({strict:!1}),{toast:r}=nt(),[c,d]=u.useState(null),[m,h]=u.useState(""),[f,p]=u.useState(!0),[g,N]=u.useState(!0),[j,b]=u.useState(null),[y,w]=u.useState(null),[z,M]=u.useState(null),[S,F]=u.useState(!1),[E,C]=u.useState(),[R,H]=u.useState(!1);u.useEffect(()=>{(async()=>{if(!l.pluginId){b("็ผบๅฐ‘ๆ’ไปถ ID"),p(!1);return}try{p(!0),b(null);const ge=await ke("/api/webui/plugins/fetch-raw",{method:"POST",body:JSON.stringify({owner:"Mai-with-u",repo:"plugin-repo",branch:"main",file_path:"plugin_details.json"})});if(!ge.ok)throw new Error("่Žทๅ–ๆ’ไปถๅˆ—่กจๅคฑ่ดฅ");const pe=await ge.json();if(!pe.success||!pe.data)throw new Error(pe.error||"่Žทๅ–ๆ’ไปถๅˆ—่กจๅคฑ่ดฅ");const Q=JSON.parse(pe.data).find(fe=>fe.id===l.pluginId);if(!Q)throw new Error("ๆœชๆ‰พๅˆฐ่ฏฅๆ’ไปถ");const I={id:Q.id,manifest:Q.manifest,downloads:0,rating:0,review_count:0,installed:!1,published_at:new Date().toISOString(),updated_at:new Date().toISOString()};d(I);const[ue,Y,we]=await Promise.all([fN(),pN(),Bl()]);w(ue),M(Y),F(bn(l.pluginId,we)),C(yn(l.pluginId,we))}catch(ge){b(ge instanceof Error?ge.message:"ๅŠ ่ฝฝๅคฑ่ดฅ")}finally{p(!1)}})()},[l.pluginId]),u.useEffect(()=>{(async()=>{if(!c?.manifest?.repository_url){N(!1);return}try{if(N(!0),S&&l.pluginId)try{const Y=await ke(`/api/webui/plugins/local-readme/${l.pluginId}`);if(Y.ok){const we=await Y.json();if(we.success&&we.data){h(we.data),N(!1);return}}}catch(Y){console.log("ๆœฌๅœฐ README ่Žทๅ–ๅคฑ่ดฅ๏ผŒๅฐ่ฏ•่ฟœ็จ‹่Žทๅ–:",Y)}const ge=c.manifest.repository_url.match(/github\.com\/([^/]+)\/([^/\s]+)/);if(!ge){h("ๆ— ๆณ•่งฃๆžไป“ๅบ“ๅœฐๅ€");return}const[,pe,D]=ge,Q=D.replace(/\.git$/,""),I=await ke("/api/webui/plugins/fetch-raw",{method:"POST",body:JSON.stringify({owner:pe,repo:Q,branch:"main",file_path:"README.md"})});if(!I.ok)throw new Error("่Žทๅ– README ๅคฑ่ดฅ");const ue=await I.json();ue.success&&ue.data?h(ue.data):h("่ฏฅๆ’ไปถๆš‚ๆ—  README ๆ–‡ๆกฃ")}catch(ge){console.error("ๅŠ ่ฝฝ README ๅคฑ่ดฅ:",ge),h("ๅŠ ่ฝฝ README ๅคฑ่ดฅ")}finally{N(!1)}})()},[c,S,l.pluginId]);const O=()=>!c||!S||!E?!1:E!==c.manifest.version,X=()=>!c||!z?!0:gN(c.manifest.host_application.min_version,c.manifest.host_application.max_version,z),L=async()=>{if(!(!c||!y?.installed))try{H(!0),await jN(c.id,c.manifest.repository_url||"","main"),yN(c.id).catch(ge=>{console.warn("Failed to record download:",ge)}),r({title:"ๅฎ‰่ฃ…ๆˆๅŠŸ",description:`${c.manifest.name} ๅทฒๆˆๅŠŸๅฎ‰่ฃ…`});const re=await Bl();F(bn(c.id,re)),C(yn(c.id,re))}catch(re){r({title:"ๅฎ‰่ฃ…ๅคฑ่ดฅ",description:re instanceof Error?re.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}finally{H(!1)}},me=async()=>{if(c)try{H(!0),await vN(c.id),r({title:"ๅธ่ฝฝๆˆๅŠŸ",description:`${c.manifest.name} ๅทฒๆˆๅŠŸๅธ่ฝฝ`});const re=await Bl();F(bn(c.id,re)),C(yn(c.id,re))}catch(re){r({title:"ๅธ่ฝฝๅคฑ่ดฅ",description:re instanceof Error?re.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}finally{H(!1)}},Ne=async()=>{if(!(!c||!y?.installed))try{H(!0);const re=await NN(c.id,c.manifest.repository_url||"","main");r({title:"ๆ›ดๆ–ฐๆˆๅŠŸ",description:`${c.manifest.name} ๅทฒไปŽ ${re.old_version} ๆ›ดๆ–ฐๅˆฐ ${re.new_version}`});const ge=await Bl();F(bn(c.id,ge)),C(yn(c.id,ge))}catch(re){r({title:"ๆ›ดๆ–ฐๅคฑ่ดฅ",description:re instanceof Error?re.message:"ๆœช็Ÿฅ้”™่ฏฏ",variant:"destructive"})}finally{H(!1)}};if(f)return e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>a({to:"/plugins"}),children:e.jsx($a,{className:"h-5 w-5"})}),e.jsx("div",{children:e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"ๆ’ไปถ่ฏฆๆƒ…"})})]}),e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(Fs,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-muted-foreground",children:"ๅŠ ่ฝฝๆ’ไปถไฟกๆฏไธญ..."})]})]});if(j||!c)return e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>a({to:"/plugins"}),children:e.jsx($a,{className:"h-5 w-5"})}),e.jsx("div",{children:e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"ๆ’ไปถ่ฏฆๆƒ…"})})]}),e.jsx(Te,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Ut,{className:"h-12 w-12 text-destructive mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"ๅŠ ่ฝฝๅคฑ่ดฅ"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:j}),e.jsx(_,{onClick:()=>a({to:"/plugins"}),children:"่ฟ”ๅ›žๆ’ไปถๅˆ—่กจ"})]})})]});const je=X();return e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>a({to:"/plugins"}),className:"shrink-0",children:e.jsx($a,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"ๆ’ไปถ่ฏฆๆƒ…"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:c.manifest.name})]})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:S?e.jsxs(e.Fragment,{children:[O()?e.jsx(_,{disabled:!y?.installed||R,onClick:Ne,title:y?.installed?void 0:"Git ๆœชๅฎ‰่ฃ…",children:R?e.jsxs(e.Fragment,{children:[e.jsx(Fs,{className:"h-4 w-4 mr-2 animate-spin"}),"ๆ›ดๆ–ฐไธญ..."]}):e.jsxs(e.Fragment,{children:[e.jsx(dt,{className:"h-4 w-4 mr-2"}),"ๆ›ดๆ–ฐ"]})}):null,e.jsx(_,{variant:"destructive",disabled:!y?.installed||R,onClick:me,title:y?.installed?void 0:"Git ๆœชๅฎ‰่ฃ…",children:R?e.jsxs(e.Fragment,{children:[e.jsx(Fs,{className:"h-4 w-4 mr-2 animate-spin"}),"ๅธ่ฝฝไธญ..."]}):e.jsxs(e.Fragment,{children:[e.jsx(os,{className:"h-4 w-4 mr-2"}),"ๅธ่ฝฝ"]})})]}):e.jsx(_,{disabled:!y?.installed||!je||R,onClick:L,title:y?.installed?je?void 0:`ไธๅ…ผๅฎนๅฝ“ๅ‰็‰ˆๆœฌ (้œ€่ฆ ${c.manifest.host_application.min_version}${c.manifest.host_application.max_version?` - ${c.manifest.host_application.max_version}`:"+"}๏ผŒๅฝ“ๅ‰ ${z?.version})`:"Git ๆœชๅฎ‰่ฃ…",children:R?e.jsxs(e.Fragment,{children:[e.jsx(Fs,{className:"h-4 w-4 mr-2 animate-spin"}),"ๅฎ‰่ฃ…ไธญ..."]}):e.jsxs(e.Fragment,{children:[e.jsx(na,{className:"h-4 w-4 mr-2"}),"ๅฎ‰่ฃ…"]})})})]}),e.jsx(ts,{className:"h-[calc(100vh-200px)] sm:h-[calc(100vh-220px)]",children:e.jsxs("div",{className:"space-y-6 pr-4",children:[e.jsx(Te,{children:e.jsx(Oe,{children:e.jsx("div",{className:"flex items-start justify-between gap-4",children:e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsx(Ue,{className:"text-2xl",children:c.manifest.name}),e.jsxs(Ce,{variant:"secondary",className:"text-sm",children:["v",c.manifest.version]}),S&&e.jsxs(Ce,{variant:"default",className:"text-sm",children:[e.jsx(st,{className:"h-3 w-3 mr-1"}),"ๅทฒๅฎ‰่ฃ… ",E&&`(v${E})`]}),O()&&e.jsxs(Ce,{variant:"outline",className:"text-sm border-orange-500 text-orange-500",children:[e.jsx(dt,{className:"h-3 w-3 mr-1"}),"ๅฏๆ›ดๆ–ฐ"]}),!je&&e.jsxs(Ce,{variant:"destructive",className:"text-sm",children:[e.jsx(Ut,{className:"h-3 w-3 mr-1"}),"ไธๅ…ผๅฎน"]})]}),e.jsx(Ns,{className:"text-base",children:c.manifest.description})]})})})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-1 space-y-6",children:[e.jsxs(Te,{children:[e.jsx(Oe,{children:e.jsx(Ue,{className:"text-lg",children:"็ปŸ่ฎกไฟกๆฏ"})}),e.jsx(ze,{children:e.jsx(TC,{pluginId:c.id})})]}),e.jsxs(Te,{children:[e.jsx(Oe,{children:e.jsx(Ue,{className:"text-lg",children:"ๅŸบๆœฌไฟกๆฏ"})}),e.jsx(ze,{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(Fl,{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(xa,{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(ov,{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(Go,{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(Q_,{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(Yt,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"ๆ”ฏๆŒ็‰ˆๆœฌ:"})]}),e.jsxs("div",{className:"text-sm pl-6 font-medium",children:[c.manifest.host_application.min_version,c.manifest.host_application.max_version?` - ${c.manifest.host_application.max_version}`:" - ๆœ€ๆ–ฐ็‰ˆๆœฌ"]})]})]})})]}),(c.manifest.categories||c.manifest.keywords)&&e.jsxs(Te,{children:[e.jsx(Oe,{children:e.jsx(Ue,{className:"text-lg",children:"ๅˆ†็ฑปไธŽๆ ‡็ญพ"})}),e.jsxs(ze,{className:"space-y-4",children:[c.manifest.categories&&c.manifest.categories.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"ๅˆ†็ฑป"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:c.manifest.categories.map(re=>e.jsx(Ce,{variant:"secondary",children:EC[re]||re},re))})]}),c.manifest.keywords&&c.manifest.keywords.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"ๆ ‡็ญพ"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:c.manifest.keywords.map(re=>e.jsxs(Ce,{variant:"outline",className:"text-xs",children:[e.jsx(cd,{className:"h-3 w-3 mr-1"}),re]},re))})]})]})]})]}),e.jsxs(Te,{className:"lg:col-span-2",children:[e.jsx(Oe,{children:e.jsx(Ue,{className:"text-lg",children:"ๆ’ไปถ่ฏดๆ˜Ž"})}),e.jsx(ze,{children:e.jsx(ts,{className:"h-[600px] pr-4",children:g?e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(Fs,{className:"h-6 w-6 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-sm text-muted-foreground",children:"ๅŠ ่ฝฝ่ฏดๆ˜Žๆ–‡ๆกฃไธญ..."})]}):m?e.jsx(bx,{content:m}):e.jsx("div",{className:"text-center text-muted-foreground py-12",children:"ๆš‚ๆ— ่ฏดๆ˜Žๆ–‡ๆกฃ"})})})]})]})]})})]})}const ec=u.forwardRef(({className:a,...l},r)=>e.jsx(Aj,{ref:r,className:P("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",a),...l}));ec.displayName=Aj.displayName;const AC=u.forwardRef(({className:a,...l},r)=>e.jsx(zj,{ref:r,className:P("aspect-square h-full w-full",a),...l}));AC.displayName=zj.displayName;const sc=u.forwardRef(({className:a,...l},r)=>e.jsx(Rj,{ref:r,className:P("flex h-full w-full items-center justify-center rounded-full bg-muted",a),...l}));sc.displayName=Rj.displayName;function zC(){return"webui_"+Math.random().toString(36).substr(2,9)+"_"+Date.now().toString(36)}function RC(){const a="maibot_webui_user_id";let l=localStorage.getItem(a);return l||(l=zC(),localStorage.setItem(a,l)),l}function DC(){return localStorage.getItem("maibot_webui_user_name")||"WebUI็”จๆˆท"}function OC(a){localStorage.setItem("maibot_webui_user_name",a)}const wN="maibot_webui_virtual_tabs";function LC(){try{const a=localStorage.getItem(wN);if(a)return JSON.parse(a)}catch(a){console.error("[Chat] ๅŠ ่ฝฝ่™šๆ‹Ÿๆ ‡็ญพ้กตๅคฑ่ดฅ:",a)}return[]}function nj(a){try{localStorage.setItem(wN,JSON.stringify(a))}catch(l){console.error("[Chat] ไฟๅญ˜่™šๆ‹Ÿๆ ‡็ญพ้กตๅคฑ่ดฅ:",l)}}function UC({segment:a}){switch(a.type){case"text":return e.jsx("span",{className:"whitespace-pre-wrap",children:String(a.data)});case"image":case"emoji":return e.jsx("img",{src:String(a.data),alt:a.type==="emoji"?"่กจๆƒ…ๅŒ…":"ๅ›พ็‰‡",className:P("rounded-lg max-w-full",a.type==="emoji"?"max-h-32":"max-h-64"),loading:"lazy",onError:l=>{const r=l.target;r.style.display="none",r.parentElement?.insertAdjacentHTML("beforeend",`[${a.type==="emoji"?"่กจๆƒ…ๅŒ…":"ๅ›พ็‰‡"}ๅŠ ่ฝฝๅคฑ่ดฅ]`)}});case"voice":return e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("audio",{controls:!0,src:String(a.data),className:"max-w-[200px] h-8",children:"ๆ‚จ็š„ๆต่งˆๅ™จไธๆ”ฏๆŒ้Ÿณ้ข‘ๆ’ญๆ”พ"})});case"video":return e.jsx("video",{controls:!0,src:String(a.data),className:"rounded-lg max-w-full max-h-64",children:"ๆ‚จ็š„ๆต่งˆๅ™จไธๆ”ฏๆŒ่ง†้ข‘ๆ’ญๆ”พ"});case"face":return e.jsxs("span",{className:"text-muted-foreground",children:["[่กจๆƒ…:",String(a.data),"]"]});case"music":return e.jsx("span",{className:"text-muted-foreground",children:"[้Ÿณไนๅˆ†ไบซ]"});case"file":return e.jsxs("span",{className:"text-muted-foreground",children:["[ๆ–‡ไปถ: ",String(a.data),"]"]});case"reply":return e.jsx("span",{className:"text-muted-foreground text-xs",children:"[ๅ›žๅคๆถˆๆฏ]"});case"forward":return e.jsx("span",{className:"text-muted-foreground",children:"[่ฝฌๅ‘ๆถˆๆฏ]"});case"unknown":default:return e.jsxs("span",{className:"text-muted-foreground",children:["[",a.original_type||"ๆœช็Ÿฅๆถˆๆฏ","]"]})}}function $C({message:a,isBot:l}){return a.message_type==="rich"&&a.segments&&a.segments.length>0?e.jsx("div",{className:"flex flex-col gap-2",children:a.segments.map((r,c)=>e.jsx(UC,{segment:r},c))}):e.jsx("span",{className:"whitespace-pre-wrap",children:a.content})}function IC(){const a={id:"webui-default",type:"webui",label:"WebUI",messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}},l=()=>{const Ke=LC().map(He=>{const Je=He.virtualConfig;return!Je.groupId&&Je.platform&&Je.userId&&(Je.groupId=`webui_virtual_group_${Je.platform}_${Je.userId}`),{id:He.id,type:"virtual",label:He.label,virtualConfig:Je,messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}}});return[a,...Ke]},[r,c]=u.useState(l),[d,m]=u.useState("webui-default"),h=r.find(V=>V.id===d)||r[0],[f,p]=u.useState(""),[g,N]=u.useState(!1),[j,b]=u.useState(!0),[y,w]=u.useState(DC()),[z,M]=u.useState(!1),[S,F]=u.useState(""),[E,C]=u.useState(!1),[R,H]=u.useState([]),[O,X]=u.useState([]),[L,me]=u.useState(!1),[Ne,je]=u.useState(!1),[re,ge]=u.useState(""),[pe,D]=u.useState({platform:"",personId:"",userId:"",userName:"",groupName:"",groupId:""}),Q=u.useRef(RC()),I=u.useRef(new Map),ue=u.useRef(null),Y=u.useRef(new Map),we=u.useRef(0),fe=u.useRef(new Map),{toast:Ee}=nt(),G=V=>(we.current+=1,`${V}-${Date.now()}-${we.current}-${Math.random().toString(36).substr(2,9)}`),$=u.useCallback((V,Ke)=>{c(He=>He.map(Je=>Je.id===V?{...Je,...Ke}:Je))},[]),A=u.useCallback((V,Ke)=>{c(He=>He.map(Je=>Je.id===V?{...Je,messages:[...Je.messages,Ke]}:Je))},[]),K=u.useCallback(()=>{ue.current?.scrollIntoView({behavior:"smooth"})},[]);u.useEffect(()=>{K()},[h?.messages,K]);const Re=u.useCallback(async()=>{me(!0);try{const V=await ke("/api/chat/platforms");if(console.log("[Chat] ๅนณๅฐๅˆ—่กจๅ“ๅบ”:",V.status,V.headers.get("content-type")),V.ok){const Ke=V.headers.get("content-type");if(Ke&&Ke.includes("application/json")){const He=await V.json();console.log("[Chat] ๅนณๅฐๅˆ—่กจๆ•ฐๆฎ:",He),H(He.platforms||[])}else{const He=await V.text();console.error("[Chat] ่Žทๅ–ๅนณๅฐๅˆ—่กจๅคฑ่ดฅ: ้ž JSON ๅ“ๅบ”:",He.substring(0,200)),Ee({title:"่ฟžๆŽฅๅคฑ่ดฅ",description:"ๆ— ๆณ•่ฟžๆŽฅๅˆฐๅŽ็ซฏๆœๅŠก๏ผŒ่ฏท็กฎไฟ MaiBot ๅทฒๅฏๅŠจ",variant:"destructive"})}}else console.error("[Chat] ่Žทๅ–ๅนณๅฐๅˆ—่กจๅคฑ่ดฅ: HTTP",V.status),Ee({title:"่Žทๅ–ๅนณๅฐๅคฑ่ดฅ",description:`ๆœๅŠกๅ™จ่ฟ”ๅ›ž้”™่ฏฏ: ${V.status}`,variant:"destructive"})}catch(V){console.error("[Chat] ่Žทๅ–ๅนณๅฐๅˆ—่กจๅคฑ่ดฅ:",V),Ee({title:"็ฝ‘็ปœ้”™่ฏฏ",description:"ๆ— ๆณ•่ฟžๆŽฅๅˆฐๅŽ็ซฏๆœๅŠก",variant:"destructive"})}finally{me(!1)}},[Ee]),se=u.useCallback(async(V,Ke)=>{je(!0);try{const He=new URLSearchParams;V&&He.append("platform",V),Ke&&He.append("search",Ke),He.append("limit","50");const Je=await ke(`/api/chat/persons?${He.toString()}`);if(Je.ok){const Es=Je.headers.get("content-type");if(Es&&Es.includes("application/json")){const ms=await Je.json();X(ms.persons||[])}else console.error("[Chat] ่Žทๅ–็”จๆˆทๅˆ—่กจๅคฑ่ดฅ: ๅŽ็ซฏ่ฟ”ๅ›ž้ž JSON ๅ“ๅบ”")}}catch(He){console.error("[Chat] ่Žทๅ–็”จๆˆทๅˆ—่กจๅคฑ่ดฅ:",He)}finally{je(!1)}},[]);u.useEffect(()=>{pe.platform&&se(pe.platform,re)},[pe.platform,re,se]);const $e=u.useCallback(async(V,Ke)=>{b(!0);try{const He=new URLSearchParams;He.append("user_id",Q.current),He.append("limit","50"),Ke&&He.append("group_id",Ke);const Je=`/api/chat/history?${He.toString()}`;console.log("[Chat] ๆญฃๅœจๅŠ ่ฝฝๅކๅฒๆถˆๆฏ:",Je);const Es=await ke(Je);if(Es.ok){const ms=await Es.text();try{const Ms=JSON.parse(ms);if(Ms.messages&&Ms.messages.length>0){const We=Ms.messages.map(rs=>({id:rs.id,type:rs.type,content:rs.content,timestamp:rs.timestamp,sender:{name:rs.sender_name||(rs.is_bot?"้บฆ้บฆ":"WebUI็”จๆˆท"),user_id:rs.user_id,is_bot:rs.is_bot}}));$(V,{messages:We});const Cs=fe.current.get(V)||new Set;We.forEach(rs=>{if(rs.type==="bot"){const is=`bot-${rs.content}-${Math.floor(rs.timestamp*1e3)}`;Cs.add(is)}}),fe.current.set(V,Cs)}}catch(Ms){console.error("[Chat] JSON ่งฃๆžๅคฑ่ดฅ:",Ms)}}}catch(He){console.error("[Chat] ๅŠ ่ฝฝๅކๅฒๆถˆๆฏๅคฑ่ดฅ:",He)}finally{b(!1)}},[$]),cs=u.useCallback(async(V,Ke,He)=>{const Je=I.current.get(V);if(Je?.readyState===WebSocket.OPEN||Je?.readyState===WebSocket.CONNECTING){console.log(`[Tab ${V}] WebSocket ๅทฒๅญ˜ๅœจ๏ผŒ่ทณ่ฟ‡่ฟžๆŽฅ`);return}N(!0);let Es=null;try{const Cs=await ke("/api/webui/ws-token");if(Cs.ok){const rs=await Cs.json();if(rs.success&&rs.token)Es=rs.token;else{console.warn(`[Tab ${V}] ่Žทๅ– WebSocket token ๅคฑ่ดฅ: ${rs.message||"ๆœช็™ปๅฝ•"}`),N(!1);return}}}catch(Cs){console.error(`[Tab ${V}] ่Žทๅ– WebSocket token ๅคฑ่ดฅ:`,Cs),N(!1);return}if(!Es){N(!1);return}const ms=window.location.protocol==="https:"?"wss:":"ws:",Ms=new URLSearchParams;Ms.append("token",Es),Ke==="virtual"&&He?(Ms.append("user_id",He.userId),Ms.append("user_name",He.userName),Ms.append("platform",He.platform),Ms.append("person_id",He.personId),Ms.append("group_name",He.groupName||"WebUI่™šๆ‹Ÿ็พค่Š"),He.groupId&&Ms.append("group_id",He.groupId)):(Ms.append("user_id",Q.current),Ms.append("user_name",y));const We=`${ms}//${window.location.host}/api/chat/ws?${Ms.toString()}`;console.log(`[Tab ${V}] ๆญฃๅœจ่ฟžๆŽฅ WebSocket:`,We);try{const Cs=new WebSocket(We);I.current.set(V,Cs),Cs.onopen=()=>{$(V,{isConnected:!0}),N(!1),console.log(`[Tab ${V}] WebSocket ๅทฒ่ฟžๆŽฅ`)},Cs.onmessage=rs=>{try{const is=JSON.parse(rs.data);switch(is.type){case"session_info":$(V,{sessionInfo:{session_id:is.session_id,user_id:is.user_id,user_name:is.user_name,bot_name:is.bot_name}});break;case"system":A(V,{id:G("sys"),type:"system",content:is.content||"",timestamp:is.timestamp||Date.now()/1e3});break;case"user_message":{const ys=is.sender?.user_id,rt=Ke==="virtual"&&He?He.userId:Q.current;console.log(`[Tab ${V}] ๆ”ถๅˆฐ user_message, sender: ${ys}, current: ${rt}`);const jt=ys?ys.replace(/^webui_user_/,""):"",Ae=rt?rt.replace(/^webui_user_/,""):"";if(jt&&Ae&&jt===Ae){console.log(`[Tab ${V}] ่ทณ่ฟ‡่‡ชๅทฑ็š„ๆถˆๆฏ๏ผˆuser_id ๅŒน้…๏ผ‰`);break}const Qe=fe.current.get(V)||new Set,As=`user-${is.content}-${Math.floor((is.timestamp||0)*1e3)}`;if(Qe.has(As)){console.log(`[Tab ${V}] ่ทณ่ฟ‡่‡ชๅทฑ็š„ๆถˆๆฏ๏ผˆๅ†…ๅฎนๅŽป้‡๏ผ‰`);break}if(Qe.add(As),fe.current.set(V,Qe),Qe.size>100){const mt=Qe.values().next().value;mt&&Qe.delete(mt)}A(V,{id:is.message_id||G("user"),type:"user",content:is.content||"",timestamp:is.timestamp||Date.now()/1e3,sender:is.sender});break}case"bot_message":{$(V,{isTyping:!1});const ys=fe.current.get(V)||new Set,rt=`bot-${is.content}-${Math.floor((is.timestamp||0)*1e3)}`;if(ys.has(rt))break;if(ys.add(rt),fe.current.set(V,ys),ys.size>100){const jt=ys.values().next().value;jt&&ys.delete(jt)}c(jt=>jt.map(Ae=>{if(Ae.id!==V)return Ae;const Qe=Ae.messages.filter(mt=>mt.type!=="thinking"),As={id:G("bot"),type:"bot",content:is.content||"",message_type:is.message_type==="rich"?"rich":"text",segments:is.segments,timestamp:is.timestamp||Date.now()/1e3,sender:is.sender};return{...Ae,messages:[...Qe,As]}}));break}case"typing":$(V,{isTyping:is.is_typing||!1});break;case"error":c(ys=>ys.map(rt=>{if(rt.id!==V)return rt;const jt=rt.messages.filter(Ae=>Ae.type!=="thinking");return{...rt,messages:[...jt,{id:G("error"),type:"error",content:is.content||"ๅ‘็”Ÿ้”™่ฏฏ",timestamp:is.timestamp||Date.now()/1e3}]}})),Ee({title:"้”™่ฏฏ",description:is.content,variant:"destructive"});break;case"pong":break;case"history":{const ys=is.messages||[];if(ys.length>0){const rt=fe.current.get(V)||new Set,jt=ys.map(Ae=>{const Qe=Ae.is_bot||!1,As=Ae.id||G(Qe?"bot":"user"),mt=`${Qe?"bot":"user"}-${Ae.content}-${Math.floor(Ae.timestamp*1e3)}`;return rt.add(mt),{id:As,type:Qe?"bot":"user",content:Ae.content,timestamp:Ae.timestamp,sender:{name:Ae.sender_name||(Qe?"้บฆ้บฆ":"็”จๆˆท"),user_id:Ae.sender_id,is_bot:Qe}}});fe.current.set(V,rt),$(V,{messages:jt}),console.log(`[Tab ${V}] ๅทฒๅŠ ่ฝฝ ${jt.length} ๆกๅކๅฒๆถˆๆฏ`)}break}default:console.log("ๆœช็Ÿฅๆถˆๆฏ็ฑปๅž‹:",is.type)}}catch(is){console.error("่งฃๆžๆถˆๆฏๅคฑ่ดฅ:",is)}},Cs.onclose=()=>{$(V,{isConnected:!1}),N(!1),I.current.delete(V),console.log(`[Tab ${V}] WebSocket ๅทฒๆ–ญๅผ€`);const rs=Y.current.get(V);rs&&clearTimeout(rs);const is=window.setTimeout(()=>{if(!J.current){const ys=r.find(rt=>rt.id===V);ys&&cs(V,ys.type,ys.virtualConfig)}},5e3);Y.current.set(V,is)},Cs.onerror=rs=>{console.error(`[Tab ${V}] WebSocket ้”™่ฏฏ:`,rs),N(!1)}}catch(Cs){console.error(`[Tab ${V}] ๅˆ›ๅปบ WebSocket ๅคฑ่ดฅ:`,Cs),N(!1)}},[y,$,A,Ee,r]),J=u.useRef(!1);u.useEffect(()=>{J.current=!1;const V=I.current,Ke=Y.current,He=fe.current;$e("webui-default");const Je=setTimeout(()=>{J.current||(cs("webui-default","webui"),r.forEach(ms=>{ms.type==="virtual"&&ms.virtualConfig&&(He.set(ms.id,new Set),setTimeout(()=>{J.current||cs(ms.id,"virtual",ms.virtualConfig)},200))}))},100),Es=setInterval(()=>{V.forEach(ms=>{ms.readyState===WebSocket.OPEN&&ms.send(JSON.stringify({type:"ping"}))})},3e4);return()=>{J.current=!0,clearTimeout(Je),clearInterval(Es),Ke.forEach(ms=>{clearTimeout(ms)}),Ke.clear(),V.forEach(ms=>{ms.close()}),V.clear()}},[]);const Z=u.useCallback(()=>{const V=I.current.get(d);if(!f.trim()||!V||V.readyState!==WebSocket.OPEN)return;const Ke=h?.type==="virtual"&&h.virtualConfig?.userName||y,He=f.trim(),Je=Date.now()/1e3;V.send(JSON.stringify({type:"message",content:He,user_name:Ke}));const Es=fe.current.get(d)||new Set,ms=`user-${He}-${Math.floor(Je*1e3)}`;if(Es.add(ms),fe.current.set(d,Es),Es.size>100){const Cs=Es.values().next().value;Cs&&Es.delete(Cs)}const Ms={id:G("user"),type:"user",content:He,timestamp:Je,sender:{name:Ke,is_bot:!1}};A(d,Ms);const We={id:G("thinking"),type:"thinking",content:"",timestamp:Je+.001,sender:{name:h?.sessionInfo.bot_name||"้บฆ้บฆ",is_bot:!0}};A(d,We),p("")},[f,y,d,h,A]),Le=V=>{V.key==="Enter"&&!V.shiftKey&&(V.preventDefault(),Z())},ne=()=>{F(y),M(!0)},De=()=>{const V=S.trim()||"WebUI็”จๆˆท";w(V),OC(V),M(!1);const Ke=I.current.get(d);Ke?.readyState===WebSocket.OPEN&&Ke.send(JSON.stringify({type:"update_nickname",user_name:V}))},xe=()=>{F(""),M(!1)},Me=V=>new Date(V*1e3).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}),ds=()=>{const V=I.current.get(d);V&&(V.close(),I.current.delete(d)),cs(d,h?.type||"webui",h?.virtualConfig)},Ts=()=>{D({platform:"",personId:"",userId:"",userName:"",groupName:"",groupId:""}),ge(""),Re(),C(!0)},Ct=()=>{if(!pe.platform||!pe.personId){Ee({title:"้…็ฝฎไธๅฎŒๆ•ด",description:"่ฏท้€‰ๆ‹ฉๅนณๅฐๅ’Œ็”จๆˆท",variant:"destructive"});return}const V=`webui_virtual_group_${pe.platform}_${pe.userId}`,Ke=`virtual-${pe.platform}-${pe.userId}-${Date.now()}`,He=pe.userName||pe.userId,Je={id:Ke,type:"virtual",label:He,virtualConfig:{...pe,groupId:V},messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}};c(Es=>{const ms=[...Es,Je],Ms=ms.filter(We=>We.type==="virtual"&&We.virtualConfig).map(We=>({id:We.id,label:We.label,virtualConfig:We.virtualConfig,createdAt:Date.now()}));return nj(Ms),ms}),m(Ke),C(!1),fe.current.set(Ke,new Set),setTimeout(()=>{cs(Ke,"virtual",pe)},100),Ee({title:"่™šๆ‹Ÿ่บซไปฝๆ ‡็ญพ้กต",description:`ๅทฒๅˆ›ๅปบ ${He} ็š„ๅฏน่ฏ`})},ia=(V,Ke)=>{if(Ke?.stopPropagation(),V==="webui-default")return;const He=I.current.get(V);He&&(He.close(),I.current.delete(V));const Je=Y.current.get(V);Je&&(clearTimeout(Je),Y.current.delete(V)),fe.current.delete(V),c(Es=>{const ms=Es.filter(We=>We.id!==V),Ms=ms.filter(We=>We.type==="virtual"&&We.virtualConfig).map(We=>({id:We.id,label:We.label,virtualConfig:We.virtualConfig,createdAt:Date.now()}));return nj(Ms),ms}),d===V&&m("webui-default")},ut=V=>{m(V)},Bs=V=>{D(Ke=>({...Ke,personId:V.person_id,userId:V.user_id,userName:V.nickname||V.person_name}))};return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(Qs,{open:E,onOpenChange:C,children:e.jsxs(Hs,{className:"sm:max-w-[500px] max-h-[85vh] overflow-hidden flex flex-col",children:[e.jsxs(qs,{children:[e.jsxs(Vs,{className:"flex items-center gap-2",children:[e.jsx(Am,{className:"h-5 w-5"}),"ๆ–ฐๅปบ่™šๆ‹Ÿ่บซไปฝๅฏน่ฏ"]}),e.jsx(at,{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(Go,{className:"h-4 w-4"}),"้€‰ๆ‹ฉๅนณๅฐ"]}),e.jsxs(Pe,{value:pe.platform,onValueChange:V=>{D(Ke=>({...Ke,platform:V,personId:"",userId:"",userName:""})),X([])},children:[e.jsx(Ie,{disabled:L,children:e.jsx(Fe,{placeholder:L?"ๅŠ ่ฝฝไธญ...":"้€‰ๆ‹ฉๅนณๅฐ"})}),e.jsx(Be,{children:R.map(V=>e.jsxs(W,{value:V.platform,children:[V.platform," (",V.count," ไบบ)"]},V.platform))})]})]}),pe.platform&&e.jsxs("div",{className:"space-y-2 flex-1 overflow-hidden flex flex-col",children:[e.jsxs(T,{className:"flex items-center gap-2",children:[e.jsx(oc,{className:"h-4 w-4"}),"้€‰ๆ‹ฉ็”จๆˆท"]}),e.jsxs("div",{className:"relative",children:[e.jsx($t,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ae,{placeholder:"ๆœ็ดข็”จๆˆทๅ...",value:re,onChange:V=>ge(V.target.value),className:"pl-9"})]}),e.jsx(ts,{className:"h-[250px] border rounded-md",children:e.jsx("div",{className:"p-2",children:Ne?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Fs,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):O.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground",children:[e.jsx(oc,{className:"h-8 w-8 mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"ๆฒกๆœ‰ๆ‰พๅˆฐ็”จๆˆท"})]}):e.jsx("div",{className:"space-y-1",children:O.map(V=>e.jsxs("button",{onClick:()=>Bs(V),className:P("w-full flex items-center gap-3 p-2 rounded-md text-left transition-colors",pe.personId===V.person_id?"bg-primary text-primary-foreground":"hover:bg-muted"),children:[e.jsx(ec,{className:"h-8 w-8 shrink-0",children:e.jsx(sc,{className:P("text-xs",pe.personId===V.person_id?"bg-primary-foreground/20":"bg-muted"),children:(V.nickname||V.person_name||"?").charAt(0)})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-medium truncate",children:V.nickname||V.person_name}),e.jsxs("div",{className:P("text-xs truncate",pe.personId===V.person_id?"text-primary-foreground/70":"text-muted-foreground"),children:["ID: ",V.user_id,V.is_known&&" ยท ๅทฒ่ฎค่ฏ†"]})]})]},V.person_id))})})})]}),pe.personId&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"่™šๆ‹Ÿ็พคๅ๏ผˆๅฏ้€‰๏ผ‰"}),e.jsx(ae,{placeholder:"WebUI่™šๆ‹Ÿ็พค่Š",value:pe.groupName,onChange:V=>D(Ke=>({...Ke,groupName:V.target.value}))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"้บฆ้บฆไผš่ฎคไธบ่ฟ™ๆ˜ฏไธ€ไธชๅไธบๆญคๅ็งฐ็š„็พค่Š"})]})]}),e.jsxs(gt,{className:"gap-2 sm:gap-0",children:[e.jsx(_,{variant:"outline",onClick:()=>C(!1),children:"ๅ–ๆถˆ"}),e.jsx(_,{onClick:Ct,disabled:!pe.platform||!pe.personId,children:"ๅˆ›ๅปบๅฏน่ฏ"})]})]})}),e.jsx("div",{className:"shrink-0 border-b bg-muted/30",children:e.jsx("div",{className:"max-w-4xl mx-auto px-2 sm:px-4",children:e.jsxs("div",{className:"flex items-center gap-1 overflow-x-auto py-1.5 scrollbar-thin",children:[r.map(V=>e.jsxs("div",{className:P("flex items-center gap-1.5 px-3 py-1.5 rounded-md text-sm whitespace-nowrap transition-colors cursor-pointer","hover:bg-muted",d===V.id?"bg-background shadow-sm border":"text-muted-foreground"),onClick:()=>ut(V.id),children:[V.type==="webui"?e.jsx(Ba,{className:"h-3.5 w-3.5"}):e.jsx(Am,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"max-w-[100px] truncate",children:V.label}),e.jsx("span",{className:P("w-1.5 h-1.5 rounded-full",V.isConnected?"bg-green-500":"bg-muted-foreground/50")}),V.id!=="webui-default"&&e.jsx("span",{onClick:Ke=>ia(V.id,Ke),className:"ml-0.5 p-0.5 rounded hover:bg-muted-foreground/20 cursor-pointer",role:"button",tabIndex:0,onKeyDown:Ke=>{(Ke.key==="Enter"||Ke.key===" ")&&(Ke.preventDefault(),ia(V.id,Ke))},children:e.jsx(Sa,{className:"h-3 w-3"})})]},V.id)),e.jsx("button",{onClick:Ts,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(Xs,{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(ec,{className:"h-8 w-8 sm:h-10 sm:w-10 shrink-0",children:e.jsx(sc,{className:"bg-primary/10 text-primary",children:e.jsx(Yn,{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(Y_,{className:"h-3 w-3 text-green-500"}),e.jsx("span",{className:"text-green-600 dark:text-green-400",children:"ๅทฒ่ฟžๆŽฅ"})]}):g?e.jsxs(e.Fragment,{children:[e.jsx(Fs,{className:"h-3 w-3 animate-spin"}),e.jsx("span",{children:"่ฟžๆŽฅไธญ..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(J_,{className:"h-3 w-3 text-red-500"}),e.jsx("span",{className:"text-red-600 dark:text-red-400",children:"ๆœช่ฟžๆŽฅ"})]})})]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[j&&e.jsx(Fs,{className:"h-4 w-4 animate-spin text-muted-foreground"}),e.jsx(_,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:ds,disabled:g,title:"้‡ๆ–ฐ่ฟžๆŽฅ",children:e.jsx(dt,{className:P("h-4 w-4",g&&"animate-spin")})})]})]}),e.jsx("div",{className:"hidden sm:flex items-center gap-2 mt-2 text-sm text-muted-foreground",children:h?.type==="virtual"&&h.virtualConfig?e.jsxs(e.Fragment,{children:[e.jsx(Am,{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(Fl,{className:"h-3 w-3"}),e.jsx("span",{children:"ๅฝ“ๅ‰่บซไปฝ๏ผš"}),z?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae,{value:S,onChange:V=>F(V.target.value),onKeyDown:V=>{V.key==="Enter"&&De(),V.key==="Escape"&&xe()},className:"h-7 w-32",placeholder:"่พ“ๅ…ฅๆ˜ต็งฐ",autoFocus:!0}),e.jsx(_,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:De,children:"ไฟๅญ˜"}),e.jsx(_,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:xe,children:"ๅ–ๆถˆ"})]}):e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"font-medium text-foreground",children:y}),e.jsx(_,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:ne,title:"ไฟฎๆ”นๆ˜ต็งฐ",children:e.jsx(X_,{className:"h-3 w-3"})})]})]})})]})}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(ts,{className:"h-full",children:e.jsxs("div",{className:"p-3 sm:p-4 max-w-4xl mx-auto space-y-3 sm:space-y-4",children:[h?.messages.length===0&&!j&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[e.jsx(Yn,{className:"h-12 w-12 mb-4 opacity-50"}),e.jsxs("p",{className:"text-sm",children:["ๅผ€ๅง‹ไธŽ ",h?.sessionInfo.bot_name||"้บฆ้บฆ"," ๅฏน่ฏๅง๏ผ"]})]}),h?.messages.map(V=>e.jsxs("div",{className:P("flex gap-2 sm:gap-3",V.type==="user"&&"flex-row-reverse",V.type==="system"&&"justify-center",V.type==="error"&&"justify-center"),children:[V.type==="system"&&e.jsx("div",{className:"text-xs text-muted-foreground bg-muted/50 px-3 py-1 rounded-full max-w-[90%]",children:V.content}),V.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:V.content}),V.type==="thinking"&&e.jsxs(e.Fragment,{children:[e.jsx(ec,{className:"h-7 w-7 sm:h-8 sm:w-8 shrink-0",children:e.jsx(sc,{className:"bg-primary/10 text-primary",children:e.jsx(Yn,{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:V.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:"ๆ€่€ƒไธญ..."})]})})]})]}),(V.type==="user"||V.type==="bot")&&e.jsxs(e.Fragment,{children:[e.jsx(ec,{className:"h-7 w-7 sm:h-8 sm:w-8 shrink-0",children:e.jsx(sc,{className:P("text-xs",V.type==="bot"?"bg-primary/10 text-primary":"bg-secondary text-secondary-foreground"),children:V.type==="bot"?e.jsx(Yn,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"}):e.jsx(Fl,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"})})}),e.jsxs("div",{className:P("flex flex-col gap-1 max-w-[75%] sm:max-w-[70%]",V.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:V.sender?.name||(V.type==="bot"?h?.sessionInfo.bot_name:y)}),e.jsx("span",{children:Me(V.timestamp)})]}),e.jsx("div",{className:P("rounded-2xl px-3 py-2 text-sm break-words",V.type==="bot"?"bg-muted rounded-tl-sm":"bg-primary text-primary-foreground rounded-tr-sm"),children:e.jsx($C,{message:V,isBot:V.type==="bot"})})]})]})]},V.id)),e.jsx("div",{ref:ue})]})})}),e.jsx("div",{className:"shrink-0 border-t bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:e.jsx("div",{className:"p-3 sm:p-4 max-w-4xl mx-auto",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{value:f,onChange:V=>p(V.target.value),onKeyDown:Le,placeholder:h?.isConnected?"่พ“ๅ…ฅๆถˆๆฏ...":"็ญ‰ๅพ…่ฟžๆŽฅ...",disabled:!h?.isConnected,className:"flex-1 h-10 sm:h-10"}),e.jsx(_,{onClick:Z,disabled:!h?.isConnected||!f.trim(),size:"icon",className:"h-10 w-10 shrink-0",children:e.jsx(Z_,{className:"h-4 w-4"})})]})})})]})}var zx="Radio",[BC,_N]=ld(zx),[PC,FC]=BC(zx),SN=u.forwardRef((a,l)=>{const{__scopeRadio:r,name:c,checked:d=!1,required:m,disabled:h,value:f="on",onCheck:p,form:g,...N}=a,[j,b]=u.useState(null),y=nd(l,M=>b(M)),w=u.useRef(!1),z=j?g||!!j.closest("form"):!0;return e.jsxs(PC,{scope:r,checked:d,disabled:h,children:[e.jsx(ar.button,{type:"button",role:"radio","aria-checked":d,"data-state":EN(d),"data-disabled":h?"":void 0,disabled:h,value:f,...N,ref:y,onClick:_n(a.onClick,M=>{d||p?.(),z&&(w.current=M.isPropagationStopped(),w.current||M.stopPropagation())})}),z&&e.jsx(TN,{control:j,bubbles:!w.current,name:c,value:f,checked:d,required:m,disabled:h,form:g,style:{transform:"translateX(-100%)"}})]})});SN.displayName=zx;var kN="RadioIndicator",CN=u.forwardRef((a,l)=>{const{__scopeRadio:r,forceMount:c,...d}=a,m=FC(kN,r);return e.jsx(b_,{present:c||m.checked,children:e.jsx(ar.span,{"data-state":EN(m.checked),"data-disabled":m.disabled?"":void 0,...d,ref:l})})});CN.displayName=kN;var HC="RadioBubbleInput",TN=u.forwardRef(({__scopeRadio:a,control:l,checked:r,bubbles:c=!0,...d},m)=>{const h=u.useRef(null),f=nd(h,m),p=y_(r),g=w_(l);return u.useEffect(()=>{const N=h.current;if(!N)return;const j=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(j,"checked").set;if(p!==r&&y){const w=new Event("click",{bubbles:c});y.call(N,r),N.dispatchEvent(w)}},[p,r,c]),e.jsx(ar.input,{type:"radio","aria-hidden":!0,defaultChecked:r,...d,tabIndex:-1,ref:f,style:{...d.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});TN.displayName=HC;function EN(a){return a?"checked":"unchecked"}var qC=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],gd="RadioGroup",[VC]=ld(gd,[Dj,_N]),MN=Dj(),AN=_N(),[GC,KC]=VC(gd),zN=u.forwardRef((a,l)=>{const{__scopeRadioGroup:r,name:c,defaultValue:d,value:m,required:h=!1,disabled:f=!1,orientation:p,dir:g,loop:N=!0,onValueChange:j,...b}=a,y=MN(r),w=Wj(g),[z,M]=ad({prop:m,defaultProp:d??null,onChange:j,caller:gd});return e.jsx(GC,{scope:r,name:c,required:h,disabled:f,value:z,onValueChange:M,children:e.jsx(Rw,{asChild:!0,...y,orientation:p,dir:w,loop:N,children:e.jsx(ar.div,{role:"radiogroup","aria-required":h,"aria-orientation":p,"data-disabled":f?"":void 0,dir:w,...b,ref:l})})})});zN.displayName=gd;var RN="RadioGroupItem",DN=u.forwardRef((a,l)=>{const{__scopeRadioGroup:r,disabled:c,...d}=a,m=KC(RN,r),h=m.disabled||c,f=MN(r),p=AN(r),g=u.useRef(null),N=nd(l,g),j=m.value===d.value,b=u.useRef(!1);return u.useEffect(()=>{const y=z=>{qC.includes(z.key)&&(b.current=!0)},w=()=>b.current=!1;return document.addEventListener("keydown",y),document.addEventListener("keyup",w),()=>{document.removeEventListener("keydown",y),document.removeEventListener("keyup",w)}},[]),e.jsx(Dw,{asChild:!0,...f,focusable:!h,active:j,children:e.jsx(SN,{disabled:h,required:m.required,checked:j,...p,...d,name:m.name,ref:N,onCheck:()=>m.onValueChange(d.value),onKeyDown:_n(y=>{y.key==="Enter"&&y.preventDefault()}),onFocus:_n(d.onFocus,()=>{b.current&&g.current?.click()})})})});DN.displayName=RN;var QC="RadioGroupIndicator",ON=u.forwardRef((a,l)=>{const{__scopeRadioGroup:r,...c}=a,d=AN(r);return e.jsx(CN,{...d,...c,ref:l})});ON.displayName=QC;var LN=zN,UN=DN,YC=ON;const Rx=u.forwardRef(({className:a,...l},r)=>e.jsx(LN,{className:P("grid gap-2",a),...l,ref:r}));Rx.displayName=LN.displayName;const Wo=u.forwardRef(({className:a,...l},r)=>e.jsx(UN,{ref:r,className:P("aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",a),...l,children:e.jsx(YC,{className:"flex items-center justify-center",children:e.jsx(Vo,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Wo.displayName=UN.displayName;function JC({question:a,value:l,onChange:r,error:c,disabled:d=!1}){const[m,h]=u.useState(null),f=d||a.readOnly,p=()=>{switch(a.type){case"single":return e.jsx(Rx,{value:l||"",onValueChange:r,disabled:f,className:"space-y-2",children:a.options?.map(g=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Wo,{value:g.value,id:`${a.id}-${g.id}`}),e.jsx(T,{htmlFor:`${a.id}-${g.id}`,className:"cursor-pointer font-normal",children:g.label})]},g.id))});case"multiple":{const g=l||[];return e.jsxs("div",{className:"space-y-2",children:[a.options?.map(N=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(tt,{id:`${a.id}-${N.id}`,checked:g.includes(N.value),disabled:f||a.maxSelections!==void 0&&g.length>=a.maxSelections&&!g.includes(N.value),onCheckedChange:j=>{r(j?[...g,N.value]:g.filter(b=>b!==N.value))}}),e.jsx(T,{htmlFor:`${a.id}-${N.id}`,className:"cursor-pointer font-normal",children:N.label})]},N.id)),a.maxSelections&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["ๆœ€ๅคš้€‰ๆ‹ฉ ",a.maxSelections," ้กน"]})]})}case"text":return e.jsx(ae,{value:l||"",onChange:g=>r(g.target.value),placeholder:a.placeholder||"่ฏท่พ“ๅ…ฅ...",disabled:f,readOnly:a.readOnly,maxLength:a.maxLength,className:P(a.readOnly&&"bg-muted cursor-not-allowed")});case"textarea":return e.jsxs("div",{className:"space-y-1",children:[e.jsx(pt,{value:l||"",onChange:g=>r(g.target.value),placeholder:a.placeholder||"่ฏท่พ“ๅ…ฅ...",disabled:f,readOnly:a.readOnly,maxLength:a.maxLength,rows:4,className:P(a.readOnly&&"bg-muted cursor-not-allowed")}),a.maxLength&&e.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[(l||"").length," / ",a.maxLength]})]});case"rating":{const g=l||0,N=m!==null?m:g;return e.jsxs("div",{className:"flex items-center gap-1",children:[[1,2,3,4,5].map(j=>e.jsx("button",{type:"button",disabled:f,className:P("p-1 transition-colors focus:outline-none focus:ring-2 focus:ring-ring rounded",f&&"cursor-not-allowed opacity-50"),onMouseEnter:()=>!f&&h(j),onMouseLeave:()=>h(null),onClick:()=>!f&&r(j),children:e.jsx(vn,{className:P("h-6 w-6 transition-colors",j<=N?"fill-yellow-400 text-yellow-400":"text-muted-foreground")})},j)),g>0&&e.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:[g," / 5"]})]})}case"scale":{const g=a.min??1,N=a.max??10,j=a.step??1,b=l??g;return e.jsxs("div",{className:"space-y-4",children:[e.jsx(el,{value:[b],onValueChange:([y])=>r(y),min:g,max:N,step:j,disabled:f}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:a.minLabel||g}),e.jsx("span",{className:"font-medium text-foreground",children:b}),e.jsx("span",{children:a.maxLabel||N})]})]})}case"dropdown":return e.jsxs(Pe,{value:l||"",onValueChange:r,disabled:f,children:[e.jsx(Ie,{children:e.jsx(Fe,{placeholder:a.placeholder||"่ฏท้€‰ๆ‹ฉ..."})}),e.jsx(Be,{children:a.options?.map(g=>e.jsx(W,{value:g.value,children:g.label},g.id))})]});default:return e.jsx("div",{className:"text-muted-foreground",children:"ไธๆ”ฏๆŒ็š„้—ฎ้ข˜็ฑปๅž‹"})}};return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(T,{className:"text-base font-medium",children:[a.title,a.required&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),a.description&&e.jsx("p",{className:"text-sm text-muted-foreground",children:a.description})]}),p(),c&&e.jsx("p",{className:"text-sm text-destructive",children:c})]})}const $N="https://maibot-plugin-stats.maibot-webui.workers.dev";function IN(){const a="maibot_user_id";let l=localStorage.getItem(a);if(!l){const r=Math.random().toString(36).substring(2,10),c=Date.now().toString(36),d=Math.random().toString(36).substring(2,10);l=`fp_${r}_${c}_${d}`,localStorage.setItem(a,l)}return l}async function XC(a,l,r,c){try{const d=c?.userId||IN(),m={surveyId:a,surveyVersion:l,userId:d,answers:r,submittedAt:new Date().toISOString(),allowMultiple:c?.allowMultiple,metadata:{userAgent:navigator.userAgent,language:navigator.language}},h=await fetch(`${$N}/survey/submit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(m)}),f=await h.json();return h.status===429?{success:!1,error:"ๆไบค่ฟ‡ไบŽ้ข‘็น๏ผŒ่ฏท็จๅŽๅ†่ฏ•"}:h.status===409?{success:!1,error:f.error||"ไฝ ๅทฒ็ปๆไบค่ฟ‡่ฟ™ไปฝ้—ฎๅทไบ†"}:h.ok?{success:!0,submissionId:f.submissionId,message:f.message}:{success:!1,error:f.error||"ๆไบคๅคฑ่ดฅ"}}catch(d){return console.error("Error submitting survey:",d),{success:!1,error:"็ฝ‘็ปœ้”™่ฏฏ"}}}async function ZC(a,l){try{const r=l||IN(),c=new URLSearchParams({user_id:r,survey_id:a}),d=await fetch(`${$N}/survey/check?${c}`);return d.ok?{success:!0,hasSubmitted:(await d.json()).hasSubmitted}:{success:!1,error:(await d.json()).error||"ๆฃ€ๆŸฅๅคฑ่ดฅ"}}catch(r){return console.error("Error checking submission:",r),{success:!1,error:"็ฝ‘็ปœ้”™่ฏฏ"}}}function BN({config:a,initialAnswers:l,onSubmitSuccess:r,onSubmitError:c,showProgress:d=!0,paginateQuestions:m=!1,className:h}){const f=u.useCallback(()=>!l||l.length===0?{}:l.reduce((I,ue)=>(I[ue.questionId]=ue.value,I),{}),[l]),[p,g]=u.useState(()=>f()),[N,j]=u.useState({}),[b,y]=u.useState(0),[w,z]=u.useState(!1),[M,S]=u.useState(!1),[F,E]=u.useState(null),[C,R]=u.useState(null),[H,O]=u.useState(!1),[X,L]=u.useState(!0);u.useEffect(()=>{l&&l.length>0&&g(I=>({...I,...f()}))},[l,f]),u.useEffect(()=>{(async()=>{if(!a.settings?.allowMultiple){const ue=await ZC(a.id);ue.success&&ue.hasSubmitted&&O(!0)}L(!1)})()},[a.id,a.settings?.allowMultiple]);const me=u.useCallback(()=>{const I=new Date;return!(a.settings?.startTime&&new Date(a.settings.startTime)>I||a.settings?.endTime&&new Date(a.settings.endTime){const ue=p[I.id];return ue==null?!1:Array.isArray(ue)?ue.length>0:typeof ue=="string"?ue.trim()!=="":!0}).length,je=Ne/a.questions.length*100,re=u.useCallback((I,ue)=>{g(Y=>({...Y,[I]:ue})),j(Y=>{const we={...Y};return delete we[I],we})},[]),ge=u.useCallback(()=>{const I={};for(const ue of a.questions){if(ue.required){const Y=p[ue.id];if(Y==null){I[ue.id]="ๆญค้ข˜ไธบๅฟ…ๅกซ้กน";continue}if(Array.isArray(Y)&&Y.length===0){I[ue.id]="่ฏท่‡ณๅฐ‘้€‰ๆ‹ฉไธ€้กน";continue}if(typeof Y=="string"&&Y.trim()===""){I[ue.id]="ๆญค้ข˜ไธบๅฟ…ๅกซ้กน";continue}}ue.minLength&&typeof p[ue.id]=="string"&&p[ue.id].length{if(!ge()){if(m){const I=a.questions.findIndex(ue=>N[ue.id]);I>=0&&y(I)}return}z(!0),E(null);try{const I=a.questions.filter(Y=>p[Y.id]!==void 0).map(Y=>({questionId:Y.id,value:p[Y.id]})),ue=await XC(a.id,a.version,I,{allowMultiple:a.settings?.allowMultiple});if(ue.success&&ue.submissionId)S(!0),R(ue.submissionId),r?.(ue.submissionId);else{const Y=ue.error||"ๆไบคๅคฑ่ดฅ";E(Y),c?.(Y)}}catch(I){const ue=I instanceof Error?I.message:"ๆไบคๅคฑ่ดฅ";E(ue),c?.(ue)}finally{z(!1)}},[ge,m,a,p,N,r,c]),D=u.useCallback(I=>{I>=0&&Ie.jsxs("div",{className:P("p-4 rounded-lg border bg-card",N[I.id]?"border-destructive bg-destructive/5":"border-border"),children:[m&&e.jsxs("div",{className:"text-xs text-muted-foreground mb-2",children:["้—ฎ้ข˜ ",b+1," / ",a.questions.length]}),!m&&e.jsxs("div",{className:"text-xs text-muted-foreground mb-2",children:[ue+1,"."]}),e.jsx(JC,{question:I,value:p[I.id],onChange:Y=>re(I.id,Y),error:N[I.id],disabled:w})]},I.id)),F&&e.jsxs(ht,{variant:"destructive",children:[e.jsx(Ut,{className:"h-4 w-4"}),e.jsx(ft,{children:F})]}),e.jsx("div",{className:"flex justify-between items-center py-4",children:m?e.jsxs(e.Fragment,{children:[e.jsxs(_,{variant:"outline",onClick:()=>D(b-1),disabled:b===0||w,children:[e.jsx(Pa,{className:"h-4 w-4 mr-1"}),"ไธŠไธ€้ข˜"]}),b===a.questions.length-1?e.jsxs(_,{onClick:pe,disabled:w,children:[w&&e.jsx(Fs,{className:"h-4 w-4 mr-2 animate-spin"}),"ๆไบค้—ฎๅท"]}):e.jsxs(_,{onClick:()=>D(b+1),disabled:w,children:["ไธ‹ไธ€้ข˜",e.jsx(ra,{className:"h-4 w-4 ml-1"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:Object.keys(N).length>0&&e.jsxs("span",{className:"text-destructive",children:["่ฟ˜ๆœ‰ ",Object.keys(N).length," ไธชๅฟ…ๅกซ้กนๆœชๅฎŒๆˆ"]})}),e.jsxs(_,{onClick:pe,disabled:w,size:"lg",children:[w&&e.jsx(Fs,{className:"h-4 w-4 mr-2 animate-spin"}),"ๆไบค้—ฎๅท"]})]})})]})})]})}const WC={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:"ๆ„Ÿ่ฐขไฝ ็š„ๅ้ฆˆ๏ผไฝ ็š„ๆ„่งๅฏนๆˆ‘ไปฌ้žๅธธ้‡่ฆ๏ผŒๆˆ‘ไปฌไผš่ฎค็œŸ่€ƒ่™‘ๆฏไธ€ๆกๅปบ่ฎฎใ€‚"}},e3={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 s3(){const[a,l]=u.useState(!0),r=u.useMemo(()=>JSON.parse(JSON.stringify(WC)),[]);u.useEffect(()=>{l(!1)},[]);const c=u.useMemo(()=>[{questionId:"webui_version",value:`v${ud}`}],[]),d=u.useCallback(h=>{console.log("WebUI Survey submitted:",h)},[]),m=u.useCallback(h=>{console.error("WebUI Survey submission error:",h)},[]);return a?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx(Fs,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r?e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsxs("div",{className:"mb-4 sm:mb-6 shrink-0",children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(pv,{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(BN,{config:r,initialAnswers:c,showProgress:!0,paginateQuestions:!1,onSubmitSuccess:d,onSubmitError:m})})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-4",children:[e.jsxs(ht,{variant:"destructive",className:"max-w-md",children:[e.jsx(Ut,{className:"h-4 w-4"}),e.jsx(ft,{children:"ๆ— ๆณ•ๅŠ ่ฝฝ้—ฎๅท้…็ฝฎ"})]}),e.jsx(_,{variant:"outline",onClick:()=>window.location.reload(),children:"้‡่ฏ•"})]})}function t3(){const[a,l]=u.useState(null),[r,c]=u.useState(!0),[d,m]=u.useState("ๆœช็Ÿฅ็‰ˆๆœฌ");u.useEffect(()=>{(async()=>{try{const j=await V1();m(j.version||"ๆœช็Ÿฅ็‰ˆๆœฌ")}catch(j){console.error("Failed to get MaiBot version:",j),m("่Žทๅ–ๅคฑ่ดฅ")}const N=JSON.parse(JSON.stringify(e3));l(N),c(!1)})()},[]);const h=u.useMemo(()=>[{questionId:"maibot_version",value:d}],[d]),f=u.useCallback(g=>{console.log("MaiBot Survey submitted:",g)},[]),p=u.useCallback(g=>{console.error("MaiBot Survey submission error:",g)},[]);return r?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx(Fs,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):a?e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsxs("div",{className:"mb-4 sm:mb-6 shrink-0",children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(pv,{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(BN,{config:a,initialAnswers:h,showProgress:!0,paginateQuestions:!1,onSubmitSuccess:f,onSubmitError:p})})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-4",children:[e.jsxs(ht,{variant:"destructive",className:"max-w-md",children:[e.jsx(Ut,{className:"h-4 w-4"}),e.jsx(ft,{children:"ๆ— ๆณ•ๅŠ ่ฝฝ้—ฎๅท้…็ฝฎ"})]}),e.jsx(_,{variant:"outline",onClick:()=>window.location.reload(),children:"้‡่ฏ•"})]})}async function a3(a=2025){const l=await ke(`/api/webui/annual-report/full?year=${a}`);if(!l.ok){const r=await l.json();throw new Error(r.detail||"่Žทๅ–ๅนดๅบฆๆŠฅๅ‘Šๅคฑ่ดฅ")}return l.json()}function l3(a,l){if(a.match(/^[a-z]+:\/\//i))return a;if(a.match(/^\/\//))return window.location.protocol+a;if(a.match(/^[a-z]+:/i))return a;const r=document.implementation.createHTMLDocument(),c=r.createElement("base"),d=r.createElement("a");return r.head.appendChild(c),r.body.appendChild(d),l&&(c.href=l),d.href=a,d.href}const n3=(()=>{let a=0;const l=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(a+=1,`u${l()}${a}`)})();function wn(a){const l=[];for(let r=0,c=a.length;rOa||a.height>Oa)&&(a.width>Oa&&a.height>Oa?a.width>a.height?(a.height*=Oa/a.width,a.width=Oa):(a.width*=Oa/a.height,a.height=Oa):a.width>Oa?(a.height*=Oa/a.width,a.width=Oa):(a.width*=Oa/a.height,a.height=Oa))}function sd(a){return new Promise((l,r)=>{const c=new Image;c.onload=()=>{c.decode().then(()=>{requestAnimationFrame(()=>l(c))})},c.onerror=r,c.crossOrigin="anonymous",c.decoding="async",c.src=a})}async function d3(a){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(a)).then(encodeURIComponent).then(l=>`data:image/svg+xml;charset=utf-8,${l}`)}async function u3(a,l,r){const c="http://www.w3.org/2000/svg",d=document.createElementNS(c,"svg"),m=document.createElementNS(c,"foreignObject");return d.setAttribute("width",`${l}`),d.setAttribute("height",`${r}`),d.setAttribute("viewBox",`0 0 ${l} ${r}`),m.setAttribute("width","100%"),m.setAttribute("height","100%"),m.setAttribute("x","0"),m.setAttribute("y","0"),m.setAttribute("externalResourcesRequired","true"),d.appendChild(m),m.appendChild(a),d3(d)}const _a=(a,l)=>{if(a instanceof l)return!0;const r=Object.getPrototypeOf(a);return r===null?!1:r.constructor.name===l.name||_a(r,l)};function m3(a){const l=a.getPropertyValue("content");return`${a.cssText} content: '${l.replace(/'|"/g,"")}';`}function x3(a,l){return PN(l).map(r=>{const c=a.getPropertyValue(r),d=a.getPropertyPriority(r);return`${r}: ${c}${d?" !important":""};`}).join(" ")}function h3(a,l,r,c){const d=`.${a}:${l}`,m=r.cssText?m3(r):x3(r,c);return document.createTextNode(`${d}{${m}}`)}function rj(a,l,r,c){const d=window.getComputedStyle(a,r),m=d.getPropertyValue("content");if(m===""||m==="none")return;const h=n3();try{l.className=`${l.className} ${h}`}catch{return}const f=document.createElement("style");f.appendChild(h3(h,r,d,c)),l.appendChild(f)}function f3(a,l,r){rj(a,l,":before",r),rj(a,l,":after",r)}const ij="application/font-woff",cj="image/jpeg",p3={woff:ij,woff2:ij,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:cj,jpeg:cj,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function g3(a){const l=/\.([^./]*?)$/g.exec(a);return l?l[1]:""}function Dx(a){const l=g3(a).toLowerCase();return p3[l]||""}function j3(a){return a.split(/,/)[1]}function ax(a){return a.search(/^(data:)/)!==-1}function v3(a,l){return`data:${l};base64,${a}`}async function HN(a,l,r){const c=await fetch(a,l);if(c.status===404)throw new Error(`Resource "${c.url}" not found`);const d=await c.blob();return new Promise((m,h)=>{const f=new FileReader;f.onerror=h,f.onloadend=()=>{try{m(r({res:c,result:f.result}))}catch(p){h(p)}},f.readAsDataURL(d)})}const Km={};function N3(a,l,r){let c=a.replace(/\?.*/,"");return r&&(c=a),/ttf|otf|eot|woff2?/i.test(c)&&(c=c.replace(/.*\//,"")),l?`[${l}]${c}`:c}async function Ox(a,l,r){const c=N3(a,l,r.includeQueryParams);if(Km[c]!=null)return Km[c];r.cacheBust&&(a+=(/\?/.test(a)?"&":"?")+new Date().getTime());let d;try{const m=await HN(a,r.fetchRequestInit,({res:h,result:f})=>(l||(l=h.headers.get("Content-Type")||""),j3(f)));d=v3(m,l)}catch(m){d=r.imagePlaceholder||"";let h=`Failed to fetch resource: ${a}`;m&&(h=typeof m=="string"?m:m.message),h&&console.warn(h)}return Km[c]=d,d}async function b3(a){const l=a.toDataURL();return l==="data:,"?a.cloneNode(!1):sd(l)}async function y3(a,l){if(a.currentSrc){const m=document.createElement("canvas"),h=m.getContext("2d");m.width=a.clientWidth,m.height=a.clientHeight,h?.drawImage(a,0,0,m.width,m.height);const f=m.toDataURL();return sd(f)}const r=a.poster,c=Dx(r),d=await Ox(r,c,l);return sd(d)}async function w3(a,l){var r;try{if(!((r=a?.contentDocument)===null||r===void 0)&&r.body)return await jd(a.contentDocument.body,l,!0)}catch{}return a.cloneNode(!1)}async function _3(a,l){return _a(a,HTMLCanvasElement)?b3(a):_a(a,HTMLVideoElement)?y3(a,l):_a(a,HTMLIFrameElement)?w3(a,l):a.cloneNode(qN(a))}const S3=a=>a.tagName!=null&&a.tagName.toUpperCase()==="SLOT",qN=a=>a.tagName!=null&&a.tagName.toUpperCase()==="SVG";async function k3(a,l,r){var c,d;if(qN(l))return l;let m=[];return S3(a)&&a.assignedNodes?m=wn(a.assignedNodes()):_a(a,HTMLIFrameElement)&&(!((c=a.contentDocument)===null||c===void 0)&&c.body)?m=wn(a.contentDocument.body.childNodes):m=wn(((d=a.shadowRoot)!==null&&d!==void 0?d:a).childNodes),m.length===0||_a(a,HTMLVideoElement)||await m.reduce((h,f)=>h.then(()=>jd(f,r)).then(p=>{p&&l.appendChild(p)}),Promise.resolve()),l}function C3(a,l,r){const c=l.style;if(!c)return;const d=window.getComputedStyle(a);d.cssText?(c.cssText=d.cssText,c.transformOrigin=d.transformOrigin):PN(r).forEach(m=>{let h=d.getPropertyValue(m);m==="font-size"&&h.endsWith("px")&&(h=`${Math.floor(parseFloat(h.substring(0,h.length-2)))-.1}px`),_a(a,HTMLIFrameElement)&&m==="display"&&h==="inline"&&(h="block"),m==="d"&&l.getAttribute("d")&&(h=`path(${l.getAttribute("d")})`),c.setProperty(m,h,d.getPropertyPriority(m))})}function T3(a,l){_a(a,HTMLTextAreaElement)&&(l.innerHTML=a.value),_a(a,HTMLInputElement)&&l.setAttribute("value",a.value)}function E3(a,l){if(_a(a,HTMLSelectElement)){const c=Array.from(l.children).find(d=>a.value===d.getAttribute("value"));c&&c.setAttribute("selected","")}}function M3(a,l,r){return _a(l,Element)&&(C3(a,l,r),f3(a,l,r),T3(a,l),E3(a,l)),l}async function A3(a,l){const r=a.querySelectorAll?a.querySelectorAll("use"):[];if(r.length===0)return a;const c={};for(let m=0;m_3(c,l)).then(c=>k3(a,c,l)).then(c=>M3(a,c,l)).then(c=>A3(c,l))}const VN=/url\((['"]?)([^'"]+?)\1\)/g,z3=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,R3=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function D3(a){const l=a.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${l})(['"]?\\))`,"g")}function O3(a){const l=[];return a.replace(VN,(r,c,d)=>(l.push(d),r)),l.filter(r=>!ax(r))}async function L3(a,l,r,c,d){try{const m=r?l3(l,r):l,h=Dx(l);let f;return d||(f=await Ox(m,h,c)),a.replace(D3(l),`$1${f}$3`)}catch{}return a}function U3(a,{preferredFontFormat:l}){return l?a.replace(R3,r=>{for(;;){const[c,,d]=z3.exec(r)||[];if(!d)return"";if(d===l)return`src: ${c};`}}):a}function GN(a){return a.search(VN)!==-1}async function KN(a,l,r){if(!GN(a))return a;const c=U3(a,r);return O3(c).reduce((m,h)=>m.then(f=>L3(f,h,l,r)),Promise.resolve(c))}async function Vr(a,l,r){var c;const d=(c=l.style)===null||c===void 0?void 0:c.getPropertyValue(a);if(d){const m=await KN(d,null,r);return l.style.setProperty(a,m,l.style.getPropertyPriority(a)),!0}return!1}async function $3(a,l){await Vr("background",a,l)||await Vr("background-image",a,l),await Vr("mask",a,l)||await Vr("-webkit-mask",a,l)||await Vr("mask-image",a,l)||await Vr("-webkit-mask-image",a,l)}async function I3(a,l){const r=_a(a,HTMLImageElement);if(!(r&&!ax(a.src))&&!(_a(a,SVGImageElement)&&!ax(a.href.baseVal)))return;const c=r?a.src:a.href.baseVal,d=await Ox(c,Dx(c),l);await new Promise((m,h)=>{a.onload=m,a.onerror=l.onImageErrorHandler?(...p)=>{try{m(l.onImageErrorHandler(...p))}catch(g){h(g)}}:h;const f=a;f.decode&&(f.decode=m),f.loading==="lazy"&&(f.loading="eager"),r?(a.srcset="",a.src=d):a.href.baseVal=d})}async function B3(a,l){const c=wn(a.childNodes).map(d=>QN(d,l));await Promise.all(c).then(()=>a)}async function QN(a,l){_a(a,Element)&&(await $3(a,l),await I3(a,l),await B3(a,l))}function P3(a,l){const{style:r}=a;l.backgroundColor&&(r.backgroundColor=l.backgroundColor),l.width&&(r.width=`${l.width}px`),l.height&&(r.height=`${l.height}px`);const c=l.style;return c!=null&&Object.keys(c).forEach(d=>{r[d]=c[d]}),a}const oj={};async function dj(a){let l=oj[a];if(l!=null)return l;const c=await(await fetch(a)).text();return l={url:a,cssText:c},oj[a]=l,l}async function uj(a,l){let r=a.cssText;const c=/url\(["']?([^"')]+)["']?\)/g,m=(r.match(/url\([^)]+\)/g)||[]).map(async h=>{let f=h.replace(c,"$1");return f.startsWith("https://")||(f=new URL(f,a.url).href),HN(f,l.fetchRequestInit,({result:p})=>(r=r.replace(h,`url(${p})`),[h,p]))});return Promise.all(m).then(()=>r)}function mj(a){if(a==null)return[];const l=[],r=/(\/\*[\s\S]*?\*\/)/gi;let c=a.replace(r,"");const d=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const p=d.exec(c);if(p===null)break;l.push(p[0])}c=c.replace(d,"");const m=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,h="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",f=new RegExp(h,"gi");for(;;){let p=m.exec(c);if(p===null){if(p=f.exec(c),p===null)break;m.lastIndex=f.lastIndex}else f.lastIndex=m.lastIndex;l.push(p[0])}return l}async function F3(a,l){const r=[],c=[];return a.forEach(d=>{if("cssRules"in d)try{wn(d.cssRules||[]).forEach((m,h)=>{if(m.type===CSSRule.IMPORT_RULE){let f=h+1;const p=m.href,g=dj(p).then(N=>uj(N,l)).then(N=>mj(N).forEach(j=>{try{d.insertRule(j,j.startsWith("@import")?f+=1:d.cssRules.length)}catch(b){console.error("Error inserting rule from remote css",{rule:j,error:b})}})).catch(N=>{console.error("Error loading remote css",N.toString())});c.push(g)}})}catch(m){const h=a.find(f=>f.href==null)||document.styleSheets[0];d.href!=null&&c.push(dj(d.href).then(f=>uj(f,l)).then(f=>mj(f).forEach(p=>{h.insertRule(p,h.cssRules.length)})).catch(f=>{console.error("Error loading remote stylesheet",f)})),console.error("Error inlining remote css file",m)}}),Promise.all(c).then(()=>(a.forEach(d=>{if("cssRules"in d)try{wn(d.cssRules||[]).forEach(m=>{r.push(m)})}catch(m){console.error(`Error while reading CSS rules from ${d.href}`,m)}}),r))}function H3(a){return a.filter(l=>l.type===CSSRule.FONT_FACE_RULE).filter(l=>GN(l.style.getPropertyValue("src")))}async function q3(a,l){if(a.ownerDocument==null)throw new Error("Provided element is not within a Document");const r=wn(a.ownerDocument.styleSheets),c=await F3(r,l);return H3(c)}function YN(a){return a.trim().replace(/["']/g,"")}function V3(a){const l=new Set;function r(c){(c.style.fontFamily||getComputedStyle(c).fontFamily).split(",").forEach(m=>{l.add(YN(m))}),Array.from(c.children).forEach(m=>{m instanceof HTMLElement&&r(m)})}return r(a),l}async function G3(a,l){const r=await q3(a,l),c=V3(a);return(await Promise.all(r.filter(m=>c.has(YN(m.style.fontFamily))).map(m=>{const h=m.parentStyleSheet?m.parentStyleSheet.href:null;return KN(m.cssText,h,l)}))).join(` +`)}async function K3(a,l){const r=l.fontEmbedCSS!=null?l.fontEmbedCSS:l.skipFonts?null:await G3(a,l);if(r){const c=document.createElement("style"),d=document.createTextNode(r);c.appendChild(d),a.firstChild?a.insertBefore(c,a.firstChild):a.appendChild(c)}}async function Q3(a,l={}){const{width:r,height:c}=FN(a,l),d=await jd(a,l,!0);return await K3(d,l),await QN(d,l),P3(d,l),await u3(d,r,c)}async function Y3(a,l={}){const{width:r,height:c}=FN(a,l),d=await Q3(a,l),m=await sd(d),h=document.createElement("canvas"),f=h.getContext("2d"),p=l.pixelRatio||c3(),g=l.canvasWidth||r,N=l.canvasHeight||c;return h.width=g*p,h.height=N*p,l.skipAutoScale||o3(h),h.style.width=`${g}`,h.style.height=`${N}`,l.backgroundColor&&(f.fillStyle=l.backgroundColor,f.fillRect(0,0,h.width,h.height)),f.drawImage(m,0,0,h.width,h.height),h}async function J3(a,l={}){return(await Y3(a,l)).toDataURL()}const $o=["#0088FE","#00C49F","#FFBB28","#FF8042","#8884d8","#82ca9d"];function X3(a){return a>=8760?"็›ธๅฝ“ไบŽๅ…จๅนดๆ— ไผ‘๏ผŒ7x24ๅฐๆ—ถๅœจ็บฟ๏ผ":a>=5e3?"็›ธๅฝ“ไบŽไธ€ไฝๅ…จ่Œๅ‘˜ๅทฅ็š„ๅนดๅทฅไฝœๆ—ถ้•ฟ":a>=2e3?"็›ธๅฝ“ไบŽ็œ‹ๅฎŒไบ† 1000 ้ƒจ็”ตๅฝฑ":a>=1e3?"็›ธๅฝ“ไบŽ็Žฏ็ƒ้ฃž่กŒ 80 ๆฌก":a>=500?"็›ธๅฝ“ไบŽ่ฏปๅฎŒไบ† 100 ๆœฌไนฆ":a>=100?"็›ธๅฝ“ไบŽ้ฉฌๆ‹‰ๆพ่ท‘ไบ† 25 ๆฌก":"่™ฝ็„ถไธๅคš๏ผŒไฝ†ๆฏไธ€ๅˆป้ƒฝๅพˆ็่ดต"}function Z3(a){return a>=1e3?"ๅคœๆทฑไบบ้™ๆ—ถ็š„็Ÿฅๅฟƒๅฅฝๅ‹":a>=500?"ๅˆๅคœๅœบ็š„ๅธธๅฎข":a>=100?"ๅถๅฐ”็†ฌๅคœ็š„ๅฐไผ™ไผด":a>=50?"ๆทฑๅคœๆœ‰ๆ—ถไนŸไผš้™ชไฝ ่Š่Š":"ๆ—ฉ็กๆ—ฉ่ตท๏ผŒๅฅๅบทไฝœๆฏ"}function W3(a){const l=a/1e6;return l>=100?"ๆ€่€ƒ้‡ๅ ชๆฏ”ไธ€ๅบงๅ›พไนฆ้ฆ†":l>=50?"็›ธๅฝ“ไบŽๅ†™ไบ†ไธ€้ƒจ็™พ็ง‘ๅ…จไนฆ":l>=10?"่„‘็ป†่ƒžไผฐ่ฎกๆถˆ่€—ไบ†ไธๅฐ‘":l>=1?"ไนŸ็ฎ—ๆ˜ฏ่ดนไบ†ไธ€็•ช่„‘็ญ‹":"่ฝป่ฝปๆพๆพ๏ผŒๆธธๅˆƒๆœ‰ไฝ™"}function e5(a){return a>=1e3?"่ฟ™้’ฑๅคŸๅƒไธ€ๅนด็š„ๆณก้ขไบ†":a>=500?"็›ธๅฝ“ไบŽไนฐไบ†ไธ€ๅฐๆธธๆˆๆœบ":a>=100?"ๅคŸ่ฏทๅคงๅฎถๅ–ๅ‡ ๆฏๅฅถ่Œถ":a>=50?"ไธ€้กฟ็ซ้”…็š„้’ฑ":a>=10?"ๅ‡ ๆฏๅ’–ๅ•ก็š„ไปทๆ ผ":"็œ้’ฑๅฐ่ƒฝๆ‰‹"}function s5(a){return a>=80?"ๆฒ‰้ป˜ๆ˜ฏ้‡‘๏ผŒๆƒœๅญ—ๅฆ‚้‡‘":a>=60?"่ฏไธๅคšไฝ†ๅฅๅฅๅˆฐไฝ":a>=40?"่ฏฅ่ฏด็š„ๆ—ถๅ€™ๆ‰ๅผ€ๅฃ":a>=20?"่ƒฝ่Š็š„้ƒฝ่Šไบ†":"่ฏ็—จๆœฌ็—จ๏ผŒๆœ‰้—ฎๅฟ…็ญ”"}function t5(a){return a>=1e4?"็œผ็›้ƒฝๅฟซ็œ‹่Šฑไบ†":a>=5e3?"ๅ ชๆฏ”ไธ“ไธšๆ‘„ๅฝฑๅธˆ็š„้˜…็‰‡้‡":a>=1e3?"็œ‹ๅ›พๅฐ่พพไบบ":a>=500?"ๅ›พ็‰‡้‰ด่ตๅฎถ":a>=100?"ๅถๅฐ”ๆฌฃ่ตไธ€ไธ‹็พŽๅ›พ":"ๅ›พ็‰‡๏ผŸๆœ‰็ฉบๅ†็œ‹"}function a5(a){return a>=500?"ๅœจไธๆ–ญ็š„็บ ๆญฃไธญๆˆ้•ฟ":a>=200?"ๅญฆไน ๆฐธๆ— ๆญขๅขƒ":a>=100?"่™šๅฟƒๆŽฅๅ—๏ผŒ็งฏๆžๆ”นๆญฃ":a>=50?"ๅถๅฐ”ไนŸไผš็Šฏ้”™":a>=10?"่กจ็Žฐ่ฟ˜็ฎ—ไธ้”™":"ๅฎŒ็พŽ่กจ่พพ๏ผŒๆ— ้œ€็บ ๆญฃ"}function l5(a){return a>=1?"่ฟ™ๆฌกๆ€่€ƒ็š„ไปทๅ€ผๅ ชๆฏ”ไธ€้กฟๅคง้ค๏ผ":a>=.5?"ไธบไบ†่ฟ™ไธช้—ฎ้ข˜๏ผŒๆˆ‘ๅฏๆ˜ฏ่ฎค็œŸๆ€่€ƒไบ†๏ผ":a>=.1?"ไธ‹ไบ†็‚นๅŠŸๅคซ๏ผŒๅ€ผๅพ—็š„๏ผ":a>=.01?"่Šฑไบ†็‚นๅฐ้’ฑ๏ผŒไฝ†ๅพˆๅ€ผๅพ—":"ๅฐๅฐๆ€่€ƒ๏ผŒไธ่ถณๆŒ‚้ฝฟ"}function n5(a,l){return a>=100?"่ฟ™ๅฅ่ฏ็ฎ€็›ดๆ˜ฏไธ‡่ƒฝ้’ฅๅŒ™๏ผ":a>=50?"็™พ่ฏ•ไธ็ˆฝ็š„็ปๅ…ธๅ›žๅค":a>=20?`${l}็š„ๅฃๅคด็ฆ…`:a>=10?"ๅธธ็”จ่ฏญๅฝ•ไน‹ไธ€":"ๅถๅฐ”็”จ็”จ็š„ๅฐ็กฎๅนธ"}function r5(a,l){return a?l>=1e3?"ๆทฑๅคœ็š„ๅฎˆๆŠค่€…๏ผŒ้ป‘ๆš—ไธญ็š„ๅ…‰่Š’":l>=500?"ๆœˆไบฎๆ˜ฏๆˆ‘็š„ๅฅฝๆœ‹ๅ‹":l>=100?"่ถŠๅคœ่ถŠ็ฒพ็ฅž๏ผŒๅคœๆ™šๆ‰ๆ˜ฏไธปๅœบ":"ๅถๅฐ”็†ฌๅคœ๏ผŒไบซๅ—ๅฎ้™ๆ—ถๅ…‰":l<=10?"ไฝœๆฏ่ง„ๅพ‹๏ผŒๅฅๅบท็”Ÿๆดป็š„ๅ…ธ่Œƒ":l<=50?"ๆ—ฉ็กๆ—ฉ่ตท๏ผŒๅถๅฐ”ไนŸไผš็†ฌไธชๅคœ":"่™ฝ็„ถๆ˜ฏๆ—ฉ่ตท้ธŸ๏ผŒไฝ†ไนŸไผšๅฎˆๅ€™ๆทฑๅคœ"}function i5(a){return a>=1e3?"ๅฟ™ๅˆฐ้ฃž่ตท๏ผŒ้”ฎ็›˜้ƒฝ่ฆๅ†’็ƒŸไบ†":a>=500?"่ฟ™ๅคฉ็ฎ€็›ดๆ˜ฏ่ฏ็—จ้™„ไฝ“":a>=200?"็คพไบค่พพไบบไธŠ็บฟ":a>=100?"ๆฏ”ๅนณๆ—ถๆดป่ทƒไธๅฐ‘":a>=50?"ๅฐๅฟ™ไธ€ไธ‹":"่ฟ˜็ฎ—่ฝปๆพ็š„ไธ€ๅคฉ"}function c5(){const[a]=u.useState(2025),[l,r]=u.useState(null),[c,d]=u.useState(!0),[m,h]=u.useState(!1),[f,p]=u.useState(null),g=u.useRef(null),{toast:N}=nt(),j=u.useCallback(async()=>{try{d(!0),p(null);const y=await a3(a);r(y)}catch(y){p(y instanceof Error?y:new Error("่Žทๅ–ๅนดๅบฆๆŠฅๅ‘Šๅคฑ่ดฅ"))}finally{d(!1)}},[a]),b=u.useCallback(async()=>{if(!(!g.current||!l)){h(!0),N({title:"ๆญฃๅœจ็”Ÿๆˆๅ›พ็‰‡",description:"่ฏท็จๅ€™..."});try{const y=g.current,w=getComputedStyle(document.documentElement),z=w.getPropertyValue("--background").trim()?`hsl(${w.getPropertyValue("--background").trim()})`:document.documentElement.classList.contains("dark")?"#0a0a0a":"#ffffff",M=y.style.width,S=y.style.maxWidth;y.style.width="1024px",y.style.maxWidth="1024px";const F=await J3(y,{quality:1,pixelRatio:2,backgroundColor:z,cacheBust:!0,filter:C=>!(C instanceof HTMLElement&&C.hasAttribute("data-export-btn"))});y.style.width=M,y.style.maxWidth=S;const E=document.createElement("a");E.download=`${l.bot_name}_${l.year}_ๅนดๅบฆๆ€ป็ป“.png`,E.href=F,E.click(),N({title:"ๅฏผๅ‡บๆˆๅŠŸ",description:"ๅนดๅบฆๆŠฅๅ‘Šๅทฒไฟๅญ˜ไธบๅ›พ็‰‡"})}catch(y){console.error("ๅฏผๅ‡บๅ›พ็‰‡ๅคฑ่ดฅ:",y),N({title:"ๅฏผๅ‡บๅคฑ่ดฅ",description:"่ฏท้‡่ฏ•",variant:"destructive"})}finally{h(!1)}}},[l,N]);return u.useEffect(()=>{j()},[j]),c?e.jsx(o5,{}):f?e.jsxs("div",{className:"flex h-screen items-center justify-center text-red-500",children:["่Žทๅ–ๅนดๅบฆๆŠฅๅ‘Šๅคฑ่ดฅ: ",f.message]}):l?e.jsx(ts,{className:"h-[calc(100vh-4rem)]",children:e.jsx("div",{className:"min-h-screen bg-gradient-to-b from-background to-muted/50 p-4 md:p-8 print:p-0",ref:g,children:e.jsxs("div",{className:"mx-auto max-w-5xl space-y-8 print:space-y-4",children:[e.jsxs("header",{className:"relative overflow-hidden rounded-3xl bg-primary p-8 text-primary-foreground shadow-2xl print:rounded-none print:shadow-none",children:[e.jsx("div",{className:"absolute right-4 top-4 z-20 print:hidden","data-export-btn":!0,children:e.jsx(_,{variant:"secondary",size:"sm",onClick:b,disabled:m,className:"gap-2 bg-white/20 hover:bg-white/30 text-white border-white/30",children:m?e.jsxs(e.Fragment,{children:[e.jsx(Fs,{className:"h-4 w-4 animate-spin"}),"ๅฏผๅ‡บไธญ..."]}):e.jsxs(e.Fragment,{children:[e.jsx(na,{className:"h-4 w-4"}),"ไฟๅญ˜ๅ›พ็‰‡"]})})}),e.jsxs("div",{className:"relative z-10 flex flex-col items-center text-center",children:[e.jsx(Yn,{className:"mb-4 h-16 w-16 animate-bounce"}),e.jsxs("h1",{className:"text-4xl font-bold tracking-tighter sm:text-6xl",children:[l.bot_name," ",l.year," ๅนดๅบฆๆ€ป็ป“"]}),e.jsx("p",{className:"mt-4 max-w-2xl text-lg opacity-90",children:"่ฟžๆŽฅไธŽๆˆ้•ฟ ยท Connection & Growth"}),e.jsxs("div",{className:"mt-6 flex items-center gap-2 text-sm opacity-75",children:[e.jsx(Ko,{className:"h-4 w-4"}),e.jsxs("span",{children:["็”Ÿๆˆๆ—ถ้—ด: ",l.generated_at]})]})]}),e.jsx("div",{className:"absolute -right-20 -top-20 h-64 w-64 rounded-full bg-white/10 blur-3xl"}),e.jsx("div",{className:"absolute -bottom-20 -left-20 h-64 w-64 rounded-full bg-white/10 blur-3xl"})]}),e.jsxs("section",{className:"space-y-4 break-inside-avoid",children:[e.jsxs("div",{className:"flex items-center gap-2 text-2xl font-bold text-primary",children:[e.jsx(da,{className:"h-8 w-8"}),e.jsx("h2",{children:"ๆ—ถๅ…‰่ถณ่ฟน"})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[e.jsx(La,{title:"ๅนดๅบฆๅœจ็บฟๆ—ถ้•ฟ",value:`${l.time_footprint.total_online_hours} ๅฐๆ—ถ`,description:X3(l.time_footprint.total_online_hours),icon:e.jsx(da,{className:"h-4 w-4"})}),e.jsx(La,{title:"ๆœ€ๅฟ™็ขŒ็š„ไธ€ๅคฉ",value:l.time_footprint.busiest_day||"N/A",description:i5(l.time_footprint.busiest_day_count),icon:e.jsx(Ko,{className:"h-4 w-4"})}),e.jsx(La,{title:"ๆทฑๅคœไบ’ๅŠจ (0-4็‚น)",value:`${l.time_footprint.midnight_chat_count} ๆฌก`,description:Z3(l.time_footprint.midnight_chat_count),icon:e.jsx(tc,{className:"h-4 w-4"})}),e.jsx(La,{title:"ไฝœๆฏๅฑžๆ€ง",value:l.time_footprint.is_night_owl?"ๅคœ็Œซๅญ":"ๆ—ฉ่ตท้ธŸ",description:r5(l.time_footprint.is_night_owl,l.time_footprint.midnight_chat_count),icon:l.time_footprint.is_night_owl?e.jsx(tc,{className:"h-4 w-4"}):e.jsx(ix,{className:"h-4 w-4"})})]}),e.jsxs(Te,{className:"overflow-hidden",children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"24ๅฐๆ—ถๆดป่ทƒๆ—ถ้’Ÿ"}),e.jsxs(Ns,{children:[l.bot_name,"ๅœจไธ€ๅคฉไธญๅ„ไธชๆ—ถๆฎต็š„ๆดป่ทƒ็จ‹ๅบฆ"]})]}),e.jsx(ze,{className:"h-[300px]",children:e.jsx(Uj,{width:"100%",height:"100%",children:e.jsxs(Io,{data:l.time_footprint.hourly_distribution.map((y,w)=>({hour:`${w}็‚น`,count:y})),children:[e.jsx(Ji,{strokeDasharray:"3 3",vertical:!1}),e.jsx(Xi,{dataKey:"hour"}),e.jsx(Gr,{}),e.jsx($j,{contentStyle:{borderRadius:"8px",border:"none",boxShadow:"0 4px 12px rgba(0,0,0,0.1)"},cursor:{fill:"transparent"}}),e.jsx(Zi,{dataKey:"count",fill:"hsl(var(--primary))",radius:[4,4,0,0]})]})})})]}),l.time_footprint.first_message_time&&e.jsx(Te,{className:"bg-muted/30 border-dashed",children:e.jsxs(ze,{className:"flex flex-col items-center justify-center p-6 text-center",children:[e.jsx("p",{className:"text-muted-foreground mb-2",children:"2025ๅนด็š„ๆ•…ไบ‹ๅผ€ๅง‹ไบŽ"}),e.jsx("div",{className:"text-xl font-bold text-primary mb-1",children:l.time_footprint.first_message_time}),e.jsxs("p",{className:"text-lg",children:[e.jsx("span",{className:"font-semibold text-foreground",children:l.time_footprint.first_message_user})," ่ฏด๏ผš",e.jsxs("span",{className:"italic text-muted-foreground",children:['"',l.time_footprint.first_message_content,'"']})]})]})})]}),e.jsxs("section",{className:"space-y-4 break-inside-avoid",children:[e.jsxs("div",{className:"flex items-center gap-2 text-2xl font-bold text-primary",children:[e.jsx(oc,{className:"h-8 w-8"}),e.jsx("h2",{children:"็คพไบค็ฝ‘็ปœ"})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsx(La,{title:"็คพไบคๅœˆๅญ",value:`${l.social_network.total_groups} ไธช็พค็ป„`,description:`${l.bot_name}ๅŠ ๅ…ฅ็š„็พค็ป„ๆ€ปๆ•ฐ`,icon:e.jsx(oc,{className:"h-4 w-4"})}),e.jsx(La,{title:"่ขซๅ‘ผๅซๆฌกๆ•ฐ",value:`${l.social_network.at_count+l.social_network.mentioned_count} ๆฌก`,description:"ๆˆ‘็š„ๅๅญ—่ขซๅคงๅฎถ้ข‘็นๆ่ตท",icon:e.jsx(W_,{className:"h-4 w-4"})}),e.jsx(La,{title:"ๆœ€้•ฟๆƒ…้™ชไผด",value:l.social_network.longest_companion_user||"N/A",description:`ๅง‹็ปˆ้ƒฝๅœจ๏ผŒๅทฒ้™ชไผด ${l.social_network.longest_companion_days} ๅคฉ`,icon:e.jsx(ei,{className:"h-4 w-4 text-red-500"})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(Te,{children:[e.jsx(Oe,{children:e.jsx(Ue,{children:"่ฏ็—จ็พค็ป„ TOP5"})}),e.jsx(ze,{children:e.jsx("div",{className:"space-y-3",children:l.social_network.top_groups.length>0?l.social_network.top_groups.map((y,w)=>e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ce,{variant:w===0?"default":"secondary",className:"h-6 w-6 rounded-full p-0 flex items-center justify-center shrink-0",children:w+1}),e.jsx("span",{className:"font-medium truncate max-w-[120px]",children:y.group_name}),y.is_webui&&e.jsx(Ce,{variant:"outline",className:"text-xs px-1.5 py-0 h-5 bg-blue-50 text-blue-600 border-blue-200",children:"WebUI"})]}),e.jsxs("span",{className:"text-muted-foreground text-sm shrink-0",children:[y.message_count," ๆกๆถˆๆฏ"]})]},y.group_id)):e.jsx("div",{className:"text-center text-muted-foreground py-4",children:"ๆš‚ๆ— ๆ•ฐๆฎ"})})})]}),e.jsxs(Te,{children:[e.jsx(Oe,{children:e.jsx(Ue,{children:"ๅนดๅบฆๆœ€ไฝณๆŸๅ‹ TOP5"})}),e.jsx(ze,{children:e.jsx("div",{className:"space-y-3",children:l.social_network.top_users.length>0?l.social_network.top_users.map((y,w)=>e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ce,{variant:w===0?"default":"secondary",className:"h-6 w-6 rounded-full p-0 flex items-center justify-center shrink-0",children:w+1}),e.jsx("span",{className:"font-medium truncate max-w-[120px]",children:y.user_nickname}),y.is_webui&&e.jsx(Ce,{variant:"outline",className:"text-xs px-1.5 py-0 h-5 bg-blue-50 text-blue-600 border-blue-200",children:"WebUI"})]}),e.jsxs("span",{className:"text-muted-foreground text-sm shrink-0",children:[y.message_count," ๆฌกไบ’ๅŠจ"]})]},y.user_id)):e.jsx("div",{className:"text-center text-muted-foreground py-4",children:"ๆš‚ๆ— ๆ•ฐๆฎ"})})})]})]})]}),e.jsxs("section",{className:"space-y-4 break-inside-avoid",children:[e.jsxs("div",{className:"flex items-center gap-2 text-2xl font-bold text-primary",children:[e.jsx(hx,{className:"h-8 w-8"}),e.jsx("h2",{children:"ๆœ€ๅผบๅคง่„‘"})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[e.jsx(La,{title:"ๅนดๅบฆ Token ๆถˆ่€—",value:(l.brain_power.total_tokens/1e6).toFixed(2)+" M",description:W3(l.brain_power.total_tokens),icon:e.jsx(sl,{className:"h-4 w-4"})}),e.jsx(La,{title:"ๅนดๅบฆๆ€ป่Šฑ่ดน",value:`$${l.brain_power.total_cost.toFixed(2)}`,description:e5(l.brain_power.total_cost),icon:e.jsx("span",{className:"font-bold",children:"$"})}),e.jsx(La,{title:"้ซ˜ๅ†ทๆŒ‡ๆ•ฐ",value:`${l.brain_power.silence_rate}%`,description:s5(l.brain_power.silence_rate),icon:e.jsx(tc,{className:"h-4 w-4"})}),e.jsx(La,{title:"ๆœ€้ซ˜ๅ…ด่ถฃๅ€ผ",value:l.brain_power.max_interest_value??"N/A",description:l.brain_power.max_interest_time?`ๅ‡บ็Žฐๅœจ ${l.brain_power.max_interest_time}`:"ๆš‚ๆ— ๆ•ฐๆฎ",icon:e.jsx(ei,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(Te,{children:[e.jsx(Oe,{children:e.jsx(Ue,{children:"ๆจกๅž‹ๅๅฅฝๅˆ†ๅธƒ"})}),e.jsx(ze,{children:e.jsx("div",{className:"space-y-3",children:l.brain_power.model_distribution.slice(0,5).map((y,w)=>{const z=l.brain_power.model_distribution[0]?.count||1,M=Math.round(y.count/z*100);return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"font-medium truncate max-w-[200px]",children:y.model}),e.jsxs("span",{className:"text-muted-foreground",children:[y.count.toLocaleString()," ๆฌก"]})]}),e.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-secondary",children:e.jsx("div",{className:"h-full transition-all duration-500",style:{width:`${M}%`,backgroundColor:$o[w%$o.length]}})})]},y.model)})})})]}),l.brain_power.top_reply_models&&l.brain_power.top_reply_models.length>0&&e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"ๆœ€ๅ–œๆฌข็š„ๅ›žๅคๆจกๅž‹ TOP5"}),e.jsxs(Ns,{children:[l.bot_name,"็”จๆฅๅ›žๅคๆถˆๆฏ็š„ๆจกๅž‹ๅๅฅฝ"]})]}),e.jsx(ze,{children:e.jsx("div",{className:"space-y-3",children:l.brain_power.top_reply_models.map((y,w)=>{const z=l.brain_power.top_reply_models[0]?.count||1,M=Math.round(y.count/z*100);return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"font-medium truncate max-w-[200px]",children:y.model}),e.jsxs("span",{className:"text-muted-foreground",children:[y.count.toLocaleString()," ๆฌก"]})]}),e.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-secondary",children:e.jsx("div",{className:"h-full transition-all duration-500",style:{width:`${M}%`,backgroundColor:$o[w%$o.length]}})})]},y.model)})})})]}),l.brain_power.top_token_consumers&&l.brain_power.top_token_consumers.length>0&&e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"็ƒง้’ฑๅคงๆˆท TOP3"}),e.jsx(Ns,{children:"่ฐๆถˆ่€—ไบ†ๆœ€ๅคš็š„ API ้ขๅบฆ"})]}),e.jsx(ze,{children:e.jsx("div",{className:"space-y-6",children:l.brain_power.top_token_consumers.map(y=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between text-sm font-medium",children:[e.jsxs("span",{children:["็”จๆˆท ",y.user_id]}),e.jsxs("span",{children:["$",y.cost.toFixed(2)]})]}),e.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-secondary",children:e.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${y.cost/(l.brain_power.top_token_consumers[0]?.cost||1)*100}%`}})})]},y.user_id))})})]})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(Te,{className:"bg-gradient-to-br from-amber-50 to-orange-50 dark:from-amber-950/20 dark:to-orange-950/20",children:[e.jsx(Oe,{children:e.jsxs(Ue,{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-2xl",children:"๐Ÿ’ฐ"}),"ๆœ€ๆ˜‚่ดต็š„ไธ€ๆฌกๆ€่€ƒ"]})}),e.jsxs(ze,{className:"text-center",children:[e.jsxs("div",{className:"text-4xl font-bold text-amber-600 dark:text-amber-400",children:["$",l.brain_power.most_expensive_cost.toFixed(4)]}),l.brain_power.most_expensive_time&&e.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:["ๅ‘็”Ÿๅœจ ",l.brain_power.most_expensive_time]}),e.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:l5(l.brain_power.most_expensive_cost)})]})]}),e.jsxs(Te,{className:"bg-gradient-to-br from-indigo-50 to-blue-50 dark:from-indigo-950/20 dark:to-blue-950/20",children:[e.jsx(Oe,{children:e.jsxs(Ue,{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-2xl",children:"๐Ÿง "}),"ๆ€่€ƒๆทฑๅบฆ"]})}),e.jsxs(ze,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-center",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-bold text-indigo-600 dark:text-indigo-400",children:l.brain_power.avg_reasoning_length?.toFixed(0)||0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"ๅนณๅ‡ๆ€่€ƒๅญ—ๆ•ฐ"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-bold text-blue-600 dark:text-blue-400",children:l.brain_power.max_reasoning_length?.toLocaleString()||0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"ๆœ€้•ฟๆ€่€ƒๅญ—ๆ•ฐ"})]})]}),l.brain_power.max_reasoning_time&&e.jsxs("p",{className:"mt-4 text-center text-xs text-muted-foreground",children:["ๆœ€ๆทฑๆฒ‰็š„ๆ€่€ƒๅ‘็”Ÿๅœจ ",l.brain_power.max_reasoning_time]})]})]})]})]}),e.jsxs("section",{className:"space-y-4 break-inside-avoid",children:[e.jsxs("div",{className:"flex items-center gap-2 text-2xl font-bold text-primary",children:[e.jsx(rd,{className:"h-8 w-8"}),e.jsx("h2",{children:"ไธชๆ€งไธŽ่กจ่พพ"})]}),(l.expression_vibe.late_night_reply||l.expression_vibe.favorite_reply)&&e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[l.expression_vibe.late_night_reply&&e.jsxs(Te,{className:"bg-gradient-to-br from-indigo-50 to-violet-50 dark:from-indigo-950/20 dark:to-violet-950/20",children:[e.jsxs(Oe,{children:[e.jsxs(Ue,{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-2xl",children:"๐ŸŒ™"}),"ๆทฑๅคœ่ฟ˜ๅœจๅ›žๅค"]}),e.jsxs(Ns,{children:["ๅ‡Œๆ™จ ",l.expression_vibe.late_night_reply.time,"๏ผŒ",l.bot_name,"่ฟ˜ๅœจๅ›žๅค..."]})]}),e.jsxs(ze,{className:"text-center",children:[e.jsxs("p",{className:"text-lg italic text-muted-foreground",children:['"',l.expression_vibe.late_night_reply.content,'"']}),e.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"ๆ˜ฏๆœ‰ไป€ไนˆๅฟƒไบ‹ๅ—๏ผŸ"})]})]}),l.expression_vibe.favorite_reply&&e.jsxs(Te,{className:"bg-gradient-to-br from-rose-50 to-pink-50 dark:from-rose-950/20 dark:to-pink-950/20",children:[e.jsxs(Oe,{children:[e.jsxs(Ue,{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-2xl",children:"๐Ÿ’ฌ"}),"ๆœ€ๅ–œๆฌข็š„ๅ›žๅค"]}),e.jsxs(Ns,{children:["ไฝฟ็”จไบ† ",l.expression_vibe.favorite_reply.count," ๆฌก"]})]}),e.jsxs(ze,{className:"text-center",children:[e.jsxs("p",{className:"text-lg font-medium text-primary",children:['"',l.expression_vibe.favorite_reply.content,'"']}),e.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:n5(l.expression_vibe.favorite_reply.count,l.bot_name)})]})]})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(Te,{className:"bg-gradient-to-br from-pink-50 to-purple-50 dark:from-pink-950/20 dark:to-purple-950/20",children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"ไฝฟ็”จๆœ€ๅคš็š„่กจๆƒ…ๅŒ… TOP3"}),e.jsx(Ns,{children:"ๅนดๅบฆๆœ€็ˆฑ็š„่กจๆƒ…ๅŒ…ไปฌ"})]}),e.jsx(ze,{children:l.expression_vibe.top_emojis&&l.expression_vibe.top_emojis.length>0?e.jsx("div",{className:"flex justify-center gap-4",children:l.expression_vibe.top_emojis.slice(0,3).map((y,w)=>e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsxs("div",{className:"relative",children:[e.jsx("img",{src:`/api/webui/emoji/${y.id}/thumbnail?original=true`,alt:`TOP ${w+1}`,className:"h-24 w-24 rounded-lg object-cover shadow-md transition-transform hover:scale-105"}),e.jsx(Ce,{className:P("absolute -top-2 -right-2",w===0?"bg-yellow-500":w===1?"bg-gray-400":"bg-amber-700"),children:w+1})]}),e.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:[y.usage_count," ๆฌก"]})]},y.id))}):e.jsx("div",{className:"flex h-32 items-center justify-center text-muted-foreground",children:"ๆš‚ๆ— ๆ•ฐๆฎ"})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"ๅฐ่ฑกๆœ€ๆทฑๅˆป็š„่กจ่พพ้ฃŽๆ ผ"}),e.jsxs(Ns,{children:[l.bot_name,"ๆœ€ๅธธไฝฟ็”จ็š„่กจ่พพๆ–นๅผ"]})]}),e.jsx(ze,{children:e.jsx("div",{className:"flex flex-wrap gap-2",children:l.expression_vibe.top_expressions.map((y,w)=>e.jsxs(Ce,{variant:"outline",className:P("px-3 py-1 text-sm",w===0&&"border-primary bg-primary/10 text-primary text-base px-4 py-2"),children:[y.style," (",y.count,")"]},y.style))})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(La,{title:"ๅ›พ็‰‡้‰ด่ต",value:`${l.expression_vibe.image_processed_count} ๅผ `,description:t5(l.expression_vibe.image_processed_count),icon:e.jsx(xx,{className:"h-4 w-4"})}),e.jsx(La,{title:"ๆˆ้•ฟ็š„่ถณ่ฟน",value:`${l.expression_vibe.rejected_expression_count} ๆฌก`,description:a5(l.expression_vibe.rejected_expression_count),icon:e.jsx(sl,{className:"h-4 w-4"})})]})]})]}),l.expression_vibe.action_types.length>0&&e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsxs(Ue,{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-2xl",children:"โšก"}),"่กŒๅŠจๆดพ"]}),e.jsx(Ns,{children:"้™คไบ†่Šๅคฉ๏ผŒๆˆ‘่ฟ˜ๅธฎๅคงๅฎถๅšไบ†่ฟ™ไบ›ไบ‹"})]}),e.jsx(ze,{children:e.jsx("div",{className:"flex flex-wrap gap-3",children:l.expression_vibe.action_types.map(y=>e.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-primary/10 px-4 py-2",children:[e.jsx("span",{className:"font-medium text-primary",children:y.action}),e.jsxs(Ce,{variant:"secondary",children:[y.count," ๆฌก"]})]},y.action))})})]})]}),e.jsxs("section",{className:"space-y-4 break-inside-avoid",children:[e.jsxs("div",{className:"flex items-center gap-2 text-2xl font-bold text-primary",children:[e.jsx(e1,{className:"h-8 w-8"}),e.jsx("h2",{children:"่ถฃๅ‘ณๆˆๅฐฑ"})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsxs(Te,{className:"col-span-1 md:col-span-2",children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:'ๆ–ฐๅญฆๅˆฐ็š„"้ป‘่ฏ"'}),e.jsxs(Ns,{children:["ไปŠๅนดๆˆ‘ๅญฆไผšไบ† ",l.achievements.new_jargon_count," ไธชๆ–ฐ่ฏ"]})]}),e.jsx(ze,{children:e.jsx("div",{className:"flex flex-wrap gap-3",children:l.achievements.sample_jargons.map(y=>e.jsxs("div",{className:"group relative rounded-lg border bg-card p-3 shadow-sm transition-all hover:shadow-md",children:[e.jsx("div",{className:"font-bold text-primary",children:y.content}),e.jsx("div",{className:"text-xs text-muted-foreground mt-1 line-clamp-2 max-w-[200px]",children:y.meaning||"ๆš‚ๆ— ่งฃ้‡Š"})]},y.content))})})]}),e.jsx(Te,{className:"flex flex-col justify-center items-center bg-primary text-primary-foreground",children:e.jsxs(ze,{className:"flex flex-col items-center justify-center p-6 text-center",children:[e.jsx(Ba,{className:"h-12 w-12 mb-4 opacity-80"}),e.jsx("div",{className:"text-4xl font-bold mb-2",children:l.achievements.total_messages.toLocaleString()}),e.jsx("div",{className:"text-sm opacity-80",children:"ๅนดๅบฆๆ€ปๆถˆๆฏๆ•ฐ"}),e.jsxs("div",{className:"mt-4 text-xs opacity-60",children:["ๅ…ถไธญๅ›žๅคไบ† ",l.achievements.total_replies.toLocaleString()," ๆฌก"]})]})})]})]}),e.jsxs("footer",{className:"mt-12 text-center text-muted-foreground",children:[e.jsx("p",{children:"MaiBot 2025 Annual Report"}),e.jsx("p",{className:"text-sm",children:"Generated with โค๏ธ by MaiBot Team"})]})]})})}):null}function La({title:a,value:l,description:r,icon:c}){return e.jsxs(Te,{children:[e.jsxs(Oe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ue,{className:"text-sm font-medium",children:a}),e.jsx("div",{className:"text-muted-foreground",children:c})]}),e.jsxs(ze,{children:[e.jsx("div",{className:"text-2xl font-bold",children:l}),e.jsx("p",{className:"text-xs text-muted-foreground",children:r})]})]})}function o5(){return e.jsxs("div",{className:"container mx-auto space-y-8 p-8",children:[e.jsx(ks,{className:"h-64 w-full rounded-3xl"}),e.jsx("div",{className:"grid gap-4 md:grid-cols-4",children:[...Array(4)].map((a,l)=>e.jsx(ks,{className:"h-32 w-full"},l))}),e.jsx(ks,{className:"h-96 w-full"})]})}var vd="DropdownMenu",[d5]=ld(vd,[Oj]),fa=Oj(),[u5,JN]=d5(vd),XN=a=>{const{__scopeDropdownMenu:l,children:r,dir:c,open:d,defaultOpen:m,onOpenChange:h,modal:f=!0}=a,p=fa(l),g=u.useRef(null),[N,j]=ad({prop:d,defaultProp:m??!1,onChange:h,caller:vd});return e.jsx(u5,{scope:l,triggerId:Ym(),triggerRef:g,contentId:Ym(),open:N,onOpenChange:j,onOpenToggle:u.useCallback(()=>j(b=>!b),[j]),modal:f,children:e.jsx(Vw,{...p,open:N,onOpenChange:j,dir:c,modal:f,children:r})})};XN.displayName=vd;var ZN="DropdownMenuTrigger",WN=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,disabled:c=!1,...d}=a,m=JN(ZN,r),h=fa(r);return e.jsx(Gw,{asChild:!0,...h,children:e.jsx(ar.button,{type:"button",id:m.triggerId,"aria-haspopup":"menu","aria-expanded":m.open,"aria-controls":m.open?m.contentId:void 0,"data-state":m.open?"open":"closed","data-disabled":c?"":void 0,disabled:c,...d,ref:__(l,m.triggerRef),onPointerDown:_n(a.onPointerDown,f=>{!c&&f.button===0&&f.ctrlKey===!1&&(m.onOpenToggle(),m.open||f.preventDefault())}),onKeyDown:_n(a.onKeyDown,f=>{c||(["Enter"," "].includes(f.key)&&m.onOpenToggle(),f.key==="ArrowDown"&&m.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(f.key)&&f.preventDefault())})})})});WN.displayName=ZN;var m5="DropdownMenuPortal",eb=a=>{const{__scopeDropdownMenu:l,...r}=a,c=fa(l);return e.jsx(Uw,{...c,...r})};eb.displayName=m5;var sb="DropdownMenuContent",tb=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=JN(sb,r),m=fa(r),h=u.useRef(!1);return e.jsx($w,{id:d.contentId,"aria-labelledby":d.triggerId,...m,...c,ref:l,onCloseAutoFocus:_n(a.onCloseAutoFocus,f=>{h.current||d.triggerRef.current?.focus(),h.current=!1,f.preventDefault()}),onInteractOutside:_n(a.onInteractOutside,f=>{const p=f.detail.originalEvent,g=p.button===0&&p.ctrlKey===!0,N=p.button===2||g;(!d.modal||N)&&(h.current=!0)}),style:{...a.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});tb.displayName=sb;var x5="DropdownMenuGroup",h5=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=fa(r);return e.jsx(Kw,{...d,...c,ref:l})});h5.displayName=x5;var f5="DropdownMenuLabel",ab=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=fa(r);return e.jsx(Hw,{...d,...c,ref:l})});ab.displayName=f5;var p5="DropdownMenuItem",lb=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=fa(r);return e.jsx(Iw,{...d,...c,ref:l})});lb.displayName=p5;var g5="DropdownMenuCheckboxItem",nb=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=fa(r);return e.jsx(Bw,{...d,...c,ref:l})});nb.displayName=g5;var j5="DropdownMenuRadioGroup",v5=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=fa(r);return e.jsx(Qw,{...d,...c,ref:l})});v5.displayName=j5;var N5="DropdownMenuRadioItem",rb=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=fa(r);return e.jsx(Fw,{...d,...c,ref:l})});rb.displayName=N5;var b5="DropdownMenuItemIndicator",ib=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=fa(r);return e.jsx(Pw,{...d,...c,ref:l})});ib.displayName=b5;var y5="DropdownMenuSeparator",cb=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=fa(r);return e.jsx(qw,{...d,...c,ref:l})});cb.displayName=y5;var w5="DropdownMenuArrow",_5=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=fa(r);return e.jsx(Yw,{...d,...c,ref:l})});_5.displayName=w5;var S5="DropdownMenuSubTrigger",ob=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=fa(r);return e.jsx(Ow,{...d,...c,ref:l})});ob.displayName=S5;var k5="DropdownMenuSubContent",db=u.forwardRef((a,l)=>{const{__scopeDropdownMenu:r,...c}=a,d=fa(r);return e.jsx(Lw,{...d,...c,ref:l,style:{...a.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});db.displayName=k5;var C5=XN,T5=WN,E5=eb,ub=tb,mb=ab,xb=lb,hb=nb,fb=rb,pb=ib,gb=cb,jb=ob,vb=db;const M5=C5,A5=T5,z5=u.forwardRef(({className:a,inset:l,children:r,...c},d)=>e.jsxs(jb,{ref:d,className:P("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",l&&"pl-8",a),...c,children:[r,e.jsx(ra,{className:"ml-auto h-4 w-4"})]}));z5.displayName=jb.displayName;const R5=u.forwardRef(({className:a,...l},r)=>e.jsx(vb,{ref:r,className:P("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a),...l}));R5.displayName=vb.displayName;const Nb=u.forwardRef(({className:a,sideOffset:l=4,...r},c)=>e.jsx(E5,{children:e.jsx(ub,{ref:c,sideOffset:l,className:P("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a),...r})}));Nb.displayName=ub.displayName;const bb=u.forwardRef(({className:a,inset:l,...r},c)=>e.jsx(xb,{ref:c,className:P("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",l&&"pl-8",a),...r}));bb.displayName=xb.displayName;const D5=u.forwardRef(({className:a,children:l,checked:r,...c},d)=>e.jsxs(hb,{ref:d,className:P("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),checked:r,...c,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(pb,{children:e.jsx(Ot,{className:"h-4 w-4"})})}),l]}));D5.displayName=hb.displayName;const O5=u.forwardRef(({className:a,children:l,...r},c)=>e.jsxs(fb,{ref:c,className:P("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),...r,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(pb,{children:e.jsx(Vo,{className:"h-2 w-2 fill-current"})})}),l]}));O5.displayName=fb.displayName;const L5=u.forwardRef(({className:a,inset:l,...r},c)=>e.jsx(mb,{ref:c,className:P("px-2 py-1.5 text-sm font-semibold",l&&"pl-8",a),...r}));L5.displayName=mb.displayName;const U5=u.forwardRef(({className:a,...l},r)=>e.jsx(gb,{ref:r,className:P("-mx-1 my-1 h-px bg-muted",a),...l}));U5.displayName=gb.displayName;const Qm=[{value:"created_at",label:"ๆœ€ๆ–ฐๅ‘ๅธƒ",icon:da},{value:"downloads",label:"ไธ‹่ฝฝๆœ€ๅคš",icon:na},{value:"likes",label:"ๆœ€ๅ—ๆฌข่ฟŽ",icon:ei}];function $5(){const a=ha(),[l,r]=u.useState([]),[c,d]=u.useState(!0),[m,h]=u.useState(""),[f,p]=u.useState("downloads"),[g,N]=u.useState(1),[j,b]=u.useState(1),[y,w]=u.useState(0),[z,M]=u.useState(new Set),[S,F]=u.useState(new Set),E=cN(),C=u.useCallback(async()=>{d(!0);try{const L=await m4({status:"approved",page:g,page_size:12,search:m||void 0,sort_by:f,sort_order:"desc"});r(L.packs),b(L.total_pages),w(L.total);const me=new Set;for(const Ne of L.packs)await iN(Ne.id,E)&&me.add(Ne.id);M(me)}catch(L){console.error("ๅŠ ่ฝฝ Pack ๅˆ—่กจๅคฑ่ดฅ:",L),aa({title:"ๅŠ ่ฝฝ Pack ๅˆ—่กจๅคฑ่ดฅ",variant:"destructive"})}finally{d(!1)}},[g,m,f,E]);u.useEffect(()=>{C()},[C]);const R=L=>{L.preventDefault(),N(1),C()},H=async L=>{if(!S.has(L)){F(me=>new Set(me).add(L));try{const me=await rN(L,E);M(Ne=>{const je=new Set(Ne);return me.liked?je.add(L):je.delete(L),je}),r(Ne=>Ne.map(je=>je.id===L?{...je,likes:me.likes}:je))}catch(me){console.error("็‚น่ตžๅคฑ่ดฅ:",me),aa({title:"็‚น่ตžๅคฑ่ดฅ",variant:"destructive"})}finally{F(me=>{const Ne=new Set(me);return Ne.delete(L),Ne})}}},O=L=>{a({to:"/config/pack-market/$packId",params:{packId:L}})},X=Qm.find(L=>L.value===f)||Qm[0];return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsx("div",{className:"mb-4 sm:mb-6",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(xa,{className:"h-8 w-8",strokeWidth:2}),"้…็ฝฎๆจกๆฟๅธ‚ๅœบ"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"ๆต่งˆๅ’Œๅบ”็”จ็คพๅŒบๅˆ†ไบซ็š„ๆจกๅž‹้…็ฝฎๆจกๆฟ๏ผŒๅฟซ้€Ÿ้…็ฝฎไฝ ็š„ MaiBot"})]}),e.jsxs(_,{variant:"outline",onClick:C,disabled:c,className:"gap-2",children:[e.jsx(dt,{className:`h-4 w-4 ${c?"animate-spin":""}`}),"ๅˆทๆ–ฐ"]})]})}),e.jsx(ts,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-4 flex-wrap",children:[e.jsx("form",{onSubmit:R,className:"flex-1 min-w-[200px] max-w-md",children:e.jsxs("div",{className:"relative",children:[e.jsx($t,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(ae,{placeholder:"ๆœ็ดขๆจกๆฟๅ็งฐใ€ๆ่ฟฐ...",value:m,onChange:L=>h(L.target.value),className:"pl-10"})]})}),e.jsxs(M5,{children:[e.jsx(A5,{asChild:!0,children:e.jsxs(_,{variant:"outline",className:"min-w-[140px] gap-2",children:[e.jsx(s1,{className:"w-4 h-4"}),X.label,e.jsx(Ia,{className:"w-4 h-4 ml-auto"})]})}),e.jsx(Nb,{align:"end",children:Qm.map(L=>e.jsxs(bb,{onClick:()=>{p(L.value),N(1)},children:[e.jsx(L.icon,{className:"w-4 h-4 mr-2"}),L.label]},L.value))})]})]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:["ๅ…ฑๆ‰พๅˆฐ ",e.jsx("span",{className:"font-medium text-foreground",children:y})," ไธชๆจกๆฟ"]}),c?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Array.from({length:6}).map((L,me)=>e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(ks,{className:"h-6 w-3/4"}),e.jsx(ks,{className:"h-4 w-full mt-2"})]}),e.jsx(ze,{children:e.jsx(ks,{className:"h-20 w-full"})}),e.jsx(od,{children:e.jsx(ks,{className:"h-9 w-full"})})]},me))}):l.length===0?e.jsx(Te,{className:"py-12",children:e.jsxs(ze,{className:"text-center text-muted-foreground",children:[e.jsx(xa,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{className:"text-lg font-medium",children:"ๆš‚ๆ— ๆจกๆฟ"}),e.jsx("p",{className:"mt-1",children:"่ฟ˜ๆฒกๆœ‰ไบบๅˆ†ไบซ้…็ฝฎๆจกๆฟ๏ผŒๅฟซๆฅๅˆ†ไบซ็ฌฌไธ€ไธชๅง๏ผ"})]})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:l.map(L=>e.jsx(I5,{pack:L,liked:z.has(L.id),liking:S.has(L.id),onLike:()=>H(L.id),onView:()=>O(L.id)},L.id))}),j>1&&e.jsx(fx,{children:e.jsxs(px,{children:[e.jsx(Xn,{children:e.jsx($v,{onClick:()=>N(L=>Math.max(1,L-1)),className:g===1?"pointer-events-none opacity-50":"cursor-pointer"})}),Array.from({length:j},(L,me)=>me+1).filter(L=>L===1||L===j||Math.abs(L-g)<=1).map((L,me,Ne)=>{const je=me>0&&L-Ne[me-1]>1;return e.jsxs(Xn,{children:[je&&e.jsx("span",{className:"px-2",children:"..."}),e.jsx(jc,{onClick:()=>N(L),isActive:L===g,className:"cursor-pointer",children:L})]},L)}),e.jsx(Xn,{children:e.jsx(Iv,{onClick:()=>N(L=>Math.min(j,L+1)),className:g===j?"pointer-events-none opacity-50":"cursor-pointer"})})]})})]})})]})}function I5({pack:a,liked:l,liking:r,onLike:c,onView:d}){const m=h=>new Date(h).toLocaleDateString("zh-CN",{year:"numeric",month:"short",day:"numeric"});return e.jsxs(Te,{className:"flex flex-col hover:shadow-md transition-shadow",children:[e.jsxs(Oe,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx(Ue,{className:"text-lg line-clamp-1",children:a.name}),e.jsxs(Ce,{variant:"secondary",className:"text-xs",children:["v",a.version]})]}),e.jsx(Ns,{className:"line-clamp-2 min-h-[40px]",children:a.description})]}),e.jsxs(ze,{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(Fl,{className:"w-3.5 h-3.5"}),a.author]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(da,{className:"w-3.5 h-3.5"}),m(a.created_at)]})]}),e.jsxs("div",{className:"flex gap-4 text-sm",children:[e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",title:"ๆไพ›ๅ•†ๆ•ฐ้‡",children:[e.jsx(Hl,{className:"w-3.5 h-3.5"}),a.provider_count]}),e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",title:"ๆจกๅž‹ๆ•ฐ้‡",children:[e.jsx(Wn,{className:"w-3.5 h-3.5"}),a.model_count]}),e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",title:"ไปปๅŠก้…็ฝฎๆ•ฐ",children:[e.jsx(er,{className:"w-3.5 h-3.5"}),a.task_count]})]}),a.tags&&a.tags.length>0&&e.jsxs("div",{className:"flex flex-wrap gap-1",children:[a.tags.slice(0,3).map(h=>e.jsxs(Ce,{variant:"outline",className:"text-xs",children:[e.jsx(cd,{className:"w-2.5 h-2.5 mr-1"}),h]},h)),a.tags.length>3&&e.jsxs(Ce,{variant:"outline",className:"text-xs",children:["+",a.tags.length-3]})]})]}),e.jsx(od,{className:"pt-3 border-t",children:e.jsxs("div",{className:"flex items-center justify-between w-full",children:[e.jsxs("div",{className:"flex items-center gap-3 text-sm text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(na,{className:"w-4 h-4"}),a.downloads]}),e.jsxs("button",{onClick:h=>{h.stopPropagation(),c()},disabled:r,className:`flex items-center gap-1 transition-colors ${l?"text-red-500":"hover:text-red-500"} ${r?"opacity-50":""}`,children:[e.jsx(ei,{className:`w-4 h-4 ${l?"fill-current":""}`}),a.likes]})]}),e.jsx(_,{size:"sm",onClick:d,children:"ๆŸฅ็œ‹่ฏฆๆƒ…"})]})})]})}var ul="Accordion",B5=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Lx,P5,F5]=S_(ul),[Nd]=ld(ul,[F5,Lj]),Ux=Lj(),yb=Is.forwardRef((a,l)=>{const{type:r,...c}=a,d=c,m=c;return e.jsx(Lx.Provider,{scope:a.__scopeAccordion,children:r==="multiple"?e.jsx(G5,{...m,ref:l}):e.jsx(V5,{...d,ref:l})})});yb.displayName=ul;var[wb,H5]=Nd(ul),[_b,q5]=Nd(ul,{collapsible:!1}),V5=Is.forwardRef((a,l)=>{const{value:r,defaultValue:c,onValueChange:d=()=>{},collapsible:m=!1,...h}=a,[f,p]=ad({prop:r,defaultProp:c??"",onChange:d,caller:ul});return e.jsx(wb,{scope:a.__scopeAccordion,value:Is.useMemo(()=>f?[f]:[],[f]),onItemOpen:p,onItemClose:Is.useCallback(()=>m&&p(""),[m,p]),children:e.jsx(_b,{scope:a.__scopeAccordion,collapsible:m,children:e.jsx(Sb,{...h,ref:l})})})}),G5=Is.forwardRef((a,l)=>{const{value:r,defaultValue:c,onValueChange:d=()=>{},...m}=a,[h,f]=ad({prop:r,defaultProp:c??[],onChange:d,caller:ul}),p=Is.useCallback(N=>f((j=[])=>[...j,N]),[f]),g=Is.useCallback(N=>f((j=[])=>j.filter(b=>b!==N)),[f]);return e.jsx(wb,{scope:a.__scopeAccordion,value:h,onItemOpen:p,onItemClose:g,children:e.jsx(_b,{scope:a.__scopeAccordion,collapsible:!0,children:e.jsx(Sb,{...m,ref:l})})})}),[K5,bd]=Nd(ul),Sb=Is.forwardRef((a,l)=>{const{__scopeAccordion:r,disabled:c,dir:d,orientation:m="vertical",...h}=a,f=Is.useRef(null),p=nd(f,l),g=P5(r),j=Wj(d)==="ltr",b=_n(a.onKeyDown,y=>{if(!B5.includes(y.key))return;const w=y.target,z=g().filter(X=>!X.ref.current?.disabled),M=z.findIndex(X=>X.ref.current===w),S=z.length;if(M===-1)return;y.preventDefault();let F=M;const E=0,C=S-1,R=()=>{F=M+1,F>C&&(F=E)},H=()=>{F=M-1,F{const{__scopeAccordion:r,value:c,...d}=a,m=bd(td,r),h=H5(td,r),f=Ux(r),p=Ym(),g=c&&h.value.includes(c)||!1,N=m.disabled||a.disabled;return e.jsx(Q5,{scope:r,open:g,disabled:N,triggerId:p,children:e.jsx(Mj,{"data-orientation":m.orientation,"data-state":zb(g),...f,...d,ref:l,disabled:N,open:g,onOpenChange:j=>{j?h.onItemOpen(c):h.onItemClose(c)}})})});kb.displayName=td;var Cb="AccordionHeader",Tb=Is.forwardRef((a,l)=>{const{__scopeAccordion:r,...c}=a,d=bd(ul,r),m=$x(Cb,r);return e.jsx(ar.h3,{"data-orientation":d.orientation,"data-state":zb(m.open),"data-disabled":m.disabled?"":void 0,...c,ref:l})});Tb.displayName=Cb;var lx="AccordionTrigger",Eb=Is.forwardRef((a,l)=>{const{__scopeAccordion:r,...c}=a,d=bd(ul,r),m=$x(lx,r),h=q5(lx,r),f=Ux(r);return e.jsx(Lx.ItemSlot,{scope:r,children:e.jsx(Jw,{"aria-disabled":m.open&&!h.collapsible||void 0,"data-orientation":d.orientation,id:m.triggerId,...f,...c,ref:l})})});Eb.displayName=lx;var Mb="AccordionContent",Ab=Is.forwardRef((a,l)=>{const{__scopeAccordion:r,...c}=a,d=bd(ul,r),m=$x(Mb,r),h=Ux(r);return e.jsx(Xw,{role:"region","aria-labelledby":m.triggerId,"data-orientation":d.orientation,...h,...c,ref:l,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...a.style}})});Ab.displayName=Mb;function zb(a){return a?"open":"closed"}var Y5=yb,J5=kb,X5=Tb,Rb=Eb,Db=Ab;const Z5=Y5,Ob=u.forwardRef(({className:a,...l},r)=>e.jsx(J5,{ref:r,className:P("border-b",a),...l}));Ob.displayName="AccordionItem";const Lb=u.forwardRef(({className:a,children:l,...r},c)=>e.jsx(X5,{className:"flex",children:e.jsxs(Rb,{ref:c,className:P("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",a),...r,children:[l,e.jsx(Ia,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));Lb.displayName=Rb.displayName;const Ub=u.forwardRef(({className:a,children:l,...r},c)=>e.jsx(Db,{ref:c,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...r,children:e.jsx("div",{className:P("pb-4 pt-0",a),children:l})}));Ub.displayName=Db.displayName;const W5={utils:"้€š็”จๅทฅๅ…ท",utils_small:"่ฝป้‡ๅทฅๅ…ท",tool_use:"ๅทฅๅ…ท่ฐƒ็”จ",replyer:"ๅ›žๅค็”Ÿๆˆ",planner:"่ง„ๅˆ’ๆŽจ็†",vlm:"่ง†่ง‰ๆจกๅž‹",voice:"่ฏญ้Ÿณๅค„็†",embedding:"ๅ‘้‡ๅตŒๅ…ฅ",lpmm_entity_extract:"ๅฎžไฝ“ๆๅ–",lpmm_rdf_build:"RDFๆž„ๅปบ",lpmm_qa:"้—ฎ็ญ”ๆจกๅž‹"};function eT(){const{packId:a}=Pb.useParams(),l=ha(),[r,c]=u.useState(null),[d,m]=u.useState(!0),[h,f]=u.useState(!1),[p,g]=u.useState(!1),[N,j]=u.useState(!1),[b,y]=u.useState(1),[w,z]=u.useState(null),[M,S]=u.useState(!1),[F,E]=u.useState(!1),[C,R]=u.useState({apply_providers:!0,apply_models:!0,apply_task_config:!0,task_mode:"append",selected_providers:void 0,selected_models:void 0,selected_tasks:void 0}),[H,O]=u.useState({}),[X,L]=u.useState({}),me=cN(),Ne=u.useCallback(async()=>{if(a){m(!0);try{const D=await x4(a);c(D);const Q=await iN(a,me);f(Q)}catch(D){console.error("ๅŠ ่ฝฝ Pack ๅคฑ่ดฅ:",D),aa({title:"ๅŠ ่ฝฝๆจกๆฟๅคฑ่ดฅ",variant:"destructive"})}finally{m(!1)}}},[a,me]);u.useEffect(()=>{Ne()},[Ne]);const je=async()=>{if(!(!a||p)){g(!0);try{const D=await rN(a,me);f(D.liked),r&&c({...r,likes:D.likes})}catch(D){console.error("็‚น่ตžๅคฑ่ดฅ:",D),aa({title:"็‚น่ตžๅคฑ่ดฅ",variant:"destructive"})}finally{g(!1)}}},re=async()=>{if(r){j(!0),y(1),S(!0);try{const D=await p4(r);z(D);const Q={};for(const ue of D.existing_providers)Q[ue.pack_provider.name]=ue.local_providers[0].name;O(Q);const I={};for(const ue of D.new_providers)I[ue.name]="";L(I)}catch(D){console.error("ๆฃ€ๆต‹ๅ†ฒ็ชๅคฑ่ดฅ:",D),aa({title:"ๆฃ€ๆต‹้…็ฝฎๅ†ฒ็ชๅคฑ่ดฅ",variant:"destructive"}),j(!1)}finally{S(!1)}}},ge=async()=>{if(r){if(C.apply_providers&&w){for(const D of w.new_providers)if(!X[D.name]){aa({title:`่ฏทๅกซๅ†™ๆไพ›ๅ•† "${D.name}" ็š„ API Key`,variant:"destructive"});return}}E(!0);try{await g4(r,C,H,X),await f4(r.id,me),c({...r,downloads:r.downloads+1}),aa({title:"้…็ฝฎๆจกๆฟๅบ”็”จๆˆๅŠŸ๏ผ"}),j(!1)}catch(D){console.error("ๅบ”็”จ Pack ๅคฑ่ดฅ:",D),aa({title:D instanceof Error?D.message:"ๅบ”็”จ้…็ฝฎๅคฑ่ดฅ",variant:"destructive"})}finally{E(!1)}}},pe=D=>new Date(D).toLocaleDateString("zh-CN",{year:"numeric",month:"long",day:"numeric"});return d?e.jsx(tT,{}):r?e.jsx("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:e.jsx(ts,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsxs(_,{variant:"ghost",size:"sm",onClick:()=>l({to:"/config/pack-market"}),className:"gap-2",children:[e.jsx($a,{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(xa,{className:"w-10 h-10 text-primary mt-1"}),e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[r.name,e.jsxs(Ce,{variant:"secondary",children:["v",r.version]})]}),e.jsx("p",{className:"text-muted-foreground mt-1",children:r.description})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-4 text-sm text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Fl,{className:"w-4 h-4"}),r.author]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(da,{className:"w-4 h-4"}),pe(r.created_at)]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(na,{className:"w-4 h-4"}),r.downloads," ๆฌกไธ‹่ฝฝ"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ei,{className:`w-4 h-4 ${h?"fill-red-500 text-red-500":""}`}),r.likes," ่ตž"]})]}),r.tags&&r.tags.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:r.tags.map(D=>e.jsxs(Ce,{variant:"outline",children:[e.jsx(cd,{className:"w-3 h-3 mr-1"}),D]},D))})]}),e.jsxs("div",{className:"flex flex-col gap-2 min-w-[160px]",children:[e.jsxs(_,{size:"lg",onClick:re,children:[e.jsx(na,{className:"w-4 h-4 mr-2"}),"ๅบ”็”จๆจกๆฟ"]}),e.jsxs(_,{variant:"outline",onClick:je,disabled:p,className:h?"text-red-500 border-red-200":"",children:[e.jsx(ei,{className:`w-4 h-4 mr-2 ${h?"fill-current":""}`}),h?"ๅทฒ็‚น่ตž":"็‚น่ตž"]})]})]}),e.jsx(la,{}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsx(Te,{children:e.jsxs(ze,{className:"flex items-center gap-3 py-4",children:[e.jsx(Hl,{className:"w-8 h-8 text-blue-500 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:r.providers.length}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"API ๆไพ›ๅ•†"})]})]})}),e.jsx(Te,{children:e.jsxs(ze,{className:"flex items-center gap-3 py-4",children:[e.jsx(Wn,{className:"w-8 h-8 text-green-500 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:r.models.length}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"ๆจกๅž‹้…็ฝฎ"})]})]})}),e.jsx(Te,{children:e.jsxs(ze,{className:"flex items-center gap-3 py-4",children:[e.jsx(er,{className:"w-8 h-8 text-purple-500 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:Object.keys(r.task_config).length}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"ไปปๅŠก้…็ฝฎ"})]})]})})]}),e.jsxs(Jt,{defaultValue:"providers",className:"space-y-4",children:[e.jsxs(Gt,{className:"w-full sm:w-auto grid grid-cols-3 sm:flex",children:[e.jsxs(Xe,{value:"providers",className:"gap-1 sm:gap-2",children:[e.jsx(Hl,{className:"w-4 h-4"}),e.jsx("span",{className:"hidden sm:inline",children:"ๆไพ›ๅ•†"}),e.jsx("span",{className:"sm:hidden",children:"ๆไพ›ๅ•†"}),e.jsxs("span",{className:"hidden sm:inline",children:["(",r.providers.length,")"]})]}),e.jsxs(Xe,{value:"models",className:"gap-1 sm:gap-2",children:[e.jsx(Wn,{className:"w-4 h-4"}),e.jsx("span",{className:"hidden sm:inline",children:"ๆจกๅž‹"}),e.jsx("span",{className:"sm:hidden",children:"ๆจกๅž‹"}),e.jsxs("span",{className:"hidden sm:inline",children:["(",r.models.length,")"]})]}),e.jsxs(Xe,{value:"tasks",className:"gap-1 sm:gap-2",children:[e.jsx(er,{className:"w-4 h-4"}),e.jsx("span",{className:"hidden sm:inline",children:"ไปปๅŠก้…็ฝฎ"}),e.jsx("span",{className:"sm:hidden",children:"ไปปๅŠก"}),e.jsxs("span",{className:"hidden sm:inline",children:["(",Object.keys(r.task_config).length,")"]})]})]}),e.jsx(Ss,{value:"providers",children:e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"API ๆไพ›ๅ•†"}),e.jsx(Ns,{children:"ๆจกๆฟไธญๅŒ…ๅซ็š„ API ๆไพ›ๅ•†้…็ฝฎ๏ผˆไธๅซ API Key๏ผ‰"})]}),e.jsx(ze,{children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(ql,{children:[e.jsx(Vl,{children:e.jsxs(_t,{children:[e.jsx(ns,{children:"ๅ็งฐ"}),e.jsx(ns,{children:"Base URL"}),e.jsx(ns,{children:"็ฑปๅž‹"})]})}),e.jsx(Gl,{children:r.providers.map(D=>e.jsxs(_t,{children:[e.jsx(Ze,{className:"font-medium whitespace-nowrap",children:D.name}),e.jsx(Ze,{className:"text-muted-foreground font-mono text-sm max-w-[200px] truncate",children:D.base_url}),e.jsx(Ze,{children:e.jsx(Ce,{variant:"outline",children:D.client_type})})]},D.name))})]})})})]})}),e.jsx(Ss,{value:"models",children:e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"ๆจกๅž‹้…็ฝฎ"}),e.jsx(Ns,{children:"ๆจกๆฟไธญๅŒ…ๅซ็š„ๆจกๅž‹้…็ฝฎ"})]}),e.jsx(ze,{children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(ql,{children:[e.jsx(Vl,{children:e.jsxs(_t,{children:[e.jsx(ns,{children:"ๆจกๅž‹ๅ็งฐ"}),e.jsx(ns,{children:"ๆ ‡่ฏ†็ฌฆ"}),e.jsx(ns,{children:"ๆไพ›ๅ•†"}),e.jsx(ns,{className:"text-right",children:"ไปทๆ ผ (ๅ…ฅ/ๅ‡บ)"})]})}),e.jsx(Gl,{children:r.models.map(D=>e.jsxs(_t,{children:[e.jsx(Ze,{className:"font-medium whitespace-nowrap",children:D.name}),e.jsx(Ze,{className:"text-muted-foreground font-mono text-sm max-w-[150px] truncate",children:D.model_identifier}),e.jsx(Ze,{className:"whitespace-nowrap",children:D.api_provider}),e.jsxs(Ze,{className:"text-right text-muted-foreground whitespace-nowrap",children:["ยฅ",D.price_in," / ยฅ",D.price_out]})]},D.name))})]})})})]})}),e.jsx(Ss,{value:"tasks",children:e.jsxs(Te,{children:[e.jsxs(Oe,{children:[e.jsx(Ue,{children:"ไปปๅŠก้…็ฝฎ"}),e.jsx(Ns,{children:"ๆจกๆฟไธญๅ„ไปปๅŠก็ฑปๅž‹็š„ๆจกๅž‹ๅˆ†้…"})]}),e.jsx(ze,{children:e.jsx(Z5,{type:"multiple",className:"w-full",children:Object.entries(r.task_config).map(([D,Q])=>e.jsxs(Ob,{value:D,children:[e.jsx(Lb,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Sn,{className:"w-4 h-4"}),W5[D]||D,e.jsxs(Ce,{variant:"secondary",className:"ml-2",children:[Q.model_list.length," ไธชๆจกๅž‹"]})]})}),e.jsx(Ub,{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(I=>e.jsx(Ce,{variant:"outline",children:I},I))}),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})]})]})})]},D))})})]})})]}),e.jsx(sT,{open:N,onOpenChange:j,pack:r,step:b,setStep:y,conflicts:w,detectingConflicts:M,applying:F,options:C,setOptions:R,_providerMapping:H,_setProviderMapping:O,newProviderApiKeys:X,setNewProviderApiKeys:L,onApply:ge})]})})}):e.jsxs("div",{className:"text-center py-12",children:[e.jsx(xa,{className:"w-16 h-16 mx-auto mb-4 opacity-50"}),e.jsx("h2",{className:"text-xl font-semibold",children:"ๆจกๆฟไธๅญ˜ๅœจ"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"่ฏฅ้…็ฝฎๆจกๆฟๅฏ่ƒฝๅทฒ่ขซๅˆ ้™คๆˆ–ๅฐšๆœช้€š่ฟ‡ๅฎกๆ ธ"}),e.jsxs(_,{className:"mt-4",onClick:()=>l({to:"/config/pack-market"}),children:[e.jsx($a,{className:"w-4 h-4 mr-2"}),"่ฟ”ๅ›žๅธ‚ๅœบ"]})]})}function sT({open:a,onOpenChange:l,pack:r,step:c,setStep:d,conflicts:m,detectingConflicts:h,applying:f,options:p,setOptions:g,_providerMapping:N,_setProviderMapping:j,newProviderApiKeys:b,setNewProviderApiKeys:y,onApply:w}){return e.jsx(Qs,{open:a,onOpenChange:l,children:e.jsxs(Hs,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(qs,{children:[e.jsxs(Vs,{className:"flex items-center gap-2",children:[e.jsx(xa,{className:"w-5 h-5"}),"ๅบ”็”จ้…็ฝฎๆจกๆฟ"]}),e.jsxs(at,{children:["ๆญฅ้ชค ",c," / ",3,"๏ผš",c===1&&"้€‰ๆ‹ฉ่ฆๅบ”็”จ็š„ๅ†…ๅฎน",c===2&&"้…็ฝฎๆไพ›ๅ•†ๆ˜ ๅฐ„",c===3&&"็กฎ่ฎคๅนถๅบ”็”จ"]})]}),h?e.jsxs("div",{className:"py-8 text-center",children:[e.jsx(Fs,{className:"w-8 h-8 mx-auto animate-spin text-primary"}),e.jsx("p",{className:"mt-4 text-muted-foreground",children:"ๆญฃๅœจๆฃ€ๆต‹้…็ฝฎๅ†ฒ็ช..."})]}):e.jsxs(e.Fragment,{children:[c===1&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(tt,{id:"apply_providers",checked:p.apply_providers,onCheckedChange:M=>g({...p,apply_providers:M})}),e.jsxs(T,{htmlFor:"apply_providers",className:"flex items-center gap-2",children:[e.jsx(Hl,{className:"w-4 h-4"}),"ๅบ”็”จๆไพ›ๅ•†้…็ฝฎ (",r.providers.length," ไธช)"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(tt,{id:"apply_models",checked:p.apply_models,onCheckedChange:M=>g({...p,apply_models:M})}),e.jsxs(T,{htmlFor:"apply_models",className:"flex items-center gap-2",children:[e.jsx(Wn,{className:"w-4 h-4"}),"ๅบ”็”จๆจกๅž‹้…็ฝฎ (",r.models.length," ไธช)"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(tt,{id:"apply_task_config",checked:p.apply_task_config,onCheckedChange:M=>g({...p,apply_task_config:M})}),e.jsxs(T,{htmlFor:"apply_task_config",className:"flex items-center gap-2",children:[e.jsx(er,{className:"w-4 h-4"}),"ๅบ”็”จไปปๅŠก้…็ฝฎ (",Object.keys(r.task_config).length," ไธช)"]})]})]}),p.apply_task_config&&e.jsxs("div",{className:"pl-6 space-y-2 border-l-2 border-muted",children:[e.jsx(T,{className:"text-sm font-medium",children:"ไปปๅŠก้…็ฝฎๅบ”็”จๆจกๅผ"}),e.jsxs(Rx,{value:p.task_mode,onValueChange:M=>g({...p,task_mode:M}),children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Wo,{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(Wo,{value:"replace",id:"mode_replace"}),e.jsx(T,{htmlFor:"mode_replace",className:"font-normal",children:"ๆ›ฟๆขๆจกๅผ - ็”จๆจกๆฟ้…็ฝฎๅฎŒๅ…จๆ›ฟๆข็Žฐๆœ‰้…็ฝฎ"})]})]})]})]}),c===2&&m&&e.jsxs("div",{className:"space-y-4",children:[p.apply_providers&&m.existing_providers.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs(ht,{children:[e.jsx(Yt,{className:"h-4 w-4"}),e.jsx(Jn,{children:"ๅ‘็Žฐๅทฒๆœ‰็š„ๆไพ›ๅ•†"}),e.jsx(ft,{children:"ไปฅไธ‹ๆไพ›ๅ•†็š„ URL ไธŽๆ‚จๆœฌๅœฐ้…็ฝฎไธญ็š„ๆไพ›ๅ•†ๅŒน้…๏ผŒๅฐ†่‡ชๅŠจไฝฟ็”จๆœฌๅœฐๆไพ›ๅ•†๏ผš"})]}),e.jsx("div",{className:"space-y-2",children:m.existing_providers.map(({pack_provider:M,local_providers:S})=>e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-lg",children:[e.jsx(Ot,{className:"w-4 h-4 text-green-500 flex-shrink-0"}),e.jsx("span",{className:"font-medium flex-shrink-0",children:M.name}),e.jsx(ra,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),S.length===1?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-muted-foreground",children:S[0].name}),e.jsx(Ce,{variant:"outline",className:"ml-auto",children:"URL ๅŒน้…"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(Pe,{value:N[M.name]||S[0].name,onValueChange:F=>j({...N,[M.name]:F}),children:[e.jsx(Ie,{className:"w-[200px]",children:e.jsx(Fe,{})}),e.jsx(Be,{children:S.map(F=>e.jsx(W,{value:F.name,children:F.name},F.name))})]}),e.jsxs(Ce,{variant:"outline",className:"ml-auto",children:[S.length," ไธชๅŒน้…"]})]})]},M.name))})]}),p.apply_providers&&m.new_providers.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs(ht,{variant:"destructive",children:[e.jsx(Lt,{className:"h-4 w-4"}),e.jsx(Jn,{children:"้œ€่ฆ้…็ฝฎ API Key"}),e.jsx(ft,{children:"ไปฅไธ‹ๆไพ›ๅ•†ๅœจๆ‚จ็š„ๆœฌๅœฐ้…็ฝฎไธญไธๅญ˜ๅœจ๏ผŒ้œ€่ฆๅกซๅ†™ API Key๏ผš"})]}),e.jsx("div",{className:"space-y-4",children:m.new_providers.map(M=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(cx,{className:"w-4 h-4 text-amber-500"}),e.jsx("span",{className:"font-medium",children:M.name}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",M.base_url,")"]})]}),e.jsx(ae,{type:"password",placeholder:`่พ“ๅ…ฅ ${M.name} ็š„ API Key`,value:b[M.name]||"",onChange:S=>y({...b,[M.name]:S.target.value})})]},M.name))})]}),(!p.apply_providers||m.existing_providers.length===0&&m.new_providers.length===0)&&e.jsxs(ht,{children:[e.jsx(Ot,{className:"h-4 w-4"}),e.jsx(Jn,{children:"ๆ— ้œ€้…็ฝฎ"}),e.jsx(ft,{children:"ๆจกๆฟไธญๆฒกๆœ‰ๆไพ›ๅ•†้…็ฝฎ๏ผŒๆˆ–ๆ‚จ้€‰ๆ‹ฉไธๅบ”็”จๆไพ›ๅ•†ใ€‚"})]})]}),c===3&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(ht,{children:[e.jsx(Yt,{className:"h-4 w-4"}),e.jsx(Jn,{children:"็กฎ่ฎคๅบ”็”จ"}),e.jsx(ft,{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(Ot,{className:"w-4 h-4 text-green-500"}),e.jsx(Hl,{className:"w-4 h-4"}),e.jsxs("span",{children:["ๅบ”็”จ ",r.providers.length," ไธชๆไพ›ๅ•†้…็ฝฎ"]})]}),p.apply_models&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Ot,{className:"w-4 h-4 text-green-500"}),e.jsx(Wn,{className:"w-4 h-4"}),e.jsxs("span",{children:["ๅบ”็”จ ",r.models.length," ไธชๆจกๅž‹้…็ฝฎ"]})]}),p.apply_task_config&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Ot,{className:"w-4 h-4 text-green-500"}),e.jsx(er,{className:"w-4 h-4"}),e.jsxs("span",{children:[p.task_mode==="append"?"่ฟฝๅŠ ":"ๆ›ฟๆข"," ",Object.keys(r.task_config).length," ไธชไปปๅŠก้…็ฝฎ"]})]})]}),m&&m.new_providers.length>0&&e.jsxs(ht,{variant:"destructive",children:[e.jsx(Lt,{className:"h-4 w-4"}),e.jsxs(ft,{children:["ๅฐ†ๆทปๅŠ  ",m.new_providers.length," ไธชๆ–ฐๆไพ›ๅ•†๏ผŒ่ฏท็กฎไฟๅทฒๅกซๅ†™ๆญฃ็กฎ็š„ API Keyใ€‚"]})]})]})]}),e.jsxs(gt,{className:"flex justify-between",children:[e.jsx("div",{children:c>1&&!h&&e.jsx(_,{variant:"outline",onClick:()=>d(c-1),disabled:f,children:"ไธŠไธ€ๆญฅ"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(_,{variant:"outline",onClick:()=>l(!1),disabled:f,children:"ๅ–ๆถˆ"}),c<3?e.jsx(_,{onClick:()=>d(c+1),disabled:h,children:"ไธ‹ไธ€ๆญฅ"}):e.jsxs(_,{onClick:w,disabled:f,children:[f&&e.jsx(Fs,{className:"w-4 h-4 mr-2 animate-spin"}),"ๅบ”็”จๆจกๆฟ"]})]})]})]})})}function tT(){return e.jsx("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:e.jsx(ts,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsx(ks,{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(ks,{className:"w-10 h-10"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(ks,{className:"h-8 w-2/3"}),e.jsx(ks,{className:"h-4 w-full"})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-4",children:[e.jsx(ks,{className:"h-4 w-24"}),e.jsx(ks,{className:"h-4 w-32"}),e.jsx(ks,{className:"h-4 w-28"}),e.jsx(ks,{className:"h-4 w-20"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(ks,{className:"h-6 w-20"}),e.jsx(ks,{className:"h-6 w-24"}),e.jsx(ks,{className:"h-6 w-16"})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 min-w-[160px]",children:[e.jsx(ks,{className:"h-10 w-full"}),e.jsx(ks,{className:"h-10 w-full"})]})]}),e.jsx(ks,{className:"h-px w-full"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsx(ks,{className:"h-24"}),e.jsx(ks,{className:"h-24"}),e.jsx(ks,{className:"h-24"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ks,{className:"h-10 w-32"}),e.jsx(ks,{className:"h-10 w-32"}),e.jsx(ks,{className:"h-10 w-32"})]}),e.jsx(ks,{className:"h-96 w-full"})]})]})})})}function aT(){const a=ha(),[l,r]=u.useState(!0);return u.useEffect(()=>{let c=!1;return(async()=>{try{const m=await dc();!c&&!m&&a({to:"/auth"})}catch{c||a({to:"/auth"})}finally{c||r(!1)}})(),()=>{c=!0}},[a]),{checking:l}}async function lT(){return await dc()}const nT=ti("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"}}),$b=u.forwardRef(({className:a,size:l,abbrTitle:r,children:c,...d},m)=>e.jsx("kbd",{className:P(nT({size:l,className:a})),ref:m,...d,children:r?e.jsx("abbr",{title:r,children:c}):c}));$b.displayName="Kbd";const rT=[{icon:id,title:"้ฆ–้กต",description:"ๆŸฅ็œ‹ไปช่กจๆฟๆฆ‚่งˆ",path:"/",category:"ๆฆ‚่งˆ"},{icon:Ua,title:"้บฆ้บฆไธป็จ‹ๅบ้…็ฝฎ",description:"้…็ฝฎ้บฆ้บฆ็š„ๆ ธๅฟƒ่ฎพ็ฝฎ",path:"/config/bot",category:"้…็ฝฎ"},{icon:Hl,title:"้บฆ้บฆๆจกๅž‹ๆไพ›ๅ•†้…็ฝฎ",description:"้…็ฝฎๆจกๅž‹ๆไพ›ๅ•†",path:"/config/modelProvider",category:"้…็ฝฎ"},{icon:gv,title:"้บฆ้บฆๆจกๅž‹้…็ฝฎ",description:"้…็ฝฎๆจกๅž‹ๅ‚ๆ•ฐ",path:"/config/model",category:"้…็ฝฎ"},{icon:rd,title:"่กจๆƒ…ๅŒ…็ฎก็†",description:"็ฎก็†้บฆ้บฆ็š„่กจๆƒ…ๅŒ…",path:"/resource/emoji",category:"่ต„ๆบ"},{icon:Ba,title:"่กจ่พพๆ–นๅผ็ฎก็†",description:"็ฎก็†้บฆ้บฆ็š„่กจ่พพๆ–นๅผ",path:"/resource/expression",category:"่ต„ๆบ"},{icon:jv,title:"ไบบ็‰ฉไฟกๆฏ็ฎก็†",description:"็ฎก็†ไบบ็‰ฉไฟกๆฏ",path:"/resource/person",category:"่ต„ๆบ"},{icon:Wr,title:"้ป‘่ฏ็ฎก็†",description:"็ฎก็†้บฆ้บฆๅญฆไน ๅˆฐ็š„้ป‘่ฏๅ’Œไฟš่ฏญ",path:"/resource/jargon",category:"่ต„ๆบ"},{icon:t1,title:"็ปŸ่ฎกไฟกๆฏ",description:"ๆŸฅ็œ‹ไฝฟ็”จ็ปŸ่ฎก",path:"/statistics",category:"็›‘ๆŽง"},{icon:xa,title:"ๆ’ไปถๅธ‚ๅœบ",description:"ๆต่งˆๅ’Œๅฎ‰่ฃ…ๆ’ไปถ",path:"/plugins",category:"ๆ‰ฉๅฑ•"},{icon:ux,title:"ๆ—ฅๅฟ—ๆŸฅ็œ‹ๅ™จ",description:"ๆŸฅ็œ‹็ณป็ปŸๆ—ฅๅฟ—",path:"/logs",category:"็›‘ๆŽง"},{icon:Sn,title:"็ณป็ปŸ่ฎพ็ฝฎ",description:"้…็ฝฎ็ณป็ปŸๅ‚ๆ•ฐ",path:"/settings",category:"็ณป็ปŸ"}];function iT({open:a,onOpenChange:l}){const[r,c]=u.useState(""),[d,m]=u.useState(0),h=ha(),f=rT.filter(N=>N.title.toLowerCase().includes(r.toLowerCase())||N.description.toLowerCase().includes(r.toLowerCase())||N.category.toLowerCase().includes(r.toLowerCase())),p=u.useCallback(N=>{h({to:N}),l(!1),c(""),m(0)},[h,l]),g=u.useCallback(N=>{N.key==="ArrowDown"?(N.preventDefault(),m(j=>(j+1)%f.length)):N.key==="ArrowUp"?(N.preventDefault(),m(j=>(j-1+f.length)%f.length)):N.key==="Enter"&&f[d]&&(N.preventDefault(),p(f[d].path))},[f,d,p]);return e.jsx(Qs,{open:a,onOpenChange:l,children:e.jsxs(Hs,{className:"max-w-2xl p-0 gap-0",children:[e.jsxs(qs,{className:"px-4 pt-4 pb-0",children:[e.jsx(Vs,{className:"sr-only",children:"ๆœ็ดข"}),e.jsxs("div",{className:"relative",children:[e.jsx($t,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground"}),e.jsx(ae,{value:r,onChange:N=>{c(N.target.value),m(0)},onKeyDown:g,placeholder:"ๆœ็ดข้กต้ข...",className:"h-12 pl-11 text-base border-0 focus-visible:ring-0 shadow-none",autoFocus:!0})]})]}),e.jsx("div",{className:"border-t",children:e.jsx(ts,{className:"h-[400px]",children:f.length>0?e.jsx("div",{className:"p-2",children:f.map((N,j)=>{const b=N.icon;return e.jsxs("button",{onClick:()=>p(N.path),onMouseEnter:()=>m(j),className:P("w-full flex items-center gap-3 px-3 py-2.5 rounded-md text-left transition-colors",j===d?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:[e.jsx(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($t,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:r?"ๆœชๆ‰พๅˆฐๅŒน้…็š„้กต้ข":"่พ“ๅ…ฅๅ…ณ้”ฎ่ฏๅผ€ๅง‹ๆœ็ดข"})]})})}),e.jsx("div",{className:"border-t px-4 py-3 flex items-center justify-between text-xs text-muted-foreground",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"โ†‘"}),e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"โ†“"}),"ๅฏผ่ˆช"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Enter"}),"้€‰ๆ‹ฉ"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Esc"}),"ๅ…ณ้—ญ"]})]})})]})})}function cT(){const a=window.location.protocol==="http:",l=window.location.hostname.toLowerCase(),r=l==="localhost"||l==="127.0.0.1"||l==="::1",c=sessionStorage.getItem("http-warning-dismissed")==="true",[d,m]=u.useState(a&&!r&&!c),[h,f]=u.useState(!1),p=()=>{f(!0),m(!1),sessionStorage.setItem("http-warning-dismissed","true")};return!d||h?null:e.jsx("div",{className:"relative bg-amber-500/10 border-b border-amber-500/20 backdrop-blur-sm",children:e.jsx("div",{className:"container mx-auto px-4 py-3",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e.jsx(Lt,{className:"h-5 w-5 text-amber-600 dark:text-amber-500 flex-shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("p",{className:"text-sm font-medium text-amber-900 dark:text-amber-100",children:[e.jsx("span",{className:"font-semibold",children:"ๅฎ‰ๅ…จ่ญฆๅ‘Š๏ผš"}),"ๆ‚จๆญฃๅœจไฝฟ็”จ ",e.jsx("strong",{children:"HTTP"})," ่ฎฟ้—ฎ MaiBot WebUI"]}),e.jsx("p",{className:"text-xs text-amber-800 dark:text-amber-200 mt-1",children:"ๅฆ‚ๆžœ่ฟ™ๆ˜ฏๅ…ฌ็ฝ‘ๆœๅŠกๅ™จ๏ผŒๆ‚จ็š„ๆ•ฐๆฎ๏ผˆๅŒ…ๆ‹ฌ Tokenใ€่Šๅคฉ่ฎฐๅฝ•็ญ‰๏ผ‰ๅฏ่ƒฝๅœจไผ ่พ“่ฟ‡็จ‹ไธญ่ขซ็ชƒๅ–ใ€‚ๅผบ็ƒˆๅปบ่ฎฎไฝฟ็”จ HTTPS ่ฎฟ้—ฎๆˆ–ไป…ๅœจๆœฌๅœฐ็ฝ‘็ปœไฝฟ็”จใ€‚"})]})]}),e.jsx(_,{variant:"ghost",size:"icon",onClick:p,className:"h-8 w-8 text-amber-700 hover:text-amber-900 dark:text-amber-400 dark:hover:text-amber-200 flex-shrink-0","aria-label":"ๅ…ณ้—ญ่ญฆๅ‘Š",children:e.jsx(Sa,{className:"h-4 w-4"})})]})})})}function oT(){const[a,l]=u.useState(0),[r,c]=u.useState(!1),d=u.useRef(null);u.useEffect(()=>{const g=N=>{const j=N.target;if(j.scrollHeight>j.clientHeight+100){d.current=j;const b=j.scrollTop,y=j.scrollHeight-j.clientHeight,w=y>0?b/y*100:0;l(w),c(b>300)}};return window.addEventListener("scroll",g,{capture:!0,passive:!0}),()=>window.removeEventListener("scroll",g,{capture:!0})},[]);const m=()=>{d.current?.scrollTo({top:0,behavior:"smooth"})},h=18,f=2*Math.PI*h,p=f-a/100*f;return e.jsx("div",{className:P("fixed bottom-24 right-8 z-50 transition-all duration-500 ease-in-out transform",r?"translate-x-0 opacity-100":"translate-x-32 opacity-0 pointer-events-none"),children:e.jsxs(_,{variant:"outline",size:"icon",className:P("relative h-12 w-12 rounded-full shadow-xl","bg-background/80 backdrop-blur-md border-border/50","hover:bg-accent hover:scale-110 hover:shadow-2xl hover:border-primary/50","transition-all duration-300","group"),onClick:m,"aria-label":"ๅ›žๅˆฐ้กถ้ƒจ",children:[e.jsxs("svg",{className:"absolute inset-0 h-full w-full -rotate-90 transform p-1",viewBox:"0 0 44 44",children:[e.jsx("circle",{className:"text-muted-foreground/10",strokeWidth:"3",stroke:"currentColor",fill:"transparent",r:h,cx:"22",cy:"22"}),e.jsx("circle",{className:"text-primary transition-all duration-100 ease-out",strokeWidth:"3",strokeDasharray:f,strokeDashoffset:p,strokeLinecap:"round",stroke:"currentColor",fill:"transparent",r:h,cx:"22",cy:"22"})]}),e.jsx(a1,{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"})]})})}function dT({children:a}){const{checking:l}=aT(),[r,c]=u.useState(!0),[d,m]=u.useState(!1),[h,f]=u.useState(!1),[p,g]=u.useState(!1),{theme:N,setTheme:j}=vx(),b=nw();if(u.useEffect(()=>{if(r)g(!1);else{const S=setTimeout(()=>{g(!0)},350);return()=>clearTimeout(S)}},[r]),u.useEffect(()=>{const S=F=>{(F.metaKey||F.ctrlKey)&&F.key==="k"&&(F.preventDefault(),f(!0))};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[]),l)return e.jsx("div",{className:"flex h-screen items-center justify-center bg-background",children:e.jsx("div",{className:"text-muted-foreground",children:"ๆญฃๅœจ้ชŒ่ฏ็™ปๅฝ•็Šถๆ€..."})});const y=[{title:"ๆฆ‚่งˆ",items:[{icon:id,label:"้ฆ–้กต",path:"/"}]},{title:"้บฆ้บฆ้…็ฝฎ็ผ–่พ‘",items:[{icon:Ua,label:"้บฆ้บฆไธป็จ‹ๅบ้…็ฝฎ",path:"/config/bot"},{icon:Hl,label:"AIๆจกๅž‹ๅŽ‚ๅ•†้…็ฝฎ",path:"/config/modelProvider",tourId:"sidebar-model-provider"},{icon:gv,label:"ๆจกๅž‹็ฎก็†ไธŽๅˆ†้…",path:"/config/model",tourId:"sidebar-model-management"},{icon:zg,label:"้บฆ้บฆ้€‚้…ๅ™จ้…็ฝฎ",path:"/config/adapter"}]},{title:"้บฆ้บฆ่ต„ๆบ็ฎก็†",items:[{icon:rd,label:"่กจๆƒ…ๅŒ…็ฎก็†",path:"/resource/emoji"},{icon:Ba,label:"่กจ่พพๆ–นๅผ็ฎก็†",path:"/resource/expression"},{icon:Wr,label:"้ป‘่ฏ็ฎก็†",path:"/resource/jargon"},{icon:jv,label:"ไบบ็‰ฉไฟกๆฏ็ฎก็†",path:"/resource/person"},{icon:xv,label:"็Ÿฅ่ฏ†ๅบ“ๅ›พ่ฐฑๅฏ่ง†ๅŒ–",path:"/resource/knowledge-graph"},{icon:Zr,label:"้บฆ้บฆ็Ÿฅ่ฏ†ๅบ“็ฎก็†",path:"/resource/knowledge-base"}]},{title:"ๆ‰ฉๅฑ•ไธŽ็›‘ๆŽง",items:[{icon:xa,label:"ๆ’ไปถๅธ‚ๅœบ",path:"/plugins"},{icon:fv,label:"้…็ฝฎๆจกๆฟๅธ‚ๅœบ",path:"/config/pack-market"},{icon:zg,label:"ๆ’ไปถ้…็ฝฎ",path:"/plugin-config"},{icon:ux,label:"ๆ—ฅๅฟ—ๆŸฅ็œ‹ๅ™จ",path:"/logs"},{icon:nx,label:"่ฎกๅˆ’ๅ™จ&ๅ›žๅคๅ™จ็›‘ๆŽง",path:"/planner-monitor"},{icon:Ba,label:"ๆœฌๅœฐ่Šๅคฉๅฎค",path:"/chat"}]},{title:"็ณป็ปŸ",items:[{icon:Sn,label:"็ณป็ปŸ่ฎพ็ฝฎ",path:"/settings"}]}],z=N==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":N,M=async()=>{await I1()};return e.jsx(Zv,{delayDuration:300,children:e.jsxs("div",{className:"flex h-screen overflow-hidden",children:[e.jsxs("aside",{className:P("fixed inset-y-0 left-0 z-50 flex flex-col border-r bg-card transition-all duration-300 lg:relative lg:z-0","w-64 lg:w-auto",r?"lg:w-64":"lg:w-16",d?"translate-x-0":"-translate-x-full lg:translate-x-0"),children:[e.jsx("div",{className:"flex h-16 items-center border-b px-4",children:e.jsxs("div",{className:P("relative flex items-center justify-center flex-1 transition-all overflow-hidden","lg:flex-1",!r&&"lg:flex-none lg:w-8"),children:[e.jsxs("div",{className:P("flex items-baseline gap-2",!r&&"lg:hidden"),children:[e.jsx("span",{className:"font-bold text-xl text-primary-gradient whitespace-nowrap",children:"MaiBot WebUI"}),e.jsx("span",{className:"text-xs text-primary/60 whitespace-nowrap",children:v2()})]}),!r&&e.jsx("span",{className:"hidden lg:block font-bold text-primary-gradient text-2xl",children:"M"})]})}),e.jsx(ts,{className:P("flex-1 overflow-x-hidden",!r&&"lg:w-16"),children:e.jsx("nav",{className:P("p-4",!r&&"lg:p-2 lg:w-16"),children:e.jsx("ul",{className:P("space-y-6",!r&&"lg:space-y-3 lg:w-full"),children:y.map((S,F)=>e.jsxs("li",{children:[e.jsx("div",{className:P("px-3 h-[1.25rem]","mb-2",!r&&"lg:mb-1 lg:invisible"),children:e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground/60 whitespace-nowrap",children:S.title})}),!r&&F>0&&e.jsx("div",{className:"hidden lg:block mb-2 border-t border-border"}),e.jsx("ul",{className:"space-y-1",children:S.items.map(E=>{const C=b({to:E.path}),R=E.icon,H=e.jsxs(e.Fragment,{children:[C&&e.jsx("div",{className:"absolute left-0 top-1/2 h-8 w-1 -translate-y-1/2 rounded-r-full bg-primary transition-opacity duration-300"}),e.jsxs("div",{className:P("flex items-center transition-all duration-300",r?"gap-3":"gap-3 lg:gap-0"),children:[e.jsx(R,{className:P("h-5 w-5 flex-shrink-0",C&&"text-primary"),strokeWidth:2,fill:"none"}),e.jsx("span",{className:P("text-sm font-medium whitespace-nowrap transition-all duration-300",C&&"font-semibold",r?"opacity-100 max-w-[200px]":"opacity-100 max-w-[200px] lg:opacity-0 lg:max-w-0 lg:overflow-hidden"),children:E.label})]})]});return e.jsx("li",{className:"relative",children:e.jsxs(Wv,{children:[e.jsx(eN,{asChild:!0,children:e.jsx(Kn,{to:E.path,"data-tour":E.tourId,className:P("relative flex items-center rounded-lg py-2 transition-all duration-300","hover:bg-accent hover:text-accent-foreground",C?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground",r?"px-3":"px-3 lg:px-0 lg:justify-center lg:w-12 lg:mx-auto"),onClick:()=>m(!1),children:H})}),p&&e.jsx(Tx,{side:"right",className:"hidden lg:block",children:e.jsx("p",{children:E.label})})]})},E.path)})})]},S.title))})})})]}),d&&e.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 lg:hidden",onClick:()=>m(!1)}),e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[e.jsx(cT,{}),e.jsxs("header",{className:"flex h-16 items-center justify-between border-b bg-card/80 backdrop-blur-md px-4 sticky top-0 z-10",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("button",{onClick:()=>m(!d),className:"rounded-lg p-2 hover:bg-accent lg:hidden",children:e.jsx(l1,{className:"h-5 w-5"})}),e.jsx("button",{onClick:()=>c(!r),className:"hidden rounded-lg p-2 hover:bg-accent lg:block",title:r?"ๆ”ถ่ตทไพง่พนๆ ":"ๅฑ•ๅผ€ไพง่พนๆ ",children:e.jsx(Pa,{className:P("h-5 w-5 transition-transform",!r&&"rotate-180")})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Kn,{to:"/annual-report",children:e.jsxs(_,{variant:"ghost",size:"sm",className:"gap-2 bg-gradient-to-r from-pink-500/10 to-purple-500/10 hover:from-pink-500/20 hover:to-purple-500/20 border border-pink-500/20",title:"ๆŸฅ็œ‹ๅนดๅบฆๆ€ป็ป“",children:[e.jsx(n1,{className:"h-4 w-4 text-pink-500"}),e.jsx("span",{className:"hidden sm:inline bg-gradient-to-r from-pink-500 to-purple-500 bg-clip-text text-transparent font-medium",children:"2025 ๅนดๅบฆๆ€ป็ป“"})]})}),e.jsxs("button",{onClick:()=>f(!0),className:"relative hidden md:flex items-center w-64 h-9 pl-9 pr-16 bg-background/50 border rounded-md hover:bg-accent/50 transition-colors text-left",children:[e.jsx($t,{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($b,{size:"sm",className:"absolute right-2 top-1/2 -translate-y-1/2",children:[e.jsx("span",{className:"text-xs",children:"โŒ˜"}),"K"]})]}),e.jsx(iT,{open:h,onOpenChange:f}),e.jsxs(_,{variant:"ghost",size:"sm",onClick:()=>window.open("https://docs.mai-mai.org","_blank"),className:"gap-2",title:"ๆŸฅ็œ‹้บฆ้บฆๆ–‡ๆกฃ",children:[e.jsx(r1,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"้บฆ้บฆๆ–‡ๆกฃ"})]}),e.jsx("button",{onClick:S=>{h2(z==="dark"?"light":"dark",j,S)},className:"rounded-lg p-2 hover:bg-accent",title:z==="dark"?"ๅˆ‡ๆขๅˆฐๆต…่‰ฒๆจกๅผ":"ๅˆ‡ๆขๅˆฐๆทฑ่‰ฒๆจกๅผ",children:z==="dark"?e.jsx(ix,{className:"h-5 w-5"}):e.jsx(tc,{className:"h-5 w-5"})}),e.jsx("div",{className:"h-6 w-px bg-border"}),e.jsxs(_,{variant:"ghost",size:"sm",onClick:M,className:"gap-2",title:"็™ปๅ‡บ็ณป็ปŸ",children:[e.jsx(i1,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"็™ปๅ‡บ"})]})]})]}),e.jsx("main",{className:"flex-1 overflow-hidden bg-background",children:a}),e.jsx(oT,{})]})]})})}function uT(a){const l=a.split(` `).slice(1),r=[];for(const c of l){const d=c.trim();if(!d.startsWith("at "))continue;const m=d.match(/at\s+(?:(.+?)\s+\()?(.+?):(\d+):(\d+)\)?$/);m?r.push({functionName:m[1]||"",fileName:m[2],lineNumber:m[3],columnNumber:m[4],raw:d}):r.push({functionName:"",fileName:"",lineNumber:"",columnNumber:"",raw:d})}return r}function mT({error:a,errorInfo:l}){const[r,c]=u.useState(!0),[d,m]=u.useState(!1),[h,f]=u.useState(!1),p=a.stack?uT(a.stack):[],g=async()=>{const N=` Error: ${a.name} Message: ${a.message} @@ -91,4 +91,4 @@ ${l?.componentStack||"No component stack available"} URL: ${window.location.href} User Agent: ${navigator.userAgent} Time: ${new Date().toISOString()} - `.trim();try{await navigator.clipboard.writeText(N),f(!0),setTimeout(()=>f(!1),2e3)}catch(j){console.error("Failed to copy:",j)}};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs(ht,{variant:"destructive",className:"border-red-500/50 bg-red-500/10",children:[e.jsx(Lt,{className:"h-4 w-4"}),e.jsxs(ft,{className:"font-mono text-sm",children:[e.jsxs("span",{className:"font-semibold",children:[a.name,":"]})," ",a.message]})]}),p.length>0&&e.jsxs(xc,{open:r,onOpenChange:c,children:[e.jsx(hc,{asChild:!0,children:e.jsxs(_,{variant:"ghost",className:"w-full justify-between p-3 h-auto",children:[e.jsxs("span",{className:"font-semibold text-sm flex items-center gap-2",children:[e.jsx(c_,{className:"h-4 w-4"}),"Stack Trace (",p.length," frames)"]}),r?e.jsx(Xr,{className:"h-4 w-4"}):e.jsx(Ba,{className:"h-4 w-4"})]})}),e.jsx(fc,{children:e.jsx(ts,{className:"h-[280px] rounded-md border bg-muted/30",children:e.jsx("div",{className:"p-3 space-y-1",children:p.map((N,j)=>e.jsx("div",{className:"font-mono text-xs p-2 rounded hover:bg-muted/50 transition-colors",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsxs("span",{className:"text-muted-foreground w-6 text-right flex-shrink-0",children:[j+1,"."]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"text-primary font-medium",children:N.functionName}),N.fileName&&e.jsxs("div",{className:"text-muted-foreground mt-0.5 break-all",children:[N.fileName,N.lineNumber&&e.jsxs("span",{className:"text-yellow-600 dark:text-yellow-400",children:[":",N.lineNumber,":",N.columnNumber]})]})]})]})},j))})})})]}),l?.componentStack&&e.jsxs(xc,{open:d,onOpenChange:m,children:[e.jsx(hc,{asChild:!0,children:e.jsxs(_,{variant:"ghost",className:"w-full justify-between p-3 h-auto",children:[e.jsxs("span",{className:"font-semibold text-sm flex items-center gap-2",children:[e.jsx(Lt,{className:"h-4 w-4"}),"Component Stack"]}),d?e.jsx(Xr,{className:"h-4 w-4"}):e.jsx(Ba,{className:"h-4 w-4"})]})}),e.jsx(fc,{children:e.jsx(ts,{className:"h-[200px] rounded-md border bg-muted/30",children:e.jsx("pre",{className:"p-3 font-mono text-xs whitespace-pre-wrap text-muted-foreground",children:l.componentStack})})})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:g,className:"w-full",children:h?e.jsxs(e.Fragment,{children:[e.jsx(Ot,{className:"mr-2 h-4 w-4 text-green-500"}),"ๅทฒๅคๅˆถๅˆฐๅ‰ช่ดดๆฟ"]}):e.jsxs(e.Fragment,{children:[e.jsx(qo,{className:"mr-2 h-4 w-4"}),"ๅคๅˆถ้”™่ฏฏไฟกๆฏ"]})})]})}function Bb({error:a,errorInfo:l}){const r=()=>{window.location.href="/"},c=()=>{window.location.reload()};return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:e.jsxs(Te,{className:"w-full max-w-2xl shadow-lg",children:[e.jsxs(Oe,{className:"text-center pb-2",children:[e.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-full bg-red-100 dark:bg-red-900/30 mb-4",children:e.jsx(Lt,{className:"h-8 w-8 text-red-600 dark:text-red-400"})}),e.jsx(Ue,{className:"text-2xl font-bold",children:"้กต้ขๅ‡บ็Žฐไบ†้—ฎ้ข˜"}),e.jsx(Ns,{className:"text-base mt-2",children:"ๅบ”็”จ็จ‹ๅบ้‡ๅˆฐไบ†ๆ„ๅค–้”™่ฏฏใ€‚ๆ‚จๅฏไปฅๅฐ่ฏ•ๅˆทๆ–ฐ้กต้ขๆˆ–่ฟ”ๅ›ž้ฆ–้กตใ€‚"})]}),e.jsxs(ze,{className:"space-y-4",children:[e.jsx(mT,{error:a,errorInfo:l}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 pt-2",children:[e.jsxs(_,{onClick:c,className:"flex-1",children:[e.jsx(dt,{className:"mr-2 h-4 w-4"}),"ๅˆทๆ–ฐ้กต้ข"]}),e.jsxs(_,{onClick:r,variant:"outline",className:"flex-1",children:[e.jsx(id,{className:"mr-2 h-4 w-4"}),"่ฟ”ๅ›ž้ฆ–้กต"]})]}),e.jsx("p",{className:"text-xs text-center text-muted-foreground pt-2",children:"ๅฆ‚ๆžœ้—ฎ้ข˜ๆŒ็ปญๅญ˜ๅœจ๏ผŒ่ฏทๅฐ†้”™่ฏฏไฟกๆฏๅคๅˆถๅนถๅ้ฆˆ็ป™ๅผ€ๅ‘่€…"})]})]})})}class xT extends u.Component{constructor(l){super(l),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(l){return{hasError:!0,error:l}}componentDidCatch(l,r){console.error("ErrorBoundary caught an error:",l,r),this.setState({errorInfo:r})}handleReset=()=>{this.setState({hasError:!1,error:null,errorInfo:null})};render(){return this.state.hasError&&this.state.error?this.props.fallback?this.props.fallback:e.jsx(Bb,{error:this.state.error,errorInfo:this.state.errorInfo}):this.props.children}}function Ib({error:a}){return e.jsx(Bb,{error:a,errorInfo:null})}const bc=rw({component:()=>e.jsxs(e.Fragment,{children:[e.jsx(xj,{}),!1]}),beforeLoad:()=>{if(window.location.pathname==="/"&&!lT())throw cw({to:"/auth"})}}),hT=lt({getParentRoute:()=>bc,path:"/auth",component:O2}),fT=lt({getParentRoute:()=>bc,path:"/setup",component:X2}),Nt=lt({getParentRoute:()=>bc,id:"protected",component:()=>e.jsx(dT,{children:e.jsx(xj,{})}),errorComponent:({error:a})=>e.jsx(Ib,{error:a})}),pT=lt({getParentRoute:()=>Nt,path:"/",component:d2}),gT=lt({getParentRoute:()=>Nt,path:"/config/bot",component:YS}),jT=lt({getParentRoute:()=>Nt,path:"/config/modelProvider",component:i4}),vT=lt({getParentRoute:()=>Nt,path:"/config/model",component:z4}),NT=lt({getParentRoute:()=>Nt,path:"/config/adapter",component:L4}),bT=lt({getParentRoute:()=>Nt,path:"/resource/emoji",component:nk}),yT=lt({getParentRoute:()=>Nt,path:"/resource/expression",component:ok}),wT=lt({getParentRoute:()=>Nt,path:"/resource/person",component:Rk}),_T=lt({getParentRoute:()=>Nt,path:"/resource/jargon",component:wk}),ST=lt({getParentRoute:()=>Nt,path:"/resource/knowledge-graph",component:Fk}),kT=lt({getParentRoute:()=>Nt,path:"/resource/knowledge-base",component:Hk}),CT=lt({getParentRoute:()=>Nt,path:"/logs",component:Vk}),TT=lt({getParentRoute:()=>Nt,path:"/planner-monitor",component:eC}),ET=lt({getParentRoute:()=>Nt,path:"/chat",component:BC}),MT=lt({getParentRoute:()=>Nt,path:"/plugins",component:NC}),AT=lt({getParentRoute:()=>Nt,path:"/plugin-detail",component:MC}),zT=lt({getParentRoute:()=>Nt,path:"/model-presets",component:yC}),RT=lt({getParentRoute:()=>Nt,path:"/plugin-config",component:SC}),DT=lt({getParentRoute:()=>Nt,path:"/plugin-mirrors",component:CC}),OT=lt({getParentRoute:()=>Nt,path:"/settings",component:T2}),LT=lt({getParentRoute:()=>Nt,path:"/config/pack-market",component:$5}),Pb=lt({getParentRoute:()=>Nt,path:"/config/pack-market/$packId",component:eT}),UT=lt({getParentRoute:()=>Nt,path:"/survey/webui-feedback",component:s3}),$T=lt({getParentRoute:()=>Nt,path:"/survey/maibot-feedback",component:t3}),BT=lt({getParentRoute:()=>Nt,path:"/annual-report",component:c5}),IT=lt({getParentRoute:()=>bc,path:"*",component:Kv}),PT=bc.addChildren([hT,fT,Nt.addChildren([pT,gT,jT,vT,NT,bT,yT,_T,wT,ST,kT,MT,AT,zT,RT,DT,CT,TT,ET,OT,LT,Pb,UT,$T,BT]),IT]),FT=iw({routeTree:PT,defaultNotFoundComponent:Kv,defaultErrorComponent:({error:a})=>e.jsx(Ib,{error:a})});function HT({children:a,defaultTheme:l="system",storageKey:r="ui-theme",...c}){const[d,m]=u.useState(()=>localStorage.getItem(r)||l);u.useEffect(()=>{const f=window.document.documentElement;if(f.classList.remove("light","dark"),d==="system"){const p=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";f.classList.add(p);return}f.classList.add(d)},[d]),u.useEffect(()=>{const f=localStorage.getItem("accent-color");if(f){const p=document.documentElement,N={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[f];N&&(p.style.setProperty("--primary",N.hsl),N.gradient?(p.style.setProperty("--primary-gradient",N.gradient),p.classList.add("has-gradient")):(p.style.removeProperty("--primary-gradient"),p.classList.remove("has-gradient")))}},[]);const h={theme:d,setTheme:f=>{localStorage.setItem(r,f),m(f)}};return e.jsx(Fv.Provider,{...c,value:h,children:a})}function qT({children:a,defaultEnabled:l=!0,defaultWavesEnabled:r=!0,storageKey:c="enable-animations",wavesStorageKey:d="enable-waves-background"}){const[m,h]=u.useState(()=>{const N=localStorage.getItem(c);return N!==null?N==="true":l}),[f,p]=u.useState(()=>{const N=localStorage.getItem(d);return N!==null?N==="true":r});u.useEffect(()=>{const N=document.documentElement;m?N.classList.remove("no-animations"):N.classList.add("no-animations"),localStorage.setItem(c,String(m))},[m,c]),u.useEffect(()=>{localStorage.setItem(d,String(f))},[f,d]);const g={enableAnimations:m,setEnableAnimations:h,enableWavesBackground:f,setEnableWavesBackground:p};return e.jsx(Hv.Provider,{value:g,children:a})}function VT(a){const[l,r]=u.useState(()=>typeof window<"u"?window.matchMedia(a).matches:!1);return u.useEffect(()=>{if(typeof window>"u")return;const c=window.matchMedia(a),d=m=>{r(m.matches)};return r(c.matches),c.addEventListener("change",d),()=>{c.removeEventListener("change",d)}},[a]),l}function Bx(){return VT("(max-width: 768px)")}const GT=k1,Fb=u.forwardRef(({className:a,...l},r)=>{const c=Bx();return e.jsx(ev,{ref:r,className:P("fixed z-[100] flex max-h-screen w-full gap-2 p-4",c?"top-0 left-0 right-0 flex-col items-center":"bottom-0 right-0 flex-col-reverse sm:max-w-[420px]",a),...l})});Fb.displayName=ev.displayName;const KT=ti("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",{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"},position:{desktop:"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",mobile:"data-[swipe=cancel]:translate-y-0 data-[swipe=end]:translate-y-[var(--radix-toast-swipe-end-y)] data-[swipe=move]:translate-y-[var(--radix-toast-swipe-move-y)] data-[swipe=move]:transition-none data-[state=open]:animate-slide-in-from-top data-[state=open]:animate-fade-in data-[state=closed]:animate-slide-out-to-top data-[state=closed]:animate-fade-out data-[swipe=end]:animate-slide-out-to-top"}},defaultVariants:{variant:"default",position:"desktop"}}),Hb=u.forwardRef(({className:a,variant:l,...r},c)=>{const m=Bx()?"mobile":"desktop";return e.jsx(sv,{ref:c,className:P(KT({variant:l,position:m}),a),...r})});Hb.displayName=sv.displayName;const QT=u.forwardRef(({className:a,...l},r)=>e.jsx(tv,{ref:r,className:P("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",a),...l}));QT.displayName=tv.displayName;const qb=u.forwardRef(({className:a,...l},r)=>e.jsx(av,{ref:r,className:P("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",a),"toast-close":"",...l,children:e.jsx(Sa,{className:"h-4 w-4"})}));qb.displayName=av.displayName;const Vb=u.forwardRef(({className:a,...l},r)=>e.jsx(lv,{ref:r,className:P("text-sm font-semibold [&+div]:text-xs",a),...l}));Vb.displayName=lv.displayName;const Gb=u.forwardRef(({className:a,...l},r)=>e.jsx(nv,{ref:r,className:P("text-sm opacity-90",a),...l}));Gb.displayName=nv.displayName;function YT(){const{toasts:a}=nt(),l=Bx();return e.jsxs(GT,{swipeDirection:l?"up":"right",children:[a.map(function({id:r,title:c,description:d,action:m,...h}){return e.jsxs(Hb,{...h,children:[e.jsxs("div",{className:"grid gap-1",children:[c&&e.jsx(Vb,{children:c}),d&&e.jsx(Gb,{children:d})]}),m,e.jsx(qb,{})]},r)}),e.jsx(Fb,{})]})}$_.createRoot(document.getElementById("root")).render(e.jsx(u.StrictMode,{children:e.jsx(xT,{children:e.jsx(HT,{defaultTheme:"system",children:e.jsx(qT,{children:e.jsxs(s4,{children:[e.jsx(ow,{router:FT}),e.jsx(l4,{}),e.jsx(YT,{})]})})})})})); + `.trim();try{await navigator.clipboard.writeText(N),f(!0),setTimeout(()=>f(!1),2e3)}catch(j){console.error("Failed to copy:",j)}};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs(ht,{variant:"destructive",className:"border-red-500/50 bg-red-500/10",children:[e.jsx(Lt,{className:"h-4 w-4"}),e.jsxs(ft,{className:"font-mono text-sm",children:[e.jsxs("span",{className:"font-semibold",children:[a.name,":"]})," ",a.message]})]}),p.length>0&&e.jsxs(xc,{open:r,onOpenChange:c,children:[e.jsx(hc,{asChild:!0,children:e.jsxs(_,{variant:"ghost",className:"w-full justify-between p-3 h-auto",children:[e.jsxs("span",{className:"font-semibold text-sm flex items-center gap-2",children:[e.jsx(c1,{className:"h-4 w-4"}),"Stack Trace (",p.length," frames)"]}),r?e.jsx(Xr,{className:"h-4 w-4"}):e.jsx(Ia,{className:"h-4 w-4"})]})}),e.jsx(fc,{children:e.jsx(ts,{className:"h-[280px] rounded-md border bg-muted/30",children:e.jsx("div",{className:"p-3 space-y-1",children:p.map((N,j)=>e.jsx("div",{className:"font-mono text-xs p-2 rounded hover:bg-muted/50 transition-colors",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsxs("span",{className:"text-muted-foreground w-6 text-right flex-shrink-0",children:[j+1,"."]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"text-primary font-medium",children:N.functionName}),N.fileName&&e.jsxs("div",{className:"text-muted-foreground mt-0.5 break-all",children:[N.fileName,N.lineNumber&&e.jsxs("span",{className:"text-yellow-600 dark:text-yellow-400",children:[":",N.lineNumber,":",N.columnNumber]})]})]})]})},j))})})})]}),l?.componentStack&&e.jsxs(xc,{open:d,onOpenChange:m,children:[e.jsx(hc,{asChild:!0,children:e.jsxs(_,{variant:"ghost",className:"w-full justify-between p-3 h-auto",children:[e.jsxs("span",{className:"font-semibold text-sm flex items-center gap-2",children:[e.jsx(Lt,{className:"h-4 w-4"}),"Component Stack"]}),d?e.jsx(Xr,{className:"h-4 w-4"}):e.jsx(Ia,{className:"h-4 w-4"})]})}),e.jsx(fc,{children:e.jsx(ts,{className:"h-[200px] rounded-md border bg-muted/30",children:e.jsx("pre",{className:"p-3 font-mono text-xs whitespace-pre-wrap text-muted-foreground",children:l.componentStack})})})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:g,className:"w-full",children:h?e.jsxs(e.Fragment,{children:[e.jsx(Ot,{className:"mr-2 h-4 w-4 text-green-500"}),"ๅทฒๅคๅˆถๅˆฐๅ‰ช่ดดๆฟ"]}):e.jsxs(e.Fragment,{children:[e.jsx(qo,{className:"mr-2 h-4 w-4"}),"ๅคๅˆถ้”™่ฏฏไฟกๆฏ"]})})]})}function Ib({error:a,errorInfo:l}){const r=()=>{window.location.href="/"},c=()=>{window.location.reload()};return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:e.jsxs(Te,{className:"w-full max-w-2xl shadow-lg",children:[e.jsxs(Oe,{className:"text-center pb-2",children:[e.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-full bg-red-100 dark:bg-red-900/30 mb-4",children:e.jsx(Lt,{className:"h-8 w-8 text-red-600 dark:text-red-400"})}),e.jsx(Ue,{className:"text-2xl font-bold",children:"้กต้ขๅ‡บ็Žฐไบ†้—ฎ้ข˜"}),e.jsx(Ns,{className:"text-base mt-2",children:"ๅบ”็”จ็จ‹ๅบ้‡ๅˆฐไบ†ๆ„ๅค–้”™่ฏฏใ€‚ๆ‚จๅฏไปฅๅฐ่ฏ•ๅˆทๆ–ฐ้กต้ขๆˆ–่ฟ”ๅ›ž้ฆ–้กตใ€‚"})]}),e.jsxs(ze,{className:"space-y-4",children:[e.jsx(mT,{error:a,errorInfo:l}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 pt-2",children:[e.jsxs(_,{onClick:c,className:"flex-1",children:[e.jsx(dt,{className:"mr-2 h-4 w-4"}),"ๅˆทๆ–ฐ้กต้ข"]}),e.jsxs(_,{onClick:r,variant:"outline",className:"flex-1",children:[e.jsx(id,{className:"mr-2 h-4 w-4"}),"่ฟ”ๅ›ž้ฆ–้กต"]})]}),e.jsx("p",{className:"text-xs text-center text-muted-foreground pt-2",children:"ๅฆ‚ๆžœ้—ฎ้ข˜ๆŒ็ปญๅญ˜ๅœจ๏ผŒ่ฏทๅฐ†้”™่ฏฏไฟกๆฏๅคๅˆถๅนถๅ้ฆˆ็ป™ๅผ€ๅ‘่€…"})]})]})})}class xT extends u.Component{constructor(l){super(l),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(l){return{hasError:!0,error:l}}componentDidCatch(l,r){console.error("ErrorBoundary caught an error:",l,r),this.setState({errorInfo:r})}handleReset=()=>{this.setState({hasError:!1,error:null,errorInfo:null})};render(){return this.state.hasError&&this.state.error?this.props.fallback?this.props.fallback:e.jsx(Ib,{error:this.state.error,errorInfo:this.state.errorInfo}):this.props.children}}function Bb({error:a}){return e.jsx(Ib,{error:a,errorInfo:null})}const bc=rw({component:()=>e.jsxs(e.Fragment,{children:[e.jsx(xj,{}),!1]}),beforeLoad:()=>{if(window.location.pathname==="/"&&!lT())throw cw({to:"/auth"})}}),hT=lt({getParentRoute:()=>bc,path:"/auth",component:O2}),fT=lt({getParentRoute:()=>bc,path:"/setup",component:X2}),Nt=lt({getParentRoute:()=>bc,id:"protected",component:()=>e.jsx(dT,{children:e.jsx(xj,{})}),errorComponent:({error:a})=>e.jsx(Bb,{error:a})}),pT=lt({getParentRoute:()=>Nt,path:"/",component:d2}),gT=lt({getParentRoute:()=>Nt,path:"/config/bot",component:YS}),jT=lt({getParentRoute:()=>Nt,path:"/config/modelProvider",component:i4}),vT=lt({getParentRoute:()=>Nt,path:"/config/model",component:z4}),NT=lt({getParentRoute:()=>Nt,path:"/config/adapter",component:L4}),bT=lt({getParentRoute:()=>Nt,path:"/resource/emoji",component:nk}),yT=lt({getParentRoute:()=>Nt,path:"/resource/expression",component:ok}),wT=lt({getParentRoute:()=>Nt,path:"/resource/person",component:Rk}),_T=lt({getParentRoute:()=>Nt,path:"/resource/jargon",component:wk}),ST=lt({getParentRoute:()=>Nt,path:"/resource/knowledge-graph",component:Fk}),kT=lt({getParentRoute:()=>Nt,path:"/resource/knowledge-base",component:Hk}),CT=lt({getParentRoute:()=>Nt,path:"/logs",component:Vk}),TT=lt({getParentRoute:()=>Nt,path:"/planner-monitor",component:eC}),ET=lt({getParentRoute:()=>Nt,path:"/chat",component:IC}),MT=lt({getParentRoute:()=>Nt,path:"/plugins",component:NC}),AT=lt({getParentRoute:()=>Nt,path:"/plugin-detail",component:MC}),zT=lt({getParentRoute:()=>Nt,path:"/model-presets",component:yC}),RT=lt({getParentRoute:()=>Nt,path:"/plugin-config",component:SC}),DT=lt({getParentRoute:()=>Nt,path:"/plugin-mirrors",component:CC}),OT=lt({getParentRoute:()=>Nt,path:"/settings",component:T2}),LT=lt({getParentRoute:()=>Nt,path:"/config/pack-market",component:$5}),Pb=lt({getParentRoute:()=>Nt,path:"/config/pack-market/$packId",component:eT}),UT=lt({getParentRoute:()=>Nt,path:"/survey/webui-feedback",component:s3}),$T=lt({getParentRoute:()=>Nt,path:"/survey/maibot-feedback",component:t3}),IT=lt({getParentRoute:()=>Nt,path:"/annual-report",component:c5}),BT=lt({getParentRoute:()=>bc,path:"*",component:Kv}),PT=bc.addChildren([hT,fT,Nt.addChildren([pT,gT,jT,vT,NT,bT,yT,_T,wT,ST,kT,MT,AT,zT,RT,DT,CT,TT,ET,OT,LT,Pb,UT,$T,IT]),BT]),FT=iw({routeTree:PT,defaultNotFoundComponent:Kv,defaultErrorComponent:({error:a})=>e.jsx(Bb,{error:a})});function HT({children:a,defaultTheme:l="system",storageKey:r="ui-theme",...c}){const[d,m]=u.useState(()=>localStorage.getItem(r)||l);u.useEffect(()=>{const f=window.document.documentElement;if(f.classList.remove("light","dark"),d==="system"){const p=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";f.classList.add(p);return}f.classList.add(d)},[d]),u.useEffect(()=>{const f=localStorage.getItem("accent-color");if(f){const p=document.documentElement,N={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[f];N&&(p.style.setProperty("--primary",N.hsl),N.gradient?(p.style.setProperty("--primary-gradient",N.gradient),p.classList.add("has-gradient")):(p.style.removeProperty("--primary-gradient"),p.classList.remove("has-gradient")))}},[]);const h={theme:d,setTheme:f=>{localStorage.setItem(r,f),m(f)}};return e.jsx(Fv.Provider,{...c,value:h,children:a})}function qT({children:a,defaultEnabled:l=!0,defaultWavesEnabled:r=!0,storageKey:c="enable-animations",wavesStorageKey:d="enable-waves-background"}){const[m,h]=u.useState(()=>{const N=localStorage.getItem(c);return N!==null?N==="true":l}),[f,p]=u.useState(()=>{const N=localStorage.getItem(d);return N!==null?N==="true":r});u.useEffect(()=>{const N=document.documentElement;m?N.classList.remove("no-animations"):N.classList.add("no-animations"),localStorage.setItem(c,String(m))},[m,c]),u.useEffect(()=>{localStorage.setItem(d,String(f))},[f,d]);const g={enableAnimations:m,setEnableAnimations:h,enableWavesBackground:f,setEnableWavesBackground:p};return e.jsx(Hv.Provider,{value:g,children:a})}function VT(a){const[l,r]=u.useState(()=>typeof window<"u"?window.matchMedia(a).matches:!1);return u.useEffect(()=>{if(typeof window>"u")return;const c=window.matchMedia(a),d=m=>{r(m.matches)};return r(c.matches),c.addEventListener("change",d),()=>{c.removeEventListener("change",d)}},[a]),l}function Ix(){return VT("(max-width: 768px)")}const GT=k_,Fb=u.forwardRef(({className:a,...l},r)=>{const c=Ix();return e.jsx(ev,{ref:r,className:P("fixed z-[100] flex max-h-screen w-full gap-2 p-4",c?"top-0 left-0 right-0 flex-col items-center":"bottom-0 right-0 flex-col-reverse sm:max-w-[420px]",a),...l})});Fb.displayName=ev.displayName;const KT=ti("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",{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"},position:{desktop:"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",mobile:"data-[swipe=cancel]:translate-y-0 data-[swipe=end]:translate-y-[var(--radix-toast-swipe-end-y)] data-[swipe=move]:translate-y-[var(--radix-toast-swipe-move-y)] data-[swipe=move]:transition-none data-[state=open]:animate-slide-in-from-top data-[state=open]:animate-fade-in data-[state=closed]:animate-slide-out-to-top data-[state=closed]:animate-fade-out data-[swipe=end]:animate-slide-out-to-top"}},defaultVariants:{variant:"default",position:"desktop"}}),Hb=u.forwardRef(({className:a,variant:l,...r},c)=>{const m=Ix()?"mobile":"desktop";return e.jsx(sv,{ref:c,className:P(KT({variant:l,position:m}),a),...r})});Hb.displayName=sv.displayName;const QT=u.forwardRef(({className:a,...l},r)=>e.jsx(tv,{ref:r,className:P("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",a),...l}));QT.displayName=tv.displayName;const qb=u.forwardRef(({className:a,...l},r)=>e.jsx(av,{ref:r,className:P("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",a),"toast-close":"",...l,children:e.jsx(Sa,{className:"h-4 w-4"})}));qb.displayName=av.displayName;const Vb=u.forwardRef(({className:a,...l},r)=>e.jsx(lv,{ref:r,className:P("text-sm font-semibold [&+div]:text-xs",a),...l}));Vb.displayName=lv.displayName;const Gb=u.forwardRef(({className:a,...l},r)=>e.jsx(nv,{ref:r,className:P("text-sm opacity-90",a),...l}));Gb.displayName=nv.displayName;function YT(){const{toasts:a}=nt(),l=Ix();return e.jsxs(GT,{swipeDirection:l?"up":"right",children:[a.map(function({id:r,title:c,description:d,action:m,...h}){return e.jsxs(Hb,{...h,children:[e.jsxs("div",{className:"grid gap-1",children:[c&&e.jsx(Vb,{children:c}),d&&e.jsx(Gb,{children:d})]}),m,e.jsx(qb,{})]},r)}),e.jsx(Fb,{})]})}$1.createRoot(document.getElementById("root")).render(e.jsx(u.StrictMode,{children:e.jsx(xT,{children:e.jsx(HT,{defaultTheme:"system",children:e.jsx(qT,{children:e.jsxs(s4,{children:[e.jsx(ow,{router:FT}),e.jsx(l4,{}),e.jsx(YT,{})]})})})})})); diff --git a/webui/dist/assets/index-DkXVyv8m.css b/webui/dist/assets/index-DkXVyv8m.css new file mode 100644 index 00000000..bd22771f --- /dev/null +++ b/webui/dist/assets/index-DkXVyv8m.css @@ -0,0 +1 @@ +@charset "UTF-8";*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background: 0 0% 100%;--foreground: 222.2 84% 4.9%;--card: 0 0% 100%;--card-foreground: 222.2 84% 4.9%;--popover: 0 0% 100%;--popover-foreground: 222.2 84% 4.9%;--primary: 221.2 83.2% 53.3%;--primary-foreground: 210 40% 98%;--primary-gradient: none;--secondary: 210 40% 96.1%;--secondary-foreground: 222.2 47.4% 11.2%;--muted: 210 40% 96.1%;--muted-foreground: 215.4 16.3% 46.9%;--accent: 210 40% 96.1%;--accent-foreground: 222.2 47.4% 11.2%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 210 40% 98%;--border: 214.3 31.8% 91.4%;--input: 214.3 31.8% 91.4%;--ring: 221.2 83.2% 53.3%;--radius: .5rem;--chart-1: 221.2 83.2% 53.3%;--chart-2: 160 60% 45%;--chart-3: 30 80% 55%;--chart-4: 280 65% 60%;--chart-5: 340 75% 55%}.dark{--background: 222.2 84% 4.9%;--foreground: 210 40% 98%;--card: 222.2 84% 4.9%;--card-foreground: 210 40% 98%;--popover: 222.2 84% 4.9%;--popover-foreground: 210 40% 98%;--primary: 217.2 91.2% 59.8%;--primary-foreground: 210 40% 98%;--primary-gradient: none;--secondary: 217.2 32.6% 17.5%;--secondary-foreground: 210 40% 98%;--muted: 217.2 32.6% 17.5%;--muted-foreground: 215 20.2% 65.1%;--accent: 217.2 32.6% 17.5%;--accent-foreground: 210 40% 98%;--destructive: 0 62.8% 30.6%;--destructive-foreground: 210 40% 98%;--border: 217.2 32.6% 17.5%;--input: 217.2 32.6% 17.5%;--ring: 224.3 76.3% 48%;--chart-1: 217.2 91.2% 59.8%;--chart-2: 160 60% 50%;--chart-3: 30 80% 60%;--chart-4: 280 65% 65%;--chart-5: 340 75% 60%}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield;-webkit-appearance:textfield;appearance:textfield}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:640px}}@media(min-width:768px){.\!container{max-width:768px!important}.container{max-width:768px}}@media(min-width:1024px){.\!container{max-width:1024px!important}.container{max-width:1024px}}@media(min-width:1280px){.\!container{max-width:1280px!important}.container{max-width:1280px}}@media(min-width:1536px){.\!container{max-width:1536px!important}.container{max-width:1536px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.invisible{visibility:hidden}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-16{inset:4rem}.inset-8{inset:2rem}.inset-x-0{left:0;right:0}.inset-x-4{left:1rem;right:1rem}.inset-y-0{top:0;bottom:0}.-bottom-20{bottom:-5rem}.-left-20{left:-5rem}.-right-2{right:-.5rem}.-right-20{right:-5rem}.-top-2{top:-.5rem}.-top-20{top:-5rem}.bottom-0{bottom:0}.bottom-1\/4{bottom:25%}.bottom-24{bottom:6rem}.bottom-4{bottom:1rem}.left-0{left:0}.left-1{left:.25rem}.left-1\/2{left:50%}.left-1\/4{left:25%}.left-2{left:.5rem}.left-2\.5{left:.625rem}.left-3{left:.75rem}.left-\[50\%\]{left:50%}.right-0{right:0}.right-1{right:.25rem}.right-1\.5{right:.375rem}.right-1\/3{right:33.333333%}.right-1\/4{right:25%}.right-2{right:.5rem}.right-4{right:1rem}.right-8{right:2rem}.top-0{top:0}.top-1{top:.25rem}.top-1\.5{top:.375rem}.top-1\/2{top:50%}.top-1\/4{top:25%}.top-2{top:.5rem}.top-2\.5{top:.625rem}.top-3{top:.75rem}.top-3\/4{top:75%}.top-4{top:1rem}.top-\[50\%\]{top:50%}.z-10{z-index:10}.z-20{z-index:20}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.order-1{order:1}.order-2{order:2}.col-span-1{grid-column:span 1 / span 1}.col-span-2{grid-column:span 2 / span 2}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.-mx-4{margin-left:-1rem;margin-right:-1rem}.mx-0{margin-left:0;margin-right:0}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-0\.5{margin-top:.125rem;margin-bottom:.125rem}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-3{margin-top:.75rem;margin-bottom:.75rem}.my-4{margin-top:1rem;margin-bottom:1rem}.-mt-1{margin-top:-.25rem}.-mt-2{margin-top:-.5rem}.-mt-4{margin-top:-1rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.mb-\[1px\]{margin-bottom:1px}.ml-0\.5{margin-left:.125rem}.ml-1{margin-left:.25rem}.ml-10{margin-left:2.5rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.ml-6{margin-left:1.5rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-1\.5{margin-right:.375rem}.mr-2{margin-right:.5rem}.mt-0{margin-top:0}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-12{margin-top:3rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.mt-auto{margin-top:auto}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-auto{aspect-ratio:auto}.aspect-square{aspect-ratio:1 / 1}.aspect-video{aspect-ratio:16 / 9}.size-4{width:1rem;height:1rem}.size-\[--cell-size\]{width:var(--cell-size);height:var(--cell-size)}.h-0\.5{height:.125rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-24{height:6rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-4{height:1rem}.h-40{height:10rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-60{height:15rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-96{height:24rem}.h-\[--cell-size\]{height:var(--cell-size)}.h-\[1\.25rem\]{height:1.25rem}.h-\[1px\]{height:1px}.h-\[200px\]{height:200px}.h-\[250px\]{height:250px}.h-\[280px\]{height:280px}.h-\[2px\]{height:2px}.h-\[300px\]{height:300px}.h-\[350px\]{height:350px}.h-\[400px\]{height:400px}.h-\[600px\]{height:600px}.h-\[70vh\]{height:70vh}.h-\[90vh\]{height:90vh}.h-\[calc\(100vh-12rem\)\]{height:calc(100vh - 12rem)}.h-\[calc\(100vh-200px\)\]{height:calc(100vh - 200px)}.h-\[calc\(100vh-240px\)\]{height:calc(100vh - 240px)}.h-\[calc\(100vh-260px\)\]{height:calc(100vh - 260px)}.h-\[calc\(100vh-4rem\)\]{height:calc(100vh - 4rem)}.h-\[calc\(85vh-220px\)\]{height:calc(85vh - 220px)}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-32{max-height:8rem}.max-h-64{max-height:16rem}.max-h-\[--radix-context-menu-content-available-height\]{max-height:var(--radix-context-menu-content-available-height)}.max-h-\[--radix-select-content-available-height\]{max-height:var(--radix-select-content-available-height)}.max-h-\[200px\]{max-height:200px}.max-h-\[300px\]{max-height:300px}.max-h-\[60vh\]{max-height:60vh}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[calc\(90vh-120px\)\]{max-height:calc(90vh - 120px)}.max-h-\[calc\(90vh-8rem\)\]{max-height:calc(90vh - 8rem)}.max-h-full{max-height:100%}.max-h-none{max-height:none}.max-h-screen{max-height:100vh}.min-h-0{min-height:0px}.min-h-10{min-height:2.5rem}.min-h-\[100px\]{min-height:100px}.min-h-\[300px\]{min-height:300px}.min-h-\[400px\]{min-height:400px}.min-h-\[40px\]{min-height:40px}.min-h-\[60px\]{min-height:60px}.min-h-\[xxx\]{min-height:xxx}.min-h-screen{min-height:100vh}.w-0{width:0px}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-2\/3{width:66.666667%}.w-20{width:5rem}.w-24{width:6rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-3\/4{width:75%}.w-32{width:8rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-\[--cell-size\]{width:var(--cell-size)}.w-\[100px\]{width:100px}.w-\[120px\]{width:120px}.w-\[130px\]{width:130px}.w-\[140px\]{width:140px}.w-\[1px\]{width:1px}.w-\[200px\]{width:200px}.w-\[600px\]{width:600px}.w-\[65px\]{width:65px}.w-\[70px\]{width:70px}.w-\[95vw\]{width:95vw}.w-auto{width:auto}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-\[--cell-size\]{min-width:var(--cell-size)}.min-w-\[100px\]{min-width:100px}.min-w-\[120px\]{min-width:120px}.min-w-\[140px\]{min-width:140px}.min-w-\[160px\]{min-width:160px}.min-w-\[200px\]{min-width:200px}.min-w-\[80px\]{min-width:80px}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.min-w-full{min-width:100%}.max-w-24{max-width:6rem}.max-w-2xl{max-width:42rem}.max-w-32{max-width:8rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-\[100px\]{max-width:100px}.max-w-\[120px\]{max-width:120px}.max-w-\[150px\]{max-width:150px}.max-w-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.max-w-\[60px\]{max-width:60px}.max-w-\[75\%\]{max-width:75%}.max-w-\[90\%\]{max-width:90%}.max-w-\[95vw\]{max-width:95vw}.max-w-\[var\(--max-width\)\]{max-width:var(--max-width)}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-none{flex:none}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.origin-\[--radix-context-menu-content-transform-origin\]{transform-origin:var(--radix-context-menu-content-transform-origin)}.origin-\[--radix-popover-content-transform-origin\]{transform-origin:var(--radix-popover-content-transform-origin)}.origin-\[--radix-select-content-transform-origin\]{transform-origin:var(--radix-select-content-transform-origin)}.origin-\[--radix-tooltip-content-transform-origin\]{transform-origin:var(--radix-tooltip-content-transform-origin)}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-x-full{--tw-translate-x: -100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-32{--tw-translate-x: 8rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rotate-90{--tw-rotate: -90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-110{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.animate-\[ping_3s_ease-in-out_infinite\]{animation:ping 3s ease-in-out infinite}.animate-\[ping_3s_ease-in-out_infinite_0\.5s\]{animation:ping 3s ease-in-out infinite .5s}.animate-\[ping_3s_ease-in-out_infinite_1s\]{animation:ping 3s ease-in-out infinite 1s}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.animate-bounce{animation:bounce 1s infinite}@keyframes ping{75%,to{transform:scale(2);opacity:0}}.animate-ping{animation:ping 1s cubic-bezier(0,0,.2,1) infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-help{cursor:help}.cursor-move{cursor:move}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.select-all{-webkit-user-select:all;-moz-user-select:all;user-select:all}.resize-none{resize:none}.resize{resize:both}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.break-inside-avoid{-moz-column-break-inside:avoid;break-inside:avoid}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-rows-\[auto_1fr_auto\]{grid-template-rows:auto 1fr auto}.flex-row{flex-direction:row}.flex-row-reverse{flex-direction:row-reverse}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.place-content-center{place-content:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.items-stretch{align-items:stretch}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-8{gap:2rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-3xl{border-radius:1.5rem}.rounded-\[2px\]{border-radius:2px}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-none{border-radius:0}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-l-md{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.rounded-r-full{border-top-right-radius:9999px;border-bottom-right-radius:9999px}.rounded-r-md{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.rounded-t-lg{border-top-left-radius:var(--radius);border-top-right-radius:var(--radius)}.rounded-tl-sm{border-top-left-radius:calc(var(--radius) - 4px)}.rounded-tr-sm{border-top-right-radius:calc(var(--radius) - 4px)}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-4{border-width:4px}.border-\[1\.5px\]{border-width:1.5px}.border-b{border-bottom-width:1px}.border-b-0{border-bottom-width:0px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-l-4{border-left-width:4px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[--color-border\]{border-color:var(--color-border)}.border-amber-200{--tw-border-opacity: 1;border-color:rgb(253 230 138 / var(--tw-border-opacity, 1))}.border-amber-500\/20{border-color:#f59e0b33}.border-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-500\/20{border-color:#f9731633}.border-orange-600{--tw-border-opacity: 1;border-color:rgb(234 88 12 / var(--tw-border-opacity, 1))}.border-pink-500\/20{border-color:#ec489933}.border-primary{border-color:hsl(var(--primary))}.border-primary\/10{border-color:hsl(var(--primary) / .1)}.border-primary\/20{border-color:hsl(var(--primary) / .2)}.border-primary\/30{border-color:hsl(var(--primary) / .3)}.border-primary\/50{border-color:hsl(var(--primary) / .5)}.border-purple-500{--tw-border-opacity: 1;border-color:rgb(168 85 247 / var(--tw-border-opacity, 1))}.border-red-200{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}.border-red-300{--tw-border-opacity: 1;border-color:rgb(252 165 165 / var(--tw-border-opacity, 1))}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-red-500\/50{border-color:#ef444480}.border-transparent{border-color:transparent}.border-white\/30{border-color:#ffffff4d}.border-yellow-200{--tw-border-opacity: 1;border-color:rgb(254 240 138 / var(--tw-border-opacity, 1))}.border-yellow-500\/50{border-color:#eab30880}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\[--color-bg\]{background-color:var(--color-bg)}.bg-accent{background-color:hsl(var(--accent))}.bg-amber-50{--tw-bg-opacity: 1;background-color:rgb(255 251 235 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-600{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.bg-amber-700{--tw-bg-opacity: 1;background-color:rgb(180 83 9 / var(--tw-bg-opacity, 1))}.bg-background{background-color:hsl(var(--background))}.bg-background\/50{background-color:hsl(var(--background) / .5)}.bg-background\/80{background-color:hsl(var(--background) / .8)}.bg-background\/95{background-color:hsl(var(--background) / .95)}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/50{background-color:#00000080}.bg-black\/80{background-color:#000c}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.bg-blue-900\/20{background-color:#1e3a8a33}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-card\/50{background-color:hsl(var(--card) / .5)}.bg-card\/80{background-color:hsl(var(--card) / .8)}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.bg-gray-800\/20{background-color:#1f293733}.bg-gray-800\/30{background-color:#1f29374d}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-500\/20{background-color:#22c55e33}.bg-green-600{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity, 1))}.bg-muted{background-color:hsl(var(--muted))}.bg-muted-foreground\/50{background-color:hsl(var(--muted-foreground) / .5)}.bg-muted\/20{background-color:hsl(var(--muted) / .2)}.bg-muted\/30{background-color:hsl(var(--muted) / .3)}.bg-muted\/50{background-color:hsl(var(--muted) / .5)}.bg-muted\/60{background-color:hsl(var(--muted) / .6)}.bg-orange-50{--tw-bg-opacity: 1;background-color:rgb(255 247 237 / var(--tw-bg-opacity, 1))}.bg-orange-50\/10{background-color:#fff7ed1a}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-500\/10{background-color:#f973161a}.bg-orange-500\/20{background-color:#f9731633}.bg-orange-600{--tw-bg-opacity: 1;background-color:rgb(234 88 12 / var(--tw-bg-opacity, 1))}.bg-pink-500{--tw-bg-opacity: 1;background-color:rgb(236 72 153 / var(--tw-bg-opacity, 1))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary-foreground\/20{background-color:hsl(var(--primary-foreground) / .2)}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-primary\/15{background-color:hsl(var(--primary) / .15)}.bg-primary\/20{background-color:hsl(var(--primary) / .2)}.bg-primary\/5{background-color:hsl(var(--primary) / .05)}.bg-primary\/60{background-color:hsl(var(--primary) / .6)}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-500\/20{background-color:#ef444433}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-red-900\/20{background-color:#7f1d1d33}.bg-red-900\/30{background-color:#7f1d1d4d}.bg-secondary{background-color:hsl(var(--secondary))}.bg-secondary\/5{background-color:hsl(var(--secondary) / .05)}.bg-slate-200{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity, 1))}.bg-slate-300{--tw-bg-opacity: 1;background-color:rgb(203 213 225 / var(--tw-bg-opacity, 1))}.bg-slate-400{--tw-bg-opacity: 1;background-color:rgb(148 163 184 / var(--tw-bg-opacity, 1))}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-white\/10{background-color:#ffffff1a}.bg-white\/20{background-color:#fff3}.bg-yellow-200{--tw-bg-opacity: 1;background-color:rgb(254 240 138 / var(--tw-bg-opacity, 1))}.bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/10{background-color:#eab3081a}.bg-yellow-500\/5{background-color:#eab3080d}.bg-yellow-900\/20{background-color:#713f1233}.bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-amber-50{--tw-gradient-from: #fffbeb var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 251 235 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-background{--tw-gradient-from: hsl(var(--background)) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-green-500{--tw-gradient-from: #22c55e var(--tw-gradient-from-position);--tw-gradient-to: rgb(34 197 94 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-50{--tw-gradient-from: #eef2ff var(--tw-gradient-from-position);--tw-gradient-to: rgb(238 242 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-500{--tw-gradient-from: #6366f1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(99 102 241 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-orange-500{--tw-gradient-from: #f97316 var(--tw-gradient-from-position);--tw-gradient-to: rgb(249 115 22 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-pink-50{--tw-gradient-from: #fdf2f8 var(--tw-gradient-from-position);--tw-gradient-to: rgb(253 242 248 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-pink-500{--tw-gradient-from: #ec4899 var(--tw-gradient-from-position);--tw-gradient-to: rgb(236 72 153 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-pink-500\/10{--tw-gradient-from: rgb(236 72 153 / .1) var(--tw-gradient-from-position);--tw-gradient-to: rgb(236 72 153 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-primary\/5{--tw-gradient-from: hsl(var(--primary) / .05) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--primary) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-purple-500{--tw-gradient-from: #a855f7 var(--tw-gradient-from-position);--tw-gradient-to: rgb(168 85 247 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-red-500{--tw-gradient-from: #ef4444 var(--tw-gradient-from-position);--tw-gradient-to: rgb(239 68 68 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-rose-50{--tw-gradient-from: #fff1f2 var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 241 242 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-200{--tw-gradient-from: #e2e8f0 var(--tw-gradient-from-position);--tw-gradient-to: rgb(226 232 240 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-300{--tw-gradient-from: #cbd5e1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(203 213 225 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-400{--tw-gradient-from: #94a3b8 var(--tw-gradient-from-position);--tw-gradient-to: rgb(148 163 184 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-background{--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), hsl(var(--background)) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-blue-50{--tw-gradient-to: #eff6ff var(--tw-gradient-to-position)}.to-blue-600{--tw-gradient-to: #2563eb var(--tw-gradient-to-position)}.to-cyan-500{--tw-gradient-to: #06b6d4 var(--tw-gradient-to-position)}.to-emerald-500{--tw-gradient-to: #10b981 var(--tw-gradient-to-position)}.to-green-600{--tw-gradient-to: #16a34a var(--tw-gradient-to-position)}.to-muted\/50{--tw-gradient-to: hsl(var(--muted) / .5) var(--tw-gradient-to-position)}.to-orange-50{--tw-gradient-to: #fff7ed var(--tw-gradient-to-position)}.to-orange-500{--tw-gradient-to: #f97316 var(--tw-gradient-to-position)}.to-pink-50{--tw-gradient-to: #fdf2f8 var(--tw-gradient-to-position)}.to-pink-500{--tw-gradient-to: #ec4899 var(--tw-gradient-to-position)}.to-primary\/10{--tw-gradient-to: hsl(var(--primary) / .1) var(--tw-gradient-to-position)}.to-purple-50{--tw-gradient-to: #faf5ff var(--tw-gradient-to-position)}.to-purple-500{--tw-gradient-to: #a855f7 var(--tw-gradient-to-position)}.to-purple-500\/10{--tw-gradient-to: rgb(168 85 247 / .1) var(--tw-gradient-to-position)}.to-secondary\/5{--tw-gradient-to: hsl(var(--secondary) / .05) var(--tw-gradient-to-position)}.to-slate-700{--tw-gradient-to: #334155 var(--tw-gradient-to-position)}.to-slate-800{--tw-gradient-to: #1e293b var(--tw-gradient-to-position)}.to-slate-900{--tw-gradient-to: #0f172a var(--tw-gradient-to-position)}.to-violet-50{--tw-gradient-to: #f5f3ff var(--tw-gradient-to-position)}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.fill-current{fill:currentColor}.fill-red-500{fill:#ef4444}.fill-yellow-400{fill:#facc15}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.p-\[1px\]{padding:1px}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.px-\[--cell-size\]{padding-left:var(--cell-size);padding-right:var(--cell-size)}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-0{padding-bottom:0}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pl-10{padding-left:2.5rem}.pl-11{padding-left:2.75rem}.pl-2{padding-left:.5rem}.pl-2\.5{padding-left:.625rem}.pl-4{padding-left:1rem}.pl-6{padding-left:1.5rem}.pl-8{padding-left:2rem}.pl-9{padding-left:2.25rem}.pr-1{padding-right:.25rem}.pr-10{padding-right:2.5rem}.pr-16{padding-right:4rem}.pr-2{padding-right:.5rem}.pr-2\.5{padding-right:.625rem}.pr-4{padding-right:1rem}.pr-6{padding-right:1.5rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.pt-8{padding-top:2rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-\[0\.8rem\]{font-size:.8rem}.text-\[10px\]{font-size:10px}.text-\[150px\]{font-size:150px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-black{font-weight:900}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.tracking-tight{letter-spacing:-.025em}.tracking-tighter{letter-spacing:-.05em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-amber-600{--tw-text-opacity: 1;color:rgb(217 119 6 / var(--tw-text-opacity, 1))}.text-amber-700{--tw-text-opacity: 1;color:rgb(180 83 9 / var(--tw-text-opacity, 1))}.text-amber-800{--tw-text-opacity: 1;color:rgb(146 64 14 / var(--tw-text-opacity, 1))}.text-amber-900{--tw-text-opacity: 1;color:rgb(120 53 15 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.text-blue-900{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity, 1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/50{color:hsl(var(--foreground) / .5)}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-indigo-600{--tw-text-opacity: 1;color:rgb(79 70 229 / var(--tw-text-opacity, 1))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-muted-foreground\/10{color:hsl(var(--muted-foreground) / .1)}.text-muted-foreground\/50{color:hsl(var(--muted-foreground) / .5)}.text-muted-foreground\/60{color:hsl(var(--muted-foreground) / .6)}.text-orange-500{--tw-text-opacity: 1;color:rgb(249 115 22 / var(--tw-text-opacity, 1))}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity, 1))}.text-orange-800{--tw-text-opacity: 1;color:rgb(154 52 18 / var(--tw-text-opacity, 1))}.text-orange-900{--tw-text-opacity: 1;color:rgb(124 45 18 / var(--tw-text-opacity, 1))}.text-pink-500{--tw-text-opacity: 1;color:rgb(236 72 153 / var(--tw-text-opacity, 1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-primary-foreground\/70{color:hsl(var(--primary-foreground) / .7)}.text-primary\/10{color:hsl(var(--primary) / .1)}.text-primary\/30{color:hsl(var(--primary) / .3)}.text-primary\/60{color:hsl(var(--primary) / .6)}.text-purple-500{--tw-text-opacity: 1;color:rgb(168 85 247 / var(--tw-text-opacity, 1))}.text-purple-600{--tw-text-opacity: 1;color:rgb(147 51 234 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-transparent{color:transparent}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.text-yellow-900{--tw-text-opacity: 1;color:rgb(113 63 18 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-30{opacity:.3}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.opacity-80{opacity:.8}.opacity-90{opacity:.9}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-4{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-border\/50{--tw-ring-color: hsl(var(--border) / .5)}.ring-orange-500\/50{--tw-ring-color: rgb(249 115 22 / .5)}.ring-primary{--tw-ring-color: hsl(var(--primary))}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.blur-3xl{--tw-blur: blur(64px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur: blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.delay-150{transition-delay:.15s}.delay-300{transition-delay:.3s}.duration-100{transition-duration:.1s}.duration-1000{transition-duration:1s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.duration-700{transition-duration:.7s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.text-primary-gradient{color:hsl(var(--primary))}.has-gradient .text-primary-gradient{background:var(--primary-gradient);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;color:transparent}.\[--cell-size\:2rem\]{--cell-size: 2rem}@font-face{font-family:JetBrains Mono;src:url(/fonts/JetBrainsMono-Medium.ttf) format("truetype");font-weight:500;font-style:normal;font-display:swap}.no-animations *,.no-animations *:before,.no-animations *:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}.no-animations *:hover{transition-duration:.01ms!important}::view-transition-old(root),::view-transition-new(root){animation:none;mix-blend-mode:normal}::view-transition-old(root){z-index:1}::view-transition-new(root){z-index:999}.__floater{z-index:99999!important;pointer-events:auto!important}.react-joyride__overlay,.react-joyride__spotlight{z-index:99998!important}.react-joyride__tooltip{pointer-events:auto!important}#tour-portal-container *{pointer-events:auto}.custom-scrollbar{scrollbar-width:thin;scrollbar-color:hsl(var(--border)) transparent}.custom-scrollbar::-webkit-scrollbar{width:8px;height:8px}.custom-scrollbar::-webkit-scrollbar-track{background:transparent;border-radius:4px}.custom-scrollbar::-webkit-scrollbar-thumb{background:hsl(var(--border));border-radius:4px;border:2px solid transparent;background-clip:content-box}.custom-scrollbar::-webkit-scrollbar-thumb:hover{background:hsl(var(--muted-foreground) / .5);background-clip:content-box}.custom-scrollbar::-webkit-scrollbar-corner{background:transparent}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.file\:text-foreground::file-selector-button{color:hsl(var(--foreground))}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.hover\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-110:hover{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:border-green-200:hover{--tw-border-opacity: 1;border-color:rgb(187 247 208 / var(--tw-border-opacity, 1))}.hover\:border-muted-foreground\/50:hover{border-color:hsl(var(--muted-foreground) / .5)}.hover\:border-primary\/50:hover{border-color:hsl(var(--primary) / .5)}.hover\:border-red-200:hover{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-accent\/50:hover{background-color:hsl(var(--accent) / .5)}.hover\:bg-amber-700:hover{--tw-bg-opacity: 1;background-color:rgb(180 83 9 / var(--tw-bg-opacity, 1))}.hover\:bg-background\/50:hover{background-color:hsl(var(--background) / .5)}.hover\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-green-50:hover{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.hover\:bg-green-700:hover{--tw-bg-opacity: 1;background-color:rgb(21 128 61 / var(--tw-bg-opacity, 1))}.hover\:bg-muted:hover{background-color:hsl(var(--muted))}.hover\:bg-muted-foreground\/20:hover{background-color:hsl(var(--muted-foreground) / .2)}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-orange-700:hover{--tw-bg-opacity: 1;background-color:rgb(194 65 12 / var(--tw-bg-opacity, 1))}.hover\:bg-primary\/10:hover{background-color:hsl(var(--primary) / .1)}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-red-50:hover{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-secondary\/90:hover{background-color:hsl(var(--secondary) / .9)}.hover\:bg-transparent:hover{background-color:transparent}.hover\:bg-white\/30:hover{background-color:#ffffff4d}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:from-pink-500\/20:hover{--tw-gradient-from: rgb(236 72 153 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(236 72 153 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:to-purple-500\/20:hover{--tw-gradient-to: rgb(168 85 247 / .2) var(--tw-gradient-to-position)}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-amber-900:hover{--tw-text-opacity: 1;color:rgb(120 53 15 / var(--tw-text-opacity, 1))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-green-600:hover{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.hover\:text-green-700:hover{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.hover\:text-orange-700:hover{--tw-text-opacity: 1;color:rgb(194 65 12 / var(--tw-text-opacity, 1))}.hover\:text-primary:hover{color:hsl(var(--primary))}.hover\:text-primary\/80:hover{color:hsl(var(--primary) / .8)}.hover\:text-red-500:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.hover\:text-red-600:hover{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.hover\:text-red-700:hover{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.hover\:text-yellow-300:hover{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:opacity-80:hover{opacity:.8}.hover\:shadow-2xl:hover{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-md:hover{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:ring-2:hover{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.hover\:ring-primary:hover{--tw-ring-color: hsl(var(--primary))}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-gray-100:focus{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-0:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-red-500:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity, 1))}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--background))}.active\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.active\:cursor-grabbing:active{cursor:grabbing}.active\:border-primary\/70:active{border-color:hsl(var(--primary) / .7)}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group[open] .group-open\:rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:-translate-y-1{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:scale-110{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:opacity-100{opacity:1}.group.destructive .group-\[\.destructive\]\:border-muted\/40{border-color:hsl(var(--muted) / .4)}.group.destructive .group-\[\.destructive\]\:text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover{--tw-text-opacity: 1;color:rgb(254 242 242 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(248 113 113 / var(--tw-ring-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-offset-red-600:focus{--tw-ring-offset-color: #dc2626}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.aria-selected\:text-muted-foreground[aria-selected=true]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[state\=inactive\]\:hidden[data-state=inactive]{display:none}.data-\[state\=inactive\]\:h-0[data-state=inactive]{height:0px}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked],.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=cancel\]\:translate-y-0[data-swipe=cancel]{--tw-translate-y: 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\=end\]\:translate-y-\[var\(--radix-toast-swipe-end-y\)\][data-swipe=end]{--tw-translate-y: var(--radix-toast-swipe-end-y);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))}.data-\[swipe\=move\]\:translate-y-\[var\(--radix-toast-swipe-move-y\)\][data-swipe=move]{--tw-translate-y: var(--radix-toast-swipe-move-y);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}.data-\[state\=closed\]\:animate-slide-out-to-top[data-state=closed]{animation:slide-out-to-top .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-in-from-top{0%{transform:translateY(-100%)}to{transform:translateY(0)}}.data-\[state\=open\]\:animate-slide-in-from-top[data-state=open]{animation:slide-in-from-top .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}@keyframes slide-out-to-top{0%{transform:translateY(0)}to{transform:translateY(-100%)}}.data-\[swipe\=end\]\:animate-slide-out-to-top[data-swipe=end]{animation:slide-out-to-top .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-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(133 77 14 / 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:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(66 32 6 / var(--tw-bg-opacity, 1))}.dark\:bg-yellow-950\/30:is(.dark *){background-color:#4220064d}.dark\:from-amber-950\/20:is(.dark *){--tw-gradient-from: rgb(69 26 3 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(69 26 3 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.dark\:from-indigo-950\/20:is(.dark *){--tw-gradient-from: rgb(30 27 75 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(30 27 75 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.dark\:from-pink-950\/20:is(.dark *){--tw-gradient-from: rgb(80 7 36 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(80 7 36 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.dark\:from-rose-950\/20:is(.dark *){--tw-gradient-from: rgb(76 5 25 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(76 5 25 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.dark\:to-blue-950\/20:is(.dark *){--tw-gradient-to: rgb(23 37 84 / .2) var(--tw-gradient-to-position)}.dark\:to-orange-950\/20:is(.dark *){--tw-gradient-to: rgb(67 20 7 / .2) var(--tw-gradient-to-position)}.dark\:to-pink-950\/20:is(.dark *){--tw-gradient-to: rgb(80 7 36 / .2) var(--tw-gradient-to-position)}.dark\:to-purple-950\/20:is(.dark *){--tw-gradient-to: rgb(59 7 100 / .2) var(--tw-gradient-to-position)}.dark\:to-violet-950\/20:is(.dark *){--tw-gradient-to: rgb(46 16 101 / .2) var(--tw-gradient-to-position)}.dark\:text-amber-100:is(.dark *){--tw-text-opacity: 1;color:rgb(254 243 199 / var(--tw-text-opacity, 1))}.dark\:text-amber-200:is(.dark *){--tw-text-opacity: 1;color:rgb(253 230 138 / var(--tw-text-opacity, 1))}.dark\:text-amber-400:is(.dark *){--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.dark\:text-amber-500:is(.dark *){--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.dark\:text-blue-100:is(.dark *){--tw-text-opacity: 1;color:rgb(219 234 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-200:is(.dark *){--tw-text-opacity: 1;color:rgb(191 219 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-300:is(.dark *){--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.dark\:text-blue-400:is(.dark *){--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.dark\:text-cyan-500:is(.dark *){--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.dark\:text-gray-100:is(.dark *){--tw-text-opacity: 1;color:rgb(243 244 246 / var(--tw-text-opacity, 1))}.dark\:text-gray-400:is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.dark\:text-gray-600:is(.dark *){--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.dark\:text-green-300:is(.dark *){--tw-text-opacity: 1;color:rgb(134 239 172 / var(--tw-text-opacity, 1))}.dark\:text-green-400:is(.dark *){--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.dark\:text-indigo-400:is(.dark *){--tw-text-opacity: 1;color:rgb(129 140 248 / var(--tw-text-opacity, 1))}.dark\:text-orange-100:is(.dark *){--tw-text-opacity: 1;color:rgb(255 237 213 / var(--tw-text-opacity, 1))}.dark\:text-orange-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 215 170 / var(--tw-text-opacity, 1))}.dark\:text-red-300:is(.dark *){--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.dark\:text-red-400:is(.dark *){--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.dark\:text-red-500:is(.dark *){--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.dark\:text-yellow-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 240 138 / var(--tw-text-opacity, 1))}.dark\:text-yellow-300:is(.dark *){--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.dark\:text-yellow-400:is(.dark *){--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.dark\:text-yellow-500:is(.dark *){--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.dark\:hover\:bg-gray-800:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:hover\:text-amber-200:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(253 230 138 / var(--tw-text-opacity, 1))}.dark\:focus\:bg-gray-800:focus:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}@media(min-width:640px){.sm\:right-2{right:.5rem}.sm\:right-3{right:.75rem}.sm\:top-2{top:.5rem}.sm\:top-3{top:.75rem}.sm\:order-1{order:1}.sm\:order-2{order:2}.sm\:col-span-2{grid-column:span 2 / span 2}.sm\:mx-0{margin-left:0;margin-right:0}.sm\:mb-3{margin-bottom:.75rem}.sm\:mb-4{margin-bottom:1rem}.sm\:mb-6{margin-bottom:1.5rem}.sm\:ml-0{margin-left:0}.sm\:ml-1{margin-left:.25rem}.sm\:mr-1{margin-right:.25rem}.sm\:mt-0{margin-top:0}.sm\:mt-2{margin-top:.5rem}.sm\:mt-3{margin-top:.75rem}.sm\:mt-6{margin-top:1.5rem}.sm\:block{display:block}.sm\:inline{display:inline}.sm\:flex{display:flex}.sm\:grid{display:grid}.sm\:hidden{display:none}.sm\:h-10{height:2.5rem}.sm\:h-12{height:3rem}.sm\:h-2{height:.5rem}.sm\:h-2\.5{height:.625rem}.sm\:h-24{height:6rem}.sm\:h-4{height:1rem}.sm\:h-5{height:1.25rem}.sm\:h-8{height:2rem}.sm\:h-9{height:2.25rem}.sm\:h-\[300px\]{height:300px}.sm\:h-\[400px\]{height:400px}.sm\:h-\[500px\]{height:500px}.sm\:h-\[85vh\]{height:85vh}.sm\:h-\[calc\(100vh-220px\)\]{height:calc(100vh - 220px)}.sm\:h-\[calc\(100vh-280px\)\]{height:calc(100vh - 280px)}.sm\:w-10{width:2.5rem}.sm\:w-2{width:.5rem}.sm\:w-2\.5{width:.625rem}.sm\:w-24{width:6rem}.sm\:w-28{width:7rem}.sm\:w-32{width:8rem}.sm\:w-4{width:1rem}.sm\:w-48{width:12rem}.sm\:w-5{width:1.25rem}.sm\:w-8{width:2rem}.sm\:w-80{width:20rem}.sm\:w-96{width:24rem}.sm\:w-\[200px\]{width:200px}.sm\:w-\[500px\]{width:500px}.sm\:w-auto{width:auto}.sm\:w-full{width:100%}.sm\:min-w-\[120px\]{min-width:120px}.sm\:max-w-2xl{max-width:42rem}.sm\:max-w-32{max-width:8rem}.sm\:max-w-\[420px\]{max-width:420px}.sm\:max-w-\[500px\]{max-width:500px}.sm\:max-w-\[70\%\]{max-width:70%}.sm\:max-w-\[900px\]{max-width:900px}.sm\:max-w-md{max-width:28rem}.sm\:max-w-sm{max-width:24rem}.sm\:flex-1{flex:1 1 0%}.sm\:flex-none{flex:none}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.sm\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-start{align-items:flex-start}.sm\:items-center{align-items:center}.sm\:justify-end{justify-content:flex-end}.sm\:justify-between{justify-content:space-between}.sm\:gap-0{gap:0px}.sm\:gap-1{gap:.25rem}.sm\:gap-2{gap:.5rem}.sm\:gap-3{gap:.75rem}.sm\:gap-4{gap:1rem}.sm\:gap-6{gap:1.5rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.sm\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.sm\:space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.sm\:space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.sm\:space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:p-3{padding:.75rem}.sm\:p-4{padding:1rem}.sm\:p-6{padding:1.5rem}.sm\:p-8{padding:2rem}.sm\:px-0{padding-left:0;padding-right:0}.sm\:px-3{padding-left:.75rem;padding-right:.75rem}.sm\:px-4{padding-left:1rem;padding-right:1rem}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:py-2{padding-top:.5rem;padding-bottom:.5rem}.sm\:pb-3{padding-bottom:.75rem}.sm\:pt-6{padding-top:1.5rem}.sm\:text-left{text-align:left}.sm\:text-right{text-align:right}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-3xl{font-size:1.875rem;line-height:2.25rem}.sm\:text-6xl{font-size:3.75rem;line-height:1}.sm\:text-\[200px\]{font-size:200px}.sm\:text-base{font-size:1rem;line-height:1.5rem}.sm\:text-lg{font-size:1.125rem;line-height:1.75rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:text-xl{font-size:1.25rem;line-height:1.75rem}.sm\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:768px){.md\:top-4{top:1rem}.md\:col-span-2{grid-column:span 2 / span 2}.md\:mb-4{margin-bottom:1rem}.md\:mb-6{margin-bottom:1.5rem}.md\:mb-8{margin-bottom:2rem}.md\:mt-8{margin-top:2rem}.md\:block{display:block}.md\:inline{display:inline}.md\:flex{display:flex}.md\:hidden{display:none}.md\:h-16{height:4rem}.md\:h-4{height:1rem}.md\:h-5{height:1.25rem}.md\:h-8{height:2rem}.md\:h-96{height:24rem}.md\:h-\[500px\]{height:500px}.md\:min-h-\[400px\]{min-height:400px}.md\:w-16{width:4rem}.md\:w-4{width:1rem}.md\:w-5{width:1.25rem}.md\:w-8{width:2rem}.md\:w-96{width:24rem}.md\:max-w-none{max-width:none}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:gap-2{gap:.5rem}.md\:gap-3{gap:.75rem}.md\:gap-4{gap:1rem}.md\:gap-6{gap:1.5rem}.md\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.md\:space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.md\:whitespace-normal{white-space:normal}.md\:p-12{padding:3rem}.md\:p-4{padding:1rem}.md\:p-6{padding:1.5rem}.md\:p-8{padding:2rem}.md\:text-2xl{font-size:1.5rem;line-height:2rem}.md\:text-3xl{font-size:1.875rem;line-height:2.25rem}.md\:text-base{font-size:1rem;line-height:1.5rem}.md\:text-lg{font-size:1.125rem;line-height:1.75rem}.md\:text-sm{font-size:.875rem;line-height:1.25rem}.md\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:1024px){.lg\:invisible{visibility:hidden}.lg\:relative{position:relative}.lg\:z-0{z-index:0}.lg\:col-span-1{grid-column:span 1 / span 1}.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:mx-auto{margin-left:auto;margin-right:auto}.lg\:mb-1{margin-bottom:.25rem}.lg\:block{display:block}.lg\:inline{display:inline}.lg\:flex{display:flex}.lg\:hidden{display:none}.lg\:w-12{width:3rem}.lg\:w-16{width:4rem}.lg\:w-64{width:16rem}.lg\:w-8{width:2rem}.lg\:w-\[130px\]{width:130px}.lg\:w-\[160px\]{width:160px}.lg\:w-\[75px\]{width:75px}.lg\:w-auto{width:auto}.lg\:w-full{width:100%}.lg\:max-w-0{max-width:0px}.lg\:flex-1{flex:1 1 0%}.lg\:flex-none{flex:none}.lg\:translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\:grid-cols-10{grid-template-columns:repeat(10,minmax(0,1fr))}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.lg\:grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.lg\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}.lg\:flex-row{flex-direction:row}.lg\:items-center{align-items:center}.lg\:justify-center{justify-content:center}.lg\:gap-0{gap:0px}.lg\:space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.lg\:overflow-hidden{overflow:hidden}.lg\:p-2{padding:.5rem}.lg\:p-4{padding:1rem}.lg\:px-0{padding-left:0;padding-right:0}.lg\:px-4{padding-left:1rem;padding-right:1rem}.lg\:pb-4{padding-bottom:1rem}.lg\:text-2xl{font-size:1.5rem;line-height:2rem}.lg\:opacity-0{opacity:0}}@media(min-width:1280px){.xl\:grid-cols-10{grid-template-columns:repeat(10,minmax(0,1fr))}.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.xl\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}}@media print{.print\:hidden{display:none}.print\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.print\:rounded-none{border-radius:0}.print\:p-0{padding:0}.print\:shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}}.\[\&\+div\]\:text-xs+div{font-size:.75rem;line-height:1rem}.\[\&\:\:-webkit-scrollbar-thumb\:hover\]\:bg-border\/80::-webkit-scrollbar-thumb:hover{background-color:hsl(var(--border) / .8)}.\[\&\:\:-webkit-scrollbar-thumb\]\:rounded-full::-webkit-scrollbar-thumb{border-radius:9999px}.\[\&\:\:-webkit-scrollbar-thumb\]\:bg-border::-webkit-scrollbar-thumb{background-color:hsl(var(--border))}.\[\&\:\:-webkit-scrollbar-track\]\:bg-transparent::-webkit-scrollbar-track{background-color:transparent}.\[\&\:\:-webkit-scrollbar\]\:w-2\.5::-webkit-scrollbar{width:.625rem}.\[\&\:first-child\[data-selected\=true\]_button\]\:rounded-l-md:first-child[data-selected=true] button{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\:last-child\[data-selected\=true\]_button\]\:rounded-r-md:last-child[data-selected=true] button{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\>\[role\=checkbox\]\]\:translate-y-\[2px\]>[role=checkbox]{--tw-translate-y: 2px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>div\]\:bg-green-500>div{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.\[\&\>span\]\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\[\&\>span\]\:text-xs>span{font-size:.75rem;line-height:1rem}.\[\&\>span\]\:opacity-70>span{opacity:.7}.\[\&\>svg\+div\]\:translate-y-0>svg+div{--tw-translate-y: 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))}.\[\&\>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-RB5cYCSR.css b/webui/dist/assets/index-RB5cYCSR.css deleted file mode 100644 index 39537543..00000000 --- a/webui/dist/assets/index-RB5cYCSR.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-x-4{left:1rem;right:1rem}.inset-y-0{top:0;bottom:0}.-bottom-20{bottom:-5rem}.-left-20{left:-5rem}.-right-2{right:-.5rem}.-right-20{right:-5rem}.-top-2{top:-.5rem}.-top-20{top:-5rem}.bottom-0{bottom:0}.bottom-1\/4{bottom:25%}.bottom-24{bottom:6rem}.bottom-4{bottom:1rem}.left-0{left:0}.left-1{left:.25rem}.left-1\/2{left:50%}.left-1\/4{left:25%}.left-2{left:.5rem}.left-2\.5{left:.625rem}.left-3{left:.75rem}.left-\[50\%\]{left:50%}.right-0{right:0}.right-1{right:.25rem}.right-1\.5{right:.375rem}.right-1\/3{right:33.333333%}.right-1\/4{right:25%}.right-2{right:.5rem}.right-4{right:1rem}.right-8{right:2rem}.top-0{top:0}.top-1{top:.25rem}.top-1\.5{top:.375rem}.top-1\/2{top:50%}.top-1\/4{top:25%}.top-2{top:.5rem}.top-2\.5{top:.625rem}.top-3{top:.75rem}.top-3\/4{top:75%}.top-4{top:1rem}.top-\[50\%\]{top:50%}.z-10{z-index:10}.z-20{z-index:20}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.order-1{order:1}.order-2{order:2}.col-span-1{grid-column:span 1 / span 1}.col-span-2{grid-column:span 2 / span 2}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.-mx-4{margin-left:-1rem;margin-right:-1rem}.mx-0{margin-left:0;margin-right:0}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-0\.5{margin-top:.125rem;margin-bottom:.125rem}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-3{margin-top:.75rem;margin-bottom:.75rem}.my-4{margin-top:1rem;margin-bottom:1rem}.-mt-1{margin-top:-.25rem}.-mt-2{margin-top:-.5rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.mb-\[1px\]{margin-bottom:1px}.ml-0\.5{margin-left:.125rem}.ml-1{margin-left:.25rem}.ml-10{margin-left:2.5rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.ml-6{margin-left:1.5rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-1\.5{margin-right:.375rem}.mr-2{margin-right:.5rem}.mt-0{margin-top:0}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-12{margin-top:3rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.mt-auto{margin-top:auto}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-auto{aspect-ratio:auto}.aspect-square{aspect-ratio:1 / 1}.aspect-video{aspect-ratio:16 / 9}.size-4{width:1rem;height:1rem}.size-\[--cell-size\]{width:var(--cell-size);height:var(--cell-size)}.h-0\.5{height:.125rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-24{height:6rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-4{height:1rem}.h-40{height:10rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-60{height:15rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-96{height:24rem}.h-\[--cell-size\]{height:var(--cell-size)}.h-\[1\.25rem\]{height:1.25rem}.h-\[1px\]{height:1px}.h-\[200px\]{height:200px}.h-\[250px\]{height:250px}.h-\[280px\]{height:280px}.h-\[2px\]{height:2px}.h-\[300px\]{height:300px}.h-\[350px\]{height:350px}.h-\[400px\]{height:400px}.h-\[600px\]{height:600px}.h-\[70vh\]{height:70vh}.h-\[90vh\]{height:90vh}.h-\[calc\(100vh-12rem\)\]{height:calc(100vh - 12rem)}.h-\[calc\(100vh-200px\)\]{height:calc(100vh - 200px)}.h-\[calc\(100vh-240px\)\]{height:calc(100vh - 240px)}.h-\[calc\(100vh-260px\)\]{height:calc(100vh - 260px)}.h-\[calc\(100vh-4rem\)\]{height:calc(100vh - 4rem)}.h-\[calc\(85vh-220px\)\]{height:calc(85vh - 220px)}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-32{max-height:8rem}.max-h-64{max-height:16rem}.max-h-\[--radix-context-menu-content-available-height\]{max-height:var(--radix-context-menu-content-available-height)}.max-h-\[--radix-select-content-available-height\]{max-height:var(--radix-select-content-available-height)}.max-h-\[200px\]{max-height:200px}.max-h-\[300px\]{max-height:300px}.max-h-\[400px\]{max-height:400px}.max-h-\[60vh\]{max-height:60vh}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[calc\(90vh-120px\)\]{max-height:calc(90vh - 120px)}.max-h-\[calc\(90vh-8rem\)\]{max-height:calc(90vh - 8rem)}.max-h-full{max-height:100%}.max-h-none{max-height:none}.max-h-screen{max-height:100vh}.min-h-0{min-height:0px}.min-h-10{min-height:2.5rem}.min-h-\[100px\]{min-height:100px}.min-h-\[300px\]{min-height:300px}.min-h-\[400px\]{min-height:400px}.min-h-\[40px\]{min-height:40px}.min-h-\[60px\]{min-height:60px}.min-h-\[xxx\]{min-height:xxx}.min-h-screen{min-height:100vh}.w-0{width:0px}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-2\/3{width:66.666667%}.w-20{width:5rem}.w-24{width:6rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-3\/4{width:75%}.w-32{width:8rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-\[--cell-size\]{width:var(--cell-size)}.w-\[100px\]{width:100px}.w-\[120px\]{width:120px}.w-\[130px\]{width:130px}.w-\[140px\]{width:140px}.w-\[1px\]{width:1px}.w-\[200px\]{width:200px}.w-\[600px\]{width:600px}.w-\[65px\]{width:65px}.w-\[70px\]{width:70px}.w-\[95vw\]{width:95vw}.w-auto{width:auto}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-\[--cell-size\]{min-width:var(--cell-size)}.min-w-\[100px\]{min-width:100px}.min-w-\[120px\]{min-width:120px}.min-w-\[140px\]{min-width:140px}.min-w-\[160px\]{min-width:160px}.min-w-\[200px\]{min-width:200px}.min-w-\[80px\]{min-width:80px}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.min-w-full{min-width:100%}.max-w-24{max-width:6rem}.max-w-2xl{max-width:42rem}.max-w-32{max-width:8rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-\[100px\]{max-width:100px}.max-w-\[120px\]{max-width:120px}.max-w-\[150px\]{max-width:150px}.max-w-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.max-w-\[60px\]{max-width:60px}.max-w-\[75\%\]{max-width:75%}.max-w-\[90\%\]{max-width:90%}.max-w-\[95vw\]{max-width:95vw}.max-w-\[var\(--max-width\)\]{max-width:var(--max-width)}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-none{flex:none}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.origin-\[--radix-context-menu-content-transform-origin\]{transform-origin:var(--radix-context-menu-content-transform-origin)}.origin-\[--radix-popover-content-transform-origin\]{transform-origin:var(--radix-popover-content-transform-origin)}.origin-\[--radix-select-content-transform-origin\]{transform-origin:var(--radix-select-content-transform-origin)}.origin-\[--radix-tooltip-content-transform-origin\]{transform-origin:var(--radix-tooltip-content-transform-origin)}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-x-full{--tw-translate-x: -100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-32{--tw-translate-x: 8rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rotate-90{--tw-rotate: -90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-110{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.animate-\[ping_3s_ease-in-out_infinite\]{animation:ping 3s ease-in-out infinite}.animate-\[ping_3s_ease-in-out_infinite_0\.5s\]{animation:ping 3s ease-in-out infinite .5s}.animate-\[ping_3s_ease-in-out_infinite_1s\]{animation:ping 3s ease-in-out infinite 1s}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.animate-bounce{animation:bounce 1s infinite}@keyframes ping{75%,to{transform:scale(2);opacity:0}}.animate-ping{animation:ping 1s cubic-bezier(0,0,.2,1) infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-help{cursor:help}.cursor-move{cursor:move}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.select-all{-webkit-user-select:all;-moz-user-select:all;user-select:all}.resize-none{resize:none}.resize{resize:both}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.break-inside-avoid{-moz-column-break-inside:avoid;break-inside:avoid}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-rows-\[auto_1fr_auto\]{grid-template-rows:auto 1fr auto}.flex-row{flex-direction:row}.flex-row-reverse{flex-direction:row-reverse}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.place-content-center{place-content:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.items-stretch{align-items:stretch}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-8{gap:2rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-3xl{border-radius:1.5rem}.rounded-\[2px\]{border-radius:2px}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-none{border-radius:0}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-l-md{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.rounded-r-full{border-top-right-radius:9999px;border-bottom-right-radius:9999px}.rounded-r-md{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.rounded-t-lg{border-top-left-radius:var(--radius);border-top-right-radius:var(--radius)}.rounded-tl-sm{border-top-left-radius:calc(var(--radius) - 4px)}.rounded-tr-sm{border-top-right-radius:calc(var(--radius) - 4px)}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-4{border-width:4px}.border-\[1\.5px\]{border-width:1.5px}.border-b{border-bottom-width:1px}.border-b-0{border-bottom-width:0px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-l-4{border-left-width:4px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[--color-border\]{border-color:var(--color-border)}.border-amber-200{--tw-border-opacity: 1;border-color:rgb(253 230 138 / var(--tw-border-opacity, 1))}.border-amber-500\/20{border-color:#f59e0b33}.border-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-500\/20{border-color:#f9731633}.border-orange-600{--tw-border-opacity: 1;border-color:rgb(234 88 12 / var(--tw-border-opacity, 1))}.border-pink-500\/20{border-color:#ec489933}.border-primary{border-color:hsl(var(--primary))}.border-primary\/10{border-color:hsl(var(--primary) / .1)}.border-primary\/20{border-color:hsl(var(--primary) / .2)}.border-primary\/30{border-color:hsl(var(--primary) / .3)}.border-primary\/50{border-color:hsl(var(--primary) / .5)}.border-purple-500{--tw-border-opacity: 1;border-color:rgb(168 85 247 / var(--tw-border-opacity, 1))}.border-red-200{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}.border-red-300{--tw-border-opacity: 1;border-color:rgb(252 165 165 / var(--tw-border-opacity, 1))}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-red-500\/50{border-color:#ef444480}.border-transparent{border-color:transparent}.border-white\/30{border-color:#ffffff4d}.border-yellow-200{--tw-border-opacity: 1;border-color:rgb(254 240 138 / var(--tw-border-opacity, 1))}.border-yellow-500\/50{border-color:#eab30880}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\[--color-bg\]{background-color:var(--color-bg)}.bg-accent{background-color:hsl(var(--accent))}.bg-amber-50{--tw-bg-opacity: 1;background-color:rgb(255 251 235 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-600{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.bg-amber-700{--tw-bg-opacity: 1;background-color:rgb(180 83 9 / var(--tw-bg-opacity, 1))}.bg-background{background-color:hsl(var(--background))}.bg-background\/50{background-color:hsl(var(--background) / .5)}.bg-background\/80{background-color:hsl(var(--background) / .8)}.bg-background\/95{background-color:hsl(var(--background) / .95)}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/50{background-color:#00000080}.bg-black\/80{background-color:#000c}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.bg-blue-900\/20{background-color:#1e3a8a33}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-card\/50{background-color:hsl(var(--card) / .5)}.bg-card\/80{background-color:hsl(var(--card) / .8)}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.bg-gray-800\/20{background-color:#1f293733}.bg-gray-800\/30{background-color:#1f29374d}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-500\/20{background-color:#22c55e33}.bg-green-600{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity, 1))}.bg-muted{background-color:hsl(var(--muted))}.bg-muted-foreground\/50{background-color:hsl(var(--muted-foreground) / .5)}.bg-muted\/20{background-color:hsl(var(--muted) / .2)}.bg-muted\/30{background-color:hsl(var(--muted) / .3)}.bg-muted\/50{background-color:hsl(var(--muted) / .5)}.bg-muted\/60{background-color:hsl(var(--muted) / .6)}.bg-orange-50{--tw-bg-opacity: 1;background-color:rgb(255 247 237 / var(--tw-bg-opacity, 1))}.bg-orange-50\/10{background-color:#fff7ed1a}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-500\/10{background-color:#f973161a}.bg-orange-500\/20{background-color:#f9731633}.bg-orange-600{--tw-bg-opacity: 1;background-color:rgb(234 88 12 / var(--tw-bg-opacity, 1))}.bg-pink-500{--tw-bg-opacity: 1;background-color:rgb(236 72 153 / var(--tw-bg-opacity, 1))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary-foreground\/20{background-color:hsl(var(--primary-foreground) / .2)}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-primary\/15{background-color:hsl(var(--primary) / .15)}.bg-primary\/20{background-color:hsl(var(--primary) / .2)}.bg-primary\/5{background-color:hsl(var(--primary) / .05)}.bg-primary\/60{background-color:hsl(var(--primary) / .6)}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-500\/20{background-color:#ef444433}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-red-900\/20{background-color:#7f1d1d33}.bg-red-900\/30{background-color:#7f1d1d4d}.bg-secondary{background-color:hsl(var(--secondary))}.bg-secondary\/5{background-color:hsl(var(--secondary) / .05)}.bg-slate-200{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity, 1))}.bg-slate-300{--tw-bg-opacity: 1;background-color:rgb(203 213 225 / var(--tw-bg-opacity, 1))}.bg-slate-400{--tw-bg-opacity: 1;background-color:rgb(148 163 184 / var(--tw-bg-opacity, 1))}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-white\/10{background-color:#ffffff1a}.bg-white\/20{background-color:#fff3}.bg-yellow-200{--tw-bg-opacity: 1;background-color:rgb(254 240 138 / var(--tw-bg-opacity, 1))}.bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/10{background-color:#eab3081a}.bg-yellow-500\/5{background-color:#eab3080d}.bg-yellow-900\/20{background-color:#713f1233}.bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-amber-50{--tw-gradient-from: #fffbeb var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 251 235 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-background{--tw-gradient-from: hsl(var(--background)) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-green-500{--tw-gradient-from: #22c55e var(--tw-gradient-from-position);--tw-gradient-to: rgb(34 197 94 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-50{--tw-gradient-from: #eef2ff var(--tw-gradient-from-position);--tw-gradient-to: rgb(238 242 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-500{--tw-gradient-from: #6366f1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(99 102 241 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-orange-500{--tw-gradient-from: #f97316 var(--tw-gradient-from-position);--tw-gradient-to: rgb(249 115 22 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-pink-50{--tw-gradient-from: #fdf2f8 var(--tw-gradient-from-position);--tw-gradient-to: rgb(253 242 248 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-pink-500{--tw-gradient-from: #ec4899 var(--tw-gradient-from-position);--tw-gradient-to: rgb(236 72 153 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-pink-500\/10{--tw-gradient-from: rgb(236 72 153 / .1) var(--tw-gradient-from-position);--tw-gradient-to: rgb(236 72 153 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-primary\/5{--tw-gradient-from: hsl(var(--primary) / .05) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--primary) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-purple-500{--tw-gradient-from: #a855f7 var(--tw-gradient-from-position);--tw-gradient-to: rgb(168 85 247 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-red-500{--tw-gradient-from: #ef4444 var(--tw-gradient-from-position);--tw-gradient-to: rgb(239 68 68 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-rose-50{--tw-gradient-from: #fff1f2 var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 241 242 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-200{--tw-gradient-from: #e2e8f0 var(--tw-gradient-from-position);--tw-gradient-to: rgb(226 232 240 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-300{--tw-gradient-from: #cbd5e1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(203 213 225 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-400{--tw-gradient-from: #94a3b8 var(--tw-gradient-from-position);--tw-gradient-to: rgb(148 163 184 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-background{--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), hsl(var(--background)) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-blue-50{--tw-gradient-to: #eff6ff var(--tw-gradient-to-position)}.to-blue-600{--tw-gradient-to: #2563eb var(--tw-gradient-to-position)}.to-cyan-500{--tw-gradient-to: #06b6d4 var(--tw-gradient-to-position)}.to-emerald-500{--tw-gradient-to: #10b981 var(--tw-gradient-to-position)}.to-green-600{--tw-gradient-to: #16a34a var(--tw-gradient-to-position)}.to-muted\/50{--tw-gradient-to: hsl(var(--muted) / .5) var(--tw-gradient-to-position)}.to-orange-50{--tw-gradient-to: #fff7ed var(--tw-gradient-to-position)}.to-orange-500{--tw-gradient-to: #f97316 var(--tw-gradient-to-position)}.to-pink-50{--tw-gradient-to: #fdf2f8 var(--tw-gradient-to-position)}.to-pink-500{--tw-gradient-to: #ec4899 var(--tw-gradient-to-position)}.to-primary\/10{--tw-gradient-to: hsl(var(--primary) / .1) var(--tw-gradient-to-position)}.to-purple-50{--tw-gradient-to: #faf5ff var(--tw-gradient-to-position)}.to-purple-500{--tw-gradient-to: #a855f7 var(--tw-gradient-to-position)}.to-purple-500\/10{--tw-gradient-to: rgb(168 85 247 / .1) var(--tw-gradient-to-position)}.to-secondary\/5{--tw-gradient-to: hsl(var(--secondary) / .05) var(--tw-gradient-to-position)}.to-slate-700{--tw-gradient-to: #334155 var(--tw-gradient-to-position)}.to-slate-800{--tw-gradient-to: #1e293b var(--tw-gradient-to-position)}.to-slate-900{--tw-gradient-to: #0f172a var(--tw-gradient-to-position)}.to-violet-50{--tw-gradient-to: #f5f3ff var(--tw-gradient-to-position)}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.fill-current{fill:currentColor}.fill-red-500{fill:#ef4444}.fill-yellow-400{fill:#facc15}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.p-\[1px\]{padding:1px}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.px-\[--cell-size\]{padding-left:var(--cell-size);padding-right:var(--cell-size)}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-0{padding-bottom:0}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pl-10{padding-left:2.5rem}.pl-11{padding-left:2.75rem}.pl-2{padding-left:.5rem}.pl-2\.5{padding-left:.625rem}.pl-4{padding-left:1rem}.pl-6{padding-left:1.5rem}.pl-8{padding-left:2rem}.pl-9{padding-left:2.25rem}.pr-1{padding-right:.25rem}.pr-10{padding-right:2.5rem}.pr-16{padding-right:4rem}.pr-2{padding-right:.5rem}.pr-2\.5{padding-right:.625rem}.pr-4{padding-right:1rem}.pr-6{padding-right:1.5rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.pt-8{padding-top:2rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-\[0\.8rem\]{font-size:.8rem}.text-\[10px\]{font-size:10px}.text-\[150px\]{font-size:150px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-black{font-weight:900}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.tracking-tight{letter-spacing:-.025em}.tracking-tighter{letter-spacing:-.05em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-amber-600{--tw-text-opacity: 1;color:rgb(217 119 6 / var(--tw-text-opacity, 1))}.text-amber-700{--tw-text-opacity: 1;color:rgb(180 83 9 / var(--tw-text-opacity, 1))}.text-amber-800{--tw-text-opacity: 1;color:rgb(146 64 14 / var(--tw-text-opacity, 1))}.text-amber-900{--tw-text-opacity: 1;color:rgb(120 53 15 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.text-blue-900{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity, 1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/50{color:hsl(var(--foreground) / .5)}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-indigo-600{--tw-text-opacity: 1;color:rgb(79 70 229 / var(--tw-text-opacity, 1))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-muted-foreground\/10{color:hsl(var(--muted-foreground) / .1)}.text-muted-foreground\/50{color:hsl(var(--muted-foreground) / .5)}.text-muted-foreground\/60{color:hsl(var(--muted-foreground) / .6)}.text-orange-500{--tw-text-opacity: 1;color:rgb(249 115 22 / var(--tw-text-opacity, 1))}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity, 1))}.text-orange-800{--tw-text-opacity: 1;color:rgb(154 52 18 / var(--tw-text-opacity, 1))}.text-orange-900{--tw-text-opacity: 1;color:rgb(124 45 18 / var(--tw-text-opacity, 1))}.text-pink-500{--tw-text-opacity: 1;color:rgb(236 72 153 / var(--tw-text-opacity, 1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-primary-foreground\/70{color:hsl(var(--primary-foreground) / .7)}.text-primary\/10{color:hsl(var(--primary) / .1)}.text-primary\/30{color:hsl(var(--primary) / .3)}.text-primary\/60{color:hsl(var(--primary) / .6)}.text-purple-500{--tw-text-opacity: 1;color:rgb(168 85 247 / var(--tw-text-opacity, 1))}.text-purple-600{--tw-text-opacity: 1;color:rgb(147 51 234 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-transparent{color:transparent}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.text-yellow-900{--tw-text-opacity: 1;color:rgb(113 63 18 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-30{opacity:.3}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.opacity-80{opacity:.8}.opacity-90{opacity:.9}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-4{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-border\/50{--tw-ring-color: hsl(var(--border) / .5)}.ring-orange-500\/50{--tw-ring-color: rgb(249 115 22 / .5)}.ring-primary{--tw-ring-color: hsl(var(--primary))}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.blur-3xl{--tw-blur: blur(64px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur: blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.delay-150{transition-delay:.15s}.delay-300{transition-delay:.3s}.duration-100{transition-duration:.1s}.duration-1000{transition-duration:1s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.duration-700{transition-duration:.7s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.text-primary-gradient{color:hsl(var(--primary))}.has-gradient .text-primary-gradient{background:var(--primary-gradient);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;color:transparent}.\[--cell-size\:2rem\]{--cell-size: 2rem}@font-face{font-family:JetBrains Mono;src:url(/fonts/JetBrainsMono-Medium.ttf) format("truetype");font-weight:500;font-style:normal;font-display:swap}.no-animations *,.no-animations *:before,.no-animations *:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}.no-animations *:hover{transition-duration:.01ms!important}::view-transition-old(root),::view-transition-new(root){animation:none;mix-blend-mode:normal}::view-transition-old(root){z-index:1}::view-transition-new(root){z-index:999}.__floater{z-index:99999!important;pointer-events:auto!important}.react-joyride__overlay,.react-joyride__spotlight{z-index:99998!important}.react-joyride__tooltip{pointer-events:auto!important}#tour-portal-container *{pointer-events:auto}.custom-scrollbar{scrollbar-width:thin;scrollbar-color:hsl(var(--border)) transparent}.custom-scrollbar::-webkit-scrollbar{width:8px;height:8px}.custom-scrollbar::-webkit-scrollbar-track{background:transparent;border-radius:4px}.custom-scrollbar::-webkit-scrollbar-thumb{background:hsl(var(--border));border-radius:4px;border:2px solid transparent;background-clip:content-box}.custom-scrollbar::-webkit-scrollbar-thumb:hover{background:hsl(var(--muted-foreground) / .5);background-clip:content-box}.custom-scrollbar::-webkit-scrollbar-corner{background:transparent}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.file\:text-foreground::file-selector-button{color:hsl(var(--foreground))}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.hover\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-110:hover{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:border-green-200:hover{--tw-border-opacity: 1;border-color:rgb(187 247 208 / var(--tw-border-opacity, 1))}.hover\:border-muted-foreground\/50:hover{border-color:hsl(var(--muted-foreground) / .5)}.hover\:border-primary\/50:hover{border-color:hsl(var(--primary) / .5)}.hover\:border-red-200:hover{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-accent\/50:hover{background-color:hsl(var(--accent) / .5)}.hover\:bg-amber-700:hover{--tw-bg-opacity: 1;background-color:rgb(180 83 9 / var(--tw-bg-opacity, 1))}.hover\:bg-background\/50:hover{background-color:hsl(var(--background) / .5)}.hover\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-green-50:hover{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.hover\:bg-green-700:hover{--tw-bg-opacity: 1;background-color:rgb(21 128 61 / var(--tw-bg-opacity, 1))}.hover\:bg-muted:hover{background-color:hsl(var(--muted))}.hover\:bg-muted-foreground\/20:hover{background-color:hsl(var(--muted-foreground) / .2)}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-orange-700:hover{--tw-bg-opacity: 1;background-color:rgb(194 65 12 / var(--tw-bg-opacity, 1))}.hover\:bg-primary\/10:hover{background-color:hsl(var(--primary) / .1)}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-red-50:hover{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-secondary\/90:hover{background-color:hsl(var(--secondary) / .9)}.hover\:bg-transparent:hover{background-color:transparent}.hover\:bg-white\/30:hover{background-color:#ffffff4d}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:from-pink-500\/20:hover{--tw-gradient-from: rgb(236 72 153 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(236 72 153 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:to-purple-500\/20:hover{--tw-gradient-to: rgb(168 85 247 / .2) var(--tw-gradient-to-position)}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-amber-900:hover{--tw-text-opacity: 1;color:rgb(120 53 15 / var(--tw-text-opacity, 1))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-green-600:hover{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.hover\:text-green-700:hover{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.hover\:text-orange-700:hover{--tw-text-opacity: 1;color:rgb(194 65 12 / var(--tw-text-opacity, 1))}.hover\:text-primary:hover{color:hsl(var(--primary))}.hover\:text-primary\/80:hover{color:hsl(var(--primary) / .8)}.hover\:text-red-500:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.hover\:text-red-600:hover{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.hover\:text-red-700:hover{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.hover\:text-yellow-300:hover{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:opacity-80:hover{opacity:.8}.hover\:shadow-2xl:hover{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-md:hover{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:ring-2:hover{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.hover\:ring-primary:hover{--tw-ring-color: hsl(var(--primary))}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-gray-100:focus{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-0:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-red-500:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity, 1))}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--background))}.active\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.active\:cursor-grabbing:active{cursor:grabbing}.active\:border-primary\/70:active{border-color:hsl(var(--primary) / .7)}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group[open] .group-open\:rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:-translate-y-1{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:scale-110{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:opacity-100{opacity:1}.group.destructive .group-\[\.destructive\]\:border-muted\/40{border-color:hsl(var(--muted) / .4)}.group.destructive .group-\[\.destructive\]\:text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover{--tw-text-opacity: 1;color:rgb(254 242 242 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(248 113 113 / var(--tw-ring-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-offset-red-600:focus{--tw-ring-offset-color: #dc2626}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.aria-selected\:text-muted-foreground[aria-selected=true]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[state\=inactive\]\:hidden[data-state=inactive]{display:none}.data-\[state\=inactive\]\:h-0[data-state=inactive]{height:0px}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked],.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=cancel\]\:translate-y-0[data-swipe=cancel]{--tw-translate-y: 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\=end\]\:translate-y-\[var\(--radix-toast-swipe-end-y\)\][data-swipe=end]{--tw-translate-y: var(--radix-toast-swipe-end-y);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))}.data-\[swipe\=move\]\:translate-y-\[var\(--radix-toast-swipe-move-y\)\][data-swipe=move]{--tw-translate-y: var(--radix-toast-swipe-move-y);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}.data-\[state\=closed\]\:animate-slide-out-to-top[data-state=closed]{animation:slide-out-to-top .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-in-from-top{0%{transform:translateY(-100%)}to{transform:translateY(0)}}.data-\[state\=open\]\:animate-slide-in-from-top[data-state=open]{animation:slide-in-from-top .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}@keyframes slide-out-to-top{0%{transform:translateY(0)}to{transform:translateY(-100%)}}.data-\[swipe\=end\]\:animate-slide-out-to-top[data-swipe=end]{animation:slide-out-to-top .2s ease-in}.data-\[range-end\=true\]\:rounded-md[data-range-end=true]{border-radius:calc(var(--radius) - 2px)}.data-\[range-middle\=true\]\:rounded-none[data-range-middle=true]{border-radius:0}.data-\[range-start\=true\]\:rounded-md[data-range-start=true]{border-radius:calc(var(--radius) - 2px)}.data-\[selected\=true\]\:rounded-none[data-selected=true]{border-radius:0}.data-\[range-end\=true\]\:bg-primary[data-range-end=true]{background-color:hsl(var(--primary))}.data-\[range-middle\=true\]\:bg-accent[data-range-middle=true]{background-color:hsl(var(--accent))}.data-\[range-start\=true\]\:bg-primary[data-range-start=true],.data-\[selected-single\=true\]\:bg-primary[data-selected-single=true]{background-color:hsl(var(--primary))}.data-\[selected\=true\]\:bg-accent[data-selected=true]{background-color:hsl(var(--accent))}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:hsl(var(--muted))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[placeholder\]\:text-muted-foreground[data-placeholder]{color:hsl(var(--muted-foreground))}.data-\[range-end\=true\]\:text-primary-foreground[data-range-end=true]{color:hsl(var(--primary-foreground))}.data-\[range-middle\=true\]\:text-accent-foreground[data-range-middle=true]{color:hsl(var(--accent-foreground))}.data-\[range-start\=true\]\:text-primary-foreground[data-range-start=true],.data-\[selected-single\=true\]\:text-primary-foreground[data-selected-single=true]{color:hsl(var(--primary-foreground))}.data-\[selected\=true\]\:text-accent-foreground[data-selected=true]{color:hsl(var(--accent-foreground))}.data-\[state\=active\]\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\[state\=open\]\:text-accent-foreground[data-state=open]{color:hsl(var(--accent-foreground))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:opacity-50[data-disabled=true],.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[state\=active\]\:shadow-sm[data-state=active]{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}.data-\[state\=active\]\:duration-300[data-state=active]{transition-duration:.3s}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:relative{position:relative}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:z-10{z-index:10}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:border-ring{border-color:hsl(var(--ring))}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-\[3px\]{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-ring\/50{--tw-ring-color: hsl(var(--ring) / .5)}@supports (backdrop-filter: var(--tw)){.supports-\[backdrop-filter\]\:bg-background\/60{background-color:hsl(var(--background) / .6)}}.dark\:border-amber-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(146 64 14 / var(--tw-border-opacity, 1))}.dark\:border-blue-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 64 175 / var(--tw-border-opacity, 1))}.dark\:border-blue-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 58 138 / var(--tw-border-opacity, 1))}.dark\:border-gray-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(17 24 39 / var(--tw-border-opacity, 1))}.dark\:border-green-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(22 101 52 / var(--tw-border-opacity, 1))}.dark\:border-green-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(20 83 45 / var(--tw-border-opacity, 1))}.dark\:border-orange-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(124 45 18 / var(--tw-border-opacity, 1))}.dark\:border-red-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(127 29 29 / var(--tw-border-opacity, 1))}.dark\:border-yellow-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(113 63 18 / var(--tw-border-opacity, 1))}.dark\:bg-amber-950\/30:is(.dark *){background-color:#451a034d}.dark\:bg-blue-500\/20:is(.dark *){background-color:#3b82f633}.dark\:bg-blue-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 58 138 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(23 37 84 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-950\/20:is(.dark *){background-color:#17255433}.dark\:bg-blue-950\/30:is(.dark *){background-color:#1725544d}.dark\:bg-gray-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-800\/30:is(.dark *){background-color:#1f29374d}.dark\:bg-gray-800\/50:is(.dark *){background-color:#1f293780}.dark\:bg-gray-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(3 7 18 / var(--tw-bg-opacity, 1))}.dark\:bg-green-900\/30:is(.dark *){background-color:#14532d4d}.dark\:bg-green-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(5 46 22 / var(--tw-bg-opacity, 1))}.dark\:bg-green-950\/20:is(.dark *){background-color:#052e1633}.dark\:bg-orange-950\/20:is(.dark *){background-color:#43140733}.dark\:bg-red-500\/20:is(.dark *){background-color:#ef444433}.dark\:bg-red-600\/30:is(.dark *){background-color:#dc26264d}.dark\:bg-red-900\/30:is(.dark *){background-color:#7f1d1d4d}.dark\:bg-red-950\/20:is(.dark *){background-color:#450a0a33}.dark\:bg-red-950\/50:is(.dark *){background-color:#450a0a80}.dark\:bg-yellow-500\/20:is(.dark *){background-color:#eab30833}.dark\:bg-yellow-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(113 63 18 / var(--tw-bg-opacity, 1))}.dark\:bg-yellow-950\/30:is(.dark *){background-color:#4220064d}.dark\:from-amber-950\/20:is(.dark *){--tw-gradient-from: rgb(69 26 3 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(69 26 3 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.dark\:from-indigo-950\/20:is(.dark *){--tw-gradient-from: rgb(30 27 75 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(30 27 75 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.dark\:from-pink-950\/20:is(.dark *){--tw-gradient-from: rgb(80 7 36 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(80 7 36 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.dark\:from-rose-950\/20:is(.dark *){--tw-gradient-from: rgb(76 5 25 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(76 5 25 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.dark\:to-blue-950\/20:is(.dark *){--tw-gradient-to: rgb(23 37 84 / .2) var(--tw-gradient-to-position)}.dark\:to-orange-950\/20:is(.dark *){--tw-gradient-to: rgb(67 20 7 / .2) var(--tw-gradient-to-position)}.dark\:to-pink-950\/20:is(.dark *){--tw-gradient-to: rgb(80 7 36 / .2) var(--tw-gradient-to-position)}.dark\:to-purple-950\/20:is(.dark *){--tw-gradient-to: rgb(59 7 100 / .2) var(--tw-gradient-to-position)}.dark\:to-violet-950\/20:is(.dark *){--tw-gradient-to: rgb(46 16 101 / .2) var(--tw-gradient-to-position)}.dark\:text-amber-100:is(.dark *){--tw-text-opacity: 1;color:rgb(254 243 199 / var(--tw-text-opacity, 1))}.dark\:text-amber-200:is(.dark *){--tw-text-opacity: 1;color:rgb(253 230 138 / var(--tw-text-opacity, 1))}.dark\:text-amber-400:is(.dark *){--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.dark\:text-amber-500:is(.dark *){--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.dark\:text-blue-100:is(.dark *){--tw-text-opacity: 1;color:rgb(219 234 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-200:is(.dark *){--tw-text-opacity: 1;color:rgb(191 219 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-300:is(.dark *){--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.dark\:text-blue-400:is(.dark *){--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.dark\:text-cyan-500:is(.dark *){--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.dark\:text-gray-100:is(.dark *){--tw-text-opacity: 1;color:rgb(243 244 246 / var(--tw-text-opacity, 1))}.dark\:text-gray-400:is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.dark\:text-gray-600:is(.dark *){--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.dark\:text-green-300:is(.dark *){--tw-text-opacity: 1;color:rgb(134 239 172 / var(--tw-text-opacity, 1))}.dark\:text-green-400:is(.dark *){--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.dark\:text-indigo-400:is(.dark *){--tw-text-opacity: 1;color:rgb(129 140 248 / var(--tw-text-opacity, 1))}.dark\:text-orange-100:is(.dark *){--tw-text-opacity: 1;color:rgb(255 237 213 / var(--tw-text-opacity, 1))}.dark\:text-orange-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 215 170 / var(--tw-text-opacity, 1))}.dark\:text-red-300:is(.dark *){--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.dark\:text-red-400:is(.dark *){--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.dark\:text-red-500:is(.dark *){--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.dark\:text-yellow-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 240 138 / var(--tw-text-opacity, 1))}.dark\:text-yellow-300:is(.dark *){--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.dark\:text-yellow-400:is(.dark *){--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.dark\:text-yellow-500:is(.dark *){--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.dark\:hover\:bg-gray-800:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:hover\:text-amber-200:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(253 230 138 / var(--tw-text-opacity, 1))}.dark\:focus\:bg-gray-800:focus:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}@media(min-width:640px){.sm\:right-2{right:.5rem}.sm\:right-3{right:.75rem}.sm\:top-2{top:.5rem}.sm\:top-3{top:.75rem}.sm\:order-1{order:1}.sm\:order-2{order:2}.sm\:col-span-2{grid-column:span 2 / span 2}.sm\:mx-0{margin-left:0;margin-right:0}.sm\:mb-3{margin-bottom:.75rem}.sm\:mb-4{margin-bottom:1rem}.sm\:mb-6{margin-bottom:1.5rem}.sm\:ml-0{margin-left:0}.sm\:ml-1{margin-left:.25rem}.sm\:mr-1{margin-right:.25rem}.sm\:mt-0{margin-top:0}.sm\:mt-2{margin-top:.5rem}.sm\:mt-3{margin-top:.75rem}.sm\:mt-6{margin-top:1.5rem}.sm\:block{display:block}.sm\:inline{display:inline}.sm\:flex{display:flex}.sm\:grid{display:grid}.sm\:hidden{display:none}.sm\:h-10{height:2.5rem}.sm\:h-12{height:3rem}.sm\:h-2{height:.5rem}.sm\:h-2\.5{height:.625rem}.sm\:h-24{height:6rem}.sm\:h-4{height:1rem}.sm\:h-5{height:1.25rem}.sm\:h-8{height:2rem}.sm\:h-9{height:2.25rem}.sm\:h-\[300px\]{height:300px}.sm\:h-\[400px\]{height:400px}.sm\:h-\[500px\]{height:500px}.sm\:h-\[85vh\]{height:85vh}.sm\:h-\[calc\(100vh-220px\)\]{height:calc(100vh - 220px)}.sm\:h-\[calc\(100vh-280px\)\]{height:calc(100vh - 280px)}.sm\:w-10{width:2.5rem}.sm\:w-2{width:.5rem}.sm\:w-2\.5{width:.625rem}.sm\:w-24{width:6rem}.sm\:w-28{width:7rem}.sm\:w-32{width:8rem}.sm\:w-4{width:1rem}.sm\:w-48{width:12rem}.sm\:w-5{width:1.25rem}.sm\:w-8{width:2rem}.sm\:w-80{width:20rem}.sm\:w-96{width:24rem}.sm\:w-\[200px\]{width:200px}.sm\:w-\[500px\]{width:500px}.sm\:w-auto{width:auto}.sm\:w-full{width:100%}.sm\:min-w-\[120px\]{min-width:120px}.sm\:max-w-2xl{max-width:42rem}.sm\:max-w-32{max-width:8rem}.sm\:max-w-\[420px\]{max-width:420px}.sm\:max-w-\[500px\]{max-width:500px}.sm\:max-w-\[70\%\]{max-width:70%}.sm\:max-w-\[900px\]{max-width:900px}.sm\:max-w-md{max-width:28rem}.sm\:max-w-sm{max-width:24rem}.sm\:flex-1{flex:1 1 0%}.sm\:flex-none{flex:none}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.sm\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-start{align-items:flex-start}.sm\:items-center{align-items:center}.sm\:justify-end{justify-content:flex-end}.sm\:justify-between{justify-content:space-between}.sm\:gap-0{gap:0px}.sm\:gap-1{gap:.25rem}.sm\:gap-2{gap:.5rem}.sm\:gap-3{gap:.75rem}.sm\:gap-4{gap:1rem}.sm\:gap-6{gap:1.5rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.sm\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.sm\:space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.sm\:space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.sm\:space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:p-3{padding:.75rem}.sm\:p-4{padding:1rem}.sm\:p-6{padding:1.5rem}.sm\:p-8{padding:2rem}.sm\:px-0{padding-left:0;padding-right:0}.sm\:px-3{padding-left:.75rem;padding-right:.75rem}.sm\:px-4{padding-left:1rem;padding-right:1rem}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:py-2{padding-top:.5rem;padding-bottom:.5rem}.sm\:pb-3{padding-bottom:.75rem}.sm\:pt-6{padding-top:1.5rem}.sm\:text-left{text-align:left}.sm\:text-right{text-align:right}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-3xl{font-size:1.875rem;line-height:2.25rem}.sm\:text-6xl{font-size:3.75rem;line-height:1}.sm\:text-\[200px\]{font-size:200px}.sm\:text-base{font-size:1rem;line-height:1.5rem}.sm\:text-lg{font-size:1.125rem;line-height:1.75rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:text-xl{font-size:1.25rem;line-height:1.75rem}.sm\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:768px){.md\:top-4{top:1rem}.md\:col-span-2{grid-column:span 2 / span 2}.md\:mb-4{margin-bottom:1rem}.md\:mb-6{margin-bottom:1.5rem}.md\:mb-8{margin-bottom:2rem}.md\:mt-8{margin-top:2rem}.md\:block{display:block}.md\:inline{display:inline}.md\:flex{display:flex}.md\:hidden{display:none}.md\:h-16{height:4rem}.md\:h-4{height:1rem}.md\:h-5{height:1.25rem}.md\:h-8{height:2rem}.md\:h-96{height:24rem}.md\:h-\[500px\]{height:500px}.md\:min-h-\[400px\]{min-height:400px}.md\:w-16{width:4rem}.md\:w-4{width:1rem}.md\:w-5{width:1.25rem}.md\:w-8{width:2rem}.md\:w-96{width:24rem}.md\:max-w-none{max-width:none}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:gap-2{gap:.5rem}.md\:gap-3{gap:.75rem}.md\:gap-4{gap:1rem}.md\:gap-6{gap:1.5rem}.md\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.md\:space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.md\:whitespace-normal{white-space:normal}.md\:p-12{padding:3rem}.md\:p-4{padding:1rem}.md\:p-6{padding:1.5rem}.md\:p-8{padding:2rem}.md\:text-2xl{font-size:1.5rem;line-height:2rem}.md\:text-3xl{font-size:1.875rem;line-height:2.25rem}.md\:text-base{font-size:1rem;line-height:1.5rem}.md\:text-lg{font-size:1.125rem;line-height:1.75rem}.md\:text-sm{font-size:.875rem;line-height:1.25rem}.md\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:1024px){.lg\:invisible{visibility:hidden}.lg\:relative{position:relative}.lg\:z-0{z-index:0}.lg\:col-span-1{grid-column:span 1 / span 1}.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:mx-auto{margin-left:auto;margin-right:auto}.lg\:mb-1{margin-bottom:.25rem}.lg\:block{display:block}.lg\:inline{display:inline}.lg\:flex{display:flex}.lg\:hidden{display:none}.lg\:w-12{width:3rem}.lg\:w-16{width:4rem}.lg\:w-64{width:16rem}.lg\:w-8{width:2rem}.lg\:w-\[130px\]{width:130px}.lg\:w-\[160px\]{width:160px}.lg\:w-\[75px\]{width:75px}.lg\:w-auto{width:auto}.lg\:w-full{width:100%}.lg\:max-w-0{max-width:0px}.lg\:flex-1{flex:1 1 0%}.lg\:flex-none{flex:none}.lg\:translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\:grid-cols-10{grid-template-columns:repeat(10,minmax(0,1fr))}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.lg\:grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.lg\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}.lg\:flex-row{flex-direction:row}.lg\:items-center{align-items:center}.lg\:justify-center{justify-content:center}.lg\:gap-0{gap:0px}.lg\:space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.lg\:overflow-hidden{overflow:hidden}.lg\:p-2{padding:.5rem}.lg\:p-4{padding:1rem}.lg\:px-0{padding-left:0;padding-right:0}.lg\:px-4{padding-left:1rem;padding-right:1rem}.lg\:pb-4{padding-bottom:1rem}.lg\:text-2xl{font-size:1.5rem;line-height:2rem}.lg\:opacity-0{opacity:0}}@media(min-width:1280px){.xl\:grid-cols-10{grid-template-columns:repeat(10,minmax(0,1fr))}.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.xl\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}}@media print{.print\:hidden{display:none}.print\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.print\:rounded-none{border-radius:0}.print\:p-0{padding:0}.print\:shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}}.\[\&\+div\]\:text-xs+div{font-size:.75rem;line-height:1rem}.\[\&\:\:-webkit-scrollbar-thumb\:hover\]\:bg-border\/80::-webkit-scrollbar-thumb:hover{background-color:hsl(var(--border) / .8)}.\[\&\:\:-webkit-scrollbar-thumb\]\:rounded-full::-webkit-scrollbar-thumb{border-radius:9999px}.\[\&\:\:-webkit-scrollbar-thumb\]\:bg-border::-webkit-scrollbar-thumb{background-color:hsl(var(--border))}.\[\&\:\:-webkit-scrollbar-track\]\:bg-transparent::-webkit-scrollbar-track{background-color:transparent}.\[\&\:\:-webkit-scrollbar\]\:w-2\.5::-webkit-scrollbar{width:.625rem}.\[\&\:first-child\[data-selected\=true\]_button\]\:rounded-l-md:first-child[data-selected=true] button{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\:last-child\[data-selected\=true\]_button\]\:rounded-r-md:last-child[data-selected=true] button{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\>\[role\=checkbox\]\]\:translate-y-\[2px\]>[role=checkbox]{--tw-translate-y: 2px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>div\]\:bg-green-500>div{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.\[\&\>span\]\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\[\&\>span\]\:text-xs>span{font-size:.75rem;line-height:1rem}.\[\&\>span\]\:opacity-70>span{opacity:.7}.\[\&\>svg\+div\]\:translate-y-0>svg+div{--tw-translate-y: 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))}.\[\&\>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/index.html b/webui/dist/index.html index 1a5c946b..73dee5a9 100644 --- a/webui/dist/index.html +++ b/webui/dist/index.html @@ -11,7 +11,7 @@ MaiBot Dashboard - + @@ -25,7 +25,7 @@ - +