From 0e499f01ce8b338fc5cb541dcecbd16eddbed890 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A2=A8=E6=A2=93=E6=9F=92?= <1787882683@qq.com> Date: Sun, 14 Dec 2025 01:11:36 +0800 Subject: [PATCH] WebUI 61ad8f5ac3fe7d2ebebe1c473e200bd2a95e6a44 --- webui/dist/assets/dnd-B_gmzEl7.js | 5 ++ webui/dist/assets/dnd-CHfCzWUK.js | 5 -- webui/dist/assets/index-B3fQDlNr.css | 1 + .../{index-DTswSzg5.js => index-BDQi9W1Z.js} | 84 +++++++++---------- webui/dist/assets/index-Bn-Lwe3B.css | 1 - webui/dist/index.html | 6 +- 6 files changed, 51 insertions(+), 51 deletions(-) create mode 100644 webui/dist/assets/dnd-B_gmzEl7.js delete mode 100644 webui/dist/assets/dnd-CHfCzWUK.js create mode 100644 webui/dist/assets/index-B3fQDlNr.css rename webui/dist/assets/{index-DTswSzg5.js => index-BDQi9W1Z.js} (62%) delete mode 100644 webui/dist/assets/index-Bn-Lwe3B.css diff --git a/webui/dist/assets/dnd-B_gmzEl7.js b/webui/dist/assets/dnd-B_gmzEl7.js new file mode 100644 index 00000000..3d96b92e --- /dev/null +++ b/webui/dist/assets/dnd-B_gmzEl7.js @@ -0,0 +1,5 @@ +import{r as c,R as P,b as Oe}from"./router-Bz250laD.js";function Sn(){for(var e=arguments.length,t=new Array(e),n=0;nr=>{t.forEach(o=>o(r))},t)}const tt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function me(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function bt(e){return"nodeType"in e}function B(e){var t,n;return e?me(e)?e:bt(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function wt(e){const{Document:t}=B(e);return e instanceof t}function Be(e){return me(e)?!1:e instanceof B(e).HTMLElement}function Wt(e){return e instanceof B(e).SVGElement}function ye(e){return e?me(e)?e.document:bt(e)?wt(e)?e:Be(e)||Wt(e)?e.ownerDocument:document:document:document}const Q=tt?c.useLayoutEffect:c.useEffect;function mt(e){const t=c.useRef(e);return Q(()=>{t.current=e}),c.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o{e.current=setInterval(r,o)},[]),n=c.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function ke(e,t){t===void 0&&(t=[e]);const n=c.useRef(e);return Q(()=>{n.current!==e&&(n.current=e)},t),n}function Fe(e,t){const n=c.useRef();return c.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Je(e){const t=mt(e),n=c.useRef(null),r=c.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function ft(e){const t=c.useRef();return c.useEffect(()=>{t.current=e},[e]),t.current}let ct={};function $e(e,t){return c.useMemo(()=>{if(t)return t;const n=ct[e]==null?0:ct[e]+1;return ct[e]=n,e+"-"+n},[e,t])}function Ht(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o{const a=Object.entries(s);for(const[l,u]of a){const f=i[l];f!=null&&(i[l]=f+e*u)}return i},{...t})}}const we=Ht(1),ze=Ht(-1);function In(e){return"clientX"in e&&"clientY"in e}function yt(e){if(!e)return!1;const{KeyboardEvent:t}=B(e.target);return t&&e instanceof t}function Mn(e){if(!e)return!1;const{TouchEvent:t}=B(e.target);return t&&e instanceof t}function ht(e){if(Mn(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return In(e)?{x:e.clientX,y:e.clientY}:null}const _e=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[_e.Translate.toString(e),_e.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Tt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function An(e){return e.matches(Tt)?e:e.querySelector(Tt)}const On={display:"none"};function Tn(e){let{id:t,value:n}=e;return P.createElement("div",{id:t,style:On},n)}function Nn(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return P.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function Ln(){const[e,t]=c.useState("");return{announce:c.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Kt=c.createContext(null);function kn(e){const t=c.useContext(Kt);c.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(e)},[e,t])}function zn(){const[e]=c.useState(()=>new Set),t=c.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[c.useCallback(r=>{let{type:o,event:i}=r;e.forEach(s=>{var a;return(a=s[o])==null?void 0:a.call(s,i)})},[e]),t]}const Pn={draggable:` + To pick up a draggable item, press the space bar. + While dragging, use the arrow keys to move the item. + Press space again to drop the item in its new position, or press escape to cancel. + `},Bn={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Fn(e){let{announcements:t=Bn,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=Pn}=e;const{announce:i,announcement:s}=Ln(),a=$e("DndLiveRegion"),[l,u]=c.useState(!1);if(c.useEffect(()=>{u(!0)},[]),kn(c.useMemo(()=>({onDragStart(d){let{active:g}=d;i(t.onDragStart({active:g}))},onDragMove(d){let{active:g,over:h}=d;t.onDragMove&&i(t.onDragMove({active:g,over:h}))},onDragOver(d){let{active:g,over:h}=d;i(t.onDragOver({active:g,over:h}))},onDragEnd(d){let{active:g,over:h}=d;i(t.onDragEnd({active:g,over:h}))},onDragCancel(d){let{active:g,over:h}=d;i(t.onDragCancel({active:g,over:h}))}}),[i,t])),!l)return null;const f=P.createElement(P.Fragment,null,P.createElement(Tn,{id:r,value:o.draggable}),P.createElement(Nn,{id:a,announcement:s}));return n?Oe.createPortal(f,n):f}var O;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(O||(O={}));function Qe(){}function ao(e,t){return c.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function co(){for(var e=arguments.length,t=new Array(e),n=0;n[...t].filter(r=>r!=null),[...t])}const V=Object.freeze({x:0,y:0});function Vt(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function qt(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function $n(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Nt(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function Gt(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function Lt(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const lo=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Lt(t,t.left,t.top),i=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const u=Vt(Lt(l),o);i.push({id:a,data:{droppableContainer:s,value:u}})}}return i.sort(qt)},Xn=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Nt(t),i=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const u=Nt(l),f=o.reduce((g,h,C)=>g+Vt(u[C],h),0),d=Number((f/4).toFixed(4));i.push({id:a,data:{droppableContainer:s,value:d}})}}return i.sort(qt)};function Yn(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),s=o-r,a=i-n;if(r{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const i of r){const{id:s}=i,a=n.get(s);if(a){const l=Yn(a,t);l>0&&o.push({id:s,data:{droppableContainer:i,value:l}})}}return o.sort($n)};function Un(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Jt(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:V}function Wn(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i({...s,top:s.top+e*a.y,bottom:s.bottom+e*a.y,left:s.left+e*a.x,right:s.right+e*a.x}),{...n})}}const Hn=Wn(1);function Kn(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Vn(e,t,n){const r=Kn(t);if(!r)return e;const{scaleX:o,scaleY:i,x:s,y:a}=r,l=e.left-s-(1-o)*parseFloat(n),u=e.top-a-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),f=o?e.width/o:e.width,d=i?e.height/i:e.height;return{width:f,height:d,top:u,right:l+f,bottom:u+d,left:l}}const qn={ignoreTransform:!1};function xe(e,t){t===void 0&&(t=qn);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:f}=B(e).getComputedStyle(e);u&&(n=Vn(n,u,f))}const{top:r,left:o,width:i,height:s,bottom:a,right:l}=n;return{top:r,left:o,width:i,height:s,bottom:a,right:l}}function kt(e){return xe(e,{ignoreTransform:!0})}function Gn(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Jn(e,t){return t===void 0&&(t=B(e).getComputedStyle(e)),t.position==="fixed"}function _n(e,t){t===void 0&&(t=B(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const i=t[o];return typeof i=="string"?n.test(i):!1})}function nt(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(wt(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Be(o)||Wt(o)||n.includes(o))return n;const i=B(e).getComputedStyle(o);return o!==e&&_n(o,i)&&n.push(o),Jn(o,i)?n:r(o.parentNode)}return e?r(e):n}function _t(e){const[t]=nt(e,1);return t??null}function lt(e){return!tt||!e?null:me(e)?e:bt(e)?wt(e)||e===ye(e).scrollingElement?window:Be(e)?e:null:null}function Qt(e){return me(e)?e.scrollX:e.scrollLeft}function Zt(e){return me(e)?e.scrollY:e.scrollTop}function gt(e){return{x:Qt(e),y:Zt(e)}}var N;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(N||(N={}));function en(e){return!tt||!e?!1:e===document.scrollingElement}function tn(e){const t={x:0,y:0},n=en(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,s=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:o,isLeft:i,isBottom:s,isRight:a,maxScroll:r,minScroll:t}}const Qn={x:.2,y:.2};function Zn(e,t,n,r,o){let{top:i,left:s,right:a,bottom:l}=n;r===void 0&&(r=10),o===void 0&&(o=Qn);const{isTop:u,isBottom:f,isLeft:d,isRight:g}=tn(e),h={x:0,y:0},C={x:0,y:0},v={height:t.height*o.y,width:t.width*o.x};return!u&&i<=t.top+v.height?(h.y=N.Backward,C.y=r*Math.abs((t.top+v.height-i)/v.height)):!f&&l>=t.bottom-v.height&&(h.y=N.Forward,C.y=r*Math.abs((t.bottom-v.height-l)/v.height)),!g&&a>=t.right-v.width?(h.x=N.Forward,C.x=r*Math.abs((t.right-v.width-a)/v.width)):!d&&s<=t.left+v.width&&(h.x=N.Backward,C.x=r*Math.abs((t.left+v.width-s)/v.width)),{direction:h,speed:C}}function er(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:s}=window;return{top:0,left:0,right:i,bottom:s,width:i,height:s}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function nn(e){return e.reduce((t,n)=>we(t,gt(n)),V)}function tr(e){return e.reduce((t,n)=>t+Qt(n),0)}function nr(e){return e.reduce((t,n)=>t+Zt(n),0)}function rr(e,t){if(t===void 0&&(t=xe),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);_t(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const or=[["x",["left","right"],tr],["y",["top","bottom"],nr]];class xt{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=nt(n),o=nn(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,s,a]of or)for(const l of s)Object.defineProperty(this,l,{get:()=>{const u=a(r),f=o[i]-u;return this.rect[l]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Te{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function ir(e){const{EventTarget:t}=B(e);return e instanceof t?e:ye(e)}function ut(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var W;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(W||(W={}));function zt(e){e.preventDefault()}function sr(e){e.stopPropagation()}var w;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(w||(w={}));const rn={start:[w.Space,w.Enter],cancel:[w.Esc],end:[w.Space,w.Enter,w.Tab]},ar=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case w.Right:return{...n,x:n.x+25};case w.Left:return{...n,x:n.x-25};case w.Down:return{...n,y:n.y+25};case w.Up:return{...n,y:n.y-25}}};class on{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Te(ye(n)),this.windowListeners=new Te(B(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(W.Resize,this.handleCancel),this.windowListeners.add(W.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(W.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&rr(r),n(V)}handleKeyDown(t){if(yt(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:i=rn,coordinateGetter:s=ar,scrollBehavior:a="smooth"}=o,{code:l}=t;if(i.end.includes(l)){this.handleEnd(t);return}if(i.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:u}=r.current,f=u?{x:u.left,y:u.top}:V;this.referenceCoordinates||(this.referenceCoordinates=f);const d=s(t,{active:n,context:r.current,currentCoordinates:f});if(d){const g=ze(d,f),h={x:0,y:0},{scrollableAncestors:C}=r.current;for(const v of C){const p=t.code,{isTop:m,isRight:y,isLeft:b,isBottom:R,maxScroll:S,minScroll:E}=tn(v),x=er(v),D={x:Math.min(p===w.Right?x.right-x.width/2:x.right,Math.max(p===w.Right?x.left:x.left+x.width/2,d.x)),y:Math.min(p===w.Down?x.bottom-x.height/2:x.bottom,Math.max(p===w.Down?x.top:x.top+x.height/2,d.y))},A=p===w.Right&&!y||p===w.Left&&!b,T=p===w.Down&&!R||p===w.Up&&!m;if(A&&D.x!==d.x){const M=v.scrollLeft+g.x,H=p===w.Right&&M<=S.x||p===w.Left&&M>=E.x;if(H&&!g.y){v.scrollTo({left:M,behavior:a});return}H?h.x=v.scrollLeft-M:h.x=p===w.Right?v.scrollLeft-S.x:v.scrollLeft-E.x,h.x&&v.scrollBy({left:-h.x,behavior:a});break}else if(T&&D.y!==d.y){const M=v.scrollTop+g.y,H=p===w.Down&&M<=S.y||p===w.Up&&M>=E.y;if(H&&!g.x){v.scrollTo({top:M,behavior:a});return}H?h.y=v.scrollTop-M:h.y=p===w.Down?v.scrollTop-S.y:v.scrollTop-E.y,h.y&&v.scrollBy({top:-h.y,behavior:a});break}}this.handleMove(t,we(ze(d,this.referenceCoordinates),h))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}on.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=rn,onActivation:o}=t,{active:i}=n;const{code:s}=e.nativeEvent;if(r.start.includes(s)){const a=i.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function Pt(e){return!!(e&&"distance"in e)}function Bt(e){return!!(e&&"delay"in e)}class Dt{constructor(t,n,r){var o;r===void 0&&(r=ir(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:i}=t,{target:s}=i;this.props=t,this.events=n,this.document=ye(s),this.documentListeners=new Te(this.document),this.listeners=new Te(r),this.windowListeners=new Te(B(s)),this.initialCoordinates=(o=ht(i))!=null?o:V,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(W.Resize,this.handleCancel),this.windowListeners.add(W.DragStart,zt),this.windowListeners.add(W.VisibilityChange,this.handleCancel),this.windowListeners.add(W.ContextMenu,zt),this.documentListeners.add(W.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Bt(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Pt(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(W.Click,sr,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(W.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:i}=this,{onMove:s,options:{activationConstraint:a}}=i;if(!o)return;const l=(n=ht(t))!=null?n:V,u=ze(o,l);if(!r&&a){if(Pt(a)){if(a.tolerance!=null&&ut(u,a.tolerance))return this.handleCancel();if(ut(u,a.distance))return this.handleStart()}if(Bt(a)&&ut(u,a.tolerance))return this.handleCancel();this.handlePending(a,u);return}t.cancelable&&t.preventDefault(),s(l)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===w.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const cr={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class sn extends Dt{constructor(t){const{event:n}=t,r=ye(n.target);super(t,cr,r)}}sn.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const lr={move:{name:"mousemove"},end:{name:"mouseup"}};var vt;(function(e){e[e.RightClick=2]="RightClick"})(vt||(vt={}));class ur extends Dt{constructor(t){super(t,lr,ye(t.event.target))}}ur.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===vt.RightClick?!1:(r?.({event:n}),!0)}}];const dt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class dr extends Dt{constructor(t){super(t,dt)}static setup(){return window.addEventListener(dt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(dt.move.name,t)};function t(){}}}dr.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r?.({event:n}),!0)}}];var Ne;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Ne||(Ne={}));var Ze;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Ze||(Ze={}));function fr(e){let{acceleration:t,activator:n=Ne.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:s=5,order:a=Ze.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:f,delta:d,threshold:g}=e;const h=gr({delta:d,disabled:!i}),[C,v]=En(),p=c.useRef({x:0,y:0}),m=c.useRef({x:0,y:0}),y=c.useMemo(()=>{switch(n){case Ne.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Ne.DraggableRect:return o}},[n,o,l]),b=c.useRef(null),R=c.useCallback(()=>{const E=b.current;if(!E)return;const x=p.current.x*m.current.x,D=p.current.y*m.current.y;E.scrollBy(x,D)},[]),S=c.useMemo(()=>a===Ze.TreeOrder?[...u].reverse():u,[a,u]);c.useEffect(()=>{if(!i||!u.length||!y){v();return}for(const E of S){if(r?.(E)===!1)continue;const x=u.indexOf(E),D=f[x];if(!D)continue;const{direction:A,speed:T}=Zn(E,D,y,t,g);for(const M of["x","y"])h[M][A[M]]||(T[M]=0,A[M]=0);if(T.x>0||T.y>0){v(),b.current=E,C(R,s),p.current=T,m.current=A;return}}p.current={x:0,y:0},m.current={x:0,y:0},v()},[t,R,r,v,i,s,JSON.stringify(y),JSON.stringify(h),C,u,S,f,JSON.stringify(g)])}const hr={x:{[N.Backward]:!1,[N.Forward]:!1},y:{[N.Backward]:!1,[N.Forward]:!1}};function gr(e){let{delta:t,disabled:n}=e;const r=ft(t);return Fe(o=>{if(n||!r||!o)return hr;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[N.Backward]:o.x[N.Backward]||i.x===-1,[N.Forward]:o.x[N.Forward]||i.x===1},y:{[N.Backward]:o.y[N.Backward]||i.y===-1,[N.Forward]:o.y[N.Forward]||i.y===1}}},[n,t,r])}function vr(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Fe(o=>{var i;return t==null?null:(i=r??o)!=null?i:null},[r,t])}function pr(e,t){return c.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,i=o.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,r)}));return[...n,...i]},[]),[e,t])}var Pe;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Pe||(Pe={}));var pt;(function(e){e.Optimized="optimized"})(pt||(pt={}));const Ft=new Map;function br(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,s]=c.useState(null),{frequency:a,measure:l,strategy:u}=o,f=c.useRef(e),d=p(),g=ke(d),h=c.useCallback(function(m){m===void 0&&(m=[]),!g.current&&s(y=>y===null?m:y.concat(m.filter(b=>!y.includes(b))))},[g]),C=c.useRef(null),v=Fe(m=>{if(d&&!n)return Ft;if(!m||m===Ft||f.current!==e||i!=null){const y=new Map;for(let b of e){if(!b)continue;if(i&&i.length>0&&!i.includes(b.id)&&b.rect.current){y.set(b.id,b.rect.current);continue}const R=b.node.current,S=R?new xt(l(R),R):null;b.rect.current=S,S&&y.set(b.id,S)}return y}return m},[e,i,n,d,l]);return c.useEffect(()=>{f.current=e},[e]),c.useEffect(()=>{d||h()},[n,d]),c.useEffect(()=>{i&&i.length>0&&s(null)},[JSON.stringify(i)]),c.useEffect(()=>{d||typeof a!="number"||C.current!==null||(C.current=setTimeout(()=>{h(),C.current=null},a))},[a,d,h,...r]),{droppableRects:v,measureDroppableContainers:h,measuringScheduled:i!=null};function p(){switch(u){case Pe.Always:return!1;case Pe.BeforeDragging:return n;default:return!n}}}function an(e,t){return Fe(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function wr(e,t){return an(e,t)}function mr(e){let{callback:t,disabled:n}=e;const r=mt(t),o=c.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return c.useEffect(()=>()=>o?.disconnect(),[o]),o}function rt(e){let{callback:t,disabled:n}=e;const r=mt(t),o=c.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return c.useEffect(()=>()=>o?.disconnect(),[o]),o}function yr(e){return new xt(xe(e),e)}function $t(e,t,n){t===void 0&&(t=yr);const[r,o]=c.useState(null);function i(){o(l=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=l??n)!=null?u:null}const f=t(e);return JSON.stringify(l)===JSON.stringify(f)?l:f})}const s=mr({callback(l){if(e)for(const u of l){const{type:f,target:d}=u;if(f==="childList"&&d instanceof HTMLElement&&d.contains(e)){i();break}}}}),a=rt({callback:i});return Q(()=>{i(),e?(a?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),s?.disconnect())},[e]),r}function xr(e){const t=an(e);return Jt(e,t)}const Xt=[];function Dr(e){const t=c.useRef(e),n=Fe(r=>e?r&&r!==Xt&&e&&t.current&&e.parentNode===t.current.parentNode?r:nt(e):Xt,[e]);return c.useEffect(()=>{t.current=e},[e]),n}function Cr(e){const[t,n]=c.useState(null),r=c.useRef(e),o=c.useCallback(i=>{const s=lt(i.target);s&&n(a=>a?(a.set(s,gt(s)),new Map(a)):null)},[]);return c.useEffect(()=>{const i=r.current;if(e!==i){s(i);const a=e.map(l=>{const u=lt(l);return u?(u.addEventListener("scroll",o,{passive:!0}),[u,gt(u)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=e}return()=>{s(e),s(i)};function s(a){a.forEach(l=>{const u=lt(l);u?.removeEventListener("scroll",o)})}},[o,e]),c.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,s)=>we(i,s),V):nn(e):V,[e,t])}function Yt(e,t){t===void 0&&(t=[]);const n=c.useRef(null);return c.useEffect(()=>{n.current=null},t),c.useEffect(()=>{const r=e!==V;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?ze(e,n.current):V}function Rr(e){c.useEffect(()=>{if(!tt)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function Sr(e,t){return c.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:i}=r;return n[o]=s=>{i(s,t)},n},{}),[e,t])}function cn(e){return c.useMemo(()=>e?Gn(e):null,[e])}const jt=[];function Er(e,t){t===void 0&&(t=xe);const[n]=e,r=cn(n?B(n):null),[o,i]=c.useState(jt);function s(){i(()=>e.length?e.map(l=>en(l)?r:new xt(t(l),l)):jt)}const a=rt({callback:s});return Q(()=>{a?.disconnect(),s(),e.forEach(l=>a?.observe(l))},[e]),o}function Ir(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Be(t)?t:e}function Mr(e){let{measure:t}=e;const[n,r]=c.useState(null),o=c.useCallback(u=>{for(const{target:f}of u)if(Be(f)){r(d=>{const g=t(f);return d?{...d,width:g.width,height:g.height}:g});break}},[t]),i=rt({callback:o}),s=c.useCallback(u=>{const f=Ir(u);i?.disconnect(),f&&i?.observe(f),r(f?t(f):null)},[t,i]),[a,l]=Je(s);return c.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const Ar=[{sensor:sn,options:{}},{sensor:on,options:{}}],Or={current:{}},Ge={draggable:{measure:kt},droppable:{measure:kt,strategy:Pe.WhileDragging,frequency:pt.Optimized},dragOverlay:{measure:xe}};class Le extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const Tr={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Le,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Qe},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Ge,measureDroppableContainers:Qe,windowRect:null,measuringScheduled:!1},Nr={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Qe,draggableNodes:new Map,over:null,measureDroppableContainers:Qe},ot=c.createContext(Nr),ln=c.createContext(Tr);function Lr(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Le}}}function kr(e,t){switch(t.type){case O.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case O.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case O.DragEnd:case O.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case O.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Le(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case O.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const s=new Le(e.droppable.containers);return s.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:s}}}case O.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new Le(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function zr(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=c.useContext(ot),i=ft(r),s=ft(n?.id);return c.useEffect(()=>{if(!t&&!r&&i&&s!=null){if(!yt(i)||document.activeElement===i.target)return;const a=o.get(s);if(!a)return;const{activatorNode:l,node:u}=a;if(!l.current&&!u.current)return;requestAnimationFrame(()=>{for(const f of[l.current,u.current]){if(!f)continue;const d=An(f);if(d){d.focus();break}}})}},[r,t,o,s,i]),null}function Pr(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...r}),n):n}function Br(e){return c.useMemo(()=>({draggable:{...Ge.draggable,...e?.draggable},droppable:{...Ge.droppable,...e?.droppable},dragOverlay:{...Ge.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Fr(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=c.useRef(!1),{x:s,y:a}=typeof o=="boolean"?{x:o,y:o}:o;Q(()=>{if(!s&&!a||!t){i.current=!1;return}if(i.current||!r)return;const u=t?.node.current;if(!u||u.isConnected===!1)return;const f=n(u),d=Jt(f,r);if(s||(d.x=0),a||(d.y=0),i.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const g=_t(u);g&&g.scrollBy({top:d.y,left:d.x})}},[t,s,a,r,n])}const un=c.createContext({...V,scaleX:1,scaleY:1});var ue;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ue||(ue={}));const uo=c.memo(function(t){var n,r,o,i;let{id:s,accessibility:a,autoScroll:l=!0,children:u,sensors:f=Ar,collisionDetection:d=jn,measuring:g,modifiers:h,...C}=t;const v=c.useReducer(kr,void 0,Lr),[p,m]=v,[y,b]=zn(),[R,S]=c.useState(ue.Uninitialized),E=R===ue.Initialized,{draggable:{active:x,nodes:D,translate:A},droppable:{containers:T}}=p,M=x!=null?D.get(x):null,H=c.useRef({initial:null,translated:null}),K=c.useMemo(()=>{var k;return x!=null?{id:x,data:(k=M?.data)!=null?k:Or,rect:H}:null},[x,M]),q=c.useRef(null),[De,Xe]=c.useState(null),[F,Ye]=c.useState(null),Z=ke(C,Object.values(C)),Ce=$e("DndDescribedBy",s),je=c.useMemo(()=>T.getEnabled(),[T]),z=Br(g),{droppableRects:ee,measureDroppableContainers:de,measuringScheduled:Re}=br(je,{dragging:E,dependencies:[A.x,A.y],config:z.droppable}),j=vr(D,x),Ue=c.useMemo(()=>F?ht(F):null,[F]),oe=Rn(),te=wr(j,z.draggable.measure);Fr({activeNode:x!=null?D.get(x):null,config:oe.layoutShiftCompensation,initialRect:te,measure:z.draggable.measure});const I=$t(j,z.draggable.measure,te),Se=$t(j?j.parentElement:null),G=c.useRef({activatorEvent:null,active:null,activeNode:j,collisionRect:null,collisions:null,droppableRects:ee,draggableNodes:D,draggingNode:null,draggingNodeRect:null,droppableContainers:T,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),fe=T.getNodeFor((n=G.current.over)==null?void 0:n.id),ne=Mr({measure:z.dragOverlay.measure}),he=(r=ne.nodeRef.current)!=null?r:j,ge=E?(o=ne.rect)!=null?o:I:null,Ct=!!(ne.nodeRef.current&&ne.rect),Rt=xr(Ct?null:I),it=cn(he?B(he):null),ie=Dr(E?fe??j:null),We=Er(ie),He=Pr(h,{transform:{x:A.x-Rt.x,y:A.y-Rt.y,scaleX:1,scaleY:1},activatorEvent:F,active:K,activeNodeRect:I,containerNodeRect:Se,draggingNodeRect:ge,over:G.current.over,overlayNodeRect:ne.rect,scrollableAncestors:ie,scrollableAncestorRects:We,windowRect:it}),St=Ue?we(Ue,A):null,Et=Cr(ie),bn=Yt(Et),wn=Yt(Et,[I]),ve=we(He,bn),pe=ge?Hn(ge,He):null,Ee=K&&pe?d({active:K,collisionRect:pe,droppableRects:ee,droppableContainers:je,pointerCoordinates:St}):null,It=Gt(Ee,"id"),[se,Mt]=c.useState(null),mn=Ct?He:we(He,wn),yn=Un(mn,(i=se?.rect)!=null?i:null,I),st=c.useRef(null),At=c.useCallback((k,$)=>{let{sensor:X,options:ae}=$;if(q.current==null)return;const U=D.get(q.current);if(!U)return;const Y=k.nativeEvent,J=new X({active:q.current,activeNode:U,event:Y,options:ae,context:G,onAbort(L){if(!D.get(L))return;const{onDragAbort:_}=Z.current,re={id:L};_?.(re),y({type:"onDragAbort",event:re})},onPending(L,ce,_,re){if(!D.get(L))return;const{onDragPending:Me}=Z.current,le={id:L,constraint:ce,initialCoordinates:_,offset:re};Me?.(le),y({type:"onDragPending",event:le})},onStart(L){const ce=q.current;if(ce==null)return;const _=D.get(ce);if(!_)return;const{onDragStart:re}=Z.current,Ie={activatorEvent:Y,active:{id:ce,data:_.data,rect:H}};Oe.unstable_batchedUpdates(()=>{re?.(Ie),S(ue.Initializing),m({type:O.DragStart,initialCoordinates:L,active:ce}),y({type:"onDragStart",event:Ie}),Xe(st.current),Ye(Y)})},onMove(L){m({type:O.DragMove,coordinates:L})},onEnd:be(O.DragEnd),onCancel:be(O.DragCancel)});st.current=J;function be(L){return async function(){const{active:_,collisions:re,over:Ie,scrollAdjustedTranslate:Me}=G.current;let le=null;if(_&&Me){const{cancelDrop:Ae}=Z.current;le={activatorEvent:Y,active:_,collisions:re,delta:Me,over:Ie},L===O.DragEnd&&typeof Ae=="function"&&await Promise.resolve(Ae(le))&&(L=O.DragCancel)}q.current=null,Oe.unstable_batchedUpdates(()=>{m({type:L}),S(ue.Uninitialized),Mt(null),Xe(null),Ye(null),st.current=null;const Ae=L===O.DragEnd?"onDragEnd":"onDragCancel";if(le){const at=Z.current[Ae];at?.(le),y({type:Ae,event:le})}})}}},[D]),xn=c.useCallback((k,$)=>(X,ae)=>{const U=X.nativeEvent,Y=D.get(ae);if(q.current!==null||!Y||U.dndKit||U.defaultPrevented)return;const J={active:Y};k(X,$.options,J)===!0&&(U.dndKit={capturedBy:$.sensor},q.current=ae,At(X,$))},[D,At]),Ot=pr(f,xn);Rr(f),Q(()=>{I&&R===ue.Initializing&&S(ue.Initialized)},[I,R]),c.useEffect(()=>{const{onDragMove:k}=Z.current,{active:$,activatorEvent:X,collisions:ae,over:U}=G.current;if(!$||!X)return;const Y={active:$,activatorEvent:X,collisions:ae,delta:{x:ve.x,y:ve.y},over:U};Oe.unstable_batchedUpdates(()=>{k?.(Y),y({type:"onDragMove",event:Y})})},[ve.x,ve.y]),c.useEffect(()=>{const{active:k,activatorEvent:$,collisions:X,droppableContainers:ae,scrollAdjustedTranslate:U}=G.current;if(!k||q.current==null||!$||!U)return;const{onDragOver:Y}=Z.current,J=ae.get(It),be=J&&J.rect.current?{id:J.id,rect:J.rect.current,data:J.data,disabled:J.disabled}:null,L={active:k,activatorEvent:$,collisions:X,delta:{x:U.x,y:U.y},over:be};Oe.unstable_batchedUpdates(()=>{Mt(be),Y?.(L),y({type:"onDragOver",event:L})})},[It]),Q(()=>{G.current={activatorEvent:F,active:K,activeNode:j,collisionRect:pe,collisions:Ee,droppableRects:ee,draggableNodes:D,draggingNode:he,draggingNodeRect:ge,droppableContainers:T,over:se,scrollableAncestors:ie,scrollAdjustedTranslate:ve},H.current={initial:ge,translated:pe}},[K,j,Ee,pe,D,he,ge,ee,T,se,ie,ve]),fr({...oe,delta:A,draggingRect:pe,pointerCoordinates:St,scrollableAncestors:ie,scrollableAncestorRects:We});const Dn=c.useMemo(()=>({active:K,activeNode:j,activeNodeRect:I,activatorEvent:F,collisions:Ee,containerNodeRect:Se,dragOverlay:ne,draggableNodes:D,droppableContainers:T,droppableRects:ee,over:se,measureDroppableContainers:de,scrollableAncestors:ie,scrollableAncestorRects:We,measuringConfiguration:z,measuringScheduled:Re,windowRect:it}),[K,j,I,F,Ee,Se,ne,D,T,ee,se,de,ie,We,z,Re,it]),Cn=c.useMemo(()=>({activatorEvent:F,activators:Ot,active:K,activeNodeRect:I,ariaDescribedById:{draggable:Ce},dispatch:m,draggableNodes:D,over:se,measureDroppableContainers:de}),[F,Ot,K,I,m,Ce,D,se,de]);return P.createElement(Kt.Provider,{value:b},P.createElement(ot.Provider,{value:Cn},P.createElement(ln.Provider,{value:Dn},P.createElement(un.Provider,{value:yn},u)),P.createElement(zr,{disabled:a?.restoreFocus===!1})),P.createElement(Fn,{...a,hiddenTextDescribedById:Ce}));function Rn(){const k=De?.autoScrollEnabled===!1,$=typeof l=="object"?l.enabled===!1:l===!1,X=E&&!k&&!$;return typeof l=="object"?{...l,enabled:X}:{enabled:X}}}),$r=c.createContext(null),Ut="button",Xr="Draggable";function Yr(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=$e(Xr),{activators:s,activatorEvent:a,active:l,activeNodeRect:u,ariaDescribedById:f,draggableNodes:d,over:g}=c.useContext(ot),{role:h=Ut,roleDescription:C="draggable",tabIndex:v=0}=o??{},p=l?.id===t,m=c.useContext(p?un:$r),[y,b]=Je(),[R,S]=Je(),E=Sr(s,t),x=ke(n);Q(()=>(d.set(t,{id:t,key:i,node:y,activatorNode:R,data:x}),()=>{const A=d.get(t);A&&A.key===i&&d.delete(t)}),[d,t]);const D=c.useMemo(()=>({role:h,tabIndex:v,"aria-disabled":r,"aria-pressed":p&&h===Ut?!0:void 0,"aria-roledescription":C,"aria-describedby":f.draggable}),[r,h,v,p,C,f.draggable]);return{active:l,activatorEvent:a,activeNodeRect:u,attributes:D,isDragging:p,listeners:r?void 0:E,node:y,over:g,setNodeRef:b,setActivatorNodeRef:S,transform:m}}function jr(){return c.useContext(ln)}const Ur="Droppable",Wr={timeout:25};function Hr(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=$e(Ur),{active:s,dispatch:a,over:l,measureDroppableContainers:u}=c.useContext(ot),f=c.useRef({disabled:n}),d=c.useRef(!1),g=c.useRef(null),h=c.useRef(null),{disabled:C,updateMeasurementsFor:v,timeout:p}={...Wr,...o},m=ke(v??r),y=c.useCallback(()=>{if(!d.current){d.current=!0;return}h.current!=null&&clearTimeout(h.current),h.current=setTimeout(()=>{u(Array.isArray(m.current)?m.current:[m.current]),h.current=null},p)},[p]),b=rt({callback:y,disabled:C||!s}),R=c.useCallback((D,A)=>{b&&(A&&(b.unobserve(A),d.current=!1),D&&b.observe(D))},[b]),[S,E]=Je(R),x=ke(t);return c.useEffect(()=>{!b||!S.current||(b.disconnect(),d.current=!1,b.observe(S.current))},[S,b]),c.useEffect(()=>(a({type:O.RegisterDroppable,element:{id:r,key:i,disabled:n,node:S,rect:g,data:x}}),()=>a({type:O.UnregisterDroppable,key:i,id:r})),[r]),c.useEffect(()=>{n!==f.current.disabled&&(a({type:O.SetDroppableDisabled,id:r,key:i,disabled:n}),f.current.disabled=n)},[r,i,n,a]),{active:s,rect:g,isOver:l?.id===r,node:S,over:l,setNodeRef:E}}function dn(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Kr(e,t){return e.reduce((n,r,o)=>{const i=t.get(r);return i&&(n[o]=i),n},Array(e.length))}function Ke(e){return e!==null&&e>=0}function Vr(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n{var t;let{rects:n,activeNodeRect:r,activeIndex:o,overIndex:i,index:s}=e;const a=(t=n[o])!=null?t:r;if(!a)return null;const l=Gr(n,s,o);if(s===o){const u=n[i];return u?{x:oo&&s<=i?{x:-a.width-l,y:0,...Ve}:s=i?{x:a.width+l,y:0,...Ve}:{x:0,y:0,...Ve}};function Gr(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];return!r||!o&&!i?0:n{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=dn(t,r,n),s=t[o],a=i[o];return!a||!s?null:{x:a.left-s.left,y:a.top-s.top,scaleX:a.width/s.width,scaleY:a.height/s.height}},qe={scaleX:1,scaleY:1},ho=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:s}=e;const a=(t=i[n])!=null?t:r;if(!a)return null;if(o===n){const u=i[s];return u?{x:0,y:nn&&o<=s?{x:0,y:-a.height-l,...qe}:o=s?{x:0,y:a.height+l,...qe}:{x:0,y:0,...qe}};function Jr(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];return r?nr.map(E=>typeof E=="object"&&"id"in E?E.id:E),[r]),C=s!=null,v=s?h.indexOf(s.id):-1,p=u?h.indexOf(u.id):-1,m=c.useRef(h),y=!Vr(h,m.current),b=p!==-1&&v===-1||y,R=qr(i);Q(()=>{y&&C&&f(h)},[y,h,C,f]),c.useEffect(()=>{m.current=h},[h]);const S=c.useMemo(()=>({activeIndex:v,containerId:d,disabled:R,disableTransforms:b,items:h,overIndex:p,useDragOverlay:g,sortedRects:Kr(h,l),strategy:o}),[v,d,R.draggable,R.droppable,b,h,p,l,g,o]);return P.createElement(gn.Provider,{value:S},t)}const _r=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return dn(n,r,o).indexOf(t)},Qr=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:s,previousItems:a,previousContainerId:l,transition:u}=e;return!u||!r||a!==i&&o===s?!1:n?!0:s!==o&&t===l},Zr={duration:200,easing:"ease"},vn="transform",eo=_e.Transition.toString({property:vn,duration:0,easing:"linear"}),to={roleDescription:"sortable"};function no(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,s]=c.useState(null),a=c.useRef(n);return Q(()=>{if(!t&&n!==a.current&&r.current){const l=o.current;if(l){const u=xe(r.current,{ignoreTransform:!0}),f={x:l.left-u.left,y:l.top-u.top,scaleX:l.width/u.width,scaleY:l.height/u.height};(f.x||f.y)&&s(f)}}n!==a.current&&(a.current=n)},[t,n,r,o]),c.useEffect(()=>{i&&s(null)},[i]),i}function vo(e){let{animateLayoutChanges:t=Qr,attributes:n,disabled:r,data:o,getNewIndex:i=_r,id:s,strategy:a,resizeObserverConfig:l,transition:u=Zr}=e;const{items:f,containerId:d,activeIndex:g,disabled:h,disableTransforms:C,sortedRects:v,overIndex:p,useDragOverlay:m,strategy:y}=c.useContext(gn),b=ro(r,h),R=f.indexOf(s),S=c.useMemo(()=>({sortable:{containerId:d,index:R,items:f},...o}),[d,o,R,f]),E=c.useMemo(()=>f.slice(f.indexOf(s)),[f,s]),{rect:x,node:D,isOver:A,setNodeRef:T}=Hr({id:s,data:S,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:E,...l}}),{active:M,activatorEvent:H,activeNodeRect:K,attributes:q,setNodeRef:De,listeners:Xe,isDragging:F,over:Ye,setActivatorNodeRef:Z,transform:Ce}=Yr({id:s,data:S,attributes:{...to,...n},disabled:b.draggable}),je=Sn(T,De),z=!!M,ee=z&&!C&&Ke(g)&&Ke(p),de=!m&&F,Re=de&&ee?Ce:null,Ue=ee?Re??(a??y)({rects:v,activeNodeRect:K,activeIndex:g,overIndex:p,index:R}):null,oe=Ke(g)&&Ke(p)?i({id:s,items:f,activeIndex:g,overIndex:p}):R,te=M?.id,I=c.useRef({activeId:te,items:f,newIndex:oe,containerId:d}),Se=f!==I.current.items,G=t({active:M,containerId:d,isDragging:F,isSorting:z,id:s,index:R,items:f,newIndex:I.current.newIndex,previousItems:I.current.items,previousContainerId:I.current.containerId,transition:u,wasDragging:I.current.activeId!=null}),fe=no({disabled:!G,index:R,node:D,rect:x});return c.useEffect(()=>{z&&I.current.newIndex!==oe&&(I.current.newIndex=oe),d!==I.current.containerId&&(I.current.containerId=d),f!==I.current.items&&(I.current.items=f)},[z,oe,d,f]),c.useEffect(()=>{if(te===I.current.activeId)return;if(te!=null&&I.current.activeId==null){I.current.activeId=te;return}const he=setTimeout(()=>{I.current.activeId=te},50);return()=>clearTimeout(he)},[te]),{active:M,activeIndex:g,attributes:q,data:S,rect:x,index:R,newIndex:oe,items:f,isOver:A,isSorting:z,isDragging:F,listeners:Xe,node:D,overIndex:p,over:Ye,setNodeRef:je,setActivatorNodeRef:Z,setDroppableNodeRef:T,setDraggableNodeRef:De,transform:fe??Ue,transition:ne()};function ne(){if(fe||Se&&I.current.newIndex===R)return eo;if(!(de&&!yt(H)||!u)&&(z||G))return _e.Transition.toString({...u,property:vn})}}function ro(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}function et(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const oo=[w.Down,w.Right,w.Up,w.Left],po=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:i,over:s,scrollableAncestors:a}}=t;if(oo.includes(e.code)){if(e.preventDefault(),!n||!r)return;const l=[];i.getEnabled().forEach(d=>{if(!d||d!=null&&d.disabled)return;const g=o.get(d.id);if(g)switch(e.code){case w.Down:r.topg.top&&l.push(d);break;case w.Left:r.left>g.left&&l.push(d);break;case w.Right:r.left1&&(f=u[1].id),f!=null){const d=i.get(n.id),g=i.get(f),h=g?o.get(g.id):null,C=g?.node.current;if(C&&h&&d&&g){const p=nt(C).some((E,x)=>a[x]!==E),m=pn(d,g),y=io(d,g),b=p||!m?{x:0,y:0}:{x:y?r.width-h.width:0,y:y?r.height-h.height:0},R={x:h.left,y:h.top};return b.x&&b.y?R:ze(R,b)}}}};function pn(e,t){return!et(e)||!et(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function io(e,t){return!et(e)||!et(t)||!pn(e,t)?!1:e.data.current.sortable.indexr=>{t.forEach(o=>o(r))},t)}const et=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function me(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function pt(e){return"nodeType"in e}function B(e){var t,n;return e?me(e)?e:pt(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function bt(e){const{Document:t}=B(e);return e instanceof t}function Be(e){return me(e)?!1:e instanceof B(e).HTMLElement}function Ut(e){return e instanceof B(e).SVGElement}function ye(e){return e?me(e)?e.document:pt(e)?bt(e)?e:Be(e)||Ut(e)?e.ownerDocument:document:document:document}const Q=et?c.useLayoutEffect:c.useEffect;function wt(e){const t=c.useRef(e);return Q(()=>{t.current=e}),c.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o{e.current=setInterval(r,o)},[]),n=c.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function ke(e,t){t===void 0&&(t=[e]);const n=c.useRef(e);return Q(()=>{n.current!==e&&(n.current=e)},t),n}function Fe(e,t){const n=c.useRef();return c.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Ge(e){const t=wt(e),n=c.useRef(null),r=c.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function dt(e){const t=c.useRef();return c.useEffect(()=>{t.current=e},[e]),t.current}let at={};function $e(e,t){return c.useMemo(()=>{if(t)return t;const n=at[e]==null?0:at[e]+1;return at[e]=n,e+"-"+n},[e,t])}function Wt(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o{const a=Object.entries(s);for(const[l,u]of a){const f=i[l];f!=null&&(i[l]=f+e*u)}return i},{...t})}}const we=Wt(1),ze=Wt(-1);function En(e){return"clientX"in e&&"clientY"in e}function mt(e){if(!e)return!1;const{KeyboardEvent:t}=B(e.target);return t&&e instanceof t}function Mn(e){if(!e)return!1;const{TouchEvent:t}=B(e.target);return t&&e instanceof t}function ft(e){if(Mn(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return En(e)?{x:e.clientX,y:e.clientY}:null}const Je=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Je.Translate.toString(e),Je.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Ot="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function In(e){return e.matches(Ot)?e:e.querySelector(Ot)}const An={display:"none"};function On(e){let{id:t,value:n}=e;return P.createElement("div",{id:t,style:An},n)}function Tn(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return P.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function Nn(){const[e,t]=c.useState("");return{announce:c.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Ht=c.createContext(null);function Ln(e){const t=c.useContext(Ht);c.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(e)},[e,t])}function kn(){const[e]=c.useState(()=>new Set),t=c.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[c.useCallback(r=>{let{type:o,event:i}=r;e.forEach(s=>{var a;return(a=s[o])==null?void 0:a.call(s,i)})},[e]),t]}const zn={draggable:` - To pick up a draggable item, press the space bar. - While dragging, use the arrow keys to move the item. - Press space again to drop the item in its new position, or press escape to cancel. - `},Pn={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Bn(e){let{announcements:t=Pn,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=zn}=e;const{announce:i,announcement:s}=Nn(),a=$e("DndLiveRegion"),[l,u]=c.useState(!1);if(c.useEffect(()=>{u(!0)},[]),Ln(c.useMemo(()=>({onDragStart(d){let{active:g}=d;i(t.onDragStart({active:g}))},onDragMove(d){let{active:g,over:h}=d;t.onDragMove&&i(t.onDragMove({active:g,over:h}))},onDragOver(d){let{active:g,over:h}=d;i(t.onDragOver({active:g,over:h}))},onDragEnd(d){let{active:g,over:h}=d;i(t.onDragEnd({active:g,over:h}))},onDragCancel(d){let{active:g,over:h}=d;i(t.onDragCancel({active:g,over:h}))}}),[i,t])),!l)return null;const f=P.createElement(P.Fragment,null,P.createElement(On,{id:r,value:o.draggable}),P.createElement(Tn,{id:a,announcement:s}));return n?Oe.createPortal(f,n):f}var O;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(O||(O={}));function _e(){}function io(e,t){return c.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function so(){for(var e=arguments.length,t=new Array(e),n=0;n[...t].filter(r=>r!=null),[...t])}const V=Object.freeze({x:0,y:0});function Kt(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Vt(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Fn(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Tt(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function qt(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function Nt(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const ao=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Nt(t,t.left,t.top),i=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const u=Kt(Nt(l),o);i.push({id:a,data:{droppableContainer:s,value:u}})}}return i.sort(Vt)},$n=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Tt(t),i=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const u=Tt(l),f=o.reduce((g,h,C)=>g+Kt(u[C],h),0),d=Number((f/4).toFixed(4));i.push({id:a,data:{droppableContainer:s,value:d}})}}return i.sort(Vt)};function Xn(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),s=o-r,a=i-n;if(r{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const i of r){const{id:s}=i,a=n.get(s);if(a){const l=Xn(a,t);l>0&&o.push({id:s,data:{droppableContainer:i,value:l}})}}return o.sort(Fn)};function jn(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Gt(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:V}function Un(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i({...s,top:s.top+e*a.y,bottom:s.bottom+e*a.y,left:s.left+e*a.x,right:s.right+e*a.x}),{...n})}}const Wn=Un(1);function Hn(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Kn(e,t,n){const r=Hn(t);if(!r)return e;const{scaleX:o,scaleY:i,x:s,y:a}=r,l=e.left-s-(1-o)*parseFloat(n),u=e.top-a-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),f=o?e.width/o:e.width,d=i?e.height/i:e.height;return{width:f,height:d,top:u,right:l+f,bottom:u+d,left:l}}const Vn={ignoreTransform:!1};function xe(e,t){t===void 0&&(t=Vn);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:f}=B(e).getComputedStyle(e);u&&(n=Kn(n,u,f))}const{top:r,left:o,width:i,height:s,bottom:a,right:l}=n;return{top:r,left:o,width:i,height:s,bottom:a,right:l}}function Lt(e){return xe(e,{ignoreTransform:!0})}function qn(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Gn(e,t){return t===void 0&&(t=B(e).getComputedStyle(e)),t.position==="fixed"}function Jn(e,t){t===void 0&&(t=B(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const i=t[o];return typeof i=="string"?n.test(i):!1})}function tt(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(bt(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Be(o)||Ut(o)||n.includes(o))return n;const i=B(e).getComputedStyle(o);return o!==e&&Jn(o,i)&&n.push(o),Gn(o,i)?n:r(o.parentNode)}return e?r(e):n}function Jt(e){const[t]=tt(e,1);return t??null}function ct(e){return!et||!e?null:me(e)?e:pt(e)?bt(e)||e===ye(e).scrollingElement?window:Be(e)?e:null:null}function _t(e){return me(e)?e.scrollX:e.scrollLeft}function Qt(e){return me(e)?e.scrollY:e.scrollTop}function ht(e){return{x:_t(e),y:Qt(e)}}var N;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(N||(N={}));function Zt(e){return!et||!e?!1:e===document.scrollingElement}function en(e){const t={x:0,y:0},n=Zt(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,s=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:o,isLeft:i,isBottom:s,isRight:a,maxScroll:r,minScroll:t}}const _n={x:.2,y:.2};function Qn(e,t,n,r,o){let{top:i,left:s,right:a,bottom:l}=n;r===void 0&&(r=10),o===void 0&&(o=_n);const{isTop:u,isBottom:f,isLeft:d,isRight:g}=en(e),h={x:0,y:0},C={x:0,y:0},v={height:t.height*o.y,width:t.width*o.x};return!u&&i<=t.top+v.height?(h.y=N.Backward,C.y=r*Math.abs((t.top+v.height-i)/v.height)):!f&&l>=t.bottom-v.height&&(h.y=N.Forward,C.y=r*Math.abs((t.bottom-v.height-l)/v.height)),!g&&a>=t.right-v.width?(h.x=N.Forward,C.x=r*Math.abs((t.right-v.width-a)/v.width)):!d&&s<=t.left+v.width&&(h.x=N.Backward,C.x=r*Math.abs((t.left+v.width-s)/v.width)),{direction:h,speed:C}}function Zn(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:s}=window;return{top:0,left:0,right:i,bottom:s,width:i,height:s}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function tn(e){return e.reduce((t,n)=>we(t,ht(n)),V)}function er(e){return e.reduce((t,n)=>t+_t(n),0)}function tr(e){return e.reduce((t,n)=>t+Qt(n),0)}function nr(e,t){if(t===void 0&&(t=xe),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);Jt(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const rr=[["x",["left","right"],er],["y",["top","bottom"],tr]];class yt{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=tt(n),o=tn(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,s,a]of rr)for(const l of s)Object.defineProperty(this,l,{get:()=>{const u=a(r),f=o[i]-u;return this.rect[l]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Te{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function or(e){const{EventTarget:t}=B(e);return e instanceof t?e:ye(e)}function lt(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var W;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(W||(W={}));function kt(e){e.preventDefault()}function ir(e){e.stopPropagation()}var w;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(w||(w={}));const nn={start:[w.Space,w.Enter],cancel:[w.Esc],end:[w.Space,w.Enter,w.Tab]},sr=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case w.Right:return{...n,x:n.x+25};case w.Left:return{...n,x:n.x-25};case w.Down:return{...n,y:n.y+25};case w.Up:return{...n,y:n.y-25}}};class rn{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Te(ye(n)),this.windowListeners=new Te(B(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(W.Resize,this.handleCancel),this.windowListeners.add(W.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(W.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&nr(r),n(V)}handleKeyDown(t){if(mt(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:i=nn,coordinateGetter:s=sr,scrollBehavior:a="smooth"}=o,{code:l}=t;if(i.end.includes(l)){this.handleEnd(t);return}if(i.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:u}=r.current,f=u?{x:u.left,y:u.top}:V;this.referenceCoordinates||(this.referenceCoordinates=f);const d=s(t,{active:n,context:r.current,currentCoordinates:f});if(d){const g=ze(d,f),h={x:0,y:0},{scrollableAncestors:C}=r.current;for(const v of C){const p=t.code,{isTop:m,isRight:y,isLeft:b,isBottom:R,maxScroll:S,minScroll:E}=en(v),x=Zn(v),D={x:Math.min(p===w.Right?x.right-x.width/2:x.right,Math.max(p===w.Right?x.left:x.left+x.width/2,d.x)),y:Math.min(p===w.Down?x.bottom-x.height/2:x.bottom,Math.max(p===w.Down?x.top:x.top+x.height/2,d.y))},A=p===w.Right&&!y||p===w.Left&&!b,T=p===w.Down&&!R||p===w.Up&&!m;if(A&&D.x!==d.x){const I=v.scrollLeft+g.x,H=p===w.Right&&I<=S.x||p===w.Left&&I>=E.x;if(H&&!g.y){v.scrollTo({left:I,behavior:a});return}H?h.x=v.scrollLeft-I:h.x=p===w.Right?v.scrollLeft-S.x:v.scrollLeft-E.x,h.x&&v.scrollBy({left:-h.x,behavior:a});break}else if(T&&D.y!==d.y){const I=v.scrollTop+g.y,H=p===w.Down&&I<=S.y||p===w.Up&&I>=E.y;if(H&&!g.x){v.scrollTo({top:I,behavior:a});return}H?h.y=v.scrollTop-I:h.y=p===w.Down?v.scrollTop-S.y:v.scrollTop-E.y,h.y&&v.scrollBy({top:-h.y,behavior:a});break}}this.handleMove(t,we(ze(d,this.referenceCoordinates),h))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}rn.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=nn,onActivation:o}=t,{active:i}=n;const{code:s}=e.nativeEvent;if(r.start.includes(s)){const a=i.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function zt(e){return!!(e&&"distance"in e)}function Pt(e){return!!(e&&"delay"in e)}class xt{constructor(t,n,r){var o;r===void 0&&(r=or(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:i}=t,{target:s}=i;this.props=t,this.events=n,this.document=ye(s),this.documentListeners=new Te(this.document),this.listeners=new Te(r),this.windowListeners=new Te(B(s)),this.initialCoordinates=(o=ft(i))!=null?o:V,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(W.Resize,this.handleCancel),this.windowListeners.add(W.DragStart,kt),this.windowListeners.add(W.VisibilityChange,this.handleCancel),this.windowListeners.add(W.ContextMenu,kt),this.documentListeners.add(W.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Pt(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(zt(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(W.Click,ir,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(W.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:i}=this,{onMove:s,options:{activationConstraint:a}}=i;if(!o)return;const l=(n=ft(t))!=null?n:V,u=ze(o,l);if(!r&&a){if(zt(a)){if(a.tolerance!=null&<(u,a.tolerance))return this.handleCancel();if(lt(u,a.distance))return this.handleStart()}if(Pt(a)&<(u,a.tolerance))return this.handleCancel();this.handlePending(a,u);return}t.cancelable&&t.preventDefault(),s(l)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===w.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const ar={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class on extends xt{constructor(t){const{event:n}=t,r=ye(n.target);super(t,ar,r)}}on.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const cr={move:{name:"mousemove"},end:{name:"mouseup"}};var gt;(function(e){e[e.RightClick=2]="RightClick"})(gt||(gt={}));class lr extends xt{constructor(t){super(t,cr,ye(t.event.target))}}lr.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===gt.RightClick?!1:(r?.({event:n}),!0)}}];const ut={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class ur extends xt{constructor(t){super(t,ut)}static setup(){return window.addEventListener(ut.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(ut.move.name,t)};function t(){}}}ur.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r?.({event:n}),!0)}}];var Ne;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Ne||(Ne={}));var Qe;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Qe||(Qe={}));function dr(e){let{acceleration:t,activator:n=Ne.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:s=5,order:a=Qe.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:f,delta:d,threshold:g}=e;const h=hr({delta:d,disabled:!i}),[C,v]=Sn(),p=c.useRef({x:0,y:0}),m=c.useRef({x:0,y:0}),y=c.useMemo(()=>{switch(n){case Ne.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Ne.DraggableRect:return o}},[n,o,l]),b=c.useRef(null),R=c.useCallback(()=>{const E=b.current;if(!E)return;const x=p.current.x*m.current.x,D=p.current.y*m.current.y;E.scrollBy(x,D)},[]),S=c.useMemo(()=>a===Qe.TreeOrder?[...u].reverse():u,[a,u]);c.useEffect(()=>{if(!i||!u.length||!y){v();return}for(const E of S){if(r?.(E)===!1)continue;const x=u.indexOf(E),D=f[x];if(!D)continue;const{direction:A,speed:T}=Qn(E,D,y,t,g);for(const I of["x","y"])h[I][A[I]]||(T[I]=0,A[I]=0);if(T.x>0||T.y>0){v(),b.current=E,C(R,s),p.current=T,m.current=A;return}}p.current={x:0,y:0},m.current={x:0,y:0},v()},[t,R,r,v,i,s,JSON.stringify(y),JSON.stringify(h),C,u,S,f,JSON.stringify(g)])}const fr={x:{[N.Backward]:!1,[N.Forward]:!1},y:{[N.Backward]:!1,[N.Forward]:!1}};function hr(e){let{delta:t,disabled:n}=e;const r=dt(t);return Fe(o=>{if(n||!r||!o)return fr;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[N.Backward]:o.x[N.Backward]||i.x===-1,[N.Forward]:o.x[N.Forward]||i.x===1},y:{[N.Backward]:o.y[N.Backward]||i.y===-1,[N.Forward]:o.y[N.Forward]||i.y===1}}},[n,t,r])}function gr(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Fe(o=>{var i;return t==null?null:(i=r??o)!=null?i:null},[r,t])}function vr(e,t){return c.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,i=o.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,r)}));return[...n,...i]},[]),[e,t])}var Pe;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Pe||(Pe={}));var vt;(function(e){e.Optimized="optimized"})(vt||(vt={}));const Bt=new Map;function pr(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,s]=c.useState(null),{frequency:a,measure:l,strategy:u}=o,f=c.useRef(e),d=p(),g=ke(d),h=c.useCallback(function(m){m===void 0&&(m=[]),!g.current&&s(y=>y===null?m:y.concat(m.filter(b=>!y.includes(b))))},[g]),C=c.useRef(null),v=Fe(m=>{if(d&&!n)return Bt;if(!m||m===Bt||f.current!==e||i!=null){const y=new Map;for(let b of e){if(!b)continue;if(i&&i.length>0&&!i.includes(b.id)&&b.rect.current){y.set(b.id,b.rect.current);continue}const R=b.node.current,S=R?new yt(l(R),R):null;b.rect.current=S,S&&y.set(b.id,S)}return y}return m},[e,i,n,d,l]);return c.useEffect(()=>{f.current=e},[e]),c.useEffect(()=>{d||h()},[n,d]),c.useEffect(()=>{i&&i.length>0&&s(null)},[JSON.stringify(i)]),c.useEffect(()=>{d||typeof a!="number"||C.current!==null||(C.current=setTimeout(()=>{h(),C.current=null},a))},[a,d,h,...r]),{droppableRects:v,measureDroppableContainers:h,measuringScheduled:i!=null};function p(){switch(u){case Pe.Always:return!1;case Pe.BeforeDragging:return n;default:return!n}}}function sn(e,t){return Fe(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function br(e,t){return sn(e,t)}function wr(e){let{callback:t,disabled:n}=e;const r=wt(t),o=c.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return c.useEffect(()=>()=>o?.disconnect(),[o]),o}function nt(e){let{callback:t,disabled:n}=e;const r=wt(t),o=c.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return c.useEffect(()=>()=>o?.disconnect(),[o]),o}function mr(e){return new yt(xe(e),e)}function Ft(e,t,n){t===void 0&&(t=mr);const[r,o]=c.useState(null);function i(){o(l=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=l??n)!=null?u:null}const f=t(e);return JSON.stringify(l)===JSON.stringify(f)?l:f})}const s=wr({callback(l){if(e)for(const u of l){const{type:f,target:d}=u;if(f==="childList"&&d instanceof HTMLElement&&d.contains(e)){i();break}}}}),a=nt({callback:i});return Q(()=>{i(),e?(a?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),s?.disconnect())},[e]),r}function yr(e){const t=sn(e);return Gt(e,t)}const $t=[];function xr(e){const t=c.useRef(e),n=Fe(r=>e?r&&r!==$t&&e&&t.current&&e.parentNode===t.current.parentNode?r:tt(e):$t,[e]);return c.useEffect(()=>{t.current=e},[e]),n}function Dr(e){const[t,n]=c.useState(null),r=c.useRef(e),o=c.useCallback(i=>{const s=ct(i.target);s&&n(a=>a?(a.set(s,ht(s)),new Map(a)):null)},[]);return c.useEffect(()=>{const i=r.current;if(e!==i){s(i);const a=e.map(l=>{const u=ct(l);return u?(u.addEventListener("scroll",o,{passive:!0}),[u,ht(u)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=e}return()=>{s(e),s(i)};function s(a){a.forEach(l=>{const u=ct(l);u?.removeEventListener("scroll",o)})}},[o,e]),c.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,s)=>we(i,s),V):tn(e):V,[e,t])}function Xt(e,t){t===void 0&&(t=[]);const n=c.useRef(null);return c.useEffect(()=>{n.current=null},t),c.useEffect(()=>{const r=e!==V;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?ze(e,n.current):V}function Cr(e){c.useEffect(()=>{if(!et)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function Rr(e,t){return c.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:i}=r;return n[o]=s=>{i(s,t)},n},{}),[e,t])}function an(e){return c.useMemo(()=>e?qn(e):null,[e])}const Yt=[];function Sr(e,t){t===void 0&&(t=xe);const[n]=e,r=an(n?B(n):null),[o,i]=c.useState(Yt);function s(){i(()=>e.length?e.map(l=>Zt(l)?r:new yt(t(l),l)):Yt)}const a=nt({callback:s});return Q(()=>{a?.disconnect(),s(),e.forEach(l=>a?.observe(l))},[e]),o}function Er(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Be(t)?t:e}function Mr(e){let{measure:t}=e;const[n,r]=c.useState(null),o=c.useCallback(u=>{for(const{target:f}of u)if(Be(f)){r(d=>{const g=t(f);return d?{...d,width:g.width,height:g.height}:g});break}},[t]),i=nt({callback:o}),s=c.useCallback(u=>{const f=Er(u);i?.disconnect(),f&&i?.observe(f),r(f?t(f):null)},[t,i]),[a,l]=Ge(s);return c.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const Ir=[{sensor:on,options:{}},{sensor:rn,options:{}}],Ar={current:{}},qe={draggable:{measure:Lt},droppable:{measure:Lt,strategy:Pe.WhileDragging,frequency:vt.Optimized},dragOverlay:{measure:xe}};class Le extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const Or={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Le,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:_e},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:qe,measureDroppableContainers:_e,windowRect:null,measuringScheduled:!1},Tr={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:_e,draggableNodes:new Map,over:null,measureDroppableContainers:_e},rt=c.createContext(Tr),cn=c.createContext(Or);function Nr(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Le}}}function Lr(e,t){switch(t.type){case O.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case O.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case O.DragEnd:case O.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case O.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Le(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case O.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const s=new Le(e.droppable.containers);return s.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:s}}}case O.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new Le(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function kr(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=c.useContext(rt),i=dt(r),s=dt(n?.id);return c.useEffect(()=>{if(!t&&!r&&i&&s!=null){if(!mt(i)||document.activeElement===i.target)return;const a=o.get(s);if(!a)return;const{activatorNode:l,node:u}=a;if(!l.current&&!u.current)return;requestAnimationFrame(()=>{for(const f of[l.current,u.current]){if(!f)continue;const d=In(f);if(d){d.focus();break}}})}},[r,t,o,s,i]),null}function zr(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...r}),n):n}function Pr(e){return c.useMemo(()=>({draggable:{...qe.draggable,...e?.draggable},droppable:{...qe.droppable,...e?.droppable},dragOverlay:{...qe.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Br(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=c.useRef(!1),{x:s,y:a}=typeof o=="boolean"?{x:o,y:o}:o;Q(()=>{if(!s&&!a||!t){i.current=!1;return}if(i.current||!r)return;const u=t?.node.current;if(!u||u.isConnected===!1)return;const f=n(u),d=Gt(f,r);if(s||(d.x=0),a||(d.y=0),i.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const g=Jt(u);g&&g.scrollBy({top:d.y,left:d.x})}},[t,s,a,r,n])}const ln=c.createContext({...V,scaleX:1,scaleY:1});var ue;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ue||(ue={}));const co=c.memo(function(t){var n,r,o,i;let{id:s,accessibility:a,autoScroll:l=!0,children:u,sensors:f=Ir,collisionDetection:d=Yn,measuring:g,modifiers:h,...C}=t;const v=c.useReducer(Lr,void 0,Nr),[p,m]=v,[y,b]=kn(),[R,S]=c.useState(ue.Uninitialized),E=R===ue.Initialized,{draggable:{active:x,nodes:D,translate:A},droppable:{containers:T}}=p,I=x!=null?D.get(x):null,H=c.useRef({initial:null,translated:null}),K=c.useMemo(()=>{var k;return x!=null?{id:x,data:(k=I?.data)!=null?k:Ar,rect:H}:null},[x,I]),q=c.useRef(null),[De,Xe]=c.useState(null),[F,Ye]=c.useState(null),Z=ke(C,Object.values(C)),Ce=$e("DndDescribedBy",s),je=c.useMemo(()=>T.getEnabled(),[T]),z=Pr(g),{droppableRects:ee,measureDroppableContainers:de,measuringScheduled:Re}=pr(je,{dragging:E,dependencies:[A.x,A.y],config:z.droppable}),j=gr(D,x),Ue=c.useMemo(()=>F?ft(F):null,[F]),oe=Cn(),te=br(j,z.draggable.measure);Br({activeNode:x!=null?D.get(x):null,config:oe.layoutShiftCompensation,initialRect:te,measure:z.draggable.measure});const M=Ft(j,z.draggable.measure,te),Se=Ft(j?j.parentElement:null),G=c.useRef({activatorEvent:null,active:null,activeNode:j,collisionRect:null,collisions:null,droppableRects:ee,draggableNodes:D,draggingNode:null,draggingNodeRect:null,droppableContainers:T,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),fe=T.getNodeFor((n=G.current.over)==null?void 0:n.id),ne=Mr({measure:z.dragOverlay.measure}),he=(r=ne.nodeRef.current)!=null?r:j,ge=E?(o=ne.rect)!=null?o:M:null,Dt=!!(ne.nodeRef.current&&ne.rect),Ct=yr(Dt?null:M),ot=an(he?B(he):null),ie=xr(E?fe??j:null),We=Sr(ie),He=zr(h,{transform:{x:A.x-Ct.x,y:A.y-Ct.y,scaleX:1,scaleY:1},activatorEvent:F,active:K,activeNodeRect:M,containerNodeRect:Se,draggingNodeRect:ge,over:G.current.over,overlayNodeRect:ne.rect,scrollableAncestors:ie,scrollableAncestorRects:We,windowRect:ot}),Rt=Ue?we(Ue,A):null,St=Dr(ie),pn=Xt(St),bn=Xt(St,[M]),ve=we(He,pn),pe=ge?Wn(ge,He):null,Ee=K&&pe?d({active:K,collisionRect:pe,droppableRects:ee,droppableContainers:je,pointerCoordinates:Rt}):null,Et=qt(Ee,"id"),[se,Mt]=c.useState(null),wn=Dt?He:we(He,bn),mn=jn(wn,(i=se?.rect)!=null?i:null,M),it=c.useRef(null),It=c.useCallback((k,$)=>{let{sensor:X,options:ae}=$;if(q.current==null)return;const U=D.get(q.current);if(!U)return;const Y=k.nativeEvent,J=new X({active:q.current,activeNode:U,event:Y,options:ae,context:G,onAbort(L){if(!D.get(L))return;const{onDragAbort:_}=Z.current,re={id:L};_?.(re),y({type:"onDragAbort",event:re})},onPending(L,ce,_,re){if(!D.get(L))return;const{onDragPending:Ie}=Z.current,le={id:L,constraint:ce,initialCoordinates:_,offset:re};Ie?.(le),y({type:"onDragPending",event:le})},onStart(L){const ce=q.current;if(ce==null)return;const _=D.get(ce);if(!_)return;const{onDragStart:re}=Z.current,Me={activatorEvent:Y,active:{id:ce,data:_.data,rect:H}};Oe.unstable_batchedUpdates(()=>{re?.(Me),S(ue.Initializing),m({type:O.DragStart,initialCoordinates:L,active:ce}),y({type:"onDragStart",event:Me}),Xe(it.current),Ye(Y)})},onMove(L){m({type:O.DragMove,coordinates:L})},onEnd:be(O.DragEnd),onCancel:be(O.DragCancel)});it.current=J;function be(L){return async function(){const{active:_,collisions:re,over:Me,scrollAdjustedTranslate:Ie}=G.current;let le=null;if(_&&Ie){const{cancelDrop:Ae}=Z.current;le={activatorEvent:Y,active:_,collisions:re,delta:Ie,over:Me},L===O.DragEnd&&typeof Ae=="function"&&await Promise.resolve(Ae(le))&&(L=O.DragCancel)}q.current=null,Oe.unstable_batchedUpdates(()=>{m({type:L}),S(ue.Uninitialized),Mt(null),Xe(null),Ye(null),it.current=null;const Ae=L===O.DragEnd?"onDragEnd":"onDragCancel";if(le){const st=Z.current[Ae];st?.(le),y({type:Ae,event:le})}})}}},[D]),yn=c.useCallback((k,$)=>(X,ae)=>{const U=X.nativeEvent,Y=D.get(ae);if(q.current!==null||!Y||U.dndKit||U.defaultPrevented)return;const J={active:Y};k(X,$.options,J)===!0&&(U.dndKit={capturedBy:$.sensor},q.current=ae,It(X,$))},[D,It]),At=vr(f,yn);Cr(f),Q(()=>{M&&R===ue.Initializing&&S(ue.Initialized)},[M,R]),c.useEffect(()=>{const{onDragMove:k}=Z.current,{active:$,activatorEvent:X,collisions:ae,over:U}=G.current;if(!$||!X)return;const Y={active:$,activatorEvent:X,collisions:ae,delta:{x:ve.x,y:ve.y},over:U};Oe.unstable_batchedUpdates(()=>{k?.(Y),y({type:"onDragMove",event:Y})})},[ve.x,ve.y]),c.useEffect(()=>{const{active:k,activatorEvent:$,collisions:X,droppableContainers:ae,scrollAdjustedTranslate:U}=G.current;if(!k||q.current==null||!$||!U)return;const{onDragOver:Y}=Z.current,J=ae.get(Et),be=J&&J.rect.current?{id:J.id,rect:J.rect.current,data:J.data,disabled:J.disabled}:null,L={active:k,activatorEvent:$,collisions:X,delta:{x:U.x,y:U.y},over:be};Oe.unstable_batchedUpdates(()=>{Mt(be),Y?.(L),y({type:"onDragOver",event:L})})},[Et]),Q(()=>{G.current={activatorEvent:F,active:K,activeNode:j,collisionRect:pe,collisions:Ee,droppableRects:ee,draggableNodes:D,draggingNode:he,draggingNodeRect:ge,droppableContainers:T,over:se,scrollableAncestors:ie,scrollAdjustedTranslate:ve},H.current={initial:ge,translated:pe}},[K,j,Ee,pe,D,he,ge,ee,T,se,ie,ve]),dr({...oe,delta:A,draggingRect:pe,pointerCoordinates:Rt,scrollableAncestors:ie,scrollableAncestorRects:We});const xn=c.useMemo(()=>({active:K,activeNode:j,activeNodeRect:M,activatorEvent:F,collisions:Ee,containerNodeRect:Se,dragOverlay:ne,draggableNodes:D,droppableContainers:T,droppableRects:ee,over:se,measureDroppableContainers:de,scrollableAncestors:ie,scrollableAncestorRects:We,measuringConfiguration:z,measuringScheduled:Re,windowRect:ot}),[K,j,M,F,Ee,Se,ne,D,T,ee,se,de,ie,We,z,Re,ot]),Dn=c.useMemo(()=>({activatorEvent:F,activators:At,active:K,activeNodeRect:M,ariaDescribedById:{draggable:Ce},dispatch:m,draggableNodes:D,over:se,measureDroppableContainers:de}),[F,At,K,M,m,Ce,D,se,de]);return P.createElement(Ht.Provider,{value:b},P.createElement(rt.Provider,{value:Dn},P.createElement(cn.Provider,{value:xn},P.createElement(ln.Provider,{value:mn},u)),P.createElement(kr,{disabled:a?.restoreFocus===!1})),P.createElement(Bn,{...a,hiddenTextDescribedById:Ce}));function Cn(){const k=De?.autoScrollEnabled===!1,$=typeof l=="object"?l.enabled===!1:l===!1,X=E&&!k&&!$;return typeof l=="object"?{...l,enabled:X}:{enabled:X}}}),Fr=c.createContext(null),jt="button",$r="Draggable";function Xr(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=$e($r),{activators:s,activatorEvent:a,active:l,activeNodeRect:u,ariaDescribedById:f,draggableNodes:d,over:g}=c.useContext(rt),{role:h=jt,roleDescription:C="draggable",tabIndex:v=0}=o??{},p=l?.id===t,m=c.useContext(p?ln:Fr),[y,b]=Ge(),[R,S]=Ge(),E=Rr(s,t),x=ke(n);Q(()=>(d.set(t,{id:t,key:i,node:y,activatorNode:R,data:x}),()=>{const A=d.get(t);A&&A.key===i&&d.delete(t)}),[d,t]);const D=c.useMemo(()=>({role:h,tabIndex:v,"aria-disabled":r,"aria-pressed":p&&h===jt?!0:void 0,"aria-roledescription":C,"aria-describedby":f.draggable}),[r,h,v,p,C,f.draggable]);return{active:l,activatorEvent:a,activeNodeRect:u,attributes:D,isDragging:p,listeners:r?void 0:E,node:y,over:g,setNodeRef:b,setActivatorNodeRef:S,transform:m}}function Yr(){return c.useContext(cn)}const jr="Droppable",Ur={timeout:25};function Wr(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=$e(jr),{active:s,dispatch:a,over:l,measureDroppableContainers:u}=c.useContext(rt),f=c.useRef({disabled:n}),d=c.useRef(!1),g=c.useRef(null),h=c.useRef(null),{disabled:C,updateMeasurementsFor:v,timeout:p}={...Ur,...o},m=ke(v??r),y=c.useCallback(()=>{if(!d.current){d.current=!0;return}h.current!=null&&clearTimeout(h.current),h.current=setTimeout(()=>{u(Array.isArray(m.current)?m.current:[m.current]),h.current=null},p)},[p]),b=nt({callback:y,disabled:C||!s}),R=c.useCallback((D,A)=>{b&&(A&&(b.unobserve(A),d.current=!1),D&&b.observe(D))},[b]),[S,E]=Ge(R),x=ke(t);return c.useEffect(()=>{!b||!S.current||(b.disconnect(),d.current=!1,b.observe(S.current))},[S,b]),c.useEffect(()=>(a({type:O.RegisterDroppable,element:{id:r,key:i,disabled:n,node:S,rect:g,data:x}}),()=>a({type:O.UnregisterDroppable,key:i,id:r})),[r]),c.useEffect(()=>{n!==f.current.disabled&&(a({type:O.SetDroppableDisabled,id:r,key:i,disabled:n}),f.current.disabled=n)},[r,i,n,a]),{active:s,rect:g,isOver:l?.id===r,node:S,over:l,setNodeRef:E}}function un(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Hr(e,t){return e.reduce((n,r,o)=>{const i=t.get(r);return i&&(n[o]=i),n},Array(e.length))}function Ke(e){return e!==null&&e>=0}function Kr(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n{var t;let{rects:n,activeNodeRect:r,activeIndex:o,overIndex:i,index:s}=e;const a=(t=n[o])!=null?t:r;if(!a)return null;const l=qr(n,s,o);if(s===o){const u=n[i];return u?{x:oo&&s<=i?{x:-a.width-l,y:0,...Ve}:s=i?{x:a.width+l,y:0,...Ve}:{x:0,y:0,...Ve}};function qr(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];return!r||!o&&!i?0:n{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=un(t,r,n),s=t[o],a=i[o];return!a||!s?null:{x:a.left-s.left,y:a.top-s.top,scaleX:a.width/s.width,scaleY:a.height/s.height}},fn="Sortable",hn=P.createContext({activeIndex:-1,containerId:fn,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:dn,disabled:{draggable:!1,droppable:!1}});function uo(e){let{children:t,id:n,items:r,strategy:o=dn,disabled:i=!1}=e;const{active:s,dragOverlay:a,droppableRects:l,over:u,measureDroppableContainers:f}=Yr(),d=$e(fn,n),g=a.rect!==null,h=c.useMemo(()=>r.map(E=>typeof E=="object"&&"id"in E?E.id:E),[r]),C=s!=null,v=s?h.indexOf(s.id):-1,p=u?h.indexOf(u.id):-1,m=c.useRef(h),y=!Kr(h,m.current),b=p!==-1&&v===-1||y,R=Vr(i);Q(()=>{y&&C&&f(h)},[y,h,C,f]),c.useEffect(()=>{m.current=h},[h]);const S=c.useMemo(()=>({activeIndex:v,containerId:d,disabled:R,disableTransforms:b,items:h,overIndex:p,useDragOverlay:g,sortedRects:Hr(h,l),strategy:o}),[v,d,R.draggable,R.droppable,b,h,p,l,g,o]);return P.createElement(hn.Provider,{value:S},t)}const Gr=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return un(n,r,o).indexOf(t)},Jr=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:s,previousItems:a,previousContainerId:l,transition:u}=e;return!u||!r||a!==i&&o===s?!1:n?!0:s!==o&&t===l},_r={duration:200,easing:"ease"},gn="transform",Qr=Je.Transition.toString({property:gn,duration:0,easing:"linear"}),Zr={roleDescription:"sortable"};function eo(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,s]=c.useState(null),a=c.useRef(n);return Q(()=>{if(!t&&n!==a.current&&r.current){const l=o.current;if(l){const u=xe(r.current,{ignoreTransform:!0}),f={x:l.left-u.left,y:l.top-u.top,scaleX:l.width/u.width,scaleY:l.height/u.height};(f.x||f.y)&&s(f)}}n!==a.current&&(a.current=n)},[t,n,r,o]),c.useEffect(()=>{i&&s(null)},[i]),i}function fo(e){let{animateLayoutChanges:t=Jr,attributes:n,disabled:r,data:o,getNewIndex:i=Gr,id:s,strategy:a,resizeObserverConfig:l,transition:u=_r}=e;const{items:f,containerId:d,activeIndex:g,disabled:h,disableTransforms:C,sortedRects:v,overIndex:p,useDragOverlay:m,strategy:y}=c.useContext(hn),b=to(r,h),R=f.indexOf(s),S=c.useMemo(()=>({sortable:{containerId:d,index:R,items:f},...o}),[d,o,R,f]),E=c.useMemo(()=>f.slice(f.indexOf(s)),[f,s]),{rect:x,node:D,isOver:A,setNodeRef:T}=Wr({id:s,data:S,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:E,...l}}),{active:I,activatorEvent:H,activeNodeRect:K,attributes:q,setNodeRef:De,listeners:Xe,isDragging:F,over:Ye,setActivatorNodeRef:Z,transform:Ce}=Xr({id:s,data:S,attributes:{...Zr,...n},disabled:b.draggable}),je=Rn(T,De),z=!!I,ee=z&&!C&&Ke(g)&&Ke(p),de=!m&&F,Re=de&&ee?Ce:null,Ue=ee?Re??(a??y)({rects:v,activeNodeRect:K,activeIndex:g,overIndex:p,index:R}):null,oe=Ke(g)&&Ke(p)?i({id:s,items:f,activeIndex:g,overIndex:p}):R,te=I?.id,M=c.useRef({activeId:te,items:f,newIndex:oe,containerId:d}),Se=f!==M.current.items,G=t({active:I,containerId:d,isDragging:F,isSorting:z,id:s,index:R,items:f,newIndex:M.current.newIndex,previousItems:M.current.items,previousContainerId:M.current.containerId,transition:u,wasDragging:M.current.activeId!=null}),fe=eo({disabled:!G,index:R,node:D,rect:x});return c.useEffect(()=>{z&&M.current.newIndex!==oe&&(M.current.newIndex=oe),d!==M.current.containerId&&(M.current.containerId=d),f!==M.current.items&&(M.current.items=f)},[z,oe,d,f]),c.useEffect(()=>{if(te===M.current.activeId)return;if(te!=null&&M.current.activeId==null){M.current.activeId=te;return}const he=setTimeout(()=>{M.current.activeId=te},50);return()=>clearTimeout(he)},[te]),{active:I,activeIndex:g,attributes:q,data:S,rect:x,index:R,newIndex:oe,items:f,isOver:A,isSorting:z,isDragging:F,listeners:Xe,node:D,overIndex:p,over:Ye,setNodeRef:je,setActivatorNodeRef:Z,setDroppableNodeRef:T,setDraggableNodeRef:De,transform:fe??Ue,transition:ne()};function ne(){if(fe||Se&&M.current.newIndex===R)return Qr;if(!(de&&!mt(H)||!u)&&(z||G))return Je.Transition.toString({...u,property:gn})}}function to(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}function Ze(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const no=[w.Down,w.Right,w.Up,w.Left],ho=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:i,over:s,scrollableAncestors:a}}=t;if(no.includes(e.code)){if(e.preventDefault(),!n||!r)return;const l=[];i.getEnabled().forEach(d=>{if(!d||d!=null&&d.disabled)return;const g=o.get(d.id);if(g)switch(e.code){case w.Down:r.topg.top&&l.push(d);break;case w.Left:r.left>g.left&&l.push(d);break;case w.Right:r.left1&&(f=u[1].id),f!=null){const d=i.get(n.id),g=i.get(f),h=g?o.get(g.id):null,C=g?.node.current;if(C&&h&&d&&g){const p=tt(C).some((E,x)=>a[x]!==E),m=vn(d,g),y=ro(d,g),b=p||!m?{x:0,y:0}:{x:y?r.width-h.width:0,y:y?r.height-h.height:0},R={x:h.left,y:h.top};return b.x&&b.y?R:ze(R,b)}}}};function vn(e,t){return!Ze(e)||!Ze(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function ro(e,t){return!Ze(e)||!Ze(t)||!vn(e,t)?!1:e.data.current.sortable.index: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-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-\[2px\]{border-radius:2px}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-none{border-radius:0}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-l-md{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.rounded-r-full{border-top-right-radius:9999px;border-bottom-right-radius:9999px}.rounded-r-md{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.rounded-tl-sm{border-top-left-radius:calc(var(--radius) - 4px)}.rounded-tr-sm{border-top-right-radius:calc(var(--radius) - 4px)}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-4{border-width:4px}.border-\[1\.5px\]{border-width:1.5px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-l-4{border-left-width:4px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[--color-border\]{border-color:var(--color-border)}.border-amber-200{--tw-border-opacity: 1;border-color:rgb(253 230 138 / var(--tw-border-opacity, 1))}.border-amber-500\/50{border-color:#f59e0b80}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-blue-700{--tw-border-opacity: 1;border-color:rgb(29 78 216 / var(--tw-border-opacity, 1))}.border-border{border-color:hsl(var(--border))}.border-border\/50{border-color:hsl(var(--border) / .5)}.border-current{border-color:currentColor}.border-gray-800{--tw-border-opacity: 1;border-color:rgb(31 41 55 / var(--tw-border-opacity, 1))}.border-green-200{--tw-border-opacity: 1;border-color:rgb(187 247 208 / var(--tw-border-opacity, 1))}.border-green-300{--tw-border-opacity: 1;border-color:rgb(134 239 172 / var(--tw-border-opacity, 1))}.border-green-500{--tw-border-opacity: 1;border-color:rgb(34 197 94 / var(--tw-border-opacity, 1))}.border-green-600{--tw-border-opacity: 1;border-color:rgb(22 163 74 / var(--tw-border-opacity, 1))}.border-green-700{--tw-border-opacity: 1;border-color:rgb(21 128 61 / var(--tw-border-opacity, 1))}.border-input{border-color:hsl(var(--input))}.border-muted{border-color:hsl(var(--muted))}.border-muted-foreground\/30{border-color:hsl(var(--muted-foreground) / .3)}.border-muted-foreground\/50{border-color:hsl(var(--muted-foreground) / .5)}.border-orange-200{--tw-border-opacity: 1;border-color:rgb(254 215 170 / var(--tw-border-opacity, 1))}.border-orange-600{--tw-border-opacity: 1;border-color:rgb(234 88 12 / var(--tw-border-opacity, 1))}.border-primary{border-color:hsl(var(--primary))}.border-primary\/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-300{--tw-border-opacity: 1;border-color:rgb(252 165 165 / var(--tw-border-opacity, 1))}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-red-500\/50{border-color:#ef444480}.border-transparent{border-color:transparent}.border-yellow-200{--tw-border-opacity: 1;border-color:rgb(254 240 138 / var(--tw-border-opacity, 1))}.border-yellow-500\/50{border-color:#eab30880}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\[--color-bg\]{background-color:var(--color-bg)}.bg-accent{background-color:hsl(var(--accent))}.bg-amber-50{--tw-bg-opacity: 1;background-color:rgb(255 251 235 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-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\/80{background-color:hsl(var(--card) / .8)}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.bg-gray-800\/20{background-color:#1f293733}.bg-gray-800\/30{background-color:#1f29374d}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-600{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity, 1))}.bg-muted{background-color:hsl(var(--muted))}.bg-muted-foreground\/50{background-color:hsl(var(--muted-foreground) / .5)}.bg-muted\/20{background-color:hsl(var(--muted) / .2)}.bg-muted\/30{background-color:hsl(var(--muted) / .3)}.bg-muted\/50{background-color:hsl(var(--muted) / .5)}.bg-muted\/60{background-color:hsl(var(--muted) / .6)}.bg-orange-50{--tw-bg-opacity: 1;background-color:rgb(255 247 237 / var(--tw-bg-opacity, 1))}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-600{--tw-bg-opacity: 1;background-color:rgb(234 88 12 / var(--tw-bg-opacity, 1))}.bg-pink-500{--tw-bg-opacity: 1;background-color:rgb(236 72 153 / var(--tw-bg-opacity, 1))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary-foreground\/20{background-color:hsl(var(--primary-foreground) / .2)}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-primary\/20{background-color:hsl(var(--primary) / .2)}.bg-primary\/5{background-color:hsl(var(--primary) / .05)}.bg-primary\/60{background-color:hsl(var(--primary) / .6)}.bg-purple-100{--tw-bg-opacity: 1;background-color:rgb(243 232 255 / var(--tw-bg-opacity, 1))}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-red-900\/20{background-color:#7f1d1d33}.bg-red-900\/30{background-color:#7f1d1d4d}.bg-secondary{background-color:hsl(var(--secondary))}.bg-secondary\/5{background-color:hsl(var(--secondary) / .05)}.bg-slate-200{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity, 1))}.bg-slate-300{--tw-bg-opacity: 1;background-color:rgb(203 213 225 / var(--tw-bg-opacity, 1))}.bg-slate-400{--tw-bg-opacity: 1;background-color:rgb(148 163 184 / var(--tw-bg-opacity, 1))}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-200{--tw-bg-opacity: 1;background-color:rgb(254 240 138 / var(--tw-bg-opacity, 1))}.bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/5{background-color:#eab3080d}.bg-yellow-900\/20{background-color:#713f1233}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-green-500{--tw-gradient-from: #22c55e var(--tw-gradient-from-position);--tw-gradient-to: rgb(34 197 94 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-500{--tw-gradient-from: #6366f1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(99 102 241 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-orange-500{--tw-gradient-from: #f97316 var(--tw-gradient-from-position);--tw-gradient-to: rgb(249 115 22 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-primary\/5{--tw-gradient-from: hsl(var(--primary) / .05) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--primary) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-purple-500{--tw-gradient-from: #a855f7 var(--tw-gradient-from-position);--tw-gradient-to: rgb(168 85 247 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-red-500{--tw-gradient-from: #ef4444 var(--tw-gradient-from-position);--tw-gradient-to: rgb(239 68 68 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-200{--tw-gradient-from: #e2e8f0 var(--tw-gradient-from-position);--tw-gradient-to: rgb(226 232 240 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-300{--tw-gradient-from: #cbd5e1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(203 213 225 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-400{--tw-gradient-from: #94a3b8 var(--tw-gradient-from-position);--tw-gradient-to: rgb(148 163 184 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-background{--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), hsl(var(--background)) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-blue-600{--tw-gradient-to: #2563eb var(--tw-gradient-to-position)}.to-cyan-500{--tw-gradient-to: #06b6d4 var(--tw-gradient-to-position)}.to-emerald-500{--tw-gradient-to: #10b981 var(--tw-gradient-to-position)}.to-green-600{--tw-gradient-to: #16a34a var(--tw-gradient-to-position)}.to-orange-500{--tw-gradient-to: #f97316 var(--tw-gradient-to-position)}.to-pink-500{--tw-gradient-to: #ec4899 var(--tw-gradient-to-position)}.to-primary\/10{--tw-gradient-to: hsl(var(--primary) / .1) var(--tw-gradient-to-position)}.to-purple-500{--tw-gradient-to: #a855f7 var(--tw-gradient-to-position)}.to-secondary\/5{--tw-gradient-to: hsl(var(--secondary) / .05) var(--tw-gradient-to-position)}.to-slate-700{--tw-gradient-to: #334155 var(--tw-gradient-to-position)}.to-slate-800{--tw-gradient-to: #1e293b var(--tw-gradient-to-position)}.to-slate-900{--tw-gradient-to: #0f172a var(--tw-gradient-to-position)}.fill-current{fill:currentColor}.fill-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-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}.pl-10{padding-left:2.5rem}.pl-11{padding-left:2.75rem}.pl-2{padding-left:.5rem}.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-4{padding-right:1rem}.pr-6{padding-right:1.5rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.pt-8{padding-top:2rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[0\.8rem\]{font-size:.8rem}.text-\[10px\]{font-size:10px}.text-\[150px\]{font-size:150px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-black{font-weight:900}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.tracking-tight{letter-spacing:-.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-amber-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-900{--tw-text-opacity: 1;color:rgb(120 53 15 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.text-blue-900{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity, 1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/50{color:hsl(var(--foreground) / .5)}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-muted-foreground\/50{color:hsl(var(--muted-foreground) / .5)}.text-muted-foreground\/60{color:hsl(var(--muted-foreground) / .6)}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity, 1))}.text-orange-800{--tw-text-opacity: 1;color:rgb(154 52 18 / var(--tw-text-opacity, 1))}.text-orange-900{--tw-text-opacity: 1;color:rgb(124 45 18 / var(--tw-text-opacity, 1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-primary-foreground\/70{color:hsl(var(--primary-foreground) / .7)}.text-primary\/10{color:hsl(var(--primary) / .1)}.text-primary\/30{color:hsl(var(--primary) / .3)}.text-primary\/60{color:hsl(var(--primary) / .6)}.text-purple-500{--tw-text-opacity: 1;color:rgb(168 85 247 / var(--tw-text-opacity, 1))}.text-purple-600{--tw-text-opacity: 1;color:rgb(147 51 234 / var(--tw-text-opacity, 1))}.text-purple-700{--tw-text-opacity: 1;color:rgb(126 34 206 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.text-yellow-900{--tw-text-opacity: 1;color:rgb(113 63 18 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-30{opacity:.3}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.opacity-90{opacity:.9}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-primary{--tw-ring-color: hsl(var(--primary))}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.blur-3xl{--tw-blur: blur(64px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur: blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.text-primary-gradient{color:hsl(var(--primary))}.has-gradient .text-primary-gradient{background:var(--primary-gradient);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;color:transparent}.\[--cell-size\:2rem\]{--cell-size: 2rem}.no-animations *,.no-animations *:before,.no-animations *:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}.no-animations *:hover{transition-duration:.01ms!important}::view-transition-old(root),::view-transition-new(root){animation:none;mix-blend-mode:normal}::view-transition-old(root){z-index:1}::view-transition-new(root){z-index:999}.__floater{z-index:99999!important;pointer-events:auto!important}.react-joyride__overlay,.react-joyride__spotlight{z-index:99998!important}.react-joyride__tooltip{pointer-events:auto!important}#tour-portal-container *{pointer-events:auto}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.file\:text-foreground::file-selector-button{color:hsl(var(--foreground))}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.hover\:border-muted-foreground\/50:hover{border-color:hsl(var(--muted-foreground) / .5)}.hover\:border-primary\/50:hover{border-color:hsl(var(--primary) / .5)}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-accent\/50:hover{background-color:hsl(var(--accent) / .5)}.hover\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-green-700:hover{--tw-bg-opacity: 1;background-color:rgb(21 128 61 / var(--tw-bg-opacity, 1))}.hover\:bg-muted:hover{background-color:hsl(var(--muted))}.hover\:bg-muted-foreground\/20:hover{background-color:hsl(var(--muted-foreground) / .2)}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-orange-700:hover{--tw-bg-opacity: 1;background-color:rgb(194 65 12 / var(--tw-bg-opacity, 1))}.hover\:bg-primary\/10:hover{background-color:hsl(var(--primary) / .1)}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-secondary\/90:hover{background-color:hsl(var(--secondary) / .9)}.hover\:bg-transparent:hover{background-color:transparent}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-green-700:hover{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.hover\:text-orange-700:hover{--tw-text-opacity: 1;color:rgb(194 65 12 / var(--tw-text-opacity, 1))}.hover\:text-primary\/80:hover{color:hsl(var(--primary) / .8)}.hover\:text-red-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\: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\:ring-2:hover{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.hover\:ring-primary:hover{--tw-ring-color: hsl(var(--primary))}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-gray-100:focus{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-0:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-red-500:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity, 1))}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--background))}.active\:cursor-grabbing:active{cursor:grabbing}.active\:border-primary\/70:active{border-color:hsl(var(--primary) / .7)}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group[open] .group-open\:rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:opacity-100{opacity:1}.group.destructive .group-\[\.destructive\]\:border-muted\/40{border-color:hsl(var(--muted) / .4)}.group.destructive .group-\[\.destructive\]\:text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover{--tw-text-opacity: 1;color:rgb(254 242 242 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(248 113 113 / var(--tw-ring-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-offset-red-600:focus{--tw-ring-offset-color: #dc2626}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.aria-selected\:text-muted-foreground[aria-selected=true]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked],.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe=end]{--tw-translate-x: var(--radix-toast-swipe-end-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe=move]{--tw-translate-x: var(--radix-toast-swipe-move-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes fade-out{0%{opacity:1}to{opacity:0}}.data-\[state\=closed\]\:animate-fade-out[data-state=closed]{animation:fade-out .15s ease-in}.data-\[state\=closed\]\:animate-slide-out-to-right[data-state=closed]{animation:slide-out-to-right .2s ease-in}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.data-\[state\=open\]\:animate-fade-in[data-state=open]{animation:fade-in .2s ease-out}@keyframes slide-in-from-right{0%{transform:translate(100%)}to{transform:translate(0)}}.data-\[state\=open\]\:animate-slide-in-from-right[data-state=open]{animation:slide-in-from-right .3s ease-out}@keyframes slide-out-to-right{0%{transform:translate(0)}to{transform:translate(100%)}}.data-\[swipe\=end\]\:animate-slide-out-to-right[data-swipe=end]{animation:slide-out-to-right .2s ease-in}.data-\[range-end\=true\]\:rounded-md[data-range-end=true]{border-radius:calc(var(--radius) - 2px)}.data-\[range-middle\=true\]\:rounded-none[data-range-middle=true]{border-radius:0}.data-\[range-start\=true\]\:rounded-md[data-range-start=true]{border-radius:calc(var(--radius) - 2px)}.data-\[selected\=true\]\:rounded-none[data-selected=true]{border-radius:0}.data-\[range-end\=true\]\:bg-primary[data-range-end=true]{background-color:hsl(var(--primary))}.data-\[range-middle\=true\]\:bg-accent[data-range-middle=true]{background-color:hsl(var(--accent))}.data-\[range-start\=true\]\:bg-primary[data-range-start=true],.data-\[selected-single\=true\]\:bg-primary[data-selected-single=true]{background-color:hsl(var(--primary))}.data-\[selected\=true\]\:bg-accent[data-selected=true]{background-color:hsl(var(--accent))}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:hsl(var(--muted))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[placeholder\]\:text-muted-foreground[data-placeholder]{color:hsl(var(--muted-foreground))}.data-\[range-end\=true\]\:text-primary-foreground[data-range-end=true]{color:hsl(var(--primary-foreground))}.data-\[range-middle\=true\]\:text-accent-foreground[data-range-middle=true]{color:hsl(var(--accent-foreground))}.data-\[range-start\=true\]\:text-primary-foreground[data-range-start=true],.data-\[selected-single\=true\]\:text-primary-foreground[data-selected-single=true]{color:hsl(var(--primary-foreground))}.data-\[selected\=true\]\:text-accent-foreground[data-selected=true]{color:hsl(var(--accent-foreground))}.data-\[state\=active\]\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\[state\=open\]\:text-accent-foreground[data-state=open]{color:hsl(var(--accent-foreground))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:opacity-50[data-disabled=true],.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[state\=active\]\:shadow-sm[data-state=active]{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}.data-\[state\=active\]\:duration-300[data-state=active]{transition-duration:.3s}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:relative{position:relative}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:z-10{z-index:10}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:border-ring{border-color:hsl(var(--ring))}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-\[3px\]{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-ring\/50{--tw-ring-color: hsl(var(--ring) / .5)}@supports (backdrop-filter: var(--tw)){.supports-\[backdrop-filter\]\:bg-background\/60{background-color:hsl(var(--background) / .6)}}.dark\:border-amber-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(146 64 14 / var(--tw-border-opacity, 1))}.dark\:border-blue-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 64 175 / var(--tw-border-opacity, 1))}.dark\:border-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-orange-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(124 45 18 / var(--tw-border-opacity, 1))}.dark\:border-yellow-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(113 63 18 / var(--tw-border-opacity, 1))}.dark\:bg-amber-950\/30:is(.dark *){background-color:#451a034d}.dark\:bg-blue-500\/20:is(.dark *){background-color:#3b82f633}.dark\:bg-blue-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 58 138 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-900\/30:is(.dark *){background-color:#1e3a8a4d}.dark\:bg-blue-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(23 37 84 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-950\/20:is(.dark *){background-color:#17255433}.dark\:bg-blue-950\/30:is(.dark *){background-color:#1725544d}.dark\:bg-gray-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-800\/30:is(.dark *){background-color:#1f29374d}.dark\:bg-gray-800\/50:is(.dark *){background-color:#1f293780}.dark\:bg-gray-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(3 7 18 / var(--tw-bg-opacity, 1))}.dark\:bg-green-900\/30:is(.dark *){background-color:#14532d4d}.dark\:bg-green-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(5 46 22 / var(--tw-bg-opacity, 1))}.dark\:bg-green-950\/20:is(.dark *){background-color:#052e1633}.dark\:bg-orange-950\/20:is(.dark *){background-color:#43140733}.dark\:bg-purple-900\/30:is(.dark *){background-color:#581c874d}.dark\:bg-red-500\/20:is(.dark *){background-color:#ef444433}.dark\:bg-red-600\/30:is(.dark *){background-color:#dc26264d}.dark\:bg-red-900\/30:is(.dark *){background-color:#7f1d1d4d}.dark\:bg-red-950\/50:is(.dark *){background-color:#450a0a80}.dark\:bg-yellow-500\/20:is(.dark *){background-color:#eab30833}.dark\:bg-yellow-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(113 63 18 / var(--tw-bg-opacity, 1))}.dark\:bg-yellow-950\/30:is(.dark *){background-color:#4220064d}.dark\:text-amber-100:is(.dark *){--tw-text-opacity: 1;color:rgb(254 243 199 / var(--tw-text-opacity, 1))}.dark\:text-amber-400:is(.dark *){--tw-text-opacity: 1;color:rgb(251 191 36 / 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-400:is(.dark *){--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.dark\:text-orange-100:is(.dark *){--tw-text-opacity: 1;color:rgb(255 237 213 / var(--tw-text-opacity, 1))}.dark\:text-orange-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 215 170 / var(--tw-text-opacity, 1))}.dark\:text-purple-400:is(.dark *){--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.dark\:text-red-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\:focus\:bg-gray-800:focus:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}@media(min-width:640px){.sm\:right-2{right:.5rem}.sm\:right-3{right:.75rem}.sm\:top-2{top:.5rem}.sm\:top-3{top:.75rem}.sm\:order-1{order:1}.sm\:order-2{order:2}.sm\:col-span-2{grid-column:span 2 / span 2}.sm\:mx-0{margin-left:0;margin-right:0}.sm\:mb-3{margin-bottom:.75rem}.sm\:mb-4{margin-bottom:1rem}.sm\:mb-6{margin-bottom:1.5rem}.sm\:ml-0{margin-left:0}.sm\:ml-1{margin-left:.25rem}.sm\:mr-1{margin-right:.25rem}.sm\:mt-0{margin-top:0}.sm\:mt-2{margin-top:.5rem}.sm\:mt-3{margin-top:.75rem}.sm\:mt-6{margin-top:1.5rem}.sm\:block{display:block}.sm\:inline{display:inline}.sm\:flex{display:flex}.sm\:grid{display:grid}.sm\:hidden{display:none}.sm\:h-10{height:2.5rem}.sm\:h-12{height:3rem}.sm\:h-2{height:.5rem}.sm\:h-2\.5{height:.625rem}.sm\:h-24{height:6rem}.sm\:h-4{height:1rem}.sm\:h-5{height:1.25rem}.sm\:h-8{height:2rem}.sm\:h-9{height:2.25rem}.sm\:h-\[300px\]{height:300px}.sm\:h-\[400px\]{height:400px}.sm\:h-\[500px\]{height:500px}.sm\:h-\[calc\(100vh-280px\)\]{height:calc(100vh - 280px)}.sm\:w-10{width:2.5rem}.sm\:w-2{width:.5rem}.sm\:w-2\.5{width:.625rem}.sm\:w-24{width:6rem}.sm\:w-28{width:7rem}.sm\:w-4{width:1rem}.sm\:w-5{width:1.25rem}.sm\:w-8{width:2rem}.sm\:w-80{width:20rem}.sm\:w-96{width:24rem}.sm\:w-\[200px\]{width:200px}.sm\:w-\[500px\]{width:500px}.sm\:w-auto{width:auto}.sm\:w-full{width:100%}.sm\:min-w-\[120px\]{min-width:120px}.sm\:max-w-2xl{max-width:42rem}.sm\:max-w-\[420px\]{max-width:420px}.sm\:max-w-\[500px\]{max-width:500px}.sm\:max-w-\[70\%\]{max-width:70%}.sm\:max-w-\[900px\]{max-width:900px}.sm\:max-w-md{max-width:28rem}.sm\:max-w-sm{max-width:24rem}.sm\:flex-1{flex:1 1 0%}.sm\:flex-none{flex:none}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.sm\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-start{align-items:flex-start}.sm\:items-center{align-items:center}.sm\:justify-end{justify-content:flex-end}.sm\:justify-between{justify-content:space-between}.sm\:gap-0{gap:0px}.sm\:gap-1{gap:.25rem}.sm\:gap-2{gap:.5rem}.sm\:gap-3{gap:.75rem}.sm\:gap-4{gap:1rem}.sm\:gap-6{gap:1.5rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.sm\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.sm\:space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.sm\:space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.sm\:space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:p-3{padding:.75rem}.sm\:p-4{padding:1rem}.sm\:p-6{padding:1.5rem}.sm\:px-0{padding-left:0;padding-right:0}.sm\:px-3{padding-left:.75rem;padding-right:.75rem}.sm\:px-4{padding-left:1rem;padding-right:1rem}.sm\:py-2{padding-top:.5rem;padding-bottom:.5rem}.sm\:pb-3{padding-bottom:.75rem}.sm\:text-left{text-align:left}.sm\:text-right{text-align:right}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-3xl{font-size:1.875rem;line-height:2.25rem}.sm\:text-\[200px\]{font-size:200px}.sm\:text-base{font-size:1rem;line-height:1.5rem}.sm\:text-lg{font-size:1.125rem;line-height:1.75rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:text-xl{font-size:1.25rem;line-height:1.75rem}.sm\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:768px){.md\:top-4{top:1rem}.md\:mb-4{margin-bottom:1rem}.md\:mb-6{margin-bottom:1.5rem}.md\:mb-8{margin-bottom:2rem}.md\:mt-8{margin-top:2rem}.md\:block{display:block}.md\:inline{display:inline}.md\:flex{display:flex}.md\:hidden{display:none}.md\:h-16{height:4rem}.md\:h-4{height:1rem}.md\:h-5{height:1.25rem}.md\:h-8{height:2rem}.md\:h-96{height:24rem}.md\:h-\[500px\]{height:500px}.md\:min-h-\[400px\]{min-height:400px}.md\:w-16{width:4rem}.md\:w-4{width:1rem}.md\:w-5{width:1.25rem}.md\:w-8{width:2rem}.md\:w-96{width:24rem}.md\:max-w-none{max-width:none}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:gap-2{gap:.5rem}.md\:gap-3{gap:.75rem}.md\:gap-4{gap:1rem}.md\:gap-6{gap:1.5rem}.md\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.md\:space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.md\:whitespace-normal{white-space:normal}.md\:p-12{padding:3rem}.md\:p-4{padding:1rem}.md\:p-6{padding:1.5rem}.md\:p-8{padding:2rem}.md\:text-2xl{font-size:1.5rem;line-height:2rem}.md\:text-3xl{font-size:1.875rem;line-height:2.25rem}.md\:text-base{font-size:1rem;line-height:1.5rem}.md\:text-lg{font-size:1.125rem;line-height:1.75rem}.md\:text-sm{font-size:.875rem;line-height:1.25rem}.md\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:1024px){.lg\:invisible{visibility:hidden}.lg\:relative{position:relative}.lg\:z-0{z-index:0}.lg\:col-span-1{grid-column:span 1 / span 1}.lg\: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-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\:grid-cols-9{grid-template-columns:repeat(9,minmax(0,1fr))}.lg\:justify-center{justify-content:center}.lg\:gap-0{gap:0px}.lg\:space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.lg\:overflow-hidden{overflow:hidden}.lg\:p-2{padding:.5rem}.lg\:p-4{padding:1rem}.lg\:px-0{padding-left:0;padding-right:0}.lg\:px-4{padding-left:1rem;padding-right:1rem}.lg\:pb-4{padding-bottom:1rem}.lg\:text-2xl{font-size:1.5rem;line-height:2rem}.lg\:opacity-0{opacity:0}}@media(min-width:1280px){.xl\:grid-cols-10{grid-template-columns:repeat(10,minmax(0,1fr))}.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.xl\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}}.\[\&\+div\]\:text-xs+div{font-size:.75rem;line-height:1rem}.\[\&\:\:-webkit-scrollbar-thumb\:hover\]\:bg-border\/80::-webkit-scrollbar-thumb:hover{background-color:hsl(var(--border) / .8)}.\[\&\:\:-webkit-scrollbar-thumb\]\:rounded-full::-webkit-scrollbar-thumb{border-radius:9999px}.\[\&\:\:-webkit-scrollbar-thumb\]\:bg-border::-webkit-scrollbar-thumb{background-color:hsl(var(--border))}.\[\&\:\:-webkit-scrollbar-track\]\:bg-transparent::-webkit-scrollbar-track{background-color:transparent}.\[\&\:\:-webkit-scrollbar\]\:w-2\.5::-webkit-scrollbar{width:.625rem}.\[\&\:first-child\[data-selected\=true\]_button\]\:rounded-l-md:first-child[data-selected=true] button{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\:last-child\[data-selected\=true\]_button\]\:rounded-r-md:last-child[data-selected=true] button{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\>\[role\=checkbox\]\]\:translate-y-\[2px\]>[role=checkbox]{--tw-translate-y: 2px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>span\]\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\[\&\>span\]\:text-xs>span{font-size:.75rem;line-height:1rem}.\[\&\>span\]\:opacity-70>span{opacity:.7}.\[\&\>svg\+div\]\:translate-y-\[-3px\]>svg+div{--tw-translate-y: -3px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>svg\]\:absolute>svg{position:absolute}.\[\&\>svg\]\:left-4>svg{left:1rem}.\[\&\>svg\]\:top-4>svg{top:1rem}.\[\&\>svg\]\:size-3\.5>svg{width:.875rem;height:.875rem}.\[\&\>svg\]\:h-2\.5>svg{height:.625rem}.\[\&\>svg\]\:h-3>svg{height:.75rem}.\[\&\>svg\]\:w-2\.5>svg{width:.625rem}.\[\&\>svg\]\:w-3>svg{width:.75rem}.\[\&\>svg\]\:text-foreground>svg{color:hsl(var(--foreground))}.\[\&\>svg\]\:text-muted-foreground>svg{color:hsl(var(--muted-foreground))}.\[\&\>svg\~\*\]\:pl-7>svg~*{padding-left:1.75rem}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&_\.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}.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)}@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}.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-DTswSzg5.js b/webui/dist/assets/index-BDQi9W1Z.js similarity index 62% rename from webui/dist/assets/index-DTswSzg5.js rename to webui/dist/assets/index-BDQi9W1Z.js index 554e7470..37cebd37 100644 --- a/webui/dist/assets/index-DTswSzg5.js +++ b/webui/dist/assets/index-BDQi9W1Z.js @@ -1,76 +1,76 @@ -import{r as m,j as e,L as li,e as Ea,R as Et,b as lN,f as nN,g as iN,h as rN,k as at,l as cN,m as oN,O as Gp,n as dN}from"./router-Bz250laD.js";import{a as uN,b as mN,g as xN}from"./react-vendor-BmxF9s7Q.js";import{N as hN,c as fN,O as xi,P as Vc,g as Mu}from"./utils-BXc2jIuz.js";import{L as Fp,T as Vp,C as Ip,R as pN,a as Qp,V as gN,b as jN,S as Yp,c as vN,d as Kp,I as bN,e as Xp,f as NN,g as Jp,h as yN,i as wN,j as _N,O as Pp,P as SN,k as Zp,l as Wp,D as eg,A as sg,m as tg,n as CN,o as kN,p as ag,q as TN,r as lg,s as EN,t as zN,u as MN,v as AN,w as ON,x as ng,y as ig,F as rg,z as cg,B as DN,E as RN}from"./radix-extra-DDK-u9dm.js";import{R as LN,T as UN,L as BN,g as HN,C as Ic,X as Qc,Y as cr,h as $N,B as Au,j as Yc,P as qN,k as GN,l as FN}from"./charts-DbiuC1q1.js";import{S as VN,G as og,O as dg,o as IN,C as ug,p as QN,T as mg,D as xg,R as YN,q as KN,H as hg,I as XN,J as fg,K as pg,L as JN,M as gg,V as PN,N as jg,Q as vg,U as ZN,X as WN,Y as bg,Z as ey,_ as sy,$ as Ng,a0 as ty,e as ay,f as ly,c as yg,P as uo,d as tm,b as Xu,h as ny,l as iy,m as ry,a1 as cy,a2 as wg,a3 as oy,a4 as dy,a5 as uy,a6 as _g,a7 as Sg,a8 as Cg,a9 as kg,aa as Tg,ab as Eg,ac as my}from"./radix-core-9dEfQl-6.js";import{R as qt,P as kr,C as ma,a as Gt,Z as fn,b as ao,F as Ra,c as xy,S as hi,d as hy,M as Yl,A as fy,D as py,e as lo,f as oi,T as gy,X as gl,g as jy,h as vy,I as Ia,i as La,j as sa,k as no,E as vr,l as Qt,m as zg,H as by,n as es,o as Ua,U as br,p as Mg,q as Ag,L as up,K as Og,r as Dg,s as Ny,t as Wc,u as mt,v as yy,B as mr,w as io,x as am,y as wy,z as _y,G as Ft,J as mo,N as di,O as ft,Q as Qa,V as ui,W as lm,Y as Tr,_ as Sy,$ as Cy,a0 as pn,a1 as fi,a2 as jl,a3 as Xa,a4 as pi,a5 as nm,a6 as ky,a7 as Ty,a8 as Ey,a9 as Ql,aa as zy,ab as Rg,ac as eo,ad as gn,ae as My,af as mi,ag as Ay,ah as Ju,ai as Pu,aj as Lg,ak as Oy,al as Dy,am as mp,an as Ry,ao as fl,ap as Ou,aq as xp,ar as Ly,as as Ug,at as Du,au as Uy,av as By,aw as Hy,ax as $y,ay as qy,az as Bg,aA as Hg,aB as $g,aC as qg,aD as Gy,aE as hp,aF as Fy,aG as Vy,aH as Iy,aI as Qy}from"./icons-LXi74TG3.js";import{S as Yy,p as Ky,j as Xy,a as Jy,E as fp,R as Py,o as Zy}from"./codemirror-BEE0n9kQ.js";import{_ as la,c as Wy,g as Gg,D as e0,z as Kc}from"./misc-CKjrIrIJ.js";import{u as s0,a as pp,D as t0,c as a0,S as l0,h as n0,b as i0,s as r0,K as c0,P as o0,d as d0,C as u0}from"./dnd-CHfCzWUK.js";import{D as m0,U as x0}from"./uppy-BMZiFQyG.js";import{M as h0,r as f0,a as p0,b as g0}from"./markdown-kUhwkcQP.js";import{c as j0,H as ro,P as co,u as v0,d as b0,R as N0,B as y0,e as w0,C as _0,M as S0,f as C0}from"./reactflow-DLoXAt4c.js";(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))o(u);new MutationObserver(u=>{for(const x of u)if(x.type==="childList")for(const h of x.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&o(h)}).observe(document,{childList:!0,subtree:!0});function r(u){const x={};return u.integrity&&(x.integrity=u.integrity),u.referrerPolicy&&(x.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?x.credentials="include":u.crossOrigin==="anonymous"?x.credentials="omit":x.credentials="same-origin",x}function o(u){if(u.ep)return;u.ep=!0;const x=r(u);fetch(u.href,x)}})();var Ru={exports:{}},or={},Lu={exports:{}},Uu={};var gp;function k0(){return gp||(gp=1,(function(l){function i(D,Y){var K=D.length;D.push(Y);e:for(;0>>1,k=D[re];if(0>>1;reu(Ce,K))_eu(Me,Ce)?(D[re]=Me,D[_e]=K,re=_e):(D[re]=Ce,D[xe]=K,re=xe);else if(_eu(Me,K))D[re]=Me,D[_e]=K,re=_e;else break e}}return Y}function u(D,Y){var K=D.sortIndex-Y.sortIndex;return K!==0?K:D.id-Y.id}if(l.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var x=performance;l.unstable_now=function(){return x.now()}}else{var h=Date,p=h.now();l.unstable_now=function(){return h.now()-p}}var g=[],v=[],j=1,N=null,y=3,S=!1,w=!1,R=!1,O=!1,U=typeof setTimeout=="function"?setTimeout:null,G=typeof clearTimeout=="function"?clearTimeout:null,L=typeof setImmediate<"u"?setImmediate:null;function T(D){for(var Y=r(v);Y!==null;){if(Y.callback===null)o(v);else if(Y.startTime<=D)o(v),Y.sortIndex=Y.expirationTime,i(g,Y);else break;Y=r(v)}}function F(D){if(R=!1,T(D),!w)if(r(g)!==null)w=!0,q||(q=!0,ge());else{var Y=r(v);Y!==null&&Ne(F,Y.startTime-D)}}var q=!1,z=-1,M=5,Q=-1;function fe(){return O?!0:!(l.unstable_now()-QD&&fe());){var re=N.callback;if(typeof re=="function"){N.callback=null,y=N.priorityLevel;var k=re(N.expirationTime<=D);if(D=l.unstable_now(),typeof k=="function"){N.callback=k,T(D),Y=!0;break s}N===r(g)&&o(g),T(D)}else o(g);N=r(g)}if(N!==null)Y=!0;else{var ne=r(v);ne!==null&&Ne(F,ne.startTime-D),Y=!1}}break e}finally{N=null,y=K,S=!1}Y=void 0}}finally{Y?ge():q=!1}}}var ge;if(typeof L=="function")ge=function(){L(ve)};else if(typeof MessageChannel<"u"){var be=new MessageChannel,je=be.port2;be.port1.onmessage=ve,ge=function(){je.postMessage(null)}}else ge=function(){U(ve,0)};function Ne(D,Y){z=U(function(){D(l.unstable_now())},Y)}l.unstable_IdlePriority=5,l.unstable_ImmediatePriority=1,l.unstable_LowPriority=4,l.unstable_NormalPriority=3,l.unstable_Profiling=null,l.unstable_UserBlockingPriority=2,l.unstable_cancelCallback=function(D){D.callback=null},l.unstable_forceFrameRate=function(D){0>D||125re?(D.sortIndex=K,i(v,D),r(g)===null&&D===r(v)&&(R?(G(z),z=-1):R=!0,Ne(F,K-re))):(D.sortIndex=k,i(g,D),w||S||(w=!0,q||(q=!0,ge()))),D},l.unstable_shouldYield=fe,l.unstable_wrapCallback=function(D){var Y=y;return function(){var K=y;y=Y;try{return D.apply(this,arguments)}finally{y=K}}}})(Uu)),Uu}var jp;function T0(){return jp||(jp=1,Lu.exports=k0()),Lu.exports}var vp;function E0(){if(vp)return or;vp=1;var l=T0(),i=uN(),r=mN();function o(s){var t="https://react.dev/errors/"+s;if(1k||(s.current=re[k],re[k]=null,k--)}function Ce(s,t){k++,re[k]=s.current,s.current=t}var _e=ne(null),Me=ne(null),Z=ne(null),me=ne(null);function ke(s,t){switch(Ce(Z,t),Ce(Me,s),Ce(_e,null),t.nodeType){case 9:case 11:s=(s=t.documentElement)&&(s=s.namespaceURI)?Df(s):0;break;default:if(s=t.tagName,t=t.namespaceURI)t=Df(t),s=Rf(t,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}xe(_e),Ce(_e,s)}function X(){xe(_e),xe(Me),xe(Z)}function ae(s){s.memoizedState!==null&&Ce(me,s);var t=_e.current,a=Rf(t,s.type);t!==a&&(Ce(Me,s),Ce(_e,a))}function De(s){Me.current===s&&(xe(_e),xe(Me)),me.current===s&&(xe(me),lr._currentValue=K)}var _s,E;function he(s){if(_s===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);_s=t&&t[1]||"",E=-1{for(const x of u)if(x.type==="childList")for(const h of x.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&o(h)}).observe(document,{childList:!0,subtree:!0});function r(u){const x={};return u.integrity&&(x.integrity=u.integrity),u.referrerPolicy&&(x.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?x.credentials="include":u.crossOrigin==="anonymous"?x.credentials="omit":x.credentials="same-origin",x}function o(u){if(u.ep)return;u.ep=!0;const x=r(u);fetch(u.href,x)}})();var Lu={exports:{}},or={},Uu={exports:{}},Bu={};var gp;function T0(){return gp||(gp=1,(function(l){function i(R,Y){var K=R.length;R.push(Y);e:for(;0>>1,T=R[re];if(0>>1;reu(Ce,K))_eu(Me,Ce)?(R[re]=Me,R[_e]=K,re=_e):(R[re]=Ce,R[xe]=K,re=xe);else if(_eu(Me,K))R[re]=Me,R[_e]=K,re=_e;else break e}}return Y}function u(R,Y){var K=R.sortIndex-Y.sortIndex;return K!==0?K:R.id-Y.id}if(l.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var x=performance;l.unstable_now=function(){return x.now()}}else{var h=Date,f=h.now();l.unstable_now=function(){return h.now()-f}}var g=[],j=[],v=1,N=null,y=3,S=!1,w=!1,L=!1,O=!1,U=typeof setTimeout=="function"?setTimeout:null,F=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function k(R){for(var Y=r(j);Y!==null;){if(Y.callback===null)o(j);else if(Y.startTime<=R)o(j),Y.sortIndex=Y.expirationTime,i(g,Y);else break;Y=r(j)}}function $(R){if(L=!1,k(R),!w)if(r(g)!==null)w=!0,G||(G=!0,ge());else{var Y=r(j);Y!==null&&Ne($,Y.startTime-R)}}var G=!1,z=-1,M=5,Q=-1;function fe(){return O?!0:!(l.unstable_now()-QR&&fe());){var re=N.callback;if(typeof re=="function"){N.callback=null,y=N.priorityLevel;var T=re(N.expirationTime<=R);if(R=l.unstable_now(),typeof T=="function"){N.callback=T,k(R),Y=!0;break s}N===r(g)&&o(g),k(R)}else o(g);N=r(g)}if(N!==null)Y=!0;else{var ie=r(j);ie!==null&&Ne($,ie.startTime-R),Y=!1}}break e}finally{N=null,y=K,S=!1}Y=void 0}}finally{Y?ge():G=!1}}}var ge;if(typeof A=="function")ge=function(){A(ve)};else if(typeof MessageChannel<"u"){var be=new MessageChannel,je=be.port2;be.port1.onmessage=ve,ge=function(){je.postMessage(null)}}else ge=function(){U(ve,0)};function Ne(R,Y){z=U(function(){R(l.unstable_now())},Y)}l.unstable_IdlePriority=5,l.unstable_ImmediatePriority=1,l.unstable_LowPriority=4,l.unstable_NormalPriority=3,l.unstable_Profiling=null,l.unstable_UserBlockingPriority=2,l.unstable_cancelCallback=function(R){R.callback=null},l.unstable_forceFrameRate=function(R){0>R||125re?(R.sortIndex=K,i(j,R),r(g)===null&&R===r(j)&&(L?(F(z),z=-1):L=!0,Ne($,K-re))):(R.sortIndex=T,i(g,R),w||S||(w=!0,G||(G=!0,ge()))),R},l.unstable_shouldYield=fe,l.unstable_wrapCallback=function(R){var Y=y;return function(){var K=y;y=Y;try{return R.apply(this,arguments)}finally{y=K}}}})(Bu)),Bu}var jp;function E0(){return jp||(jp=1,Uu.exports=T0()),Uu.exports}var vp;function z0(){if(vp)return or;vp=1;var l=E0(),i=yN(),r=wN();function o(s){var t="https://react.dev/errors/"+s;if(1T||(s.current=re[T],re[T]=null,T--)}function Ce(s,t){T++,re[T]=s.current,s.current=t}var _e=ie(null),Me=ie(null),Z=ie(null),me=ie(null);function ke(s,t){switch(Ce(Z,t),Ce(Me,s),Ce(_e,null),t.nodeType){case 9:case 11:s=(s=t.documentElement)&&(s=s.namespaceURI)?Rf(s):0;break;default:if(s=t.tagName,t=t.namespaceURI)t=Rf(t),s=Lf(t,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}xe(_e),Ce(_e,s)}function X(){xe(_e),xe(Me),xe(Z)}function ae(s){s.memoizedState!==null&&Ce(me,s);var t=_e.current,a=Lf(t,s.type);t!==a&&(Ce(Me,s),Ce(_e,a))}function De(s){Me.current===s&&(xe(_e),xe(Me)),me.current===s&&(xe(me),lr._currentValue=K)}var _s,E;function he(s){if(_s===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);_s=t&&t[1]||"",E=-1)":-1c||A[n]!==P[c]){var ce=` -`+A[n].replace(" at new "," at ");return s.displayName&&ce.includes("")&&(ce=ce.replace("",s.displayName)),ce}while(1<=n&&0<=c);break}}}finally{Xe=!1,Error.prepareStackTrace=a}return(a=s?s.displayName||s.name:"")?he(a):""}function W(s,t){switch(s.tag){case 26:case 27:case 5:return he(s.type);case 16:return he("Lazy");case 13:return s.child!==t&&t!==null?he("Suspense Fallback"):he("Suspense");case 19:return he("SuspenseList");case 0:case 15:return ye(s.type,!1);case 11:return ye(s.type.render,!1);case 1:return ye(s.type,!0);case 31:return he("Activity");default:return""}}function Se(s){try{var t="",a=null;do t+=W(s,a),a=s,s=s.return;while(s);return t}catch(n){return` +`);for(c=n=0;nc||D[n]!==P[c]){var ce=` +`+D[n].replace(" at new "," at ");return s.displayName&&ce.includes("")&&(ce=ce.replace("",s.displayName)),ce}while(1<=n&&0<=c);break}}}finally{Xe=!1,Error.prepareStackTrace=a}return(a=s?s.displayName||s.name:"")?he(a):""}function W(s,t){switch(s.tag){case 26:case 27:case 5:return he(s.type);case 16:return he("Lazy");case 13:return s.child!==t&&t!==null?he("Suspense Fallback"):he("Suspense");case 19:return he("SuspenseList");case 0:case 15:return ye(s.type,!1);case 11:return ye(s.type.render,!1);case 1:return ye(s.type,!0);case 31:return he("Activity");default:return""}}function Se(s){try{var t="",a=null;do t+=W(s,a),a=s,s=s.return;while(s);return t}catch(n){return` Error generating stack: `+n.message+` -`+n.stack}}var Ge=Object.prototype.hasOwnProperty,jt=l.unstable_scheduleCallback,Qs=l.unstable_cancelCallback,zt=l.unstable_shouldYield,Es=l.unstable_requestPaint,lt=l.unstable_now,I=l.unstable_getCurrentPriorityLevel,$e=l.unstable_ImmediatePriority,Oe=l.unstable_UserBlockingPriority,Ke=l.unstable_NormalPriority,$s=l.unstable_LowPriority,Je=l.unstable_IdlePriority,Ps=l.log,we=l.unstable_setDisableYieldValue,Ss=null,Ee=null;function xs(s){if(typeof Ps=="function"&&we(s),Ee&&typeof Ee.setStrictMode=="function")try{Ee.setStrictMode(Ss,s)}catch{}}var bs=Math.clz32?Math.clz32:vt,Mt=Math.log,Ys=Math.LN2;function vt(s){return s>>>=0,s===0?32:31-(Mt(s)/Ys|0)|0}var Ks=256,nt=262144,bl=4194304;function ha(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 bt(s,t,a){var n=s.pendingLanes;if(n===0)return 0;var c=0,d=s.suspendedLanes,f=s.pingedLanes;s=s.warmLanes;var b=n&134217727;return b!==0?(n=b&~d,n!==0?c=ha(n):(f&=b,f!==0?c=ha(f):a||(a=b&~s,a!==0&&(c=ha(a))))):(b=n&~d,b!==0?c=ha(b):f!==0?c=ha(f):a||(a=n&~s,a!==0&&(c=ha(a)))),c===0?0:t!==0&&t!==c&&(t&d)===0&&(d=c&-c,a=t&-t,d>=a||d===32&&(a&4194048)!==0)?t:c}function Vt(s,t){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&t)===0}function te(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 de(){var s=bl;return bl<<=1,(bl&62914560)===0&&(bl=4194304),s}function Ns(s){for(var t=[],a=0;31>a;a++)t.push(s);return t}function At(s,t){s.pendingLanes|=t,t!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function Ot(s,t,a,n,c,d){var f=s.pendingLanes;s.pendingLanes=a,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=a,s.entangledLanes&=a,s.errorRecoveryDisabledLanes&=a,s.shellSuspendCounter=0;var b=s.entanglements,A=s.expirationTimes,P=s.hiddenUpdates;for(a=f&~a;0"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var Zj=/[\n"\\]/g;function pa(s){return s.replace(Zj,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function So(s,t,a,n,c,d,f,b){s.name="",f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"?s.type=f:s.removeAttribute("type"),t!=null?f==="number"?(t===0&&s.value===""||s.value!=t)&&(s.value=""+fa(t)):s.value!==""+fa(t)&&(s.value=""+fa(t)):f!=="submit"&&f!=="reset"||s.removeAttribute("value"),t!=null?Co(s,f,fa(t)):a!=null?Co(s,f,fa(a)):n!=null&&s.removeAttribute("value"),c==null&&d!=null&&(s.defaultChecked=!!d),c!=null&&(s.checked=c&&typeof c!="function"&&typeof c!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?s.name=""+fa(b):s.removeAttribute("name")}function km(s,t,a,n,c,d,f,b){if(d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(s.type=d),t!=null||a!=null){if(!(d!=="submit"&&d!=="reset"||t!=null)){_o(s);return}a=a!=null?""+fa(a):"",t=t!=null?""+fa(t):a,b||t===s.value||(s.value=t),s.defaultValue=t}n=n??c,n=typeof n!="function"&&typeof n!="symbol"&&!!n,s.checked=b?s.checked:!!n,s.defaultChecked=!!n,f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(s.name=f),_o(s)}function Co(s,t,a){t==="number"&&Dr(s.ownerDocument)===s||s.defaultValue===""+a||(s.defaultValue=""+a)}function Sn(s,t,a,n){if(s=s.options,t){t={};for(var c=0;c"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Mo=!1;if(Za)try{var yi={};Object.defineProperty(yi,"passive",{get:function(){Mo=!0}}),window.addEventListener("test",yi,yi),window.removeEventListener("test",yi,yi)}catch{Mo=!1}var yl=null,Ao=null,Lr=null;function Dm(){if(Lr)return Lr;var s,t=Ao,a=t.length,n,c="value"in yl?yl.value:yl.textContent,d=c.length;for(s=0;s=Si),$m=" ",qm=!1;function Gm(s,t){switch(s){case"keyup":return Cv.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Fm(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var En=!1;function Tv(s,t){switch(s){case"compositionend":return Fm(t);case"keypress":return t.which!==32?null:(qm=!0,$m);case"textInput":return s=t.data,s===$m&&qm?null:s;default:return null}}function Ev(s,t){if(En)return s==="compositionend"||!Uo&&Gm(s,t)?(s=Dm(),Lr=Ao=yl=null,En=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:a,offset:t-s};s=n}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Pm(a)}}function Wm(s,t){return s&&t?s===t?!0:s&&s.nodeType===3?!1:t&&t.nodeType===3?Wm(s,t.parentNode):"contains"in s?s.contains(t):s.compareDocumentPosition?!!(s.compareDocumentPosition(t)&16):!1:!1}function ex(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var t=Dr(s.document);t instanceof s.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)s=t.contentWindow;else break;t=Dr(s.document)}return t}function $o(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 Uv=Za&&"documentMode"in document&&11>=document.documentMode,zn=null,qo=null,Ei=null,Go=!1;function sx(s,t,a){var n=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Go||zn==null||zn!==Dr(n)||(n=zn,"selectionStart"in n&&$o(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),Ei&&Ti(Ei,n)||(Ei=n,n=Ec(qo,"onSelect"),0>=f,c-=f,Ha=1<<32-bs(t)+c|a<ss?(vs=Re,Re=null):vs=Re.sibling;var ks=ee($,Re,J[ss],oe);if(ks===null){Re===null&&(Re=vs);break}s&&Re&&ks.alternate===null&&t($,Re),B=d(ks,B,ss),Cs===null?qe=ks:Cs.sibling=ks,Cs=ks,Re=vs}if(ss===J.length)return a($,Re),ws&&el($,ss),qe;if(Re===null){for(;ssss?(vs=Re,Re=null):vs=Re.sibling;var Vl=ee($,Re,ks.value,oe);if(Vl===null){Re===null&&(Re=vs);break}s&&Re&&Vl.alternate===null&&t($,Re),B=d(Vl,B,ss),Cs===null?qe=Vl:Cs.sibling=Vl,Cs=Vl,Re=vs}if(ks.done)return a($,Re),ws&&el($,ss),qe;if(Re===null){for(;!ks.done;ss++,ks=J.next())ks=ue($,ks.value,oe),ks!==null&&(B=d(ks,B,ss),Cs===null?qe=ks:Cs.sibling=ks,Cs=ks);return ws&&el($,ss),qe}for(Re=n(Re);!ks.done;ss++,ks=J.next())ks=le(Re,$,ss,ks.value,oe),ks!==null&&(s&&ks.alternate!==null&&Re.delete(ks.key===null?ss:ks.key),B=d(ks,B,ss),Cs===null?qe=ks:Cs.sibling=ks,Cs=ks);return s&&Re.forEach(function(aN){return t($,aN)}),ws&&el($,ss),qe}function Ls($,B,J,oe){if(typeof J=="object"&&J!==null&&J.type===R&&J.key===null&&(J=J.props.children),typeof J=="object"&&J!==null){switch(J.$$typeof){case S:e:{for(var qe=J.key;B!==null;){if(B.key===qe){if(qe=J.type,qe===R){if(B.tag===7){a($,B.sibling),oe=c(B,J.props.children),oe.return=$,$=oe;break e}}else if(B.elementType===qe||typeof qe=="object"&&qe!==null&&qe.$$typeof===M&&rn(qe)===B.type){a($,B.sibling),oe=c(B,J.props),Ri(oe,J),oe.return=$,$=oe;break e}a($,B);break}else t($,B);B=B.sibling}J.type===R?(oe=sn(J.props.children,$.mode,oe,J.key),oe.return=$,$=oe):(oe=Qr(J.type,J.key,J.props,null,$.mode,oe),Ri(oe,J),oe.return=$,$=oe)}return f($);case w:e:{for(qe=J.key;B!==null;){if(B.key===qe)if(B.tag===4&&B.stateNode.containerInfo===J.containerInfo&&B.stateNode.implementation===J.implementation){a($,B.sibling),oe=c(B,J.children||[]),oe.return=$,$=oe;break e}else{a($,B);break}else t($,B);B=B.sibling}oe=Xo(J,$.mode,oe),oe.return=$,$=oe}return f($);case M:return J=rn(J),Ls($,B,J,oe)}if(Ne(J))return Ae($,B,J,oe);if(ge(J)){if(qe=ge(J),typeof qe!="function")throw Error(o(150));return J=qe.call(J),Ye($,B,J,oe)}if(typeof J.then=="function")return Ls($,B,Wr(J),oe);if(J.$$typeof===L)return Ls($,B,Xr($,J),oe);ec($,J)}return typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint"?(J=""+J,B!==null&&B.tag===6?(a($,B.sibling),oe=c(B,J),oe.return=$,$=oe):(a($,B),oe=Ko(J,$.mode,oe),oe.return=$,$=oe),f($)):a($,B)}return function($,B,J,oe){try{Di=0;var qe=Ls($,B,J,oe);return qn=null,qe}catch(Re){if(Re===$n||Re===Pr)throw Re;var Cs=ia(29,Re,null,$.mode);return Cs.lanes=oe,Cs.return=$,Cs}finally{}}}var on=_x(!0),Sx=_x(!1),kl=!1;function rd(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function cd(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 Tl(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function El(s,t,a){var n=s.updateQueue;if(n===null)return null;if(n=n.shared,(Ts&2)!==0){var c=n.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),n.pending=t,t=Ir(s),cx(s,null,a),t}return Vr(s,n,t,a),Ir(s)}function Li(s,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var n=t.lanes;n&=s.pendingLanes,a|=n,t.lanes=a,pe(s,a)}}function od(s,t){var a=s.updateQueue,n=s.alternate;if(n!==null&&(n=n.updateQueue,a===n)){var c=null,d=null;if(a=a.firstBaseUpdate,a!==null){do{var f={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};d===null?c=d=f:d=d.next=f,a=a.next}while(a!==null);d===null?c=d=t:d=d.next=t}else c=d=t;a={baseState:n.baseState,firstBaseUpdate:c,lastBaseUpdate:d,shared:n.shared,callbacks:n.callbacks},s.updateQueue=a;return}s=a.lastBaseUpdate,s===null?a.firstBaseUpdate=t:s.next=t,a.lastBaseUpdate=t}var dd=!1;function Ui(){if(dd){var s=Hn;if(s!==null)throw s}}function Bi(s,t,a,n){dd=!1;var c=s.updateQueue;kl=!1;var d=c.firstBaseUpdate,f=c.lastBaseUpdate,b=c.shared.pending;if(b!==null){c.shared.pending=null;var A=b,P=A.next;A.next=null,f===null?d=P:f.next=P,f=A;var ce=s.alternate;ce!==null&&(ce=ce.updateQueue,b=ce.lastBaseUpdate,b!==f&&(b===null?ce.firstBaseUpdate=P:b.next=P,ce.lastBaseUpdate=A))}if(d!==null){var ue=c.baseState;f=0,ce=P=A=null,b=d;do{var ee=b.lane&-536870913,le=ee!==b.lane;if(le?(js&ee)===ee:(n&ee)===ee){ee!==0&&ee===Bn&&(dd=!0),ce!==null&&(ce=ce.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var Ae=s,Ye=b;ee=t;var Ls=a;switch(Ye.tag){case 1:if(Ae=Ye.payload,typeof Ae=="function"){ue=Ae.call(Ls,ue,ee);break e}ue=Ae;break e;case 3:Ae.flags=Ae.flags&-65537|128;case 0:if(Ae=Ye.payload,ee=typeof Ae=="function"?Ae.call(Ls,ue,ee):Ae,ee==null)break e;ue=N({},ue,ee);break e;case 2:kl=!0}}ee=b.callback,ee!==null&&(s.flags|=64,le&&(s.flags|=8192),le=c.callbacks,le===null?c.callbacks=[ee]:le.push(ee))}else le={lane:ee,tag:b.tag,payload:b.payload,callback:b.callback,next:null},ce===null?(P=ce=le,A=ue):ce=ce.next=le,f|=ee;if(b=b.next,b===null){if(b=c.shared.pending,b===null)break;le=b,b=le.next,le.next=null,c.lastBaseUpdate=le,c.shared.pending=null}}while(!0);ce===null&&(A=ue),c.baseState=A,c.firstBaseUpdate=P,c.lastBaseUpdate=ce,d===null&&(c.shared.lanes=0),Dl|=f,s.lanes=f,s.memoizedState=ue}}function Cx(s,t){if(typeof s!="function")throw Error(o(191,s));s.call(t)}function kx(s,t){var a=s.callbacks;if(a!==null)for(s.callbacks=null,s=0;sd?d:8;var f=D.T,b={};D.T=b,Ed(s,!1,t,a);try{var A=c(),P=D.S;if(P!==null&&P(b,A),A!==null&&typeof A=="object"&&typeof A.then=="function"){var ce=Qv(A,n);qi(s,t,ce,ua(s))}else qi(s,t,n,ua(s))}catch(ue){qi(s,t,{then:function(){},status:"rejected",reason:ue},ua())}finally{Y.p=d,f!==null&&b.types!==null&&(f.types=b.types),D.T=f}}function Zv(){}function kd(s,t,a,n){if(s.tag!==5)throw Error(o(476));var c=nh(s).queue;lh(s,c,t,K,a===null?Zv:function(){return ih(s),a(n)})}function nh(s){var t=s.memoizedState;if(t!==null)return t;t={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ll,lastRenderedState:K},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ll,lastRenderedState:a},next:null},s.memoizedState=t,s=s.alternate,s!==null&&(s.memoizedState=t),t}function ih(s){var t=nh(s);t.next===null&&(t=s.alternate.memoizedState),qi(s,t.next.queue,{},ua())}function Td(){return Ut(lr)}function rh(){return ht().memoizedState}function ch(){return ht().memoizedState}function Wv(s){for(var t=s.return;t!==null;){switch(t.tag){case 24:case 3:var a=ua();s=Tl(a);var n=El(t,s,a);n!==null&&(Wt(n,t,a),Li(n,t,a)),t={cache:ad()},s.payload=t;return}t=t.return}}function eb(s,t,a){var n=ua();a={lane:n,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},dc(s)?dh(t,a):(a=Qo(s,t,a,n),a!==null&&(Wt(a,s,n),uh(a,t,n)))}function oh(s,t,a){var n=ua();qi(s,t,a,n)}function qi(s,t,a,n){var c={lane:n,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(dc(s))dh(t,c);else{var d=s.alternate;if(s.lanes===0&&(d===null||d.lanes===0)&&(d=t.lastRenderedReducer,d!==null))try{var f=t.lastRenderedState,b=d(f,a);if(c.hasEagerState=!0,c.eagerState=b,na(b,f))return Vr(s,t,c,0),qs===null&&Fr(),!1}catch{}finally{}if(a=Qo(s,t,c,n),a!==null)return Wt(a,s,n),uh(a,t,n),!0}return!1}function Ed(s,t,a,n){if(n={lane:2,revertLane:ru(),gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},dc(s)){if(t)throw Error(o(479))}else t=Qo(s,a,n,2),t!==null&&Wt(t,s,2)}function dc(s){var t=s.alternate;return s===We||t!==null&&t===We}function dh(s,t){Fn=ac=!0;var a=s.pending;a===null?t.next=t:(t.next=a.next,a.next=t),s.pending=t}function uh(s,t,a){if((a&4194048)!==0){var n=t.lanes;n&=s.pendingLanes,a|=n,t.lanes=a,pe(s,a)}}var Gi={readContext:Ut,use:ic,useCallback:rt,useContext:rt,useEffect:rt,useImperativeHandle:rt,useLayoutEffect:rt,useInsertionEffect:rt,useMemo:rt,useReducer:rt,useRef:rt,useState:rt,useDebugValue:rt,useDeferredValue:rt,useTransition:rt,useSyncExternalStore:rt,useId:rt,useHostTransitionStatus:rt,useFormState:rt,useActionState:rt,useOptimistic:rt,useMemoCache:rt,useCacheRefresh:rt};Gi.useEffectEvent=rt;var mh={readContext:Ut,use:ic,useCallback:function(s,t){return It().memoizedState=[s,t===void 0?null:t],s},useContext:Ut,useEffect:Xx,useImperativeHandle:function(s,t,a){a=a!=null?a.concat([s]):null,cc(4194308,4,Wx.bind(null,t,s),a)},useLayoutEffect:function(s,t){return cc(4194308,4,s,t)},useInsertionEffect:function(s,t){cc(4,2,s,t)},useMemo:function(s,t){var a=It();t=t===void 0?null:t;var n=s();if(dn){xs(!0);try{s()}finally{xs(!1)}}return a.memoizedState=[n,t],n},useReducer:function(s,t,a){var n=It();if(a!==void 0){var c=a(t);if(dn){xs(!0);try{a(t)}finally{xs(!1)}}}else c=t;return n.memoizedState=n.baseState=c,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:c},n.queue=s,s=s.dispatch=eb.bind(null,We,s),[n.memoizedState,s]},useRef:function(s){var t=It();return s={current:s},t.memoizedState=s},useState:function(s){s=yd(s);var t=s.queue,a=oh.bind(null,We,t);return t.dispatch=a,[s.memoizedState,a]},useDebugValue:Sd,useDeferredValue:function(s,t){var a=It();return Cd(a,s,t)},useTransition:function(){var s=yd(!1);return s=lh.bind(null,We,s.queue,!0,!1),It().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,t,a){var n=We,c=It();if(ws){if(a===void 0)throw Error(o(407));a=a()}else{if(a=t(),qs===null)throw Error(o(349));(js&127)!==0||Ox(n,t,a)}c.memoizedState=a;var d={value:a,getSnapshot:t};return c.queue=d,Xx(Rx.bind(null,n,d,s),[s]),n.flags|=2048,In(9,{destroy:void 0},Dx.bind(null,n,d,a,t),null),a},useId:function(){var s=It(),t=qs.identifierPrefix;if(ws){var a=$a,n=Ha;a=(n&~(1<<32-bs(n)-1)).toString(32)+a,t="_"+t+"R_"+a,a=lc++,0<\/script>",d=d.removeChild(d.firstChild);break;case"select":d=typeof n.is=="string"?f.createElement("select",{is:n.is}):f.createElement("select"),n.multiple?d.multiple=!0:n.size&&(d.size=n.size);break;default:d=typeof n.is=="string"?f.createElement(c,{is:n.is}):f.createElement(c)}}d[ys]=t,d[kt]=n;e:for(f=t.child;f!==null;){if(f.tag===5||f.tag===6)d.appendChild(f.stateNode);else if(f.tag!==4&&f.tag!==27&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===t)break e;for(;f.sibling===null;){if(f.return===null||f.return===t)break e;f=f.return}f.sibling.return=f.return,f=f.sibling}t.stateNode=d;e:switch(Ht(d,c,n),c){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}n&&il(t)}}return Js(t),Fd(t,t.type,s===null?null:s.memoizedProps,t.pendingProps,a),null;case 6:if(s&&t.stateNode!=null)s.memoizedProps!==n&&il(t);else{if(typeof n!="string"&&t.stateNode===null)throw Error(o(166));if(s=Z.current,Ln(t)){if(s=t.stateNode,a=t.memoizedProps,n=null,c=Lt,c!==null)switch(c.tag){case 27:case 5:n=c.memoizedProps}s[ys]=t,s=!!(s.nodeValue===a||n!==null&&n.suppressHydrationWarning===!0||Af(s.nodeValue,a)),s||Sl(t,!0)}else s=zc(s).createTextNode(n),s[ys]=t,t.stateNode=s}return Js(t),null;case 31:if(a=t.memoizedState,s===null||s.memoizedState!==null){if(n=Ln(t),a!==null){if(s===null){if(!n)throw Error(o(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(o(557));s[ys]=t}else tn(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Js(t),s=!1}else a=Wo(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=a),s=!0;if(!s)return t.flags&256?(ca(t),t):(ca(t),null);if((t.flags&128)!==0)throw Error(o(558))}return Js(t),null;case 13:if(n=t.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(c=Ln(t),n!==null&&n.dehydrated!==null){if(s===null){if(!c)throw Error(o(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(o(317));c[ys]=t}else tn(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Js(t),c=!1}else c=Wo(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(ca(t),t):(ca(t),null)}return ca(t),(t.flags&128)!==0?(t.lanes=a,t):(a=n!==null,s=s!==null&&s.memoizedState!==null,a&&(n=t.child,c=null,n.alternate!==null&&n.alternate.memoizedState!==null&&n.alternate.memoizedState.cachePool!==null&&(c=n.alternate.memoizedState.cachePool.pool),d=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(d=n.memoizedState.cachePool.pool),d!==c&&(n.flags|=2048)),a!==s&&a&&(t.child.flags|=8192),fc(t,t.updateQueue),Js(t),null);case 4:return X(),s===null&&uu(t.stateNode.containerInfo),Js(t),null;case 10:return tl(t.type),Js(t),null;case 19:if(xe(xt),n=t.memoizedState,n===null)return Js(t),null;if(c=(t.flags&128)!==0,d=n.rendering,d===null)if(c)Vi(n,!1);else{if(ct!==0||s!==null&&(s.flags&128)!==0)for(s=t.child;s!==null;){if(d=tc(s),d!==null){for(t.flags|=128,Vi(n,!1),s=d.updateQueue,t.updateQueue=s,fc(t,s),t.subtreeFlags=0,s=a,a=t.child;a!==null;)ox(a,s),a=a.sibling;return Ce(xt,xt.current&1|2),ws&&el(t,n.treeForkCount),t.child}s=s.sibling}n.tail!==null&<()>bc&&(t.flags|=128,c=!0,Vi(n,!1),t.lanes=4194304)}else{if(!c)if(s=tc(d),s!==null){if(t.flags|=128,c=!0,s=s.updateQueue,t.updateQueue=s,fc(t,s),Vi(n,!0),n.tail===null&&n.tailMode==="hidden"&&!d.alternate&&!ws)return Js(t),null}else 2*lt()-n.renderingStartTime>bc&&a!==536870912&&(t.flags|=128,c=!0,Vi(n,!1),t.lanes=4194304);n.isBackwards?(d.sibling=t.child,t.child=d):(s=n.last,s!==null?s.sibling=d:t.child=d,n.last=d)}return n.tail!==null?(s=n.tail,n.rendering=s,n.tail=s.sibling,n.renderingStartTime=lt(),s.sibling=null,a=xt.current,Ce(xt,c?a&1|2:a&1),ws&&el(t,n.treeForkCount),s):(Js(t),null);case 22:case 23:return ca(t),md(),n=t.memoizedState!==null,s!==null?s.memoizedState!==null!==n&&(t.flags|=8192):n&&(t.flags|=8192),n?(a&536870912)!==0&&(t.flags&128)===0&&(Js(t),t.subtreeFlags&6&&(t.flags|=8192)):Js(t),a=t.updateQueue,a!==null&&fc(t,a.retryQueue),a=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(a=s.memoizedState.cachePool.pool),n=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),n!==a&&(t.flags|=2048),s!==null&&xe(nn),null;case 24:return a=null,s!==null&&(a=s.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),tl(Nt),Js(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function nb(s,t){switch(Po(t),t.tag){case 1:return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 3:return tl(Nt),X(),s=t.flags,(s&65536)!==0&&(s&128)===0?(t.flags=s&-65537|128,t):null;case 26:case 27:case 5:return De(t),null;case 31:if(t.memoizedState!==null){if(ca(t),t.alternate===null)throw Error(o(340));tn()}return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 13:if(ca(t),s=t.memoizedState,s!==null&&s.dehydrated!==null){if(t.alternate===null)throw Error(o(340));tn()}return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 19:return xe(xt),null;case 4:return X(),null;case 10:return tl(t.type),null;case 22:case 23:return ca(t),md(),s!==null&&xe(nn),s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 24:return tl(Nt),null;case 25:return null;default:return null}}function Lh(s,t){switch(Po(t),t.tag){case 3:tl(Nt),X();break;case 26:case 27:case 5:De(t);break;case 4:X();break;case 31:t.memoizedState!==null&&ca(t);break;case 13:ca(t);break;case 19:xe(xt);break;case 10:tl(t.type);break;case 22:case 23:ca(t),md(),s!==null&&xe(nn);break;case 24:tl(Nt)}}function Ii(s,t){try{var a=t.updateQueue,n=a!==null?a.lastEffect:null;if(n!==null){var c=n.next;a=c;do{if((a.tag&s)===s){n=void 0;var d=a.create,f=a.inst;n=d(),f.destroy=n}a=a.next}while(a!==c)}}catch(b){Os(t,t.return,b)}}function Al(s,t,a){try{var n=t.updateQueue,c=n!==null?n.lastEffect:null;if(c!==null){var d=c.next;n=d;do{if((n.tag&s)===s){var f=n.inst,b=f.destroy;if(b!==void 0){f.destroy=void 0,c=t;var A=a,P=b;try{P()}catch(ce){Os(c,A,ce)}}}n=n.next}while(n!==d)}}catch(ce){Os(t,t.return,ce)}}function Uh(s){var t=s.updateQueue;if(t!==null){var a=s.stateNode;try{kx(t,a)}catch(n){Os(s,s.return,n)}}}function Bh(s,t,a){a.props=un(s.type,s.memoizedProps),a.state=s.memoizedState;try{a.componentWillUnmount()}catch(n){Os(s,t,n)}}function Qi(s,t){try{var a=s.ref;if(a!==null){switch(s.tag){case 26:case 27:case 5:var n=s.stateNode;break;case 30:n=s.stateNode;break;default:n=s.stateNode}typeof a=="function"?s.refCleanup=a(n):a.current=n}}catch(c){Os(s,t,c)}}function qa(s,t){var a=s.ref,n=s.refCleanup;if(a!==null)if(typeof n=="function")try{n()}catch(c){Os(s,t,c)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(c){Os(s,t,c)}else a.current=null}function Hh(s){var t=s.type,a=s.memoizedProps,n=s.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&n.focus();break e;case"img":a.src?n.src=a.src:a.srcSet&&(n.srcset=a.srcSet)}}catch(c){Os(s,s.return,c)}}function Vd(s,t,a){try{var n=s.stateNode;kb(n,s.type,a,t),n[kt]=t}catch(c){Os(s,s.return,c)}}function $h(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Hl(s.type)||s.tag===4}function Id(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||$h(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&&Hl(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 Qd(s,t,a){var n=s.tag;if(n===5||n===6)s=s.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(s,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(s),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=Pa));else if(n!==4&&(n===27&&Hl(s.type)&&(a=s.stateNode,t=null),s=s.child,s!==null))for(Qd(s,t,a),s=s.sibling;s!==null;)Qd(s,t,a),s=s.sibling}function pc(s,t,a){var n=s.tag;if(n===5||n===6)s=s.stateNode,t?a.insertBefore(s,t):a.appendChild(s);else if(n!==4&&(n===27&&Hl(s.type)&&(a=s.stateNode),s=s.child,s!==null))for(pc(s,t,a),s=s.sibling;s!==null;)pc(s,t,a),s=s.sibling}function qh(s){var t=s.stateNode,a=s.memoizedProps;try{for(var n=s.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);Ht(t,n,a),t[ys]=s,t[kt]=a}catch(d){Os(s,s.return,d)}}var rl=!1,_t=!1,Yd=!1,Gh=typeof WeakSet=="function"?WeakSet:Set,Rt=null;function ib(s,t){if(s=s.containerInfo,hu=Uc,s=ex(s),$o(s)){if("selectionStart"in s)var a={start:s.selectionStart,end:s.selectionEnd};else e:{a=(a=s.ownerDocument)&&a.defaultView||window;var n=a.getSelection&&a.getSelection();if(n&&n.rangeCount!==0){a=n.anchorNode;var c=n.anchorOffset,d=n.focusNode;n=n.focusOffset;try{a.nodeType,d.nodeType}catch{a=null;break e}var f=0,b=-1,A=-1,P=0,ce=0,ue=s,ee=null;s:for(;;){for(var le;ue!==a||c!==0&&ue.nodeType!==3||(b=f+c),ue!==d||n!==0&&ue.nodeType!==3||(A=f+n),ue.nodeType===3&&(f+=ue.nodeValue.length),(le=ue.firstChild)!==null;)ee=ue,ue=le;for(;;){if(ue===s)break s;if(ee===a&&++P===c&&(b=f),ee===d&&++ce===n&&(A=f),(le=ue.nextSibling)!==null)break;ue=ee,ee=ue.parentNode}ue=le}a=b===-1||A===-1?null:{start:b,end:A}}else a=null}a=a||{start:0,end:0}}else a=null;for(fu={focusedElem:s,selectionRange:a},Uc=!1,Rt=t;Rt!==null;)if(t=Rt,s=t.child,(t.subtreeFlags&1028)!==0&&s!==null)s.return=t,Rt=s;else for(;Rt!==null;){switch(t=Rt,d=t.alternate,s=t.flags,t.tag){case 0:if((s&4)!==0&&(s=t.updateQueue,s=s!==null?s.events:null,s!==null))for(a=0;a title"))),Ht(d,n,a),d[ys]=s,Dt(d),n=d;break e;case"link":var f=Xf("link","href",c).get(n+(a.href||""));if(f){for(var b=0;bLs&&(f=Ls,Ls=Ye,Ye=f);var $=Zm(b,Ye),B=Zm(b,Ls);if($&&B&&(le.rangeCount!==1||le.anchorNode!==$.node||le.anchorOffset!==$.offset||le.focusNode!==B.node||le.focusOffset!==B.offset)){var J=ue.createRange();J.setStart($.node,$.offset),le.removeAllRanges(),Ye>Ls?(le.addRange(J),le.extend(B.node,B.offset)):(J.setEnd(B.node,B.offset),le.addRange(J))}}}}for(ue=[],le=b;le=le.parentNode;)le.nodeType===1&&ue.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;ba?32:a,D.T=null,a=eu,eu=null;var d=Ll,f=ml;if(Tt=0,Jn=Ll=null,ml=0,(Ts&6)!==0)throw Error(o(331));var b=Ts;if(Ts|=4,Wh(d.current),Jh(d,d.current,f,a),Ts=b,Zi(0,!1),Ee&&typeof Ee.onPostCommitFiberRoot=="function")try{Ee.onPostCommitFiberRoot(Ss,d)}catch{}return!0}finally{Y.p=c,D.T=n,jf(s,t)}}function bf(s,t,a){t=ja(a,t),t=Od(s.stateNode,t,2),s=El(s,t,2),s!==null&&(At(s,2),Ga(s))}function Os(s,t,a){if(s.tag===3)bf(s,s,a);else for(;t!==null;){if(t.tag===3){bf(t,s,a);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(Rl===null||!Rl.has(n))){s=ja(a,s),a=bh(2),n=El(t,a,2),n!==null&&(Nh(a,n,t,s),At(n,2),Ga(n));break}}t=t.return}}function lu(s,t,a){var n=s.pingCache;if(n===null){n=s.pingCache=new ob;var c=new Set;n.set(t,c)}else c=n.get(t),c===void 0&&(c=new Set,n.set(t,c));c.has(a)||(Jd=!0,c.add(a),s=hb.bind(null,s,t,a),t.then(s,s))}function hb(s,t,a){var n=s.pingCache;n!==null&&n.delete(t),s.pingedLanes|=s.suspendedLanes&a,s.warmLanes&=~a,qs===s&&(js&a)===a&&(ct===4||ct===3&&(js&62914560)===js&&300>lt()-vc?(Ts&2)===0&&Pn(s,0):Pd|=a,Xn===js&&(Xn=0)),Ga(s)}function Nf(s,t){t===0&&(t=de()),s=en(s,t),s!==null&&(At(s,t),Ga(s))}function fb(s){var t=s.memoizedState,a=0;t!==null&&(a=t.retryLane),Nf(s,a)}function pb(s,t){var a=0;switch(s.tag){case 31:case 13:var n=s.stateNode,c=s.memoizedState;c!==null&&(a=c.retryLane);break;case 19:n=s.stateNode;break;case 22:n=s.stateNode._retryCache;break;default:throw Error(o(314))}n!==null&&n.delete(t),Nf(s,a)}function gb(s,t){return jt(s,t)}var Cc=null,Wn=null,nu=!1,kc=!1,iu=!1,Bl=0;function Ga(s){s!==Wn&&s.next===null&&(Wn===null?Cc=Wn=s:Wn=Wn.next=s),kc=!0,nu||(nu=!0,vb())}function Zi(s,t){if(!iu&&kc){iu=!0;do for(var a=!1,n=Cc;n!==null;){if(s!==0){var c=n.pendingLanes;if(c===0)var d=0;else{var f=n.suspendedLanes,b=n.pingedLanes;d=(1<<31-bs(42|s)+1)-1,d&=c&~(f&~b),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(a=!0,Sf(n,d))}else d=js,d=bt(n,n===qs?d:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),(d&3)===0||Vt(n,d)||(a=!0,Sf(n,d));n=n.next}while(a);iu=!1}}function jb(){yf()}function yf(){kc=nu=!1;var s=0;Bl!==0&&Eb()&&(s=Bl);for(var t=lt(),a=null,n=Cc;n!==null;){var c=n.next,d=wf(n,t);d===0?(n.next=null,a===null?Cc=c:a.next=c,c===null&&(Wn=a)):(a=n,(s!==0||(d&3)!==0)&&(kc=!0)),n=c}Tt!==0&&Tt!==5||Zi(s),Bl!==0&&(Bl=0)}function wf(s,t){for(var a=s.suspendedLanes,n=s.pingedLanes,c=s.expirationTimes,d=s.pendingLanes&-62914561;0b)break;var ce=A.transferSize,ue=A.initiatorType;ce&&Of(ue)&&(A=A.responseEnd,f+=ce*(A"u"?null:document;function If(s,t,a){var n=ei;if(n&&typeof t=="string"&&t){var c=pa(t);c='link[rel="'+s+'"][href="'+c+'"]',typeof a=="string"&&(c+='[crossorigin="'+a+'"]'),Vf.has(c)||(Vf.add(c),s={rel:s,crossOrigin:a,href:t},n.querySelector(c)===null&&(t=n.createElement("link"),Ht(t,"link",s),Dt(t),n.head.appendChild(t)))}}function Bb(s){xl.D(s),If("dns-prefetch",s,null)}function Hb(s,t){xl.C(s,t),If("preconnect",s,t)}function $b(s,t,a){xl.L(s,t,a);var n=ei;if(n&&s&&t){var c='link[rel="preload"][as="'+pa(t)+'"]';t==="image"&&a&&a.imageSrcSet?(c+='[imagesrcset="'+pa(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(c+='[imagesizes="'+pa(a.imageSizes)+'"]')):c+='[href="'+pa(s)+'"]';var d=c;switch(t){case"style":d=si(s);break;case"script":d=ti(s)}_a.has(d)||(s=N({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:s,as:t},a),_a.set(d,s),n.querySelector(c)!==null||t==="style"&&n.querySelector(tr(d))||t==="script"&&n.querySelector(ar(d))||(t=n.createElement("link"),Ht(t,"link",s),Dt(t),n.head.appendChild(t)))}}function qb(s,t){xl.m(s,t);var a=ei;if(a&&s){var n=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+pa(n)+'"][href="'+pa(s)+'"]',d=c;switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":d=ti(s)}if(!_a.has(d)&&(s=N({rel:"modulepreload",href:s},t),_a.set(d,s),a.querySelector(c)===null)){switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(ar(d)))return}n=a.createElement("link"),Ht(n,"link",s),Dt(n),a.head.appendChild(n)}}}function Gb(s,t,a){xl.S(s,t,a);var n=ei;if(n&&s){var c=wn(n).hoistableStyles,d=si(s);t=t||"default";var f=c.get(d);if(!f){var b={loading:0,preload:null};if(f=n.querySelector(tr(d)))b.loading=5;else{s=N({rel:"stylesheet",href:s,"data-precedence":t},a),(a=_a.get(d))&&yu(s,a);var A=f=n.createElement("link");Dt(A),Ht(A,"link",s),A._p=new Promise(function(P,ce){A.onload=P,A.onerror=ce}),A.addEventListener("load",function(){b.loading|=1}),A.addEventListener("error",function(){b.loading|=2}),b.loading|=4,Ac(f,t,n)}f={type:"stylesheet",instance:f,count:1,state:b},c.set(d,f)}}}function Fb(s,t){xl.X(s,t);var a=ei;if(a&&s){var n=wn(a).hoistableScripts,c=ti(s),d=n.get(c);d||(d=a.querySelector(ar(c)),d||(s=N({src:s,async:!0},t),(t=_a.get(c))&&wu(s,t),d=a.createElement("script"),Dt(d),Ht(d,"link",s),a.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},n.set(c,d))}}function Vb(s,t){xl.M(s,t);var a=ei;if(a&&s){var n=wn(a).hoistableScripts,c=ti(s),d=n.get(c);d||(d=a.querySelector(ar(c)),d||(s=N({src:s,async:!0,type:"module"},t),(t=_a.get(c))&&wu(s,t),d=a.createElement("script"),Dt(d),Ht(d,"link",s),a.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},n.set(c,d))}}function Qf(s,t,a,n){var c=(c=Z.current)?Mc(c):null;if(!c)throw Error(o(446));switch(s){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=si(a.href),a=wn(c).hoistableStyles,n=a.get(t),n||(n={type:"style",instance:null,count:0,state:null},a.set(t,n)),n):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){s=si(a.href);var d=wn(c).hoistableStyles,f=d.get(s);if(f||(c=c.ownerDocument||c,f={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},d.set(s,f),(d=c.querySelector(tr(s)))&&!d._p&&(f.instance=d,f.state.loading=5),_a.has(s)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},_a.set(s,a),d||Ib(c,s,a,f.state))),t&&n===null)throw Error(o(528,""));return f}if(t&&n!==null)throw Error(o(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=ti(a),a=wn(c).hoistableScripts,n=a.get(t),n||(n={type:"script",instance:null,count:0,state:null},a.set(t,n)),n):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,s))}}function si(s){return'href="'+pa(s)+'"'}function tr(s){return'link[rel="stylesheet"]['+s+"]"}function Yf(s){return N({},s,{"data-precedence":s.precedence,precedence:null})}function Ib(s,t,a,n){s.querySelector('link[rel="preload"][as="style"]['+t+"]")?n.loading=1:(t=s.createElement("link"),n.preload=t,t.addEventListener("load",function(){return n.loading|=1}),t.addEventListener("error",function(){return n.loading|=2}),Ht(t,"link",a),Dt(t),s.head.appendChild(t))}function ti(s){return'[src="'+pa(s)+'"]'}function ar(s){return"script[async]"+s}function Kf(s,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var n=s.querySelector('style[data-href~="'+pa(a.href)+'"]');if(n)return t.instance=n,Dt(n),n;var c=N({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return n=(s.ownerDocument||s).createElement("style"),Dt(n),Ht(n,"style",c),Ac(n,a.precedence,s),t.instance=n;case"stylesheet":c=si(a.href);var d=s.querySelector(tr(c));if(d)return t.state.loading|=4,t.instance=d,Dt(d),d;n=Yf(a),(c=_a.get(c))&&yu(n,c),d=(s.ownerDocument||s).createElement("link"),Dt(d);var f=d;return f._p=new Promise(function(b,A){f.onload=b,f.onerror=A}),Ht(d,"link",n),t.state.loading|=4,Ac(d,a.precedence,s),t.instance=d;case"script":return d=ti(a.src),(c=s.querySelector(ar(d)))?(t.instance=c,Dt(c),c):(n=a,(c=_a.get(d))&&(n=N({},a),wu(n,c)),s=s.ownerDocument||s,c=s.createElement("script"),Dt(c),Ht(c,"link",n),s.head.appendChild(c),t.instance=c);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(n=t.instance,t.state.loading|=4,Ac(n,a.precedence,s));return t.instance}function Ac(s,t,a){for(var n=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=n.length?n[n.length-1]:null,d=c,f=0;f title"):null)}function Qb(s,t,a){if(a===1||t.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return s=t.disabled,typeof t.precedence=="string"&&s==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Pf(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function Yb(s,t,a,n){if(a.type==="stylesheet"&&(typeof n.media!="string"||matchMedia(n.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var c=si(n.href),d=t.querySelector(tr(c));if(d){t=d._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(s.count++,s=Dc.bind(s),t.then(s,s)),a.state.loading|=4,a.instance=d,Dt(d);return}d=t.ownerDocument||t,n=Yf(n),(c=_a.get(c))&&yu(n,c),d=d.createElement("link"),Dt(d);var f=d;f._p=new Promise(function(b,A){f.onload=b,f.onerror=A}),Ht(d,"link",n),a.instance=d}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(s.count++,a=Dc.bind(s),t.addEventListener("load",a),t.addEventListener("error",a))}}var _u=0;function Kb(s,t){return s.stylesheets&&s.count===0&&Lc(s,s.stylesheets),0_u?50:800)+t);return s.unsuspend=a,function(){s.unsuspend=null,clearTimeout(n),clearTimeout(c)}}:null}function Dc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Lc(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var Rc=null;function Lc(s,t){s.stylesheets=null,s.unsuspend!==null&&(s.count++,Rc=new Map,t.forEach(Xb,s),Rc=null,Dc.call(s))}function Xb(s,t){if(!(t.state.loading&4)){var a=Rc.get(s);if(a)var n=a.get(null);else{a=new Map,Rc.set(s,a);for(var c=s.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;d"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l)}catch(i){console.error(i)}}return l(),Ru.exports=E0(),Ru.exports}var M0=z0();function H(...l){return hN(fN(l))}const Ve=m.forwardRef(({className:l,...i},r)=>e.jsx("div",{ref:r,className:H("rounded-xl border bg-card text-card-foreground shadow",l),...i}));Ve.displayName="Card";const as=m.forwardRef(({className:l,...i},r)=>e.jsx("div",{ref:r,className:H("flex flex-col space-y-1.5 p-6",l),...i}));as.displayName="CardHeader";const ls=m.forwardRef(({className:l,...i},r)=>e.jsx("div",{ref:r,className:H("font-semibold leading-none tracking-tight",l),...i}));ls.displayName="CardTitle";const st=m.forwardRef(({className:l,...i},r)=>e.jsx("div",{ref:r,className:H("text-sm text-muted-foreground",l),...i}));st.displayName="CardDescription";const ps=m.forwardRef(({className:l,...i},r)=>e.jsx("div",{ref:r,className:H("p-6 pt-0",l),...i}));ps.displayName="CardContent";const Fg=m.forwardRef(({className:l,...i},r)=>e.jsx("div",{ref:r,className:H("flex items-center p-6 pt-0",l),...i}));Fg.displayName="CardFooter";const ka=pN,xa=m.forwardRef(({className:l,...i},r)=>e.jsx(Fp,{ref:r,className:H("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",l),...i}));xa.displayName=Fp.displayName;const ts=m.forwardRef(({className:l,...i},r)=>e.jsx(Vp,{ref:r,className:H("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all duration-300 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",l),...i}));ts.displayName=Vp.displayName;const Ms=m.forwardRef(({className:l,...i},r)=>e.jsx(Ip,{ref:r,className:H("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=active]:animate-in data-[state=active]:fade-in data-[state=active]:duration-300",l),...i}));Ms.displayName=Ip.displayName;const Ze=m.forwardRef(({className:l,children:i,viewportRef:r,...o},u)=>e.jsxs(Qp,{ref:u,className:H("relative overflow-hidden",l),...o,children:[e.jsx(gN,{ref:r,className:"h-full w-full rounded-[inherit]",children:i}),e.jsx(Zu,{}),e.jsx(Zu,{orientation:"horizontal"}),e.jsx(jN,{})]}));Ze.displayName=Qp.displayName;const Zu=m.forwardRef(({className:l,orientation:i="vertical",...r},o)=>e.jsx(Yp,{ref:o,orientation:i,className:H("flex touch-none select-none transition-colors",i==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",i==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",l),...r,children:e.jsx(vN,{className:"relative flex-1 rounded-full bg-border"})}));Zu.displayName=Yp.displayName;function Vg({className:l,...i}){return e.jsx("div",{className:H("animate-pulse rounded-md bg-primary/10",l),...i})}const gi=m.forwardRef(({className:l,value:i,...r},o)=>e.jsx(Kp,{ref:o,className:H("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",l),...r,children:e.jsx(bN,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(i||0)}%)`}})}));gi.displayName=Kp.displayName;const A0={light:"",dark:".dark"},Ig=m.createContext(null);function Qg(){const l=m.useContext(Ig);if(!l)throw new Error("useChart must be used within a ");return l}const ni=m.forwardRef(({id:l,className:i,children:r,config:o,...u},x)=>{const h=m.useId(),p=`chart-${l||h.replace(/:/g,"")}`;return e.jsx(Ig.Provider,{value:{config:o},children:e.jsxs("div",{"data-chart":p,ref:x,className:H("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",i),...u,children:[e.jsx(O0,{id:p,config:o}),e.jsx(LN,{children:r})]})})});ni.displayName="Chart";const O0=({id:l,config:i})=>{const r=Object.entries(i).filter(([,o])=>o.theme||o.color);return r.length?e.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(A0).map(([o,u])=>` +`+n.stack}}var Ge=Object.prototype.hasOwnProperty,jt=l.unstable_scheduleCallback,Qs=l.unstable_cancelCallback,zt=l.unstable_shouldYield,Es=l.unstable_requestPaint,lt=l.unstable_now,I=l.unstable_getCurrentPriorityLevel,$e=l.unstable_ImmediatePriority,Oe=l.unstable_UserBlockingPriority,Ke=l.unstable_NormalPriority,$s=l.unstable_LowPriority,Je=l.unstable_IdlePriority,Ps=l.log,we=l.unstable_setDisableYieldValue,Ss=null,Ee=null;function xs(s){if(typeof Ps=="function"&&we(s),Ee&&typeof Ee.setStrictMode=="function")try{Ee.setStrictMode(Ss,s)}catch{}}var bs=Math.clz32?Math.clz32:vt,Mt=Math.log,Ys=Math.LN2;function vt(s){return s>>>=0,s===0?32:31-(Mt(s)/Ys|0)|0}var Ks=256,nt=262144,bl=4194304;function ha(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 bt(s,t,a){var n=s.pendingLanes;if(n===0)return 0;var c=0,d=s.suspendedLanes,p=s.pingedLanes;s=s.warmLanes;var b=n&134217727;return b!==0?(n=b&~d,n!==0?c=ha(n):(p&=b,p!==0?c=ha(p):a||(a=b&~s,a!==0&&(c=ha(a))))):(b=n&~d,b!==0?c=ha(b):p!==0?c=ha(p):a||(a=n&~s,a!==0&&(c=ha(a)))),c===0?0:t!==0&&t!==c&&(t&d)===0&&(d=c&-c,a=t&-t,d>=a||d===32&&(a&4194048)!==0)?t:c}function Vt(s,t){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&t)===0}function te(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 de(){var s=bl;return bl<<=1,(bl&62914560)===0&&(bl=4194304),s}function Ns(s){for(var t=[],a=0;31>a;a++)t.push(s);return t}function At(s,t){s.pendingLanes|=t,t!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function Ot(s,t,a,n,c,d){var p=s.pendingLanes;s.pendingLanes=a,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=a,s.entangledLanes&=a,s.errorRecoveryDisabledLanes&=a,s.shellSuspendCounter=0;var b=s.entanglements,D=s.expirationTimes,P=s.hiddenUpdates;for(a=p&~a;0"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var ov=/[\n"\\]/g;function pa(s){return s.replace(ov,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Co(s,t,a,n,c,d,p,b){s.name="",p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"?s.type=p:s.removeAttribute("type"),t!=null?p==="number"?(t===0&&s.value===""||s.value!=t)&&(s.value=""+fa(t)):s.value!==""+fa(t)&&(s.value=""+fa(t)):p!=="submit"&&p!=="reset"||s.removeAttribute("value"),t!=null?ko(s,p,fa(t)):a!=null?ko(s,p,fa(a)):n!=null&&s.removeAttribute("value"),c==null&&d!=null&&(s.defaultChecked=!!d),c!=null&&(s.checked=c&&typeof c!="function"&&typeof c!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?s.name=""+fa(b):s.removeAttribute("name")}function Tm(s,t,a,n,c,d,p,b){if(d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(s.type=d),t!=null||a!=null){if(!(d!=="submit"&&d!=="reset"||t!=null)){So(s);return}a=a!=null?""+fa(a):"",t=t!=null?""+fa(t):a,b||t===s.value||(s.value=t),s.defaultValue=t}n=n??c,n=typeof n!="function"&&typeof n!="symbol"&&!!n,s.checked=b?s.checked:!!n,s.defaultChecked=!!n,p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(s.name=p),So(s)}function ko(s,t,a){t==="number"&&Dr(s.ownerDocument)===s||s.defaultValue===""+a||(s.defaultValue=""+a)}function Sn(s,t,a,n){if(s=s.options,t){t={};for(var c=0;c"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ao=!1;if(Za)try{var yi={};Object.defineProperty(yi,"passive",{get:function(){Ao=!0}}),window.addEventListener("test",yi,yi),window.removeEventListener("test",yi,yi)}catch{Ao=!1}var yl=null,Oo=null,Lr=null;function Rm(){if(Lr)return Lr;var s,t=Oo,a=t.length,n,c="value"in yl?yl.value:yl.textContent,d=c.length;for(s=0;s=Si),qm=" ",Gm=!1;function Fm(s,t){switch(s){case"keyup":return Uv.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Vm(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var En=!1;function Hv(s,t){switch(s){case"compositionend":return Vm(t);case"keypress":return t.which!==32?null:(Gm=!0,qm);case"textInput":return s=t.data,s===qm&&Gm?null:s;default:return null}}function $v(s,t){if(En)return s==="compositionend"||!Bo&&Fm(s,t)?(s=Rm(),Lr=Oo=yl=null,En=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:a,offset:t-s};s=n}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Zm(a)}}function ex(s,t){return s&&t?s===t?!0:s&&s.nodeType===3?!1:t&&t.nodeType===3?ex(s,t.parentNode):"contains"in s?s.contains(t):s.compareDocumentPosition?!!(s.compareDocumentPosition(t)&16):!1:!1}function sx(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var t=Dr(s.document);t instanceof s.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)s=t.contentWindow;else break;t=Dr(s.document)}return t}function qo(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 Kv=Za&&"documentMode"in document&&11>=document.documentMode,zn=null,Go=null,Ei=null,Fo=!1;function tx(s,t,a){var n=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Fo||zn==null||zn!==Dr(n)||(n=zn,"selectionStart"in n&&qo(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),Ei&&Ti(Ei,n)||(Ei=n,n=Ec(Go,"onSelect"),0>=p,c-=p,Ha=1<<32-bs(t)+c|a<ss?(vs=Re,Re=null):vs=Re.sibling;var ks=ee(q,Re,J[ss],oe);if(ks===null){Re===null&&(Re=vs);break}s&&Re&&ks.alternate===null&&t(q,Re),B=d(ks,B,ss),Cs===null?qe=ks:Cs.sibling=ks,Cs=ks,Re=vs}if(ss===J.length)return a(q,Re),ws&&el(q,ss),qe;if(Re===null){for(;ssss?(vs=Re,Re=null):vs=Re.sibling;var Vl=ee(q,Re,ks.value,oe);if(Vl===null){Re===null&&(Re=vs);break}s&&Re&&Vl.alternate===null&&t(q,Re),B=d(Vl,B,ss),Cs===null?qe=Vl:Cs.sibling=Vl,Cs=Vl,Re=vs}if(ks.done)return a(q,Re),ws&&el(q,ss),qe;if(Re===null){for(;!ks.done;ss++,ks=J.next())ks=ue(q,ks.value,oe),ks!==null&&(B=d(ks,B,ss),Cs===null?qe=ks:Cs.sibling=ks,Cs=ks);return ws&&el(q,ss),qe}for(Re=n(Re);!ks.done;ss++,ks=J.next())ks=le(Re,q,ss,ks.value,oe),ks!==null&&(s&&ks.alternate!==null&&Re.delete(ks.key===null?ss:ks.key),B=d(ks,B,ss),Cs===null?qe=ks:Cs.sibling=ks,Cs=ks);return s&&Re.forEach(function(hN){return t(q,hN)}),ws&&el(q,ss),qe}function Ls(q,B,J,oe){if(typeof J=="object"&&J!==null&&J.type===L&&J.key===null&&(J=J.props.children),typeof J=="object"&&J!==null){switch(J.$$typeof){case S:e:{for(var qe=J.key;B!==null;){if(B.key===qe){if(qe=J.type,qe===L){if(B.tag===7){a(q,B.sibling),oe=c(B,J.props.children),oe.return=q,q=oe;break e}}else if(B.elementType===qe||typeof qe=="object"&&qe!==null&&qe.$$typeof===M&&rn(qe)===B.type){a(q,B.sibling),oe=c(B,J.props),Ri(oe,J),oe.return=q,q=oe;break e}a(q,B);break}else t(q,B);B=B.sibling}J.type===L?(oe=sn(J.props.children,q.mode,oe,J.key),oe.return=q,q=oe):(oe=Qr(J.type,J.key,J.props,null,q.mode,oe),Ri(oe,J),oe.return=q,q=oe)}return p(q);case w:e:{for(qe=J.key;B!==null;){if(B.key===qe)if(B.tag===4&&B.stateNode.containerInfo===J.containerInfo&&B.stateNode.implementation===J.implementation){a(q,B.sibling),oe=c(B,J.children||[]),oe.return=q,q=oe;break e}else{a(q,B);break}else t(q,B);B=B.sibling}oe=Jo(J,q.mode,oe),oe.return=q,q=oe}return p(q);case M:return J=rn(J),Ls(q,B,J,oe)}if(Ne(J))return Ae(q,B,J,oe);if(ge(J)){if(qe=ge(J),typeof qe!="function")throw Error(o(150));return J=qe.call(J),Ye(q,B,J,oe)}if(typeof J.then=="function")return Ls(q,B,Wr(J),oe);if(J.$$typeof===A)return Ls(q,B,Xr(q,J),oe);ec(q,J)}return typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint"?(J=""+J,B!==null&&B.tag===6?(a(q,B.sibling),oe=c(B,J),oe.return=q,q=oe):(a(q,B),oe=Xo(J,q.mode,oe),oe.return=q,q=oe),p(q)):a(q,B)}return function(q,B,J,oe){try{Di=0;var qe=Ls(q,B,J,oe);return qn=null,qe}catch(Re){if(Re===$n||Re===Pr)throw Re;var Cs=ia(29,Re,null,q.mode);return Cs.lanes=oe,Cs.return=q,Cs}finally{}}}var on=Sx(!0),Cx=Sx(!1),kl=!1;function cd(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function od(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 Tl(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function El(s,t,a){var n=s.updateQueue;if(n===null)return null;if(n=n.shared,(Ts&2)!==0){var c=n.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),n.pending=t,t=Ir(s),ox(s,null,a),t}return Vr(s,n,t,a),Ir(s)}function Li(s,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var n=t.lanes;n&=s.pendingLanes,a|=n,t.lanes=a,pe(s,a)}}function dd(s,t){var a=s.updateQueue,n=s.alternate;if(n!==null&&(n=n.updateQueue,a===n)){var c=null,d=null;if(a=a.firstBaseUpdate,a!==null){do{var p={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};d===null?c=d=p:d=d.next=p,a=a.next}while(a!==null);d===null?c=d=t:d=d.next=t}else c=d=t;a={baseState:n.baseState,firstBaseUpdate:c,lastBaseUpdate:d,shared:n.shared,callbacks:n.callbacks},s.updateQueue=a;return}s=a.lastBaseUpdate,s===null?a.firstBaseUpdate=t:s.next=t,a.lastBaseUpdate=t}var ud=!1;function Ui(){if(ud){var s=Hn;if(s!==null)throw s}}function Bi(s,t,a,n){ud=!1;var c=s.updateQueue;kl=!1;var d=c.firstBaseUpdate,p=c.lastBaseUpdate,b=c.shared.pending;if(b!==null){c.shared.pending=null;var D=b,P=D.next;D.next=null,p===null?d=P:p.next=P,p=D;var ce=s.alternate;ce!==null&&(ce=ce.updateQueue,b=ce.lastBaseUpdate,b!==p&&(b===null?ce.firstBaseUpdate=P:b.next=P,ce.lastBaseUpdate=D))}if(d!==null){var ue=c.baseState;p=0,ce=P=D=null,b=d;do{var ee=b.lane&-536870913,le=ee!==b.lane;if(le?(js&ee)===ee:(n&ee)===ee){ee!==0&&ee===Bn&&(ud=!0),ce!==null&&(ce=ce.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var Ae=s,Ye=b;ee=t;var Ls=a;switch(Ye.tag){case 1:if(Ae=Ye.payload,typeof Ae=="function"){ue=Ae.call(Ls,ue,ee);break e}ue=Ae;break e;case 3:Ae.flags=Ae.flags&-65537|128;case 0:if(Ae=Ye.payload,ee=typeof Ae=="function"?Ae.call(Ls,ue,ee):Ae,ee==null)break e;ue=N({},ue,ee);break e;case 2:kl=!0}}ee=b.callback,ee!==null&&(s.flags|=64,le&&(s.flags|=8192),le=c.callbacks,le===null?c.callbacks=[ee]:le.push(ee))}else le={lane:ee,tag:b.tag,payload:b.payload,callback:b.callback,next:null},ce===null?(P=ce=le,D=ue):ce=ce.next=le,p|=ee;if(b=b.next,b===null){if(b=c.shared.pending,b===null)break;le=b,b=le.next,le.next=null,c.lastBaseUpdate=le,c.shared.pending=null}}while(!0);ce===null&&(D=ue),c.baseState=D,c.firstBaseUpdate=P,c.lastBaseUpdate=ce,d===null&&(c.shared.lanes=0),Dl|=p,s.lanes=p,s.memoizedState=ue}}function kx(s,t){if(typeof s!="function")throw Error(o(191,s));s.call(t)}function Tx(s,t){var a=s.callbacks;if(a!==null)for(s.callbacks=null,s=0;sd?d:8;var p=R.T,b={};R.T=b,zd(s,!1,t,a);try{var D=c(),P=R.S;if(P!==null&&P(b,D),D!==null&&typeof D=="object"&&typeof D.then=="function"){var ce=ab(D,n);qi(s,t,ce,ua(s))}else qi(s,t,n,ua(s))}catch(ue){qi(s,t,{then:function(){},status:"rejected",reason:ue},ua())}finally{Y.p=d,p!==null&&b.types!==null&&(p.types=b.types),R.T=p}}function ob(){}function Td(s,t,a,n){if(s.tag!==5)throw Error(o(476));var c=ih(s).queue;nh(s,c,t,K,a===null?ob:function(){return rh(s),a(n)})}function ih(s){var t=s.memoizedState;if(t!==null)return t;t={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ll,lastRenderedState:K},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ll,lastRenderedState:a},next:null},s.memoizedState=t,s=s.alternate,s!==null&&(s.memoizedState=t),t}function rh(s){var t=ih(s);t.next===null&&(t=s.alternate.memoizedState),qi(s,t.next.queue,{},ua())}function Ed(){return Ut(lr)}function ch(){return ft().memoizedState}function oh(){return ft().memoizedState}function db(s){for(var t=s.return;t!==null;){switch(t.tag){case 24:case 3:var a=ua();s=Tl(a);var n=El(t,s,a);n!==null&&(Wt(n,t,a),Li(n,t,a)),t={cache:ld()},s.payload=t;return}t=t.return}}function ub(s,t,a){var n=ua();a={lane:n,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},dc(s)?uh(t,a):(a=Yo(s,t,a,n),a!==null&&(Wt(a,s,n),mh(a,t,n)))}function dh(s,t,a){var n=ua();qi(s,t,a,n)}function qi(s,t,a,n){var c={lane:n,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(dc(s))uh(t,c);else{var d=s.alternate;if(s.lanes===0&&(d===null||d.lanes===0)&&(d=t.lastRenderedReducer,d!==null))try{var p=t.lastRenderedState,b=d(p,a);if(c.hasEagerState=!0,c.eagerState=b,na(b,p))return Vr(s,t,c,0),qs===null&&Fr(),!1}catch{}finally{}if(a=Yo(s,t,c,n),a!==null)return Wt(a,s,n),mh(a,t,n),!0}return!1}function zd(s,t,a,n){if(n={lane:2,revertLane:cu(),gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},dc(s)){if(t)throw Error(o(479))}else t=Yo(s,a,n,2),t!==null&&Wt(t,s,2)}function dc(s){var t=s.alternate;return s===es||t!==null&&t===es}function uh(s,t){Fn=ac=!0;var a=s.pending;a===null?t.next=t:(t.next=a.next,a.next=t),s.pending=t}function mh(s,t,a){if((a&4194048)!==0){var n=t.lanes;n&=s.pendingLanes,a|=n,t.lanes=a,pe(s,a)}}var Gi={readContext:Ut,use:ic,useCallback:rt,useContext:rt,useEffect:rt,useImperativeHandle:rt,useLayoutEffect:rt,useInsertionEffect:rt,useMemo:rt,useReducer:rt,useRef:rt,useState:rt,useDebugValue:rt,useDeferredValue:rt,useTransition:rt,useSyncExternalStore:rt,useId:rt,useHostTransitionStatus:rt,useFormState:rt,useActionState:rt,useOptimistic:rt,useMemoCache:rt,useCacheRefresh:rt};Gi.useEffectEvent=rt;var xh={readContext:Ut,use:ic,useCallback:function(s,t){return It().memoizedState=[s,t===void 0?null:t],s},useContext:Ut,useEffect:Jx,useImperativeHandle:function(s,t,a){a=a!=null?a.concat([s]):null,cc(4194308,4,eh.bind(null,t,s),a)},useLayoutEffect:function(s,t){return cc(4194308,4,s,t)},useInsertionEffect:function(s,t){cc(4,2,s,t)},useMemo:function(s,t){var a=It();t=t===void 0?null:t;var n=s();if(dn){xs(!0);try{s()}finally{xs(!1)}}return a.memoizedState=[n,t],n},useReducer:function(s,t,a){var n=It();if(a!==void 0){var c=a(t);if(dn){xs(!0);try{a(t)}finally{xs(!1)}}}else c=t;return n.memoizedState=n.baseState=c,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:c},n.queue=s,s=s.dispatch=ub.bind(null,es,s),[n.memoizedState,s]},useRef:function(s){var t=It();return s={current:s},t.memoizedState=s},useState:function(s){s=wd(s);var t=s.queue,a=dh.bind(null,es,t);return t.dispatch=a,[s.memoizedState,a]},useDebugValue:Cd,useDeferredValue:function(s,t){var a=It();return kd(a,s,t)},useTransition:function(){var s=wd(!1);return s=nh.bind(null,es,s.queue,!0,!1),It().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,t,a){var n=es,c=It();if(ws){if(a===void 0)throw Error(o(407));a=a()}else{if(a=t(),qs===null)throw Error(o(349));(js&127)!==0||Dx(n,t,a)}c.memoizedState=a;var d={value:a,getSnapshot:t};return c.queue=d,Jx(Lx.bind(null,n,d,s),[s]),n.flags|=2048,In(9,{destroy:void 0},Rx.bind(null,n,d,a,t),null),a},useId:function(){var s=It(),t=qs.identifierPrefix;if(ws){var a=$a,n=Ha;a=(n&~(1<<32-bs(n)-1)).toString(32)+a,t="_"+t+"R_"+a,a=lc++,0<\/script>",d=d.removeChild(d.firstChild);break;case"select":d=typeof n.is=="string"?p.createElement("select",{is:n.is}):p.createElement("select"),n.multiple?d.multiple=!0:n.size&&(d.size=n.size);break;default:d=typeof n.is=="string"?p.createElement(c,{is:n.is}):p.createElement(c)}}d[ys]=t,d[kt]=n;e:for(p=t.child;p!==null;){if(p.tag===5||p.tag===6)d.appendChild(p.stateNode);else if(p.tag!==4&&p.tag!==27&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===t)break e;for(;p.sibling===null;){if(p.return===null||p.return===t)break e;p=p.return}p.sibling.return=p.return,p=p.sibling}t.stateNode=d;e:switch(Ht(d,c,n),c){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}n&&il(t)}}return Js(t),Vd(t,t.type,s===null?null:s.memoizedProps,t.pendingProps,a),null;case 6:if(s&&t.stateNode!=null)s.memoizedProps!==n&&il(t);else{if(typeof n!="string"&&t.stateNode===null)throw Error(o(166));if(s=Z.current,Ln(t)){if(s=t.stateNode,a=t.memoizedProps,n=null,c=Lt,c!==null)switch(c.tag){case 27:case 5:n=c.memoizedProps}s[ys]=t,s=!!(s.nodeValue===a||n!==null&&n.suppressHydrationWarning===!0||Of(s.nodeValue,a)),s||Sl(t,!0)}else s=zc(s).createTextNode(n),s[ys]=t,t.stateNode=s}return Js(t),null;case 31:if(a=t.memoizedState,s===null||s.memoizedState!==null){if(n=Ln(t),a!==null){if(s===null){if(!n)throw Error(o(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(o(557));s[ys]=t}else tn(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Js(t),s=!1}else a=ed(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=a),s=!0;if(!s)return t.flags&256?(ca(t),t):(ca(t),null);if((t.flags&128)!==0)throw Error(o(558))}return Js(t),null;case 13:if(n=t.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(c=Ln(t),n!==null&&n.dehydrated!==null){if(s===null){if(!c)throw Error(o(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(o(317));c[ys]=t}else tn(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Js(t),c=!1}else c=ed(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(ca(t),t):(ca(t),null)}return ca(t),(t.flags&128)!==0?(t.lanes=a,t):(a=n!==null,s=s!==null&&s.memoizedState!==null,a&&(n=t.child,c=null,n.alternate!==null&&n.alternate.memoizedState!==null&&n.alternate.memoizedState.cachePool!==null&&(c=n.alternate.memoizedState.cachePool.pool),d=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(d=n.memoizedState.cachePool.pool),d!==c&&(n.flags|=2048)),a!==s&&a&&(t.child.flags|=8192),fc(t,t.updateQueue),Js(t),null);case 4:return X(),s===null&&mu(t.stateNode.containerInfo),Js(t),null;case 10:return tl(t.type),Js(t),null;case 19:if(xe(ht),n=t.memoizedState,n===null)return Js(t),null;if(c=(t.flags&128)!==0,d=n.rendering,d===null)if(c)Vi(n,!1);else{if(ct!==0||s!==null&&(s.flags&128)!==0)for(s=t.child;s!==null;){if(d=tc(s),d!==null){for(t.flags|=128,Vi(n,!1),s=d.updateQueue,t.updateQueue=s,fc(t,s),t.subtreeFlags=0,s=a,a=t.child;a!==null;)dx(a,s),a=a.sibling;return Ce(ht,ht.current&1|2),ws&&el(t,n.treeForkCount),t.child}s=s.sibling}n.tail!==null&<()>bc&&(t.flags|=128,c=!0,Vi(n,!1),t.lanes=4194304)}else{if(!c)if(s=tc(d),s!==null){if(t.flags|=128,c=!0,s=s.updateQueue,t.updateQueue=s,fc(t,s),Vi(n,!0),n.tail===null&&n.tailMode==="hidden"&&!d.alternate&&!ws)return Js(t),null}else 2*lt()-n.renderingStartTime>bc&&a!==536870912&&(t.flags|=128,c=!0,Vi(n,!1),t.lanes=4194304);n.isBackwards?(d.sibling=t.child,t.child=d):(s=n.last,s!==null?s.sibling=d:t.child=d,n.last=d)}return n.tail!==null?(s=n.tail,n.rendering=s,n.tail=s.sibling,n.renderingStartTime=lt(),s.sibling=null,a=ht.current,Ce(ht,c?a&1|2:a&1),ws&&el(t,n.treeForkCount),s):(Js(t),null);case 22:case 23:return ca(t),xd(),n=t.memoizedState!==null,s!==null?s.memoizedState!==null!==n&&(t.flags|=8192):n&&(t.flags|=8192),n?(a&536870912)!==0&&(t.flags&128)===0&&(Js(t),t.subtreeFlags&6&&(t.flags|=8192)):Js(t),a=t.updateQueue,a!==null&&fc(t,a.retryQueue),a=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(a=s.memoizedState.cachePool.pool),n=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),n!==a&&(t.flags|=2048),s!==null&&xe(nn),null;case 24:return a=null,s!==null&&(a=s.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),tl(Nt),Js(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function pb(s,t){switch(Zo(t),t.tag){case 1:return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 3:return tl(Nt),X(),s=t.flags,(s&65536)!==0&&(s&128)===0?(t.flags=s&-65537|128,t):null;case 26:case 27:case 5:return De(t),null;case 31:if(t.memoizedState!==null){if(ca(t),t.alternate===null)throw Error(o(340));tn()}return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 13:if(ca(t),s=t.memoizedState,s!==null&&s.dehydrated!==null){if(t.alternate===null)throw Error(o(340));tn()}return s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 19:return xe(ht),null;case 4:return X(),null;case 10:return tl(t.type),null;case 22:case 23:return ca(t),xd(),s!==null&&xe(nn),s=t.flags,s&65536?(t.flags=s&-65537|128,t):null;case 24:return tl(Nt),null;case 25:return null;default:return null}}function Uh(s,t){switch(Zo(t),t.tag){case 3:tl(Nt),X();break;case 26:case 27:case 5:De(t);break;case 4:X();break;case 31:t.memoizedState!==null&&ca(t);break;case 13:ca(t);break;case 19:xe(ht);break;case 10:tl(t.type);break;case 22:case 23:ca(t),xd(),s!==null&&xe(nn);break;case 24:tl(Nt)}}function Ii(s,t){try{var a=t.updateQueue,n=a!==null?a.lastEffect:null;if(n!==null){var c=n.next;a=c;do{if((a.tag&s)===s){n=void 0;var d=a.create,p=a.inst;n=d(),p.destroy=n}a=a.next}while(a!==c)}}catch(b){Os(t,t.return,b)}}function Al(s,t,a){try{var n=t.updateQueue,c=n!==null?n.lastEffect:null;if(c!==null){var d=c.next;n=d;do{if((n.tag&s)===s){var p=n.inst,b=p.destroy;if(b!==void 0){p.destroy=void 0,c=t;var D=a,P=b;try{P()}catch(ce){Os(c,D,ce)}}}n=n.next}while(n!==d)}}catch(ce){Os(t,t.return,ce)}}function Bh(s){var t=s.updateQueue;if(t!==null){var a=s.stateNode;try{Tx(t,a)}catch(n){Os(s,s.return,n)}}}function Hh(s,t,a){a.props=un(s.type,s.memoizedProps),a.state=s.memoizedState;try{a.componentWillUnmount()}catch(n){Os(s,t,n)}}function Qi(s,t){try{var a=s.ref;if(a!==null){switch(s.tag){case 26:case 27:case 5:var n=s.stateNode;break;case 30:n=s.stateNode;break;default:n=s.stateNode}typeof a=="function"?s.refCleanup=a(n):a.current=n}}catch(c){Os(s,t,c)}}function qa(s,t){var a=s.ref,n=s.refCleanup;if(a!==null)if(typeof n=="function")try{n()}catch(c){Os(s,t,c)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(c){Os(s,t,c)}else a.current=null}function $h(s){var t=s.type,a=s.memoizedProps,n=s.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&n.focus();break e;case"img":a.src?n.src=a.src:a.srcSet&&(n.srcset=a.srcSet)}}catch(c){Os(s,s.return,c)}}function Id(s,t,a){try{var n=s.stateNode;Bb(n,s.type,a,t),n[kt]=t}catch(c){Os(s,s.return,c)}}function qh(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Hl(s.type)||s.tag===4}function Qd(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||qh(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&&Hl(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 Yd(s,t,a){var n=s.tag;if(n===5||n===6)s=s.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(s,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(s),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=Pa));else if(n!==4&&(n===27&&Hl(s.type)&&(a=s.stateNode,t=null),s=s.child,s!==null))for(Yd(s,t,a),s=s.sibling;s!==null;)Yd(s,t,a),s=s.sibling}function pc(s,t,a){var n=s.tag;if(n===5||n===6)s=s.stateNode,t?a.insertBefore(s,t):a.appendChild(s);else if(n!==4&&(n===27&&Hl(s.type)&&(a=s.stateNode),s=s.child,s!==null))for(pc(s,t,a),s=s.sibling;s!==null;)pc(s,t,a),s=s.sibling}function Gh(s){var t=s.stateNode,a=s.memoizedProps;try{for(var n=s.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);Ht(t,n,a),t[ys]=s,t[kt]=a}catch(d){Os(s,s.return,d)}}var rl=!1,_t=!1,Kd=!1,Fh=typeof WeakSet=="function"?WeakSet:Set,Rt=null;function gb(s,t){if(s=s.containerInfo,fu=Uc,s=sx(s),qo(s)){if("selectionStart"in s)var a={start:s.selectionStart,end:s.selectionEnd};else e:{a=(a=s.ownerDocument)&&a.defaultView||window;var n=a.getSelection&&a.getSelection();if(n&&n.rangeCount!==0){a=n.anchorNode;var c=n.anchorOffset,d=n.focusNode;n=n.focusOffset;try{a.nodeType,d.nodeType}catch{a=null;break e}var p=0,b=-1,D=-1,P=0,ce=0,ue=s,ee=null;s:for(;;){for(var le;ue!==a||c!==0&&ue.nodeType!==3||(b=p+c),ue!==d||n!==0&&ue.nodeType!==3||(D=p+n),ue.nodeType===3&&(p+=ue.nodeValue.length),(le=ue.firstChild)!==null;)ee=ue,ue=le;for(;;){if(ue===s)break s;if(ee===a&&++P===c&&(b=p),ee===d&&++ce===n&&(D=p),(le=ue.nextSibling)!==null)break;ue=ee,ee=ue.parentNode}ue=le}a=b===-1||D===-1?null:{start:b,end:D}}else a=null}a=a||{start:0,end:0}}else a=null;for(pu={focusedElem:s,selectionRange:a},Uc=!1,Rt=t;Rt!==null;)if(t=Rt,s=t.child,(t.subtreeFlags&1028)!==0&&s!==null)s.return=t,Rt=s;else for(;Rt!==null;){switch(t=Rt,d=t.alternate,s=t.flags,t.tag){case 0:if((s&4)!==0&&(s=t.updateQueue,s=s!==null?s.events:null,s!==null))for(a=0;a title"))),Ht(d,n,a),d[ys]=s,Dt(d),n=d;break e;case"link":var p=Jf("link","href",c).get(n+(a.href||""));if(p){for(var b=0;bLs&&(p=Ls,Ls=Ye,Ye=p);var q=Wm(b,Ye),B=Wm(b,Ls);if(q&&B&&(le.rangeCount!==1||le.anchorNode!==q.node||le.anchorOffset!==q.offset||le.focusNode!==B.node||le.focusOffset!==B.offset)){var J=ue.createRange();J.setStart(q.node,q.offset),le.removeAllRanges(),Ye>Ls?(le.addRange(J),le.extend(B.node,B.offset)):(J.setEnd(B.node,B.offset),le.addRange(J))}}}}for(ue=[],le=b;le=le.parentNode;)le.nodeType===1&&ue.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;ba?32:a,R.T=null,a=su,su=null;var d=Ll,p=ml;if(Tt=0,Jn=Ll=null,ml=0,(Ts&6)!==0)throw Error(o(331));var b=Ts;if(Ts|=4,ef(d.current),Ph(d,d.current,p,a),Ts=b,Zi(0,!1),Ee&&typeof Ee.onPostCommitFiberRoot=="function")try{Ee.onPostCommitFiberRoot(Ss,d)}catch{}return!0}finally{Y.p=c,R.T=n,vf(s,t)}}function Nf(s,t,a){t=ja(a,t),t=Dd(s.stateNode,t,2),s=El(s,t,2),s!==null&&(At(s,2),Ga(s))}function Os(s,t,a){if(s.tag===3)Nf(s,s,a);else for(;t!==null;){if(t.tag===3){Nf(t,s,a);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(Rl===null||!Rl.has(n))){s=ja(a,s),a=Nh(2),n=El(t,a,2),n!==null&&(yh(a,n,t,s),At(n,2),Ga(n));break}}t=t.return}}function nu(s,t,a){var n=s.pingCache;if(n===null){n=s.pingCache=new bb;var c=new Set;n.set(t,c)}else c=n.get(t),c===void 0&&(c=new Set,n.set(t,c));c.has(a)||(Pd=!0,c.add(a),s=Sb.bind(null,s,t,a),t.then(s,s))}function Sb(s,t,a){var n=s.pingCache;n!==null&&n.delete(t),s.pingedLanes|=s.suspendedLanes&a,s.warmLanes&=~a,qs===s&&(js&a)===a&&(ct===4||ct===3&&(js&62914560)===js&&300>lt()-vc?(Ts&2)===0&&Pn(s,0):Zd|=a,Xn===js&&(Xn=0)),Ga(s)}function yf(s,t){t===0&&(t=de()),s=en(s,t),s!==null&&(At(s,t),Ga(s))}function Cb(s){var t=s.memoizedState,a=0;t!==null&&(a=t.retryLane),yf(s,a)}function kb(s,t){var a=0;switch(s.tag){case 31:case 13:var n=s.stateNode,c=s.memoizedState;c!==null&&(a=c.retryLane);break;case 19:n=s.stateNode;break;case 22:n=s.stateNode._retryCache;break;default:throw Error(o(314))}n!==null&&n.delete(t),yf(s,a)}function Tb(s,t){return jt(s,t)}var Cc=null,Wn=null,iu=!1,kc=!1,ru=!1,Bl=0;function Ga(s){s!==Wn&&s.next===null&&(Wn===null?Cc=Wn=s:Wn=Wn.next=s),kc=!0,iu||(iu=!0,zb())}function Zi(s,t){if(!ru&&kc){ru=!0;do for(var a=!1,n=Cc;n!==null;){if(s!==0){var c=n.pendingLanes;if(c===0)var d=0;else{var p=n.suspendedLanes,b=n.pingedLanes;d=(1<<31-bs(42|s)+1)-1,d&=c&~(p&~b),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(a=!0,Cf(n,d))}else d=js,d=bt(n,n===qs?d:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),(d&3)===0||Vt(n,d)||(a=!0,Cf(n,d));n=n.next}while(a);ru=!1}}function Eb(){wf()}function wf(){kc=iu=!1;var s=0;Bl!==0&&$b()&&(s=Bl);for(var t=lt(),a=null,n=Cc;n!==null;){var c=n.next,d=_f(n,t);d===0?(n.next=null,a===null?Cc=c:a.next=c,c===null&&(Wn=a)):(a=n,(s!==0||(d&3)!==0)&&(kc=!0)),n=c}Tt!==0&&Tt!==5||Zi(s),Bl!==0&&(Bl=0)}function _f(s,t){for(var a=s.suspendedLanes,n=s.pingedLanes,c=s.expirationTimes,d=s.pendingLanes&-62914561;0b)break;var ce=D.transferSize,ue=D.initiatorType;ce&&Df(ue)&&(D=D.responseEnd,p+=ce*(D"u"?null:document;function Qf(s,t,a){var n=ei;if(n&&typeof t=="string"&&t){var c=pa(t);c='link[rel="'+s+'"][href="'+c+'"]',typeof a=="string"&&(c+='[crossorigin="'+a+'"]'),If.has(c)||(If.add(c),s={rel:s,crossOrigin:a,href:t},n.querySelector(c)===null&&(t=n.createElement("link"),Ht(t,"link",s),Dt(t),n.head.appendChild(t)))}}function Xb(s){xl.D(s),Qf("dns-prefetch",s,null)}function Jb(s,t){xl.C(s,t),Qf("preconnect",s,t)}function Pb(s,t,a){xl.L(s,t,a);var n=ei;if(n&&s&&t){var c='link[rel="preload"][as="'+pa(t)+'"]';t==="image"&&a&&a.imageSrcSet?(c+='[imagesrcset="'+pa(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(c+='[imagesizes="'+pa(a.imageSizes)+'"]')):c+='[href="'+pa(s)+'"]';var d=c;switch(t){case"style":d=si(s);break;case"script":d=ti(s)}_a.has(d)||(s=N({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:s,as:t},a),_a.set(d,s),n.querySelector(c)!==null||t==="style"&&n.querySelector(tr(d))||t==="script"&&n.querySelector(ar(d))||(t=n.createElement("link"),Ht(t,"link",s),Dt(t),n.head.appendChild(t)))}}function Zb(s,t){xl.m(s,t);var a=ei;if(a&&s){var n=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+pa(n)+'"][href="'+pa(s)+'"]',d=c;switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":d=ti(s)}if(!_a.has(d)&&(s=N({rel:"modulepreload",href:s},t),_a.set(d,s),a.querySelector(c)===null)){switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(ar(d)))return}n=a.createElement("link"),Ht(n,"link",s),Dt(n),a.head.appendChild(n)}}}function Wb(s,t,a){xl.S(s,t,a);var n=ei;if(n&&s){var c=wn(n).hoistableStyles,d=si(s);t=t||"default";var p=c.get(d);if(!p){var b={loading:0,preload:null};if(p=n.querySelector(tr(d)))b.loading=5;else{s=N({rel:"stylesheet",href:s,"data-precedence":t},a),(a=_a.get(d))&&wu(s,a);var D=p=n.createElement("link");Dt(D),Ht(D,"link",s),D._p=new Promise(function(P,ce){D.onload=P,D.onerror=ce}),D.addEventListener("load",function(){b.loading|=1}),D.addEventListener("error",function(){b.loading|=2}),b.loading|=4,Ac(p,t,n)}p={type:"stylesheet",instance:p,count:1,state:b},c.set(d,p)}}}function eN(s,t){xl.X(s,t);var a=ei;if(a&&s){var n=wn(a).hoistableScripts,c=ti(s),d=n.get(c);d||(d=a.querySelector(ar(c)),d||(s=N({src:s,async:!0},t),(t=_a.get(c))&&_u(s,t),d=a.createElement("script"),Dt(d),Ht(d,"link",s),a.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},n.set(c,d))}}function sN(s,t){xl.M(s,t);var a=ei;if(a&&s){var n=wn(a).hoistableScripts,c=ti(s),d=n.get(c);d||(d=a.querySelector(ar(c)),d||(s=N({src:s,async:!0,type:"module"},t),(t=_a.get(c))&&_u(s,t),d=a.createElement("script"),Dt(d),Ht(d,"link",s),a.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},n.set(c,d))}}function Yf(s,t,a,n){var c=(c=Z.current)?Mc(c):null;if(!c)throw Error(o(446));switch(s){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=si(a.href),a=wn(c).hoistableStyles,n=a.get(t),n||(n={type:"style",instance:null,count:0,state:null},a.set(t,n)),n):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){s=si(a.href);var d=wn(c).hoistableStyles,p=d.get(s);if(p||(c=c.ownerDocument||c,p={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},d.set(s,p),(d=c.querySelector(tr(s)))&&!d._p&&(p.instance=d,p.state.loading=5),_a.has(s)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},_a.set(s,a),d||tN(c,s,a,p.state))),t&&n===null)throw Error(o(528,""));return p}if(t&&n!==null)throw Error(o(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=ti(a),a=wn(c).hoistableScripts,n=a.get(t),n||(n={type:"script",instance:null,count:0,state:null},a.set(t,n)),n):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,s))}}function si(s){return'href="'+pa(s)+'"'}function tr(s){return'link[rel="stylesheet"]['+s+"]"}function Kf(s){return N({},s,{"data-precedence":s.precedence,precedence:null})}function tN(s,t,a,n){s.querySelector('link[rel="preload"][as="style"]['+t+"]")?n.loading=1:(t=s.createElement("link"),n.preload=t,t.addEventListener("load",function(){return n.loading|=1}),t.addEventListener("error",function(){return n.loading|=2}),Ht(t,"link",a),Dt(t),s.head.appendChild(t))}function ti(s){return'[src="'+pa(s)+'"]'}function ar(s){return"script[async]"+s}function Xf(s,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var n=s.querySelector('style[data-href~="'+pa(a.href)+'"]');if(n)return t.instance=n,Dt(n),n;var c=N({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return n=(s.ownerDocument||s).createElement("style"),Dt(n),Ht(n,"style",c),Ac(n,a.precedence,s),t.instance=n;case"stylesheet":c=si(a.href);var d=s.querySelector(tr(c));if(d)return t.state.loading|=4,t.instance=d,Dt(d),d;n=Kf(a),(c=_a.get(c))&&wu(n,c),d=(s.ownerDocument||s).createElement("link"),Dt(d);var p=d;return p._p=new Promise(function(b,D){p.onload=b,p.onerror=D}),Ht(d,"link",n),t.state.loading|=4,Ac(d,a.precedence,s),t.instance=d;case"script":return d=ti(a.src),(c=s.querySelector(ar(d)))?(t.instance=c,Dt(c),c):(n=a,(c=_a.get(d))&&(n=N({},a),_u(n,c)),s=s.ownerDocument||s,c=s.createElement("script"),Dt(c),Ht(c,"link",n),s.head.appendChild(c),t.instance=c);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(n=t.instance,t.state.loading|=4,Ac(n,a.precedence,s));return t.instance}function Ac(s,t,a){for(var n=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=n.length?n[n.length-1]:null,d=c,p=0;p title"):null)}function aN(s,t,a){if(a===1||t.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return s=t.disabled,typeof t.precedence=="string"&&s==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Zf(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function lN(s,t,a,n){if(a.type==="stylesheet"&&(typeof n.media!="string"||matchMedia(n.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var c=si(n.href),d=t.querySelector(tr(c));if(d){t=d._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(s.count++,s=Dc.bind(s),t.then(s,s)),a.state.loading|=4,a.instance=d,Dt(d);return}d=t.ownerDocument||t,n=Kf(n),(c=_a.get(c))&&wu(n,c),d=d.createElement("link"),Dt(d);var p=d;p._p=new Promise(function(b,D){p.onload=b,p.onerror=D}),Ht(d,"link",n),a.instance=d}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(s.count++,a=Dc.bind(s),t.addEventListener("load",a),t.addEventListener("error",a))}}var Su=0;function nN(s,t){return s.stylesheets&&s.count===0&&Lc(s,s.stylesheets),0Su?50:800)+t);return s.unsuspend=a,function(){s.unsuspend=null,clearTimeout(n),clearTimeout(c)}}:null}function Dc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Lc(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var Rc=null;function Lc(s,t){s.stylesheets=null,s.unsuspend!==null&&(s.count++,Rc=new Map,t.forEach(iN,s),Rc=null,Dc.call(s))}function iN(s,t){if(!(t.state.loading&4)){var a=Rc.get(s);if(a)var n=a.get(null);else{a=new Map,Rc.set(s,a);for(var c=s.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;d"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l)}catch(i){console.error(i)}}return l(),Lu.exports=z0(),Lu.exports}var A0=M0();function H(...l){return SN(CN(l))}const Fe=m.forwardRef(({className:l,...i},r)=>e.jsx("div",{ref:r,className:H("rounded-xl border bg-card text-card-foreground shadow",l),...i}));Fe.displayName="Card";const as=m.forwardRef(({className:l,...i},r)=>e.jsx("div",{ref:r,className:H("flex flex-col space-y-1.5 p-6",l),...i}));as.displayName="CardHeader";const ls=m.forwardRef(({className:l,...i},r)=>e.jsx("div",{ref:r,className:H("font-semibold leading-none tracking-tight",l),...i}));ls.displayName="CardTitle";const st=m.forwardRef(({className:l,...i},r)=>e.jsx("div",{ref:r,className:H("text-sm text-muted-foreground",l),...i}));st.displayName="CardDescription";const ps=m.forwardRef(({className:l,...i},r)=>e.jsx("div",{ref:r,className:H("p-6 pt-0",l),...i}));ps.displayName="CardContent";const ej=m.forwardRef(({className:l,...i},r)=>e.jsx("div",{ref:r,className:H("flex items-center p-6 pt-0",l),...i}));ej.displayName="CardFooter";const ka=kN,xa=m.forwardRef(({className:l,...i},r)=>e.jsx(Fp,{ref:r,className:H("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",l),...i}));xa.displayName=Fp.displayName;const ts=m.forwardRef(({className:l,...i},r)=>e.jsx(Vp,{ref:r,className:H("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all duration-300 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",l),...i}));ts.displayName=Vp.displayName;const Ms=m.forwardRef(({className:l,...i},r)=>e.jsx(Ip,{ref:r,className:H("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=active]:animate-in data-[state=active]:fade-in data-[state=active]:duration-300",l),...i}));Ms.displayName=Ip.displayName;const Ze=m.forwardRef(({className:l,children:i,viewportRef:r,...o},u)=>e.jsxs(Qp,{ref:u,className:H("relative overflow-hidden",l),...o,children:[e.jsx(TN,{ref:r,className:"h-full w-full rounded-[inherit]",children:i}),e.jsx(Wu,{}),e.jsx(Wu,{orientation:"horizontal"}),e.jsx(EN,{})]}));Ze.displayName=Qp.displayName;const Wu=m.forwardRef(({className:l,orientation:i="vertical",...r},o)=>e.jsx(Yp,{ref:o,orientation:i,className:H("flex touch-none select-none transition-colors",i==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",i==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",l),...r,children:e.jsx(zN,{className:"relative flex-1 rounded-full bg-border"})}));Wu.displayName=Yp.displayName;function sj({className:l,...i}){return e.jsx("div",{className:H("animate-pulse rounded-md bg-primary/10",l),...i})}const gi=m.forwardRef(({className:l,value:i,...r},o)=>e.jsx(Kp,{ref:o,className:H("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",l),...r,children:e.jsx(MN,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(i||0)}%)`}})}));gi.displayName=Kp.displayName;const O0={light:"",dark:".dark"},tj=m.createContext(null);function aj(){const l=m.useContext(tj);if(!l)throw new Error("useChart must be used within a ");return l}const ni=m.forwardRef(({id:l,className:i,children:r,config:o,...u},x)=>{const h=m.useId(),f=`chart-${l||h.replace(/:/g,"")}`;return e.jsx(tj.Provider,{value:{config:o},children:e.jsxs("div",{"data-chart":f,ref:x,className:H("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",i),...u,children:[e.jsx(D0,{id:f,config:o}),e.jsx(YN,{children:r})]})})});ni.displayName="Chart";const D0=({id:l,config:i})=>{const r=Object.entries(i).filter(([,o])=>o.theme||o.color);return r.length?e.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(O0).map(([o,u])=>` ${u} [data-chart=${l}] { -${r.map(([x,h])=>{const p=h.theme?.[o]||h.color;return p?` --color-${x}: ${p};`:null}).join(` +${r.map(([x,h])=>{const f=h.theme?.[o]||h.color;return f?` --color-${x}: ${f};`:null}).join(` `)} } `).join(` -`)}}):null},dr=UN,ii=m.forwardRef(({active:l,payload:i,className:r,indicator:o="dot",hideLabel:u=!1,hideIndicator:x=!1,label:h,labelFormatter:p,labelClassName:g,formatter:v,color:j,nameKey:N,labelKey:y},S)=>{const{config:w}=Qg(),R=m.useMemo(()=>{if(u||!i?.length)return null;const[U]=i,G=`${y||U?.dataKey||U?.name||"value"}`,L=Wu(w,U,G),T=!y&&typeof h=="string"?w[h]?.label||h:L?.label;return p?e.jsx("div",{className:H("font-medium",g),children:p(T,i)}):T?e.jsx("div",{className:H("font-medium",g),children:T}):null},[h,p,i,u,g,w,y]);if(!l||!i?.length)return null;const O=i.length===1&&o!=="dot";return e.jsxs("div",{ref:S,className:H("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:[O?null:R,e.jsx("div",{className:"grid gap-1.5",children:i.filter(U=>U.type!=="none").map((U,G)=>{const L=`${N||U.name||U.dataKey||"value"}`,T=Wu(w,U,L),F=j||U.payload.fill||U.color;return e.jsx("div",{className:H("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",o==="dot"&&"items-center"),children:v&&U?.value!==void 0&&U.name?v(U.value,U.name,U,G,U.payload):e.jsxs(e.Fragment,{children:[T?.icon?e.jsx(T.icon,{}):!x&&e.jsx("div",{className:H("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":o==="dot","w-1":o==="line","w-0 border-[1.5px] border-dashed bg-transparent":o==="dashed","my-0.5":O&&o==="dashed"}),style:{"--color-bg":F,"--color-border":F}}),e.jsxs("div",{className:H("flex flex-1 justify-between leading-none",O?"items-end":"items-center"),children:[e.jsxs("div",{className:"grid gap-1.5",children:[O?R:null,e.jsx("span",{className:"text-muted-foreground",children:T?.label||U.name})]}),U.value&&e.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:U.value.toLocaleString()})]})]})},U.dataKey)})})]})});ii.displayName="ChartTooltip";const D0=BN,Yg=m.forwardRef(({className:l,hideIcon:i=!1,payload:r,verticalAlign:o="bottom",nameKey:u},x)=>{const{config:h}=Qg();return r?.length?e.jsx("div",{ref:x,className:H("flex items-center justify-center gap-4",o==="top"?"pb-3":"pt-3",l),children:r.filter(p=>p.type!=="none").map(p=>{const g=`${u||p.dataKey||"value"}`,v=Wu(h,p,g);return e.jsxs("div",{className:H("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[v?.icon&&!i?e.jsx(v.icon,{}):e.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:p.color}}),v?.label]},p.value)})}):null});Yg.displayName="ChartLegend";function Wu(l,i,r){if(typeof i!="object"||i===null)return;const o="payload"in i&&typeof i.payload=="object"&&i.payload!==null?i.payload:void 0;let u=r;return r in i&&typeof i[r]=="string"?u=i[r]:o&&r in o&&typeof o[r]=="string"&&(u=o[r]),u in l?l[u]:l[r]}const Nr=xi("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),_=m.forwardRef(({className:l,variant:i,size:r,asChild:o=!1,...u},x)=>{const h=o?VN:"button";return e.jsx(h,{className:H(Nr({variant:i,size:r,className:l})),ref:x,...u})});_.displayName="Button";const R0=xi("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 Qe({className:l,variant:i,...r}){return e.jsx("div",{className:H(R0({variant:i}),l),...r})}const L0=5,U0=5e3;let Bu=0;function B0(){return Bu=(Bu+1)%Number.MAX_SAFE_INTEGER,Bu.toString()}const Hu=new Map,Np=l=>{if(Hu.has(l))return;const i=setTimeout(()=>{Hu.delete(l),gr({type:"REMOVE_TOAST",toastId:l})},U0);Hu.set(l,i)},H0=(l,i)=>{switch(i.type){case"ADD_TOAST":return{...l,toasts:[i.toast,...l.toasts].slice(0,L0)};case"UPDATE_TOAST":return{...l,toasts:l.toasts.map(r=>r.id===i.toast.id?{...r,...i.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=i;return r?Np(r):l.toasts.forEach(o=>{Np(o.id)}),{...l,toasts:l.toasts.map(o=>o.id===r||r===void 0?{...o,open:!1}:o)}}case"REMOVE_TOAST":return i.toastId===void 0?{...l,toasts:[]}:{...l,toasts:l.toasts.filter(r=>r.id!==i.toastId)}}},so=[];let to={toasts:[]};function gr(l){to=H0(to,l),so.forEach(i=>{i(to)})}function $0({...l}){const i=B0(),r=u=>gr({type:"UPDATE_TOAST",toast:{...u,id:i}}),o=()=>gr({type:"DISMISS_TOAST",toastId:i});return gr({type:"ADD_TOAST",toast:{...l,id:i,open:!0,onOpenChange:u=>{u||o()}}}),{id:i,dismiss:o,update:r}}function Vs(){const[l,i]=m.useState(to);return m.useEffect(()=>(so.push(i),()=>{const r=so.indexOf(i);r>-1&&so.splice(r,1)}),[l]),{...l,toast:$0,dismiss:r=>gr({type:"DISMISS_TOAST",toastId:r})}}const q0=l=>{const i=[];for(let r=0;r{try{S(!0);const k=await Vc.get("https://v1.hitokoto.cn/?c=a&c=b&c=c&c=d&c=h&c=i&c=k");N({hitokoto:k.data.hitokoto,from:k.data.from||k.data.from_who||"未知"})}catch(k){console.error("获取一言失败:",k),N({hitokoto:"人生就像一盒巧克力,你永远不知道下一颗是什么味道。",from:"阿甘正传"})}finally{S(!1)}},[]),T=m.useCallback(async()=>{try{const k=localStorage.getItem("access-token"),ne=await Vc.get("/api/webui/system/status",{headers:{Authorization:`Bearer ${k}`}});R(ne.data)}catch(k){console.error("获取机器人状态失败:",k),R(null)}},[]),F=async()=>{if(!O)try{U(!0);const k=localStorage.getItem("access-token");await Vc.post("/api/webui/system/restart",{},{headers:{Authorization:`Bearer ${k}`}}),G({title:"重启中",description:"麦麦正在重启,请稍候..."}),setTimeout(()=>{T(),U(!1)},3e3)}catch(k){console.error("重启失败:",k),G({title:"重启失败",description:"无法重启麦麦,请检查控制台",variant:"destructive"}),U(!1)}},q=m.useCallback(async()=>{try{const k=localStorage.getItem("access-token"),ne=await Vc.get(`/api/webui/statistics/dashboard?hours=${h}`,{headers:{Authorization:`Bearer ${k}`}});i(ne.data),o(!1),x(100)}catch(k){console.error("Failed to fetch dashboard data:",k),o(!1),x(100)}},[h]);if(m.useEffect(()=>{if(!r)return;x(0);const k=setTimeout(()=>x(15),200),ne=setTimeout(()=>x(30),800),xe=setTimeout(()=>x(45),2e3),Ce=setTimeout(()=>x(60),4e3),_e=setTimeout(()=>x(75),6500),Me=setTimeout(()=>x(85),9e3),Z=setTimeout(()=>x(92),11e3);return()=>{clearTimeout(k),clearTimeout(ne),clearTimeout(xe),clearTimeout(Ce),clearTimeout(_e),clearTimeout(Me),clearTimeout(Z)}},[r]),m.useEffect(()=>{q(),L(),T()},[q,L,T]),m.useEffect(()=>{if(!g)return;const k=setInterval(()=>{q(),T()},3e4);return()=>clearInterval(k)},[g,q,T]),r||!l)return e.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-200px)]",children:e.jsxs("div",{className:"text-center space-y-6 w-full max-w-md px-4",children:[e.jsx(qt,{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(gi,{value:u,className:"h-2"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[u,"%"]})]})]})});const{summary:z,model_stats:M=[],hourly_data:Q=[],daily_data:fe=[],recent_activity:ve=[]}=l,ge=z??{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},be=k=>{const ne=Math.floor(k/3600),xe=Math.floor(k%3600/60);return`${ne}小时${xe}分钟`},je=k=>{const ne=k.toLocaleString("zh-CN");return k>=1e9?{display:`${(k/1e9).toFixed(2)}B`,exact:ne,needsExact:!0}:k>=1e6?{display:`${(k/1e6).toFixed(2)}M`,exact:ne,needsExact:!0}:k>=1e4?{display:`${(k/1e3).toFixed(1)}K`,exact:ne,needsExact:!0}:k>=1e3?{display:`${(k/1e3).toFixed(2)}K`,exact:ne,needsExact:!0}:{display:ne,exact:ne,needsExact:!1}},Ne=k=>{const ne=`¥${k.toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2})}`;return k>=1e6?{display:`¥${(k/1e6).toFixed(2)}M`,exact:ne,needsExact:!0}:k>=1e4?{display:`¥${(k/1e3).toFixed(1)}K`,exact:ne,needsExact:!0}:k>=1e3?{display:`¥${(k/1e3).toFixed(2)}K`,exact:ne,needsExact:!0}:{display:ne,exact:ne,needsExact:!1}},D=k=>new Date(k).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),Y=q0(M.length),K=M.map((k,ne)=>({name:k.model_name,value:k.request_count,fill:Y[ne]})),re={requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"},tokens:{label:"Tokens",color:"hsl(var(--chart-3))"}};return e.jsx(Ze,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"实时监控面板"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"麦麦运行状态和统计数据一览"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(ka,{value:h.toString(),onValueChange:k=>p(Number(k)),children:e.jsxs(xa,{className:"grid grid-cols-3 w-full sm:w-auto",children:[e.jsx(ts,{value:"24",children:"24小时"}),e.jsx(ts,{value:"168",children:"7天"}),e.jsx(ts,{value:"720",children:"30天"})]})}),e.jsxs(_,{variant:g?"default":"outline",size:"sm",onClick:()=>v(!g),className:"gap-2",children:[e.jsx(qt,{className:`h-4 w-4 ${g?"animate-spin":""}`}),e.jsx("span",{className:"hidden sm:inline",children:"自动刷新"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:q,children:e.jsx(qt,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 rounded-lg border border-dashed border-muted-foreground/30 bg-muted/20",children:[y?e.jsx(Vg,{className:"h-5 flex-1"}):j?e.jsxs("p",{className:"flex-1 text-sm text-muted-foreground italic truncate",children:['"',j.hitokoto,'" —— ',j.from]}):null,e.jsx(_,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:L,disabled:y,children:e.jsx(qt,{className:`h-3.5 w-3.5 ${y?"animate-spin":""}`})})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-3",children:[e.jsxs(Ve,{className:"lg:col-span-1",children:[e.jsx(as,{className:"pb-3",children:e.jsxs(ls,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(kr,{className:"h-4 w-4"}),"麦麦状态"]})}),e.jsx(ps,{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(Qe,{variant:"outline",className:"text-green-600 border-green-300 bg-green-50",children:[e.jsx(ma,{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(Qe,{variant:"outline",className:"text-red-600 border-red-300 bg-red-50",children:[e.jsx(Gt,{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:["运行 ",be(w.uptime)]})]})]})})]}),e.jsxs(Ve,{children:[e.jsx(as,{className:"pb-3",children:e.jsxs(ls,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(fn,{className:"h-4 w-4"}),"快速操作"]})}),e.jsx(ps,{children:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:F,disabled:O,className:"gap-2",children:[e.jsx(ao,{className:`h-4 w-4 ${O?"animate-spin":""}`}),O?"重启中...":"重启麦麦"]}),e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(li,{to:"/logs",children:[e.jsx(Ra,{className:"h-4 w-4"}),"查看日志"]})}),e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(li,{to:"/plugins",children:[e.jsx(xy,{className:"h-4 w-4"}),"插件管理"]})}),e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(li,{to:"/settings",children:[e.jsx(hi,{className:"h-4 w-4"}),"系统设置"]})})]})})]}),e.jsxs(Ve,{children:[e.jsxs(as,{className:"pb-3",children:[e.jsxs(ls,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(hy,{className:"h-4 w-4"}),"反馈问卷"]}),e.jsx(st,{className:"text-xs",children:"帮助我们改进产品体验"})]}),e.jsx(ps,{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(li,{to:"/survey/webui-feedback",children:[e.jsx(Ra,{className:"h-4 w-4"}),"WebUI 反馈"]})}),e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(li,{to:"/survey/maibot-feedback",children:[e.jsx(Yl,{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(Ve,{children:[e.jsxs(as,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(ls,{className:"text-sm font-medium",children:"总请求数"}),e.jsx(fy,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(ps,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[je(ge.total_requests).display,je(ge.total_requests).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",je(ge.total_requests).exact,")"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["最近",h<48?h+"小时":Math.floor(h/24)+"天"]})]})]}),e.jsxs(Ve,{children:[e.jsxs(as,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(ls,{className:"text-sm font-medium",children:"总花费"}),e.jsx(py,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(ps,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[Ne(ge.total_cost).display,Ne(ge.total_cost).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",Ne(ge.total_cost).exact,")"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:ge.cost_per_hour>0?`¥${ge.cost_per_hour.toFixed(2)}/小时`:"暂无数据"})]})]}),e.jsxs(Ve,{children:[e.jsxs(as,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(ls,{className:"text-sm font-medium",children:"Token消耗"}),e.jsx(lo,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(ps,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[je(ge.total_tokens).display,je(ge.total_tokens).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",je(ge.total_tokens).exact,")"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:ge.tokens_per_hour>0?`${je(ge.tokens_per_hour).display}/小时`:"暂无数据"})]})]}),e.jsxs(Ve,{children:[e.jsxs(as,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(ls,{className:"text-sm font-medium",children:"平均响应"}),e.jsx(fn,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(ps,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[ge.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(Ve,{children:[e.jsxs(as,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(ls,{className:"text-sm font-medium",children:"在线时长"}),e.jsx(oi,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(ps,{children:e.jsxs("div",{className:"text-xl font-bold",children:[be(ge.online_time),e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",ge.online_time.toLocaleString(),"秒)"]})]})})]}),e.jsxs(Ve,{children:[e.jsxs(as,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(ls,{className:"text-sm font-medium",children:"消息处理"}),e.jsx(Yl,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(ps,{children:[e.jsxs("div",{className:"text-xl font-bold",children:[je(ge.total_messages).display,je(ge.total_messages).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",je(ge.total_messages).exact,")"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["回复 ",je(ge.total_replies).display,je(ge.total_replies).needsExact&&e.jsxs("span",{children:["(",je(ge.total_replies).exact,")"]})," 条"]})]})]}),e.jsxs(Ve,{children:[e.jsxs(as,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(ls,{className:"text-sm font-medium",children:"成本效率"}),e.jsx(gy,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(ps,{children:[e.jsx("div",{className:"text-xl font-bold",children:ge.total_messages>0?`¥${(ge.total_cost/ge.total_messages*100).toFixed(2)}`:"¥0.00"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"每100条消息"})]})]})]}),e.jsxs(ka,{defaultValue:"trends",className:"space-y-4",children:[e.jsxs(xa,{className:"grid w-full grid-cols-2 sm:grid-cols-4",children:[e.jsx(ts,{value:"trends",children:"趋势"}),e.jsx(ts,{value:"models",children:"模型"}),e.jsx(ts,{value:"activity",children:"活动"}),e.jsx(ts,{value:"daily",children:"日统计"})]}),e.jsxs(Ms,{value:"trends",className:"space-y-4",children:[e.jsxs(Ve,{children:[e.jsxs(as,{children:[e.jsx(ls,{children:"请求趋势"}),e.jsxs(st,{children:["最近",h,"小时的请求量变化"]})]}),e.jsx(ps,{children:e.jsx(ni,{config:re,className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:e.jsxs(HN,{data:Q,children:[e.jsx(Ic,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Qc,{dataKey:"timestamp",tickFormatter:k=>D(k),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(cr,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(dr,{content:e.jsx(ii,{labelFormatter:k=>D(k)})}),e.jsx($N,{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(Ve,{children:[e.jsxs(as,{children:[e.jsx(ls,{children:"花费趋势"}),e.jsx(st,{children:"API调用成本变化"})]}),e.jsx(ps,{children:e.jsx(ni,{config:re,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:e.jsxs(Au,{data:Q,children:[e.jsx(Ic,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Qc,{dataKey:"timestamp",tickFormatter:k=>D(k),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(cr,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(dr,{content:e.jsx(ii,{labelFormatter:k=>D(k)})}),e.jsx(Yc,{dataKey:"cost",fill:"var(--color-cost)"})]})})})]}),e.jsxs(Ve,{children:[e.jsxs(as,{children:[e.jsx(ls,{children:"Token消耗"}),e.jsx(st,{children:"Token使用量变化"})]}),e.jsx(ps,{children:e.jsx(ni,{config:re,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:e.jsxs(Au,{data:Q,children:[e.jsx(Ic,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Qc,{dataKey:"timestamp",tickFormatter:k=>D(k),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(cr,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(dr,{content:e.jsx(ii,{labelFormatter:k=>D(k)})}),e.jsx(Yc,{dataKey:"tokens",fill:"var(--color-tokens)"})]})})})]})]})]}),e.jsx(Ms,{value:"models",className:"space-y-4",children:e.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[e.jsxs(Ve,{children:[e.jsxs(as,{children:[e.jsx(ls,{children:"模型请求分布"}),e.jsxs(st,{children:["各模型使用占比 (共 ",M.length," 个模型)"]})]}),e.jsx(ps,{children:e.jsx(ni,{config:Object.fromEntries(M.map((k,ne)=>[k.model_name,{label:k.model_name,color:Y[ne]}])),className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:e.jsxs(qN,{children:[e.jsx(dr,{content:e.jsx(ii,{})}),e.jsx(GN,{data:K,cx:"50%",cy:"50%",labelLine:!1,label:({name:k,percent:ne})=>ne&&ne<.05?"":`${k} ${ne?(ne*100).toFixed(0):0}%`,outerRadius:100,dataKey:"value",children:K.map((k,ne)=>e.jsx(FN,{fill:k.fill},`cell-${ne}`))})]})})})]}),e.jsxs(Ve,{children:[e.jsxs(as,{children:[e.jsx(ls,{children:"模型详细统计"}),e.jsx(st,{children:"请求数、花费和性能"})]}),e.jsx(ps,{children:e.jsx(Ze,{className:"h-[300px] sm:h-[400px]",children:e.jsx("div",{className:"space-y-3",children:M.map((k,ne)=>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:k.model_name}),e.jsx("div",{className:"w-3 h-3 rounded-full ml-2 flex-shrink-0",style:{backgroundColor:`hsl(var(--chart-${ne%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:k.request_count.toLocaleString()})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"花费:"}),e.jsxs("span",{className:"ml-1 font-medium",children:["¥",k.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:[(k.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:[k.avg_response_time.toFixed(2),"s"]})]})]})]},ne))})})})]})]})}),e.jsx(Ms,{value:"activity",children:e.jsxs(Ve,{children:[e.jsxs(as,{children:[e.jsx(ls,{children:"最近活动"}),e.jsx(st,{children:"最新的API调用记录"})]}),e.jsx(ps,{children:e.jsx(Ze,{className:"h-[400px] sm:h-[500px]",children:e.jsx("div",{className:"space-y-2",children:ve.map((k,ne)=>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:k.model}),e.jsx("div",{className:"text-xs text-muted-foreground",children:k.request_type})]}),e.jsx("div",{className:"text-xs text-muted-foreground flex-shrink-0",children:D(k.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:k.tokens})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"花费:"}),e.jsxs("span",{className:"ml-1",children:["¥",k.cost.toFixed(4)]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"耗时:"}),e.jsxs("span",{className:"ml-1",children:[k.time_cost.toFixed(2),"s"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"状态:"}),e.jsx("span",{className:`ml-1 ${k.status==="success"?"text-green-600":"text-red-600"}`,children:k.status})]})]})]},ne))})})})]})}),e.jsx(Ms,{value:"daily",children:e.jsxs(Ve,{children:[e.jsxs(as,{children:[e.jsx(ls,{children:"每日统计"}),e.jsx(st,{children:"最近7天的数据汇总"})]}),e.jsx(ps,{children:e.jsx(ni,{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(Au,{data:fe,children:[e.jsx(Ic,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Qc,{dataKey:"timestamp",tickFormatter:k=>{const ne=new Date(k);return`${ne.getMonth()+1}/${ne.getDate()}`},stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(cr,{yAxisId:"left",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(cr,{yAxisId:"right",orientation:"right",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(dr,{content:e.jsx(ii,{labelFormatter:k=>new Date(k).toLocaleDateString("zh-CN")})}),e.jsx(D0,{content:e.jsx(Yg,{})}),e.jsx(Yc,{yAxisId:"left",dataKey:"requests",fill:"var(--color-requests)"}),e.jsx(Yc,{yAxisId:"right",dataKey:"cost",fill:"var(--color-cost)"})]})})})]})})]})]})})}const F0={theme:"system",setTheme:()=>null},Kg=m.createContext(F0),im=()=>{const l=m.useContext(Kg);if(l===void 0)throw new Error("useTheme must be used within a ThemeProvider");return l},V0=(l,i,r)=>{const o=document.documentElement.classList.contains("no-animations");if(!document.startViewTransition||o){i(l);return}const u=r.clientX,x=r.clientY,h=Math.hypot(Math.max(u,innerWidth-u),Math.max(x,innerHeight-x));document.startViewTransition(()=>{i(l)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${u}px ${x}px)`,`circle(${h}px at ${u}px ${x}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},Xg=m.createContext(void 0),Jg=()=>{const l=m.useContext(Xg);if(l===void 0)throw new Error("useAnimation must be used within an AnimationProvider");return l},Fe=m.forwardRef(({className:l,...i},r)=>e.jsx(Xp,{className:H("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",l),...i,ref:r,children:e.jsx(NN,{className:H("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Fe.displayName=Xp.displayName;const I0=xi("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),C=m.forwardRef(({className:l,...i},r)=>e.jsx(og,{ref:r,className:H(I0(),l),...i}));C.displayName=og.displayName;const ie=m.forwardRef(({className:l,type:i,...r},o)=>e.jsx("input",{type:i,className:H("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",l),ref:o,...r}));ie.displayName="Input";const Q0=[{id:"minLength",label:"长度至少 10 位",description:"Token 长度必须大于等于 10 个字符",validate:l=>l.length>=10},{id:"hasUppercase",label:"包含大写字母",description:"至少包含一个大写字母 (A-Z)",validate:l=>/[A-Z]/.test(l)},{id:"hasLowercase",label:"包含小写字母",description:"至少包含一个小写字母 (a-z)",validate:l=>/[a-z]/.test(l)},{id:"hasSpecialChar",label:"包含特殊符号",description:"至少包含一个特殊符号 (!@#$%^&*()_+-=[]{}|;:,.<>?/)",validate:l=>/[!@#$%^&*()_+\-=[\]{}|;:,.<>?/]/.test(l)}];function Y0(l){const i=Q0.map(o=>({id:o.id,label:o.label,description:o.description,passed:o.validate(l)}));return{isValid:i.every(o=>o.passed),rules:i}}const xo="0.12.0 Beta",rm="MaiBot Dashboard",K0=`${rm} v${xo}`,X0=(l="v")=>`${l}${xo}`,ea={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"},Va={theme:"system",accentColor:"blue",enableAnimations:!0,enableWavesBackground:!0,logCacheSize:1e3,logAutoScroll:!0,logFontSize:"xs",logLineSpacing:4,dataSyncInterval:30,wsReconnectInterval:3e3,wsMaxReconnectAttempts:10};function dt(l){const i=Pg(l),r=localStorage.getItem(i);if(r===null)return Va[l];const o=Va[l];if(typeof o=="boolean")return r==="true";if(typeof o=="number"){const u=parseFloat(r);return isNaN(u)?o:u}return r}function ri(l,i){const r=Pg(l);localStorage.setItem(r,String(i)),window.dispatchEvent(new CustomEvent("maibot-settings-change",{detail:{key:l,value:i}}))}function J0(){return{theme:dt("theme"),accentColor:dt("accentColor"),enableAnimations:dt("enableAnimations"),enableWavesBackground:dt("enableWavesBackground"),logCacheSize:dt("logCacheSize"),logAutoScroll:dt("logAutoScroll"),logFontSize:dt("logFontSize"),logLineSpacing:dt("logLineSpacing"),dataSyncInterval:dt("dataSyncInterval"),wsReconnectInterval:dt("wsReconnectInterval"),wsMaxReconnectAttempts:dt("wsMaxReconnectAttempts")}}function P0(){const l=J0(),i=localStorage.getItem(ea.COMPLETED_TOURS),r=i?JSON.parse(i):[];return{...l,completedTours:r}}function Z0(l){const i=[],r=[];for(const[o,u]of Object.entries(l)){if(o==="completedTours"){Array.isArray(u)?(localStorage.setItem(ea.COMPLETED_TOURS,JSON.stringify(u)),i.push("completedTours")):r.push("completedTours");continue}if(o in Va){const x=o,h=Va[x];if(typeof u==typeof h){if(x==="theme"&&!["light","dark","system"].includes(u)){r.push(o);continue}if(x==="logFontSize"&&!["xs","sm","base"].includes(u)){r.push(o);continue}ri(x,u),i.push(o)}else r.push(o)}else r.push(o)}return{success:i.length>0,imported:i,skipped:r}}function W0(){for(const l of Object.keys(Va))ri(l,Va[l]);localStorage.removeItem(ea.COMPLETED_TOURS),window.dispatchEvent(new CustomEvent("maibot-settings-reset"))}function ew(){const l=[],i=[],r=[];for(let o=0;oo.size-r.size),{used:l,items:localStorage.length,details:i}}function sw(l){if(l===0)return"0 B";const i=1024,r=["B","KB","MB"],o=Math.floor(Math.log(l)/Math.log(i));return parseFloat((l/Math.pow(i,o)).toFixed(2))+" "+r[o]}function Pg(l){return{theme:ea.THEME,accentColor:ea.ACCENT_COLOR,enableAnimations:ea.ENABLE_ANIMATIONS,enableWavesBackground:ea.ENABLE_WAVES_BACKGROUND,logCacheSize:ea.LOG_CACHE_SIZE,logAutoScroll:ea.LOG_AUTO_SCROLL,logFontSize:ea.LOG_FONT_SIZE,logLineSpacing:ea.LOG_LINE_SPACING,dataSyncInterval:ea.DATA_SYNC_INTERVAL,wsReconnectInterval:ea.WS_RECONNECT_INTERVAL,wsMaxReconnectAttempts:ea.WS_MAX_RECONNECT_ATTEMPTS}[l]}const Ca=m.forwardRef(({className:l,...i},r)=>e.jsxs(Jp,{ref:r,className:H("relative flex w-full touch-none select-none items-center",l),...i,children:[e.jsx(yN,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:e.jsx(wN,{className:"absolute h-full bg-primary"})}),e.jsx(_N,{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"})]}));Ca.displayName=Jp.displayName;class tw{ws=null;reconnectTimeout=null;reconnectAttempts=0;heartbeatInterval=null;logCallbacks=new Set;connectionCallbacks=new Set;isConnected=!1;logCache=[];getMaxCacheSize(){return dt("logCacheSize")}getMaxReconnectAttempts(){return dt("wsMaxReconnectAttempts")}getReconnectInterval(){return dt("wsReconnectInterval")}getWebSocketUrl(){{const i=window.location.protocol==="https:"?"wss:":"ws:",r=window.location.host;return`${i}//${r}/ws/logs`}}connect(){if(this.ws?.readyState===WebSocket.OPEN||this.ws?.readyState===WebSocket.CONNECTING)return;const i=this.getWebSocketUrl();try{this.ws=new WebSocket(i),this.ws.onopen=()=>{this.isConnected=!0,this.reconnectAttempts=0,this.notifyConnection(!0),this.startHeartbeat()},this.ws.onmessage=r=>{try{if(r.data==="pong")return;const o=JSON.parse(r.data);this.notifyLog(o)}catch(o){console.error("解析日志消息失败:",o)}},this.ws.onerror=r=>{console.error("❌ WebSocket 错误:",r),this.isConnected=!1,this.notifyConnection(!1)},this.ws.onclose=()=>{this.isConnected=!1,this.notifyConnection(!1),this.stopHeartbeat(),this.attemptReconnect()}}catch(r){console.error("创建 WebSocket 连接失败:",r),this.attemptReconnect()}}attemptReconnect(){const i=this.getMaxReconnectAttempts();if(this.reconnectAttempts>=i)return;this.reconnectAttempts+=1;const r=this.getReconnectInterval(),o=Math.min(r*this.reconnectAttempts,3e4);this.reconnectTimeout=window.setTimeout(()=>{this.connect()},o)}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(i){return this.logCallbacks.add(i),()=>this.logCallbacks.delete(i)}onConnectionChange(i){return this.connectionCallbacks.add(i),i(this.isConnected),()=>this.connectionCallbacks.delete(i)}notifyLog(i){if(!this.logCache.some(o=>o.id===i.id)){this.logCache.push(i);const o=this.getMaxCacheSize();this.logCache.length>o&&(this.logCache=this.logCache.slice(-o)),this.logCallbacks.forEach(u=>{try{u(i)}catch(x){console.error("日志回调执行失败:",x)}})}}notifyConnection(i){this.connectionCallbacks.forEach(r=>{try{r(i)}catch(o){console.error("连接状态回调执行失败:",o)}})}getAllLogs(){return[...this.logCache]}clearLogs(){this.logCache=[]}getConnectionStatus(){return this.isConnected}}const hn=new tw;typeof window<"u"&&hn.connect();const Gs=YN,cm=KN,aw=IN,Zg=m.forwardRef(({className:l,...i},r)=>e.jsx(dg,{ref:r,className:H("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",l),...i}));Zg.displayName=dg.displayName;const Us=m.forwardRef(({className:l,children:i,preventOutsideClose:r=!1,...o},u)=>e.jsxs(aw,{children:[e.jsx(Zg,{}),e.jsxs(ug,{ref:u,className:H("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",l),onPointerDownOutside:r?x=>x.preventDefault():void 0,onInteractOutside:r?x=>x.preventDefault():void 0,...o,children:[i,e.jsxs(QN,{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(gl,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Us.displayName=ug.displayName;const Bs=({className:l,...i})=>e.jsx("div",{className:H("flex flex-col space-y-1.5 text-center sm:text-left",l),...i});Bs.displayName="DialogHeader";const tt=({className:l,...i})=>e.jsx("div",{className:H("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",l),...i});tt.displayName="DialogFooter";const Hs=m.forwardRef(({className:l,...i},r)=>e.jsx(mg,{ref:r,className:H("text-lg font-semibold leading-none tracking-tight",l),...i}));Hs.displayName=mg.displayName;const Ws=m.forwardRef(({className:l,...i},r)=>e.jsx(xg,{ref:r,className:H("text-sm text-muted-foreground",l),...i}));Ws.displayName=xg.displayName;const ms=CN,ut=kN,lw=SN,Wg=m.forwardRef(({className:l,...i},r)=>e.jsx(Pp,{className:H("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",l),...i,ref:r}));Wg.displayName=Pp.displayName;const ns=m.forwardRef(({className:l,...i},r)=>e.jsxs(lw,{children:[e.jsx(Wg,{}),e.jsx(Zp,{ref:r,className:H("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",l),...i})]}));ns.displayName=Zp.displayName;const is=({className:l,...i})=>e.jsx("div",{className:H("flex flex-col space-y-2 text-center sm:text-left",l),...i});is.displayName="AlertDialogHeader";const rs=({className:l,...i})=>e.jsx("div",{className:H("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",l),...i});rs.displayName="AlertDialogFooter";const cs=m.forwardRef(({className:l,...i},r)=>e.jsx(Wp,{ref:r,className:H("text-lg font-semibold",l),...i}));cs.displayName=Wp.displayName;const os=m.forwardRef(({className:l,...i},r)=>e.jsx(eg,{ref:r,className:H("text-sm text-muted-foreground",l),...i}));os.displayName=eg.displayName;const ds=m.forwardRef(({className:l,...i},r)=>e.jsx(sg,{ref:r,className:H(Nr(),l),...i}));ds.displayName=sg.displayName;const us=m.forwardRef(({className:l,...i},r)=>e.jsx(tg,{ref:r,className:H(Nr({variant:"outline"}),"mt-2 sm:mt-0",l),...i}));us.displayName=tg.displayName;function nw(){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(ka,{defaultValue:"appearance",className:"w-full",children:[e.jsxs(xa,{className:"grid w-full grid-cols-2 sm:grid-cols-4 gap-0.5 sm:gap-1 h-auto p-1",children:[e.jsxs(ts,{value:"appearance",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(jy,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"外观"})]}),e.jsxs(ts,{value:"security",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(vy,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"安全"})]}),e.jsxs(ts,{value:"other",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(hi,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"其他"})]}),e.jsxs(ts,{value:"about",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(Ia,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"关于"})]})]}),e.jsxs(Ze,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[e.jsx(Ms,{value:"appearance",className:"mt-0",children:e.jsx(iw,{})}),e.jsx(Ms,{value:"security",className:"mt-0",children:e.jsx(rw,{})}),e.jsx(Ms,{value:"other",className:"mt-0",children:e.jsx(cw,{})}),e.jsx(Ms,{value:"about",className:"mt-0",children:e.jsx(ow,{})})]})]})]})}function wp(l){const i=document.documentElement,o={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[l];if(o)i.style.setProperty("--primary",o.hsl),o.gradient?(i.style.setProperty("--primary-gradient",o.gradient),i.classList.add("has-gradient")):(i.style.removeProperty("--primary-gradient"),i.classList.remove("has-gradient"));else if(l.startsWith("#")){const u=x=>{x=x.replace("#","");const h=parseInt(x.substring(0,2),16)/255,p=parseInt(x.substring(2,4),16)/255,g=parseInt(x.substring(4,6),16)/255,v=Math.max(h,p,g),j=Math.min(h,p,g);let N=0,y=0;const S=(v+j)/2;if(v!==j){const w=v-j;switch(y=S>.5?w/(2-v-j):w/(v+j),v){case h:N=((p-g)/w+(plocalStorage.getItem("accent-color")||"blue");m.useEffect(()=>{const v=localStorage.getItem("accent-color")||"blue";wp(v)},[]);const g=v=>{p(v),localStorage.setItem("accent-color",v),wp(v)};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($u,{value:"light",current:l,onChange:i,label:"浅色",description:"始终使用浅色主题"}),e.jsx($u,{value:"dark",current:l,onChange:i,label:"深色",description:"始终使用深色主题"}),e.jsx($u,{value:"system",current:l,onChange:i,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(Sa,{value:"blue",current:h,onChange:g,label:"蓝色",colorClass:"bg-blue-500"}),e.jsx(Sa,{value:"purple",current:h,onChange:g,label:"紫色",colorClass:"bg-purple-500"}),e.jsx(Sa,{value:"green",current:h,onChange:g,label:"绿色",colorClass:"bg-green-500"}),e.jsx(Sa,{value:"orange",current:h,onChange:g,label:"橙色",colorClass:"bg-orange-500"}),e.jsx(Sa,{value:"pink",current:h,onChange:g,label:"粉色",colorClass:"bg-pink-500"}),e.jsx(Sa,{value:"red",current:h,onChange:g,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(Sa,{value:"gradient-sunset",current:h,onChange:g,label:"日落",colorClass:"bg-gradient-to-r from-orange-500 to-pink-500"}),e.jsx(Sa,{value:"gradient-ocean",current:h,onChange:g,label:"海洋",colorClass:"bg-gradient-to-r from-blue-500 to-cyan-500"}),e.jsx(Sa,{value:"gradient-forest",current:h,onChange:g,label:"森林",colorClass:"bg-gradient-to-r from-green-500 to-emerald-500"}),e.jsx(Sa,{value:"gradient-aurora",current:h,onChange:g,label:"极光",colorClass:"bg-gradient-to-r from-purple-500 to-pink-500"}),e.jsx(Sa,{value:"gradient-fire",current:h,onChange:g,label:"烈焰",colorClass:"bg-gradient-to-r from-red-500 to-orange-500"}),e.jsx(Sa,{value:"gradient-twilight",current:h,onChange:g,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:v=>g(v.target.value),className:"h-10 sm:h-12 w-full rounded-lg border-2 border-border cursor-pointer",title:"选择自定义颜色"})}),e.jsx("div",{className:"flex-1",children:e.jsx(ie,{type:"text",value:h,onChange:v=>g(v.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(C,{htmlFor:"animations",className:"text-base font-medium cursor-pointer",children:"启用动画效果"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后将禁用所有过渡动画和特效,提升性能"})]}),e.jsx(Fe,{id:"animations",checked:r,onCheckedChange:o})]})}),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(C,{htmlFor:"waves-background",className:"text-base font-medium cursor-pointer",children:"登录页波浪背景"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后登录页将使用纯色背景,适合低性能设备"})]}),e.jsx(Fe,{id:"waves-background",checked:u,onCheckedChange:x})]})})]})]})]})}function rw(){const l=Ea(),[i,r]=m.useState(""),[o,u]=m.useState(""),[x,h]=m.useState(!1),[p,g]=m.useState(!1),[v,j]=m.useState(!1),[N,y]=m.useState(!1),[S,w]=m.useState(!1),[R,O]=m.useState(!1),[U,G]=m.useState(""),[L,T]=m.useState(!1),{toast:F}=Vs(),q=m.useMemo(()=>Y0(o),[o]),z=async be=>{if(!i){F({title:"无法复制",description:"Token 存储在安全 Cookie 中,请重新生成以获取新 Token",variant:"destructive"});return}try{await navigator.clipboard.writeText(be),w(!0),F({title:"复制成功",description:"Token 已复制到剪贴板"}),setTimeout(()=>w(!1),2e3)}catch{F({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},M=async()=>{if(!o.trim()){F({title:"输入错误",description:"请输入新的 Token",variant:"destructive"});return}if(!q.isValid){const be=q.rules.filter(je=>!je.passed).map(je=>je.label).join(", ");F({title:"格式错误",description:`Token 不符合要求: ${be}`,variant:"destructive"});return}j(!0);try{const be=await fetch("/api/webui/auth/update",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({new_token:o.trim()})}),je=await be.json();be.ok&&je.success?(u(""),r(o.trim()),F({title:"更新成功",description:"Access Token 已更新,即将跳转到登录页"}),setTimeout(()=>{l({to:"/auth"})},1500)):F({title:"更新失败",description:je.message||"无法更新 Token",variant:"destructive"})}catch(be){console.error("更新 Token 错误:",be),F({title:"更新失败",description:"连接服务器失败",variant:"destructive"})}finally{j(!1)}},Q=async()=>{y(!0);try{const be=await fetch("/api/webui/auth/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"}),je=await be.json();be.ok&&je.success?(r(je.token),G(je.token),O(!0),T(!1),F({title:"生成成功",description:"新的 Access Token 已生成,请及时保存"})):F({title:"生成失败",description:je.message||"无法生成新 Token",variant:"destructive"})}catch(be){console.error("生成 Token 错误:",be),F({title:"生成失败",description:"连接服务器失败",variant:"destructive"})}finally{y(!1)}},fe=async()=>{try{await navigator.clipboard.writeText(U),T(!0),F({title:"复制成功",description:"Token 已复制到剪贴板"})}catch{F({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},ve=()=>{O(!1),setTimeout(()=>{G(""),T(!1)},300),setTimeout(()=>{l({to:"/auth"})},500)},ge=be=>{be||ve()};return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsx(Gs,{open:R,onOpenChange:ge,children:e.jsxs(Us,{className:"sm:max-w-md",children:[e.jsxs(Bs,{children:[e.jsxs(Hs,{className:"flex items-center gap-2",children:[e.jsx(La,{className:"h-5 w-5 text-yellow-500"}),"新的 Access Token"]}),e.jsx(Ws,{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(C,{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:U})]}),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(La,{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(tt,{className:"gap-2 sm:gap-0",children:[e.jsx(_,{variant:"outline",onClick:fe,className:"gap-2",children:L?e.jsxs(e.Fragment,{children:[e.jsx(sa,{className:"h-4 w-4 text-green-500"}),"已复制"]}):e.jsxs(e.Fragment,{children:[e.jsx(no,{className:"h-4 w-4"}),"复制 Token"]})}),e.jsx(_,{onClick:ve,children:"我已保存,关闭"})]})]})}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"当前 Access Token"}),e.jsx("div",{className:"space-y-3 sm:space-y-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"current-token",className:"text-sm",children:"您的访问令牌"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(ie,{id:"current-token",type:x?"text":"password",value:i||"••••••••••••••••••••••••••••••••",readOnly:!0,className:"pr-10 font-mono text-sm",placeholder:"Token 存储在安全 Cookie 中"}),e.jsx("button",{onClick:()=>{i?h(!x):F({title:"无法查看",description:'Token 存储在安全 Cookie 中,如需新 Token 请点击"重新生成"'})},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:x?"隐藏":"显示",children:x?e.jsx(vr,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(Qt,{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:()=>z(i),title:"复制到剪贴板",className:"flex-shrink-0",disabled:!i,children:S?e.jsx(sa,{className:"h-4 w-4 text-green-500"}):e.jsx(no,{className:"h-4 w-4"})}),e.jsxs(ms,{children:[e.jsx(ut,{asChild:!0,children:e.jsxs(_,{variant:"outline",disabled:N,className:"gap-2 flex-1 sm:flex-none",children:[e.jsx(qt,{className:H("h-4 w-4",N&&"animate-spin")}),e.jsx("span",{className:"hidden sm:inline",children:"重新生成"}),e.jsx("span",{className:"sm:hidden",children:"生成"})]})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认重新生成 Token"}),e.jsx(os,{children:"这将生成一个新的 64 位安全令牌,并使当前 Token 立即失效。 您需要使用新 Token 重新登录系统。此操作不可撤销,确定要继续吗?"})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:Q,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(C,{htmlFor:"new-token",className:"text-sm",children:"新的访问令牌"}),e.jsxs("div",{className:"relative",children:[e.jsx(ie,{id:"new-token",type:p?"text":"password",value:o,onChange:be=>u(be.target.value),className:"pr-10 font-mono text-sm",placeholder:"输入自定义 Token"}),e.jsx("button",{onClick:()=>g(!p),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:p?"隐藏":"显示",children:p?e.jsx(vr,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(Qt,{className:"h-4 w-4 text-muted-foreground"})})]}),o&&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:q.rules.map(be=>e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[be.passed?e.jsx(ma,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):e.jsx(zg,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:H(be.passed?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:be.label})]},be.id))}),q.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(sa,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:"Token 格式正确,可以使用"})]})})]})]}),e.jsx(_,{onClick:M,disabled:v||!q.isValid||!o,className:"w-full sm:w-auto",children:v?"更新中...":"更新自定义 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 cw(){const l=Ea(),{toast:i}=Vs(),[r,o]=m.useState(!1),[u,x]=m.useState(!1),[h,p]=m.useState(()=>dt("logCacheSize")),[g,v]=m.useState(()=>dt("wsReconnectInterval")),[j,N]=m.useState(()=>dt("wsMaxReconnectAttempts")),[y,S]=m.useState(()=>dt("dataSyncInterval")),[w,R]=m.useState(()=>yp()),[O,U]=m.useState(!1),[G,L]=m.useState(!1),T=m.useRef(null);if(u)throw new Error("这是一个手动触发的测试错误,用于验证错误边界组件是否正常工作。");const F=()=>{R(yp())},q=D=>{const Y=D[0];p(Y),ri("logCacheSize",Y)},z=D=>{const Y=D[0];v(Y),ri("wsReconnectInterval",Y)},M=D=>{const Y=D[0];N(Y),ri("wsMaxReconnectAttempts",Y)},Q=D=>{const Y=D[0];S(Y),ri("dataSyncInterval",Y)},fe=()=>{hn.clearLogs(),i({title:"日志已清除",description:"日志缓存已清空"})},ve=()=>{const D=ew();F(),i({title:"缓存已清除",description:`已清除 ${D.clearedKeys.length} 项缓存数据`})},ge=()=>{U(!0);try{const D=P0(),Y=JSON.stringify(D,null,2),K=new Blob([Y],{type:"application/json"}),re=URL.createObjectURL(K),k=document.createElement("a");k.href=re,k.download=`maibot-webui-settings-${new Date().toISOString().slice(0,10)}.json`,document.body.appendChild(k),k.click(),document.body.removeChild(k),URL.revokeObjectURL(re),i({title:"导出成功",description:"设置已导出为 JSON 文件"})}catch(D){console.error("导出设置失败:",D),i({title:"导出失败",description:"无法导出设置",variant:"destructive"})}finally{U(!1)}},be=D=>{const Y=D.target.files?.[0];if(!Y)return;L(!0);const K=new FileReader;K.onload=re=>{try{const k=re.target?.result,ne=JSON.parse(k),xe=Z0(ne);xe.success?(p(dt("logCacheSize")),v(dt("wsReconnectInterval")),N(dt("wsMaxReconnectAttempts")),S(dt("dataSyncInterval")),F(),i({title:"导入成功",description:`成功导入 ${xe.imported.length} 项设置${xe.skipped.length>0?`,跳过 ${xe.skipped.length} 项`:""}`}),(xe.imported.includes("theme")||xe.imported.includes("accentColor"))&&i({title:"提示",description:"部分设置需要刷新页面才能完全生效"})):i({title:"导入失败",description:"没有有效的设置项可导入",variant:"destructive"})}catch(k){console.error("导入设置失败:",k),i({title:"导入失败",description:"文件格式无效",variant:"destructive"})}finally{L(!1),T.current&&(T.current.value="")}},K.readAsText(Y)},je=()=>{W0(),p(Va.logCacheSize),v(Va.wsReconnectInterval),N(Va.wsMaxReconnectAttempts),S(Va.dataSyncInterval),F(),i({title:"已重置",description:"所有设置已恢复为默认值,刷新页面以应用更改"})},Ne=async()=>{o(!0);try{const D=localStorage.getItem("access-token"),Y=await fetch("/api/webui/setup/reset",{method:"POST",headers:{Authorization:`Bearer ${D}`}}),K=await Y.json();Y.ok&&K.success?(i({title:"重置成功",description:"即将进入初次配置向导"}),setTimeout(()=>{l({to:"/setup"})},1e3)):i({title:"重置失败",description:K.message||"无法重置配置状态",variant:"destructive"})}catch(D){console.error("重置配置状态错误:",D),i({title:"重置失败",description:"连接服务器失败",variant:"destructive"})}finally{o(!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(lo,{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(by,{className:"h-4 w-4"}),"本地存储使用"]}),e.jsx(_,{variant:"ghost",size:"sm",onClick:F,className:"h-7 px-2",children:e.jsx(qt,{className:"h-3 w-3"})})]}),e.jsx("div",{className:"text-2xl font-bold text-primary",children:sw(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(C,{className:"text-sm font-medium",children:"日志缓存大小"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[h," 条"]})]}),e.jsx(Ca,{value:[h],onValueChange:q,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(C,{className:"text-sm font-medium",children:"首页数据刷新间隔"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[y," 秒"]})]}),e.jsx(Ca,{value:[y],onValueChange:Q,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(C,{className:"text-sm font-medium",children:"WebSocket 重连间隔"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[g/1e3," 秒"]})]}),e.jsx(Ca,{value:[g],onValueChange:z,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(C,{className:"text-sm font-medium",children:"WebSocket 最大重连次数"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[j," 次"]})]}),e.jsx(Ca,{value:[j],onValueChange:M,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:fe,className:"gap-2",children:[e.jsx(es,{className:"h-4 w-4"}),"清除日志缓存"]}),e.jsxs(ms,{children:[e.jsx(ut,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:"gap-2",children:[e.jsx(es,{className:"h-4 w-4"}),"清除本地缓存"]})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认清除本地缓存"}),e.jsx(os,{children:"这将清除所有本地缓存的设置和数据(不包括登录凭证)。 您可能需要重新配置部分偏好设置。确定要继续吗?"})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:ve,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(Ua,{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:ge,disabled:O,className:"gap-2",children:[e.jsx(Ua,{className:"h-4 w-4"}),O?"导出中...":"导出设置"]}),e.jsx("input",{ref:T,type:"file",accept:".json",onChange:be,className:"hidden"}),e.jsxs(_,{variant:"outline",onClick:()=>T.current?.click(),disabled:G,className:"gap-2",children:[e.jsx(br,{className:"h-4 w-4"}),G?"导入中...":"导入设置"]})]}),e.jsx("div",{className:"pt-2 border-t",children:e.jsxs(ms,{children:[e.jsx(ut,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:"gap-2 text-destructive hover:text-destructive",children:[e.jsx(ao,{className:"h-4 w-4"}),"重置所有设置为默认值"]})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认重置所有设置"}),e.jsx(os,{children:"这将把所有界面设置恢复为默认值,包括主题、颜色、动画等偏好设置。 此操作不会影响您的登录状态。确定要继续吗?"})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:je,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(ms,{children:[e.jsx(ut,{asChild:!0,children:e.jsxs(_,{variant:"outline",disabled:r,className:"gap-2",children:[e.jsx(ao,{className:H("h-4 w-4",r&&"animate-spin")}),"重新进行初次配置"]})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认重新配置"}),e.jsx(os,{children:"这将带您重新进入初次配置向导。您可以重新设置系统的基础配置项。确定要继续吗?"})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:Ne,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(La,{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(ms,{children:[e.jsx(ut,{asChild:!0,children:e.jsxs(_,{variant:"destructive",className:"gap-2",children:[e.jsx(La,{className:"h-4 w-4"}),"触发测试错误"]})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认触发错误"}),e.jsx(os,{children:"这将手动触发一个 React 错误,用于测试错误边界组件的显示效果。 页面将显示错误界面,您可以通过刷新页面或点击返回首页来恢复。"})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>x(!0),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认触发"})]})]})]})]})]})]})}function ow(){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:H("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:["关于 ",rm]}),e.jsxs("div",{className:"space-y-2 text-xs sm:text-sm text-muted-foreground",children:[e.jsxs("p",{children:["版本: ",xo]}),e.jsx("p",{children:"麦麦(MaiBot)的现代化 Web 管理界面"})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"作者"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:"MaiBot 核心"}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Mai-with-u"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:"WebUI"}),e.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground",children:["Mai-with-u ",e.jsx("a",{href:"https://github.com/DrSmoothl",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"@MotricSeven"})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"技术栈"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 text-xs sm:text-sm text-muted-foreground",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"前端框架"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"React 19.2.0"}),e.jsx("li",{children:"TypeScript 5.7.2"}),e.jsx("li",{children:"Vite 6.0.7"}),e.jsx("li",{children:"TanStack Router 1.94.2"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"UI 组件"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"shadcn/ui"}),e.jsx("li",{children:"Radix UI"}),e.jsx("li",{children:"Tailwind CSS 3.4.17"}),e.jsx("li",{children:"Lucide Icons"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"后端"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"Python 3.12+"}),e.jsx("li",{children:"FastAPI"}),e.jsx("li",{children:"Uvicorn"}),e.jsx("li",{children:"WebSocket"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"构建工具"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"Bun / npm"}),e.jsx("li",{children:"ESLint 9.17.0"}),e.jsx("li",{children:"PostCSS"})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源库感谢"}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mb-3",children:"本项目使用了以下优秀的开源库,感谢他们的贡献:"}),e.jsx(Ze,{className:"h-[300px] sm:h-[400px]",children:e.jsxs("div",{className:"space-y-4 pr-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"UI 框架与组件"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(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:l,description:i,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:l}),e.jsx("p",{className:"text-muted-foreground text-xs mt-0.5",children:i})]}),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 $u({value:l,current:i,onChange:r,label:o,description:u}){const x=i===l;return e.jsxs("button",{onClick:()=>r(l),className:H("relative rounded-lg border-2 p-3 sm:p-4 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",x?"border-primary bg-accent":"border-border"),children:[x&&e.jsx("div",{className:"absolute top-2 right-2 sm:top-3 sm:right-3 h-2 w-2 rounded-full bg-primary"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm sm:text-base font-medium",children:o}),e.jsx("div",{className:"text-[10px] sm:text-xs text-muted-foreground",children:u})]}),e.jsxs("div",{className:"mt-2 sm:mt-3 flex gap-1",children:[l==="light"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-200"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-300"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-400"})]}),l==="dark"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-700"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-800"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-900"})]}),l==="system"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-200 to-slate-700"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-300 to-slate-800"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-400 to-slate-900"})]})]})]})}function Sa({value:l,current:i,onChange:r,label:o,colorClass:u}){const x=i===l;return e.jsxs("button",{onClick:()=>r(l),className:H("relative rounded-lg border-2 p-2 sm:p-3 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",x?"border-primary bg-accent":"border-border"),children:[x&&e.jsx("div",{className:"absolute top-1.5 right-1.5 sm:top-2 sm:right-2 h-1.5 w-1.5 sm:h-2 sm:w-2 rounded-full bg-primary"}),e.jsxs("div",{className:"flex flex-col items-center gap-1.5 sm:gap-2",children:[e.jsx("div",{className:H("h-8 w-8 sm:h-10 sm:w-10 rounded-full",u)}),e.jsx("div",{className:"text-[10px] sm:text-xs font-medium text-center",children:o})]})]})}class dw{grad3;p;perm;constructor(i=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(i,r,o){return i[0]*r+i[1]*o}mix(i,r,o){return(1-o)*i+o*r}fade(i){return i*i*i*(i*(i*6-15)+10)}perlin2(i,r){const o=Math.floor(i)&255,u=Math.floor(r)&255;i-=Math.floor(i),r-=Math.floor(r);const x=this.fade(i),h=this.fade(r),p=this.perm[o]+u,g=this.perm[p],v=this.perm[p+1],j=this.perm[o+1]+u,N=this.perm[j],y=this.perm[j+1];return this.mix(this.mix(this.dot(this.grad3[g%12],i,r),this.dot(this.grad3[N%12],i-1,r),x),this.mix(this.dot(this.grad3[v%12],i,r-1),this.dot(this.grad3[y%12],i-1,r-1),x),h)}}function _p(){const l=m.useRef(null),i=m.useRef(null),r=m.useRef(void 0),o=m.useRef({mouse:{x:-10,y:0,lx:0,ly:0,sx:0,sy:0,v:0,vs:0,a:0,set:!1},lines:[],paths:[],noise:new dw(Math.random()),bounding:null});return m.useEffect(()=>{const u=i.current,x=l.current;if(!u||!x)return;const h=o.current,p=()=>{const R=u.getBoundingClientRect();h.bounding=R,x.style.width=`${R.width}px`,x.style.height=`${R.height}px`},g=()=>{if(!h.bounding)return;const{width:R,height:O}=h.bounding;h.lines=[],h.paths.forEach(Q=>Q.remove()),h.paths=[];const U=10,G=32,L=R+200,T=O+30,F=Math.ceil(L/U),q=Math.ceil(T/G),z=(R-U*F)/2,M=(O-G*q)/2;for(let Q=0;Q<=F;Q++){const fe=[];for(let ge=0;ge<=q;ge++){const be={x:z+U*Q,y:M+G*ge,wave:{x:0,y:0},cursor:{x:0,y:0,vx:0,vy:0}};fe.push(be)}const ve=document.createElementNS("http://www.w3.org/2000/svg","path");x.appendChild(ve),h.paths.push(ve),h.lines.push(fe)}},v=R=>{const{lines:O,mouse:U,noise:G}=h;O.forEach(L=>{L.forEach(T=>{const F=G.perlin2((T.x+R*.0125)*.002,(T.y+R*.005)*.0015)*12;T.wave.x=Math.cos(F)*32,T.wave.y=Math.sin(F)*16;const q=T.x-U.sx,z=T.y-U.sy,M=Math.hypot(q,z),Q=Math.max(175,U.vs);if(M{const U={x:R.x+R.wave.x+(O?R.cursor.x:0),y:R.y+R.wave.y+(O?R.cursor.y:0)};return U.x=Math.round(U.x*10)/10,U.y=Math.round(U.y*10)/10,U},N=()=>{const{lines:R,paths:O}=h;R.forEach((U,G)=>{let L=j(U[0],!1),T=`M ${L.x} ${L.y}`;U.forEach((F,q)=>{const z=q===U.length-1;L=j(F,!z),T+=`L ${L.x} ${L.y}`}),O[G].setAttribute("d",T)})},y=R=>{const{mouse:O}=h;O.sx+=(O.x-O.sx)*.1,O.sy+=(O.y-O.sy)*.1;const U=O.x-O.lx,G=O.y-O.ly,L=Math.hypot(U,G);O.v=L,O.vs+=(L-O.vs)*.1,O.vs=Math.min(100,O.vs),O.lx=O.x,O.ly=O.y,O.a=Math.atan2(G,U),u&&(u.style.setProperty("--x",`${O.sx}px`),u.style.setProperty("--y",`${O.sy}px`)),v(R),N(),r.current=requestAnimationFrame(y)},S=R=>{if(!h.bounding)return;const{mouse:O}=h;O.x=R.pageX-h.bounding.left,O.y=R.pageY-h.bounding.top+window.scrollY,O.set||(O.sx=O.x,O.sy=O.y,O.lx=O.x,O.ly=O.y,O.set=!0)},w=()=>{p(),g()};return p(),g(),window.addEventListener("resize",w),window.addEventListener("mousemove",S),r.current=requestAnimationFrame(y),()=>{window.removeEventListener("resize",w),window.removeEventListener("mousemove",S),r.current&&cancelAnimationFrame(r.current)}},[]),e.jsxs("div",{ref:i,className:"waves-background",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"hidden",pointerEvents:"none"},children:[e.jsx("div",{className:"waves-cursor",style:{position:"absolute",top:0,left:0,width:"0.5rem",height:"0.5rem",background:"hsl(var(--primary) / 0.3)",borderRadius:"50%",transform:"translate3d(calc(var(--x, -0.5rem) - 50%), calc(var(--y, 50%) - 50%), 0)",willChange:"transform",pointerEvents:"none"}}),e.jsx("svg",{ref:l,style:{display:"block",width:"100%",height:"100%"},children:e.jsx("style",{children:` +`)}}):null},dr=KN,ii=m.forwardRef(({active:l,payload:i,className:r,indicator:o="dot",hideLabel:u=!1,hideIndicator:x=!1,label:h,labelFormatter:f,labelClassName:g,formatter:j,color:v,nameKey:N,labelKey:y},S)=>{const{config:w}=aj(),L=m.useMemo(()=>{if(u||!i?.length)return null;const[U]=i,F=`${y||U?.dataKey||U?.name||"value"}`,A=em(w,U,F),k=!y&&typeof h=="string"?w[h]?.label||h:A?.label;return f?e.jsx("div",{className:H("font-medium",g),children:f(k,i)}):k?e.jsx("div",{className:H("font-medium",g),children:k}):null},[h,f,i,u,g,w,y]);if(!l||!i?.length)return null;const O=i.length===1&&o!=="dot";return e.jsxs("div",{ref:S,className:H("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:[O?null:L,e.jsx("div",{className:"grid gap-1.5",children:i.filter(U=>U.type!=="none").map((U,F)=>{const A=`${N||U.name||U.dataKey||"value"}`,k=em(w,U,A),$=v||U.payload.fill||U.color;return e.jsx("div",{className:H("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",o==="dot"&&"items-center"),children:j&&U?.value!==void 0&&U.name?j(U.value,U.name,U,F,U.payload):e.jsxs(e.Fragment,{children:[k?.icon?e.jsx(k.icon,{}):!x&&e.jsx("div",{className:H("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":o==="dot","w-1":o==="line","w-0 border-[1.5px] border-dashed bg-transparent":o==="dashed","my-0.5":O&&o==="dashed"}),style:{"--color-bg":$,"--color-border":$}}),e.jsxs("div",{className:H("flex flex-1 justify-between leading-none",O?"items-end":"items-center"),children:[e.jsxs("div",{className:"grid gap-1.5",children:[O?L:null,e.jsx("span",{className:"text-muted-foreground",children:k?.label||U.name})]}),U.value&&e.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:U.value.toLocaleString()})]})]})},U.dataKey)})})]})});ii.displayName="ChartTooltip";const R0=XN,lj=m.forwardRef(({className:l,hideIcon:i=!1,payload:r,verticalAlign:o="bottom",nameKey:u},x)=>{const{config:h}=aj();return r?.length?e.jsx("div",{ref:x,className:H("flex items-center justify-center gap-4",o==="top"?"pb-3":"pt-3",l),children:r.filter(f=>f.type!=="none").map(f=>{const g=`${u||f.dataKey||"value"}`,j=em(h,f,g);return e.jsxs("div",{className:H("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[j?.icon&&!i?e.jsx(j.icon,{}):e.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:f.color}}),j?.label]},f.value)})}):null});lj.displayName="ChartLegend";function em(l,i,r){if(typeof i!="object"||i===null)return;const o="payload"in i&&typeof i.payload=="object"&&i.payload!==null?i.payload:void 0;let u=r;return r in i&&typeof i[r]=="string"?u=i[r]:o&&r in o&&typeof o[r]=="string"&&(u=o[r]),u in l?l[u]:l[r]}const Nr=xi("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),_=m.forwardRef(({className:l,variant:i,size:r,asChild:o=!1,...u},x)=>{const h=o?sy:"button";return e.jsx(h,{className:H(Nr({variant:i,size:r,className:l})),ref:x,...u})});_.displayName="Button";const L0=xi("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 Qe({className:l,variant:i,...r}){return e.jsx("div",{className:H(L0({variant:i}),l),...r})}const U0=5,B0=5e3;let Hu=0;function H0(){return Hu=(Hu+1)%Number.MAX_SAFE_INTEGER,Hu.toString()}const $u=new Map,Np=l=>{if($u.has(l))return;const i=setTimeout(()=>{$u.delete(l),gr({type:"REMOVE_TOAST",toastId:l})},B0);$u.set(l,i)},$0=(l,i)=>{switch(i.type){case"ADD_TOAST":return{...l,toasts:[i.toast,...l.toasts].slice(0,U0)};case"UPDATE_TOAST":return{...l,toasts:l.toasts.map(r=>r.id===i.toast.id?{...r,...i.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=i;return r?Np(r):l.toasts.forEach(o=>{Np(o.id)}),{...l,toasts:l.toasts.map(o=>o.id===r||r===void 0?{...o,open:!1}:o)}}case"REMOVE_TOAST":return i.toastId===void 0?{...l,toasts:[]}:{...l,toasts:l.toasts.filter(r=>r.id!==i.toastId)}}},so=[];let to={toasts:[]};function gr(l){to=$0(to,l),so.forEach(i=>{i(to)})}function q0({...l}){const i=H0(),r=u=>gr({type:"UPDATE_TOAST",toast:{...u,id:i}}),o=()=>gr({type:"DISMISS_TOAST",toastId:i});return gr({type:"ADD_TOAST",toast:{...l,id:i,open:!0,onOpenChange:u=>{u||o()}}}),{id:i,dismiss:o,update:r}}function Vs(){const[l,i]=m.useState(to);return m.useEffect(()=>(so.push(i),()=>{const r=so.indexOf(i);r>-1&&so.splice(r,1)}),[l]),{...l,toast:q0,dismiss:r=>gr({type:"DISMISS_TOAST",toastId:r})}}const G0=l=>{const i=[];for(let r=0;r{try{S(!0);const T=await Vc.get("https://v1.hitokoto.cn/?c=a&c=b&c=c&c=d&c=h&c=i&c=k");N({hitokoto:T.data.hitokoto,from:T.data.from||T.data.from_who||"未知"})}catch(T){console.error("获取一言失败:",T),N({hitokoto:"人生就像一盒巧克力,你永远不知道下一颗是什么味道。",from:"阿甘正传"})}finally{S(!1)}},[]),k=m.useCallback(async()=>{try{const T=localStorage.getItem("access-token"),ie=await Vc.get("/api/webui/system/status",{headers:{Authorization:`Bearer ${T}`}});L(ie.data)}catch(T){console.error("获取机器人状态失败:",T),L(null)}},[]),$=async()=>{if(!O)try{U(!0);const T=localStorage.getItem("access-token");await Vc.post("/api/webui/system/restart",{},{headers:{Authorization:`Bearer ${T}`}}),F({title:"重启中",description:"麦麦正在重启,请稍候..."}),setTimeout(()=>{k(),U(!1)},3e3)}catch(T){console.error("重启失败:",T),F({title:"重启失败",description:"无法重启麦麦,请检查控制台",variant:"destructive"}),U(!1)}},G=m.useCallback(async()=>{try{const T=localStorage.getItem("access-token"),ie=await Vc.get(`/api/webui/statistics/dashboard?hours=${h}`,{headers:{Authorization:`Bearer ${T}`}});i(ie.data),o(!1),x(100)}catch(T){console.error("Failed to fetch dashboard data:",T),o(!1),x(100)}},[h]);if(m.useEffect(()=>{if(!r)return;x(0);const T=setTimeout(()=>x(15),200),ie=setTimeout(()=>x(30),800),xe=setTimeout(()=>x(45),2e3),Ce=setTimeout(()=>x(60),4e3),_e=setTimeout(()=>x(75),6500),Me=setTimeout(()=>x(85),9e3),Z=setTimeout(()=>x(92),11e3);return()=>{clearTimeout(T),clearTimeout(ie),clearTimeout(xe),clearTimeout(Ce),clearTimeout(_e),clearTimeout(Me),clearTimeout(Z)}},[r]),m.useEffect(()=>{G(),A(),k()},[G,A,k]),m.useEffect(()=>{if(!g)return;const T=setInterval(()=>{G(),k()},3e4);return()=>clearInterval(T)},[g,G,k]),r||!l)return e.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-200px)]",children:e.jsxs("div",{className:"text-center space-y-6 w-full max-w-md px-4",children:[e.jsx(qt,{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(gi,{value:u,className:"h-2"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[u,"%"]})]})]})});const{summary:z,model_stats:M=[],hourly_data:Q=[],daily_data:fe=[],recent_activity:ve=[]}=l,ge=z??{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},be=T=>{const ie=Math.floor(T/3600),xe=Math.floor(T%3600/60);return`${ie}小时${xe}分钟`},je=T=>{const ie=T.toLocaleString("zh-CN");return T>=1e9?{display:`${(T/1e9).toFixed(2)}B`,exact:ie,needsExact:!0}:T>=1e6?{display:`${(T/1e6).toFixed(2)}M`,exact:ie,needsExact:!0}:T>=1e4?{display:`${(T/1e3).toFixed(1)}K`,exact:ie,needsExact:!0}:T>=1e3?{display:`${(T/1e3).toFixed(2)}K`,exact:ie,needsExact:!0}:{display:ie,exact:ie,needsExact:!1}},Ne=T=>{const ie=`¥${T.toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2})}`;return T>=1e6?{display:`¥${(T/1e6).toFixed(2)}M`,exact:ie,needsExact:!0}:T>=1e4?{display:`¥${(T/1e3).toFixed(1)}K`,exact:ie,needsExact:!0}:T>=1e3?{display:`¥${(T/1e3).toFixed(2)}K`,exact:ie,needsExact:!0}:{display:ie,exact:ie,needsExact:!1}},R=T=>new Date(T).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),Y=G0(M.length),K=M.map((T,ie)=>({name:T.model_name,value:T.request_count,fill:Y[ie]})),re={requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"},tokens:{label:"Tokens",color:"hsl(var(--chart-3))"}};return e.jsx(Ze,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"实时监控面板"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"麦麦运行状态和统计数据一览"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(ka,{value:h.toString(),onValueChange:T=>f(Number(T)),children:e.jsxs(xa,{className:"grid grid-cols-3 w-full sm:w-auto",children:[e.jsx(ts,{value:"24",children:"24小时"}),e.jsx(ts,{value:"168",children:"7天"}),e.jsx(ts,{value:"720",children:"30天"})]})}),e.jsxs(_,{variant:g?"default":"outline",size:"sm",onClick:()=>j(!g),className:"gap-2",children:[e.jsx(qt,{className:`h-4 w-4 ${g?"animate-spin":""}`}),e.jsx("span",{className:"hidden sm:inline",children:"自动刷新"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:G,children:e.jsx(qt,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 rounded-lg border border-dashed border-muted-foreground/30 bg-muted/20",children:[y?e.jsx(sj,{className:"h-5 flex-1"}):v?e.jsxs("p",{className:"flex-1 text-sm text-muted-foreground italic truncate",children:['"',v.hitokoto,'" —— ',v.from]}):null,e.jsx(_,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:A,disabled:y,children:e.jsx(qt,{className:`h-3.5 w-3.5 ${y?"animate-spin":""}`})})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-3",children:[e.jsxs(Fe,{className:"lg:col-span-1",children:[e.jsx(as,{className:"pb-3",children:e.jsxs(ls,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(kr,{className:"h-4 w-4"}),"麦麦状态"]})}),e.jsx(ps,{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(Qe,{variant:"outline",className:"text-green-600 border-green-300 bg-green-50",children:[e.jsx(ma,{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(Qe,{variant:"outline",className:"text-red-600 border-red-300 bg-red-50",children:[e.jsx(Gt,{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:["运行 ",be(w.uptime)]})]})]})})]}),e.jsxs(Fe,{children:[e.jsx(as,{className:"pb-3",children:e.jsxs(ls,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(fn,{className:"h-4 w-4"}),"快速操作"]})}),e.jsx(ps,{children:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:$,disabled:O,className:"gap-2",children:[e.jsx(ao,{className:`h-4 w-4 ${O?"animate-spin":""}`}),O?"重启中...":"重启麦麦"]}),e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(li,{to:"/logs",children:[e.jsx(Ra,{className:"h-4 w-4"}),"查看日志"]})}),e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(li,{to:"/plugins",children:[e.jsx(_y,{className:"h-4 w-4"}),"插件管理"]})}),e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(li,{to:"/settings",children:[e.jsx(hi,{className:"h-4 w-4"}),"系统设置"]})})]})})]}),e.jsxs(Fe,{children:[e.jsxs(as,{className:"pb-3",children:[e.jsxs(ls,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Sy,{className:"h-4 w-4"}),"反馈问卷"]}),e.jsx(st,{className:"text-xs",children:"帮助我们改进产品体验"})]}),e.jsx(ps,{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(li,{to:"/survey/webui-feedback",children:[e.jsx(Ra,{className:"h-4 w-4"}),"WebUI 反馈"]})}),e.jsx(_,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(li,{to:"/survey/maibot-feedback",children:[e.jsx(Yl,{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(Fe,{children:[e.jsxs(as,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(ls,{className:"text-sm font-medium",children:"总请求数"}),e.jsx(Cy,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(ps,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[je(ge.total_requests).display,je(ge.total_requests).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",je(ge.total_requests).exact,")"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["最近",h<48?h+"小时":Math.floor(h/24)+"天"]})]})]}),e.jsxs(Fe,{children:[e.jsxs(as,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(ls,{className:"text-sm font-medium",children:"总花费"}),e.jsx(ky,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(ps,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[Ne(ge.total_cost).display,Ne(ge.total_cost).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",Ne(ge.total_cost).exact,")"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:ge.cost_per_hour>0?`¥${ge.cost_per_hour.toFixed(2)}/小时`:"暂无数据"})]})]}),e.jsxs(Fe,{children:[e.jsxs(as,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(ls,{className:"text-sm font-medium",children:"Token消耗"}),e.jsx(lo,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(ps,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[je(ge.total_tokens).display,je(ge.total_tokens).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",je(ge.total_tokens).exact,")"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:ge.tokens_per_hour>0?`${je(ge.tokens_per_hour).display}/小时`:"暂无数据"})]})]}),e.jsxs(Fe,{children:[e.jsxs(as,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(ls,{className:"text-sm font-medium",children:"平均响应"}),e.jsx(fn,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(ps,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[ge.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(Fe,{children:[e.jsxs(as,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(ls,{className:"text-sm font-medium",children:"在线时长"}),e.jsx(oi,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(ps,{children:e.jsxs("div",{className:"text-xl font-bold",children:[be(ge.online_time),e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",ge.online_time.toLocaleString(),"秒)"]})]})})]}),e.jsxs(Fe,{children:[e.jsxs(as,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(ls,{className:"text-sm font-medium",children:"消息处理"}),e.jsx(Yl,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(ps,{children:[e.jsxs("div",{className:"text-xl font-bold",children:[je(ge.total_messages).display,je(ge.total_messages).needsExact&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground ml-1",children:["(",je(ge.total_messages).exact,")"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["回复 ",je(ge.total_replies).display,je(ge.total_replies).needsExact&&e.jsxs("span",{children:["(",je(ge.total_replies).exact,")"]})," 条"]})]})]}),e.jsxs(Fe,{children:[e.jsxs(as,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(ls,{className:"text-sm font-medium",children:"成本效率"}),e.jsx(Ty,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(ps,{children:[e.jsx("div",{className:"text-xl font-bold",children:ge.total_messages>0?`¥${(ge.total_cost/ge.total_messages*100).toFixed(2)}`:"¥0.00"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"每100条消息"})]})]})]}),e.jsxs(ka,{defaultValue:"trends",className:"space-y-4",children:[e.jsxs(xa,{className:"grid w-full grid-cols-2 sm:grid-cols-4",children:[e.jsx(ts,{value:"trends",children:"趋势"}),e.jsx(ts,{value:"models",children:"模型"}),e.jsx(ts,{value:"activity",children:"活动"}),e.jsx(ts,{value:"daily",children:"日统计"})]}),e.jsxs(Ms,{value:"trends",className:"space-y-4",children:[e.jsxs(Fe,{children:[e.jsxs(as,{children:[e.jsx(ls,{children:"请求趋势"}),e.jsxs(st,{children:["最近",h,"小时的请求量变化"]})]}),e.jsx(ps,{children:e.jsx(ni,{config:re,className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:e.jsxs(JN,{data:Q,children:[e.jsx(Ic,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Qc,{dataKey:"timestamp",tickFormatter:T=>R(T),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(cr,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(dr,{content:e.jsx(ii,{labelFormatter:T=>R(T)})}),e.jsx(PN,{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(Fe,{children:[e.jsxs(as,{children:[e.jsx(ls,{children:"花费趋势"}),e.jsx(st,{children:"API调用成本变化"})]}),e.jsx(ps,{children:e.jsx(ni,{config:re,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:e.jsxs(Ou,{data:Q,children:[e.jsx(Ic,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Qc,{dataKey:"timestamp",tickFormatter:T=>R(T),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(cr,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(dr,{content:e.jsx(ii,{labelFormatter:T=>R(T)})}),e.jsx(Yc,{dataKey:"cost",fill:"var(--color-cost)"})]})})})]}),e.jsxs(Fe,{children:[e.jsxs(as,{children:[e.jsx(ls,{children:"Token消耗"}),e.jsx(st,{children:"Token使用量变化"})]}),e.jsx(ps,{children:e.jsx(ni,{config:re,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:e.jsxs(Ou,{data:Q,children:[e.jsx(Ic,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Qc,{dataKey:"timestamp",tickFormatter:T=>R(T),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(cr,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(dr,{content:e.jsx(ii,{labelFormatter:T=>R(T)})}),e.jsx(Yc,{dataKey:"tokens",fill:"var(--color-tokens)"})]})})})]})]})]}),e.jsx(Ms,{value:"models",className:"space-y-4",children:e.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[e.jsxs(Fe,{children:[e.jsxs(as,{children:[e.jsx(ls,{children:"模型请求分布"}),e.jsxs(st,{children:["各模型使用占比 (共 ",M.length," 个模型)"]})]}),e.jsx(ps,{children:e.jsx(ni,{config:Object.fromEntries(M.map((T,ie)=>[T.model_name,{label:T.model_name,color:Y[ie]}])),className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:e.jsxs(ZN,{children:[e.jsx(dr,{content:e.jsx(ii,{})}),e.jsx(WN,{data:K,cx:"50%",cy:"50%",labelLine:!1,label:({name:T,percent:ie})=>ie&&ie<.05?"":`${T} ${ie?(ie*100).toFixed(0):0}%`,outerRadius:100,dataKey:"value",children:K.map((T,ie)=>e.jsx(ey,{fill:T.fill},`cell-${ie}`))})]})})})]}),e.jsxs(Fe,{children:[e.jsxs(as,{children:[e.jsx(ls,{children:"模型详细统计"}),e.jsx(st,{children:"请求数、花费和性能"})]}),e.jsx(ps,{children:e.jsx(Ze,{className:"h-[300px] sm:h-[400px]",children:e.jsx("div",{className:"space-y-3",children:M.map((T,ie)=>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:T.model_name}),e.jsx("div",{className:"w-3 h-3 rounded-full ml-2 flex-shrink-0",style:{backgroundColor:`hsl(var(--chart-${ie%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:T.request_count.toLocaleString()})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"花费:"}),e.jsxs("span",{className:"ml-1 font-medium",children:["¥",T.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:[(T.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:[T.avg_response_time.toFixed(2),"s"]})]})]})]},ie))})})})]})]})}),e.jsx(Ms,{value:"activity",children:e.jsxs(Fe,{children:[e.jsxs(as,{children:[e.jsx(ls,{children:"最近活动"}),e.jsx(st,{children:"最新的API调用记录"})]}),e.jsx(ps,{children:e.jsx(Ze,{className:"h-[400px] sm:h-[500px]",children:e.jsx("div",{className:"space-y-2",children:ve.map((T,ie)=>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:T.model}),e.jsx("div",{className:"text-xs text-muted-foreground",children:T.request_type})]}),e.jsx("div",{className:"text-xs text-muted-foreground flex-shrink-0",children:R(T.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:T.tokens})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"花费:"}),e.jsxs("span",{className:"ml-1",children:["¥",T.cost.toFixed(4)]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"耗时:"}),e.jsxs("span",{className:"ml-1",children:[T.time_cost.toFixed(2),"s"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"状态:"}),e.jsx("span",{className:`ml-1 ${T.status==="success"?"text-green-600":"text-red-600"}`,children:T.status})]})]})]},ie))})})})]})}),e.jsx(Ms,{value:"daily",children:e.jsxs(Fe,{children:[e.jsxs(as,{children:[e.jsx(ls,{children:"每日统计"}),e.jsx(st,{children:"最近7天的数据汇总"})]}),e.jsx(ps,{children:e.jsx(ni,{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(Ou,{data:fe,children:[e.jsx(Ic,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),e.jsx(Qc,{dataKey:"timestamp",tickFormatter:T=>{const ie=new Date(T);return`${ie.getMonth()+1}/${ie.getDate()}`},stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(cr,{yAxisId:"left",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(cr,{yAxisId:"right",orientation:"right",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),e.jsx(dr,{content:e.jsx(ii,{labelFormatter:T=>new Date(T).toLocaleDateString("zh-CN")})}),e.jsx(R0,{content:e.jsx(lj,{})}),e.jsx(Yc,{yAxisId:"left",dataKey:"requests",fill:"var(--color-requests)"}),e.jsx(Yc,{yAxisId:"right",dataKey:"cost",fill:"var(--color-cost)"})]})})})]})})]})]})})}const V0={theme:"system",setTheme:()=>null},nj=m.createContext(V0),rm=()=>{const l=m.useContext(nj);if(l===void 0)throw new Error("useTheme must be used within a ThemeProvider");return l},I0=(l,i,r)=>{const o=document.documentElement.classList.contains("no-animations");if(!document.startViewTransition||o){i(l);return}const u=r.clientX,x=r.clientY,h=Math.hypot(Math.max(u,innerWidth-u),Math.max(x,innerHeight-x));document.startViewTransition(()=>{i(l)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${u}px ${x}px)`,`circle(${h}px at ${u}px ${x}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},ij=m.createContext(void 0),rj=()=>{const l=m.useContext(ij);if(l===void 0)throw new Error("useAnimation must be used within an AnimationProvider");return l},Ve=m.forwardRef(({className:l,...i},r)=>e.jsx(Xp,{className:H("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",l),...i,ref:r,children:e.jsx(AN,{className:H("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")})}));Ve.displayName=Xp.displayName;const Q0=xi("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),C=m.forwardRef(({className:l,...i},r)=>e.jsx(og,{ref:r,className:H(Q0(),l),...i}));C.displayName=og.displayName;const ne=m.forwardRef(({className:l,type:i,...r},o)=>e.jsx("input",{type:i,className:H("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",l),ref:o,...r}));ne.displayName="Input";const Y0=[{id:"minLength",label:"长度至少 10 位",description:"Token 长度必须大于等于 10 个字符",validate:l=>l.length>=10},{id:"hasUppercase",label:"包含大写字母",description:"至少包含一个大写字母 (A-Z)",validate:l=>/[A-Z]/.test(l)},{id:"hasLowercase",label:"包含小写字母",description:"至少包含一个小写字母 (a-z)",validate:l=>/[a-z]/.test(l)},{id:"hasSpecialChar",label:"包含特殊符号",description:"至少包含一个特殊符号 (!@#$%^&*()_+-=[]{}|;:,.<>?/)",validate:l=>/[!@#$%^&*()_+\-=[\]{}|;:,.<>?/]/.test(l)}];function K0(l){const i=Y0.map(o=>({id:o.id,label:o.label,description:o.description,passed:o.validate(l)}));return{isValid:i.every(o=>o.passed),rules:i}}const ho="0.12.0 Beta",cm="MaiBot Dashboard",X0=`${cm} v${ho}`,J0=(l="v")=>`${l}${ho}`,ea={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"},Va={theme:"system",accentColor:"blue",enableAnimations:!0,enableWavesBackground:!0,logCacheSize:1e3,logAutoScroll:!0,logFontSize:"xs",logLineSpacing:4,dataSyncInterval:30,wsReconnectInterval:3e3,wsMaxReconnectAttempts:10};function dt(l){const i=cj(l),r=localStorage.getItem(i);if(r===null)return Va[l];const o=Va[l];if(typeof o=="boolean")return r==="true";if(typeof o=="number"){const u=parseFloat(r);return isNaN(u)?o:u}return r}function ri(l,i){const r=cj(l);localStorage.setItem(r,String(i)),window.dispatchEvent(new CustomEvent("maibot-settings-change",{detail:{key:l,value:i}}))}function P0(){return{theme:dt("theme"),accentColor:dt("accentColor"),enableAnimations:dt("enableAnimations"),enableWavesBackground:dt("enableWavesBackground"),logCacheSize:dt("logCacheSize"),logAutoScroll:dt("logAutoScroll"),logFontSize:dt("logFontSize"),logLineSpacing:dt("logLineSpacing"),dataSyncInterval:dt("dataSyncInterval"),wsReconnectInterval:dt("wsReconnectInterval"),wsMaxReconnectAttempts:dt("wsMaxReconnectAttempts")}}function Z0(){const l=P0(),i=localStorage.getItem(ea.COMPLETED_TOURS),r=i?JSON.parse(i):[];return{...l,completedTours:r}}function W0(l){const i=[],r=[];for(const[o,u]of Object.entries(l)){if(o==="completedTours"){Array.isArray(u)?(localStorage.setItem(ea.COMPLETED_TOURS,JSON.stringify(u)),i.push("completedTours")):r.push("completedTours");continue}if(o in Va){const x=o,h=Va[x];if(typeof u==typeof h){if(x==="theme"&&!["light","dark","system"].includes(u)){r.push(o);continue}if(x==="logFontSize"&&!["xs","sm","base"].includes(u)){r.push(o);continue}ri(x,u),i.push(o)}else r.push(o)}else r.push(o)}return{success:i.length>0,imported:i,skipped:r}}function ew(){for(const l of Object.keys(Va))ri(l,Va[l]);localStorage.removeItem(ea.COMPLETED_TOURS),window.dispatchEvent(new CustomEvent("maibot-settings-reset"))}function sw(){const l=[],i=[],r=[];for(let o=0;oo.size-r.size),{used:l,items:localStorage.length,details:i}}function tw(l){if(l===0)return"0 B";const i=1024,r=["B","KB","MB"],o=Math.floor(Math.log(l)/Math.log(i));return parseFloat((l/Math.pow(i,o)).toFixed(2))+" "+r[o]}function cj(l){return{theme:ea.THEME,accentColor:ea.ACCENT_COLOR,enableAnimations:ea.ENABLE_ANIMATIONS,enableWavesBackground:ea.ENABLE_WAVES_BACKGROUND,logCacheSize:ea.LOG_CACHE_SIZE,logAutoScroll:ea.LOG_AUTO_SCROLL,logFontSize:ea.LOG_FONT_SIZE,logLineSpacing:ea.LOG_LINE_SPACING,dataSyncInterval:ea.DATA_SYNC_INTERVAL,wsReconnectInterval:ea.WS_RECONNECT_INTERVAL,wsMaxReconnectAttempts:ea.WS_MAX_RECONNECT_ATTEMPTS}[l]}const Ca=m.forwardRef(({className:l,...i},r)=>e.jsxs(Jp,{ref:r,className:H("relative flex w-full touch-none select-none items-center",l),...i,children:[e.jsx(ON,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:e.jsx(DN,{className:"absolute h-full bg-primary"})}),e.jsx(RN,{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"})]}));Ca.displayName=Jp.displayName;class aw{ws=null;reconnectTimeout=null;reconnectAttempts=0;heartbeatInterval=null;logCallbacks=new Set;connectionCallbacks=new Set;isConnected=!1;logCache=[];getMaxCacheSize(){return dt("logCacheSize")}getMaxReconnectAttempts(){return dt("wsMaxReconnectAttempts")}getReconnectInterval(){return dt("wsReconnectInterval")}getWebSocketUrl(){{const i=window.location.protocol==="https:"?"wss:":"ws:",r=window.location.host;return`${i}//${r}/ws/logs`}}connect(){if(this.ws?.readyState===WebSocket.OPEN||this.ws?.readyState===WebSocket.CONNECTING)return;const i=this.getWebSocketUrl();try{this.ws=new WebSocket(i),this.ws.onopen=()=>{this.isConnected=!0,this.reconnectAttempts=0,this.notifyConnection(!0),this.startHeartbeat()},this.ws.onmessage=r=>{try{if(r.data==="pong")return;const o=JSON.parse(r.data);this.notifyLog(o)}catch(o){console.error("解析日志消息失败:",o)}},this.ws.onerror=r=>{console.error("❌ WebSocket 错误:",r),this.isConnected=!1,this.notifyConnection(!1)},this.ws.onclose=()=>{this.isConnected=!1,this.notifyConnection(!1),this.stopHeartbeat(),this.attemptReconnect()}}catch(r){console.error("创建 WebSocket 连接失败:",r),this.attemptReconnect()}}attemptReconnect(){const i=this.getMaxReconnectAttempts();if(this.reconnectAttempts>=i)return;this.reconnectAttempts+=1;const r=this.getReconnectInterval(),o=Math.min(r*this.reconnectAttempts,3e4);this.reconnectTimeout=window.setTimeout(()=>{this.connect()},o)}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(i){return this.logCallbacks.add(i),()=>this.logCallbacks.delete(i)}onConnectionChange(i){return this.connectionCallbacks.add(i),i(this.isConnected),()=>this.connectionCallbacks.delete(i)}notifyLog(i){if(!this.logCache.some(o=>o.id===i.id)){this.logCache.push(i);const o=this.getMaxCacheSize();this.logCache.length>o&&(this.logCache=this.logCache.slice(-o)),this.logCallbacks.forEach(u=>{try{u(i)}catch(x){console.error("日志回调执行失败:",x)}})}}notifyConnection(i){this.connectionCallbacks.forEach(r=>{try{r(i)}catch(o){console.error("连接状态回调执行失败:",o)}})}getAllLogs(){return[...this.logCache]}clearLogs(){this.logCache=[]}getConnectionStatus(){return this.isConnected}}const hn=new aw;typeof window<"u"&&hn.connect();const Gs=ly,om=ny,lw=ty,oj=m.forwardRef(({className:l,...i},r)=>e.jsx(dg,{ref:r,className:H("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",l),...i}));oj.displayName=dg.displayName;const Us=m.forwardRef(({className:l,children:i,preventOutsideClose:r=!1,...o},u)=>e.jsxs(lw,{children:[e.jsx(oj,{}),e.jsxs(ug,{ref:u,className:H("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",l),onPointerDownOutside:r?x=>x.preventDefault():void 0,onInteractOutside:r?x=>x.preventDefault():void 0,...o,children:[i,e.jsxs(ay,{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(gl,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Us.displayName=ug.displayName;const Bs=({className:l,...i})=>e.jsx("div",{className:H("flex flex-col space-y-1.5 text-center sm:text-left",l),...i});Bs.displayName="DialogHeader";const tt=({className:l,...i})=>e.jsx("div",{className:H("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",l),...i});tt.displayName="DialogFooter";const Hs=m.forwardRef(({className:l,...i},r)=>e.jsx(mg,{ref:r,className:H("text-lg font-semibold leading-none tracking-tight",l),...i}));Hs.displayName=mg.displayName;const Ws=m.forwardRef(({className:l,...i},r)=>e.jsx(xg,{ref:r,className:H("text-sm text-muted-foreground",l),...i}));Ws.displayName=xg.displayName;const ms=UN,mt=BN,nw=LN,dj=m.forwardRef(({className:l,...i},r)=>e.jsx(Pp,{className:H("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",l),...i,ref:r}));dj.displayName=Pp.displayName;const ns=m.forwardRef(({className:l,...i},r)=>e.jsxs(nw,{children:[e.jsx(dj,{}),e.jsx(Zp,{ref:r,className:H("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",l),...i})]}));ns.displayName=Zp.displayName;const is=({className:l,...i})=>e.jsx("div",{className:H("flex flex-col space-y-2 text-center sm:text-left",l),...i});is.displayName="AlertDialogHeader";const rs=({className:l,...i})=>e.jsx("div",{className:H("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",l),...i});rs.displayName="AlertDialogFooter";const cs=m.forwardRef(({className:l,...i},r)=>e.jsx(Wp,{ref:r,className:H("text-lg font-semibold",l),...i}));cs.displayName=Wp.displayName;const os=m.forwardRef(({className:l,...i},r)=>e.jsx(eg,{ref:r,className:H("text-sm text-muted-foreground",l),...i}));os.displayName=eg.displayName;const ds=m.forwardRef(({className:l,...i},r)=>e.jsx(sg,{ref:r,className:H(Nr(),l),...i}));ds.displayName=sg.displayName;const us=m.forwardRef(({className:l,...i},r)=>e.jsx(tg,{ref:r,className:H(Nr({variant:"outline"}),"mt-2 sm:mt-0",l),...i}));us.displayName=tg.displayName;function iw(){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(ka,{defaultValue:"appearance",className:"w-full",children:[e.jsxs(xa,{className:"grid w-full grid-cols-2 sm:grid-cols-4 gap-0.5 sm:gap-1 h-auto p-1",children:[e.jsxs(ts,{value:"appearance",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(Ey,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"外观"})]}),e.jsxs(ts,{value:"security",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(zy,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"安全"})]}),e.jsxs(ts,{value:"other",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(hi,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"其他"})]}),e.jsxs(ts,{value:"about",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[e.jsx(Ia,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),e.jsx("span",{children:"关于"})]})]}),e.jsxs(Ze,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[e.jsx(Ms,{value:"appearance",className:"mt-0",children:e.jsx(rw,{})}),e.jsx(Ms,{value:"security",className:"mt-0",children:e.jsx(cw,{})}),e.jsx(Ms,{value:"other",className:"mt-0",children:e.jsx(ow,{})}),e.jsx(Ms,{value:"about",className:"mt-0",children:e.jsx(dw,{})})]})]})]})}function wp(l){const i=document.documentElement,o={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[l];if(o)i.style.setProperty("--primary",o.hsl),o.gradient?(i.style.setProperty("--primary-gradient",o.gradient),i.classList.add("has-gradient")):(i.style.removeProperty("--primary-gradient"),i.classList.remove("has-gradient"));else if(l.startsWith("#")){const u=x=>{x=x.replace("#","");const h=parseInt(x.substring(0,2),16)/255,f=parseInt(x.substring(2,4),16)/255,g=parseInt(x.substring(4,6),16)/255,j=Math.max(h,f,g),v=Math.min(h,f,g);let N=0,y=0;const S=(j+v)/2;if(j!==v){const w=j-v;switch(y=S>.5?w/(2-j-v):w/(j+v),j){case h:N=((f-g)/w+(flocalStorage.getItem("accent-color")||"blue");m.useEffect(()=>{const j=localStorage.getItem("accent-color")||"blue";wp(j)},[]);const g=j=>{f(j),localStorage.setItem("accent-color",j),wp(j)};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(qu,{value:"light",current:l,onChange:i,label:"浅色",description:"始终使用浅色主题"}),e.jsx(qu,{value:"dark",current:l,onChange:i,label:"深色",description:"始终使用深色主题"}),e.jsx(qu,{value:"system",current:l,onChange:i,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(Sa,{value:"blue",current:h,onChange:g,label:"蓝色",colorClass:"bg-blue-500"}),e.jsx(Sa,{value:"purple",current:h,onChange:g,label:"紫色",colorClass:"bg-purple-500"}),e.jsx(Sa,{value:"green",current:h,onChange:g,label:"绿色",colorClass:"bg-green-500"}),e.jsx(Sa,{value:"orange",current:h,onChange:g,label:"橙色",colorClass:"bg-orange-500"}),e.jsx(Sa,{value:"pink",current:h,onChange:g,label:"粉色",colorClass:"bg-pink-500"}),e.jsx(Sa,{value:"red",current:h,onChange:g,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(Sa,{value:"gradient-sunset",current:h,onChange:g,label:"日落",colorClass:"bg-gradient-to-r from-orange-500 to-pink-500"}),e.jsx(Sa,{value:"gradient-ocean",current:h,onChange:g,label:"海洋",colorClass:"bg-gradient-to-r from-blue-500 to-cyan-500"}),e.jsx(Sa,{value:"gradient-forest",current:h,onChange:g,label:"森林",colorClass:"bg-gradient-to-r from-green-500 to-emerald-500"}),e.jsx(Sa,{value:"gradient-aurora",current:h,onChange:g,label:"极光",colorClass:"bg-gradient-to-r from-purple-500 to-pink-500"}),e.jsx(Sa,{value:"gradient-fire",current:h,onChange:g,label:"烈焰",colorClass:"bg-gradient-to-r from-red-500 to-orange-500"}),e.jsx(Sa,{value:"gradient-twilight",current:h,onChange:g,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:j=>g(j.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:j=>g(j.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(C,{htmlFor:"animations",className:"text-base font-medium cursor-pointer",children:"启用动画效果"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后将禁用所有过渡动画和特效,提升性能"})]}),e.jsx(Ve,{id:"animations",checked:r,onCheckedChange:o})]})}),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(C,{htmlFor:"waves-background",className:"text-base font-medium cursor-pointer",children:"登录页波浪背景"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后登录页将使用纯色背景,适合低性能设备"})]}),e.jsx(Ve,{id:"waves-background",checked:u,onCheckedChange:x})]})})]})]})]})}function cw(){const l=Ea(),[i,r]=m.useState(""),[o,u]=m.useState(""),[x,h]=m.useState(!1),[f,g]=m.useState(!1),[j,v]=m.useState(!1),[N,y]=m.useState(!1),[S,w]=m.useState(!1),[L,O]=m.useState(!1),[U,F]=m.useState(""),[A,k]=m.useState(!1),{toast:$}=Vs(),G=m.useMemo(()=>K0(o),[o]),z=async be=>{if(!i){$({title:"无法复制",description:"Token 存储在安全 Cookie 中,请重新生成以获取新 Token",variant:"destructive"});return}try{await navigator.clipboard.writeText(be),w(!0),$({title:"复制成功",description:"Token 已复制到剪贴板"}),setTimeout(()=>w(!1),2e3)}catch{$({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},M=async()=>{if(!o.trim()){$({title:"输入错误",description:"请输入新的 Token",variant:"destructive"});return}if(!G.isValid){const be=G.rules.filter(je=>!je.passed).map(je=>je.label).join(", ");$({title:"格式错误",description:`Token 不符合要求: ${be}`,variant:"destructive"});return}v(!0);try{const be=await fetch("/api/webui/auth/update",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({new_token:o.trim()})}),je=await be.json();be.ok&&je.success?(u(""),r(o.trim()),$({title:"更新成功",description:"Access Token 已更新,即将跳转到登录页"}),setTimeout(()=>{l({to:"/auth"})},1500)):$({title:"更新失败",description:je.message||"无法更新 Token",variant:"destructive"})}catch(be){console.error("更新 Token 错误:",be),$({title:"更新失败",description:"连接服务器失败",variant:"destructive"})}finally{v(!1)}},Q=async()=>{y(!0);try{const be=await fetch("/api/webui/auth/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"}),je=await be.json();be.ok&&je.success?(r(je.token),F(je.token),O(!0),k(!1),$({title:"生成成功",description:"新的 Access Token 已生成,请及时保存"})):$({title:"生成失败",description:je.message||"无法生成新 Token",variant:"destructive"})}catch(be){console.error("生成 Token 错误:",be),$({title:"生成失败",description:"连接服务器失败",variant:"destructive"})}finally{y(!1)}},fe=async()=>{try{await navigator.clipboard.writeText(U),k(!0),$({title:"复制成功",description:"Token 已复制到剪贴板"})}catch{$({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},ve=()=>{O(!1),setTimeout(()=>{F(""),k(!1)},300),setTimeout(()=>{l({to:"/auth"})},500)},ge=be=>{be||ve()};return e.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[e.jsx(Gs,{open:L,onOpenChange:ge,children:e.jsxs(Us,{className:"sm:max-w-md",children:[e.jsxs(Bs,{children:[e.jsxs(Hs,{className:"flex items-center gap-2",children:[e.jsx(La,{className:"h-5 w-5 text-yellow-500"}),"新的 Access Token"]}),e.jsx(Ws,{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(C,{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:U})]}),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(La,{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(tt,{className:"gap-2 sm:gap-0",children:[e.jsx(_,{variant:"outline",onClick:fe,className:"gap-2",children:A?e.jsxs(e.Fragment,{children:[e.jsx(sa,{className:"h-4 w-4 text-green-500"}),"已复制"]}):e.jsxs(e.Fragment,{children:[e.jsx(no,{className:"h-4 w-4"}),"复制 Token"]})}),e.jsx(_,{onClick:ve,children:"我已保存,关闭"})]})]})}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"当前 Access Token"}),e.jsx("div",{className:"space-y-3 sm:space-y-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{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:x?"text":"password",value:i||"••••••••••••••••••••••••••••••••",readOnly:!0,className:"pr-10 font-mono text-sm",placeholder:"Token 存储在安全 Cookie 中"}),e.jsx("button",{onClick:()=>{i?h(!x):$({title:"无法查看",description:'Token 存储在安全 Cookie 中,如需新 Token 请点击"重新生成"'})},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:x?"隐藏":"显示",children:x?e.jsx(vr,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(Qt,{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:()=>z(i),title:"复制到剪贴板",className:"flex-shrink-0",disabled:!i,children:S?e.jsx(sa,{className:"h-4 w-4 text-green-500"}):e.jsx(no,{className:"h-4 w-4"})}),e.jsxs(ms,{children:[e.jsx(mt,{asChild:!0,children:e.jsxs(_,{variant:"outline",disabled:N,className:"gap-2 flex-1 sm:flex-none",children:[e.jsx(qt,{className:H("h-4 w-4",N&&"animate-spin")}),e.jsx("span",{className:"hidden sm:inline",children:"重新生成"}),e.jsx("span",{className:"sm:hidden",children:"生成"})]})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认重新生成 Token"}),e.jsx(os,{children:"这将生成一个新的 64 位安全令牌,并使当前 Token 立即失效。 您需要使用新 Token 重新登录系统。此操作不可撤销,确定要继续吗?"})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:Q,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(C,{htmlFor:"new-token",className:"text-sm",children:"新的访问令牌"}),e.jsxs("div",{className:"relative",children:[e.jsx(ne,{id:"new-token",type:f?"text":"password",value:o,onChange:be=>u(be.target.value),className:"pr-10 font-mono text-sm",placeholder:"输入自定义 Token"}),e.jsx("button",{onClick:()=>g(!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(vr,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(Qt,{className:"h-4 w-4 text-muted-foreground"})})]}),o&&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:G.rules.map(be=>e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[be.passed?e.jsx(ma,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):e.jsx(zg,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:H(be.passed?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:be.label})]},be.id))}),G.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(sa,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:"Token 格式正确,可以使用"})]})})]})]}),e.jsx(_,{onClick:M,disabled:j||!G.isValid||!o,className:"w-full sm:w-auto",children:j?"更新中...":"更新自定义 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 ow(){const l=Ea(),{toast:i}=Vs(),[r,o]=m.useState(!1),[u,x]=m.useState(!1),[h,f]=m.useState(()=>dt("logCacheSize")),[g,j]=m.useState(()=>dt("wsReconnectInterval")),[v,N]=m.useState(()=>dt("wsMaxReconnectAttempts")),[y,S]=m.useState(()=>dt("dataSyncInterval")),[w,L]=m.useState(()=>yp()),[O,U]=m.useState(!1),[F,A]=m.useState(!1),k=m.useRef(null);if(u)throw new Error("这是一个手动触发的测试错误,用于验证错误边界组件是否正常工作。");const $=()=>{L(yp())},G=R=>{const Y=R[0];f(Y),ri("logCacheSize",Y)},z=R=>{const Y=R[0];j(Y),ri("wsReconnectInterval",Y)},M=R=>{const Y=R[0];N(Y),ri("wsMaxReconnectAttempts",Y)},Q=R=>{const Y=R[0];S(Y),ri("dataSyncInterval",Y)},fe=()=>{hn.clearLogs(),i({title:"日志已清除",description:"日志缓存已清空"})},ve=()=>{const R=sw();$(),i({title:"缓存已清除",description:`已清除 ${R.clearedKeys.length} 项缓存数据`})},ge=()=>{U(!0);try{const R=Z0(),Y=JSON.stringify(R,null,2),K=new Blob([Y],{type:"application/json"}),re=URL.createObjectURL(K),T=document.createElement("a");T.href=re,T.download=`maibot-webui-settings-${new Date().toISOString().slice(0,10)}.json`,document.body.appendChild(T),T.click(),document.body.removeChild(T),URL.revokeObjectURL(re),i({title:"导出成功",description:"设置已导出为 JSON 文件"})}catch(R){console.error("导出设置失败:",R),i({title:"导出失败",description:"无法导出设置",variant:"destructive"})}finally{U(!1)}},be=R=>{const Y=R.target.files?.[0];if(!Y)return;A(!0);const K=new FileReader;K.onload=re=>{try{const T=re.target?.result,ie=JSON.parse(T),xe=W0(ie);xe.success?(f(dt("logCacheSize")),j(dt("wsReconnectInterval")),N(dt("wsMaxReconnectAttempts")),S(dt("dataSyncInterval")),$(),i({title:"导入成功",description:`成功导入 ${xe.imported.length} 项设置${xe.skipped.length>0?`,跳过 ${xe.skipped.length} 项`:""}`}),(xe.imported.includes("theme")||xe.imported.includes("accentColor"))&&i({title:"提示",description:"部分设置需要刷新页面才能完全生效"})):i({title:"导入失败",description:"没有有效的设置项可导入",variant:"destructive"})}catch(T){console.error("导入设置失败:",T),i({title:"导入失败",description:"文件格式无效",variant:"destructive"})}finally{A(!1),k.current&&(k.current.value="")}},K.readAsText(Y)},je=()=>{ew(),f(Va.logCacheSize),j(Va.wsReconnectInterval),N(Va.wsMaxReconnectAttempts),S(Va.dataSyncInterval),$(),i({title:"已重置",description:"所有设置已恢复为默认值,刷新页面以应用更改"})},Ne=async()=>{o(!0);try{const R=localStorage.getItem("access-token"),Y=await fetch("/api/webui/setup/reset",{method:"POST",headers:{Authorization:`Bearer ${R}`}}),K=await Y.json();Y.ok&&K.success?(i({title:"重置成功",description:"即将进入初次配置向导"}),setTimeout(()=>{l({to:"/setup"})},1e3)):i({title:"重置失败",description:K.message||"无法重置配置状态",variant:"destructive"})}catch(R){console.error("重置配置状态错误:",R),i({title:"重置失败",description:"连接服务器失败",variant:"destructive"})}finally{o(!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(lo,{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(My,{className:"h-4 w-4"}),"本地存储使用"]}),e.jsx(_,{variant:"ghost",size:"sm",onClick:$,className:"h-7 px-2",children:e.jsx(qt,{className:"h-3 w-3"})})]}),e.jsx("div",{className:"text-2xl font-bold text-primary",children:tw(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(C,{className:"text-sm font-medium",children:"日志缓存大小"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[h," 条"]})]}),e.jsx(Ca,{value:[h],onValueChange:G,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(C,{className:"text-sm font-medium",children:"首页数据刷新间隔"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[y," 秒"]})]}),e.jsx(Ca,{value:[y],onValueChange:Q,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(C,{className:"text-sm font-medium",children:"WebSocket 重连间隔"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[g/1e3," 秒"]})]}),e.jsx(Ca,{value:[g],onValueChange:z,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(C,{className:"text-sm font-medium",children:"WebSocket 最大重连次数"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[v," 次"]})]}),e.jsx(Ca,{value:[v],onValueChange:M,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:fe,className:"gap-2",children:[e.jsx(We,{className:"h-4 w-4"}),"清除日志缓存"]}),e.jsxs(ms,{children:[e.jsx(mt,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:"gap-2",children:[e.jsx(We,{className:"h-4 w-4"}),"清除本地缓存"]})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认清除本地缓存"}),e.jsx(os,{children:"这将清除所有本地缓存的设置和数据(不包括登录凭证)。 您可能需要重新配置部分偏好设置。确定要继续吗?"})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:ve,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(Ua,{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:ge,disabled:O,className:"gap-2",children:[e.jsx(Ua,{className:"h-4 w-4"}),O?"导出中...":"导出设置"]}),e.jsx("input",{ref:k,type:"file",accept:".json",onChange:be,className:"hidden"}),e.jsxs(_,{variant:"outline",onClick:()=>k.current?.click(),disabled:F,className:"gap-2",children:[e.jsx(br,{className:"h-4 w-4"}),F?"导入中...":"导入设置"]})]}),e.jsx("div",{className:"pt-2 border-t",children:e.jsxs(ms,{children:[e.jsx(mt,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:"gap-2 text-destructive hover:text-destructive",children:[e.jsx(ao,{className:"h-4 w-4"}),"重置所有设置为默认值"]})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认重置所有设置"}),e.jsx(os,{children:"这将把所有界面设置恢复为默认值,包括主题、颜色、动画等偏好设置。 此操作不会影响您的登录状态。确定要继续吗?"})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:je,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(ms,{children:[e.jsx(mt,{asChild:!0,children:e.jsxs(_,{variant:"outline",disabled:r,className:"gap-2",children:[e.jsx(ao,{className:H("h-4 w-4",r&&"animate-spin")}),"重新进行初次配置"]})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认重新配置"}),e.jsx(os,{children:"这将带您重新进入初次配置向导。您可以重新设置系统的基础配置项。确定要继续吗?"})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:Ne,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(La,{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(ms,{children:[e.jsx(mt,{asChild:!0,children:e.jsxs(_,{variant:"destructive",className:"gap-2",children:[e.jsx(La,{className:"h-4 w-4"}),"触发测试错误"]})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认触发错误"}),e.jsx(os,{children:"这将手动触发一个 React 错误,用于测试错误边界组件的显示效果。 页面将显示错误界面,您可以通过刷新页面或点击返回首页来恢复。"})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>x(!0),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认触发"})]})]})]})]})]})]})}function dw(){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:H("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:["关于 ",cm]}),e.jsxs("div",{className:"space-y-2 text-xs sm:text-sm text-muted-foreground",children:[e.jsxs("p",{children:["版本: ",ho]}),e.jsx("p",{children:"麦麦(MaiBot)的现代化 Web 管理界面"})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"作者"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:"MaiBot 核心"}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Mai-with-u"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:"WebUI"}),e.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground",children:["Mai-with-u ",e.jsx("a",{href:"https://github.com/DrSmoothl",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"@MotricSeven"})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"技术栈"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 text-xs sm:text-sm text-muted-foreground",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"前端框架"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"React 19.2.0"}),e.jsx("li",{children:"TypeScript 5.7.2"}),e.jsx("li",{children:"Vite 6.0.7"}),e.jsx("li",{children:"TanStack Router 1.94.2"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"UI 组件"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"shadcn/ui"}),e.jsx("li",{children:"Radix UI"}),e.jsx("li",{children:"Tailwind CSS 3.4.17"}),e.jsx("li",{children:"Lucide Icons"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"后端"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"Python 3.12+"}),e.jsx("li",{children:"FastAPI"}),e.jsx("li",{children:"Uvicorn"}),e.jsx("li",{children:"WebSocket"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"font-medium text-foreground",children:"构建工具"}),e.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[e.jsx("li",{children:"Bun / npm"}),e.jsx("li",{children:"ESLint 9.17.0"}),e.jsx("li",{children:"PostCSS"})]})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[e.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源库感谢"}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mb-3",children:"本项目使用了以下优秀的开源库,感谢他们的贡献:"}),e.jsx(Ze,{className:"h-[300px] sm:h-[400px]",children:e.jsxs("div",{className:"space-y-4 pr-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"UI 框架与组件"}),e.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[e.jsx(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:l,description:i,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:l}),e.jsx("p",{className:"text-muted-foreground text-xs mt-0.5",children:i})]}),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 qu({value:l,current:i,onChange:r,label:o,description:u}){const x=i===l;return e.jsxs("button",{onClick:()=>r(l),className:H("relative rounded-lg border-2 p-3 sm:p-4 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",x?"border-primary bg-accent":"border-border"),children:[x&&e.jsx("div",{className:"absolute top-2 right-2 sm:top-3 sm:right-3 h-2 w-2 rounded-full bg-primary"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm sm:text-base font-medium",children:o}),e.jsx("div",{className:"text-[10px] sm:text-xs text-muted-foreground",children:u})]}),e.jsxs("div",{className:"mt-2 sm:mt-3 flex gap-1",children:[l==="light"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-200"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-300"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-400"})]}),l==="dark"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-700"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-800"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-900"})]}),l==="system"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-200 to-slate-700"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-300 to-slate-800"}),e.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-400 to-slate-900"})]})]})]})}function Sa({value:l,current:i,onChange:r,label:o,colorClass:u}){const x=i===l;return e.jsxs("button",{onClick:()=>r(l),className:H("relative rounded-lg border-2 p-2 sm:p-3 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",x?"border-primary bg-accent":"border-border"),children:[x&&e.jsx("div",{className:"absolute top-1.5 right-1.5 sm:top-2 sm:right-2 h-1.5 w-1.5 sm:h-2 sm:w-2 rounded-full bg-primary"}),e.jsxs("div",{className:"flex flex-col items-center gap-1.5 sm:gap-2",children:[e.jsx("div",{className:H("h-8 w-8 sm:h-10 sm:w-10 rounded-full",u)}),e.jsx("div",{className:"text-[10px] sm:text-xs font-medium text-center",children:o})]})]})}class uw{grad3;p;perm;constructor(i=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(i,r,o){return i[0]*r+i[1]*o}mix(i,r,o){return(1-o)*i+o*r}fade(i){return i*i*i*(i*(i*6-15)+10)}perlin2(i,r){const o=Math.floor(i)&255,u=Math.floor(r)&255;i-=Math.floor(i),r-=Math.floor(r);const x=this.fade(i),h=this.fade(r),f=this.perm[o]+u,g=this.perm[f],j=this.perm[f+1],v=this.perm[o+1]+u,N=this.perm[v],y=this.perm[v+1];return this.mix(this.mix(this.dot(this.grad3[g%12],i,r),this.dot(this.grad3[N%12],i-1,r),x),this.mix(this.dot(this.grad3[j%12],i,r-1),this.dot(this.grad3[y%12],i-1,r-1),x),h)}}function _p(){const l=m.useRef(null),i=m.useRef(null),r=m.useRef(void 0),o=m.useRef({mouse:{x:-10,y:0,lx:0,ly:0,sx:0,sy:0,v:0,vs:0,a:0,set:!1},lines:[],paths:[],noise:new uw(Math.random()),bounding:null});return m.useEffect(()=>{const u=i.current,x=l.current;if(!u||!x)return;const h=o.current,f=()=>{const L=u.getBoundingClientRect();h.bounding=L,x.style.width=`${L.width}px`,x.style.height=`${L.height}px`},g=()=>{if(!h.bounding)return;const{width:L,height:O}=h.bounding;h.lines=[],h.paths.forEach(Q=>Q.remove()),h.paths=[];const U=10,F=32,A=L+200,k=O+30,$=Math.ceil(A/U),G=Math.ceil(k/F),z=(L-U*$)/2,M=(O-F*G)/2;for(let Q=0;Q<=$;Q++){const fe=[];for(let ge=0;ge<=G;ge++){const be={x:z+U*Q,y:M+F*ge,wave:{x:0,y:0},cursor:{x:0,y:0,vx:0,vy:0}};fe.push(be)}const ve=document.createElementNS("http://www.w3.org/2000/svg","path");x.appendChild(ve),h.paths.push(ve),h.lines.push(fe)}},j=L=>{const{lines:O,mouse:U,noise:F}=h;O.forEach(A=>{A.forEach(k=>{const $=F.perlin2((k.x+L*.0125)*.002,(k.y+L*.005)*.0015)*12;k.wave.x=Math.cos($)*32,k.wave.y=Math.sin($)*16;const G=k.x-U.sx,z=k.y-U.sy,M=Math.hypot(G,z),Q=Math.max(175,U.vs);if(M{const U={x:L.x+L.wave.x+(O?L.cursor.x:0),y:L.y+L.wave.y+(O?L.cursor.y:0)};return U.x=Math.round(U.x*10)/10,U.y=Math.round(U.y*10)/10,U},N=()=>{const{lines:L,paths:O}=h;L.forEach((U,F)=>{let A=v(U[0],!1),k=`M ${A.x} ${A.y}`;U.forEach(($,G)=>{const z=G===U.length-1;A=v($,!z),k+=`L ${A.x} ${A.y}`}),O[F].setAttribute("d",k)})},y=L=>{const{mouse:O}=h;O.sx+=(O.x-O.sx)*.1,O.sy+=(O.y-O.sy)*.1;const U=O.x-O.lx,F=O.y-O.ly,A=Math.hypot(U,F);O.v=A,O.vs+=(A-O.vs)*.1,O.vs=Math.min(100,O.vs),O.lx=O.x,O.ly=O.y,O.a=Math.atan2(F,U),u&&(u.style.setProperty("--x",`${O.sx}px`),u.style.setProperty("--y",`${O.sy}px`)),j(L),N(),r.current=requestAnimationFrame(y)},S=L=>{if(!h.bounding)return;const{mouse:O}=h;O.x=L.pageX-h.bounding.left,O.y=L.pageY-h.bounding.top+window.scrollY,O.set||(O.sx=O.x,O.sy=O.y,O.lx=O.x,O.ly=O.y,O.set=!0)},w=()=>{f(),g()};return f(),g(),window.addEventListener("resize",w),window.addEventListener("mousemove",S),r.current=requestAnimationFrame(y),()=>{window.removeEventListener("resize",w),window.removeEventListener("mousemove",S),r.current&&cancelAnimationFrame(r.current)}},[]),e.jsxs("div",{ref:i,className:"waves-background",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"hidden",pointerEvents:"none"},children:[e.jsx("div",{className:"waves-cursor",style:{position:"absolute",top:0,left:0,width:"0.5rem",height:"0.5rem",background:"hsl(var(--primary) / 0.3)",borderRadius:"50%",transform:"translate3d(calc(var(--x, -0.5rem) - 50%), calc(var(--y, 50%) - 50%), 0)",willChange:"transform",pointerEvents:"none"}}),e.jsx("svg",{ref:l,style:{display:"block",width:"100%",height:"100%"},children:e.jsx("style",{children:` path { fill: none; stroke: hsl(var(--primary) / 0.20); stroke-width: 1px; } - `})})]})}async function Te(l,i){const r={...i,credentials:"include",headers:{"Content-Type":"application/json",...i?.headers}},o=await fetch(l,r);if(o.status===401)throw window.location.href="/auth",new Error("认证失败,请重新登录");return o}function Fs(){return{"Content-Type":"application/json"}}async function uw(){try{await fetch("/api/webui/auth/logout",{method:"POST",credentials:"include"})}catch(l){console.error("登出请求失败:",l)}window.location.href="/auth"}async function om(){try{return(await(await fetch("/api/webui/auth/check",{method:"GET",credentials:"include"})).json()).authenticated===!0}catch{return!1}}function mw(){const[l,i]=m.useState(""),[r,o]=m.useState(!1),[u,x]=m.useState(""),[h,p]=m.useState(!0),g=Ea(),{enableWavesBackground:v,setEnableWavesBackground:j}=Jg(),{theme:N,setTheme:y}=im();m.useEffect(()=>{(async()=>{try{await om()&&g({to:"/"})}catch{}finally{p(!1)}})()},[g]);const w=N==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":N,R=()=>{y(w==="dark"?"light":"dark")},O=async U=>{if(U.preventDefault(),x(""),!l.trim()){x("请输入 Access Token");return}o(!0);try{const G=await fetch("/api/webui/auth/verify",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({token:l.trim()})}),L=await G.json();G.ok&&L.valid?L.is_first_setup?g({to:"/setup"}):g({to:"/"}):x(L.message||"Token 验证失败,请检查后重试")}catch(G){console.error("Token 验证错误:",G),x("连接服务器失败,请检查网络连接")}finally{o(!1)}};return h?e.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[v&&e.jsx(_p,{}),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:[v&&e.jsx(_p,{}),e.jsxs(Ve,{className:"relative z-10 w-full max-w-md shadow-2xl backdrop-blur-xl bg-card/80 border-border/50",children:[e.jsx("button",{onClick:R,className:"absolute right-4 top-4 rounded-lg p-2 hover:bg-accent transition-colors z-10 text-foreground",title:w==="dark"?"切换到浅色模式":"切换到深色模式",children:w==="dark"?e.jsx(Mg,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"}):e.jsx(Ag,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"})}),e.jsxs(as,{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(up,{className:"h-8 w-8 text-primary",strokeWidth:2,fill:"none"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ls,{className:"text-2xl font-bold",children:"欢迎使用 MaiBot"}),e.jsx(st,{className:"text-base",children:"请输入您的 Access Token 以继续访问系统"})]})]}),e.jsx(ps,{children:e.jsxs("form",{onSubmit:O,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"token",className:"text-sm font-medium",children:"Access Token"}),e.jsxs("div",{className:"relative",children:[e.jsx(Og,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground",strokeWidth:2,fill:"none"}),e.jsx(ie,{id:"token",type:"password",placeholder:"请输入您的 Access Token",value:l,onChange:U=>i(U.target.value),className:H("pl-10",u&&"border-red-500 focus-visible:ring-red-500"),disabled:r,autoFocus:!0,autoComplete:"off"})]})]}),u&&e.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-red-50 p-3 text-sm text-red-600 dark:bg-red-950/50 dark:text-red-400",children:[e.jsx(Gt,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),e.jsx("span",{children:u})]}),e.jsx(_,{type:"submit",className:"w-full",disabled: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(Gs,{children:[e.jsx(cm,{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(Dg,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我没有 Token,我该去哪里获得 Token?"]})}),e.jsxs(Us,{className:"sm:max-w-md",children:[e.jsxs(Bs,{children:[e.jsxs(Hs,{className:"flex items-center gap-2",children:[e.jsx(up,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"如何获取 Access Token"]}),e.jsx(Ws,{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(Ny,{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(Ra,{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(Gt,{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(ms,{children:[e.jsx(ut,{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(fn,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我觉得这个界面很卡怎么办?"]})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsxs(cs,{className:"flex items-center gap-2",children:[e.jsx(fn,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"关闭背景动画"]}),e.jsx(os,{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(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>j(!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:K0})})]})}const Is=m.forwardRef(({className:l,...i},r)=>e.jsx("textarea",{className:H("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",l),ref:r,...i}));Is.displayName="Textarea";const ho=m.forwardRef(({className:l,orientation:i="horizontal",decorative:r=!0,...o},u)=>e.jsx(ag,{ref:u,decorative:r,orientation:i,className:H("shrink-0 bg-border",i==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",l),...o}));ho.displayName=ag.displayName;function xw({config:l,onChange:i}){const r=u=>{u.trim()&&!l.alias_names.includes(u.trim())&&i({...l,alias_names:[...l.alias_names,u.trim()]})},o=u=>{i({...l,alias_names:l.alias_names.filter((x,h)=>h!==u)})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{htmlFor:"qq_account",children:"QQ账号 *"}),e.jsx(ie,{id:"qq_account",type:"number",placeholder:"请输入机器人的QQ账号",value:l.qq_account||"",onChange:u=>i({...l,qq_account:Number(u.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人登录使用的QQ账号"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{htmlFor:"nickname",children:"昵称 *"}),e.jsx(ie,{id:"nickname",placeholder:"请输入机器人的昵称",value:l.nickname,onChange:u=>i({...l,nickname:u.target.value})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的主要称呼名称"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{children:"别名"}),e.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:l.alias_names.map((u,x)=>e.jsxs(Qe,{variant:"secondary",className:"gap-1",children:[u,e.jsx("button",{type:"button",onClick:()=>o(x),className:"ml-1 hover:text-destructive",children:e.jsx(gl,{className:"h-3 w-3"})})]},x))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ie,{id:"alias_input",placeholder:"输入别名后按回车添加",onKeyPress:u=>{u.key==="Enter"&&(r(u.target.value),u.target.value="")}}),e.jsx(_,{type:"button",variant:"outline",onClick:()=>{const u=document.getElementById("alias_input");u&&(r(u.value),u.value="")},children:"添加"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的其他称呼,可以添加多个"})]})]})}function hw({config:l,onChange:i}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{htmlFor:"personality",children:"人格特征 *"}),e.jsx(Is,{id:"personality",placeholder:"描述机器人的人格特质和身份特征(建议120字以内)",value:l.personality,onChange:r=>i({...l,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(C,{htmlFor:"reply_style",children:"表达风格 *"}),e.jsx(Is,{id:"reply_style",placeholder:"描述机器人说话的表达风格、表达习惯",value:l.reply_style,onChange:r=>i({...l,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(C,{htmlFor:"interest",children:"兴趣 *"}),e.jsx(Is,{id:"interest",placeholder:"描述机器人感兴趣的话题",value:l.interest,onChange:r=>i({...l,interest:r.target.value}),rows:2}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"会影响机器人对什么话题进行回复"})]}),e.jsx(ho,{}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{htmlFor:"plan_style",children:"群聊说话规则 *"}),e.jsx(Is,{id:"plan_style",placeholder:"机器人在群聊中的行为风格和规则",value:l.plan_style,onChange:r=>i({...l,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(C,{htmlFor:"private_plan_style",children:"私聊说话规则 *"}),e.jsx(Is,{id:"private_plan_style",placeholder:"机器人在私聊中的行为风格和规则",value:l.private_plan_style,onChange:r=>i({...l,private_plan_style:r.target.value}),rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在私聊中的行为方式"})]})]})}function fw({config:l,onChange:i}){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(C,{htmlFor:"emoji_chance",children:"表情包激活概率"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[(l.emoji_chance*100).toFixed(0),"%"]})]}),e.jsx(ie,{id:"emoji_chance",type:"range",min:"0",max:"1",step:"0.1",value:l.emoji_chance,onChange:r=>i({...l,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(C,{htmlFor:"max_reg_num",children:"最大表情包数量"}),e.jsx(ie,{id:"max_reg_num",type:"number",min:"1",max:"200",value:l.max_reg_num,onChange:r=>i({...l,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(C,{htmlFor:"do_replace",children:"达到最大数量时替换"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"开启后会删除旧表情包,关闭则不再收集新表情包"})]}),e.jsx(Fe,{id:"do_replace",checked:l.do_replace,onCheckedChange:r=>i({...l,do_replace:r})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),e.jsx(ie,{id:"check_interval",type:"number",min:"1",max:"120",value:l.check_interval,onChange:r=>i({...l,check_interval:Number(r.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包注册、破损、删除的时间间隔"})]}),e.jsx(ho,{}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{htmlFor:"steal_emoji",children:"偷取表情包"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人将一些表情包据为己有"})]}),e.jsx(Fe,{id:"steal_emoji",checked:l.steal_emoji,onCheckedChange:r=>i({...l,steal_emoji:r})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{htmlFor:"content_filtration",children:"启用表情包过滤"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"只保存符合要求的表情包"})]}),e.jsx(Fe,{id:"content_filtration",checked:l.content_filtration,onCheckedChange:r=>i({...l,content_filtration:r})})]}),l.content_filtration&&e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{htmlFor:"filtration_prompt",children:"过滤要求"}),e.jsx(ie,{id:"filtration_prompt",placeholder:"例如:符合公序良俗",value:l.filtration_prompt,onChange:r=>i({...l,filtration_prompt:r.target.value})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"描述表情包应该符合的要求"})]})]})}function pw({config:l,onChange:i}){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(C,{htmlFor:"enable_tool",children:"启用工具系统"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人使用各种工具增强功能"})]}),e.jsx(Fe,{id:"enable_tool",checked:l.enable_tool,onCheckedChange:r=>i({...l,enable_tool:r})})]}),e.jsx(ho,{}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{htmlFor:"all_global",children:"启用全局黑话模式"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人学习和使用群组黑话"})]}),e.jsx(Fe,{id:"all_global",checked:l.all_global,onCheckedChange:r=>i({...l,all_global:r})})]})]})}function gw({config:l,onChange:i}){const[r,o]=m.useState(!1);return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"rounded-lg bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"mt-0.5",children:e.jsx("svg",{className:"h-5 w-5 text-blue-600 dark:text-blue-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),e.jsxs("div",{className:"flex-1 text-sm",children:[e.jsx("p",{className:"font-medium text-blue-900 dark:text-blue-100 mb-1",children:"关于硅基流动 (SiliconFlow)"}),e.jsx("p",{className:"text-blue-700 dark:text-blue-300 mb-2",children:"硅基流动提供了完整的模型覆盖,包括 DeepSeek V3、Qwen、视觉模型、语音识别和嵌入模型。 只需一个 API Key 即可使用麦麦的所有功能!"}),e.jsxs("a",{href:"https://cloud.siliconflow.cn",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-blue-600 dark:text-blue-400 hover:underline font-medium",children:["前往硅基流动获取 API Key",e.jsx(Wc,{className:"h-3 w-3"})]})]})]})}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{htmlFor:"siliconflow_api_key",children:"SiliconFlow API Key *"}),e.jsxs("div",{className:"relative",children:[e.jsx(ie,{id:"siliconflow_api_key",type:r?"text":"password",placeholder:"sk-...",value:l.api_key,onChange:u=>i({api_key:u.target.value}),className:"font-mono pr-10"}),e.jsx(_,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent",onClick:()=>o(!r),children:r?e.jsx(vr,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(Qt,{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 jw(){const l=await Te("/api/webui/config/bot",{method:"GET",headers:Fs()});if(!l.ok)throw new Error("读取Bot配置失败");const r=(await l.json()).config.bot||{};return{qq_account:r.qq_account||0,nickname:r.nickname||"",alias_names:r.alias_names||[]}}async function vw(){const l=await Te("/api/webui/config/bot",{method:"GET",headers:Fs()});if(!l.ok)throw new Error("读取人格配置失败");const r=(await l.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 bw(){const l=await Te("/api/webui/config/bot",{method:"GET",headers:Fs()});if(!l.ok)throw new Error("读取表情包配置失败");const r=(await l.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 Nw(){const l=await Te("/api/webui/config/bot",{method:"GET",headers:Fs()});if(!l.ok)throw new Error("读取其他配置失败");const r=(await l.json()).config,o=r.tool||{},u=r.expression||{};return{enable_tool:o.enable_tool??!0,all_global:u.all_global_jargon??!0}}async function yw(){const l=await Te("/api/webui/config/model",{method:"GET",headers:Fs()});if(!l.ok)throw new Error("读取模型配置失败");return{api_key:((await l.json()).config.api_providers||[]).find(x=>x.name==="SiliconFlow")?.api_key||""}}async function ww(l){const i=await Te("/api/webui/config/bot/section/bot",{method:"POST",headers:Fs(),body:JSON.stringify(l)});if(!i.ok){const r=await i.json();throw new Error(r.detail||"保存Bot基础配置失败")}return await i.json()}async function _w(l){const i=await Te("/api/webui/config/bot/section/personality",{method:"POST",headers:Fs(),body:JSON.stringify(l)});if(!i.ok){const r=await i.json();throw new Error(r.detail||"保存人格配置失败")}return await i.json()}async function Sw(l){const i=await Te("/api/webui/config/bot/section/emoji",{method:"POST",headers:Fs(),body:JSON.stringify(l)});if(!i.ok){const r=await i.json();throw new Error(r.detail||"保存表情包配置失败")}return await i.json()}async function Cw(l){const i=[];i.push(Te("/api/webui/config/bot/section/tool",{method:"POST",headers:Fs(),body:JSON.stringify({enable_tool:l.enable_tool})})),i.push(Te("/api/webui/config/bot/section/expression",{method:"POST",headers:Fs(),body:JSON.stringify({all_global_jargon:l.all_global})}));const r=await Promise.all(i);for(const o of r)if(!o.ok){const u=await o.json();throw new Error(u.detail||"保存其他配置失败")}return{success:!0}}async function kw(l){const i=await Te("/api/webui/config/model",{method:"GET",headers:Fs()});if(!i.ok)throw new Error("读取模型配置失败");const o=(await i.json()).config,u=o.api_providers||[],x=u.findIndex(g=>g.name==="SiliconFlow");x>=0?u[x]={...u[x],api_key:l.api_key}:u.push({name:"SiliconFlow",base_url:"https://api.siliconflow.cn/v1",api_key:l.api_key,client_type:"openai",max_retry:3,timeout:120,retry_interval:5});const h={...o,api_providers:u},p=await Te("/api/webui/config/model",{method:"POST",headers:Fs(),body:JSON.stringify(h)});if(!p.ok){const g=await p.json();throw new Error(g.detail||"保存模型配置失败")}return await p.json()}async function Sp(){const l=localStorage.getItem("access-token"),i=await Te("/api/webui/setup/complete",{method:"POST",headers:{Authorization:`Bearer ${l}`}});if(!i.ok){const r=await i.json();throw new Error(r.message||"标记配置完成失败")}return await i.json()}async function fo(){const l=await Te("/api/webui/system/restart",{method:"POST",headers:Fs()});if(!l.ok){const i=await l.json();throw new Error(i.detail||"重启失败")}return await l.json()}async function ej(){const l=await Te("/api/webui/system/status",{method:"GET",headers:Fs()});if(!l.ok){const i=await l.json();throw new Error(i.detail||"获取状态失败")}return await l.json()}function Tw(){const l=Ea(),{toast:i}=Vs(),[r,o]=m.useState(0),[u,x]=m.useState(!1),[h,p]=m.useState(!1),[g,v]=m.useState(!0),[j,N]=m.useState({qq_account:0,nickname:"",alias_names:[]}),[y,S]=m.useState({personality:"是一个女大学生,现在在读大二,会刷贴吧。",reply_style:"请回复的平淡一些,简短一些,说中文,不要刻意突出自身学科背景。可以参考贴吧,知乎和微博的回复风格。",interest:"对技术相关话题,游戏和动漫相关话题感兴趣,也对日常话题感兴趣,不喜欢太过沉重严肃的话题",plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 + `})})]})}async function Te(l,i){const r={...i,credentials:"include",headers:{"Content-Type":"application/json",...i?.headers}},o=await fetch(l,r);if(o.status===401)throw window.location.href="/auth",new Error("认证失败,请重新登录");return o}function Fs(){return{"Content-Type":"application/json"}}async function mw(){try{await fetch("/api/webui/auth/logout",{method:"POST",credentials:"include"})}catch(l){console.error("登出请求失败:",l)}window.location.href="/auth"}async function dm(){try{return(await(await fetch("/api/webui/auth/check",{method:"GET",credentials:"include"})).json()).authenticated===!0}catch{return!1}}function xw(){const[l,i]=m.useState(""),[r,o]=m.useState(!1),[u,x]=m.useState(""),[h,f]=m.useState(!0),g=Ea(),{enableWavesBackground:j,setEnableWavesBackground:v}=rj(),{theme:N,setTheme:y}=rm();m.useEffect(()=>{(async()=>{try{await dm()&&g({to:"/"})}catch{}finally{f(!1)}})()},[g]);const w=N==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":N,L=()=>{y(w==="dark"?"light":"dark")},O=async U=>{if(U.preventDefault(),x(""),!l.trim()){x("请输入 Access Token");return}o(!0);try{const F=await fetch("/api/webui/auth/verify",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({token:l.trim()})}),A=await F.json();F.ok&&A.valid?A.is_first_setup?g({to:"/setup"}):g({to:"/"}):x(A.message||"Token 验证失败,请检查后重试")}catch(F){console.error("Token 验证错误:",F),x("连接服务器失败,请检查网络连接")}finally{o(!1)}};return h?e.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[j&&e.jsx(_p,{}),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:[j&&e.jsx(_p,{}),e.jsxs(Fe,{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:L,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(Mg,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"}):e.jsx(Ag,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"})}),e.jsxs(as,{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(mp,{className:"h-8 w-8 text-primary",strokeWidth:2,fill:"none"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ls,{className:"text-2xl font-bold",children:"欢迎使用 MaiBot"}),e.jsx(st,{className:"text-base",children:"请输入您的 Access Token 以继续访问系统"})]})]}),e.jsx(ps,{children:e.jsxs("form",{onSubmit:O,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"token",className:"text-sm font-medium",children:"Access Token"}),e.jsxs("div",{className:"relative",children:[e.jsx(Og,{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:l,onChange:U=>i(U.target.value),className:H("pl-10",u&&"border-red-500 focus-visible:ring-red-500"),disabled:r,autoFocus:!0,autoComplete:"off"})]})]}),u&&e.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-red-50 p-3 text-sm text-red-600 dark:bg-red-950/50 dark:text-red-400",children:[e.jsx(Gt,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),e.jsx("span",{children:u})]}),e.jsx(_,{type:"submit",className:"w-full",disabled: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(Gs,{children:[e.jsx(om,{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(Dg,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我没有 Token,我该去哪里获得 Token?"]})}),e.jsxs(Us,{className:"sm:max-w-md",children:[e.jsxs(Bs,{children:[e.jsxs(Hs,{className:"flex items-center gap-2",children:[e.jsx(mp,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"如何获取 Access Token"]}),e.jsx(Ws,{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(Ay,{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(Ra,{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(Gt,{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(ms,{children:[e.jsx(mt,{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(fn,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我觉得这个界面很卡怎么办?"]})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsxs(cs,{className:"flex items-center gap-2",children:[e.jsx(fn,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"关闭背景动画"]}),e.jsx(os,{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(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>v(!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:X0})})]})}const Is=m.forwardRef(({className:l,...i},r)=>e.jsx("textarea",{className:H("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",l),ref:r,...i}));Is.displayName="Textarea";const fo=m.forwardRef(({className:l,orientation:i="horizontal",decorative:r=!0,...o},u)=>e.jsx(ag,{ref:u,decorative:r,orientation:i,className:H("shrink-0 bg-border",i==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",l),...o}));fo.displayName=ag.displayName;function hw({config:l,onChange:i}){const r=u=>{u.trim()&&!l.alias_names.includes(u.trim())&&i({...l,alias_names:[...l.alias_names,u.trim()]})},o=u=>{i({...l,alias_names:l.alias_names.filter((x,h)=>h!==u)})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{htmlFor:"qq_account",children:"QQ账号 *"}),e.jsx(ne,{id:"qq_account",type:"number",placeholder:"请输入机器人的QQ账号",value:l.qq_account||"",onChange:u=>i({...l,qq_account:Number(u.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人登录使用的QQ账号"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{htmlFor:"nickname",children:"昵称 *"}),e.jsx(ne,{id:"nickname",placeholder:"请输入机器人的昵称",value:l.nickname,onChange:u=>i({...l,nickname:u.target.value})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的主要称呼名称"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{children:"别名"}),e.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:l.alias_names.map((u,x)=>e.jsxs(Qe,{variant:"secondary",className:"gap-1",children:[u,e.jsx("button",{type:"button",onClick:()=>o(x),className:"ml-1 hover:text-destructive",children:e.jsx(gl,{className:"h-3 w-3"})})]},x))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{id:"alias_input",placeholder:"输入别名后按回车添加",onKeyPress:u=>{u.key==="Enter"&&(r(u.target.value),u.target.value="")}}),e.jsx(_,{type:"button",variant:"outline",onClick:()=>{const u=document.getElementById("alias_input");u&&(r(u.value),u.value="")},children:"添加"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的其他称呼,可以添加多个"})]})]})}function fw({config:l,onChange:i}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{htmlFor:"personality",children:"人格特征 *"}),e.jsx(Is,{id:"personality",placeholder:"描述机器人的人格特质和身份特征(建议120字以内)",value:l.personality,onChange:r=>i({...l,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(C,{htmlFor:"reply_style",children:"表达风格 *"}),e.jsx(Is,{id:"reply_style",placeholder:"描述机器人说话的表达风格、表达习惯",value:l.reply_style,onChange:r=>i({...l,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(C,{htmlFor:"interest",children:"兴趣 *"}),e.jsx(Is,{id:"interest",placeholder:"描述机器人感兴趣的话题",value:l.interest,onChange:r=>i({...l,interest:r.target.value}),rows:2}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"会影响机器人对什么话题进行回复"})]}),e.jsx(fo,{}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{htmlFor:"plan_style",children:"群聊说话规则 *"}),e.jsx(Is,{id:"plan_style",placeholder:"机器人在群聊中的行为风格和规则",value:l.plan_style,onChange:r=>i({...l,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(C,{htmlFor:"private_plan_style",children:"私聊说话规则 *"}),e.jsx(Is,{id:"private_plan_style",placeholder:"机器人在私聊中的行为风格和规则",value:l.private_plan_style,onChange:r=>i({...l,private_plan_style:r.target.value}),rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在私聊中的行为方式"})]})]})}function pw({config:l,onChange:i}){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(C,{htmlFor:"emoji_chance",children:"表情包激活概率"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[(l.emoji_chance*100).toFixed(0),"%"]})]}),e.jsx(ne,{id:"emoji_chance",type:"range",min:"0",max:"1",step:"0.1",value:l.emoji_chance,onChange:r=>i({...l,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(C,{htmlFor:"max_reg_num",children:"最大表情包数量"}),e.jsx(ne,{id:"max_reg_num",type:"number",min:"1",max:"200",value:l.max_reg_num,onChange:r=>i({...l,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(C,{htmlFor:"do_replace",children:"达到最大数量时替换"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"开启后会删除旧表情包,关闭则不再收集新表情包"})]}),e.jsx(Ve,{id:"do_replace",checked:l.do_replace,onCheckedChange:r=>i({...l,do_replace:r})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),e.jsx(ne,{id:"check_interval",type:"number",min:"1",max:"120",value:l.check_interval,onChange:r=>i({...l,check_interval:Number(r.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包注册、破损、删除的时间间隔"})]}),e.jsx(fo,{}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{htmlFor:"steal_emoji",children:"偷取表情包"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人将一些表情包据为己有"})]}),e.jsx(Ve,{id:"steal_emoji",checked:l.steal_emoji,onCheckedChange:r=>i({...l,steal_emoji:r})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{htmlFor:"content_filtration",children:"启用表情包过滤"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"只保存符合要求的表情包"})]}),e.jsx(Ve,{id:"content_filtration",checked:l.content_filtration,onCheckedChange:r=>i({...l,content_filtration:r})})]}),l.content_filtration&&e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{htmlFor:"filtration_prompt",children:"过滤要求"}),e.jsx(ne,{id:"filtration_prompt",placeholder:"例如:符合公序良俗",value:l.filtration_prompt,onChange:r=>i({...l,filtration_prompt:r.target.value})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"描述表情包应该符合的要求"})]})]})}function gw({config:l,onChange:i}){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(C,{htmlFor:"enable_tool",children:"启用工具系统"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人使用各种工具增强功能"})]}),e.jsx(Ve,{id:"enable_tool",checked:l.enable_tool,onCheckedChange:r=>i({...l,enable_tool:r})})]}),e.jsx(fo,{}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{htmlFor:"all_global",children:"启用全局黑话模式"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人学习和使用群组黑话"})]}),e.jsx(Ve,{id:"all_global",checked:l.all_global,onCheckedChange:r=>i({...l,all_global:r})})]})]})}function jw({config:l,onChange:i}){const[r,o]=m.useState(!1);return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"rounded-lg bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"mt-0.5",children:e.jsx("svg",{className:"h-5 w-5 text-blue-600 dark:text-blue-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),e.jsxs("div",{className:"flex-1 text-sm",children:[e.jsx("p",{className:"font-medium text-blue-900 dark:text-blue-100 mb-1",children:"关于硅基流动 (SiliconFlow)"}),e.jsx("p",{className:"text-blue-700 dark:text-blue-300 mb-2",children:"硅基流动提供了完整的模型覆盖,包括 DeepSeek V3、Qwen、视觉模型、语音识别和嵌入模型。 只需一个 API Key 即可使用麦麦的所有功能!"}),e.jsxs("a",{href:"https://cloud.siliconflow.cn",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-blue-600 dark:text-blue-400 hover:underline font-medium",children:["前往硅基流动获取 API Key",e.jsx(Wc,{className:"h-3 w-3"})]})]})]})}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(C,{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:l.api_key,onChange:u=>i({api_key:u.target.value}),className:"font-mono pr-10"}),e.jsx(_,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent",onClick:()=>o(!r),children:r?e.jsx(vr,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(Qt,{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 vw(){const l=await Te("/api/webui/config/bot",{method:"GET",headers:Fs()});if(!l.ok)throw new Error("读取Bot配置失败");const r=(await l.json()).config.bot||{};return{qq_account:r.qq_account||0,nickname:r.nickname||"",alias_names:r.alias_names||[]}}async function bw(){const l=await Te("/api/webui/config/bot",{method:"GET",headers:Fs()});if(!l.ok)throw new Error("读取人格配置失败");const r=(await l.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 Nw(){const l=await Te("/api/webui/config/bot",{method:"GET",headers:Fs()});if(!l.ok)throw new Error("读取表情包配置失败");const r=(await l.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 yw(){const l=await Te("/api/webui/config/bot",{method:"GET",headers:Fs()});if(!l.ok)throw new Error("读取其他配置失败");const r=(await l.json()).config,o=r.tool||{},u=r.expression||{};return{enable_tool:o.enable_tool??!0,all_global:u.all_global_jargon??!0}}async function ww(){const l=await Te("/api/webui/config/model",{method:"GET",headers:Fs()});if(!l.ok)throw new Error("读取模型配置失败");return{api_key:((await l.json()).config.api_providers||[]).find(x=>x.name==="SiliconFlow")?.api_key||""}}async function _w(l){const i=await Te("/api/webui/config/bot/section/bot",{method:"POST",headers:Fs(),body:JSON.stringify(l)});if(!i.ok){const r=await i.json();throw new Error(r.detail||"保存Bot基础配置失败")}return await i.json()}async function Sw(l){const i=await Te("/api/webui/config/bot/section/personality",{method:"POST",headers:Fs(),body:JSON.stringify(l)});if(!i.ok){const r=await i.json();throw new Error(r.detail||"保存人格配置失败")}return await i.json()}async function Cw(l){const i=await Te("/api/webui/config/bot/section/emoji",{method:"POST",headers:Fs(),body:JSON.stringify(l)});if(!i.ok){const r=await i.json();throw new Error(r.detail||"保存表情包配置失败")}return await i.json()}async function kw(l){const i=[];i.push(Te("/api/webui/config/bot/section/tool",{method:"POST",headers:Fs(),body:JSON.stringify({enable_tool:l.enable_tool})})),i.push(Te("/api/webui/config/bot/section/expression",{method:"POST",headers:Fs(),body:JSON.stringify({all_global_jargon:l.all_global})}));const r=await Promise.all(i);for(const o of r)if(!o.ok){const u=await o.json();throw new Error(u.detail||"保存其他配置失败")}return{success:!0}}async function Tw(l){const i=await Te("/api/webui/config/model",{method:"GET",headers:Fs()});if(!i.ok)throw new Error("读取模型配置失败");const o=(await i.json()).config,u=o.api_providers||[],x=u.findIndex(g=>g.name==="SiliconFlow");x>=0?u[x]={...u[x],api_key:l.api_key}:u.push({name:"SiliconFlow",base_url:"https://api.siliconflow.cn/v1",api_key:l.api_key,client_type:"openai",max_retry:3,timeout:120,retry_interval:5});const h={...o,api_providers:u},f=await Te("/api/webui/config/model",{method:"POST",headers:Fs(),body:JSON.stringify(h)});if(!f.ok){const g=await f.json();throw new Error(g.detail||"保存模型配置失败")}return await f.json()}async function Sp(){const l=localStorage.getItem("access-token"),i=await Te("/api/webui/setup/complete",{method:"POST",headers:{Authorization:`Bearer ${l}`}});if(!i.ok){const r=await i.json();throw new Error(r.message||"标记配置完成失败")}return await i.json()}async function po(){const l=await Te("/api/webui/system/restart",{method:"POST",headers:Fs()});if(!l.ok){const i=await l.json();throw new Error(i.detail||"重启失败")}return await l.json()}async function uj(){const l=await Te("/api/webui/system/status",{method:"GET",headers:Fs()});if(!l.ok){const i=await l.json();throw new Error(i.detail||"获取状态失败")}return await l.json()}function Ew(){const l=Ea(),{toast:i}=Vs(),[r,o]=m.useState(0),[u,x]=m.useState(!1),[h,f]=m.useState(!1),[g,j]=m.useState(!0),[v,N]=m.useState({qq_account:0,nickname:"",alias_names:[]}),[y,S]=m.useState({personality:"是一个女大学生,现在在读大二,会刷贴吧。",reply_style:"请回复的平淡一些,简短一些,说中文,不要刻意突出自身学科背景。可以参考贴吧,知乎和微博的回复风格。",interest:"对技术相关话题,游戏和动漫相关话题感兴趣,也对日常话题感兴趣,不喜欢太过沉重严肃的话题",plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 2.如果相同的内容已经被执行,请不要重复执行 3.请控制你的发言频率,不要太过频繁的发言 4.如果有人对你感到厌烦,请减少回复 5.如果有人对你进行攻击,或者情绪激动,请你以合适的方法应对`,private_plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 2.如果相同的内容已经被执行,请不要重复执行 -3.某句话如果已经被回复过,不要重复回复`}),[w,R]=m.useState({emoji_chance:.4,max_reg_num:40,do_replace:!0,check_interval:10,steal_emoji:!0,content_filtration:!1,filtration_prompt:"符合公序良俗"}),[O,U]=m.useState({enable_tool:!0,all_global:!0}),[G,L]=m.useState({api_key:""}),[T,F]=m.useState(!1),[q,z]=m.useState(""),M=[{id:"bot-basic",title:"Bot基础",description:"配置机器人的基本信息",icon:mr},{id:"personality",title:"人格配置",description:"定义机器人的性格和说话风格",icon:io},{id:"emoji",title:"表情包",description:"配置表情包相关设置",icon:am},{id:"other",title:"其他设置",description:"工具、情绪系统等配置",icon:hi},{id:"siliconflow",title:"API配置",description:"配置硅基流动API密钥",icon:Og}],Q=(r+1)/M.length*100;m.useEffect(()=>{(async()=>{try{v(!0);const[Y,K,re,k,ne]=await Promise.all([jw(),vw(),bw(),Nw(),yw()]);N(Y),S(K),R(re),U(k),L(ne)}catch(Y){i({title:"加载配置失败",description:Y instanceof Error?Y.message:"无法加载现有配置,将使用默认值",variant:"destructive"})}finally{v(!1)}})()},[i]);const fe=async()=>{p(!0);try{switch(r){case 0:await ww(j);break;case 1:await _w(y);break;case 2:await Sw(w);break;case 3:await Cw(O);break;case 4:await kw(G);break}return i({title:"保存成功",description:`${M[r].title}配置已保存`}),!0}catch(D){return i({title:"保存失败",description:D instanceof Error?D.message:"未知错误",variant:"destructive"}),!1}finally{p(!1)}},ve=async()=>{await fe()&&r{r>0&&o(r-1)},be=async()=>{x(!0),F(!0);try{if(z("正在保存API配置..."),!await fe()){x(!1),F(!1);return}z("正在完成初始化..."),await Sp(),z("正在重启麦麦..."),await fo(),i({title:"配置完成",description:"麦麦正在重启以应用新配置..."}),z("等待麦麦重启完成...");const Y=60;let K=0,re=!1;for(;KsetTimeout(k,1e3));try{(await ej()).running&&(re=!0,z("重启成功!正在跳转..."))}catch{K++}}if(!re)throw new Error("重启超时,请手动检查麦麦状态");setTimeout(()=>{l({to:"/"})},1e3)}catch(D){F(!1),i({title:"配置失败",description:D instanceof Error?D.message:"未知错误",variant:"destructive"})}finally{x(!1)}},je=async()=>{try{await Sp(),l({to:"/"})}catch(D){i({title:"跳过失败",description:D instanceof Error?D.message:"未知错误",variant:"destructive"})}},Ne=()=>{switch(r){case 0:return e.jsx(xw,{config:j,onChange:N});case 1:return e.jsx(hw,{config:y,onChange:S});case 2:return e.jsx(fw,{config:w,onChange:R});case 3:return e.jsx(pw,{config:O,onChange:U});case 4:return e.jsx(gw,{config:G,onChange:L});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:[T&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm",children:e.jsxs("div",{className:"mx-auto flex max-w-md flex-col items-center space-y-6 rounded-lg border bg-card p-8 text-center shadow-lg",children:[e.jsx("div",{className:"flex h-20 w-20 items-center justify-center rounded-full bg-primary/10",children:e.jsx(mt,{className:"h-10 w-10 animate-spin text-primary"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h2",{className:"text-2xl font-bold",children:"正在重启麦麦"}),e.jsx("p",{className:"text-muted-foreground",children:q})]}),e.jsx("div",{className:"w-full",children:e.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-secondary",children:e.jsx("div",{className:"h-full w-full animate-pulse bg-primary",style:{animation:"pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite"}})})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"请稍候,这可能需要一分钟..."})]})}),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(yy,{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:["让我们一起完成 ",rm," 的初始配置"]})]}),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:["步骤 ",r+1," / ",M.length]}),e.jsxs("span",{className:"font-medium text-primary",children:[Math.round(Q),"%"]})]}),e.jsx(gi,{value:Q,className:"h-2"})]}),e.jsx("div",{className:"mb-6 md:mb-8 flex justify-between",children:M.map((D,Y)=>{const K=D.icon;return e.jsxs("div",{className:H("flex flex-1 flex-col items-center gap-1 md:gap-2",Yl({to:"/"}),className:"gap-2 w-full sm:w-auto",children:[e.jsx(mo,{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(di,{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 Ew=Et.memo(function({config:i,onChange:r}){const o=()=>{r({...i,platforms:[...i.platforms,""]})},u=v=>{r({...i,platforms:i.platforms.filter((j,N)=>N!==v)})},x=(v,j)=>{const N=[...i.platforms];N[v]=j,r({...i,platforms:N})},h=()=>{r({...i,alias_names:[...i.alias_names,""]})},p=v=>{r({...i,alias_names:i.alias_names.filter((j,N)=>N!==v)})},g=(v,j)=>{const N=[...i.alias_names];N[v]=j,r({...i,alias_names:N})};return e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"基本信息"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"platform",children:"平台"}),e.jsx(ie,{id:"platform",value:i.platform,onChange:v=>r({...i,platform:v.target.value}),placeholder:"qq"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"qq_account",children:"QQ账号"}),e.jsx(ie,{id:"qq_account",value:i.qq_account,onChange:v=>r({...i,qq_account:v.target.value}),placeholder:"123456789"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"nickname",children:"昵称"}),e.jsx(ie,{id:"nickname",value:i.nickname,onChange:v=>r({...i,nickname:v.target.value}),placeholder:"麦麦"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{children:"其他平台账号"}),e.jsxs(_,{onClick:o,size:"sm",variant:"outline",children:[e.jsx(ft,{className:"h-4 w-4 mr-1"}),"添加"]})]}),e.jsxs("div",{className:"space-y-2",children:[i.platforms.map((v,j)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ie,{value:v,onChange:N=>x(j,N.target.value),placeholder:"wx:114514"}),e.jsxs(ms,{children:[e.jsx(ut,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(es,{className:"h-4 w-4"})})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:['确定要删除平台账号 "',v||"(空)",'" 吗?此操作无法撤销。']})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>u(j),children:"删除"})]})]})]})]},j)),i.platforms.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(C,{children:"别名"}),e.jsxs(_,{onClick:h,size:"sm",variant:"outline",children:[e.jsx(ft,{className:"h-4 w-4 mr-1"}),"添加"]})]}),e.jsxs("div",{className:"space-y-2",children:[i.alias_names.map((v,j)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ie,{value:v,onChange:N=>g(j,N.target.value),placeholder:"小麦"}),e.jsxs(ms,{children:[e.jsx(ut,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(es,{className:"h-4 w-4"})})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:['确定要删除别名 "',v||"(空)",'" 吗?此操作无法撤销。']})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>p(j),children:"删除"})]})]})]})]},j)),i.alias_names.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无别名"})]})]})]})]})})}),zw=Et.memo(function({config:i,onChange:r}){const o=()=>{r({...i,states:[...i.states,""]})},u=h=>{r({...i,states:i.states.filter((p,g)=>g!==h)})},x=(h,p)=>{const g=[...i.states];g[h]=p,r({...i,states:g})};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(C,{htmlFor:"personality",children:"人格特质"}),e.jsx(Is,{id:"personality",value:i.personality,onChange:h=>r({...i,personality:h.target.value}),placeholder:"描述人格特质和身份特征(建议120字以内)",rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"建议120字以内,描述人格特质和身份特征"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"reply_style",children:"表达风格"}),e.jsx(Is,{id:"reply_style",value:i.reply_style,onChange:h=>r({...i,reply_style:h.target.value}),placeholder:"描述说话的表达风格和习惯",rows:3})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"interest",children:"兴趣"}),e.jsx(Is,{id:"interest",value:i.interest,onChange:h=>r({...i,interest:h.target.value}),placeholder:"会影响麦麦对什么话题进行回复",rows:2})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"plan_style",children:"说话规则与行为风格"}),e.jsx(Is,{id:"plan_style",value:i.plan_style,onChange:h=>r({...i,plan_style:h.target.value}),placeholder:"麦麦的说话规则和行为风格",rows:5})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"visual_style",children:"识图规则"}),e.jsx(Is,{id:"visual_style",value:i.visual_style,onChange:h=>r({...i,visual_style:h.target.value}),placeholder:"识图时的处理规则",rows:3})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"private_plan_style",children:"私聊规则"}),e.jsx(Is,{id:"private_plan_style",value:i.private_plan_style,onChange:h=>r({...i,private_plan_style:h.target.value}),placeholder:"私聊的说话规则和行为风格",rows:4})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{children:"状态列表(人格多样性)"}),e.jsxs(_,{onClick:o,size:"sm",variant:"outline",children:[e.jsx(ft,{className:"h-4 w-4 mr-1"}),"添加状态"]})]}),e.jsx("div",{className:"space-y-2",children:i.states.map((h,p)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Is,{value:h,onChange:g=>x(p,g.target.value),placeholder:"描述一个人格状态",rows:2}),e.jsxs(ms,{children:[e.jsx(ut,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(es,{className:"h-4 w-4"})})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsx(os,{children:"确定要删除这个人格状态吗?此操作无法撤销。"})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>u(p),children:"删除"})]})]})]})]},p))})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"state_probability",children:"状态替换概率"}),e.jsx(ie,{id:"state_probability",type:"number",step:"0.1",min:"0",max:"1",value:i.state_probability,onChange:h=>r({...i,state_probability:parseFloat(h.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"每次构建人格时替换 personality 的概率(0.0-1.0)"})]})]})]})})}),Be=ey,He=sy,Le=m.forwardRef(({className:l,children:i,...r},o)=>e.jsxs(hg,{ref:o,className:H("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",l),...r,children:[i,e.jsx(XN,{asChild:!0,children:e.jsx(Qa,{className:"h-4 w-4 opacity-50"})})]}));Le.displayName=hg.displayName;const tj=m.forwardRef(({className:l,...i},r)=>e.jsx(fg,{ref:r,className:H("flex cursor-default items-center justify-center py-1",l),...i,children:e.jsx(ui,{className:"h-4 w-4"})}));tj.displayName=fg.displayName;const aj=m.forwardRef(({className:l,...i},r)=>e.jsx(pg,{ref:r,className:H("flex cursor-default items-center justify-center py-1",l),...i,children:e.jsx(Qa,{className:"h-4 w-4"})}));aj.displayName=pg.displayName;const Ue=m.forwardRef(({className:l,children:i,position:r="popper",...o},u)=>e.jsx(JN,{children:e.jsxs(gg,{ref:u,className:H("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",l),position:r,...o,children:[e.jsx(tj,{}),e.jsx(PN,{className:H("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:i}),e.jsx(aj,{})]})}));Ue.displayName=gg.displayName;const Mw=m.forwardRef(({className:l,...i},r)=>e.jsx(jg,{ref:r,className:H("px-2 py-1.5 text-sm font-semibold",l),...i}));Mw.displayName=jg.displayName;const se=m.forwardRef(({className:l,children:i,...r},o)=>e.jsxs(vg,{ref:o,className:H("relative flex w-full cursor-default select-none items-center rounded-sm py-2 pl-2 pr-8 text-sm outline-none bg-white dark:bg-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 focus:bg-gray-100 dark:focus:bg-gray-800 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",l),...r,children:[e.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(ZN,{children:e.jsx(sa,{className:"h-4 w-4"})})}),e.jsx(WN,{children:i})]}));se.displayName=vg.displayName;const Aw=m.forwardRef(({className:l,...i},r)=>e.jsx(bg,{ref:r,className:H("-mx-1 my-1 h-px bg-muted",l),...i}));Aw.displayName=bg.displayName;const Ya=EN,Ka=zN,Ba=m.forwardRef(({className:l,align:i="center",sideOffset:r=4,...o},u)=>e.jsx(TN,{children:e.jsx(lg,{ref:u,align:i,sideOffset:r,className:H("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]",l),...o})}));Ba.displayName=lg.displayName;const Ow=Et.memo(function({value:i,onChange:r}){const[o,u]=m.useState("00"),[x,h]=m.useState("00"),[p,g]=m.useState("23"),[v,j]=m.useState("59");m.useEffect(()=>{const y=i.split("-");if(y.length===2){const[S,w]=y,[R,O]=S.split(":"),[U,G]=w.split(":");R&&u(R.padStart(2,"0")),O&&h(O.padStart(2,"0")),U&&g(U.padStart(2,"0")),G&&j(G.padStart(2,"0"))}},[i]);const N=(y,S,w,R)=>{const O=`${y}:${S}-${w}:${R}`;r(O)};return e.jsxs(Ya,{children:[e.jsx(Ka,{asChild:!0,children:e.jsxs(_,{variant:"outline",className:"w-full justify-start font-mono text-sm",children:[e.jsx(oi,{className:"h-4 w-4 mr-2"}),i||"选择时间段"]})}),e.jsx(Ba,{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(C,{className:"text-xs",children:"小时"}),e.jsxs(Be,{value:o,onValueChange:y=>{u(y),N(y,x,p,v)},children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsx(Ue,{children:Array.from({length:24},(y,S)=>S).map(y=>e.jsx(se,{value:y.toString().padStart(2,"0"),children:y.toString().padStart(2,"0")},y))})]})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-xs",children:"分钟"}),e.jsxs(Be,{value:x,onValueChange:y=>{h(y),N(o,y,p,v)},children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsx(Ue,{children:Array.from({length:60},(y,S)=>S).map(y=>e.jsx(se,{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(C,{className:"text-xs",children:"小时"}),e.jsxs(Be,{value:p,onValueChange:y=>{g(y),N(o,x,y,v)},children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsx(Ue,{children:Array.from({length:24},(y,S)=>S).map(y=>e.jsx(se,{value:y.toString().padStart(2,"0"),children:y.toString().padStart(2,"0")},y))})]})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-xs",children:"分钟"}),e.jsxs(Be,{value:v,onValueChange:y=>{j(y),N(o,x,p,y)},children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsx(Ue,{children:Array.from({length:60},(y,S)=>S).map(y=>e.jsx(se,{value:y.toString().padStart(2,"0"),children:y.toString().padStart(2,"0")},y))})]})]})]})]})]})})]})}),Dw=Et.memo(function({rule:i}){const r=`{ target = "${i.target}", time = "${i.time}", value = ${i.value.toFixed(1)} }`;return e.jsxs(Ya,{children:[e.jsx(Ka,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(Qt,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Ba,{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 文件中的格式"})]})})]})}),Rw=Et.memo(function({config:i,onChange:r}){const o=()=>{r({...i,talk_value_rules:[...i.talk_value_rules,{target:"",time:"00:00-23:59",value:1}]})},u=h=>{r({...i,talk_value_rules:i.talk_value_rules.filter((p,g)=>g!==h)})},x=(h,p,g)=>{const v=[...i.talk_value_rules];v[h]={...v[h],[p]:g},r({...i,talk_value_rules:v})};return e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"聊天设置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"talk_value",children:"聊天频率(基础值)"}),e.jsx(ie,{id:"talk_value",type:"number",step:"0.1",min:"0",max:"1",value:i.talk_value,onChange:h=>r({...i,talk_value:parseFloat(h.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"越小越沉默,范围 0-1"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Fe,{id:"mentioned_bot_reply",checked:i.mentioned_bot_reply,onCheckedChange:h=>r({...i,mentioned_bot_reply:h})}),e.jsx(C,{htmlFor:"mentioned_bot_reply",className:"cursor-pointer",children:"启用提及必回复"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"max_context_size",children:"上下文长度"}),e.jsx(ie,{id:"max_context_size",type:"number",min:"1",value:i.max_context_size,onChange:h=>r({...i,max_context_size:parseInt(h.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"planner_smooth",children:"规划器平滑"}),e.jsx(ie,{id:"planner_smooth",type:"number",step:"1",min:"0",value:i.planner_smooth,onChange:h=>r({...i,planner_smooth:parseFloat(h.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"增大数值会减小 planner 负荷,推荐 1-5,0 为关闭"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Fe,{id:"enable_talk_value_rules",checked:i.enable_talk_value_rules,onCheckedChange:h=>r({...i,enable_talk_value_rules:h})}),e.jsx(C,{htmlFor:"enable_talk_value_rules",className:"cursor-pointer",children:"启用动态发言频率规则"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Fe,{id:"include_planner_reasoning",checked:i.include_planner_reasoning,onCheckedChange:h=>r({...i,include_planner_reasoning:h})}),e.jsx(C,{htmlFor:"include_planner_reasoning",className:"cursor-pointer",children:"将 planner 推理加入 replyer"})]})]})]}),i.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:o,size:"sm",children:[e.jsx(ft,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),i.talk_value_rules&&i.talk_value_rules.length>0?e.jsx("div",{className:"space-y-4",children:i.talk_value_rules.map((h,p)=>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:["规则 #",p+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Dw,{rule:h}),e.jsxs(ms,{children:[e.jsx(ut,{asChild:!0,children:e.jsx(_,{variant:"ghost",size:"sm",children:e.jsx(es,{className:"h-4 w-4 text-destructive"})})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:["确定要删除规则 #",p+1," 吗?此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>u(p),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"配置类型"}),e.jsxs(Be,{value:h.target===""?"global":"specific",onValueChange:g=>{g==="global"?x(p,"target",""):x(p,"target","qq::group")},children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"global",children:"全局配置"}),e.jsx(se,{value:"specific",children:"详细配置"})]})]})]}),h.target!==""&&(()=>{const g=h.target.split(":"),v=g[0]||"qq",j=g[1]||"",N=g[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(C,{className:"text-xs font-medium",children:"平台"}),e.jsxs(Be,{value:v,onValueChange:y=>{x(p,"target",`${y}:${j}:${N}`)},children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"qq",children:"QQ"}),e.jsx(se,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"群 ID"}),e.jsx(ie,{value:j,onChange:y=>{x(p,"target",`${v}:${y.target.value}:${N}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"类型"}),e.jsxs(Be,{value:N,onValueChange:y=>{x(p,"target",`${v}:${j}:${y}`)},children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"group",children:"群组(group)"}),e.jsx(se,{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(C,{className:"text-xs font-medium",children:"时间段 (Time)"}),e.jsx(Ow,{value:h.time,onChange:g=>x(p,"time",g)}),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(C,{htmlFor:`rule-value-${p}`,className:"text-xs font-medium",children:"发言频率值 (Value)"}),e.jsx(ie,{id:`rule-value-${p}`,type:"number",step:"0.01",min:"0.01",max:"1",value:h.value,onChange:g=>{const v=parseFloat(g.target.value);isNaN(v)||x(p,"value",Math.max(.01,Math.min(1,v)))},className:"w-20 h-8 text-xs"})]}),e.jsx(Ca,{value:[h.value],onValueChange:g=>x(p,"value",g[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 (正常)"})]})]})]})]},p))}):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 表示正常发言"]})]})]})]})]})}),Lw=Et.memo(function({config:i,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 space-x-2",children:[e.jsx(Fe,{checked:i.enable_asr,onCheckedChange:o=>r({...i,enable_asr:o})}),e.jsx(C,{className:"cursor-pointer",children:"启用语音识别"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后麦麦可以识别语音消息,需要配置语音识别模型"})]})}),Uw=Et.memo(function({config:i,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(Fe,{checked:i.enable,onCheckedChange:o=>r({...i,enable:o})}),e.jsx(C,{className:"cursor-pointer",children:"启用 LPMM 知识库"})]}),i.enable&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"LPMM 模式"}),e.jsxs(Be,{value:i.lpmm_mode,onValueChange:o=>r({...i,lpmm_mode:o}),children:[e.jsx(Le,{children:e.jsx(He,{placeholder:"选择 LPMM 模式"})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"classic",children:"经典模式"}),e.jsx(se,{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(C,{children:"同义词搜索 TopK"}),e.jsx(ie,{type:"number",min:"1",value:i.rag_synonym_search_top_k,onChange:o=>r({...i,rag_synonym_search_top_k:parseInt(o.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"同义词阈值"}),e.jsx(ie,{type:"number",step:"0.1",min:"0",max:"1",value:i.rag_synonym_threshold,onChange:o=>r({...i,rag_synonym_threshold:parseFloat(o.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"实体提取线程数"}),e.jsx(ie,{type:"number",min:"1",value:i.info_extraction_workers,onChange:o=>r({...i,info_extraction_workers:parseInt(o.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"嵌入向量维度"}),e.jsx(ie,{type:"number",min:"1",value:i.embedding_dimension,onChange:o=>r({...i,embedding_dimension:parseInt(o.target.value)})})]})]})]})]})]})}),Bw=Et.memo(function({config:i,onChange:r}){const[o,u]=m.useState(""),[x,h]=m.useState("WARNING"),p=()=>{o&&!i.suppress_libraries.includes(o)&&(r({...i,suppress_libraries:[...i.suppress_libraries,o]}),u(""))},g=w=>{r({...i,suppress_libraries:i.suppress_libraries.filter(R=>R!==w)})},v=()=>{o&&!i.library_log_levels[o]&&(r({...i,library_log_levels:{...i.library_log_levels,[o]:x}}),u(""),h("WARNING"))},j=w=>{const R={...i.library_log_levels};delete R[w],r({...i,library_log_levels:R})},N=["DEBUG","INFO","WARNING","ERROR","CRITICAL"],y=["FULL","compact","lite"],S=["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(C,{children:"日期格式"}),e.jsx(ie,{value:i.date_style,onChange:w=>r({...i,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(C,{children:"日志级别样式"}),e.jsxs(Be,{value:i.log_level_style,onValueChange:w=>r({...i,log_level_style:w}),children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsx(Ue,{children:y.map(w=>e.jsx(se,{value:w,children:w},w))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"日志文本颜色"}),e.jsxs(Be,{value:i.color_text,onValueChange:w=>r({...i,color_text:w}),children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsx(Ue,{children:S.map(w=>e.jsx(se,{value:w,children:w},w))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"全局日志级别"}),e.jsxs(Be,{value:i.log_level,onValueChange:w=>r({...i,log_level:w}),children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsx(Ue,{children:N.map(w=>e.jsx(se,{value:w,children:w},w))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"控制台日志级别"}),e.jsxs(Be,{value:i.console_log_level,onValueChange:w=>r({...i,console_log_level:w}),children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsx(Ue,{children:N.map(w=>e.jsx(se,{value:w,children:w},w))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"文件日志级别"}),e.jsxs(Be,{value:i.file_log_level,onValueChange:w=>r({...i,file_log_level:w}),children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsx(Ue,{children:N.map(w=>e.jsx(se,{value:w,children:w},w))})]})]})]})]}),e.jsxs("div",{children:[e.jsx(C,{className:"mb-2 block",children:"完全屏蔽的库"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(ie,{value:o,onChange:w=>u(w.target.value),placeholder:"输入库名",className:"flex-1",onKeyDown:w=>{w.key==="Enter"&&(w.preventDefault(),p())}}),e.jsx(_,{onClick:p,size:"sm",className:"flex-shrink-0",children:e.jsx(ft,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:i.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:()=>g(w),children:e.jsx(es,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},w))})]}),e.jsxs("div",{children:[e.jsx(C,{className:"mb-2 block",children:"特定库的日志级别"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(ie,{value:o,onChange:w=>u(w.target.value),placeholder:"输入库名",className:"flex-1"}),e.jsxs(Be,{value:x,onValueChange:h,children:[e.jsx(Le,{className:"w-32",children:e.jsx(He,{})}),e.jsx(Ue,{children:N.map(w=>e.jsx(se,{value:w,children:w},w))})]}),e.jsx(_,{onClick:v,size:"sm",children:e.jsx(ft,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"space-y-2",children:Object.entries(i.library_log_levels).map(([w,R])=>e.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[e.jsx("span",{className:"text-sm font-medium",children:w}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:R}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>j(w),children:e.jsx(es,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]})]},w))})]})]})}),Hw=Et.memo(function({config:i,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(C,{children:"显示 Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否在日志中显示提示词"})]}),e.jsx(Fe,{checked:i.show_prompt,onCheckedChange:o=>r({...i,show_prompt:o})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{children:"显示回复器 Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的提示词"})]}),e.jsx(Fe,{checked:i.show_replyer_prompt,onCheckedChange:o=>r({...i,show_replyer_prompt:o})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{children:"显示回复器推理"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的推理过程"})]}),e.jsx(Fe,{checked:i.show_replyer_reasoning,onCheckedChange:o=>r({...i,show_replyer_reasoning:o})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{children:"显示 Jargon Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示术语相关的提示词"})]}),e.jsx(Fe,{checked:i.show_jargon_prompt,onCheckedChange:o=>r({...i,show_jargon_prompt:o})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{children:"显示记忆检索 Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示记忆检索相关的提示词"})]}),e.jsx(Fe,{checked:i.show_memory_prompt,onCheckedChange:o=>r({...i,show_memory_prompt:o})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{children:"显示 Planner Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示 Planner 的提示词和原始返回结果"})]}),e.jsx(Fe,{checked:i.show_planner_prompt,onCheckedChange:o=>r({...i,show_planner_prompt:o})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{children:"显示 LPMM 相关文段"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示 LPMM 知识库找到的相关文段日志"})]}),e.jsx(Fe,{checked:i.show_lpmm_paragraph,onCheckedChange:o=>r({...i,show_lpmm_paragraph:o})})]})]})]})}),$w=Et.memo(function({config:i,onChange:r}){const[o,u]=m.useState(""),x=()=>{o&&!i.auth_token.includes(o)&&(r({...i,auth_token:[...i.auth_token,o]}),u(""))},h=p=>{r({...i,auth_token:i.auth_token.filter((g,v)=>v!==p)})};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:"MaimMessage 服务配置"}),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(C,{children:"启用自定义服务器"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否使用自定义的 MaimMessage 服务器"})]}),e.jsx(Fe,{checked:i.use_custom,onCheckedChange:p=>r({...i,use_custom:p})})]}),i.use_custom&&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(C,{children:"主机地址"}),e.jsx(ie,{value:i.host,onChange:p=>r({...i,host:p.target.value}),placeholder:"127.0.0.1"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"端口号"}),e.jsx(ie,{type:"number",value:i.port,onChange:p=>r({...i,port:parseInt(p.target.value)}),placeholder:"8090"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"连接模式"}),e.jsxs(Be,{value:i.mode,onValueChange:p=>r({...i,mode:p}),children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"ws",children:"WebSocket (ws)"}),e.jsx(se,{value:"tcp",children:"TCP"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Fe,{checked:i.use_wss,onCheckedChange:p=>r({...i,use_wss:p}),disabled:i.mode!=="ws"}),e.jsx(C,{children:"使用 WSS 安全连接"})]})]}),i.use_wss&&i.mode==="ws"&&e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"SSL 证书文件路径"}),e.jsx(ie,{value:i.cert_file,onChange:p=>r({...i,cert_file:p.target.value}),placeholder:"cert.pem"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"SSL 密钥文件路径"}),e.jsx(ie,{value:i.key_file,onChange:p=>r({...i,key_file:p.target.value}),placeholder:"key.pem"})]})]})]})]})]}),e.jsxs("div",{children:[e.jsx(C,{className:"mb-2 block",children:"认证令牌"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"用于 API 验证,为空则不启用验证"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(ie,{value:o,onChange:p=>u(p.target.value),placeholder:"输入认证令牌",onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),x())}}),e.jsx(_,{onClick:x,size:"sm",children:e.jsx(ft,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"space-y-2",children:i.auth_token.map((p,g)=>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:p}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>h(g),children:e.jsx(es,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},g))})]})]})}),qw=Et.memo(function({config:i,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(C,{children:"启用统计信息发送"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"发送匿名统计信息,帮助我们了解全球有多少只麦麦在运行"})]}),e.jsx(Fe,{checked:i.enable,onCheckedChange:o=>r({...i,enable:o})})]})]})}),Gw=Et.memo(function({emojiConfig:i,memoryConfig:r,toolConfig:o,onEmojiChange:u,onMemoryChange:x,onToolChange:h}){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:"flex items-center space-x-2",children:[e.jsx(Fe,{id:"enable_tool",checked:o.enable_tool,onCheckedChange:p=>h({...o,enable_tool:p})}),e.jsx(C,{htmlFor:"enable_tool",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(C,{htmlFor:"max_agent_iterations",children:"记忆思考深度"}),e.jsx(ie,{id:"max_agent_iterations",type:"number",min:"1",value:r.max_agent_iterations,onChange:p=>x({...r,max_agent_iterations:parseInt(p.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"最低为 1(不深入思考)"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"agent_timeout_seconds",children:"最长回忆时间(秒)"}),e.jsx(ie,{id:"agent_timeout_seconds",type:"number",min:"1",step:"0.1",value:r.agent_timeout_seconds??120,onChange:p=>x({...r,agent_timeout_seconds:parseFloat(p.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"记忆检索的超时时间,避免过长的等待"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Fe,{id:"enable_jargon_detection",checked:r.enable_jargon_detection??!0,onCheckedChange:p=>x({...r,enable_jargon_detection:p})}),e.jsx(C,{htmlFor:"enable_jargon_detection",className:"cursor-pointer",children:"启用黑话识别"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"记忆检索过程中是否启用黑话识别"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Fe,{id:"global_memory",checked:r.global_memory??!1,onCheckedChange:p=>x({...r,global_memory:p})}),e.jsx(C,{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(C,{htmlFor:"emoji_chance",children:"表情包激活概率"}),e.jsx(ie,{id:"emoji_chance",type:"number",step:"0.1",min:"0",max:"1",value:i.emoji_chance,onChange:p=>u({...i,emoji_chance:parseFloat(p.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"范围 0-1,越大越容易发送表情包"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"max_reg_num",children:"最大注册数量"}),e.jsx(ie,{id:"max_reg_num",type:"number",min:"1",value:i.max_reg_num,onChange:p=>u({...i,max_reg_num:parseInt(p.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦最多可以注册的表情包数量"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),e.jsx(ie,{id:"check_interval",type:"number",min:"1",value:i.check_interval,onChange:p=>u({...i,check_interval:parseInt(p.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包(注册、破损、删除)的时间间隔"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Fe,{id:"do_replace",checked:i.do_replace,onCheckedChange:p=>u({...i,do_replace:p})}),e.jsx(C,{htmlFor:"do_replace",className:"cursor-pointer",children:"达到最大数量时替换表情包"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Fe,{id:"steal_emoji",checked:i.steal_emoji,onCheckedChange:p=>u({...i,steal_emoji:p})}),e.jsx(C,{htmlFor:"steal_emoji",className:"cursor-pointer",children:"偷取表情包"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许麦麦将看到的表情包据为己有"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Fe,{id:"content_filtration",checked:i.content_filtration,onCheckedChange:p=>u({...i,content_filtration:p})}),e.jsx(C,{htmlFor:"content_filtration",className:"cursor-pointer",children:"启用表情包过滤"})]}),i.content_filtration&&e.jsxs("div",{className:"grid gap-2 pl-6 border-l-2 border-primary/20",children:[e.jsx(C,{htmlFor:"filtration_prompt",children:"过滤要求"}),e.jsx(ie,{id:"filtration_prompt",value:i.filtration_prompt,onChange:p=>u({...i,filtration_prompt:p.target.value}),placeholder:"符合公序良俗"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"只有符合此要求的表情包才会被保存"})]})]})]})})]})}),Fw=Et.memo(function({member:i,groupIndex:r,memberIndex:o,availableChatIds:u,onUpdate:x,onRemove:h}){const p=u.includes(i)||i==="*",[g,v]=m.useState(!p);return e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:"flex-1 flex gap-2",children:g?e.jsxs(e.Fragment,{children:[e.jsx(ie,{value:i,onChange:j=>x(r,o,j.target.value),placeholder:'输入 "*" 或 "qq:123456:group"',className:"flex-1"}),u.length>0&&e.jsx(_,{size:"sm",variant:"outline",onClick:()=>v(!1),title:"切换到下拉选择",children:"下拉"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(Be,{value:i,onValueChange:j=>x(r,o,j),children:[e.jsx(Le,{className:"flex-1",children:e.jsx(He,{placeholder:"选择聊天流"})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"*",children:"* (全局共享)"}),u.map((j,N)=>e.jsx(se,{value:j,children:j},N))]})]}),e.jsx(_,{size:"sm",variant:"outline",onClick:()=>v(!0),title:"切换到手动输入",children:"输入"})]})}),e.jsxs(ms,{children:[e.jsx(ut,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(es,{className:"h-4 w-4"})})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:['确定要删除组成员 "',i||"(空)",'" 吗?此操作无法撤销。']})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>h(r,o),children:"删除"})]})]})]})]})}),Vw=Et.memo(function({config:i,onChange:r}){const o=()=>{r({...i,learning_list:[...i.learning_list,["","enable","enable","1.0"]]})},u=y=>{r({...i,learning_list:i.learning_list.filter((S,w)=>w!==y)})},x=(y,S,w)=>{const R=[...i.learning_list];R[y][S]=w,r({...i,learning_list:R})},h=({rule:y})=>{const S=`["${y[0]}", "${y[1]}", "${y[2]}", "${y[3]}"]`;return e.jsxs(Ya,{children:[e.jsx(Ka,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(Qt,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Ba,{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:S}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},p=()=>{r({...i,expression_groups:[...i.expression_groups,[]]})},g=y=>{r({...i,expression_groups:i.expression_groups.filter((S,w)=>w!==y)})},v=y=>{const S=[...i.expression_groups];S[y]=[...S[y],""],r({...i,expression_groups:S})},j=(y,S)=>{const w=[...i.expression_groups];w[y]=w[y].filter((R,O)=>O!==S),r({...i,expression_groups:w})},N=(y,S,w)=>{const R=[...i.expression_groups];R[y][S]=w,r({...i,expression_groups:R})};return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"表达学习配置"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦如何学习和使用表达方式"})]}),e.jsxs(_,{onClick:o,size:"sm",variant:"outline",children:[e.jsx(ft,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),e.jsxs("div",{className:"space-y-4",children:[i.learning_list.map((y,S)=>{const w=i.learning_list.some((T,F)=>F!==S&&T[0]===""),R=y[0]==="",O=y[0].split(":"),U=O[0]||"qq",G=O[1]||"",L=O[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:["规则 ",S+1," ",R&&"(全局配置)"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{rule:y}),e.jsxs(ms,{children:[e.jsx(ut,{asChild:!0,children:e.jsx(_,{size:"sm",variant:"ghost",children:e.jsx(es,{className:"h-4 w-4"})})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:["确定要删除学习规则 ",S+1," 吗?此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>u(S),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"配置类型"}),e.jsxs(Be,{value:R?"global":"specific",onValueChange:T=>{T==="global"?x(S,0,""):x(S,0,"qq::group")},disabled:w&&!R,children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"global",children:"全局配置"}),e.jsx(se,{value:"specific",disabled:w&&!R,children:"详细配置"})]})]}),w&&!R&&e.jsx("p",{className:"text-xs text-amber-600",children:"已存在全局配置,无法创建新的全局配置"})]}),!R&&e.jsxs("div",{className:"grid gap-4 p-3 sm:p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"平台"}),e.jsxs(Be,{value:U,onValueChange:T=>{x(S,0,`${T}:${G}:${L}`)},children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"qq",children:"QQ"}),e.jsx(se,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"群 ID"}),e.jsx(ie,{value:G,onChange:T=>{x(S,0,`${U}:${T.target.value}:${L}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"类型"}),e.jsxs(Be,{value:L,onValueChange:T=>{x(S,0,`${U}:${G}:${T}`)},children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"group",children:"群组(group)"}),e.jsx(se,{value:"private",children:"私聊(private)"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",y[0]||"(未设置)"]})]}),e.jsx("div",{className:"grid gap-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-xs font-medium",children:"使用学到的表达"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦使用从聊天中学到的表达方式"})]}),e.jsx(Fe,{checked:y[1]==="enable",onCheckedChange:T=>x(S,1,T?"enable":"disable")})]})}),e.jsx("div",{className:"grid gap-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-xs font-medium",children:"学习表达"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦从聊天中学习新的表达方式"})]}),e.jsx(Fe,{checked:y[2]==="enable",onCheckedChange:T=>x(S,2,T?"enable":"disable")})]})}),e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{className:"text-xs font-medium",children:"学习强度"}),e.jsx(ie,{type:"number",step:"0.1",min:"0",max:"5",value:y[3],onChange:T=>{const F=parseFloat(T.target.value);isNaN(F)||x(S,3,Math.max(0,Math.min(5,F)).toFixed(1))},className:"w-20 h-8 text-xs"})]}),e.jsx(Ca,{value:[parseFloat(y[3])||1],onValueChange:T=>x(S,3,T[0].toFixed(1)),min:0,max:5,step:.1,className:"w-full"}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"0 (不学习)"}),e.jsx("span",{children:"2.5"}),e.jsx("span",{children:"5.0 (快速学习)"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"影响学习频率,最短学习间隔 = 300/学习强度(秒)"})]})]})]},S)}),i.learning_list.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无学习规则,点击"添加规则"开始配置'})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"表达反思配置"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦主动向管理员询问表达方式是否合适的功能"})]}),e.jsx(Fe,{checked:i.reflect,onCheckedChange:y=>r({...i,reflect:y})})]}),i.reflect&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsx("span",{className:"text-sm font-medium",children:"反思操作员"})}),e.jsx("div",{className:"space-y-4",children:(()=>{const S=(i.reflect_operator_id||"").split(":"),w=S[0]||"qq",R=S[1]||"",O=S[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(C,{className:"text-xs font-medium",children:"平台"}),e.jsxs(Be,{value:w,onValueChange:U=>{r({...i,reflect_operator_id:`${U}:${R}:${O}`})},children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"qq",children:"QQ"}),e.jsx(se,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"用户/群 ID"}),e.jsx(ie,{value:R,onChange:U=>{r({...i,reflect_operator_id:`${w}:${U.target.value}:${O}`})},placeholder:"输入 ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"类型"}),e.jsxs(Be,{value:O,onValueChange:U=>{r({...i,reflect_operator_id:`${w}:${R}:${U}`})},children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"private",children:"私聊(private)"}),e.jsx(se,{value:"group",children:"群组(group)"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前操作员 ID:",i.reflect_operator_id||"(未设置)"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦会向此操作员询问表达方式是否合适"})]})})()})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-medium",children:"允许反思的聊天流"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"只有在此列表中的聊天流才会提出问题并跟踪。如果列表为空,则所有聊天流都可以进行表达反思"})]}),e.jsxs(_,{onClick:()=>{r({...i,allow_reflect:[...i.allow_reflect||[],"qq::group"]})},size:"sm",variant:"outline",children:[e.jsx(ft,{className:"h-4 w-4 mr-1"}),"添加聊天流"]})]}),e.jsxs("div",{className:"space-y-2",children:[(i.allow_reflect||[]).map((y,S)=>{const w=y.split(":"),R=w[0]||"qq",O=w[1]||"",U=w[2]||"group";return e.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg bg-muted/50",children:[e.jsxs(Be,{value:R,onValueChange:G=>{const L=[...i.allow_reflect];L[S]=`${G}:${O}:${U}`,r({...i,allow_reflect:L})},children:[e.jsx(Le,{className:"w-24",children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"qq",children:"QQ"}),e.jsx(se,{value:"wx",children:"微信"})]})]}),e.jsx(ie,{value:O,onChange:G=>{const L=[...i.allow_reflect];L[S]=`${R}:${G.target.value}:${U}`,r({...i,allow_reflect:L})},placeholder:"ID",className:"flex-1 font-mono text-sm"}),e.jsxs(Be,{value:U,onValueChange:G=>{const L=[...i.allow_reflect];L[S]=`${R}:${O}:${G}`,r({...i,allow_reflect:L})},children:[e.jsx(Le,{className:"w-32",children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"group",children:"群组"}),e.jsx(se,{value:"private",children:"私聊"})]})]}),e.jsx(_,{onClick:()=>{r({...i,allow_reflect:i.allow_reflect.filter((G,L)=>L!==S)})},size:"sm",variant:"ghost",children:e.jsx(es,{className:"h-4 w-4"})})]},S)}),(!i.allow_reflect||i.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:p,size:"sm",variant:"outline",children:[e.jsx(ft,{className:"h-4 w-4 mr-1"}),"添加共享组"]})]}),e.jsxs("div",{className:"space-y-4",children:[i.expression_groups.map((y,S)=>{const w=i.learning_list.map(R=>R[0]).filter(R=>R!=="");return e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["共享组 ",S+1,y.length===1&&y[0]==="*"&&"(全局共享)"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(_,{onClick:()=>v(S),size:"sm",variant:"outline",children:e.jsx(ft,{className:"h-4 w-4"})}),e.jsxs(ms,{children:[e.jsx(ut,{asChild:!0,children:e.jsx(_,{size:"sm",variant:"ghost",children:e.jsx(es,{className:"h-4 w-4"})})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:["确定要删除共享组 ",S+1," 吗?此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>g(S),children:"删除"})]})]})]})]})]}),e.jsx("div",{className:"space-y-2",children:y.map((R,O)=>e.jsx(Fw,{member:R,groupIndex:S,memberIndex:O,availableChatIds:w,onUpdate:N,onRemove:j},`${S}-${O}`))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:'提示:可以从下拉框选择已配置的聊天流,或手动输入。输入 "*" 启用全局共享'})]},S)}),i.expression_groups.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-4",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"黑话设置"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Fe,{id:"all_global_jargon",checked:i.all_global_jargon??!1,onCheckedChange:y=>r({...i,all_global_jargon:y})}),e.jsx(C,{htmlFor:"all_global_jargon",className:"cursor-pointer",children:"全局黑话模式"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"开启后,新增的黑话将默认设为全局(所有聊天流共享)。关闭后,已记录的全局黑话不会改变,需要手动删除。"})]})})]})});function Iw({regex:l,reaction:i,onRegexChange:r,onReactionChange:o}){const[u,x]=m.useState(!1),[h,p]=m.useState(""),[g,v]=m.useState(null),[j,N]=m.useState(""),[y,S]=m.useState({}),[w,R]=m.useState(""),O=m.useRef(null),[U,G]=m.useState("build"),L=z=>z.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),T=(z,M=0)=>{const Q=O.current;if(!Q)return;const fe=Q.selectionStart||0,ve=Q.selectionEnd||0,ge=l.substring(0,fe)+z+l.substring(ve);r(ge),setTimeout(()=>{const be=fe+z.length+M;Q.setSelectionRange(be,be),Q.focus()},0)};m.useEffect(()=>{if(!l||!h){v(null),S({}),R(i),N("");return}try{const z=L(l),M=new RegExp(z,"g"),Q=h.match(M);v(Q),N("");const ve=new RegExp(z).exec(h);if(ve&&ve.groups){S(ve.groups);let ge=i;Object.entries(ve.groups).forEach(([be,je])=>{ge=ge.replace(new RegExp(`\\[${be}\\]`,"g"),je||"")}),R(ge)}else S({}),R(i)}catch(z){N(z.message),v(null),S({}),R(i)}},[l,h,i]);const F=()=>{if(!h||!g||g.length===0)return e.jsx("span",{className:"text-muted-foreground",children:h||"请输入测试文本"});try{const z=L(l),M=new RegExp(z,"g");let Q=0;const fe=[];let ve;for(;(ve=M.exec(h))!==null;)ve.index>Q&&fe.push(e.jsx("span",{children:h.substring(Q,ve.index)},`text-${Q}`)),fe.push(e.jsx("span",{className:"bg-yellow-200 dark:bg-yellow-900 font-semibold",children:ve[0]},`match-${ve.index}`)),Q=ve.index+ve[0].length;return Q)",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(Gs,{open:u,onOpenChange:x,children:[e.jsx(cm,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(lm,{className:"h-4 w-4 mr-1"}),"正则编辑器"]})}),e.jsxs(Us,{className:"max-w-[95vw] sm:max-w-[900px] max-h-[90vh]",children:[e.jsxs(Bs,{children:[e.jsx(Hs,{children:"正则表达式编辑器"}),e.jsx(Ws,{className:"text-sm",children:"使用可视化工具构建正则表达式,并实时测试效果"})]}),e.jsx(Ze,{className:"max-h-[calc(90vh-120px)]",children:e.jsxs(ka,{value:U,onValueChange:z=>G(z),className:"w-full",children:[e.jsxs(xa,{className:"grid w-full grid-cols-2",children:[e.jsx(ts,{value:"build",children:"🔧 构建器"}),e.jsx(ts,{value:"test",children:"🧪 测试器"})]}),e.jsxs(Ms,{value:"build",className:"space-y-4 mt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{className:"text-sm font-medium",children:"正则表达式"}),e.jsx(ie,{ref:O,value:l,onChange:z=>r(z.target.value),className:"font-mono text-sm",placeholder:"点击下方按钮构建正则表达式..."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{className:"text-sm font-medium",children:"Reaction 内容"}),e.jsx(Is,{value:i,onChange:z=>o(z.target.value),placeholder:"使用 [捕获组名] 引用捕获的内容...",rows:3,className:"text-sm"})]}),e.jsxs("div",{className:"space-y-4 border-t pt-4",children:[q.map(z=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("h5",{className:"text-xs font-semibold text-primary",children:z.category}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:z.items.map(M=>e.jsx(_,{variant:"outline",size:"sm",className:"justify-start h-auto py-2 px-3",onClick:()=>T(M.pattern,M.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:M.label}),e.jsx("code",{className:"ml-auto text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:M.pattern})]}),e.jsx("span",{className:"text-xs text-muted-foreground mt-0.5",children:M.desc})]})},M.label))})]},z.category)),e.jsxs("div",{className:"space-y-2 border-t pt-4",children:[e.jsx("h5",{className:"text-xs font-semibold text-primary",children:"完整示例模板"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(_,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>r("^(?P\\S{1,20})是这样的$"),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsxs("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:["^(?P\\S","{1,20}",")是这样的$"]}),e.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「某事物是这样的」并捕获事物名称"})]})}),e.jsx(_,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>r("(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"}),e.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「我没要求你做某事」并捕获具体行为"})]})}),e.jsx(_,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>r("(?P.+?)(?:是|为什么|怎么)"),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?P.+?)(?:是|为什么|怎么)"}),e.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"捕获问题主题词"})]})})]})]})]}),e.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[e.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 使用提示"}),e.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[e.jsx("li",{children:"点击输入框设置光标位置,然后点击按钮插入模式"}),e.jsxs("li",{children:["命名捕获组格式:",e.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"(?P<名称>模式)"})]}),e.jsxs("li",{children:["在 reaction 中使用 ",e.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"[名称]"})," 引用捕获的内容"]}),e.jsx("li",{children:"切换到测试器标签页验证正则表达式效果"})]})]})]}),e.jsxs(Ms,{value:"test",className:"space-y-4 mt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{className:"text-sm font-medium",children:"当前正则表达式"}),e.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:l||"(未设置)"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"test-text",className:"text-sm font-medium",children:"测试文本"}),e.jsx(Is,{id:"test-text",value:h,onChange:z=>p(z.target.value),placeholder:`在此输入要测试的文本... -例如:打游戏是这样的`,className:"min-h-[100px] text-sm"})]}),j&&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:j})]}),!j&&h&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"flex items-center gap-2",children:g&&g.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:["匹配成功 (",g.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(C,{className:"text-sm font-medium",children:"匹配高亮"}),e.jsx(Ze,{className:"h-40 rounded-md bg-muted p-3",children:e.jsx("div",{className:"text-sm break-words",children:F()})})]}),Object.keys(y).length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{className:"text-sm font-medium",children:"命名捕获组"}),e.jsx(Ze,{className:"h-32 rounded-md border p-3",children:e.jsx("div",{className:"space-y-2",children:Object.entries(y).map(([z,M])=>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:["[",z,"]"]}),e.jsx("span",{className:"text-muted-foreground",children:"="}),e.jsx("span",{className:"font-mono bg-muted px-2 py-0.5 rounded",children:M})]},z))})})]}),Object.keys(y).length>0&&i&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{className:"text-sm font-medium",children:"Reaction 替换预览"}),e.jsx(Ze,{className:"h-48 rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3",children:e.jsx("div",{className:"text-sm break-words",children:w})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"reaction 中的 [name] 已被替换为对应的捕获组值"})]})]}),e.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[e.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 测试说明"}),e.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[e.jsx("li",{children:"匹配的文本会以黄色背景高亮显示"}),e.jsx("li",{children:"命名捕获组的值会显示在下方列表中"}),e.jsx("li",{children:"Reaction 替换预览显示最终生成的反应内容"}),e.jsx("li",{children:"如需修改正则,切换回构建器标签页"})]})]})]})]})})]})]})}const Qw=Et.memo(function({keywordReactionConfig:i,responsePostProcessConfig:r,chineseTypoConfig:o,responseSplitterConfig:u,onKeywordReactionChange:x,onResponsePostProcessChange:h,onChineseTypoChange:p,onResponseSplitterChange:g}){const v=()=>{x({...i,regex_rules:[...i.regex_rules,{regex:[""],reaction:""}]})},j=T=>{x({...i,regex_rules:i.regex_rules.filter((F,q)=>q!==T)})},N=(T,F,q)=>{const z=[...i.regex_rules];F==="regex"&&typeof q=="string"?z[T]={...z[T],regex:[q]}:F==="reaction"&&typeof q=="string"&&(z[T]={...z[T],reaction:q}),x({...i,regex_rules:z})},y=()=>{x({...i,keyword_rules:[...i.keyword_rules,{keywords:[],reaction:""}]})},S=T=>{x({...i,keyword_rules:i.keyword_rules.filter((F,q)=>q!==T)})},w=(T,F,q)=>{const z=[...i.keyword_rules];typeof q=="string"&&(z[T]={...z[T],reaction:q}),x({...i,keyword_rules:z})},R=T=>{const F=[...i.keyword_rules];F[T]={...F[T],keywords:[...F[T].keywords||[],""]},x({...i,keyword_rules:F})},O=(T,F)=>{const q=[...i.keyword_rules];q[T]={...q[T],keywords:(q[T].keywords||[]).filter((z,M)=>M!==F)},x({...i,keyword_rules:q})},U=(T,F,q)=>{const z=[...i.keyword_rules],M=[...z[T].keywords||[]];M[F]=q,z[T]={...z[T],keywords:M},x({...i,keyword_rules:z})},G=({rule:T})=>{const F=`{ regex = [${(T.regex||[]).map(q=>`"${q}"`).join(", ")}], reaction = "${T.reaction}" }`;return e.jsxs(Ya,{children:[e.jsx(Ka,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(Qt,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Ba,{className:"w-[95vw] sm:w-[500px]",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),e.jsx(Ze,{className:"h-60 rounded-md bg-muted p-3",children:e.jsx("pre",{className:"font-mono text-xs break-all",children:F})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},L=({rule:T})=>{const F=`[[keyword_reaction.keyword_rules]] -keywords = [${(T.keywords||[]).map(q=>`"${q}"`).join(", ")}] -reaction = "${T.reaction}"`;return e.jsxs(Ya,{children:[e.jsx(Ka,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(Qt,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Ba,{className:"w-[95vw] sm:w-[500px]",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),e.jsx(Ze,{className:"h-60 rounded-md bg-muted p-3",children:e.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-all",children:F})}),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:v,size:"sm",variant:"outline",children:[e.jsx(ft,{className:"h-4 w-4 mr-1"}),"添加正则规则"]})]}),e.jsxs("div",{className:"space-y-3",children:[i.regex_rules.map((T,F)=>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:["正则规则 ",F+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Iw,{regex:T.regex&&T.regex[0]||"",reaction:T.reaction,onRegexChange:q=>N(F,"regex",q),onReactionChange:q=>N(F,"reaction",q)}),e.jsx(G,{rule:T}),e.jsxs(ms,{children:[e.jsx(ut,{asChild:!0,children:e.jsx(_,{size:"sm",variant:"ghost",children:e.jsx(es,{className:"h-4 w-4"})})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:["确定要删除正则规则 ",F+1," 吗?此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>j(F),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"正则表达式(Python 语法)"}),e.jsx(ie,{value:T.regex&&T.regex[0]||"",onChange:q=>N(F,"regex",q.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(C,{className:"text-xs font-medium",children:"反应内容"}),e.jsx(Is,{value:T.reaction,onChange:q=>N(F,"reaction",q.target.value),placeholder:`触发后麦麦的反应... -可以使用 [捕获组名] 来引用正则表达式中的内容`,rows:3,className:"text-sm"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"使用 [捕获组名] 引用正则表达式中的命名捕获组,例如 [n] 会被替换为捕获的内容"})]})]})]},F)),i.regex_rules.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无正则规则,点击"添加正则规则"开始配置'})]})]}),e.jsxs("div",{className:"space-y-4 border-t pt-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-base font-semibold",children:"关键词规则"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用关键词列表匹配消息内容"})]}),e.jsxs(_,{onClick:y,size:"sm",variant:"outline",children:[e.jsx(ft,{className:"h-4 w-4 mr-1"}),"添加关键词规则"]})]}),e.jsxs("div",{className:"space-y-3",children:[i.keyword_rules.map((T,F)=>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:["关键词规则 ",F+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(L,{rule:T}),e.jsxs(ms,{children:[e.jsx(ut,{asChild:!0,children:e.jsx(_,{size:"sm",variant:"ghost",children:e.jsx(es,{className:"h-4 w-4"})})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:["确定要删除关键词规则 ",F+1," 吗?此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>S(F),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(C,{className:"text-xs font-medium",children:"关键词列表"}),e.jsxs(_,{onClick:()=>R(F),size:"sm",variant:"ghost",children:[e.jsx(ft,{className:"h-3 w-3 mr-1"}),"添加关键词"]})]}),e.jsxs("div",{className:"space-y-2",children:[(T.keywords||[]).map((q,z)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ie,{value:q,onChange:M=>U(F,z,M.target.value),placeholder:"关键词",className:"flex-1"}),e.jsx(_,{onClick:()=>O(F,z),size:"sm",variant:"ghost",children:e.jsx(es,{className:"h-4 w-4"})})]},z)),(!T.keywords||T.keywords.length===0)&&e.jsx("p",{className:"text-xs text-muted-foreground text-center py-2",children:'暂无关键词,点击"添加关键词"开始配置'})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"反应内容"}),e.jsx(Is,{value:T.reaction,onChange:q=>w(F,"reaction",q.target.value),placeholder:"触发后麦麦的反应...",rows:3,className:"text-sm"})]})]})]},F)),i.keyword_rules.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无关键词规则,点击"添加关键词规则"开始配置'})]})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"回复后处理配置"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Fe,{id:"enable_response_post_process",checked:r.enable_response_post_process,onCheckedChange:T=>h({...r,enable_response_post_process:T})}),e.jsx(C,{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(Fe,{id:"enable_chinese_typo",checked:o.enable,onCheckedChange:T=>p({...o,enable:T})}),e.jsx(C,{htmlFor:"enable_chinese_typo",className:"cursor-pointer font-semibold",children:"中文错别字生成器"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"为回复添加随机错别字,让麦麦的回复更自然"}),o.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(C,{htmlFor:"error_rate",className:"text-xs font-medium",children:"单字替换概率"}),e.jsx(ie,{id:"error_rate",type:"number",step:"0.001",min:"0",max:"1",value:o.error_rate,onChange:T=>p({...o,error_rate:parseFloat(T.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"min_freq",className:"text-xs font-medium",children:"最小字频阈值"}),e.jsx(ie,{id:"min_freq",type:"number",min:"0",value:o.min_freq,onChange:T=>p({...o,min_freq:parseInt(T.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"tone_error_rate",className:"text-xs font-medium",children:"声调错误概率"}),e.jsx(ie,{id:"tone_error_rate",type:"number",step:"0.01",min:"0",max:"1",value:o.tone_error_rate,onChange:T=>p({...o,tone_error_rate:parseFloat(T.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"word_replace_rate",className:"text-xs font-medium",children:"整词替换概率"}),e.jsx(ie,{id:"word_replace_rate",type:"number",step:"0.001",min:"0",max:"1",value:o.word_replace_rate,onChange:T=>p({...o,word_replace_rate:parseFloat(T.target.value)})})]})]})]})}),e.jsx("div",{className:"border-t pt-6 space-y-4",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[e.jsx(Fe,{id:"enable_response_splitter",checked:u.enable,onCheckedChange:T=>g({...u,enable:T})}),e.jsx(C,{htmlFor:"enable_response_splitter",className:"cursor-pointer font-semibold",children:"回复分割器"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"控制回复的长度和句子数量"}),u.enable&&e.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"max_length",className:"text-xs font-medium",children:"最大长度"}),e.jsx(ie,{id:"max_length",type:"number",min:"1",value:u.max_length,onChange:T=>g({...u,max_length:parseInt(T.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大字符数"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"max_sentence_num",className:"text-xs font-medium",children:"最大句子数"}),e.jsx(ie,{id:"max_sentence_num",type:"number",min:"1",value:u.max_sentence_num,onChange:T=>g({...u,max_sentence_num:parseInt(T.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大句子数量"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Fe,{id:"enable_kaomoji_protection",checked:u.enable_kaomoji_protection,onCheckedChange:T=>g({...u,enable_kaomoji_protection:T})}),e.jsx(C,{htmlFor:"enable_kaomoji_protection",className:"cursor-pointer",children:"启用颜文字保护"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Fe,{id:"enable_overflow_return_all",checked:u.enable_overflow_return_all,onCheckedChange:T=>g({...u,enable_overflow_return_all:T})}),e.jsx(C,{htmlFor:"enable_overflow_return_all",className:"cursor-pointer",children:"超出时一次性返回全部"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"当句子数量超出限制时,合并后一次性返回所有内容"})]})]})})]})]})]})}),Kl="/api/webui/config";async function Cp(){const i=await(await Te(`${Kl}/bot`)).json();if(!i.success)throw new Error("获取配置数据失败");return i.config}async function Il(){const i=await(await Te(`${Kl}/model`)).json();if(!i.success)throw new Error("获取模型配置数据失败");return i.config}async function kp(l){const r=await(await Te(`${Kl}/bot`,{method:"POST",body:JSON.stringify(l)})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}async function Yw(){const i=await(await Te(`${Kl}/bot/raw`)).json();if(!i.success)throw new Error("获取配置源代码失败");return i.content}async function Kw(l){const r=await(await Te(`${Kl}/bot/raw`,{method:"POST",body:JSON.stringify({raw_content:l})})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}async function jr(l){const r=await(await Te(`${Kl}/model`,{method:"POST",body:JSON.stringify(l)})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}async function Xw(l,i){const o=await(await Te(`${Kl}/bot/section/${l}`,{method:"POST",body:JSON.stringify(i)})).json();if(!o.success)throw new Error(o.message||`保存配置节 ${l} 失败`)}async function em(l,i){const o=await(await Te(`${Kl}/model/section/${l}`,{method:"POST",body:JSON.stringify(i)})).json();if(!o.success)throw new Error(o.message||`保存配置节 ${l} 失败`)}async function Jw(l,i="openai",r="/models"){const o=new URLSearchParams({provider_name:l,parser:i,endpoint:r}),u=await Te(`/api/webui/models/list?${o}`);if(!u.ok){const h=await u.json().catch(()=>({}));throw new Error(h.detail||`获取模型列表失败 (${u.status})`)}const x=await u.json();if(!x.success)throw new Error("获取模型列表失败");return x.models}async function Pw(l){const i=new URLSearchParams({provider_name:l}),r=await Te(`/api/webui/models/test-connection-by-name?${i}`,{method:"POST"});if(!r.ok){const o=await r.json().catch(()=>({}));throw new Error(o.detail||`测试连接失败 (${r.status})`)}return await r.json()}const Zw=xi("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"}}),ta=m.forwardRef(({className:l,variant:i,...r},o)=>e.jsx("div",{ref:o,role:"alert",className:H(Zw({variant:i}),l),...r}));ta.displayName="Alert";const Ww=m.forwardRef(({className:l,...i},r)=>e.jsx("h5",{ref:r,className:H("mb-1 font-medium leading-none tracking-tight",l),...i}));Ww.displayName="AlertTitle";const aa=m.forwardRef(({className:l,...i},r)=>e.jsx("div",{ref:r,className:H("text-sm [&_p]:leading-relaxed",l),...i}));aa.displayName="AlertDescription";function dm({onRestartComplete:l,onRestartFailed:i}){const[r,o]=m.useState(0),[u,x]=m.useState("restarting"),[h,p]=m.useState(0),[g,v]=m.useState(0);m.useEffect(()=>{const y=setInterval(()=>{o(R=>R>=90?R:R+1)},200),S=setInterval(()=>{p(R=>R+1)},1e3),w=setTimeout(()=>{x("checking"),j()},3e3);return()=>{clearInterval(y),clearInterval(S),clearTimeout(w)}},[]);const j=()=>{const S=async()=>{try{if(v(R=>R+1),(await fetch("/api/webui/system/status",{method:"GET",headers:{"Content-Type":"application/json"},signal:AbortSignal.timeout(3e3)})).ok)o(100),x("success"),setTimeout(()=>{l?.()},1500);else throw new Error("Status check failed")}catch{g<60?setTimeout(S,2e3):(x("failed"),i?.())}};S()},N=y=>{const S=Math.floor(y/60),w=y%60;return`${S}:${w.toString().padStart(2,"0")}`};return e.jsx("div",{className:"fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center",children:e.jsxs("div",{className:"max-w-md w-full mx-4 space-y-8",children:[e.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[u==="restarting"&&e.jsxs(e.Fragment,{children:[e.jsx(mt,{className:"h-16 w-16 text-primary animate-spin"}),e.jsx("h2",{className:"text-2xl font-bold",children:"正在重启麦麦"}),e.jsx("p",{className:"text-muted-foreground text-center",children:"请稍候,麦麦正在重启中..."})]}),u==="checking"&&e.jsxs(e.Fragment,{children:[e.jsx(mt,{className:"h-16 w-16 text-primary animate-spin"}),e.jsx("h2",{className:"text-2xl font-bold",children:"检查服务状态"}),e.jsxs("p",{className:"text-muted-foreground text-center",children:["等待服务恢复... (尝试 ",g,"/60)"]})]}),u==="success"&&e.jsxs(e.Fragment,{children:[e.jsx(ma,{className:"h-16 w-16 text-green-500"}),e.jsx("h2",{className:"text-2xl font-bold",children:"重启成功"}),e.jsx("p",{className:"text-muted-foreground text-center",children:"正在跳转到登录页面..."})]}),u==="failed"&&e.jsxs(e.Fragment,{children:[e.jsx(Gt,{className:"h-16 w-16 text-destructive"}),e.jsx("h2",{className:"text-2xl font-bold",children:"重启超时"}),e.jsx("p",{className:"text-muted-foreground text-center",children:"服务未能在预期时间内恢复,请手动检查或刷新页面"})]})]}),u!=="failed"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(gi,{value:r,className:"h-2"}),e.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[e.jsxs("span",{children:[r,"%"]}),e.jsxs("span",{children:["已用时: ",N(h)]})]})]}),e.jsx("div",{className:"bg-muted/50 rounded-lg p-4 space-y-2",children:e.jsxs("p",{className:"text-sm text-muted-foreground",children:[u==="restarting"&&"🔄 配置已保存,正在重启主程序...",u==="checking"&&"⏳ 正在等待服务恢复,请勿关闭页面...",u==="success"&&"✅ 配置已生效,服务运行正常",u==="failed"&&"⚠️ 如果长时间无响应,请尝试手动重启"]})}),u==="failed"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>window.location.reload(),className:"flex-1 px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90",children:"刷新页面"}),e.jsx("button",{onClick:()=>{x("checking"),v(0),j()},className:"flex-1 px-4 py-2 bg-secondary text-secondary-foreground rounded-md hover:bg-secondary/90",children:"重试检测"})]})]})})}const e1={name:"toml",startState:function(){return{inString:!1,stringType:"",lhs:!0,inArray:0}},token:function(l,i){let r;if(!i.inString&&(r=l.match(/^('''|"""|'|")/))&&(i.stringType=r[0],i.inString=!0),l.sol()&&!i.inString&&i.inArray===0&&(i.lhs=!0),i.inString){for(;i.inString;)if(l.match(i.stringType))i.inString=!1;else if(l.peek()==="\\")l.next(),l.next();else{if(l.eol())break;l.match(/^.[^\\\"\']*/)}return i.lhs?"property":"string"}else{if(i.inArray&&l.peek()==="]")return l.next(),i.inArray--,"bracket";if(i.lhs&&l.peek()==="["&&l.skipTo("]"))return l.next(),l.peek()==="]"&&l.next(),"atom";if(l.peek()==="#")return l.skipToEnd(),"comment";if(l.eatSpace())return null;if(i.lhs&&l.eatWhile(function(o){return o!="="&&o!=" "}))return"property";if(i.lhs&&l.peek()==="=")return l.next(),i.lhs=!1,null;if(!i.lhs&&l.match(/^\d\d\d\d[\d\-\:\.T]*Z/))return"atom";if(!i.lhs&&(l.match("true")||l.match("false")))return"atom";if(!i.lhs&&l.peek()==="[")return i.inArray++,l.next(),"bracket";if(!i.lhs&&l.match(/^\-?\d+(?:\.\d+)?/))return"number";l.eatSpace()||l.next()}return null},languageData:{commentTokens:{line:"#"}}},s1={python:[Ky()],json:[Xy(),Jy()],toml:[Yy.define(e1)],text:[]};function t1({value:l,onChange:i,language:r="text",readOnly:o=!1,height:u="400px",minHeight:x,maxHeight:h,placeholder:p,theme:g="dark",className:v=""}){const[j,N]=m.useState(!1);if(m.useEffect(()=>{N(!0)},[]),!j)return e.jsx("div",{className:`rounded-md border bg-muted animate-pulse ${v}`,style:{height:u,minHeight:x,maxHeight:h}});const y=[...s1[r]||[],fp.lineWrapping];return o&&y.push(fp.editable.of(!1)),e.jsx("div",{className:`rounded-md overflow-hidden border ${v}`,children:e.jsx(Py,{value:l,height:u,minHeight:x,maxHeight:h,theme:g==="dark"?Zy:void 0,extensions:y,onChange:i,placeholder:p,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 a1(l,i,r,o={}){const{debounceMs:u=2e3,onSaveSuccess:x,onSaveError:h}=o,p=m.useRef(null),g=m.useCallback(async(y,S)=>{try{i(!0),await Xw(y,S),r(!1),x?.()}catch(w){console.error(`自动保存 ${y} 失败:`,w),r(!0),h?.(w instanceof Error?w:new Error(String(w)))}finally{i(!1)}},[i,r,x,h]),v=m.useCallback((y,S)=>{l||(r(!0),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{g(y,S)},u))},[l,r,g,u]),j=m.useCallback(async(y,S)=>{p.current&&(clearTimeout(p.current),p.current=null),await g(y,S)},[g]),N=m.useCallback(()=>{p.current&&(clearTimeout(p.current),p.current=null)},[]);return m.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[]),{triggerAutoSave:v,saveNow:j,cancelPendingAutoSave:N}}function $t(l,i,r,o){m.useEffect(()=>{l&&!r&&o(i,l)},[l])}const l1=500;function n1(){const[l,i]=m.useState(!0),[r,o]=m.useState(!1),[u,x]=m.useState(!1),[h,p]=m.useState(!1),[g,v]=m.useState(!1),[j,N]=m.useState(!1),[y,S]=m.useState("visual"),[w,R]=m.useState(""),[O,U]=m.useState(!1),{toast:G}=Vs(),[L,T]=m.useState(null),[F,q]=m.useState(null),[z,M]=m.useState(null),[Q,fe]=m.useState(null),[ve,ge]=m.useState(null),[be,je]=m.useState(null),[Ne,D]=m.useState(null),[Y,K]=m.useState(null),[re,k]=m.useState(null),[ne,xe]=m.useState(null),[Ce,_e]=m.useState(null),[Me,Z]=m.useState(null),[me,ke]=m.useState(null),[X,ae]=m.useState(null),[De,_s]=m.useState(null),[E,he]=m.useState(null),[Xe,ye]=m.useState(null),W=m.useRef(!0),Se=m.useRef({}),Ge=m.useCallback(we=>{Se.current=we,T(we.bot),q(we.personality);const Ss=we.chat;Ss.talk_value_rules||(Ss.talk_value_rules=[]),M(Ss),fe(we.expression),ge(we.emoji),je(we.memory),D(we.tool),K(we.voice),k(we.lpmm_knowledge),xe(we.keyword_reaction),_e(we.response_post_process),Z(we.chinese_typo),ke(we.response_splitter),ae(we.log),_s(we.debug),he(we.maim_message),ye(we.telemetry)},[]),jt=m.useCallback(()=>({...Se.current,bot:L,personality:F,chat:z,expression:Q,emoji:ve,memory:be,tool:Ne,voice:Y,lpmm_knowledge:re,keyword_reaction:ne,response_post_process:Ce,chinese_typo:Me,response_splitter:me,log:X,debug:De,maim_message:E,telemetry:Xe}),[L,F,z,Q,ve,be,Ne,Y,re,ne,Ce,Me,me,X,De,E,Xe]),Qs=m.useCallback(async()=>{try{const Ss=(await Yw()).replace(/"([^"]*)"/g,(Ee,xs)=>`"${xs.replace(/\\n/g,` -`).replace(/\\t/g," ").replace(/\\r/g,"\r").replace(/\\"/g,'"').replace(/\\\\/g,"\\")}"`);R(Ss),U(!1)}catch(we){G({variant:"destructive",title:"加载失败",description:we instanceof Error?we.message:"加载源代码失败"})}},[G]),zt=m.useCallback(async()=>{try{i(!0);const we=await Cp();Ge(we),p(!1),W.current=!1,await Qs()}catch(we){console.error("加载配置失败:",we),G({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}finally{i(!1)}},[G,Qs,Ge]);m.useEffect(()=>{zt()},[zt]);const{triggerAutoSave:Es,cancelPendingAutoSave:lt}=a1(W.current,x,p);$t(L,"bot",W.current,Es),$t(F,"personality",W.current,Es),$t(z,"chat",W.current,Es),$t(Q,"expression",W.current,Es),$t(ve,"emoji",W.current,Es),$t(be,"memory",W.current,Es),$t(Ne,"tool",W.current,Es),$t(Y,"voice",W.current,Es),$t(re,"lpmm_knowledge",W.current,Es),$t(ne,"keyword_reaction",W.current,Es),$t(Ce,"response_post_process",W.current,Es),$t(Me,"chinese_typo",W.current,Es),$t(me,"response_splitter",W.current,Es),$t(X,"log",W.current,Es),$t(De,"debug",W.current,Es),$t(E,"maim_message",W.current,Es),$t(Xe,"telemetry",W.current,Es);const I=async()=>{try{o(!0);const we=w.replace(/"([^"]*)"/g,(Ss,Ee)=>`"${Ee.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r")}"`);await Kw(we),p(!1),U(!1),G({title:"保存成功",description:"配置已保存"}),await zt()}catch(we){U(!0),G({variant:"destructive",title:"保存失败",description:we instanceof Error?we.message:"保存配置失败"})}finally{o(!1)}},$e=async we=>{if(h){G({variant:"destructive",title:"切换失败",description:"请先保存当前更改"});return}if(S(we),we==="source")await Qs();else try{const Ss=await Cp();Ge(Ss),p(!1)}catch(Ss){console.error("加载配置失败:",Ss),G({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}},Oe=async()=>{try{o(!0),lt(),await kp(jt()),p(!1),G({title:"保存成功",description:"麦麦主程序配置已保存"})}catch(we){console.error("保存配置失败:",we),G({title:"保存失败",description:we.message,variant:"destructive"})}finally{o(!1)}},Ke=async()=>{try{v(!0),fo().catch(()=>{}),N(!0)}catch(we){console.error("重启失败:",we),N(!1),G({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),v(!1)}},$s=async()=>{try{o(!0),lt(),await kp(jt()),p(!1),G({title:"保存成功",description:"配置已保存,即将重启麦麦..."}),await new Promise(we=>setTimeout(we,l1)),await Ke()}catch(we){console.error("保存失败:",we),G({title:"保存失败",description:we.message,variant:"destructive"})}finally{o(!1)}},Je=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},Ps=()=>{N(!1),v(!1),G({title:"重启失败",description:"服务器未能在预期时间内恢复,请手动检查",variant:"destructive"})};return l?e.jsx(Ze,{className:"h-full",children:e.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):e.jsx(Ze,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:gap-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl md:text-3xl font-bold",children:"麦麦主程序配置"}),e.jsx("p",{className:"text-muted-foreground mt-1 text-xs sm:text-sm",children:"管理麦麦的核心功能和行为设置"})]}),e.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[e.jsxs(_,{onClick:y==="visual"?Oe:I,disabled:r||u||!h||g,size:"sm",variant:"outline",className:"w-20 sm:w-24",children:[e.jsx(Tr,{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?"保存中":u?"自动":h?"保存":"已保存"})]}),e.jsxs(ms,{children:[e.jsx(ut,{asChild:!0,children:e.jsxs(_,{disabled:r||u||g,size:"sm",className:"w-20 sm:w-28",children:[e.jsx(kr,{className:"h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"ml-1 truncate text-xs sm:text-sm",children:g?"重启中":h?"保存重启":"重启"})]})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认重启麦麦?"}),e.jsx(os,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:h?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})})})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:h?$s:Ke,children:h?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsx("div",{className:"flex",children:e.jsx(ka,{value:y,onValueChange:we=>$e(we),className:"w-full",children:e.jsxs(xa,{className:"h-8 sm:h-9 w-full grid grid-cols-2",children:[e.jsxs(ts,{value:"visual",className:"text-xs sm:text-sm",children:[e.jsx(Sy,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"可视化编辑"]}),e.jsxs(ts,{value:"source",className:"text-xs sm:text-sm",children:[e.jsx(Cy,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"源代码编辑"]})]})})})]}),e.jsxs(ta,{children:[e.jsx(Ia,{className:"h-4 w-4"}),e.jsxs(aa,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),y==="source"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(ta,{children:[e.jsx(Ia,{className:"h-4 w-4"}),e.jsxs(aa,{children:[e.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。此功能仅适用于熟悉 TOML 语法的高级用户。保存时会在后端验证格式,只有格式完全正确才能保存。",O&&e.jsx("span",{className:"text-destructive font-semibold ml-2",children:"⚠️ 上次保存失败,请检查 TOML 格式"})]})]}),e.jsx(t1,{value:w,onChange:we=>{R(we),p(!0),O&&U(!1)},language:"toml",theme:"dark",height:"calc(100vh - 280px)",minHeight:"500px",placeholder:"TOML 配置内容"})]}),y==="visual"&&e.jsx(e.Fragment,{children:e.jsxs(ka,{defaultValue:"bot",className:"w-full",children:[e.jsxs(xa,{className:"flex flex-wrap h-auto gap-1 p-1 sm:grid sm:grid-cols-5 lg:grid-cols-9",children:[e.jsx(ts,{value:"bot",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"基本信息"}),e.jsx(ts,{value:"personality",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"人格"}),e.jsx(ts,{value:"chat",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"聊天"}),e.jsx(ts,{value:"expression",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"表达"}),e.jsx(ts,{value:"features",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"功能"}),e.jsx(ts,{value:"processing",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"处理"}),e.jsx(ts,{value:"voice",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"语音"}),e.jsx(ts,{value:"lpmm",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"知识库"}),e.jsx(ts,{value:"other",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"其他"})]}),e.jsx(Ms,{value:"bot",className:"space-y-4",children:L&&e.jsx(Ew,{config:L,onChange:T})}),e.jsx(Ms,{value:"personality",className:"space-y-4",children:F&&e.jsx(zw,{config:F,onChange:q})}),e.jsx(Ms,{value:"chat",className:"space-y-4",children:z&&e.jsx(Rw,{config:z,onChange:M})}),e.jsx(Ms,{value:"expression",className:"space-y-4",children:Q&&e.jsx(Vw,{config:Q,onChange:fe})}),e.jsx(Ms,{value:"features",className:"space-y-4",children:ve&&be&&Ne&&e.jsx(Gw,{emojiConfig:ve,memoryConfig:be,toolConfig:Ne,onEmojiChange:ge,onMemoryChange:je,onToolChange:D})}),e.jsx(Ms,{value:"processing",className:"space-y-4",children:ne&&Ce&&Me&&me&&e.jsx(Qw,{keywordReactionConfig:ne,responsePostProcessConfig:Ce,chineseTypoConfig:Me,responseSplitterConfig:me,onKeywordReactionChange:xe,onResponsePostProcessChange:_e,onChineseTypoChange:Z,onResponseSplitterChange:ke})}),e.jsx(Ms,{value:"voice",className:"space-y-4",children:Y&&e.jsx(Lw,{config:Y,onChange:K})}),e.jsx(Ms,{value:"lpmm",className:"space-y-4",children:re&&e.jsx(Uw,{config:re,onChange:k})}),e.jsxs(Ms,{value:"other",className:"space-y-4",children:[X&&e.jsx(Bw,{config:X,onChange:ae}),De&&e.jsx(Hw,{config:De,onChange:_s}),E&&e.jsx($w,{config:E,onChange:he}),Xe&&e.jsx(qw,{config:Xe,onChange:ye})]})]})}),j&&e.jsx(dm,{onRestartComplete:Je,onRestartFailed:Ps})]})})}const jn=m.forwardRef(({className:l,...i},r)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:r,className:H("w-full caption-bottom text-sm",l),...i})}));jn.displayName="Table";const vn=m.forwardRef(({className:l,...i},r)=>e.jsx("thead",{ref:r,className:H("[&_tr]:border-b",l),...i}));vn.displayName="TableHeader";const bn=m.forwardRef(({className:l,...i},r)=>e.jsx("tbody",{ref:r,className:H("[&_tr:last-child]:border-0",l),...i}));bn.displayName="TableBody";const i1=m.forwardRef(({className:l,...i},r)=>e.jsx("tfoot",{ref:r,className:H("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",l),...i}));i1.displayName="TableFooter";const pt=m.forwardRef(({className:l,...i},r)=>e.jsx("tr",{ref:r,className:H("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",l),...i}));pt.displayName="TableRow";const Pe=m.forwardRef(({className:l,...i},r)=>e.jsx("th",{ref:r,className:H("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",l),...i}));Pe.displayName="TableHead";const Ie=m.forwardRef(({className:l,...i},r)=>e.jsx("td",{ref:r,className:H("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",l),...i}));Ie.displayName="TableCell";const r1=m.forwardRef(({className:l,...i},r)=>e.jsx("caption",{ref:r,className:H("mt-4 text-sm text-muted-foreground",l),...i}));r1.displayName="TableCaption";const po=m.forwardRef(({className:l,...i},r)=>e.jsx(la,{ref:r,className:H("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",l),...i}));po.displayName=la.displayName;const go=m.forwardRef(({className:l,...i},r)=>e.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[e.jsx(Ft,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(la.Input,{ref:r,className:H("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",l),...i})]}));go.displayName=la.Input.displayName;const jo=m.forwardRef(({className:l,...i},r)=>e.jsx(la.List,{ref:r,className:H("max-h-[300px] overflow-y-auto overflow-x-hidden",l),...i}));jo.displayName=la.List.displayName;const vo=m.forwardRef((l,i)=>e.jsx(la.Empty,{ref:i,className:"py-6 text-center text-sm",...l}));vo.displayName=la.Empty.displayName;const yr=m.forwardRef(({className:l,...i},r)=>e.jsx(la.Group,{ref:r,className:H("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",l),...i}));yr.displayName=la.Group.displayName;const c1=m.forwardRef(({className:l,...i},r)=>e.jsx(la.Separator,{ref:r,className:H("-mx-1 h-px bg-border",l),...i}));c1.displayName=la.Separator.displayName;const wr=m.forwardRef(({className:l,...i},r)=>e.jsx(la.Item,{ref:r,className:H("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",l),...i}));wr.displayName=la.Item.displayName;const gt=m.forwardRef(({className:l,...i},r)=>e.jsx(Ng,{ref:r,className:H("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",l),...i,children:e.jsx(ty,{className:H("grid place-content-center text-current"),children:e.jsx(sa,{className:"h-4 w-4"})})}));gt.displayName=Ng.displayName;const lj=m.createContext(null),nj="maibot-completed-tours";function o1(){try{const l=localStorage.getItem(nj);return l?new Set(JSON.parse(l)):new Set}catch{return new Set}}function Tp(l){localStorage.setItem(nj,JSON.stringify([...l]))}function d1({children:l}){const[i,r]=m.useState({activeTourId:null,stepIndex:0,isRunning:!1}),o=m.useRef(new Map),[,u]=m.useState(0),[x,h]=m.useState(o1),p=m.useCallback((L,T)=>{o.current.set(L,T),u(F=>F+1)},[]),g=m.useCallback(L=>{o.current.delete(L),r(T=>T.activeTourId===L?{...T,activeTourId:null,isRunning:!1,stepIndex:0}:T)},[]),v=m.useCallback((L,T=0)=>{o.current.has(L)&&r({activeTourId:L,stepIndex:T,isRunning:!0})},[]),j=m.useCallback(()=>{r(L=>({...L,isRunning:!1}))},[]),N=m.useCallback(L=>{r(T=>({...T,stepIndex:L}))},[]),y=m.useCallback(()=>{r(L=>({...L,stepIndex:L.stepIndex+1}))},[]),S=m.useCallback(()=>{r(L=>({...L,stepIndex:Math.max(0,L.stepIndex-1)}))},[]),w=m.useCallback(()=>i.activeTourId?o.current.get(i.activeTourId)||[]:[],[i.activeTourId]),R=m.useCallback(L=>{h(T=>{const F=new Set(T);return F.add(L),Tp(F),F})},[]),O=m.useCallback(L=>{const{action:T,index:F,status:q,type:z}=L,M=["finished","skipped"];if(T==="close"){r(Q=>({...Q,isRunning:!1,stepIndex:0}));return}M.includes(q)?r(Q=>(q==="finished"&&Q.activeTourId&&setTimeout(()=>R(Q.activeTourId),0),{...Q,isRunning:!1,stepIndex:0})):z==="step:after"&&(T==="next"?r(Q=>({...Q,stepIndex:F+1})):T==="prev"&&r(Q=>({...Q,stepIndex:F-1})))},[R]),U=m.useCallback(L=>x.has(L),[x]),G=m.useCallback(L=>{h(T=>{const F=new Set(T);return F.delete(L),Tp(F),F})},[]);return e.jsx(lj.Provider,{value:{state:i,tours:o.current,registerTour:p,unregisterTour:g,startTour:v,stopTour:j,goToStep:N,nextStep:y,prevStep:S,getCurrentSteps:w,handleJoyrideCallback:O,isTourCompleted:U,markTourCompleted:R,resetTourCompleted:G},children:l})}function um(){const l=m.useContext(lj);if(!l)throw new Error("useTour must be used within a TourProvider");return l}const u1={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)"}},m1={back:"上一步",close:"关闭",last:"完成",next:"下一步",nextLabelWithProgress:"下一步 ({step}/{steps})",open:"打开对话框",skip:"跳过"};function x1(){const{state:l,getCurrentSteps:i,handleJoyrideCallback:r}=um(),o=i(),[u,x]=m.useState(!1),h=m.useRef(l.stepIndex),p=m.useRef(null);m.useEffect(()=>{h.current!==l.stepIndex&&(x(!1),h.current=l.stepIndex)},[l.stepIndex]),m.useEffect(()=>{if(!l.isRunning||o.length===0){x(!1);return}const j=o[l.stepIndex];if(!j){x(!1);return}const N=j.target;if(N==="body"){x(!0);return}x(!1);const y=setTimeout(()=>{const S=()=>{const U=document.querySelector(N);if(U){const G=U.getBoundingClientRect();if(G.width>0&&G.height>0)return!0}return!1};if(S()){setTimeout(()=>x(!0),100);return}const w=setInterval(()=>{S()&&(clearInterval(w),setTimeout(()=>x(!0),100))},100),R=setTimeout(()=>{clearInterval(w),x(!0)},5e3),O=()=>{clearInterval(w),clearTimeout(R)};p.current=O},150);return()=>{clearTimeout(y),p.current&&(p.current(),p.current=null)}},[l.isRunning,l.stepIndex,o]);const g=m.useRef(null);if(m.useEffect(()=>{let j=document.getElementById("tour-portal-container");return j||(j=document.createElement("div"),j.id="tour-portal-container",j.style.cssText="position: fixed; top: 0; left: 0; z-index: 99999; pointer-events: none;",document.body.appendChild(j)),g.current=j,()=>{}},[]),!l.isRunning||o.length===0||!u)return null;const v=e.jsx(Wy,{steps:o,stepIndex:l.stepIndex,run:l.isRunning,continuous:!0,showSkipButton:!0,showProgress:!0,disableOverlayClose:!0,disableScrolling:!1,disableScrollParentFix:!1,callback:r,styles:u1,locale:m1,scrollOffset:80,scrollToFirstStep:!0,floaterProps:{styles:{floater:{zIndex:99999}},disableAnimation:!0}},`tour-step-${l.stepIndex}`);return g.current?lN.createPortal(v,g.current):v}const Fa="model-assignment-tour",ij=[{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}],rj={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"},xr=[{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 Ep(l){return l?l.replace(/\/+$/,"").toLowerCase():""}function h1(l){if(!l)return null;const i=Ep(l);return xr.find(r=>r.id!=="custom"&&Ep(r.base_url)===i)||null}const Xc=l=>({...l,max_retry:l.max_retry??2,timeout:l.timeout??30,retry_interval:l.retry_interval??10}),f1=l=>{const i={};return l?(l.name?.trim()||(i.name="请输入提供商名称"),l.base_url?.trim()||(i.base_url="请输入基础 URL"),l.api_key?.trim()||(i.api_key="请输入 API Key"),{isValid:Object.keys(i).length===0,errors:i}):{isValid:!1,errors:{name:"提供商数据为空"}}};function p1(){const[l,i]=m.useState([]),[r,o]=m.useState(!0),[u,x]=m.useState(!1),[h,p]=m.useState(!1),[g,v]=m.useState(!1),[j,N]=m.useState(!1),[y,S]=m.useState(!1),[w,R]=m.useState(!1),[O,U]=m.useState(null),[G,L]=m.useState(null),[T,F]=m.useState("custom"),[q,z]=m.useState(!1),[M,Q]=m.useState(!1),[fe,ve]=m.useState(null),[ge,be]=m.useState(!1),[je,Ne]=m.useState(""),[D,Y]=m.useState(new Set),[K,re]=m.useState(!1),[k,ne]=m.useState(1),[xe,Ce]=m.useState(20),[_e,Me]=m.useState(""),[Z,me]=m.useState({isOpen:!1,providersToDelete:[],affectedModels:[],pendingProviders:[],context:"auto",oldProviders:[]}),[ke,X]=m.useState({}),[ae,De]=m.useState(new Set),[_s,E]=m.useState(new Map),{toast:he}=Vs(),Xe=Ea(),{state:ye,goToStep:W,registerTour:Se}=um(),Ge=m.useRef(null),jt=m.useRef(!0);m.useEffect(()=>{Se(Fa,ij)},[Se]),m.useEffect(()=>{if(ye.activeTourId===Fa&&ye.isRunning){const V=rj[ye.stepIndex];V&&!window.location.pathname.endsWith(V.replace("/config/",""))&&Xe({to:V})}},[ye.stepIndex,ye.activeTourId,ye.isRunning,Xe]);const Qs=m.useRef(ye.stepIndex);m.useEffect(()=>{if(ye.activeTourId===Fa&&ye.isRunning){const V=Qs.current,pe=ye.stepIndex;V>=3&&V<=9&&pe<3&&R(!1),V>=10&&pe>=3&&pe<=9&&(X({}),F("custom"),U({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10}),L(null),be(!1),R(!0)),Qs.current=pe}},[ye.stepIndex,ye.activeTourId,ye.isRunning]),m.useEffect(()=>{if(ye.activeTourId!==Fa||!ye.isRunning)return;const V=pe=>{const ze=pe.target,zs=ye.stepIndex;zs===2&&ze.closest('[data-tour="add-provider-button"]')?setTimeout(()=>W(3),300):zs===9&&ze.closest('[data-tour="provider-cancel-button"]')&&setTimeout(()=>W(10),300)};return document.addEventListener("click",V,!0),()=>document.removeEventListener("click",V,!0)},[ye,W]),m.useEffect(()=>{zt()},[]);const zt=async()=>{try{o(!0);const V=await Il();i(V.api_providers||[]),v(!1),jt.current=!1}catch(V){console.error("加载配置失败:",V)}finally{o(!1)}},Es=async()=>{try{N(!0),fo().catch(()=>{}),S(!0)}catch(V){console.error("重启失败:",V),S(!1),he({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),N(!1)}},lt=async()=>{try{x(!0),Ge.current&&clearTimeout(Ge.current);const V=l.map(it=>({...it,max_retry:it.max_retry??2,timeout:it.timeout??30,retry_interval:it.retry_interval??10})),{shouldProceed:pe}=await Oe(V,"restart");if(!pe){x(!1);return}const ze=await Il(),zs=new Set(V.map(it=>it.name)),Yt=(ze.models||[]).filter(it=>zs.has(it.api_provider));ze.api_providers=V,ze.models=Yt,await jr(ze),v(!1),he({title:"保存成功",description:"正在重启麦麦..."}),await Es()}catch(V){console.error("保存配置失败:",V),he({title:"保存失败",description:V.message,variant:"destructive"}),x(!1)}},I=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},$e=()=>{S(!1),N(!1),he({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},Oe=m.useCallback(async(V,pe="auto")=>{try{const ze=await Il(),zs=new Set(l.map(ys=>ys.name)),za=new Set(V.map(ys=>ys.name)),Yt=Array.from(zs).filter(ys=>!za.has(ys));if(Yt.length===0)return{shouldProceed:!0,providers:V};const Ct=(ze.models||[]).filter(ys=>Yt.includes(ys.api_provider));return Ct.length===0?{shouldProceed:!0,providers:V}:(me({isOpen:!0,providersToDelete:Yt,affectedModels:Ct,pendingProviders:V,context:pe,oldProviders:[...l]}),{shouldProceed:!1,providers:V})}catch(ze){return console.error("检查删除影响失败:",ze),{shouldProceed:!0,providers:V}}},[l]),Ke=async()=>{try{(Z.context==="auto"?p:x)(!0),me(ys=>({...ys,isOpen:!1}));const pe=await Il(),ze=Z.pendingProviders.map(Xc),zs=new Set(ze.map(ys=>ys.name)),Yt=(pe.models||[]).filter(ys=>zs.has(ys.api_provider)),it=new Set(Z.affectedModels.map(ys=>ys.name)),Ct=pe.model_task_config;Ct&&Object.keys(Ct).forEach(ys=>{const kt=Ct[ys];kt&&Array.isArray(kt.model_list)&&(kt.model_list=kt.model_list.filter(Nl=>!it.has(Nl)))}),pe.api_providers=ze,pe.models=Yt,pe.model_task_config=Ct,await jr(pe),i(Z.pendingProviders),v(!1),he({title:"删除成功",description:`已删除 ${Z.providersToDelete.length} 个提供商和 ${Z.affectedModels.length} 个关联模型`}),me({isOpen:!1,providersToDelete:[],affectedModels:[],pendingProviders:[],context:"auto",oldProviders:[]}),Y(new Set),Z.context==="restart"&&await Es()}catch(V){console.error("删除失败:",V),he({title:"删除失败",description:V.message,variant:"destructive"})}finally{Z.context==="auto"?p(!1):x(!1)}},$s=()=>{Z.oldProviders.length>0&&i(Z.oldProviders),me({isOpen:!1,providersToDelete:[],affectedModels:[],pendingProviders:[],context:"auto",oldProviders:[]}),v(!1)},Je=m.useCallback(async V=>{if(jt.current)return;const{shouldProceed:pe}=await Oe(V,"auto");if(!pe){v(!0);return}try{p(!0);const ze=V.map(Xc);await em("api_providers",ze),v(!1)}catch(ze){console.error("自动保存失败:",ze),he({title:"自动保存失败",description:ze.message,variant:"destructive"}),v(!0)}finally{p(!1)}},[l,Oe]);m.useEffect(()=>{if(!jt.current)return v(!0),Ge.current&&clearTimeout(Ge.current),Ge.current=setTimeout(()=>{Je(l)},2e3),()=>{Ge.current&&clearTimeout(Ge.current)}},[l,Je]);const Ps=async()=>{try{x(!0),Ge.current&&clearTimeout(Ge.current);const V=l.map(Xc),{shouldProceed:pe}=await Oe(V,"manual");if(!pe){x(!1);return}const ze=await Il(),zs=new Set(V.map(it=>it.name)),za=ze.models||[],Yt=za.filter(it=>{const Ct=zs.has(it.api_provider);return Ct||console.warn(`模型 "${it.name}" 引用了已删除的提供商 "${it.api_provider}",将被移除`),Ct});if(za.length!==Yt.length){const it=za.length-Yt.length;he({title:"注意",description:`已自动移除 ${it} 个引用已删除提供商的模型`,variant:"default"})}console.log("发送的 providers 数据:",V),ze.api_providers=V,ze.models=Yt,console.log("完整配置数据:",ze),await jr(ze),v(!1),he({title:"保存成功",description:"模型提供商配置已保存"})}catch(V){console.error("保存配置失败:",V),he({title:"保存失败",description:V.message,variant:"destructive"})}finally{x(!1)}},we=(V,pe)=>{if(X({}),V){const ze=xr.find(zs=>zs.base_url===V.base_url&&zs.client_type===V.client_type);F(ze?.id||"custom"),U(V)}else F("custom"),U({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10});L(pe),be(!1),R(!0)},Ss=m.useCallback(V=>{F(V),z(!1);const pe=xr.find(ze=>ze.id===V);pe&&pe.id!=="custom"?U(ze=>({...ze,name:pe.name,base_url:pe.base_url,client_type:pe.client_type})):pe?.id==="custom"&&U(ze=>({...ze,name:"",base_url:"",client_type:"openai"}))},[]),Ee=m.useMemo(()=>T!=="custom",[T]),xs=m.useCallback(async()=>{if(O?.api_key)try{await navigator.clipboard.writeText(O.api_key),he({title:"复制成功",description:"API Key 已复制到剪贴板"})}catch{he({title:"复制失败",description:"无法访问剪贴板",variant:"destructive"})}},[O?.api_key,he]),bs=()=>{if(!O)return;const{isValid:V,errors:pe}=f1(O);if(!V){X(pe);return}X({});const ze=Xc(O);if(G!==null){const zs=[...l];zs[G]=ze,i(zs)}else i([...l,ze]);R(!1),U(null),L(null)},Mt=V=>{if(!V&&O){const pe={...O,max_retry:O.max_retry??2,timeout:O.timeout??30,retry_interval:O.retry_interval??10};U(pe)}R(V)},Ys=V=>{ve(V),Q(!0)},vt=async()=>{if(fe!==null){const V=l.filter((ze,zs)=>zs!==fe),{shouldProceed:pe}=await Oe(V,"manual");pe&&(i(V),he({title:"删除成功",description:"提供商已从列表中移除"}))}Q(!1),ve(null)},Ks=V=>{const pe=new Set(D);pe.has(V)?pe.delete(V):pe.add(V),Y(pe)},nt=()=>{if(D.size===bt.length)Y(new Set);else{const V=bt.map((pe,ze)=>l.findIndex(zs=>zs===bt[ze]));Y(new Set(V))}},bl=()=>{if(D.size===0){he({title:"提示",description:"请先选择要删除的提供商",variant:"default"});return}re(!0)},ha=async()=>{const V=l.filter((ze,zs)=>!D.has(zs)),{shouldProceed:pe}=await Oe(V,"manual");pe&&(i(V),Y(new Set),he({title:"批量删除成功",description:`已删除 ${D.size} 个提供商`})),re(!1)},bt=m.useMemo(()=>{if(!je)return l;const V=je.toLowerCase();return l.filter(pe=>pe.name.toLowerCase().includes(V)||pe.base_url.toLowerCase().includes(V)||pe.client_type.toLowerCase().includes(V))},[l,je]),{totalPages:Vt,paginatedProviders:te}=m.useMemo(()=>{const V=Math.ceil(bt.length/xe),pe=bt.slice((k-1)*xe,k*xe);return{totalPages:V,paginatedProviders:pe}},[bt,k,xe]),de=m.useCallback(()=>{const V=parseInt(_e);V>=1&&V<=Vt&&(ne(V),Me(""))},[_e,Vt]),Ns=async V=>{De(pe=>new Set(pe).add(V));try{const pe=await Pw(V);E(ze=>new Map(ze).set(V,pe)),pe.network_ok?pe.api_key_valid===!0?he({title:"连接正常",description:`${V} 网络连接正常,API Key 有效 (${pe.latency_ms}ms)`}):pe.api_key_valid===!1?he({title:"连接正常但 Key 无效",description:`${V} 网络连接正常,但 API Key 无效或已过期`,variant:"destructive"}):he({title:"网络连接正常",description:`${V} 可以访问 (${pe.latency_ms}ms)`}):he({title:"连接失败",description:pe.error||"无法连接到提供商",variant:"destructive"})}catch(pe){he({title:"测试失败",description:pe.message,variant:"destructive"})}finally{De(pe=>{const ze=new Set(pe);return ze.delete(V),ze})}},At=async()=>{for(const V of l)await Ns(V.name)},Ot=V=>{const pe=ae.has(V),ze=_s.get(V);return pe?e.jsxs(Qe,{variant:"secondary",className:"gap-1",children:[e.jsx(mt,{className:"h-3 w-3 animate-spin"}),"测试中"]}):ze?ze.network_ok?ze.api_key_valid===!0?e.jsxs(Qe,{className:"gap-1 bg-green-600 hover:bg-green-700",children:[e.jsx(ma,{className:"h-3 w-3"}),"正常"]}):ze.api_key_valid===!1?e.jsxs(Qe,{variant:"destructive",className:"gap-1",children:[e.jsx(Gt,{className:"h-3 w-3"}),"Key无效"]}):e.jsxs(Qe,{className:"gap-1 bg-blue-600 hover:bg-blue-700",children:[e.jsx(ma,{className:"h-3 w-3"}),"可访问"]}):e.jsxs(Qe,{variant:"destructive",className:"gap-1",children:[e.jsx(zg,{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:[D.size>0&&e.jsxs(_,{onClick:bl,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(es,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",D.size,")"]}),e.jsxs(_,{onClick:At,size:"sm",variant:"outline",className:"w-full sm:w-auto",disabled:l.length===0||ae.size>0,children:[e.jsx(fn,{className:"mr-2 h-4 w-4"}),ae.size>0?`测试中 (${ae.size})`:"测试全部"]}),e.jsxs(_,{onClick:()=>we(null,null),size:"sm",className:"w-full sm:w-auto","data-tour":"add-provider-button",children:[e.jsx(ft,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加提供商"]}),e.jsxs(_,{onClick:Ps,disabled:u||h||!g||j,size:"sm",variant:"outline",className:"w-full sm:w-auto sm:min-w-[120px]",children:[e.jsx(Tr,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),u?"保存中...":h?"自动保存中...":g?"保存配置":"已保存"]}),e.jsxs(ms,{children:[e.jsx(ut,{asChild:!0,children:e.jsxs(_,{disabled:u||h||j,size:"sm",className:"w-full sm:w-auto sm:min-w-[120px]",children:[e.jsx(kr,{className:"mr-2 h-4 w-4"}),j?"重启中...":g?"保存并重启":"重启麦麦"]})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认重启麦麦?"}),e.jsx(os,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:g?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})})})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:g?lt:Es,children:g?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsxs(ta,{children:[e.jsx(Ia,{className:"h-4 w-4"}),e.jsxs(aa,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),e.jsxs(Ze,{className:"h-[calc(100vh-260px)]",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 mb-4",children:[e.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[e.jsx(Ft,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ie,{placeholder:"搜索提供商名称、URL 或类型...",value:je,onChange:V=>Ne(V.target.value),className:"pl-9"})]}),je&&e.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",bt.length," 个结果"]})]}),e.jsx("div",{className:"md:hidden space-y-3",children:bt.length===0?e.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:je?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'}):te.map((V,pe)=>{const ze=l.findIndex(zs=>zs===V);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:V.name}),Ot(V.name)]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:V.base_url})]}),e.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>Ns(V.name),disabled:ae.has(V.name),title:"测试连接",children:ae.has(V.name)?e.jsx(mt,{className:"h-4 w-4 animate-spin"}):e.jsx(fn,{className:"h-4 w-4"})}),e.jsx(_,{variant:"default",size:"sm",onClick:()=>we(V,ze),children:e.jsx(pn,{className:"h-4 w-4",strokeWidth:2,fill:"none"})}),e.jsx(_,{size:"sm",onClick:()=>Ys(ze),className:"bg-red-600 hover:bg-red-700 text-white",children:e.jsx(es,{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:V.client_type})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"最大重试"}),e.jsx("p",{className:"font-medium",children:V.max_retry})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"超时(秒)"}),e.jsx("p",{className:"font-medium",children:V.timeout})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"重试间隔(秒)"}),e.jsx("p",{className:"font-medium",children:V.retry_interval})]})]})]},pe)})}),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(jn,{children:[e.jsx(vn,{children:e.jsxs(pt,{children:[e.jsx(Pe,{className:"w-12",children:e.jsx(gt,{checked:D.size===bt.length&&bt.length>0,onCheckedChange:nt})}),e.jsx(Pe,{children:"状态"}),e.jsx(Pe,{children:"名称"}),e.jsx(Pe,{children:"基础URL"}),e.jsx(Pe,{children:"客户端类型"}),e.jsx(Pe,{className:"text-right",children:"最大重试"}),e.jsx(Pe,{className:"text-right",children:"超时(秒)"}),e.jsx(Pe,{className:"text-right",children:"重试间隔(秒)"}),e.jsx(Pe,{className:"text-right",children:"操作"})]})}),e.jsx(bn,{children:te.length===0?e.jsx(pt,{children:e.jsx(Ie,{colSpan:9,className:"text-center text-muted-foreground py-8",children:je?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'})}):te.map((V,pe)=>{const ze=l.findIndex(zs=>zs===V);return e.jsxs(pt,{children:[e.jsx(Ie,{children:e.jsx(gt,{checked:D.has(ze),onCheckedChange:()=>Ks(ze)})}),e.jsx(Ie,{children:Ot(V.name)||e.jsx(Qe,{variant:"outline",className:"text-muted-foreground",children:"未测试"})}),e.jsx(Ie,{className:"font-medium",children:V.name}),e.jsx(Ie,{className:"max-w-xs truncate",title:V.base_url,children:V.base_url}),e.jsx(Ie,{children:V.client_type}),e.jsx(Ie,{className:"text-right",children:V.max_retry}),e.jsx(Ie,{className:"text-right",children:V.timeout}),e.jsx(Ie,{className:"text-right",children:V.retry_interval}),e.jsx(Ie,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>Ns(V.name),disabled:ae.has(V.name),title:"测试连接",children:ae.has(V.name)?e.jsx(mt,{className:"h-4 w-4 animate-spin"}):e.jsx(fn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"default",size:"sm",onClick:()=>we(V,ze),children:[e.jsx(pn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(_,{size:"sm",onClick:()=>Ys(ze),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(es,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},pe)})})]})})}),bt.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(C,{htmlFor:"page-size-provider",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Be,{value:xe.toString(),onValueChange:V=>{Ce(parseInt(V)),ne(1),Y(new Set)},children:[e.jsx(Le,{id:"page-size-provider",className:"w-20",children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"10",children:"10"}),e.jsx(se,{value:"20",children:"20"}),e.jsx(se,{value:"50",children:"50"}),e.jsx(se,{value:"100",children:"100"})]})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(k-1)*xe+1," 到"," ",Math.min(k*xe,bt.length)," 条,共 ",bt.length," 条"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>ne(1),disabled:k===1,className:"hidden sm:flex",children:e.jsx(fi,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>ne(V=>Math.max(1,V-1)),disabled:k===1,children:[e.jsx(jl,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ie,{type:"number",value:_e,onChange:V=>Me(V.target.value),onKeyDown:V=>V.key==="Enter"&&de(),placeholder:k.toString(),className:"w-16 h-8 text-center",min:1,max:Vt}),e.jsx(_,{variant:"outline",size:"sm",onClick:de,disabled:!_e,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>ne(V=>V+1),disabled:k>=Vt,children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Xa,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>ne(Vt),disabled:k>=Vt,className:"hidden sm:flex",children:e.jsx(pi,{className:"h-4 w-4"})})]})]})]}),e.jsx(Gs,{open:w,onOpenChange:Mt,children:e.jsxs(Us,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto","data-tour":"provider-dialog",preventOutsideClose:ye.isRunning,children:[e.jsxs(Bs,{children:[e.jsx(Hs,{children:G!==null?"编辑提供商":"添加提供商"}),e.jsx(Ws,{children:"配置 API 提供商的连接信息和参数"})]}),e.jsxs("form",{onSubmit:V=>{V.preventDefault(),bs()},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(C,{htmlFor:"template",children:"提供商模板"}),e.jsxs(Ya,{open:q,onOpenChange:z,children:[e.jsx(Ka,{asChild:!0,children:e.jsxs(_,{variant:"outline",role:"combobox","aria-expanded":q,className:"w-full justify-between",children:[T?xr.find(V=>V.id===T)?.display_name:"选择提供商模板...",e.jsx(nm,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(Ba,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:e.jsxs(po,{children:[e.jsx(go,{placeholder:"搜索提供商模板..."}),e.jsx(Ze,{className:"h-[300px]",children:e.jsxs(jo,{className:"max-h-none overflow-visible",children:[e.jsx(vo,{children:"未找到匹配的模板"}),e.jsx(yr,{children:xr.map(V=>e.jsxs(wr,{value:V.display_name,onSelect:()=>Ss(V.id),children:[e.jsx(sa,{className:`mr-2 h-4 w-4 ${T===V.id?"opacity-100":"opacity-0"}`}),V.display_name]},V.id))})]})})]})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"选择预设模板可自动填充 URL 和客户端类型,支持搜索"})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-name-input",children:[e.jsx(C,{htmlFor:"name",className:ke.name?"text-destructive":"",children:"名称 *"}),e.jsx(ie,{id:"name",value:O?.name||"",onChange:V=>{U(pe=>pe?{...pe,name:V.target.value}:null),ke.name&&X(pe=>({...pe,name:void 0}))},placeholder:"例如: DeepSeek, SiliconFlow",className:ke.name?"border-destructive focus-visible:ring-destructive":""}),ke.name&&e.jsx("p",{className:"text-xs text-destructive",children:ke.name})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-url-input",children:[e.jsx(C,{htmlFor:"base_url",className:ke.base_url?"text-destructive":"",children:"基础 URL *"}),e.jsx(ie,{id:"base_url",value:O?.base_url||"",onChange:V=>{U(pe=>pe?{...pe,base_url:V.target.value}:null),ke.base_url&&X(pe=>({...pe,base_url:void 0}))},placeholder:"https://api.example.com/v1",disabled:Ee,className:`${Ee?"bg-muted cursor-not-allowed":""} ${ke.base_url?"border-destructive focus-visible:ring-destructive":""}`}),ke.base_url&&e.jsx("p",{className:"text-xs text-destructive",children:ke.base_url}),Ee&&!ke.base_url&&e.jsx("p",{className:"text-xs text-muted-foreground",children:'使用模板时 URL 不可编辑,切换到"自定义"以手动配置'})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-apikey-input",children:[e.jsx(C,{htmlFor:"api_key",className:ke.api_key?"text-destructive":"",children:"API Key *"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ie,{id:"api_key",type:ge?"text":"password",value:O?.api_key||"",onChange:V=>{U(pe=>pe?{...pe,api_key:V.target.value}:null),ke.api_key&&X(pe=>({...pe,api_key:void 0}))},placeholder:"sk-...",className:`flex-1 ${ke.api_key?"border-destructive focus-visible:ring-destructive":""}`}),e.jsx(_,{type:"button",variant:"outline",size:"icon",onClick:()=>be(!ge),title:ge?"隐藏密钥":"显示密钥",children:ge?e.jsx(vr,{className:"h-4 w-4"}):e.jsx(Qt,{className:"h-4 w-4"})}),e.jsx(_,{type:"button",variant:"outline",size:"icon",onClick:xs,title:"复制密钥",children:e.jsx(no,{className:"h-4 w-4"})})]}),ke.api_key&&e.jsx("p",{className:"text-xs text-destructive",children:ke.api_key})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"client_type",children:"客户端类型"}),e.jsxs(Be,{value:O?.client_type||"openai",onValueChange:V=>U(pe=>pe?{...pe,client_type:V}:null),disabled:Ee,children:[e.jsx(Le,{id:"client_type",className:Ee?"bg-muted cursor-not-allowed":"",children:e.jsx(He,{placeholder:"选择客户端类型"})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"openai",children:"OpenAI"}),e.jsx(se,{value:"gemini",children:"Gemini"})]})]}),Ee&&e.jsx("p",{className:"text-xs text-muted-foreground",children:'使用模板时客户端类型不可编辑,切换到"自定义"以手动配置'})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"max_retry",children:"最大重试"}),e.jsx(ie,{id:"max_retry",type:"number",min:"0",value:O?.max_retry??"",onChange:V=>{const pe=V.target.value===""?null:parseInt(V.target.value);U(ze=>ze?{...ze,max_retry:pe}:null)},placeholder:"默认: 2"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"timeout",children:"超时(秒)"}),e.jsx(ie,{id:"timeout",type:"number",min:"1",value:O?.timeout??"",onChange:V=>{const pe=V.target.value===""?null:parseInt(V.target.value);U(ze=>ze?{...ze,timeout:pe}:null)},placeholder:"默认: 30"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"retry_interval",children:"重试间隔(秒)"}),e.jsx(ie,{id:"retry_interval",type:"number",min:"1",value:O?.retry_interval??"",onChange:V=>{const pe=V.target.value===""?null:parseInt(V.target.value);U(ze=>ze?{...ze,retry_interval:pe}:null)},placeholder:"默认: 10"})]})]})]}),e.jsxs(tt,{children:[e.jsx(_,{type:"button",variant:"outline",onClick:()=>R(!1),"data-tour":"provider-cancel-button",children:"取消"}),e.jsx(_,{type:"submit","data-tour":"provider-save-button",children:"保存"})]})]})]})}),e.jsx(ms,{open:M,onOpenChange:Q,children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:['确定要删除提供商 "',fe!==null?l[fe]?.name:"",'" 吗? 此操作无法撤销。']})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:vt,children:"删除"})]})]})}),e.jsx(ms,{open:K,onOpenChange:re,children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认批量删除"}),e.jsxs(os,{children:["确定要删除选中的 ",D.size," 个提供商吗? 此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:ha,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),e.jsx(ms,{open:Z.isOpen,onOpenChange:V=>me(pe=>({...pe,isOpen:V})),children:e.jsxs(ns,{className:"max-w-2xl",children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除提供商"}),e.jsx(os,{asChild:!0,children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:["您即将删除以下提供商:",e.jsx("strong",{className:"text-foreground ml-1",children:Z.providersToDelete.join(", ")})]}),e.jsxs("p",{className:"text-yellow-600 dark:text-yellow-500 font-medium",children:["⚠️ 此操作将同时删除 ",Z.affectedModels.length," 个关联的模型:"]}),e.jsx(Ze,{className:"h-32 w-full rounded border p-3",children:e.jsx("div",{className:"space-y-1",children:Z.affectedModels.map((V,pe)=>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:V.name}),e.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(",V.model_identifier,")"]})]},pe))})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"这些模型将从模型列表和所有任务分配中移除。此操作无法撤销。"})]})})]}),e.jsxs(rs,{children:[e.jsx(us,{onClick:$s,children:"取消"}),e.jsx(ds,{onClick:Ke,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})}),y&&e.jsx(dm,{onRestartComplete:I,onRestartFailed:$e})]})}function cj(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).substring(2,11)}`}function oj(l){return typeof l=="boolean"?"boolean":typeof l=="number"?"number":"string"}function g1(l,i){switch(i){case"boolean":return l==="true";case"number":{const r=parseFloat(l);return isNaN(r)?0:r}default:return l}}function qu(l){return Object.entries(l).map(([i,r])=>({id:cj(),key:i,value:r,type:oj(r)}))}function Gu(l){const i={};for(const r of l)r.key.trim()&&(i[r.key.trim()]=r.value);return i}function Fu(l){if(!l.trim())return{valid:!0,parsed:{}};try{const i=JSON.parse(l);if(typeof i!="object"||i===null||Array.isArray(i))return{valid:!1,error:"必须是一个 JSON 对象 {}"};for(const[r,o]of Object.entries(i))if(o!==null&&!["string","number","boolean"].includes(typeof o))return{valid:!1,error:`键 "${r}" 的值类型不支持(仅支持 string/number/boolean)`};return{valid:!0,parsed:i}}catch{return{valid:!1,error:"JSON 格式错误"}}}function j1(l){switch(l){case"boolean":return"布尔";case"number":return"数字";default:return"字符串"}}function v1(l){switch(l){case"boolean":return"bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-400";case"number":return"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400";default:return"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400"}}function b1({value:l,onChange:i,className:r,placeholder:o="添加额外参数..."}){const[u,x]=m.useState("list"),[h,p]=m.useState(()=>qu(l||{})),[g,v]=m.useState(()=>Object.keys(l||{}).length>0?JSON.stringify(l,null,2):""),[j,N]=m.useState(null);m.useEffect(()=>{const G=qu(l||{});p(G),v(Object.keys(l||{}).length>0?JSON.stringify(l,null,2):"")},[l]);const y=m.useMemo(()=>{const G=Fu(g);return G.valid&&G.parsed?{success:!0,data:G.parsed}:{success:!1,data:{}}},[g]),S=m.useCallback(G=>{const L=G;if(L==="json"&&u==="list"){const T=Gu(h);v(Object.keys(T).length>0?JSON.stringify(T,null,2):""),N(null)}else if(L==="list"&&u==="json"){const T=Fu(g);T.valid&&T.parsed&&(p(qu(T.parsed)),N(null))}x(L)},[u,h,g]),w=m.useCallback(()=>{const G={id:cj(),key:"",value:"",type:"string"},L=[...h,G];p(L)},[h]),R=m.useCallback(G=>{const L=h.filter(T=>T.id!==G);p(L),i(Gu(L))},[h,i]),O=m.useCallback((G,L,T)=>{const F=h.map(q=>{if(q.id!==G)return q;if(L==="type"){const z=T;let M;return z==="boolean"?M=q.value==="true"||q.value===!0:z==="number"?M=typeof q.value=="number"?q.value:parseFloat(String(q.value))||0:M=String(q.value),{...q,type:z,value:M}}else return L==="value"?{...q,value:g1(T,q.type)}:{...q,[L]:T}});p(F),i(Gu(F))},[h,i]),U=m.useCallback(G=>{v(G);const L=Fu(G);L.valid&&L.parsed?(N(null),i(L.parsed)):N(L.error||"JSON 格式错误")},[i]);return e.jsxs("div",{className:H("space-y-3",r),children:[e.jsx(C,{className:"text-sm font-medium",children:"额外参数"}),e.jsxs(ka,{value:u,onValueChange:S,className:"w-full",children:[e.jsxs(xa,{className:"h-8 p-0.5 bg-muted/60",children:[e.jsx(ts,{value:"list",className:"h-7 px-3 text-xs data-[state=active]:bg-background data-[state=active]:shadow-sm",children:"键值对"}),e.jsx(ts,{value:"json",className:"h-7 px-3 text-xs data-[state=active]:bg-background data-[state=active]:shadow-sm",children:"JSON"})]}),e.jsxs(Ms,{value:"list",className:"mt-3 space-y-2",children:[h.length===0?e.jsx("div",{className:"text-sm text-muted-foreground text-center py-4 border border-dashed rounded-md",children:o}):e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"grid grid-cols-[1fr_1fr_90px_32px] gap-2 text-xs text-muted-foreground px-1",children:[e.jsx("span",{children:"键名"}),e.jsx("span",{children:"值"}),e.jsx("span",{children:"类型"}),e.jsx("span",{})]}),h.map(G=>e.jsxs("div",{className:"grid grid-cols-[1fr_1fr_90px_32px] gap-2 items-center",children:[e.jsx(ie,{value:G.key,onChange:L=>O(G.id,"key",L.target.value),placeholder:"key",className:"h-8 text-sm"}),G.type==="boolean"?e.jsxs("div",{className:"flex items-center h-8 px-3 border rounded-md bg-background",children:[e.jsx(Fe,{checked:G.value===!0,onCheckedChange:L=>O(G.id,"value",String(L))}),e.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:G.value?"true":"false"})]}):e.jsx(ie,{type:G.type==="number"?"number":"text",value:G.value,onChange:L=>O(G.id,"value",L.target.value),placeholder:"value",className:"h-8 text-sm",step:G.type==="number"?"any":void 0}),e.jsxs(Be,{value:G.type,onValueChange:L=>O(G.id,"type",L),children:[e.jsx(Le,{className:"h-8 text-xs",children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"string",children:"字符串"}),e.jsx(se,{value:"number",children:"数字"}),e.jsx(se,{value:"boolean",children:"布尔"})]})]}),e.jsx(_,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",onClick:()=>R(G.id),children:e.jsx(es,{className:"h-4 w-4"})})]},G.id))]}),e.jsxs(_,{type:"button",variant:"outline",size:"sm",className:"w-full h-8",onClick:w,children:[e.jsx(ft,{className:"h-4 w-4 mr-1"}),"添加参数"]})]}),e.jsx(Ms,{value:"json",className:"mt-3",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"编辑"}),j?e.jsxs("div",{className:"flex items-center gap-1 text-xs text-destructive",children:[e.jsx(Gt,{className:"h-3 w-3"}),e.jsx("span",{className:"truncate max-w-[150px]",children:j})]}):g.trim()&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600 dark:text-green-400",children:[e.jsx(sa,{className:"h-3 w-3"}),e.jsx("span",{children:"有效"})]})]}),e.jsx(Is,{value:g,onChange:G=>U(G.target.value),placeholder:`{ +3.某句话如果已经被回复过,不要重复回复`}),[w,L]=m.useState({emoji_chance:.4,max_reg_num:40,do_replace:!0,check_interval:10,steal_emoji:!0,content_filtration:!1,filtration_prompt:"符合公序良俗"}),[O,U]=m.useState({enable_tool:!0,all_global:!0}),[F,A]=m.useState({api_key:""}),[k,$]=m.useState(!1),[G,z]=m.useState(""),M=[{id:"bot-basic",title:"Bot基础",description:"配置机器人的基本信息",icon:mr},{id:"personality",title:"人格配置",description:"定义机器人的性格和说话风格",icon:io},{id:"emoji",title:"表情包",description:"配置表情包相关设置",icon:lm},{id:"other",title:"其他设置",description:"工具、情绪系统等配置",icon:hi},{id:"siliconflow",title:"API配置",description:"配置硅基流动API密钥",icon:Og}],Q=(r+1)/M.length*100;m.useEffect(()=>{(async()=>{try{j(!0);const[Y,K,re,T,ie]=await Promise.all([vw(),bw(),Nw(),yw(),ww()]);N(Y),S(K),L(re),U(T),A(ie)}catch(Y){i({title:"加载配置失败",description:Y instanceof Error?Y.message:"无法加载现有配置,将使用默认值",variant:"destructive"})}finally{j(!1)}})()},[i]);const fe=async()=>{f(!0);try{switch(r){case 0:await _w(v);break;case 1:await Sw(y);break;case 2:await Cw(w);break;case 3:await kw(O);break;case 4:await Tw(F);break}return i({title:"保存成功",description:`${M[r].title}配置已保存`}),!0}catch(R){return i({title:"保存失败",description:R instanceof Error?R.message:"未知错误",variant:"destructive"}),!1}finally{f(!1)}},ve=async()=>{await fe()&&r{r>0&&o(r-1)},be=async()=>{x(!0),$(!0);try{if(z("正在保存API配置..."),!await fe()){x(!1),$(!1);return}z("正在完成初始化..."),await Sp(),z("正在重启麦麦..."),await po(),i({title:"配置完成",description:"麦麦正在重启以应用新配置..."}),z("等待麦麦重启完成...");const Y=60;let K=0,re=!1;for(;KsetTimeout(T,1e3));try{(await uj()).running&&(re=!0,z("重启成功!正在跳转..."))}catch{K++}}if(!re)throw new Error("重启超时,请手动检查麦麦状态");setTimeout(()=>{l({to:"/"})},1e3)}catch(R){$(!1),i({title:"配置失败",description:R instanceof Error?R.message:"未知错误",variant:"destructive"})}finally{x(!1)}},je=async()=>{try{await Sp(),l({to:"/"})}catch(R){i({title:"跳过失败",description:R instanceof Error?R.message:"未知错误",variant:"destructive"})}},Ne=()=>{switch(r){case 0:return e.jsx(hw,{config:v,onChange:N});case 1:return e.jsx(fw,{config:y,onChange:S});case 2:return e.jsx(pw,{config:w,onChange:L});case 3:return e.jsx(gw,{config:O,onChange:U});case 4:return e.jsx(jw,{config:F,onChange:A});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:[k&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm",children:e.jsxs("div",{className:"mx-auto flex max-w-md flex-col items-center space-y-6 rounded-lg border bg-card p-8 text-center shadow-lg",children:[e.jsx("div",{className:"flex h-20 w-20 items-center justify-center rounded-full bg-primary/10",children:e.jsx(xt,{className:"h-10 w-10 animate-spin text-primary"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h2",{className:"text-2xl font-bold",children:"正在重启麦麦"}),e.jsx("p",{className:"text-muted-foreground",children:G})]}),e.jsx("div",{className:"w-full",children:e.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-secondary",children:e.jsx("div",{className:"h-full w-full animate-pulse bg-primary",style:{animation:"pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite"}})})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"请稍候,这可能需要一分钟..."})]})}),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(Oy,{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:["让我们一起完成 ",cm," 的初始配置"]})]}),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:["步骤 ",r+1," / ",M.length]}),e.jsxs("span",{className:"font-medium text-primary",children:[Math.round(Q),"%"]})]}),e.jsx(gi,{value:Q,className:"h-2"})]}),e.jsx("div",{className:"mb-6 md:mb-8 flex justify-between",children:M.map((R,Y)=>{const K=R.icon;return e.jsxs("div",{className:H("flex flex-1 flex-col items-center gap-1 md:gap-2",Yl({to:"/"}),className:"gap-2 w-full sm:w-auto",children:[e.jsx(xo,{className:"h-4 w-4"}),"返回首页"]}),e.jsxs(_,{size:"lg",variant:"outline",onClick:()=>window.history.back(),className:"gap-2 w-full sm:w-auto",children:[e.jsx(di,{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 zw=Et.memo(function({config:i,onChange:r}){const o=()=>{r({...i,platforms:[...i.platforms,""]})},u=j=>{r({...i,platforms:i.platforms.filter((v,N)=>N!==j)})},x=(j,v)=>{const N=[...i.platforms];N[j]=v,r({...i,platforms:N})},h=()=>{r({...i,alias_names:[...i.alias_names,""]})},f=j=>{r({...i,alias_names:i.alias_names.filter((v,N)=>N!==j)})},g=(j,v)=>{const N=[...i.alias_names];N[j]=v,r({...i,alias_names:N})};return e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"基本信息"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"platform",children:"平台"}),e.jsx(ne,{id:"platform",value:i.platform,onChange:j=>r({...i,platform:j.target.value}),placeholder:"qq"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"qq_account",children:"QQ账号"}),e.jsx(ne,{id:"qq_account",value:i.qq_account,onChange:j=>r({...i,qq_account:j.target.value}),placeholder:"123456789"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"nickname",children:"昵称"}),e.jsx(ne,{id:"nickname",value:i.nickname,onChange:j=>r({...i,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(C,{children:"其他平台账号"}),e.jsxs(_,{onClick:o,size:"sm",variant:"outline",children:[e.jsx(ut,{className:"h-4 w-4 mr-1"}),"添加"]})]}),e.jsxs("div",{className:"space-y-2",children:[i.platforms.map((j,v)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{value:j,onChange:N=>x(v,N.target.value),placeholder:"wx:114514"}),e.jsxs(ms,{children:[e.jsx(mt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(We,{className:"h-4 w-4"})})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:['确定要删除平台账号 "',j||"(空)",'" 吗?此操作无法撤销。']})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>u(v),children:"删除"})]})]})]})]},v)),i.platforms.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(C,{children:"别名"}),e.jsxs(_,{onClick:h,size:"sm",variant:"outline",children:[e.jsx(ut,{className:"h-4 w-4 mr-1"}),"添加"]})]}),e.jsxs("div",{className:"space-y-2",children:[i.alias_names.map((j,v)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{value:j,onChange:N=>g(v,N.target.value),placeholder:"小麦"}),e.jsxs(ms,{children:[e.jsx(mt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(We,{className:"h-4 w-4"})})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:['确定要删除别名 "',j||"(空)",'" 吗?此操作无法撤销。']})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>f(v),children:"删除"})]})]})]})]},v)),i.alias_names.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无别名"})]})]})]})]})})}),Mw=Et.memo(function({config:i,onChange:r}){const o=()=>{r({...i,states:[...i.states,""]})},u=h=>{r({...i,states:i.states.filter((f,g)=>g!==h)})},x=(h,f)=>{const g=[...i.states];g[h]=f,r({...i,states:g})};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(C,{htmlFor:"personality",children:"人格特质"}),e.jsx(Is,{id:"personality",value:i.personality,onChange:h=>r({...i,personality:h.target.value}),placeholder:"描述人格特质和身份特征(建议120字以内)",rows:3}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"建议120字以内,描述人格特质和身份特征"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"reply_style",children:"表达风格"}),e.jsx(Is,{id:"reply_style",value:i.reply_style,onChange:h=>r({...i,reply_style:h.target.value}),placeholder:"描述说话的表达风格和习惯",rows:3})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"interest",children:"兴趣"}),e.jsx(Is,{id:"interest",value:i.interest,onChange:h=>r({...i,interest:h.target.value}),placeholder:"会影响麦麦对什么话题进行回复",rows:2})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"plan_style",children:"说话规则与行为风格"}),e.jsx(Is,{id:"plan_style",value:i.plan_style,onChange:h=>r({...i,plan_style:h.target.value}),placeholder:"麦麦的说话规则和行为风格",rows:5})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"visual_style",children:"识图规则"}),e.jsx(Is,{id:"visual_style",value:i.visual_style,onChange:h=>r({...i,visual_style:h.target.value}),placeholder:"识图时的处理规则",rows:3})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"private_plan_style",children:"私聊规则"}),e.jsx(Is,{id:"private_plan_style",value:i.private_plan_style,onChange:h=>r({...i,private_plan_style:h.target.value}),placeholder:"私聊的说话规则和行为风格",rows:4})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{children:"状态列表(人格多样性)"}),e.jsxs(_,{onClick:o,size:"sm",variant:"outline",children:[e.jsx(ut,{className:"h-4 w-4 mr-1"}),"添加状态"]})]}),e.jsx("div",{className:"space-y-2",children:i.states.map((h,f)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Is,{value:h,onChange:g=>x(f,g.target.value),placeholder:"描述一个人格状态",rows:2}),e.jsxs(ms,{children:[e.jsx(mt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(We,{className:"h-4 w-4"})})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsx(os,{children:"确定要删除这个人格状态吗?此操作无法撤销。"})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>u(f),children:"删除"})]})]})]})]},f))})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"state_probability",children:"状态替换概率"}),e.jsx(ne,{id:"state_probability",type:"number",step:"0.1",min:"0",max:"1",value:i.state_probability,onChange:h=>r({...i,state_probability:parseFloat(h.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"每次构建人格时替换 personality 的概率(0.0-1.0)"})]})]})]})})}),Be=uy,He=my,Le=m.forwardRef(({className:l,children:i,...r},o)=>e.jsxs(hg,{ref:o,className:H("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",l),...r,children:[i,e.jsx(iy,{asChild:!0,children:e.jsx(Qa,{className:"h-4 w-4 opacity-50"})})]}));Le.displayName=hg.displayName;const xj=m.forwardRef(({className:l,...i},r)=>e.jsx(fg,{ref:r,className:H("flex cursor-default items-center justify-center py-1",l),...i,children:e.jsx(ui,{className:"h-4 w-4"})}));xj.displayName=fg.displayName;const hj=m.forwardRef(({className:l,...i},r)=>e.jsx(pg,{ref:r,className:H("flex cursor-default items-center justify-center py-1",l),...i,children:e.jsx(Qa,{className:"h-4 w-4"})}));hj.displayName=pg.displayName;const Ue=m.forwardRef(({className:l,children:i,position:r="popper",...o},u)=>e.jsx(ry,{children:e.jsxs(gg,{ref:u,className:H("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",l),position:r,...o,children:[e.jsx(xj,{}),e.jsx(cy,{className:H("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:i}),e.jsx(hj,{})]})}));Ue.displayName=gg.displayName;const Aw=m.forwardRef(({className:l,...i},r)=>e.jsx(jg,{ref:r,className:H("px-2 py-1.5 text-sm font-semibold",l),...i}));Aw.displayName=jg.displayName;const se=m.forwardRef(({className:l,children:i,...r},o)=>e.jsxs(vg,{ref:o,className:H("relative flex w-full cursor-default select-none items-center rounded-sm py-2 pl-2 pr-8 text-sm outline-none bg-white dark:bg-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 focus:bg-gray-100 dark:focus:bg-gray-800 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",l),...r,children:[e.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(oy,{children:e.jsx(sa,{className:"h-4 w-4"})})}),e.jsx(dy,{children:i})]}));se.displayName=vg.displayName;const Ow=m.forwardRef(({className:l,...i},r)=>e.jsx(bg,{ref:r,className:H("-mx-1 my-1 h-px bg-muted",l),...i}));Ow.displayName=bg.displayName;const Ya=$N,Ka=qN,Ba=m.forwardRef(({className:l,align:i="center",sideOffset:r=4,...o},u)=>e.jsx(HN,{children:e.jsx(lg,{ref:u,align:i,sideOffset:r,className:H("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]",l),...o})}));Ba.displayName=lg.displayName;const Dw=Et.memo(function({value:i,onChange:r}){const[o,u]=m.useState("00"),[x,h]=m.useState("00"),[f,g]=m.useState("23"),[j,v]=m.useState("59");m.useEffect(()=>{const y=i.split("-");if(y.length===2){const[S,w]=y,[L,O]=S.split(":"),[U,F]=w.split(":");L&&u(L.padStart(2,"0")),O&&h(O.padStart(2,"0")),U&&g(U.padStart(2,"0")),F&&v(F.padStart(2,"0"))}},[i]);const N=(y,S,w,L)=>{const O=`${y}:${S}-${w}:${L}`;r(O)};return e.jsxs(Ya,{children:[e.jsx(Ka,{asChild:!0,children:e.jsxs(_,{variant:"outline",className:"w-full justify-start font-mono text-sm",children:[e.jsx(oi,{className:"h-4 w-4 mr-2"}),i||"选择时间段"]})}),e.jsx(Ba,{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(C,{className:"text-xs",children:"小时"}),e.jsxs(Be,{value:o,onValueChange:y=>{u(y),N(y,x,f,j)},children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsx(Ue,{children:Array.from({length:24},(y,S)=>S).map(y=>e.jsx(se,{value:y.toString().padStart(2,"0"),children:y.toString().padStart(2,"0")},y))})]})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-xs",children:"分钟"}),e.jsxs(Be,{value:x,onValueChange:y=>{h(y),N(o,y,f,j)},children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsx(Ue,{children:Array.from({length:60},(y,S)=>S).map(y=>e.jsx(se,{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(C,{className:"text-xs",children:"小时"}),e.jsxs(Be,{value:f,onValueChange:y=>{g(y),N(o,x,y,j)},children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsx(Ue,{children:Array.from({length:24},(y,S)=>S).map(y=>e.jsx(se,{value:y.toString().padStart(2,"0"),children:y.toString().padStart(2,"0")},y))})]})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-xs",children:"分钟"}),e.jsxs(Be,{value:j,onValueChange:y=>{v(y),N(o,x,f,y)},children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsx(Ue,{children:Array.from({length:60},(y,S)=>S).map(y=>e.jsx(se,{value:y.toString().padStart(2,"0"),children:y.toString().padStart(2,"0")},y))})]})]})]})]})]})})]})}),Rw=Et.memo(function({rule:i}){const r=`{ target = "${i.target}", time = "${i.time}", value = ${i.value.toFixed(1)} }`;return e.jsxs(Ya,{children:[e.jsx(Ka,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(Qt,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Ba,{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 文件中的格式"})]})})]})}),Lw=Et.memo(function({config:i,onChange:r}){const o=()=>{r({...i,talk_value_rules:[...i.talk_value_rules,{target:"",time:"00:00-23:59",value:1}]})},u=h=>{r({...i,talk_value_rules:i.talk_value_rules.filter((f,g)=>g!==h)})},x=(h,f,g)=>{const j=[...i.talk_value_rules];j[h]={...j[h],[f]:g},r({...i,talk_value_rules: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-4",children:"聊天设置"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"talk_value",children:"聊天频率(基础值)"}),e.jsx(ne,{id:"talk_value",type:"number",step:"0.1",min:"0",max:"1",value:i.talk_value,onChange:h=>r({...i,talk_value:parseFloat(h.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"越小越沉默,范围 0-1"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ve,{id:"mentioned_bot_reply",checked:i.mentioned_bot_reply,onCheckedChange:h=>r({...i,mentioned_bot_reply:h})}),e.jsx(C,{htmlFor:"mentioned_bot_reply",className:"cursor-pointer",children:"启用提及必回复"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"max_context_size",children:"上下文长度"}),e.jsx(ne,{id:"max_context_size",type:"number",min:"1",value:i.max_context_size,onChange:h=>r({...i,max_context_size:parseInt(h.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"planner_smooth",children:"规划器平滑"}),e.jsx(ne,{id:"planner_smooth",type:"number",step:"1",min:"0",value:i.planner_smooth,onChange:h=>r({...i,planner_smooth:parseFloat(h.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"增大数值会减小 planner 负荷,推荐 1-5,0 为关闭"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ve,{id:"enable_talk_value_rules",checked:i.enable_talk_value_rules,onCheckedChange:h=>r({...i,enable_talk_value_rules:h})}),e.jsx(C,{htmlFor:"enable_talk_value_rules",className:"cursor-pointer",children:"启用动态发言频率规则"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ve,{id:"include_planner_reasoning",checked:i.include_planner_reasoning,onCheckedChange:h=>r({...i,include_planner_reasoning:h})}),e.jsx(C,{htmlFor:"include_planner_reasoning",className:"cursor-pointer",children:"将 planner 推理加入 replyer"})]})]})]}),i.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:o,size:"sm",children:[e.jsx(ut,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),i.talk_value_rules&&i.talk_value_rules.length>0?e.jsx("div",{className:"space-y-4",children:i.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(Rw,{rule:h}),e.jsxs(ms,{children:[e.jsx(mt,{asChild:!0,children:e.jsx(_,{variant:"ghost",size:"sm",children:e.jsx(We,{className:"h-4 w-4 text-destructive"})})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:["确定要删除规则 #",f+1," 吗?此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>u(f),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"配置类型"}),e.jsxs(Be,{value:h.target===""?"global":"specific",onValueChange:g=>{g==="global"?x(f,"target",""):x(f,"target","qq::group")},children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"global",children:"全局配置"}),e.jsx(se,{value:"specific",children:"详细配置"})]})]})]}),h.target!==""&&(()=>{const g=h.target.split(":"),j=g[0]||"qq",v=g[1]||"",N=g[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(C,{className:"text-xs font-medium",children:"平台"}),e.jsxs(Be,{value:j,onValueChange:y=>{x(f,"target",`${y}:${v}:${N}`)},children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"qq",children:"QQ"}),e.jsx(se,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"群 ID"}),e.jsx(ne,{value:v,onChange:y=>{x(f,"target",`${j}:${y.target.value}:${N}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"类型"}),e.jsxs(Be,{value:N,onValueChange:y=>{x(f,"target",`${j}:${v}:${y}`)},children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"group",children:"群组(group)"}),e.jsx(se,{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(C,{className:"text-xs font-medium",children:"时间段 (Time)"}),e.jsx(Dw,{value:h.time,onChange:g=>x(f,"time",g)}),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(C,{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:g=>{const j=parseFloat(g.target.value);isNaN(j)||x(f,"value",Math.max(.01,Math.min(1,j)))},className:"w-20 h-8 text-xs"})]}),e.jsx(Ca,{value:[h.value],onValueChange:g=>x(f,"value",g[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 表示正常发言"]})]})]})]})]})}),Uw=Et.memo(function({config:i,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 space-x-2",children:[e.jsx(Ve,{checked:i.enable_asr,onCheckedChange:o=>r({...i,enable_asr:o})}),e.jsx(C,{className:"cursor-pointer",children:"启用语音识别"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后麦麦可以识别语音消息,需要配置语音识别模型"})]})}),Bw=Et.memo(function({config:i,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(Ve,{checked:i.enable,onCheckedChange:o=>r({...i,enable:o})}),e.jsx(C,{className:"cursor-pointer",children:"启用 LPMM 知识库"})]}),i.enable&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"LPMM 模式"}),e.jsxs(Be,{value:i.lpmm_mode,onValueChange:o=>r({...i,lpmm_mode:o}),children:[e.jsx(Le,{children:e.jsx(He,{placeholder:"选择 LPMM 模式"})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"classic",children:"经典模式"}),e.jsx(se,{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(C,{children:"同义词搜索 TopK"}),e.jsx(ne,{type:"number",min:"1",value:i.rag_synonym_search_top_k,onChange:o=>r({...i,rag_synonym_search_top_k:parseInt(o.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"同义词阈值"}),e.jsx(ne,{type:"number",step:"0.1",min:"0",max:"1",value:i.rag_synonym_threshold,onChange:o=>r({...i,rag_synonym_threshold:parseFloat(o.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"实体提取线程数"}),e.jsx(ne,{type:"number",min:"1",value:i.info_extraction_workers,onChange:o=>r({...i,info_extraction_workers:parseInt(o.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"嵌入向量维度"}),e.jsx(ne,{type:"number",min:"1",value:i.embedding_dimension,onChange:o=>r({...i,embedding_dimension:parseInt(o.target.value)})})]})]})]})]})]})}),Hw=Et.memo(function({config:i,onChange:r}){const[o,u]=m.useState(""),[x,h]=m.useState("WARNING"),f=()=>{o&&!i.suppress_libraries.includes(o)&&(r({...i,suppress_libraries:[...i.suppress_libraries,o]}),u(""))},g=w=>{r({...i,suppress_libraries:i.suppress_libraries.filter(L=>L!==w)})},j=()=>{o&&!i.library_log_levels[o]&&(r({...i,library_log_levels:{...i.library_log_levels,[o]:x}}),u(""),h("WARNING"))},v=w=>{const L={...i.library_log_levels};delete L[w],r({...i,library_log_levels:L})},N=["DEBUG","INFO","WARNING","ERROR","CRITICAL"],y=["FULL","compact","lite"],S=["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(C,{children:"日期格式"}),e.jsx(ne,{value:i.date_style,onChange:w=>r({...i,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(C,{children:"日志级别样式"}),e.jsxs(Be,{value:i.log_level_style,onValueChange:w=>r({...i,log_level_style:w}),children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsx(Ue,{children:y.map(w=>e.jsx(se,{value:w,children:w},w))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"日志文本颜色"}),e.jsxs(Be,{value:i.color_text,onValueChange:w=>r({...i,color_text:w}),children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsx(Ue,{children:S.map(w=>e.jsx(se,{value:w,children:w},w))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"全局日志级别"}),e.jsxs(Be,{value:i.log_level,onValueChange:w=>r({...i,log_level:w}),children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsx(Ue,{children:N.map(w=>e.jsx(se,{value:w,children:w},w))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"控制台日志级别"}),e.jsxs(Be,{value:i.console_log_level,onValueChange:w=>r({...i,console_log_level:w}),children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsx(Ue,{children:N.map(w=>e.jsx(se,{value:w,children:w},w))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"文件日志级别"}),e.jsxs(Be,{value:i.file_log_level,onValueChange:w=>r({...i,file_log_level:w}),children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsx(Ue,{children:N.map(w=>e.jsx(se,{value:w,children:w},w))})]})]})]})]}),e.jsxs("div",{children:[e.jsx(C,{className:"mb-2 block",children:"完全屏蔽的库"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(ne,{value:o,onChange:w=>u(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(ut,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:i.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:()=>g(w),children:e.jsx(We,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},w))})]}),e.jsxs("div",{children:[e.jsx(C,{className:"mb-2 block",children:"特定库的日志级别"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(ne,{value:o,onChange:w=>u(w.target.value),placeholder:"输入库名",className:"flex-1"}),e.jsxs(Be,{value:x,onValueChange:h,children:[e.jsx(Le,{className:"w-32",children:e.jsx(He,{})}),e.jsx(Ue,{children:N.map(w=>e.jsx(se,{value:w,children:w},w))})]}),e.jsx(_,{onClick:j,size:"sm",children:e.jsx(ut,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"space-y-2",children:Object.entries(i.library_log_levels).map(([w,L])=>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:L}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>v(w),children:e.jsx(We,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]})]},w))})]})]})}),$w=Et.memo(function({config:i,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(C,{children:"显示 Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否在日志中显示提示词"})]}),e.jsx(Ve,{checked:i.show_prompt,onCheckedChange:o=>r({...i,show_prompt:o})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{children:"显示回复器 Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的提示词"})]}),e.jsx(Ve,{checked:i.show_replyer_prompt,onCheckedChange:o=>r({...i,show_replyer_prompt:o})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{children:"显示回复器推理"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的推理过程"})]}),e.jsx(Ve,{checked:i.show_replyer_reasoning,onCheckedChange:o=>r({...i,show_replyer_reasoning:o})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{children:"显示 Jargon Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示术语相关的提示词"})]}),e.jsx(Ve,{checked:i.show_jargon_prompt,onCheckedChange:o=>r({...i,show_jargon_prompt:o})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{children:"显示记忆检索 Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示记忆检索相关的提示词"})]}),e.jsx(Ve,{checked:i.show_memory_prompt,onCheckedChange:o=>r({...i,show_memory_prompt:o})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{children:"显示 Planner Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示 Planner 的提示词和原始返回结果"})]}),e.jsx(Ve,{checked:i.show_planner_prompt,onCheckedChange:o=>r({...i,show_planner_prompt:o})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{children:"显示 LPMM 相关文段"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示 LPMM 知识库找到的相关文段日志"})]}),e.jsx(Ve,{checked:i.show_lpmm_paragraph,onCheckedChange:o=>r({...i,show_lpmm_paragraph:o})})]})]})]})}),qw=Et.memo(function({config:i,onChange:r}){const[o,u]=m.useState(""),x=()=>{o&&!i.auth_token.includes(o)&&(r({...i,auth_token:[...i.auth_token,o]}),u(""))},h=f=>{r({...i,auth_token:i.auth_token.filter((g,j)=>j!==f)})};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:"MaimMessage 服务配置"}),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(C,{children:"启用自定义服务器"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"是否使用自定义的 MaimMessage 服务器"})]}),e.jsx(Ve,{checked:i.use_custom,onCheckedChange:f=>r({...i,use_custom:f})})]}),i.use_custom&&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(C,{children:"主机地址"}),e.jsx(ne,{value:i.host,onChange:f=>r({...i,host:f.target.value}),placeholder:"127.0.0.1"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"端口号"}),e.jsx(ne,{type:"number",value:i.port,onChange:f=>r({...i,port:parseInt(f.target.value)}),placeholder:"8090"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"连接模式"}),e.jsxs(Be,{value:i.mode,onValueChange:f=>r({...i,mode:f}),children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"ws",children:"WebSocket (ws)"}),e.jsx(se,{value:"tcp",children:"TCP"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ve,{checked:i.use_wss,onCheckedChange:f=>r({...i,use_wss:f}),disabled:i.mode!=="ws"}),e.jsx(C,{children:"使用 WSS 安全连接"})]})]}),i.use_wss&&i.mode==="ws"&&e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"SSL 证书文件路径"}),e.jsx(ne,{value:i.cert_file,onChange:f=>r({...i,cert_file:f.target.value}),placeholder:"cert.pem"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"SSL 密钥文件路径"}),e.jsx(ne,{value:i.key_file,onChange:f=>r({...i,key_file:f.target.value}),placeholder:"key.pem"})]})]})]})]})]}),e.jsxs("div",{children:[e.jsx(C,{className:"mb-2 block",children:"认证令牌"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"用于 API 验证,为空则不启用验证"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(ne,{value:o,onChange:f=>u(f.target.value),placeholder:"输入认证令牌",onKeyDown:f=>{f.key==="Enter"&&(f.preventDefault(),x())}}),e.jsx(_,{onClick:x,size:"sm",children:e.jsx(ut,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),e.jsx("div",{className:"space-y-2",children:i.auth_token.map((f,g)=>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:f}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>h(g),children:e.jsx(We,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},g))})]})]})}),Gw=Et.memo(function({config:i,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(C,{children:"启用统计信息发送"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"发送匿名统计信息,帮助我们了解全球有多少只麦麦在运行"})]}),e.jsx(Ve,{checked:i.enable,onCheckedChange:o=>r({...i,enable:o})})]})]})}),Fw=Et.memo(function({emojiConfig:i,memoryConfig:r,toolConfig:o,onEmojiChange:u,onMemoryChange:x,onToolChange:h}){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:"flex items-center space-x-2",children:[e.jsx(Ve,{id:"enable_tool",checked:o.enable_tool,onCheckedChange:f=>h({...o,enable_tool:f})}),e.jsx(C,{htmlFor:"enable_tool",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(C,{htmlFor:"max_agent_iterations",children:"记忆思考深度"}),e.jsx(ne,{id:"max_agent_iterations",type:"number",min:"1",value:r.max_agent_iterations,onChange:f=>x({...r,max_agent_iterations:parseInt(f.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"最低为 1(不深入思考)"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{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:f=>x({...r,agent_timeout_seconds:parseFloat(f.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(Ve,{id:"enable_jargon_detection",checked:r.enable_jargon_detection??!0,onCheckedChange:f=>x({...r,enable_jargon_detection:f})}),e.jsx(C,{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(Ve,{id:"global_memory",checked:r.global_memory??!1,onCheckedChange:f=>x({...r,global_memory:f})}),e.jsx(C,{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(C,{htmlFor:"emoji_chance",children:"表情包激活概率"}),e.jsx(ne,{id:"emoji_chance",type:"number",step:"0.1",min:"0",max:"1",value:i.emoji_chance,onChange:f=>u({...i,emoji_chance:parseFloat(f.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"范围 0-1,越大越容易发送表情包"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"max_reg_num",children:"最大注册数量"}),e.jsx(ne,{id:"max_reg_num",type:"number",min:"1",value:i.max_reg_num,onChange:f=>u({...i,max_reg_num:parseInt(f.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦最多可以注册的表情包数量"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),e.jsx(ne,{id:"check_interval",type:"number",min:"1",value:i.check_interval,onChange:f=>u({...i,check_interval:parseInt(f.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(Ve,{id:"do_replace",checked:i.do_replace,onCheckedChange:f=>u({...i,do_replace:f})}),e.jsx(C,{htmlFor:"do_replace",className:"cursor-pointer",children:"达到最大数量时替换表情包"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ve,{id:"steal_emoji",checked:i.steal_emoji,onCheckedChange:f=>u({...i,steal_emoji:f})}),e.jsx(C,{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(Ve,{id:"content_filtration",checked:i.content_filtration,onCheckedChange:f=>u({...i,content_filtration:f})}),e.jsx(C,{htmlFor:"content_filtration",className:"cursor-pointer",children:"启用表情包过滤"})]}),i.content_filtration&&e.jsxs("div",{className:"grid gap-2 pl-6 border-l-2 border-primary/20",children:[e.jsx(C,{htmlFor:"filtration_prompt",children:"过滤要求"}),e.jsx(ne,{id:"filtration_prompt",value:i.filtration_prompt,onChange:f=>u({...i,filtration_prompt:f.target.value}),placeholder:"符合公序良俗"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"只有符合此要求的表情包才会被保存"})]})]})]})})]})}),Vw=Et.memo(function({member:i,groupIndex:r,memberIndex:o,availableChatIds:u,onUpdate:x,onRemove:h}){const f=u.includes(i)||i==="*",[g,j]=m.useState(!f);return e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:"flex-1 flex gap-2",children:g?e.jsxs(e.Fragment,{children:[e.jsx(ne,{value:i,onChange:v=>x(r,o,v.target.value),placeholder:'输入 "*" 或 "qq:123456:group"',className:"flex-1"}),u.length>0&&e.jsx(_,{size:"sm",variant:"outline",onClick:()=>j(!1),title:"切换到下拉选择",children:"下拉"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(Be,{value:i,onValueChange:v=>x(r,o,v),children:[e.jsx(Le,{className:"flex-1",children:e.jsx(He,{placeholder:"选择聊天流"})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"*",children:"* (全局共享)"}),u.map((v,N)=>e.jsx(se,{value:v,children:v},N))]})]}),e.jsx(_,{size:"sm",variant:"outline",onClick:()=>j(!0),title:"切换到手动输入",children:"输入"})]})}),e.jsxs(ms,{children:[e.jsx(mt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(We,{className:"h-4 w-4"})})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:['确定要删除组成员 "',i||"(空)",'" 吗?此操作无法撤销。']})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>h(r,o),children:"删除"})]})]})]})]})}),Iw=Et.memo(function({config:i,onChange:r}){const o=()=>{r({...i,learning_list:[...i.learning_list,["","enable","enable","1.0"]]})},u=y=>{r({...i,learning_list:i.learning_list.filter((S,w)=>w!==y)})},x=(y,S,w)=>{const L=[...i.learning_list];L[y][S]=w,r({...i,learning_list:L})},h=({rule:y})=>{const S=`["${y[0]}", "${y[1]}", "${y[2]}", "${y[3]}"]`;return e.jsxs(Ya,{children:[e.jsx(Ka,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(Qt,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Ba,{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:S}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},f=()=>{r({...i,expression_groups:[...i.expression_groups,[]]})},g=y=>{r({...i,expression_groups:i.expression_groups.filter((S,w)=>w!==y)})},j=y=>{const S=[...i.expression_groups];S[y]=[...S[y],""],r({...i,expression_groups:S})},v=(y,S)=>{const w=[...i.expression_groups];w[y]=w[y].filter((L,O)=>O!==S),r({...i,expression_groups:w})},N=(y,S,w)=>{const L=[...i.expression_groups];L[y][S]=w,r({...i,expression_groups:L})};return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"表达学习配置"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦如何学习和使用表达方式"})]}),e.jsxs(_,{onClick:o,size:"sm",variant:"outline",children:[e.jsx(ut,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),e.jsxs("div",{className:"space-y-4",children:[i.learning_list.map((y,S)=>{const w=i.learning_list.some((k,$)=>$!==S&&k[0]===""),L=y[0]==="",O=y[0].split(":"),U=O[0]||"qq",F=O[1]||"",A=O[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:["规则 ",S+1," ",L&&"(全局配置)"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{rule:y}),e.jsxs(ms,{children:[e.jsx(mt,{asChild:!0,children:e.jsx(_,{size:"sm",variant:"ghost",children:e.jsx(We,{className:"h-4 w-4"})})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:["确定要删除学习规则 ",S+1," 吗?此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>u(S),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"配置类型"}),e.jsxs(Be,{value:L?"global":"specific",onValueChange:k=>{k==="global"?x(S,0,""):x(S,0,"qq::group")},disabled:w&&!L,children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"global",children:"全局配置"}),e.jsx(se,{value:"specific",disabled:w&&!L,children:"详细配置"})]})]}),w&&!L&&e.jsx("p",{className:"text-xs text-amber-600",children:"已存在全局配置,无法创建新的全局配置"})]}),!L&&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(C,{className:"text-xs font-medium",children:"平台"}),e.jsxs(Be,{value:U,onValueChange:k=>{x(S,0,`${k}:${F}:${A}`)},children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"qq",children:"QQ"}),e.jsx(se,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"群 ID"}),e.jsx(ne,{value:F,onChange:k=>{x(S,0,`${U}:${k.target.value}:${A}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"类型"}),e.jsxs(Be,{value:A,onValueChange:k=>{x(S,0,`${U}:${F}:${k}`)},children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"group",children:"群组(group)"}),e.jsx(se,{value:"private",children:"私聊(private)"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",y[0]||"(未设置)"]})]}),e.jsx("div",{className:"grid gap-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-xs font-medium",children:"使用学到的表达"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦使用从聊天中学到的表达方式"})]}),e.jsx(Ve,{checked:y[1]==="enable",onCheckedChange:k=>x(S,1,k?"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(C,{className:"text-xs font-medium",children:"学习表达"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦从聊天中学习新的表达方式"})]}),e.jsx(Ve,{checked:y[2]==="enable",onCheckedChange:k=>x(S,2,k?"enable":"disable")})]})}),e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{className:"text-xs font-medium",children:"学习强度"}),e.jsx(ne,{type:"number",step:"0.1",min:"0",max:"5",value:y[3],onChange:k=>{const $=parseFloat(k.target.value);isNaN($)||x(S,3,Math.max(0,Math.min(5,$)).toFixed(1))},className:"w-20 h-8 text-xs"})]}),e.jsx(Ca,{value:[parseFloat(y[3])||1],onValueChange:k=>x(S,3,k[0].toFixed(1)),min:0,max:5,step:.1,className:"w-full"}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"0 (不学习)"}),e.jsx("span",{children:"2.5"}),e.jsx("span",{children:"5.0 (快速学习)"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"影响学习频率,最短学习间隔 = 300/学习强度(秒)"})]})]})]},S)}),i.learning_list.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无学习规则,点击"添加规则"开始配置'})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"表达反思配置"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦主动向管理员询问表达方式是否合适的功能"})]}),e.jsx(Ve,{checked:i.reflect,onCheckedChange:y=>r({...i,reflect:y})})]}),i.reflect&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsx("span",{className:"text-sm font-medium",children:"反思操作员"})}),e.jsx("div",{className:"space-y-4",children:(()=>{const S=(i.reflect_operator_id||"").split(":"),w=S[0]||"qq",L=S[1]||"",O=S[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(C,{className:"text-xs font-medium",children:"平台"}),e.jsxs(Be,{value:w,onValueChange:U=>{r({...i,reflect_operator_id:`${U}:${L}:${O}`})},children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"qq",children:"QQ"}),e.jsx(se,{value:"wx",children:"微信"})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"用户/群 ID"}),e.jsx(ne,{value:L,onChange:U=>{r({...i,reflect_operator_id:`${w}:${U.target.value}:${O}`})},placeholder:"输入 ID",className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"类型"}),e.jsxs(Be,{value:O,onValueChange:U=>{r({...i,reflect_operator_id:`${w}:${L}:${U}`})},children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"private",children:"私聊(private)"}),e.jsx(se,{value:"group",children:"群组(group)"})]})]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前操作员 ID:",i.reflect_operator_id||"(未设置)"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦会向此操作员询问表达方式是否合适"})]})})()})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-medium",children:"允许反思的聊天流"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"只有在此列表中的聊天流才会提出问题并跟踪。如果列表为空,则所有聊天流都可以进行表达反思"})]}),e.jsxs(_,{onClick:()=>{r({...i,allow_reflect:[...i.allow_reflect||[],"qq::group"]})},size:"sm",variant:"outline",children:[e.jsx(ut,{className:"h-4 w-4 mr-1"}),"添加聊天流"]})]}),e.jsxs("div",{className:"space-y-2",children:[(i.allow_reflect||[]).map((y,S)=>{const w=y.split(":"),L=w[0]||"qq",O=w[1]||"",U=w[2]||"group";return e.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg bg-muted/50",children:[e.jsxs(Be,{value:L,onValueChange:F=>{const A=[...i.allow_reflect];A[S]=`${F}:${O}:${U}`,r({...i,allow_reflect:A})},children:[e.jsx(Le,{className:"w-24",children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"qq",children:"QQ"}),e.jsx(se,{value:"wx",children:"微信"})]})]}),e.jsx(ne,{value:O,onChange:F=>{const A=[...i.allow_reflect];A[S]=`${L}:${F.target.value}:${U}`,r({...i,allow_reflect:A})},placeholder:"ID",className:"flex-1 font-mono text-sm"}),e.jsxs(Be,{value:U,onValueChange:F=>{const A=[...i.allow_reflect];A[S]=`${L}:${O}:${F}`,r({...i,allow_reflect:A})},children:[e.jsx(Le,{className:"w-32",children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"group",children:"群组"}),e.jsx(se,{value:"private",children:"私聊"})]})]}),e.jsx(_,{onClick:()=>{r({...i,allow_reflect:i.allow_reflect.filter((F,A)=>A!==S)})},size:"sm",variant:"ghost",children:e.jsx(We,{className:"h-4 w-4"})})]},S)}),(!i.allow_reflect||i.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(ut,{className:"h-4 w-4 mr-1"}),"添加共享组"]})]}),e.jsxs("div",{className:"space-y-4",children:[i.expression_groups.map((y,S)=>{const w=i.learning_list.map(L=>L[0]).filter(L=>L!=="");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:["共享组 ",S+1,y.length===1&&y[0]==="*"&&"(全局共享)"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(_,{onClick:()=>j(S),size:"sm",variant:"outline",children:e.jsx(ut,{className:"h-4 w-4"})}),e.jsxs(ms,{children:[e.jsx(mt,{asChild:!0,children:e.jsx(_,{size:"sm",variant:"ghost",children:e.jsx(We,{className:"h-4 w-4"})})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:["确定要删除共享组 ",S+1," 吗?此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>g(S),children:"删除"})]})]})]})]})]}),e.jsx("div",{className:"space-y-2",children:y.map((L,O)=>e.jsx(Vw,{member:L,groupIndex:S,memberIndex:O,availableChatIds:w,onUpdate:N,onRemove:v},`${S}-${O}`))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:'提示:可以从下拉框选择已配置的聊天流,或手动输入。输入 "*" 启用全局共享'})]},S)}),i.expression_groups.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-4",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(Ve,{id:"all_global_jargon",checked:i.all_global_jargon??!1,onCheckedChange:y=>r({...i,all_global_jargon:y})}),e.jsx(C,{htmlFor:"all_global_jargon",className:"cursor-pointer",children:"全局黑话模式"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"开启后,新增的黑话将默认设为全局(所有聊天流共享)。关闭后,已记录的全局黑话不会改变,需要手动删除。"})]})})]})});function Qw({regex:l,reaction:i,onRegexChange:r,onReactionChange:o}){const[u,x]=m.useState(!1),[h,f]=m.useState(""),[g,j]=m.useState(null),[v,N]=m.useState(""),[y,S]=m.useState({}),[w,L]=m.useState(""),O=m.useRef(null),[U,F]=m.useState("build"),A=z=>z.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),k=(z,M=0)=>{const Q=O.current;if(!Q)return;const fe=Q.selectionStart||0,ve=Q.selectionEnd||0,ge=l.substring(0,fe)+z+l.substring(ve);r(ge),setTimeout(()=>{const be=fe+z.length+M;Q.setSelectionRange(be,be),Q.focus()},0)};m.useEffect(()=>{if(!l||!h){j(null),S({}),L(i),N("");return}try{const z=A(l),M=new RegExp(z,"g"),Q=h.match(M);j(Q),N("");const ve=new RegExp(z).exec(h);if(ve&&ve.groups){S(ve.groups);let ge=i;Object.entries(ve.groups).forEach(([be,je])=>{ge=ge.replace(new RegExp(`\\[${be}\\]`,"g"),je||"")}),L(ge)}else S({}),L(i)}catch(z){N(z.message),j(null),S({}),L(i)}},[l,h,i]);const $=()=>{if(!h||!g||g.length===0)return e.jsx("span",{className:"text-muted-foreground",children:h||"请输入测试文本"});try{const z=A(l),M=new RegExp(z,"g");let Q=0;const fe=[];let ve;for(;(ve=M.exec(h))!==null;)ve.index>Q&&fe.push(e.jsx("span",{children:h.substring(Q,ve.index)},`text-${Q}`)),fe.push(e.jsx("span",{className:"bg-yellow-200 dark:bg-yellow-900 font-semibold",children:ve[0]},`match-${ve.index}`)),Q=ve.index+ve[0].length;return Q)",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(Gs,{open:u,onOpenChange:x,children:[e.jsx(om,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(nm,{className:"h-4 w-4 mr-1"}),"正则编辑器"]})}),e.jsxs(Us,{className:"max-w-[95vw] sm:max-w-[900px] max-h-[90vh]",children:[e.jsxs(Bs,{children:[e.jsx(Hs,{children:"正则表达式编辑器"}),e.jsx(Ws,{className:"text-sm",children:"使用可视化工具构建正则表达式,并实时测试效果"})]}),e.jsx(Ze,{className:"max-h-[calc(90vh-120px)]",children:e.jsxs(ka,{value:U,onValueChange:z=>F(z),className:"w-full",children:[e.jsxs(xa,{className:"grid w-full grid-cols-2",children:[e.jsx(ts,{value:"build",children:"🔧 构建器"}),e.jsx(ts,{value:"test",children:"🧪 测试器"})]}),e.jsxs(Ms,{value:"build",className:"space-y-4 mt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{className:"text-sm font-medium",children:"正则表达式"}),e.jsx(ne,{ref:O,value:l,onChange:z=>r(z.target.value),className:"font-mono text-sm",placeholder:"点击下方按钮构建正则表达式..."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{className:"text-sm font-medium",children:"Reaction 内容"}),e.jsx(Is,{value:i,onChange:z=>o(z.target.value),placeholder:"使用 [捕获组名] 引用捕获的内容...",rows:3,className:"text-sm"})]}),e.jsxs("div",{className:"space-y-4 border-t pt-4",children:[G.map(z=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("h5",{className:"text-xs font-semibold text-primary",children:z.category}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:z.items.map(M=>e.jsx(_,{variant:"outline",size:"sm",className:"justify-start h-auto py-2 px-3",onClick:()=>k(M.pattern,M.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:M.label}),e.jsx("code",{className:"ml-auto text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:M.pattern})]}),e.jsx("span",{className:"text-xs text-muted-foreground mt-0.5",children:M.desc})]})},M.label))})]},z.category)),e.jsxs("div",{className:"space-y-2 border-t pt-4",children:[e.jsx("h5",{className:"text-xs font-semibold text-primary",children:"完整示例模板"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(_,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>r("^(?P\\S{1,20})是这样的$"),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsxs("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:["^(?P\\S","{1,20}",")是这样的$"]}),e.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「某事物是这样的」并捕获事物名称"})]})}),e.jsx(_,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>r("(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"}),e.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「我没要求你做某事」并捕获具体行为"})]})}),e.jsx(_,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>r("(?P.+?)(?:是|为什么|怎么)"),children:e.jsxs("div",{className:"flex flex-col items-start w-full",children:[e.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?P.+?)(?:是|为什么|怎么)"}),e.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"捕获问题主题词"})]})})]})]})]}),e.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[e.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 使用提示"}),e.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[e.jsx("li",{children:"点击输入框设置光标位置,然后点击按钮插入模式"}),e.jsxs("li",{children:["命名捕获组格式:",e.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"(?P<名称>模式)"})]}),e.jsxs("li",{children:["在 reaction 中使用 ",e.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"[名称]"})," 引用捕获的内容"]}),e.jsx("li",{children:"切换到测试器标签页验证正则表达式效果"})]})]})]}),e.jsxs(Ms,{value:"test",className:"space-y-4 mt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{className:"text-sm font-medium",children:"当前正则表达式"}),e.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:l||"(未设置)"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"test-text",className:"text-sm font-medium",children:"测试文本"}),e.jsx(Is,{id:"test-text",value:h,onChange:z=>f(z.target.value),placeholder:`在此输入要测试的文本... +例如:打游戏是这样的`,className:"min-h-[100px] text-sm"})]}),v&&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:v})]}),!v&&h&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"flex items-center gap-2",children:g&&g.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:["匹配成功 (",g.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(C,{className:"text-sm font-medium",children:"匹配高亮"}),e.jsx(Ze,{className:"h-40 rounded-md bg-muted p-3",children:e.jsx("div",{className:"text-sm break-words",children:$()})})]}),Object.keys(y).length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{className:"text-sm font-medium",children:"命名捕获组"}),e.jsx(Ze,{className:"h-32 rounded-md border p-3",children:e.jsx("div",{className:"space-y-2",children:Object.entries(y).map(([z,M])=>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:["[",z,"]"]}),e.jsx("span",{className:"text-muted-foreground",children:"="}),e.jsx("span",{className:"font-mono bg-muted px-2 py-0.5 rounded",children:M})]},z))})})]}),Object.keys(y).length>0&&i&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{className:"text-sm font-medium",children:"Reaction 替换预览"}),e.jsx(Ze,{className:"h-48 rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3",children:e.jsx("div",{className:"text-sm break-words",children:w})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"reaction 中的 [name] 已被替换为对应的捕获组值"})]})]}),e.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[e.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 测试说明"}),e.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[e.jsx("li",{children:"匹配的文本会以黄色背景高亮显示"}),e.jsx("li",{children:"命名捕获组的值会显示在下方列表中"}),e.jsx("li",{children:"Reaction 替换预览显示最终生成的反应内容"}),e.jsx("li",{children:"如需修改正则,切换回构建器标签页"})]})]})]})]})})]})]})}const Yw=Et.memo(function({keywordReactionConfig:i,responsePostProcessConfig:r,chineseTypoConfig:o,responseSplitterConfig:u,onKeywordReactionChange:x,onResponsePostProcessChange:h,onChineseTypoChange:f,onResponseSplitterChange:g}){const j=()=>{x({...i,regex_rules:[...i.regex_rules,{regex:[""],reaction:""}]})},v=k=>{x({...i,regex_rules:i.regex_rules.filter(($,G)=>G!==k)})},N=(k,$,G)=>{const z=[...i.regex_rules];$==="regex"&&typeof G=="string"?z[k]={...z[k],regex:[G]}:$==="reaction"&&typeof G=="string"&&(z[k]={...z[k],reaction:G}),x({...i,regex_rules:z})},y=()=>{x({...i,keyword_rules:[...i.keyword_rules,{keywords:[],reaction:""}]})},S=k=>{x({...i,keyword_rules:i.keyword_rules.filter(($,G)=>G!==k)})},w=(k,$,G)=>{const z=[...i.keyword_rules];typeof G=="string"&&(z[k]={...z[k],reaction:G}),x({...i,keyword_rules:z})},L=k=>{const $=[...i.keyword_rules];$[k]={...$[k],keywords:[...$[k].keywords||[],""]},x({...i,keyword_rules:$})},O=(k,$)=>{const G=[...i.keyword_rules];G[k]={...G[k],keywords:(G[k].keywords||[]).filter((z,M)=>M!==$)},x({...i,keyword_rules:G})},U=(k,$,G)=>{const z=[...i.keyword_rules],M=[...z[k].keywords||[]];M[$]=G,z[k]={...z[k],keywords:M},x({...i,keyword_rules:z})},F=({rule:k})=>{const $=`{ regex = [${(k.regex||[]).map(G=>`"${G}"`).join(", ")}], reaction = "${k.reaction}" }`;return e.jsxs(Ya,{children:[e.jsx(Ka,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(Qt,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Ba,{className:"w-[95vw] sm:w-[500px]",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),e.jsx(Ze,{className:"h-60 rounded-md bg-muted p-3",children:e.jsx("pre",{className:"font-mono text-xs break-all",children:$})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},A=({rule:k})=>{const $=`[[keyword_reaction.keyword_rules]] +keywords = [${(k.keywords||[]).map(G=>`"${G}"`).join(", ")}] +reaction = "${k.reaction}"`;return e.jsxs(Ya,{children:[e.jsx(Ka,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",children:[e.jsx(Qt,{className:"h-4 w-4 mr-1"}),"预览"]})}),e.jsx(Ba,{className:"w-[95vw] sm:w-[500px]",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),e.jsx(Ze,{className:"h-60 rounded-md bg-muted p-3",children:e.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-all",children:$})}),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:j,size:"sm",variant:"outline",children:[e.jsx(ut,{className:"h-4 w-4 mr-1"}),"添加正则规则"]})]}),e.jsxs("div",{className:"space-y-3",children:[i.regex_rules.map((k,$)=>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:["正则规则 ",$+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Qw,{regex:k.regex&&k.regex[0]||"",reaction:k.reaction,onRegexChange:G=>N($,"regex",G),onReactionChange:G=>N($,"reaction",G)}),e.jsx(F,{rule:k}),e.jsxs(ms,{children:[e.jsx(mt,{asChild:!0,children:e.jsx(_,{size:"sm",variant:"ghost",children:e.jsx(We,{className:"h-4 w-4"})})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:["确定要删除正则规则 ",$+1," 吗?此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>v($),children:"删除"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-xs font-medium",children:"正则表达式(Python 语法)"}),e.jsx(ne,{value:k.regex&&k.regex[0]||"",onChange:G=>N($,"regex",G.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(C,{className:"text-xs font-medium",children:"反应内容"}),e.jsx(Is,{value:k.reaction,onChange:G=>N($,"reaction",G.target.value),placeholder:`触发后麦麦的反应... +可以使用 [捕获组名] 来引用正则表达式中的内容`,rows:3,className:"text-sm"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"使用 [捕获组名] 引用正则表达式中的命名捕获组,例如 [n] 会被替换为捕获的内容"})]})]})]},$)),i.regex_rules.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无正则规则,点击"添加正则规则"开始配置'})]})]}),e.jsxs("div",{className:"space-y-4 border-t pt-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-base font-semibold",children:"关键词规则"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用关键词列表匹配消息内容"})]}),e.jsxs(_,{onClick:y,size:"sm",variant:"outline",children:[e.jsx(ut,{className:"h-4 w-4 mr-1"}),"添加关键词规则"]})]}),e.jsxs("div",{className:"space-y-3",children:[i.keyword_rules.map((k,$)=>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:["关键词规则 ",$+1]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(A,{rule:k}),e.jsxs(ms,{children:[e.jsx(mt,{asChild:!0,children:e.jsx(_,{size:"sm",variant:"ghost",children:e.jsx(We,{className:"h-4 w-4"})})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:["确定要删除关键词规则 ",$+1," 吗?此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>S($),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(C,{className:"text-xs font-medium",children:"关键词列表"}),e.jsxs(_,{onClick:()=>L($),size:"sm",variant:"ghost",children:[e.jsx(ut,{className:"h-3 w-3 mr-1"}),"添加关键词"]})]}),e.jsxs("div",{className:"space-y-2",children:[(k.keywords||[]).map((G,z)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{value:G,onChange:M=>U($,z,M.target.value),placeholder:"关键词",className:"flex-1"}),e.jsx(_,{onClick:()=>O($,z),size:"sm",variant:"ghost",children:e.jsx(We,{className:"h-4 w-4"})})]},z)),(!k.keywords||k.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(C,{className:"text-xs font-medium",children:"反应内容"}),e.jsx(Is,{value:k.reaction,onChange:G=>w($,"reaction",G.target.value),placeholder:"触发后麦麦的反应...",rows:3,className:"text-sm"})]})]})]},$)),i.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(Ve,{id:"enable_response_post_process",checked:r.enable_response_post_process,onCheckedChange:k=>h({...r,enable_response_post_process:k})}),e.jsx(C,{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(Ve,{id:"enable_chinese_typo",checked:o.enable,onCheckedChange:k=>f({...o,enable:k})}),e.jsx(C,{htmlFor:"enable_chinese_typo",className:"cursor-pointer font-semibold",children:"中文错别字生成器"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"为回复添加随机错别字,让麦麦的回复更自然"}),o.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(C,{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:o.error_rate,onChange:k=>f({...o,error_rate:parseFloat(k.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"min_freq",className:"text-xs font-medium",children:"最小字频阈值"}),e.jsx(ne,{id:"min_freq",type:"number",min:"0",value:o.min_freq,onChange:k=>f({...o,min_freq:parseInt(k.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{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:o.tone_error_rate,onChange:k=>f({...o,tone_error_rate:parseFloat(k.target.value)})})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{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:o.word_replace_rate,onChange:k=>f({...o,word_replace_rate:parseFloat(k.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(Ve,{id:"enable_response_splitter",checked:u.enable,onCheckedChange:k=>g({...u,enable:k})}),e.jsx(C,{htmlFor:"enable_response_splitter",className:"cursor-pointer font-semibold",children:"回复分割器"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"控制回复的长度和句子数量"}),u.enable&&e.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"max_length",className:"text-xs font-medium",children:"最大长度"}),e.jsx(ne,{id:"max_length",type:"number",min:"1",value:u.max_length,onChange:k=>g({...u,max_length:parseInt(k.target.value)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大字符数"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"max_sentence_num",className:"text-xs font-medium",children:"最大句子数"}),e.jsx(ne,{id:"max_sentence_num",type:"number",min:"1",value:u.max_sentence_num,onChange:k=>g({...u,max_sentence_num:parseInt(k.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(Ve,{id:"enable_kaomoji_protection",checked:u.enable_kaomoji_protection,onCheckedChange:k=>g({...u,enable_kaomoji_protection:k})}),e.jsx(C,{htmlFor:"enable_kaomoji_protection",className:"cursor-pointer",children:"启用颜文字保护"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ve,{id:"enable_overflow_return_all",checked:u.enable_overflow_return_all,onCheckedChange:k=>g({...u,enable_overflow_return_all:k})}),e.jsx(C,{htmlFor:"enable_overflow_return_all",className:"cursor-pointer",children:"超出时一次性返回全部"})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"当句子数量超出限制时,合并后一次性返回所有内容"})]})]})})]})]})]})}),Kl="/api/webui/config";async function Cp(){const i=await(await Te(`${Kl}/bot`)).json();if(!i.success)throw new Error("获取配置数据失败");return i.config}async function Il(){const i=await(await Te(`${Kl}/model`)).json();if(!i.success)throw new Error("获取模型配置数据失败");return i.config}async function kp(l){const r=await(await Te(`${Kl}/bot`,{method:"POST",body:JSON.stringify(l)})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}async function Kw(){const i=await(await Te(`${Kl}/bot/raw`)).json();if(!i.success)throw new Error("获取配置源代码失败");return i.content}async function Xw(l){const r=await(await Te(`${Kl}/bot/raw`,{method:"POST",body:JSON.stringify({raw_content:l})})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}async function jr(l){const r=await(await Te(`${Kl}/model`,{method:"POST",body:JSON.stringify(l)})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}async function Jw(l,i){const o=await(await Te(`${Kl}/bot/section/${l}`,{method:"POST",body:JSON.stringify(i)})).json();if(!o.success)throw new Error(o.message||`保存配置节 ${l} 失败`)}async function sm(l,i){const o=await(await Te(`${Kl}/model/section/${l}`,{method:"POST",body:JSON.stringify(i)})).json();if(!o.success)throw new Error(o.message||`保存配置节 ${l} 失败`)}async function Pw(l,i="openai",r="/models"){const o=new URLSearchParams({provider_name:l,parser:i,endpoint:r}),u=await Te(`/api/webui/models/list?${o}`);if(!u.ok){const h=await u.json().catch(()=>({}));throw new Error(h.detail||`获取模型列表失败 (${u.status})`)}const x=await u.json();if(!x.success)throw new Error("获取模型列表失败");return x.models}async function Zw(l){const i=new URLSearchParams({provider_name:l}),r=await Te(`/api/webui/models/test-connection-by-name?${i}`,{method:"POST"});if(!r.ok){const o=await r.json().catch(()=>({}));throw new Error(o.detail||`测试连接失败 (${r.status})`)}return await r.json()}const Ww=xi("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"}}),ta=m.forwardRef(({className:l,variant:i,...r},o)=>e.jsx("div",{ref:o,role:"alert",className:H(Ww({variant:i}),l),...r}));ta.displayName="Alert";const e1=m.forwardRef(({className:l,...i},r)=>e.jsx("h5",{ref:r,className:H("mb-1 font-medium leading-none tracking-tight",l),...i}));e1.displayName="AlertTitle";const aa=m.forwardRef(({className:l,...i},r)=>e.jsx("div",{ref:r,className:H("text-sm [&_p]:leading-relaxed",l),...i}));aa.displayName="AlertDescription";function um({onRestartComplete:l,onRestartFailed:i}){const[r,o]=m.useState(0),[u,x]=m.useState("restarting"),[h,f]=m.useState(0),[g,j]=m.useState(0);m.useEffect(()=>{const y=setInterval(()=>{o(L=>L>=90?L:L+1)},200),S=setInterval(()=>{f(L=>L+1)},1e3),w=setTimeout(()=>{x("checking"),v()},3e3);return()=>{clearInterval(y),clearInterval(S),clearTimeout(w)}},[]);const v=()=>{const S=async()=>{try{if(j(L=>L+1),(await fetch("/api/webui/system/status",{method:"GET",headers:{"Content-Type":"application/json"},signal:AbortSignal.timeout(3e3)})).ok)o(100),x("success"),setTimeout(()=>{l?.()},1500);else throw new Error("Status check failed")}catch{g<60?setTimeout(S,2e3):(x("failed"),i?.())}};S()},N=y=>{const S=Math.floor(y/60),w=y%60;return`${S}:${w.toString().padStart(2,"0")}`};return e.jsx("div",{className:"fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center",children:e.jsxs("div",{className:"max-w-md w-full mx-4 space-y-8",children:[e.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[u==="restarting"&&e.jsxs(e.Fragment,{children:[e.jsx(xt,{className:"h-16 w-16 text-primary animate-spin"}),e.jsx("h2",{className:"text-2xl font-bold",children:"正在重启麦麦"}),e.jsx("p",{className:"text-muted-foreground text-center",children:"请稍候,麦麦正在重启中..."})]}),u==="checking"&&e.jsxs(e.Fragment,{children:[e.jsx(xt,{className:"h-16 w-16 text-primary animate-spin"}),e.jsx("h2",{className:"text-2xl font-bold",children:"检查服务状态"}),e.jsxs("p",{className:"text-muted-foreground text-center",children:["等待服务恢复... (尝试 ",g,"/60)"]})]}),u==="success"&&e.jsxs(e.Fragment,{children:[e.jsx(ma,{className:"h-16 w-16 text-green-500"}),e.jsx("h2",{className:"text-2xl font-bold",children:"重启成功"}),e.jsx("p",{className:"text-muted-foreground text-center",children:"正在跳转到登录页面..."})]}),u==="failed"&&e.jsxs(e.Fragment,{children:[e.jsx(Gt,{className:"h-16 w-16 text-destructive"}),e.jsx("h2",{className:"text-2xl font-bold",children:"重启超时"}),e.jsx("p",{className:"text-muted-foreground text-center",children:"服务未能在预期时间内恢复,请手动检查或刷新页面"})]})]}),u!=="failed"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(gi,{value:r,className:"h-2"}),e.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[e.jsxs("span",{children:[r,"%"]}),e.jsxs("span",{children:["已用时: ",N(h)]})]})]}),e.jsx("div",{className:"bg-muted/50 rounded-lg p-4 space-y-2",children:e.jsxs("p",{className:"text-sm text-muted-foreground",children:[u==="restarting"&&"🔄 配置已保存,正在重启主程序...",u==="checking"&&"⏳ 正在等待服务恢复,请勿关闭页面...",u==="success"&&"✅ 配置已生效,服务运行正常",u==="failed"&&"⚠️ 如果长时间无响应,请尝试手动重启"]})}),u==="failed"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>window.location.reload(),className:"flex-1 px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90",children:"刷新页面"}),e.jsx("button",{onClick:()=>{x("checking"),j(0),v()},className:"flex-1 px-4 py-2 bg-secondary text-secondary-foreground rounded-md hover:bg-secondary/90",children:"重试检测"})]})]})})}const s1={name:"toml",startState:function(){return{inString:!1,stringType:"",lhs:!0,inArray:0}},token:function(l,i){let r;if(!i.inString&&(r=l.match(/^('''|"""|'|")/))&&(i.stringType=r[0],i.inString=!0),l.sol()&&!i.inString&&i.inArray===0&&(i.lhs=!0),i.inString){for(;i.inString;)if(l.match(i.stringType))i.inString=!1;else if(l.peek()==="\\")l.next(),l.next();else{if(l.eol())break;l.match(/^.[^\\\"\']*/)}return i.lhs?"property":"string"}else{if(i.inArray&&l.peek()==="]")return l.next(),i.inArray--,"bracket";if(i.lhs&&l.peek()==="["&&l.skipTo("]"))return l.next(),l.peek()==="]"&&l.next(),"atom";if(l.peek()==="#")return l.skipToEnd(),"comment";if(l.eatSpace())return null;if(i.lhs&&l.eatWhile(function(o){return o!="="&&o!=" "}))return"property";if(i.lhs&&l.peek()==="=")return l.next(),i.lhs=!1,null;if(!i.lhs&&l.match(/^\d\d\d\d[\d\-\:\.T]*Z/))return"atom";if(!i.lhs&&(l.match("true")||l.match("false")))return"atom";if(!i.lhs&&l.peek()==="[")return i.inArray++,l.next(),"bracket";if(!i.lhs&&l.match(/^\-?\d+(?:\.\d+)?/))return"number";l.eatSpace()||l.next()}return null},languageData:{commentTokens:{line:"#"}}},t1={python:[l0()],json:[n0(),i0()],toml:[a0.define(s1)],text:[]};function a1({value:l,onChange:i,language:r="text",readOnly:o=!1,height:u="400px",minHeight:x,maxHeight:h,placeholder:f,theme:g="dark",className:j=""}){const[v,N]=m.useState(!1);if(m.useEffect(()=>{N(!0)},[]),!v)return e.jsx("div",{className:`rounded-md border bg-muted animate-pulse ${j}`,style:{height:u,minHeight:x,maxHeight:h}});const y=[...t1[r]||[],pp.lineWrapping];return o&&y.push(pp.editable.of(!1)),e.jsx("div",{className:`rounded-md overflow-hidden border ${j}`,children:e.jsx(r0,{value:l,height:u,minHeight:x,maxHeight:h,theme:g==="dark"?c0:void 0,extensions:y,onChange:i,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 l1(l,i,r,o={}){const{debounceMs:u=2e3,onSaveSuccess:x,onSaveError:h}=o,f=m.useRef(null),g=m.useCallback(async(y,S)=>{try{i(!0),await Jw(y,S),r(!1),x?.()}catch(w){console.error(`自动保存 ${y} 失败:`,w),r(!0),h?.(w instanceof Error?w:new Error(String(w)))}finally{i(!1)}},[i,r,x,h]),j=m.useCallback((y,S)=>{l||(r(!0),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{g(y,S)},u))},[l,r,g,u]),v=m.useCallback(async(y,S)=>{f.current&&(clearTimeout(f.current),f.current=null),await g(y,S)},[g]),N=m.useCallback(()=>{f.current&&(clearTimeout(f.current),f.current=null)},[]);return m.useEffect(()=>()=>{f.current&&clearTimeout(f.current)},[]),{triggerAutoSave:j,saveNow:v,cancelPendingAutoSave:N}}function $t(l,i,r,o){m.useEffect(()=>{l&&!r&&o(i,l)},[l])}const n1=500;function i1(){const[l,i]=m.useState(!0),[r,o]=m.useState(!1),[u,x]=m.useState(!1),[h,f]=m.useState(!1),[g,j]=m.useState(!1),[v,N]=m.useState(!1),[y,S]=m.useState("visual"),[w,L]=m.useState(""),[O,U]=m.useState(!1),{toast:F}=Vs(),[A,k]=m.useState(null),[$,G]=m.useState(null),[z,M]=m.useState(null),[Q,fe]=m.useState(null),[ve,ge]=m.useState(null),[be,je]=m.useState(null),[Ne,R]=m.useState(null),[Y,K]=m.useState(null),[re,T]=m.useState(null),[ie,xe]=m.useState(null),[Ce,_e]=m.useState(null),[Me,Z]=m.useState(null),[me,ke]=m.useState(null),[X,ae]=m.useState(null),[De,_s]=m.useState(null),[E,he]=m.useState(null),[Xe,ye]=m.useState(null),W=m.useRef(!0),Se=m.useRef({}),Ge=m.useCallback(we=>{Se.current=we,k(we.bot),G(we.personality);const Ss=we.chat;Ss.talk_value_rules||(Ss.talk_value_rules=[]),M(Ss),fe(we.expression),ge(we.emoji),je(we.memory),R(we.tool),K(we.voice),T(we.lpmm_knowledge),xe(we.keyword_reaction),_e(we.response_post_process),Z(we.chinese_typo),ke(we.response_splitter),ae(we.log),_s(we.debug),he(we.maim_message),ye(we.telemetry)},[]),jt=m.useCallback(()=>({...Se.current,bot:A,personality:$,chat:z,expression:Q,emoji:ve,memory:be,tool:Ne,voice:Y,lpmm_knowledge:re,keyword_reaction:ie,response_post_process:Ce,chinese_typo:Me,response_splitter:me,log:X,debug:De,maim_message:E,telemetry:Xe}),[A,$,z,Q,ve,be,Ne,Y,re,ie,Ce,Me,me,X,De,E,Xe]),Qs=m.useCallback(async()=>{try{const Ss=(await Kw()).replace(/"([^"]*)"/g,(Ee,xs)=>`"${xs.replace(/\\n/g,` +`).replace(/\\t/g," ").replace(/\\r/g,"\r").replace(/\\"/g,'"').replace(/\\\\/g,"\\")}"`);L(Ss),U(!1)}catch(we){F({variant:"destructive",title:"加载失败",description:we instanceof Error?we.message:"加载源代码失败"})}},[F]),zt=m.useCallback(async()=>{try{i(!0);const we=await Cp();Ge(we),f(!1),W.current=!1,await Qs()}catch(we){console.error("加载配置失败:",we),F({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}finally{i(!1)}},[F,Qs,Ge]);m.useEffect(()=>{zt()},[zt]);const{triggerAutoSave:Es,cancelPendingAutoSave:lt}=l1(W.current,x,f);$t(A,"bot",W.current,Es),$t($,"personality",W.current,Es),$t(z,"chat",W.current,Es),$t(Q,"expression",W.current,Es),$t(ve,"emoji",W.current,Es),$t(be,"memory",W.current,Es),$t(Ne,"tool",W.current,Es),$t(Y,"voice",W.current,Es),$t(re,"lpmm_knowledge",W.current,Es),$t(ie,"keyword_reaction",W.current,Es),$t(Ce,"response_post_process",W.current,Es),$t(Me,"chinese_typo",W.current,Es),$t(me,"response_splitter",W.current,Es),$t(X,"log",W.current,Es),$t(De,"debug",W.current,Es),$t(E,"maim_message",W.current,Es),$t(Xe,"telemetry",W.current,Es);const I=async()=>{try{o(!0);const we=w.replace(/"([^"]*)"/g,(Ss,Ee)=>`"${Ee.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r")}"`);await Xw(we),f(!1),U(!1),F({title:"保存成功",description:"配置已保存"}),await zt()}catch(we){U(!0),F({variant:"destructive",title:"保存失败",description:we instanceof Error?we.message:"保存配置失败"})}finally{o(!1)}},$e=async we=>{if(h){F({variant:"destructive",title:"切换失败",description:"请先保存当前更改"});return}if(S(we),we==="source")await Qs();else try{const Ss=await Cp();Ge(Ss),f(!1)}catch(Ss){console.error("加载配置失败:",Ss),F({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}},Oe=async()=>{try{o(!0),lt(),await kp(jt()),f(!1),F({title:"保存成功",description:"麦麦主程序配置已保存"})}catch(we){console.error("保存配置失败:",we),F({title:"保存失败",description:we.message,variant:"destructive"})}finally{o(!1)}},Ke=async()=>{try{j(!0),po().catch(()=>{}),N(!0)}catch(we){console.error("重启失败:",we),N(!1),F({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),j(!1)}},$s=async()=>{try{o(!0),lt(),await kp(jt()),f(!1),F({title:"保存成功",description:"配置已保存,即将重启麦麦..."}),await new Promise(we=>setTimeout(we,n1)),await Ke()}catch(we){console.error("保存失败:",we),F({title:"保存失败",description:we.message,variant:"destructive"})}finally{o(!1)}},Je=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},Ps=()=>{N(!1),j(!1),F({title:"重启失败",description:"服务器未能在预期时间内恢复,请手动检查",variant:"destructive"})};return l?e.jsx(Ze,{className:"h-full",children:e.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):e.jsx(Ze,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:gap-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl md:text-3xl font-bold",children:"麦麦主程序配置"}),e.jsx("p",{className:"text-muted-foreground mt-1 text-xs sm:text-sm",children:"管理麦麦的核心功能和行为设置"})]}),e.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[e.jsxs(_,{onClick:y==="visual"?Oe:I,disabled:r||u||!h||g,size:"sm",variant:"outline",className:"w-20 sm:w-24",children:[e.jsx(Tr,{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?"保存中":u?"自动":h?"保存":"已保存"})]}),e.jsxs(ms,{children:[e.jsx(mt,{asChild:!0,children:e.jsxs(_,{disabled:r||u||g,size:"sm",className:"w-20 sm:w-28",children:[e.jsx(kr,{className:"h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"ml-1 truncate text-xs sm:text-sm",children:g?"重启中":h?"保存重启":"重启"})]})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认重启麦麦?"}),e.jsx(os,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:h?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})})})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:h?$s:Ke,children:h?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsx("div",{className:"flex",children:e.jsx(ka,{value:y,onValueChange:we=>$e(we),className:"w-full",children:e.jsxs(xa,{className:"h-8 sm:h-9 w-full grid grid-cols-2",children:[e.jsxs(ts,{value:"visual",className:"text-xs sm:text-sm",children:[e.jsx(Ly,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"可视化编辑"]}),e.jsxs(ts,{value:"source",className:"text-xs sm:text-sm",children:[e.jsx(Uy,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"源代码编辑"]})]})})})]}),e.jsxs(ta,{children:[e.jsx(Ia,{className:"h-4 w-4"}),e.jsxs(aa,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),y==="source"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(ta,{children:[e.jsx(Ia,{className:"h-4 w-4"}),e.jsxs(aa,{children:[e.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。此功能仅适用于熟悉 TOML 语法的高级用户。保存时会在后端验证格式,只有格式完全正确才能保存。",O&&e.jsx("span",{className:"text-destructive font-semibold ml-2",children:"⚠️ 上次保存失败,请检查 TOML 格式"})]})]}),e.jsx(a1,{value:w,onChange:we=>{L(we),f(!0),O&&U(!1)},language:"toml",theme:"dark",height:"calc(100vh - 280px)",minHeight:"500px",placeholder:"TOML 配置内容"})]}),y==="visual"&&e.jsx(e.Fragment,{children:e.jsxs(ka,{defaultValue:"bot",className:"w-full",children:[e.jsxs(xa,{className:"flex flex-wrap h-auto gap-1 p-1 sm:grid sm:grid-cols-5 lg:grid-cols-9",children:[e.jsx(ts,{value:"bot",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"基本信息"}),e.jsx(ts,{value:"personality",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"人格"}),e.jsx(ts,{value:"chat",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"聊天"}),e.jsx(ts,{value:"expression",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"表达"}),e.jsx(ts,{value:"features",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"功能"}),e.jsx(ts,{value:"processing",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"处理"}),e.jsx(ts,{value:"voice",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"语音"}),e.jsx(ts,{value:"lpmm",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"知识库"}),e.jsx(ts,{value:"other",className:"text-xs px-2 py-1.5 sm:px-3 sm:py-2 data-[state=active]:shadow-sm",children:"其他"})]}),e.jsx(Ms,{value:"bot",className:"space-y-4",children:A&&e.jsx(zw,{config:A,onChange:k})}),e.jsx(Ms,{value:"personality",className:"space-y-4",children:$&&e.jsx(Mw,{config:$,onChange:G})}),e.jsx(Ms,{value:"chat",className:"space-y-4",children:z&&e.jsx(Lw,{config:z,onChange:M})}),e.jsx(Ms,{value:"expression",className:"space-y-4",children:Q&&e.jsx(Iw,{config:Q,onChange:fe})}),e.jsx(Ms,{value:"features",className:"space-y-4",children:ve&&be&&Ne&&e.jsx(Fw,{emojiConfig:ve,memoryConfig:be,toolConfig:Ne,onEmojiChange:ge,onMemoryChange:je,onToolChange:R})}),e.jsx(Ms,{value:"processing",className:"space-y-4",children:ie&&Ce&&Me&&me&&e.jsx(Yw,{keywordReactionConfig:ie,responsePostProcessConfig:Ce,chineseTypoConfig:Me,responseSplitterConfig:me,onKeywordReactionChange:xe,onResponsePostProcessChange:_e,onChineseTypoChange:Z,onResponseSplitterChange:ke})}),e.jsx(Ms,{value:"voice",className:"space-y-4",children:Y&&e.jsx(Uw,{config:Y,onChange:K})}),e.jsx(Ms,{value:"lpmm",className:"space-y-4",children:re&&e.jsx(Bw,{config:re,onChange:T})}),e.jsxs(Ms,{value:"other",className:"space-y-4",children:[X&&e.jsx(Hw,{config:X,onChange:ae}),De&&e.jsx($w,{config:De,onChange:_s}),E&&e.jsx(qw,{config:E,onChange:he}),Xe&&e.jsx(Gw,{config:Xe,onChange:ye})]})]})}),v&&e.jsx(um,{onRestartComplete:Je,onRestartFailed:Ps})]})})}const jn=m.forwardRef(({className:l,...i},r)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:r,className:H("w-full caption-bottom text-sm",l),...i})}));jn.displayName="Table";const vn=m.forwardRef(({className:l,...i},r)=>e.jsx("thead",{ref:r,className:H("[&_tr]:border-b",l),...i}));vn.displayName="TableHeader";const bn=m.forwardRef(({className:l,...i},r)=>e.jsx("tbody",{ref:r,className:H("[&_tr:last-child]:border-0",l),...i}));bn.displayName="TableBody";const r1=m.forwardRef(({className:l,...i},r)=>e.jsx("tfoot",{ref:r,className:H("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",l),...i}));r1.displayName="TableFooter";const pt=m.forwardRef(({className:l,...i},r)=>e.jsx("tr",{ref:r,className:H("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",l),...i}));pt.displayName="TableRow";const Pe=m.forwardRef(({className:l,...i},r)=>e.jsx("th",{ref:r,className:H("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",l),...i}));Pe.displayName="TableHead";const Ie=m.forwardRef(({className:l,...i},r)=>e.jsx("td",{ref:r,className:H("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",l),...i}));Ie.displayName="TableCell";const c1=m.forwardRef(({className:l,...i},r)=>e.jsx("caption",{ref:r,className:H("mt-4 text-sm text-muted-foreground",l),...i}));c1.displayName="TableCaption";const go=m.forwardRef(({className:l,...i},r)=>e.jsx(la,{ref:r,className:H("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",l),...i}));go.displayName=la.displayName;const jo=m.forwardRef(({className:l,...i},r)=>e.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[e.jsx(Ft,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(la.Input,{ref:r,className:H("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",l),...i})]}));jo.displayName=la.Input.displayName;const vo=m.forwardRef(({className:l,...i},r)=>e.jsx(la.List,{ref:r,className:H("max-h-[300px] overflow-y-auto overflow-x-hidden",l),...i}));vo.displayName=la.List.displayName;const bo=m.forwardRef((l,i)=>e.jsx(la.Empty,{ref:i,className:"py-6 text-center text-sm",...l}));bo.displayName=la.Empty.displayName;const yr=m.forwardRef(({className:l,...i},r)=>e.jsx(la.Group,{ref:r,className:H("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",l),...i}));yr.displayName=la.Group.displayName;const o1=m.forwardRef(({className:l,...i},r)=>e.jsx(la.Separator,{ref:r,className:H("-mx-1 h-px bg-border",l),...i}));o1.displayName=la.Separator.displayName;const wr=m.forwardRef(({className:l,...i},r)=>e.jsx(la.Item,{ref:r,className:H("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",l),...i}));wr.displayName=la.Item.displayName;const gt=m.forwardRef(({className:l,...i},r)=>e.jsx(Ng,{ref:r,className:H("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",l),...i,children:e.jsx(xy,{className:H("grid place-content-center text-current"),children:e.jsx(sa,{className:"h-4 w-4"})})}));gt.displayName=Ng.displayName;const fj=m.createContext(null),pj="maibot-completed-tours";function d1(){try{const l=localStorage.getItem(pj);return l?new Set(JSON.parse(l)):new Set}catch{return new Set}}function Tp(l){localStorage.setItem(pj,JSON.stringify([...l]))}function u1({children:l}){const[i,r]=m.useState({activeTourId:null,stepIndex:0,isRunning:!1}),o=m.useRef(new Map),[,u]=m.useState(0),[x,h]=m.useState(d1),f=m.useCallback((A,k)=>{o.current.set(A,k),u($=>$+1)},[]),g=m.useCallback(A=>{o.current.delete(A),r(k=>k.activeTourId===A?{...k,activeTourId:null,isRunning:!1,stepIndex:0}:k)},[]),j=m.useCallback((A,k=0)=>{o.current.has(A)&&r({activeTourId:A,stepIndex:k,isRunning:!0})},[]),v=m.useCallback(()=>{r(A=>({...A,isRunning:!1}))},[]),N=m.useCallback(A=>{r(k=>({...k,stepIndex:A}))},[]),y=m.useCallback(()=>{r(A=>({...A,stepIndex:A.stepIndex+1}))},[]),S=m.useCallback(()=>{r(A=>({...A,stepIndex:Math.max(0,A.stepIndex-1)}))},[]),w=m.useCallback(()=>i.activeTourId?o.current.get(i.activeTourId)||[]:[],[i.activeTourId]),L=m.useCallback(A=>{h(k=>{const $=new Set(k);return $.add(A),Tp($),$})},[]),O=m.useCallback(A=>{const{action:k,index:$,status:G,type:z}=A,M=["finished","skipped"];if(k==="close"){r(Q=>({...Q,isRunning:!1,stepIndex:0}));return}M.includes(G)?r(Q=>(G==="finished"&&Q.activeTourId&&setTimeout(()=>L(Q.activeTourId),0),{...Q,isRunning:!1,stepIndex:0})):z==="step:after"&&(k==="next"?r(Q=>({...Q,stepIndex:$+1})):k==="prev"&&r(Q=>({...Q,stepIndex:$-1})))},[L]),U=m.useCallback(A=>x.has(A),[x]),F=m.useCallback(A=>{h(k=>{const $=new Set(k);return $.delete(A),Tp($),$})},[]);return e.jsx(fj.Provider,{value:{state:i,tours:o.current,registerTour:f,unregisterTour:g,startTour:j,stopTour:v,goToStep:N,nextStep:y,prevStep:S,getCurrentSteps:w,handleJoyrideCallback:O,isTourCompleted:U,markTourCompleted:L,resetTourCompleted:F},children:l})}function mm(){const l=m.useContext(fj);if(!l)throw new Error("useTour must be used within a TourProvider");return l}const m1={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)"}},x1={back:"上一步",close:"关闭",last:"完成",next:"下一步",nextLabelWithProgress:"下一步 ({step}/{steps})",open:"打开对话框",skip:"跳过"};function h1(){const{state:l,getCurrentSteps:i,handleJoyrideCallback:r}=mm(),o=i(),[u,x]=m.useState(!1),h=m.useRef(l.stepIndex),f=m.useRef(null);m.useEffect(()=>{h.current!==l.stepIndex&&(x(!1),h.current=l.stepIndex)},[l.stepIndex]),m.useEffect(()=>{if(!l.isRunning||o.length===0){x(!1);return}const v=o[l.stepIndex];if(!v){x(!1);return}const N=v.target;if(N==="body"){x(!0);return}x(!1);const y=setTimeout(()=>{const S=()=>{const U=document.querySelector(N);if(U){const F=U.getBoundingClientRect();if(F.width>0&&F.height>0)return!0}return!1};if(S()){setTimeout(()=>x(!0),100);return}const w=setInterval(()=>{S()&&(clearInterval(w),setTimeout(()=>x(!0),100))},100),L=setTimeout(()=>{clearInterval(w),x(!0)},5e3),O=()=>{clearInterval(w),clearTimeout(L)};f.current=O},150);return()=>{clearTimeout(y),f.current&&(f.current(),f.current=null)}},[l.isRunning,l.stepIndex,o]);const g=m.useRef(null);if(m.useEffect(()=>{let v=document.getElementById("tour-portal-container");return v||(v=document.createElement("div"),v.id="tour-portal-container",v.style.cssText="position: fixed; top: 0; left: 0; z-index: 99999; pointer-events: none;",document.body.appendChild(v)),g.current=v,()=>{}},[]),!l.isRunning||o.length===0||!u)return null;const j=e.jsx(o0,{steps:o,stepIndex:l.stepIndex,run:l.isRunning,continuous:!0,showSkipButton:!0,showProgress:!0,disableOverlayClose:!0,disableScrolling:!1,disableScrollParentFix:!1,callback:r,styles:m1,locale:x1,scrollOffset:80,scrollToFirstStep:!0,floaterProps:{styles:{floater:{zIndex:99999}},disableAnimation:!0}},`tour-step-${l.stepIndex}`);return g.current?fN.createPortal(j,g.current):j}const Fa="model-assignment-tour",gj=[{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}],jj={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"},xr=[{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 Ep(l){return l?l.replace(/\/+$/,"").toLowerCase():""}function f1(l){if(!l)return null;const i=Ep(l);return xr.find(r=>r.id!=="custom"&&Ep(r.base_url)===i)||null}const Xc=l=>({...l,max_retry:l.max_retry??2,timeout:l.timeout??30,retry_interval:l.retry_interval??10}),p1=l=>{const i={};return l?(l.name?.trim()||(i.name="请输入提供商名称"),l.base_url?.trim()||(i.base_url="请输入基础 URL"),l.api_key?.trim()||(i.api_key="请输入 API Key"),{isValid:Object.keys(i).length===0,errors:i}):{isValid:!1,errors:{name:"提供商数据为空"}}};function g1(){const[l,i]=m.useState([]),[r,o]=m.useState(!0),[u,x]=m.useState(!1),[h,f]=m.useState(!1),[g,j]=m.useState(!1),[v,N]=m.useState(!1),[y,S]=m.useState(!1),[w,L]=m.useState(!1),[O,U]=m.useState(null),[F,A]=m.useState(null),[k,$]=m.useState("custom"),[G,z]=m.useState(!1),[M,Q]=m.useState(!1),[fe,ve]=m.useState(null),[ge,be]=m.useState(!1),[je,Ne]=m.useState(""),[R,Y]=m.useState(new Set),[K,re]=m.useState(!1),[T,ie]=m.useState(1),[xe,Ce]=m.useState(20),[_e,Me]=m.useState(""),[Z,me]=m.useState({isOpen:!1,providersToDelete:[],affectedModels:[],pendingProviders:[],context:"auto",oldProviders:[]}),[ke,X]=m.useState({}),[ae,De]=m.useState(new Set),[_s,E]=m.useState(new Map),{toast:he}=Vs(),Xe=Ea(),{state:ye,goToStep:W,registerTour:Se}=mm(),Ge=m.useRef(null),jt=m.useRef(!0);m.useEffect(()=>{Se(Fa,gj)},[Se]),m.useEffect(()=>{if(ye.activeTourId===Fa&&ye.isRunning){const V=jj[ye.stepIndex];V&&!window.location.pathname.endsWith(V.replace("/config/",""))&&Xe({to:V})}},[ye.stepIndex,ye.activeTourId,ye.isRunning,Xe]);const Qs=m.useRef(ye.stepIndex);m.useEffect(()=>{if(ye.activeTourId===Fa&&ye.isRunning){const V=Qs.current,pe=ye.stepIndex;V>=3&&V<=9&&pe<3&&L(!1),V>=10&&pe>=3&&pe<=9&&(X({}),$("custom"),U({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10}),A(null),be(!1),L(!0)),Qs.current=pe}},[ye.stepIndex,ye.activeTourId,ye.isRunning]),m.useEffect(()=>{if(ye.activeTourId!==Fa||!ye.isRunning)return;const V=pe=>{const ze=pe.target,zs=ye.stepIndex;zs===2&&ze.closest('[data-tour="add-provider-button"]')?setTimeout(()=>W(3),300):zs===9&&ze.closest('[data-tour="provider-cancel-button"]')&&setTimeout(()=>W(10),300)};return document.addEventListener("click",V,!0),()=>document.removeEventListener("click",V,!0)},[ye,W]),m.useEffect(()=>{zt()},[]);const zt=async()=>{try{o(!0);const V=await Il();i(V.api_providers||[]),j(!1),jt.current=!1}catch(V){console.error("加载配置失败:",V)}finally{o(!1)}},Es=async()=>{try{N(!0),po().catch(()=>{}),S(!0)}catch(V){console.error("重启失败:",V),S(!1),he({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),N(!1)}},lt=async()=>{try{x(!0),Ge.current&&clearTimeout(Ge.current);const V=l.map(it=>({...it,max_retry:it.max_retry??2,timeout:it.timeout??30,retry_interval:it.retry_interval??10})),{shouldProceed:pe}=await Oe(V,"restart");if(!pe){x(!1);return}const ze=await Il(),zs=new Set(V.map(it=>it.name)),Yt=(ze.models||[]).filter(it=>zs.has(it.api_provider));ze.api_providers=V,ze.models=Yt,await jr(ze),j(!1),he({title:"保存成功",description:"正在重启麦麦..."}),await Es()}catch(V){console.error("保存配置失败:",V),he({title:"保存失败",description:V.message,variant:"destructive"}),x(!1)}},I=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},$e=()=>{S(!1),N(!1),he({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},Oe=m.useCallback(async(V,pe="auto")=>{try{const ze=await Il(),zs=new Set(l.map(ys=>ys.name)),za=new Set(V.map(ys=>ys.name)),Yt=Array.from(zs).filter(ys=>!za.has(ys));if(Yt.length===0)return{shouldProceed:!0,providers:V};const Ct=(ze.models||[]).filter(ys=>Yt.includes(ys.api_provider));return Ct.length===0?{shouldProceed:!0,providers:V}:(me({isOpen:!0,providersToDelete:Yt,affectedModels:Ct,pendingProviders:V,context:pe,oldProviders:[...l]}),{shouldProceed:!1,providers:V})}catch(ze){return console.error("检查删除影响失败:",ze),{shouldProceed:!0,providers:V}}},[l]),Ke=async()=>{try{(Z.context==="auto"?f:x)(!0),me(ys=>({...ys,isOpen:!1}));const pe=await Il(),ze=Z.pendingProviders.map(Xc),zs=new Set(ze.map(ys=>ys.name)),Yt=(pe.models||[]).filter(ys=>zs.has(ys.api_provider)),it=new Set(Z.affectedModels.map(ys=>ys.name)),Ct=pe.model_task_config;Ct&&Object.keys(Ct).forEach(ys=>{const kt=Ct[ys];kt&&Array.isArray(kt.model_list)&&(kt.model_list=kt.model_list.filter(Nl=>!it.has(Nl)))}),pe.api_providers=ze,pe.models=Yt,pe.model_task_config=Ct,await jr(pe),i(Z.pendingProviders),j(!1),he({title:"删除成功",description:`已删除 ${Z.providersToDelete.length} 个提供商和 ${Z.affectedModels.length} 个关联模型`}),me({isOpen:!1,providersToDelete:[],affectedModels:[],pendingProviders:[],context:"auto",oldProviders:[]}),Y(new Set),Z.context==="restart"&&await Es()}catch(V){console.error("删除失败:",V),he({title:"删除失败",description:V.message,variant:"destructive"})}finally{Z.context==="auto"?f(!1):x(!1)}},$s=()=>{Z.oldProviders.length>0&&i(Z.oldProviders),me({isOpen:!1,providersToDelete:[],affectedModels:[],pendingProviders:[],context:"auto",oldProviders:[]}),j(!1)},Je=m.useCallback(async V=>{if(jt.current)return;const{shouldProceed:pe}=await Oe(V,"auto");if(!pe){j(!0);return}try{f(!0);const ze=V.map(Xc);await sm("api_providers",ze),j(!1)}catch(ze){console.error("自动保存失败:",ze),he({title:"自动保存失败",description:ze.message,variant:"destructive"}),j(!0)}finally{f(!1)}},[l,Oe]);m.useEffect(()=>{if(!jt.current)return j(!0),Ge.current&&clearTimeout(Ge.current),Ge.current=setTimeout(()=>{Je(l)},2e3),()=>{Ge.current&&clearTimeout(Ge.current)}},[l,Je]);const Ps=async()=>{try{x(!0),Ge.current&&clearTimeout(Ge.current);const V=l.map(Xc),{shouldProceed:pe}=await Oe(V,"manual");if(!pe){x(!1);return}const ze=await Il(),zs=new Set(V.map(it=>it.name)),za=ze.models||[],Yt=za.filter(it=>{const Ct=zs.has(it.api_provider);return Ct||console.warn(`模型 "${it.name}" 引用了已删除的提供商 "${it.api_provider}",将被移除`),Ct});if(za.length!==Yt.length){const it=za.length-Yt.length;he({title:"注意",description:`已自动移除 ${it} 个引用已删除提供商的模型`,variant:"default"})}console.log("发送的 providers 数据:",V),ze.api_providers=V,ze.models=Yt,console.log("完整配置数据:",ze),await jr(ze),j(!1),he({title:"保存成功",description:"模型提供商配置已保存"})}catch(V){console.error("保存配置失败:",V),he({title:"保存失败",description:V.message,variant:"destructive"})}finally{x(!1)}},we=(V,pe)=>{if(X({}),V){const ze=xr.find(zs=>zs.base_url===V.base_url&&zs.client_type===V.client_type);$(ze?.id||"custom"),U(V)}else $("custom"),U({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10});A(pe),be(!1),L(!0)},Ss=m.useCallback(V=>{$(V),z(!1);const pe=xr.find(ze=>ze.id===V);pe&&pe.id!=="custom"?U(ze=>({...ze,name:pe.name,base_url:pe.base_url,client_type:pe.client_type})):pe?.id==="custom"&&U(ze=>({...ze,name:"",base_url:"",client_type:"openai"}))},[]),Ee=m.useMemo(()=>k!=="custom",[k]),xs=m.useCallback(async()=>{if(O?.api_key)try{await navigator.clipboard.writeText(O.api_key),he({title:"复制成功",description:"API Key 已复制到剪贴板"})}catch{he({title:"复制失败",description:"无法访问剪贴板",variant:"destructive"})}},[O?.api_key,he]),bs=()=>{if(!O)return;const{isValid:V,errors:pe}=p1(O);if(!V){X(pe);return}X({});const ze=Xc(O);if(F!==null){const zs=[...l];zs[F]=ze,i(zs)}else i([...l,ze]);L(!1),U(null),A(null)},Mt=V=>{if(!V&&O){const pe={...O,max_retry:O.max_retry??2,timeout:O.timeout??30,retry_interval:O.retry_interval??10};U(pe)}L(V)},Ys=V=>{ve(V),Q(!0)},vt=async()=>{if(fe!==null){const V=l.filter((ze,zs)=>zs!==fe),{shouldProceed:pe}=await Oe(V,"manual");pe&&(i(V),he({title:"删除成功",description:"提供商已从列表中移除"}))}Q(!1),ve(null)},Ks=V=>{const pe=new Set(R);pe.has(V)?pe.delete(V):pe.add(V),Y(pe)},nt=()=>{if(R.size===bt.length)Y(new Set);else{const V=bt.map((pe,ze)=>l.findIndex(zs=>zs===bt[ze]));Y(new Set(V))}},bl=()=>{if(R.size===0){he({title:"提示",description:"请先选择要删除的提供商",variant:"default"});return}re(!0)},ha=async()=>{const V=l.filter((ze,zs)=>!R.has(zs)),{shouldProceed:pe}=await Oe(V,"manual");pe&&(i(V),Y(new Set),he({title:"批量删除成功",description:`已删除 ${R.size} 个提供商`})),re(!1)},bt=m.useMemo(()=>{if(!je)return l;const V=je.toLowerCase();return l.filter(pe=>pe.name.toLowerCase().includes(V)||pe.base_url.toLowerCase().includes(V)||pe.client_type.toLowerCase().includes(V))},[l,je]),{totalPages:Vt,paginatedProviders:te}=m.useMemo(()=>{const V=Math.ceil(bt.length/xe),pe=bt.slice((T-1)*xe,T*xe);return{totalPages:V,paginatedProviders:pe}},[bt,T,xe]),de=m.useCallback(()=>{const V=parseInt(_e);V>=1&&V<=Vt&&(ie(V),Me(""))},[_e,Vt]),Ns=async V=>{De(pe=>new Set(pe).add(V));try{const pe=await Zw(V);E(ze=>new Map(ze).set(V,pe)),pe.network_ok?pe.api_key_valid===!0?he({title:"连接正常",description:`${V} 网络连接正常,API Key 有效 (${pe.latency_ms}ms)`}):pe.api_key_valid===!1?he({title:"连接正常但 Key 无效",description:`${V} 网络连接正常,但 API Key 无效或已过期`,variant:"destructive"}):he({title:"网络连接正常",description:`${V} 可以访问 (${pe.latency_ms}ms)`}):he({title:"连接失败",description:pe.error||"无法连接到提供商",variant:"destructive"})}catch(pe){he({title:"测试失败",description:pe.message,variant:"destructive"})}finally{De(pe=>{const ze=new Set(pe);return ze.delete(V),ze})}},At=async()=>{for(const V of l)await Ns(V.name)},Ot=V=>{const pe=ae.has(V),ze=_s.get(V);return pe?e.jsxs(Qe,{variant:"secondary",className:"gap-1",children:[e.jsx(xt,{className:"h-3 w-3 animate-spin"}),"测试中"]}):ze?ze.network_ok?ze.api_key_valid===!0?e.jsxs(Qe,{className:"gap-1 bg-green-600 hover:bg-green-700",children:[e.jsx(ma,{className:"h-3 w-3"}),"正常"]}):ze.api_key_valid===!1?e.jsxs(Qe,{variant:"destructive",className:"gap-1",children:[e.jsx(Gt,{className:"h-3 w-3"}),"Key无效"]}):e.jsxs(Qe,{className:"gap-1 bg-blue-600 hover:bg-blue-700",children:[e.jsx(ma,{className:"h-3 w-3"}),"可访问"]}):e.jsxs(Qe,{variant:"destructive",className:"gap-1",children:[e.jsx(zg,{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:[R.size>0&&e.jsxs(_,{onClick:bl,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(We,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",R.size,")"]}),e.jsxs(_,{onClick:At,size:"sm",variant:"outline",className:"w-full sm:w-auto",disabled:l.length===0||ae.size>0,children:[e.jsx(fn,{className:"mr-2 h-4 w-4"}),ae.size>0?`测试中 (${ae.size})`:"测试全部"]}),e.jsxs(_,{onClick:()=>we(null,null),size:"sm",className:"w-full sm:w-auto","data-tour":"add-provider-button",children:[e.jsx(ut,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加提供商"]}),e.jsxs(_,{onClick:Ps,disabled:u||h||!g||v,size:"sm",variant:"outline",className:"w-full sm:w-auto sm:min-w-[120px]",children:[e.jsx(Tr,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),u?"保存中...":h?"自动保存中...":g?"保存配置":"已保存"]}),e.jsxs(ms,{children:[e.jsx(mt,{asChild:!0,children:e.jsxs(_,{disabled:u||h||v,size:"sm",className:"w-full sm:w-auto sm:min-w-[120px]",children:[e.jsx(kr,{className:"mr-2 h-4 w-4"}),v?"重启中...":g?"保存并重启":"重启麦麦"]})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认重启麦麦?"}),e.jsx(os,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:g?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})})})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:g?lt:Es,children:g?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsxs(ta,{children:[e.jsx(Ia,{className:"h-4 w-4"}),e.jsxs(aa,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),e.jsxs(Ze,{className:"h-[calc(100vh-260px)]",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 mb-4",children:[e.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[e.jsx(Ft,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ne,{placeholder:"搜索提供商名称、URL 或类型...",value:je,onChange:V=>Ne(V.target.value),className:"pl-9"})]}),je&&e.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",bt.length," 个结果"]})]}),e.jsx("div",{className:"md:hidden space-y-3",children:bt.length===0?e.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:je?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'}):te.map((V,pe)=>{const ze=l.findIndex(zs=>zs===V);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:V.name}),Ot(V.name)]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:V.base_url})]}),e.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>Ns(V.name),disabled:ae.has(V.name),title:"测试连接",children:ae.has(V.name)?e.jsx(xt,{className:"h-4 w-4 animate-spin"}):e.jsx(fn,{className:"h-4 w-4"})}),e.jsx(_,{variant:"default",size:"sm",onClick:()=>we(V,ze),children:e.jsx(pn,{className:"h-4 w-4",strokeWidth:2,fill:"none"})}),e.jsx(_,{size:"sm",onClick:()=>Ys(ze),className:"bg-red-600 hover:bg-red-700 text-white",children:e.jsx(We,{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:V.client_type})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"最大重试"}),e.jsx("p",{className:"font-medium",children:V.max_retry})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"超时(秒)"}),e.jsx("p",{className:"font-medium",children:V.timeout})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"重试间隔(秒)"}),e.jsx("p",{className:"font-medium",children:V.retry_interval})]})]})]},pe)})}),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(jn,{children:[e.jsx(vn,{children:e.jsxs(pt,{children:[e.jsx(Pe,{className:"w-12",children:e.jsx(gt,{checked:R.size===bt.length&&bt.length>0,onCheckedChange:nt})}),e.jsx(Pe,{children:"状态"}),e.jsx(Pe,{children:"名称"}),e.jsx(Pe,{children:"基础URL"}),e.jsx(Pe,{children:"客户端类型"}),e.jsx(Pe,{className:"text-right",children:"最大重试"}),e.jsx(Pe,{className:"text-right",children:"超时(秒)"}),e.jsx(Pe,{className:"text-right",children:"重试间隔(秒)"}),e.jsx(Pe,{className:"text-right",children:"操作"})]})}),e.jsx(bn,{children:te.length===0?e.jsx(pt,{children:e.jsx(Ie,{colSpan:9,className:"text-center text-muted-foreground py-8",children:je?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'})}):te.map((V,pe)=>{const ze=l.findIndex(zs=>zs===V);return e.jsxs(pt,{children:[e.jsx(Ie,{children:e.jsx(gt,{checked:R.has(ze),onCheckedChange:()=>Ks(ze)})}),e.jsx(Ie,{children:Ot(V.name)||e.jsx(Qe,{variant:"outline",className:"text-muted-foreground",children:"未测试"})}),e.jsx(Ie,{className:"font-medium",children:V.name}),e.jsx(Ie,{className:"max-w-xs truncate",title:V.base_url,children:V.base_url}),e.jsx(Ie,{children:V.client_type}),e.jsx(Ie,{className:"text-right",children:V.max_retry}),e.jsx(Ie,{className:"text-right",children:V.timeout}),e.jsx(Ie,{className:"text-right",children:V.retry_interval}),e.jsx(Ie,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>Ns(V.name),disabled:ae.has(V.name),title:"测试连接",children:ae.has(V.name)?e.jsx(xt,{className:"h-4 w-4 animate-spin"}):e.jsx(fn,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"default",size:"sm",onClick:()=>we(V,ze),children:[e.jsx(pn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(_,{size:"sm",onClick:()=>Ys(ze),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(We,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},pe)})})]})})}),bt.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(C,{htmlFor:"page-size-provider",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Be,{value:xe.toString(),onValueChange:V=>{Ce(parseInt(V)),ie(1),Y(new Set)},children:[e.jsx(Le,{id:"page-size-provider",className:"w-20",children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"10",children:"10"}),e.jsx(se,{value:"20",children:"20"}),e.jsx(se,{value:"50",children:"50"}),e.jsx(se,{value:"100",children:"100"})]})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(T-1)*xe+1," 到"," ",Math.min(T*xe,bt.length)," 条,共 ",bt.length," 条"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>ie(1),disabled:T===1,className:"hidden sm:flex",children:e.jsx(fi,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>ie(V=>Math.max(1,V-1)),disabled:T===1,children:[e.jsx(jl,{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:_e,onChange:V=>Me(V.target.value),onKeyDown:V=>V.key==="Enter"&&de(),placeholder:T.toString(),className:"w-16 h-8 text-center",min:1,max:Vt}),e.jsx(_,{variant:"outline",size:"sm",onClick:de,disabled:!_e,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>ie(V=>V+1),disabled:T>=Vt,children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Xa,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>ie(Vt),disabled:T>=Vt,className:"hidden sm:flex",children:e.jsx(pi,{className:"h-4 w-4"})})]})]})]}),e.jsx(Gs,{open:w,onOpenChange:Mt,children:e.jsxs(Us,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto","data-tour":"provider-dialog",preventOutsideClose:ye.isRunning,children:[e.jsxs(Bs,{children:[e.jsx(Hs,{children:F!==null?"编辑提供商":"添加提供商"}),e.jsx(Ws,{children:"配置 API 提供商的连接信息和参数"})]}),e.jsxs("form",{onSubmit:V=>{V.preventDefault(),bs()},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(C,{htmlFor:"template",children:"提供商模板"}),e.jsxs(Ya,{open:G,onOpenChange:z,children:[e.jsx(Ka,{asChild:!0,children:e.jsxs(_,{variant:"outline",role:"combobox","aria-expanded":G,className:"w-full justify-between",children:[k?xr.find(V=>V.id===k)?.display_name:"选择提供商模板...",e.jsx(im,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(Ba,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:e.jsxs(go,{children:[e.jsx(jo,{placeholder:"搜索提供商模板..."}),e.jsx(Ze,{className:"h-[300px]",children:e.jsxs(vo,{className:"max-h-none overflow-visible",children:[e.jsx(bo,{children:"未找到匹配的模板"}),e.jsx(yr,{children:xr.map(V=>e.jsxs(wr,{value:V.display_name,onSelect:()=>Ss(V.id),children:[e.jsx(sa,{className:`mr-2 h-4 w-4 ${k===V.id?"opacity-100":"opacity-0"}`}),V.display_name]},V.id))})]})})]})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"选择预设模板可自动填充 URL 和客户端类型,支持搜索"})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-name-input",children:[e.jsx(C,{htmlFor:"name",className:ke.name?"text-destructive":"",children:"名称 *"}),e.jsx(ne,{id:"name",value:O?.name||"",onChange:V=>{U(pe=>pe?{...pe,name:V.target.value}:null),ke.name&&X(pe=>({...pe,name:void 0}))},placeholder:"例如: DeepSeek, SiliconFlow",className:ke.name?"border-destructive focus-visible:ring-destructive":""}),ke.name&&e.jsx("p",{className:"text-xs text-destructive",children:ke.name})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-url-input",children:[e.jsx(C,{htmlFor:"base_url",className:ke.base_url?"text-destructive":"",children:"基础 URL *"}),e.jsx(ne,{id:"base_url",value:O?.base_url||"",onChange:V=>{U(pe=>pe?{...pe,base_url:V.target.value}:null),ke.base_url&&X(pe=>({...pe,base_url:void 0}))},placeholder:"https://api.example.com/v1",disabled:Ee,className:`${Ee?"bg-muted cursor-not-allowed":""} ${ke.base_url?"border-destructive focus-visible:ring-destructive":""}`}),ke.base_url&&e.jsx("p",{className:"text-xs text-destructive",children:ke.base_url}),Ee&&!ke.base_url&&e.jsx("p",{className:"text-xs text-muted-foreground",children:'使用模板时 URL 不可编辑,切换到"自定义"以手动配置'})]}),e.jsxs("div",{className:"grid gap-2","data-tour":"provider-apikey-input",children:[e.jsx(C,{htmlFor:"api_key",className:ke.api_key?"text-destructive":"",children:"API Key *"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{id:"api_key",type:ge?"text":"password",value:O?.api_key||"",onChange:V=>{U(pe=>pe?{...pe,api_key:V.target.value}:null),ke.api_key&&X(pe=>({...pe,api_key:void 0}))},placeholder:"sk-...",className:`flex-1 ${ke.api_key?"border-destructive focus-visible:ring-destructive":""}`}),e.jsx(_,{type:"button",variant:"outline",size:"icon",onClick:()=>be(!ge),title:ge?"隐藏密钥":"显示密钥",children:ge?e.jsx(vr,{className:"h-4 w-4"}):e.jsx(Qt,{className:"h-4 w-4"})}),e.jsx(_,{type:"button",variant:"outline",size:"icon",onClick:xs,title:"复制密钥",children:e.jsx(no,{className:"h-4 w-4"})})]}),ke.api_key&&e.jsx("p",{className:"text-xs text-destructive",children:ke.api_key})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"client_type",children:"客户端类型"}),e.jsxs(Be,{value:O?.client_type||"openai",onValueChange:V=>U(pe=>pe?{...pe,client_type:V}:null),disabled:Ee,children:[e.jsx(Le,{id:"client_type",className:Ee?"bg-muted cursor-not-allowed":"",children:e.jsx(He,{placeholder:"选择客户端类型"})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"openai",children:"OpenAI"}),e.jsx(se,{value:"gemini",children:"Gemini"})]})]}),Ee&&e.jsx("p",{className:"text-xs text-muted-foreground",children:'使用模板时客户端类型不可编辑,切换到"自定义"以手动配置'})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"max_retry",children:"最大重试"}),e.jsx(ne,{id:"max_retry",type:"number",min:"0",value:O?.max_retry??"",onChange:V=>{const pe=V.target.value===""?null:parseInt(V.target.value);U(ze=>ze?{...ze,max_retry:pe}:null)},placeholder:"默认: 2"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"timeout",children:"超时(秒)"}),e.jsx(ne,{id:"timeout",type:"number",min:"1",value:O?.timeout??"",onChange:V=>{const pe=V.target.value===""?null:parseInt(V.target.value);U(ze=>ze?{...ze,timeout:pe}:null)},placeholder:"默认: 30"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"retry_interval",children:"重试间隔(秒)"}),e.jsx(ne,{id:"retry_interval",type:"number",min:"1",value:O?.retry_interval??"",onChange:V=>{const pe=V.target.value===""?null:parseInt(V.target.value);U(ze=>ze?{...ze,retry_interval:pe}:null)},placeholder:"默认: 10"})]})]})]}),e.jsxs(tt,{children:[e.jsx(_,{type:"button",variant:"outline",onClick:()=>L(!1),"data-tour":"provider-cancel-button",children:"取消"}),e.jsx(_,{type:"submit","data-tour":"provider-save-button",children:"保存"})]})]})]})}),e.jsx(ms,{open:M,onOpenChange:Q,children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:['确定要删除提供商 "',fe!==null?l[fe]?.name:"",'" 吗? 此操作无法撤销。']})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:vt,children:"删除"})]})]})}),e.jsx(ms,{open:K,onOpenChange:re,children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认批量删除"}),e.jsxs(os,{children:["确定要删除选中的 ",R.size," 个提供商吗? 此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:ha,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),e.jsx(ms,{open:Z.isOpen,onOpenChange:V=>me(pe=>({...pe,isOpen:V})),children:e.jsxs(ns,{className:"max-w-2xl",children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除提供商"}),e.jsx(os,{asChild:!0,children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:["您即将删除以下提供商:",e.jsx("strong",{className:"text-foreground ml-1",children:Z.providersToDelete.join(", ")})]}),e.jsxs("p",{className:"text-yellow-600 dark:text-yellow-500 font-medium",children:["⚠️ 此操作将同时删除 ",Z.affectedModels.length," 个关联的模型:"]}),e.jsx(Ze,{className:"h-32 w-full rounded border p-3",children:e.jsx("div",{className:"space-y-1",children:Z.affectedModels.map((V,pe)=>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:V.name}),e.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(",V.model_identifier,")"]})]},pe))})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"这些模型将从模型列表和所有任务分配中移除。此操作无法撤销。"})]})})]}),e.jsxs(rs,{children:[e.jsx(us,{onClick:$s,children:"取消"}),e.jsx(ds,{onClick:Ke,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})}),y&&e.jsx(um,{onRestartComplete:I,onRestartFailed:$e})]})}function vj(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).substring(2,11)}`}function bj(l){return typeof l=="boolean"?"boolean":typeof l=="number"?"number":"string"}function j1(l,i){switch(i){case"boolean":return l==="true";case"number":{const r=parseFloat(l);return isNaN(r)?0:r}default:return l}}function Gu(l){return Object.entries(l).map(([i,r])=>({id:vj(),key:i,value:r,type:bj(r)}))}function Fu(l){const i={};for(const r of l)r.key.trim()&&(i[r.key.trim()]=r.value);return i}function Vu(l){if(!l.trim())return{valid:!0,parsed:{}};try{const i=JSON.parse(l);if(typeof i!="object"||i===null||Array.isArray(i))return{valid:!1,error:"必须是一个 JSON 对象 {}"};for(const[r,o]of Object.entries(i))if(o!==null&&!["string","number","boolean"].includes(typeof o))return{valid:!1,error:`键 "${r}" 的值类型不支持(仅支持 string/number/boolean)`};return{valid:!0,parsed:i}}catch{return{valid:!1,error:"JSON 格式错误"}}}function v1(l){switch(l){case"boolean":return"布尔";case"number":return"数字";default:return"字符串"}}function b1(l){switch(l){case"boolean":return"bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-400";case"number":return"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400";default:return"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400"}}function N1({value:l,onChange:i,className:r,placeholder:o="添加额外参数..."}){const[u,x]=m.useState("list"),[h,f]=m.useState(()=>Gu(l||{})),[g,j]=m.useState(()=>Object.keys(l||{}).length>0?JSON.stringify(l,null,2):""),[v,N]=m.useState(null);m.useEffect(()=>{const F=Gu(l||{});f(F),j(Object.keys(l||{}).length>0?JSON.stringify(l,null,2):"")},[l]);const y=m.useMemo(()=>{const F=Vu(g);return F.valid&&F.parsed?{success:!0,data:F.parsed}:{success:!1,data:{}}},[g]),S=m.useCallback(F=>{const A=F;if(A==="json"&&u==="list"){const k=Fu(h);j(Object.keys(k).length>0?JSON.stringify(k,null,2):""),N(null)}else if(A==="list"&&u==="json"){const k=Vu(g);k.valid&&k.parsed&&(f(Gu(k.parsed)),N(null))}x(A)},[u,h,g]),w=m.useCallback(()=>{const F={id:vj(),key:"",value:"",type:"string"},A=[...h,F];f(A)},[h]),L=m.useCallback(F=>{const A=h.filter(k=>k.id!==F);f(A),i(Fu(A))},[h,i]),O=m.useCallback((F,A,k)=>{const $=h.map(G=>{if(G.id!==F)return G;if(A==="type"){const z=k;let M;return z==="boolean"?M=G.value==="true"||G.value===!0:z==="number"?M=typeof G.value=="number"?G.value:parseFloat(String(G.value))||0:M=String(G.value),{...G,type:z,value:M}}else return A==="value"?{...G,value:j1(k,G.type)}:{...G,[A]:k}});f($),i(Fu($))},[h,i]),U=m.useCallback(F=>{j(F);const A=Vu(F);A.valid&&A.parsed?(N(null),i(A.parsed)):N(A.error||"JSON 格式错误")},[i]);return e.jsxs("div",{className:H("space-y-3",r),children:[e.jsx(C,{className:"text-sm font-medium",children:"额外参数"}),e.jsxs(ka,{value:u,onValueChange:S,className:"w-full",children:[e.jsxs(xa,{className:"h-8 p-0.5 bg-muted/60",children:[e.jsx(ts,{value:"list",className:"h-7 px-3 text-xs data-[state=active]:bg-background data-[state=active]:shadow-sm",children:"键值对"}),e.jsx(ts,{value:"json",className:"h-7 px-3 text-xs data-[state=active]:bg-background data-[state=active]:shadow-sm",children:"JSON"})]}),e.jsxs(Ms,{value:"list",className:"mt-3 space-y-2",children:[h.length===0?e.jsx("div",{className:"text-sm text-muted-foreground text-center py-4 border border-dashed rounded-md",children:o}):e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"grid grid-cols-[1fr_1fr_90px_32px] gap-2 text-xs text-muted-foreground px-1",children:[e.jsx("span",{children:"键名"}),e.jsx("span",{children:"值"}),e.jsx("span",{children:"类型"}),e.jsx("span",{})]}),h.map(F=>e.jsxs("div",{className:"grid grid-cols-[1fr_1fr_90px_32px] gap-2 items-center",children:[e.jsx(ne,{value:F.key,onChange:A=>O(F.id,"key",A.target.value),placeholder:"key",className:"h-8 text-sm"}),F.type==="boolean"?e.jsxs("div",{className:"flex items-center h-8 px-3 border rounded-md bg-background",children:[e.jsx(Ve,{checked:F.value===!0,onCheckedChange:A=>O(F.id,"value",String(A))}),e.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:F.value?"true":"false"})]}):e.jsx(ne,{type:F.type==="number"?"number":"text",value:F.value,onChange:A=>O(F.id,"value",A.target.value),placeholder:"value",className:"h-8 text-sm",step:F.type==="number"?"any":void 0}),e.jsxs(Be,{value:F.type,onValueChange:A=>O(F.id,"type",A),children:[e.jsx(Le,{className:"h-8 text-xs",children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"string",children:"字符串"}),e.jsx(se,{value:"number",children:"数字"}),e.jsx(se,{value:"boolean",children:"布尔"})]})]}),e.jsx(_,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",onClick:()=>L(F.id),children:e.jsx(We,{className:"h-4 w-4"})})]},F.id))]}),e.jsxs(_,{type:"button",variant:"outline",size:"sm",className:"w-full h-8",onClick:w,children:[e.jsx(ut,{className:"h-4 w-4 mr-1"}),"添加参数"]})]}),e.jsx(Ms,{value:"json",className:"mt-3",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"编辑"}),v?e.jsxs("div",{className:"flex items-center gap-1 text-xs text-destructive",children:[e.jsx(Gt,{className:"h-3 w-3"}),e.jsx("span",{className:"truncate max-w-[150px]",children:v})]}):g.trim()&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600 dark:text-green-400",children:[e.jsx(sa,{className:"h-3 w-3"}),e.jsx("span",{children:"有效"})]})]}),e.jsx(Is,{value:g,onChange:F=>U(F.target.value),placeholder:`{ "key": "value" -}`,className:H("font-mono text-sm min-h-[140px] h-[140px] resize-y flex-1",j&&"border-destructive focus-visible:ring-destructive")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"支持 string、number、boolean 类型"})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"预览"}),e.jsx("div",{className:"min-h-[140px] h-[140px] flex-1 rounded-md border bg-muted/30 p-3 overflow-auto",children:y.success&&Object.keys(y.data).length>0?e.jsx("div",{className:"space-y-2",children:Object.entries(y.data).map(([G,L])=>{const T=oj(L);return e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("code",{className:"px-1.5 py-0.5 bg-background rounded text-xs font-medium",children:G}),e.jsx("span",{className:"text-muted-foreground",children:"="}),e.jsx("span",{className:H("font-mono",T==="boolean"&&(L?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"),T==="number"&&"text-blue-600 dark:text-blue-400",T==="string"&&"text-amber-600 dark:text-amber-400"),children:T==="string"?`"${L}"`:String(L)}),e.jsx(Qe,{variant:"secondary",className:H("h-5 text-[10px] px-1.5",v1(T)),children:j1(T)})]},G)})}):y.success?e.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"暂无参数"}):e.jsx("div",{className:"flex items-center justify-center h-full text-sm text-destructive",children:"JSON 格式错误"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"实时预览解析结果"})]})]})})]})]})}function N1({value:l,label:i,onRemove:r}){const{attributes:o,listeners:u,setNodeRef:x,transform:h,transition:p,isDragging:g}=d0({id:l}),v={transform:u0.Transform.toString(h),transition:p,opacity:g?.5:1},j=y=>{y.preventDefault(),y.stopPropagation(),r(l)},N=y=>{y.stopPropagation()};return e.jsx("div",{ref:x,style:v,className:H("inline-flex items-center gap-1",g&&"shadow-lg"),children:e.jsxs(Qe,{variant:"secondary",className:"cursor-move hover:bg-secondary/80 flex items-center gap-1",children:[e.jsx("div",{...o,...u,className:"cursor-grab active:cursor-grabbing flex items-center",children:e.jsx(ky,{className:"h-3 w-3 text-muted-foreground"})}),e.jsx("span",{children:i}),e.jsx("button",{type:"button",className:"ml-1 rounded-sm hover:bg-destructive/20 focus:outline-none focus:ring-1 focus:ring-destructive",onClick:j,onPointerDown:N,onMouseDown:y=>y.stopPropagation(),children:e.jsx(gl,{className:"h-3 w-3 cursor-pointer hover:text-destructive",strokeWidth:2,fill:"none"})})]})})}function y1({options:l,selected:i,onChange:r,placeholder:o="选择选项...",emptyText:u="未找到选项",className:x}){const[h,p]=m.useState(!1),g=s0(pp(o0,{activationConstraint:{distance:8}}),pp(c0,{coordinateGetter:r0})),v=y=>{i.includes(y)?r(i.filter(S=>S!==y)):r([...i,y])},j=y=>{r(i.filter(S=>S!==y))},N=y=>{const{active:S,over:w}=y;if(w&&S.id!==w.id){const R=i.indexOf(S.id),O=i.indexOf(w.id);r(i0(i,R,O))}};return e.jsxs(Ya,{open:h,onOpenChange:p,children:[e.jsx(Ka,{asChild:!0,children:e.jsxs(_,{variant:"outline",role:"combobox","aria-expanded":h,className:H("w-full justify-between min-h-10 h-auto",x),children:[e.jsx(t0,{sensors:g,collisionDetection:a0,onDragEnd:N,children:e.jsx(l0,{items:i,strategy:n0,children:e.jsx("div",{className:"flex gap-1 flex-wrap flex-1",children:i.length===0?e.jsx("span",{className:"text-muted-foreground",children:o}):i.map(y=>{const S=l.find(w=>w.value===y);return e.jsx(N1,{value:y,label:S?.label||y,onRemove:j},y)})})})}),e.jsx(nm,{className:"ml-2 h-4 w-4 shrink-0 opacity-50",strokeWidth:2,fill:"none"})]})}),e.jsx(Ba,{className:"w-full p-0",align:"start",children:e.jsxs(po,{children:[e.jsx(go,{placeholder:"搜索...",className:"h-9"}),e.jsxs(jo,{children:[e.jsx(vo,{children:u}),e.jsx(yr,{children:l.map(y=>{const S=i.includes(y.value);return e.jsxs(wr,{value:y.value,onSelect:()=>v(y.value),children:[e.jsx("div",{className:H("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",S?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(sa,{className:"h-3 w-3",strokeWidth:2,fill:"none"})}),e.jsx("span",{children:y.label})]},y.value)})})]})]})})]})}const Da=Et.memo(function({title:i,description:r,taskConfig:o,modelNames:u,onChange:x,hideTemperature:h=!1,hideMaxTokens:p=!1,dataTour:g}){const v=j=>{x("model_list",j)};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:i}),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":g,children:[e.jsx(C,{children:"模型列表"}),e.jsx(y1,{options:u.map(j=>({label:j,value:j})),selected:o.model_list||[],onChange:v,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(C,{children:"温度"}),e.jsx(ie,{type:"number",step:"0.1",min:"0",max:"1",value:o.temperature??.3,onChange:j=>{const N=parseFloat(j.target.value);!isNaN(N)&&N>=0&&N<=1&&x("temperature",N)},className:"w-20 h-8 text-sm"})]}),e.jsx(Ca,{value:[o.temperature??.3],onValueChange:j=>x("temperature",j[0]),min:0,max:1,step:.1,className:"w-full"})]}),!p&&e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"最大 Token"}),e.jsx(ie,{type:"number",step:"1",min:"1",value:o.max_tokens??1024,onChange:j=>x("max_tokens",parseInt(j.target.value))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{children:"慢请求阈值 (秒)"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"超时警告"})]}),e.jsx(ie,{type:"number",step:"1",min:"1",value:o.slow_threshold??15,onChange:j=>{const N=parseInt(j.target.value);!isNaN(N)&&N>=1&&x("slow_threshold",N)},placeholder:"15"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"模型响应时间超过此阈值将输出警告日志"})]})]})]})}),w1=Et.memo(function({paginatedModels:i,allModels:r,onEdit:o,onDelete:u,isModelUsed:x,searchQuery:h}){return i.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:i.map((p,g)=>{const v=r.findIndex(N=>N===p),j=x(p.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:p.name}),e.jsx(Qe,{variant:j?"default":"secondary",className:j?"bg-green-600 hover:bg-green-700":"",children:j?"已使用":"未使用"})]}),e.jsx("p",{className:"text-xs text-muted-foreground break-all",title:p.model_identifier,children:p.model_identifier})]}),e.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>o(p,v),children:[e.jsx(pn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(_,{size:"sm",onClick:()=>u(v),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(es,{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:p.api_provider})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"模型温度"}),e.jsx("p",{className:"font-medium",children:p.temperature!=null?p.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:["¥",p.price_in,"/M"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:"输出价格"}),e.jsxs("p",{className:"font-medium",children:["¥",p.price_out,"/M"]})]})]})]},g)})})}),_1=Et.memo(function({paginatedModels:i,allModels:r,filteredModels:o,selectedModels:u,onEdit:x,onDelete:h,onToggleSelection:p,onToggleSelectAll:g,isModelUsed:v,searchQuery:j}){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(jn,{children:[e.jsx(vn,{children:e.jsxs(pt,{children:[e.jsx(Pe,{className:"w-12",children:e.jsx(gt,{checked:u.size===o.length&&o.length>0,onCheckedChange:g})}),e.jsx(Pe,{className:"w-24",children:"使用状态"}),e.jsx(Pe,{children:"模型名称"}),e.jsx(Pe,{children:"模型标识符"}),e.jsx(Pe,{children:"提供商"}),e.jsx(Pe,{className:"text-center",children:"温度"}),e.jsx(Pe,{className:"text-right",children:"输入价格"}),e.jsx(Pe,{className:"text-right",children:"输出价格"}),e.jsx(Pe,{className:"text-right",children:"操作"})]})}),e.jsx(bn,{children:i.length===0?e.jsx(pt,{children:e.jsx(Ie,{colSpan:9,className:"text-center text-muted-foreground py-8",children:j?"未找到匹配的模型":"暂无模型配置"})}):i.map((N,y)=>{const S=r.findIndex(R=>R===N),w=v(N.name);return e.jsxs(pt,{children:[e.jsx(Ie,{children:e.jsx(gt,{checked:u.has(S),onCheckedChange:()=>p(S)})}),e.jsx(Ie,{children:e.jsx(Qe,{variant:w?"default":"secondary",className:w?"bg-green-600 hover:bg-green-700":"",children:w?"已使用":"未使用"})}),e.jsx(Ie,{className:"font-medium",children:N.name}),e.jsx(Ie,{className:"max-w-xs truncate",title:N.model_identifier,children:N.model_identifier}),e.jsx(Ie,{children:N.api_provider}),e.jsx(Ie,{className:"text-center",children:N.temperature!=null?N.temperature:e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsxs(Ie,{className:"text-right",children:["¥",N.price_in,"/M"]}),e.jsxs(Ie,{className:"text-right",children:["¥",N.price_out,"/M"]}),e.jsx(Ie,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>x(N,S),children:[e.jsx(pn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(_,{size:"sm",onClick:()=>h(S),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(es,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},y)})})]})})})}),S1=300*1e3,zp=new Map,C1=[10,20,50,100],k1=Et.memo(function({page:i,pageSize:r,totalItems:o,jumpToPage:u,onPageChange:x,onPageSizeChange:h,onJumpToPageChange:p,onJumpToPage:g,onSelectionClear:v}){const j=Math.ceil(o/r),N=S=>{h(parseInt(S)),x(1),v?.()},y=S=>{S.key==="Enter"&&g()};return o===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(C,{htmlFor:"page-size-model",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Be,{value:r.toString(),onValueChange:N,children:[e.jsx(Le,{id:"page-size-model",className:"w-20",children:e.jsx(He,{})}),e.jsx(Ue,{children:C1.map(S=>e.jsx(se,{value:S.toString(),children:S},S))})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(i-1)*r+1," 到"," ",Math.min(i*r,o)," 条,共 ",o," 条"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>x(1),disabled:i===1,className:"hidden sm:flex",children:e.jsx(fi,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>x(Math.max(1,i-1)),disabled:i===1,children:[e.jsx(jl,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ie,{type:"number",value:u,onChange:S=>p(S.target.value),onKeyDown:y,placeholder:i.toString(),className:"w-16 h-8 text-center",min:1,max:j}),e.jsx(_,{variant:"outline",size:"sm",onClick:g,disabled:!u,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>x(i+1),disabled:i>=j,children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Xa,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>x(j),disabled:i>=j,className:"hidden sm:flex",children:e.jsx(pi,{className:"h-4 w-4"})})]})]})});function T1(l){const{models:i,taskConfig:r,debounceMs:o=2e3,onSavingChange:u,onUnsavedChange:x}=l,h=m.useRef(null),p=m.useRef(null),g=m.useRef(!0),v=m.useCallback(()=>{h.current&&(clearTimeout(h.current),h.current=null),p.current&&(clearTimeout(p.current),p.current=null)},[]),j=m.useCallback(S=>{const w={model_identifier:S.model_identifier,name:S.name,api_provider:S.api_provider,price_in:S.price_in??0,price_out:S.price_out??0,force_stream_mode:S.force_stream_mode??!1,extra_params:S.extra_params??{}};return S.temperature!=null&&(w.temperature=S.temperature),S.max_tokens!=null&&(w.max_tokens=S.max_tokens),w},[]),N=m.useCallback(async S=>{try{u?.(!0);const w=S.map(j);await em("models",w),x?.(!1)}catch(w){console.error("自动保存模型列表失败:",w),x?.(!0)}finally{u?.(!1)}},[u,x,j]),y=m.useCallback(async S=>{try{u?.(!0),await em("model_task_config",S),x?.(!1)}catch(w){console.error("自动保存任务配置失败:",w),x?.(!0)}finally{u?.(!1)}},[u,x]);return m.useEffect(()=>{if(!g.current)return x?.(!0),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{N(i)},o),()=>{h.current&&clearTimeout(h.current)}},[i,N,o,x]),m.useEffect(()=>{if(!(g.current||!r))return x?.(!0),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{y(r)},o),()=>{p.current&&clearTimeout(p.current)}},[r,y,o,x]),m.useEffect(()=>()=>{v()},[v]),{clearTimers:v,initialLoadRef:g}}function E1(l={}){const{onCloseEditDialog:i}=l,r=Ea(),{registerTour:o,startTour:u,state:x,goToStep:h}=um(),p=m.useRef(x.stepIndex);return m.useEffect(()=>{o(Fa,ij)},[o]),m.useEffect(()=>{if(x.activeTourId===Fa&&x.isRunning){const v=rj[x.stepIndex];v&&!window.location.pathname.endsWith(v.replace("/config/",""))&&r({to:v})}},[x.stepIndex,x.activeTourId,x.isRunning,r]),m.useEffect(()=>{if(x.activeTourId===Fa&&x.isRunning){const v=p.current,j=x.stepIndex;v>=12&&v<=17&&j<12&&i?.(),p.current=j}},[x.stepIndex,x.activeTourId,x.isRunning,i]),m.useEffect(()=>{if(x.activeTourId!==Fa||!x.isRunning)return;const v=j=>{const N=j.target,y=x.stepIndex;y===2&&N.closest('[data-tour="add-provider-button"]')?setTimeout(()=>h(3),300):y===9&&N.closest('[data-tour="provider-cancel-button"]')?setTimeout(()=>h(10),300):y===11&&N.closest('[data-tour="add-model-button"]')?setTimeout(()=>h(12),300):y===17&&N.closest('[data-tour="model-cancel-button"]')?setTimeout(()=>h(18),300):y===18&&N.closest('[data-tour="tasks-tab-trigger"]')&&setTimeout(()=>h(19),300)};return document.addEventListener("click",v,!0),()=>document.removeEventListener("click",v,!0)},[x,h]),{startTour:m.useCallback(()=>{u(Fa)},[u]),isRunning:x.isRunning&&x.activeTourId===Fa,stepIndex:x.stepIndex}}function z1(l){const{getProviderConfig:i}=l,[r,o]=m.useState([]),[u,x]=m.useState(!1),[h,p]=m.useState(null),[g,v]=m.useState(null),j=m.useCallback(()=>{o([]),p(null),v(null)},[]),N=m.useCallback(async(y,S=!1)=>{const w=i(y);if(!w?.base_url){o([]),v(null),p('提供商配置不完整,请先在"模型提供商配置"中配置');return}if(!w.api_key){o([]),v(null),p('该提供商未配置 API Key,请先在"模型提供商配置"中填写');return}const R=h1(w.base_url);if(v(R),!R?.modelFetcher){o([]),p(null);return}const O=`${y}:${w.base_url}`,U=zp.get(O);if(!S&&U&&Date.now()-U.timestampz(!1)}),{clearTimers:Xe,initialLoadRef:ye}=T1({models:l,taskConfig:g,onSavingChange:R,onUnsavedChange:U}),W=m.useCallback(async()=>{try{N(!0);const te=await Il(),de=te.models||[];i(de),p(de.map(At=>At.name));const Ns=te.api_providers||[];o(Ns.map(At=>At.name)),x(Ns),v(te.model_task_config||null),U(!1),ye.current=!1}catch(te){console.error("加载配置失败:",te)}finally{N(!1)}},[ye]);m.useEffect(()=>{W()},[W]);const Se=m.useCallback(te=>u.find(de=>de.name===te),[u]),{availableModels:Ge,fetchingModels:jt,modelFetchError:Qs,matchedTemplate:zt,fetchModelsForProvider:Es,clearModels:lt}=z1({getProviderConfig:Se});m.useEffect(()=>{q&&M?.api_provider&&Es(M.api_provider)},[q,M?.api_provider,Es]);const I=async()=>{try{L(!0),fo().catch(()=>{}),F(!0)}catch(te){console.error("重启失败:",te),F(!1),_s({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),L(!1)}},$e=te=>{const de={model_identifier:te.model_identifier,name:te.name,api_provider:te.api_provider,price_in:te.price_in??0,price_out:te.price_out??0,force_stream_mode:te.force_stream_mode??!1,extra_params:te.extra_params??{}};return te.temperature!=null&&(de.temperature=te.temperature),te.max_tokens!=null&&(de.max_tokens=te.max_tokens),de},Oe=async()=>{try{S(!0),Xe();const te=await Il();te.models=l.map($e),te.model_task_config=g,await jr(te),U(!1),_s({title:"保存成功",description:"正在重启麦麦..."}),await I()}catch(te){console.error("保存配置失败:",te),_s({title:"保存失败",description:te.message,variant:"destructive"}),S(!1)}},Ke=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},$s=()=>{F(!1),L(!1),_s({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},Je=async()=>{try{S(!0),Xe();const te=await Il();te.models=l.map($e),te.model_task_config=g,await jr(te),U(!1),_s({title:"保存成功",description:"模型配置已保存"}),await W()}catch(te){console.error("保存配置失败:",te),_s({title:"保存失败",description:te.message,variant:"destructive"})}finally{S(!1)}},Ps=(te,de)=>{De({}),Q(te||{model_identifier:"",name:"",api_provider:r[0]||"",price_in:0,price_out:0,temperature:null,max_tokens:null,force_stream_mode:!1,extra_params:{}}),ve(de),z(!0)},we=()=>{if(!M)return;const te={};if(M.name?.trim()||(te.name="请输入模型名称"),M.api_provider?.trim()||(te.api_provider="请选择 API 提供商"),M.model_identifier?.trim()||(te.model_identifier="请输入模型标识符"),Object.keys(te).length>0){De(te);return}De({});const de={model_identifier:M.model_identifier,name:M.name,api_provider:M.api_provider,price_in:M.price_in??0,price_out:M.price_out??0,force_stream_mode:M.force_stream_mode??!1,extra_params:M.extra_params??{}};M.temperature!=null&&(de.temperature=M.temperature),M.max_tokens!=null&&(de.max_tokens=M.max_tokens);let Ns,At=null;if(fe!==null?(At=l[fe].name,Ns=[...l],Ns[fe]=de):Ns=[...l,de],i(Ns),p(Ns.map(Ot=>Ot.name)),At&&At!==de.name&&g){const Ot=V=>V.map(pe=>pe===At?de.name:pe);v({...g,utils:{...g.utils,model_list:Ot(g.utils?.model_list||[])},utils_small:{...g.utils_small,model_list:Ot(g.utils_small?.model_list||[])},tool_use:{...g.tool_use,model_list:Ot(g.tool_use?.model_list||[])},replyer:{...g.replyer,model_list:Ot(g.replyer?.model_list||[])},planner:{...g.planner,model_list:Ot(g.planner?.model_list||[])},vlm:{...g.vlm,model_list:Ot(g.vlm?.model_list||[])},voice:{...g.voice,model_list:Ot(g.voice?.model_list||[])},embedding:{...g.embedding,model_list:Ot(g.embedding?.model_list||[])},lpmm_entity_extract:{...g.lpmm_entity_extract,model_list:Ot(g.lpmm_entity_extract?.model_list||[])},lpmm_rdf_build:{...g.lpmm_rdf_build,model_list:Ot(g.lpmm_rdf_build?.model_list||[])},lpmm_qa:{...g.lpmm_qa,model_list:Ot(g.lpmm_qa?.model_list||[])}})}z(!1),Q(null),ve(null)},Ss=te=>{if(!te&&M){const de={...M,price_in:M.price_in??0,price_out:M.price_out??0};Q(de)}z(te)},Ee=te=>{Ne(te),be(!0)},xs=()=>{if(je!==null){const te=l.filter((de,Ns)=>Ns!==je);i(te),p(te.map(de=>de.name)),_s({title:"删除成功",description:"模型已从列表中移除"})}be(!1),Ne(null)},bs=te=>{const de=new Set(K);de.has(te)?de.delete(te):de.add(te),re(de)},Mt=()=>{if(K.size===nt.length)re(new Set);else{const te=nt.map((de,Ns)=>l.findIndex(At=>At===nt[Ns]));re(new Set(te))}},Ys=()=>{if(K.size===0){_s({title:"提示",description:"请先选择要删除的模型",variant:"default"});return}ne(!0)},vt=()=>{const te=l.filter((de,Ns)=>!K.has(Ns));i(te),p(te.map(de=>de.name)),re(new Set),ne(!1),_s({title:"批量删除成功",description:`已删除 ${K.size} 个模型`})},Ks=(te,de,Ns)=>{g&&v({...g,[te]:{...g[te],[de]:Ns}})},nt=l.filter(te=>{if(!D)return!0;const de=D.toLowerCase();return te.name.toLowerCase().includes(de)||te.model_identifier.toLowerCase().includes(de)||te.api_provider.toLowerCase().includes(de)}),bl=Math.ceil(nt.length/_e),ha=nt.slice((xe-1)*_e,xe*_e),bt=()=>{const te=parseInt(Z);te>=1&&te<=bl&&(Ce(te),me(""))},Vt=te=>g?[g.utils?.model_list||[],g.utils_small?.model_list||[],g.tool_use?.model_list||[],g.replyer?.model_list||[],g.planner?.model_list||[],g.vlm?.model_list||[],g.voice?.model_list||[],g.embedding?.model_list||[],g.lpmm_entity_extract?.model_list||[],g.lpmm_rdf_build?.model_list||[],g.lpmm_qa?.model_list||[]].some(Ns=>Ns.includes(te)):!1;return j?e.jsx(Ze,{className:"h-full",children:e.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):e.jsx(Ze,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型管理与分配"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"添加模型并为模型分配功能"})]}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[e.jsxs(_,{onClick:Je,disabled:y||w||!O||G,size:"sm",variant:"outline",className:"flex-1 sm:flex-none sm:min-w-[120px]",children:[e.jsx(Tr,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),y?"保存中...":w?"自动保存中...":O?"保存配置":"已保存"]}),e.jsxs(ms,{children:[e.jsx(ut,{asChild:!0,children:e.jsxs(_,{disabled:y||w||G,size:"sm",className:"flex-1 sm:flex-none sm:min-w-[120px]",children:[e.jsx(kr,{className:"mr-2 h-4 w-4"}),G?"重启中...":O?"保存并重启":"重启麦麦"]})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认重启麦麦?"}),e.jsx(os,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:O?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})})})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:O?Oe:I,children:O?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsxs(ta,{children:[e.jsx(Ia,{className:"h-4 w-4"}),e.jsxs(aa,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),e.jsxs(ta,{className:"hidden lg:flex border-primary/30 bg-primary/5 cursor-pointer hover:bg-primary/10 transition-colors",onClick:E,children:[e.jsx(Ty,{className:"h-4 w-4 text-primary"}),e.jsxs(aa,{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(ka,{defaultValue:"models",className:"w-full",children:[e.jsxs(xa,{className:"grid w-full max-w-full sm:max-w-md grid-cols-2",children:[e.jsx(ts,{value:"models",children:"添加模型"}),e.jsx(ts,{value:"tasks","data-tour":"tasks-tab-trigger",children:"为模型分配功能"})]}),e.jsxs(Ms,{value:"models",className:"space-y-4 mt-0",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-2",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"配置可用的模型列表"}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[K.size>0&&e.jsxs(_,{onClick:Ys,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(es,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",K.size,")"]}),e.jsxs(_,{onClick:()=>Ps(null,null),size:"sm",variant:"outline",className:"w-full sm:w-auto","data-tour":"add-model-button",children:[e.jsx(ft,{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(Ft,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ie,{placeholder:"搜索模型名称、标识符或提供商...",value:D,onChange:te=>Y(te.target.value),className:"pl-9"})]}),D&&e.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",nt.length," 个结果"]})]}),e.jsx(w1,{paginatedModels:ha,allModels:l,onEdit:Ps,onDelete:Ee,isModelUsed:Vt,searchQuery:D}),e.jsx(_1,{paginatedModels:ha,allModels:l,filteredModels:nt,selectedModels:K,onEdit:Ps,onDelete:Ee,onToggleSelection:bs,onToggleSelectAll:Mt,isModelUsed:Vt,searchQuery:D}),e.jsx(k1,{page:xe,pageSize:_e,totalItems:nt.length,jumpToPage:Z,onPageChange:Ce,onPageSizeChange:Me,onJumpToPageChange:me,onJumpToPage:bt,onSelectionClear:()=>re(new Set)})]}),e.jsxs(Ms,{value:"tasks",className:"space-y-6 mt-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"为不同的任务配置使用的模型和参数"}),g&&e.jsxs("div",{className:"grid gap-4 sm:gap-6",children:[e.jsx(Da,{title:"组件模型 (utils)",description:"用于表情包、取名、关系、情绪变化等组件",taskConfig:g.utils,modelNames:h,onChange:(te,de)=>Ks("utils",te,de),dataTour:"task-model-select"}),e.jsx(Da,{title:"组件小模型 (utils_small)",description:"消耗量较大的组件,建议使用速度较快的小模型",taskConfig:g.utils_small,modelNames:h,onChange:(te,de)=>Ks("utils_small",te,de)}),e.jsx(Da,{title:"工具调用模型 (tool_use)",description:"需要使用支持工具调用的模型",taskConfig:g.tool_use,modelNames:h,onChange:(te,de)=>Ks("tool_use",te,de)}),e.jsx(Da,{title:"首要回复模型 (replyer)",description:"用于表达器和表达方式学习",taskConfig:g.replyer,modelNames:h,onChange:(te,de)=>Ks("replyer",te,de)}),e.jsx(Da,{title:"决策模型 (planner)",description:"负责决定麦麦该什么时候回复",taskConfig:g.planner,modelNames:h,onChange:(te,de)=>Ks("planner",te,de)}),e.jsx(Da,{title:"图像识别模型 (vlm)",description:"视觉语言模型",taskConfig:g.vlm,modelNames:h,onChange:(te,de)=>Ks("vlm",te,de),hideTemperature:!0}),e.jsx(Da,{title:"语音识别模型 (voice)",description:"语音转文字",taskConfig:g.voice,modelNames:h,onChange:(te,de)=>Ks("voice",te,de),hideTemperature:!0,hideMaxTokens:!0}),e.jsx(Da,{title:"嵌入模型 (embedding)",description:"用于向量化",taskConfig:g.embedding,modelNames:h,onChange:(te,de)=>Ks("embedding",te,de),hideTemperature:!0,hideMaxTokens:!0}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库模型"}),e.jsx(Da,{title:"实体提取模型 (lpmm_entity_extract)",description:"从文本中提取实体",taskConfig:g.lpmm_entity_extract,modelNames:h,onChange:(te,de)=>Ks("lpmm_entity_extract",te,de)}),e.jsx(Da,{title:"RDF 构建模型 (lpmm_rdf_build)",description:"构建知识图谱",taskConfig:g.lpmm_rdf_build,modelNames:h,onChange:(te,de)=>Ks("lpmm_rdf_build",te,de)}),e.jsx(Da,{title:"问答模型 (lpmm_qa)",description:"知识库问答",taskConfig:g.lpmm_qa,modelNames:h,onChange:(te,de)=>Ks("lpmm_qa",te,de)})]})]})]})]}),e.jsx(Gs,{open:q,onOpenChange:Ss,children:e.jsxs(Us,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto","data-tour":"model-dialog",preventOutsideClose:he,children:[e.jsxs(Bs,{children:[e.jsx(Hs,{children:fe!==null?"编辑模型":"添加模型"}),e.jsx(Ws,{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(C,{htmlFor:"model_name",className:ae.name?"text-destructive":"",children:"模型名称 *"}),e.jsx(ie,{id:"model_name",value:M?.name||"",onChange:te=>{Q(de=>de?{...de,name:te.target.value}:null),ae.name&&De(de=>({...de,name:void 0}))},placeholder:"例如: qwen3-30b",className:ae.name?"border-destructive focus-visible:ring-destructive":""}),ae.name?e.jsx("p",{className:"text-xs text-destructive",children:ae.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(C,{htmlFor:"api_provider",className:ae.api_provider?"text-destructive":"",children:"API 提供商 *"}),e.jsxs(Be,{value:M?.api_provider||"",onValueChange:te=>{Q(de=>de?{...de,api_provider:te}:null),lt(),ae.api_provider&&De(de=>({...de,api_provider:void 0}))},children:[e.jsx(Le,{id:"api_provider",className:ae.api_provider?"border-destructive focus-visible:ring-destructive":"",children:e.jsx(He,{placeholder:"选择提供商"})}),e.jsx(Ue,{children:r.map(te=>e.jsx(se,{value:te,children:te},te))})]}),ae.api_provider&&e.jsx("p",{className:"text-xs text-destructive",children:ae.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(C,{htmlFor:"model_identifier",className:ae.model_identifier?"text-destructive":"",children:"模型标识符 *"}),zt?.modelFetcher&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Qe,{variant:"secondary",className:"text-xs",children:zt.display_name}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-6 px-2",onClick:()=>M?.api_provider&&Es(M.api_provider,!0),disabled:jt,children:jt?e.jsx(mt,{className:"h-3 w-3 animate-spin"}):e.jsx(qt,{className:"h-3 w-3"})})]})]}),zt?.modelFetcher?e.jsxs(Ya,{open:ke,onOpenChange:X,children:[e.jsx(Ka,{asChild:!0,children:e.jsxs(_,{variant:"outline",role:"combobox","aria-expanded":ke,className:"w-full justify-between font-normal",disabled:jt||!!Qs,children:[jt?e.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(mt,{className:"h-4 w-4 animate-spin"}),"正在获取模型列表..."]}):Qs?e.jsx("span",{className:"text-muted-foreground text-sm",children:"点击下方输入框手动填写"}):M?.model_identifier?e.jsx("span",{className:"truncate",children:M.model_identifier}):e.jsx("span",{className:"text-muted-foreground",children:"搜索或选择模型..."}),e.jsx(nm,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(Ba,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:e.jsxs(po,{children:[e.jsx(go,{placeholder:"搜索模型..."}),e.jsx(Ze,{className:"h-[300px]",children:e.jsxs(jo,{className:"max-h-none overflow-visible",children:[e.jsx(vo,{children:Qs?e.jsxs("div",{className:"py-4 px-2 text-center space-y-2",children:[e.jsx("p",{className:"text-sm text-destructive",children:Qs}),!Qs.includes("API Key")&&e.jsx(_,{variant:"link",size:"sm",onClick:()=>M?.api_provider&&Es(M.api_provider,!0),children:"重试"})]}):"未找到匹配的模型"}),e.jsx(yr,{heading:"可用模型",children:Ge.map(te=>e.jsxs(wr,{value:te.id,onSelect:()=>{Q(de=>de?{...de,model_identifier:te.id}:null),X(!1)},children:[e.jsx(sa,{className:`mr-2 h-4 w-4 ${M?.model_identifier===te.id?"opacity-100":"opacity-0"}`}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{children:te.id}),te.name!==te.id&&e.jsx("span",{className:"text-xs text-muted-foreground",children:te.name})]})]},te.id))}),e.jsx(yr,{heading:"手动输入",children:e.jsxs(wr,{value:"__manual_input__",onSelect:()=>{X(!1)},children:[e.jsx(pn,{className:"mr-2 h-4 w-4"}),"手动输入模型标识符..."]})})]})})]})})]}):e.jsx(ie,{id:"model_identifier",value:M?.model_identifier||"",onChange:te=>{Q(de=>de?{...de,model_identifier:te.target.value}:null),ae.model_identifier&&De(de=>({...de,model_identifier:void 0}))},placeholder:"Qwen/Qwen3-30B-A3B-Instruct-2507",className:ae.model_identifier?"border-destructive focus-visible:ring-destructive":""}),ae.model_identifier&&e.jsx("p",{className:"text-xs text-destructive",children:ae.model_identifier}),Qs&&zt?.modelFetcher&&!ae.model_identifier&&e.jsxs(ta,{variant:"destructive",className:"mt-2 py-2",children:[e.jsx(Ia,{className:"h-4 w-4"}),e.jsx(aa,{className:"text-xs",children:Qs})]}),zt?.modelFetcher&&e.jsx(ie,{value:M?.model_identifier||"",onChange:te=>{Q(de=>de?{...de,model_identifier:te.target.value}:null),ae.model_identifier&&De(de=>({...de,model_identifier:void 0}))},placeholder:"或手动输入模型标识符",className:`mt-2 ${ae.model_identifier?"border-destructive focus-visible:ring-destructive":""}`}),!ae.model_identifier&&e.jsx("p",{className:"text-xs text-muted-foreground",children:Qs?'请手动输入模型标识符,或前往"模型提供商配置"检查 API Key':zt?.modelFetcher?`已识别为 ${zt.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(C,{htmlFor:"price_in",children:"输入价格 (¥/M token)"}),e.jsx(ie,{id:"price_in",type:"number",step:"0.1",min:"0",value:M?.price_in??"",onChange:te=>{const de=te.target.value===""?null:parseFloat(te.target.value);Q(Ns=>Ns?{...Ns,price_in:de}:null)},placeholder:"默认: 0"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"price_out",children:"输出价格 (¥/M token)"}),e.jsx(ie,{id:"price_out",type:"number",step:"0.1",min:"0",value:M?.price_out??"",onChange:te=>{const de=te.target.value===""?null:parseFloat(te.target.value);Q(Ns=>Ns?{...Ns,price_out:de}:null)},placeholder:"默认: 0"})]})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{htmlFor:"enable_model_temperature",className:"cursor-pointer",children:"自定义模型温度"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后将覆盖「为模型分配功能」中的任务温度配置"})]}),e.jsx(Fe,{id:"enable_model_temperature",checked:M?.temperature!=null,onCheckedChange:te=>{Q(te?de=>de?{...de,temperature:.5}:null:de=>de?{...de,temperature:null}:null)}})]}),M?.temperature!=null&&e.jsxs("div",{className:"space-y-2 pt-2 border-t",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{className:"text-sm",children:"温度值"}),e.jsx("span",{className:"text-sm font-medium tabular-nums",children:M.temperature.toFixed(1)})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"0"}),e.jsx(Ca,{value:[M.temperature],onValueChange:te=>Q(de=>de?{...de,temperature:te[0]}:null),min:0,max:1,step:.1,className:"flex-1"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"1"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"较低的温度(0.1-0.3)产生更确定的输出,较高的温度(0.7-1.0)产生更多样化的输出"})]})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{htmlFor:"enable_model_max_tokens",className:"cursor-pointer",children:"自定义最大 Token"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后将覆盖「为模型分配功能」中的任务最大 Token 配置"})]}),e.jsx(Fe,{id:"enable_model_max_tokens",checked:M?.max_tokens!=null,onCheckedChange:te=>{Q(te?de=>de?{...de,max_tokens:2048}:null:de=>de?{...de,max_tokens:null}:null)}})]}),M?.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(C,{className:"text-sm",children:"最大 Token 数"}),e.jsx(ie,{type:"number",min:"1",max:"128000",value:M.max_tokens,onChange:te=>{const de=parseInt(te.target.value);!isNaN(de)&&de>=1&&Q(Ns=>Ns?{...Ns,max_tokens:de}:null)},className:"w-28 h-8 text-sm"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"限制模型单次输出的最大 token 数量,不同模型支持的上限不同"})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Fe,{id:"force_stream_mode",checked:M?.force_stream_mode||!1,onCheckedChange:te=>Q(de=>de?{...de,force_stream_mode:te}:null)}),e.jsx(C,{htmlFor:"force_stream_mode",className:"cursor-pointer",children:"强制流式输出模式"})]}),e.jsx(b1,{value:M?.extra_params||{},onChange:te=>Q(de=>de?{...de,extra_params:te}:null),placeholder:"添加额外参数(如 enable_thinking、top_p 等)..."})]}),e.jsxs(tt,{children:[e.jsx(_,{variant:"outline",onClick:()=>z(!1),"data-tour":"model-cancel-button",children:"取消"}),e.jsx(_,{onClick:we,"data-tour":"model-save-button",children:"保存"})]})]})}),e.jsx(ms,{open:ge,onOpenChange:be,children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:['确定要删除模型 "',je!==null?l[je]?.name:"",'" 吗? 此操作无法撤销。']})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:xs,children:"删除"})]})]})}),e.jsx(ms,{open:k,onOpenChange:ne,children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认批量删除"}),e.jsxs(os,{children:["确定要删除选中的 ",K.size," 个模型吗? 此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:vt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),T&&e.jsx(dm,{onRestartComplete:Ke,onRestartFailed:$s})]})})}const _r=MN,Sr=AN,Cr=ON,bo="/api/webui/config";async function A1(){const i=await(await Te(`${bo}/adapter-config/path`)).json();return!i.success||!i.path?null:{path:i.path,lastModified:i.lastModified}}async function Mp(l){const r=await(await Te(`${bo}/adapter-config/path`,{method:"POST",headers:Fs(),body:JSON.stringify({path:l})})).json();if(!r.success)throw new Error(r.message||"保存路径失败")}async function Ap(l){const r=await(await Te(`${bo}/adapter-config?path=${encodeURIComponent(l)}`)).json();if(!r.success)throw new Error("读取配置文件失败");return r.content}async function Op(l,i){const o=await(await Te(`${bo}/adapter-config`,{method:"POST",headers:Fs(),body:JSON.stringify({path:l,content:i})})).json();if(!o.success)throw new Error(o.message||"保存配置失败")}const ot={inner:{version:"0.1.2"},nickname:{nickname:""},napcat_server:{host:"localhost",port:8095,token:"",heartbeat_interval:30},maibot_server:{host:"localhost",port:8e3},chat:{group_list_type:"whitelist",group_list:[],private_list_type:"whitelist",private_list:[],ban_user_id:[],ban_qq_bot:!1,enable_poke:!0},voice:{use_tts:!1},debug:{level:"INFO"}},Vu={oneclick:{name:"一键包",description:"使用一键包部署的适配器配置",path:"../MaiBot-Napcat-Adapter/config.toml",icon:Ql},docker:{name:"Docker",description:"Docker Compose 部署的适配器配置",path:"/MaiMBot/adapters-config/config.toml",icon:Ey}};function O1(l,i){let r=l.slice(0,i).split(/\r\n|\n|\r/g);return[r.length,r.pop().length+1]}function D1(l,i,r){let o=l.split(/\r\n|\n|\r/g),u="",x=(Math.log10(i+1)|0)+1;for(let h=i-1;h<=i+1;h++){let p=o[h-1];p&&(u+=h.toString().padEnd(x," "),u+=": ",u+=p,u+=` +}`,className:H("font-mono text-sm min-h-[140px] h-[140px] resize-y flex-1",v&&"border-destructive focus-visible:ring-destructive")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"支持 string、number、boolean 类型"})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"预览"}),e.jsx("div",{className:"min-h-[140px] h-[140px] flex-1 rounded-md border bg-muted/30 p-3 overflow-auto",children:y.success&&Object.keys(y.data).length>0?e.jsx("div",{className:"space-y-2",children:Object.entries(y.data).map(([F,A])=>{const k=bj(A);return e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("code",{className:"px-1.5 py-0.5 bg-background rounded text-xs font-medium",children:F}),e.jsx("span",{className:"text-muted-foreground",children:"="}),e.jsx("span",{className:H("font-mono",k==="boolean"&&(A?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"),k==="number"&&"text-blue-600 dark:text-blue-400",k==="string"&&"text-amber-600 dark:text-amber-400"),children:k==="string"?`"${A}"`:String(A)}),e.jsx(Qe,{variant:"secondary",className:H("h-5 text-[10px] px-1.5",b1(k)),children:v1(k)})]},F)})}):y.success?e.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"暂无参数"}):e.jsx("div",{className:"flex items-center justify-center h-full text-sm text-destructive",children:"JSON 格式错误"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"实时预览解析结果"})]})]})})]})]})}function y1({value:l,label:i,onRemove:r}){const{attributes:o,listeners:u,setNodeRef:x,transform:h,transition:f,isDragging:g}=Zg({id:l}),j={transform:Wg.Transform.toString(h),transition:f,opacity:g?.5:1},v=y=>{y.preventDefault(),y.stopPropagation(),r(l)},N=y=>{y.stopPropagation()};return e.jsx("div",{ref:x,style:j,className:H("inline-flex items-center gap-1",g&&"shadow-lg"),children:e.jsxs(Qe,{variant:"secondary",className:"cursor-move hover:bg-secondary/80 flex items-center gap-1",children:[e.jsx("div",{...o,...u,className:"cursor-grab active:cursor-grabbing flex items-center",children:e.jsx(Rg,{className:"h-3 w-3 text-muted-foreground"})}),e.jsx("span",{children:i}),e.jsx("button",{type:"button",className:"ml-1 rounded-sm hover:bg-destructive/20 focus:outline-none focus:ring-1 focus:ring-destructive",onClick:v,onPointerDown:N,onMouseDown:y=>y.stopPropagation(),children:e.jsx(gl,{className:"h-3 w-3 cursor-pointer hover:text-destructive",strokeWidth:2,fill:"none"})})]})})}function w1({options:l,selected:i,onChange:r,placeholder:o="选择选项...",emptyText:u="未找到选项",className:x}){const[h,f]=m.useState(!1),g=Vg(ro(Pg,{activationConstraint:{distance:8}}),ro(Jg,{coordinateGetter:Xg})),j=y=>{i.includes(y)?r(i.filter(S=>S!==y)):r([...i,y])},v=y=>{r(i.filter(S=>S!==y))},N=y=>{const{active:S,over:w}=y;if(w&&S.id!==w.id){const L=i.indexOf(S.id),O=i.indexOf(w.id);r(Kg(i,L,O))}};return e.jsxs(Ya,{open:h,onOpenChange:f,children:[e.jsx(Ka,{asChild:!0,children:e.jsxs(_,{variant:"outline",role:"combobox","aria-expanded":h,className:H("w-full justify-between min-h-10 h-auto",x),children:[e.jsx(Ig,{sensors:g,collisionDetection:Qg,onDragEnd:N,children:e.jsx(Yg,{items:i,strategy:u0,children:e.jsx("div",{className:"flex gap-1 flex-wrap flex-1",children:i.length===0?e.jsx("span",{className:"text-muted-foreground",children:o}):i.map(y=>{const S=l.find(w=>w.value===y);return e.jsx(y1,{value:y,label:S?.label||y,onRemove:v},y)})})})}),e.jsx(im,{className:"ml-2 h-4 w-4 shrink-0 opacity-50",strokeWidth:2,fill:"none"})]})}),e.jsx(Ba,{className:"w-full p-0",align:"start",children:e.jsxs(go,{children:[e.jsx(jo,{placeholder:"搜索...",className:"h-9"}),e.jsxs(vo,{children:[e.jsx(bo,{children:u}),e.jsx(yr,{children:l.map(y=>{const S=i.includes(y.value);return e.jsxs(wr,{value:y.value,onSelect:()=>j(y.value),children:[e.jsx("div",{className:H("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",S?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(sa,{className:"h-3 w-3",strokeWidth:2,fill:"none"})}),e.jsx("span",{children:y.label})]},y.value)})})]})]})})]})}const Da=Et.memo(function({title:i,description:r,taskConfig:o,modelNames:u,onChange:x,hideTemperature:h=!1,hideMaxTokens:f=!1,dataTour:g}){const j=v=>{x("model_list",v)};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:i}),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":g,children:[e.jsx(C,{children:"模型列表"}),e.jsx(w1,{options:u.map(v=>({label:v,value:v})),selected:o.model_list||[],onChange:j,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(C,{children:"温度"}),e.jsx(ne,{type:"number",step:"0.1",min:"0",max:"1",value:o.temperature??.3,onChange:v=>{const N=parseFloat(v.target.value);!isNaN(N)&&N>=0&&N<=1&&x("temperature",N)},className:"w-20 h-8 text-sm"})]}),e.jsx(Ca,{value:[o.temperature??.3],onValueChange:v=>x("temperature",v[0]),min:0,max:1,step:.1,className:"w-full"})]}),!f&&e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{children:"最大 Token"}),e.jsx(ne,{type:"number",step:"1",min:"1",value:o.max_tokens??1024,onChange:v=>x("max_tokens",parseInt(v.target.value))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{children:"慢请求阈值 (秒)"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"超时警告"})]}),e.jsx(ne,{type:"number",step:"1",min:"1",value:o.slow_threshold??15,onChange:v=>{const N=parseInt(v.target.value);!isNaN(N)&&N>=1&&x("slow_threshold",N)},placeholder:"15"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"模型响应时间超过此阈值将输出警告日志"})]})]})]})}),_1=Et.memo(function({paginatedModels:i,allModels:r,onEdit:o,onDelete:u,isModelUsed:x,searchQuery:h}){return i.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:i.map((f,g)=>{const j=r.findIndex(N=>N===f),v=x(f.name);return e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("h3",{className:"font-semibold text-base",children:f.name}),e.jsx(Qe,{variant:v?"default":"secondary",className:v?"bg-green-600 hover:bg-green-700":"",children:v?"已使用":"未使用"})]}),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:()=>o(f,j),children:[e.jsx(pn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(_,{size:"sm",onClick:()=>u(j),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(We,{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"]})]})]})]},g)})})}),S1=Et.memo(function({paginatedModels:i,allModels:r,filteredModels:o,selectedModels:u,onEdit:x,onDelete:h,onToggleSelection:f,onToggleSelectAll:g,isModelUsed:j,searchQuery:v}){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(jn,{children:[e.jsx(vn,{children:e.jsxs(pt,{children:[e.jsx(Pe,{className:"w-12",children:e.jsx(gt,{checked:u.size===o.length&&o.length>0,onCheckedChange:g})}),e.jsx(Pe,{className:"w-24",children:"使用状态"}),e.jsx(Pe,{children:"模型名称"}),e.jsx(Pe,{children:"模型标识符"}),e.jsx(Pe,{children:"提供商"}),e.jsx(Pe,{className:"text-center",children:"温度"}),e.jsx(Pe,{className:"text-right",children:"输入价格"}),e.jsx(Pe,{className:"text-right",children:"输出价格"}),e.jsx(Pe,{className:"text-right",children:"操作"})]})}),e.jsx(bn,{children:i.length===0?e.jsx(pt,{children:e.jsx(Ie,{colSpan:9,className:"text-center text-muted-foreground py-8",children:v?"未找到匹配的模型":"暂无模型配置"})}):i.map((N,y)=>{const S=r.findIndex(L=>L===N),w=j(N.name);return e.jsxs(pt,{children:[e.jsx(Ie,{children:e.jsx(gt,{checked:u.has(S),onCheckedChange:()=>f(S)})}),e.jsx(Ie,{children:e.jsx(Qe,{variant:w?"default":"secondary",className:w?"bg-green-600 hover:bg-green-700":"",children:w?"已使用":"未使用"})}),e.jsx(Ie,{className:"font-medium",children:N.name}),e.jsx(Ie,{className:"max-w-xs truncate",title:N.model_identifier,children:N.model_identifier}),e.jsx(Ie,{children:N.api_provider}),e.jsx(Ie,{className:"text-center",children:N.temperature!=null?N.temperature:e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsxs(Ie,{className:"text-right",children:["¥",N.price_in,"/M"]}),e.jsxs(Ie,{className:"text-right",children:["¥",N.price_out,"/M"]}),e.jsx(Ie,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>x(N,S),children:[e.jsx(pn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),e.jsxs(_,{size:"sm",onClick:()=>h(S),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(We,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},y)})})]})})})}),C1=300*1e3,zp=new Map,k1=[10,20,50,100],T1=Et.memo(function({page:i,pageSize:r,totalItems:o,jumpToPage:u,onPageChange:x,onPageSizeChange:h,onJumpToPageChange:f,onJumpToPage:g,onSelectionClear:j}){const v=Math.ceil(o/r),N=S=>{h(parseInt(S)),x(1),j?.()},y=S=>{S.key==="Enter"&&g()};return o===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(C,{htmlFor:"page-size-model",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Be,{value:r.toString(),onValueChange:N,children:[e.jsx(Le,{id:"page-size-model",className:"w-20",children:e.jsx(He,{})}),e.jsx(Ue,{children:k1.map(S=>e.jsx(se,{value:S.toString(),children:S},S))})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(i-1)*r+1," 到"," ",Math.min(i*r,o)," 条,共 ",o," 条"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>x(1),disabled:i===1,className:"hidden sm:flex",children:e.jsx(fi,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>x(Math.max(1,i-1)),disabled:i===1,children:[e.jsx(jl,{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:u,onChange:S=>f(S.target.value),onKeyDown:y,placeholder:i.toString(),className:"w-16 h-8 text-center",min:1,max:v}),e.jsx(_,{variant:"outline",size:"sm",onClick:g,disabled:!u,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>x(i+1),disabled:i>=v,children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Xa,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>x(v),disabled:i>=v,className:"hidden sm:flex",children:e.jsx(pi,{className:"h-4 w-4"})})]})]})});function E1(l){const{models:i,taskConfig:r,debounceMs:o=2e3,onSavingChange:u,onUnsavedChange:x}=l,h=m.useRef(null),f=m.useRef(null),g=m.useRef(!0),j=m.useCallback(()=>{h.current&&(clearTimeout(h.current),h.current=null),f.current&&(clearTimeout(f.current),f.current=null)},[]),v=m.useCallback(S=>{const w={model_identifier:S.model_identifier,name:S.name,api_provider:S.api_provider,price_in:S.price_in??0,price_out:S.price_out??0,force_stream_mode:S.force_stream_mode??!1,extra_params:S.extra_params??{}};return S.temperature!=null&&(w.temperature=S.temperature),S.max_tokens!=null&&(w.max_tokens=S.max_tokens),w},[]),N=m.useCallback(async S=>{try{u?.(!0);const w=S.map(v);await sm("models",w),x?.(!1)}catch(w){console.error("自动保存模型列表失败:",w),x?.(!0)}finally{u?.(!1)}},[u,x,v]),y=m.useCallback(async S=>{try{u?.(!0),await sm("model_task_config",S),x?.(!1)}catch(w){console.error("自动保存任务配置失败:",w),x?.(!0)}finally{u?.(!1)}},[u,x]);return m.useEffect(()=>{if(!g.current)return x?.(!0),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{N(i)},o),()=>{h.current&&clearTimeout(h.current)}},[i,N,o,x]),m.useEffect(()=>{if(!(g.current||!r))return x?.(!0),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{y(r)},o),()=>{f.current&&clearTimeout(f.current)}},[r,y,o,x]),m.useEffect(()=>()=>{j()},[j]),{clearTimers:j,initialLoadRef:g}}function z1(l={}){const{onCloseEditDialog:i}=l,r=Ea(),{registerTour:o,startTour:u,state:x,goToStep:h}=mm(),f=m.useRef(x.stepIndex);return m.useEffect(()=>{o(Fa,gj)},[o]),m.useEffect(()=>{if(x.activeTourId===Fa&&x.isRunning){const j=jj[x.stepIndex];j&&!window.location.pathname.endsWith(j.replace("/config/",""))&&r({to:j})}},[x.stepIndex,x.activeTourId,x.isRunning,r]),m.useEffect(()=>{if(x.activeTourId===Fa&&x.isRunning){const j=f.current,v=x.stepIndex;j>=12&&j<=17&&v<12&&i?.(),f.current=v}},[x.stepIndex,x.activeTourId,x.isRunning,i]),m.useEffect(()=>{if(x.activeTourId!==Fa||!x.isRunning)return;const j=v=>{const N=v.target,y=x.stepIndex;y===2&&N.closest('[data-tour="add-provider-button"]')?setTimeout(()=>h(3),300):y===9&&N.closest('[data-tour="provider-cancel-button"]')?setTimeout(()=>h(10),300):y===11&&N.closest('[data-tour="add-model-button"]')?setTimeout(()=>h(12),300):y===17&&N.closest('[data-tour="model-cancel-button"]')?setTimeout(()=>h(18),300):y===18&&N.closest('[data-tour="tasks-tab-trigger"]')&&setTimeout(()=>h(19),300)};return document.addEventListener("click",j,!0),()=>document.removeEventListener("click",j,!0)},[x,h]),{startTour:m.useCallback(()=>{u(Fa)},[u]),isRunning:x.isRunning&&x.activeTourId===Fa,stepIndex:x.stepIndex}}function M1(l){const{getProviderConfig:i}=l,[r,o]=m.useState([]),[u,x]=m.useState(!1),[h,f]=m.useState(null),[g,j]=m.useState(null),v=m.useCallback(()=>{o([]),f(null),j(null)},[]),N=m.useCallback(async(y,S=!1)=>{const w=i(y);if(!w?.base_url){o([]),j(null),f('提供商配置不完整,请先在"模型提供商配置"中配置');return}if(!w.api_key){o([]),j(null),f('该提供商未配置 API Key,请先在"模型提供商配置"中填写');return}const L=f1(w.base_url);if(j(L),!L?.modelFetcher){o([]),f(null);return}const O=`${y}:${w.base_url}`,U=zp.get(O);if(!S&&U&&Date.now()-U.timestampz(!1)}),{clearTimers:Xe,initialLoadRef:ye}=E1({models:l,taskConfig:g,onSavingChange:L,onUnsavedChange:U}),W=m.useCallback(async()=>{try{N(!0);const te=await Il(),de=te.models||[];i(de),f(de.map(At=>At.name));const Ns=te.api_providers||[];o(Ns.map(At=>At.name)),x(Ns),j(te.model_task_config||null),U(!1),ye.current=!1}catch(te){console.error("加载配置失败:",te)}finally{N(!1)}},[ye]);m.useEffect(()=>{W()},[W]);const Se=m.useCallback(te=>u.find(de=>de.name===te),[u]),{availableModels:Ge,fetchingModels:jt,modelFetchError:Qs,matchedTemplate:zt,fetchModelsForProvider:Es,clearModels:lt}=M1({getProviderConfig:Se});m.useEffect(()=>{G&&M?.api_provider&&Es(M.api_provider)},[G,M?.api_provider,Es]);const I=async()=>{try{A(!0),po().catch(()=>{}),$(!0)}catch(te){console.error("重启失败:",te),$(!1),_s({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),A(!1)}},$e=te=>{const de={model_identifier:te.model_identifier,name:te.name,api_provider:te.api_provider,price_in:te.price_in??0,price_out:te.price_out??0,force_stream_mode:te.force_stream_mode??!1,extra_params:te.extra_params??{}};return te.temperature!=null&&(de.temperature=te.temperature),te.max_tokens!=null&&(de.max_tokens=te.max_tokens),de},Oe=async()=>{try{S(!0),Xe();const te=await Il();te.models=l.map($e),te.model_task_config=g,await jr(te),U(!1),_s({title:"保存成功",description:"正在重启麦麦..."}),await I()}catch(te){console.error("保存配置失败:",te),_s({title:"保存失败",description:te.message,variant:"destructive"}),S(!1)}},Ke=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},$s=()=>{$(!1),A(!1),_s({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},Je=async()=>{try{S(!0),Xe();const te=await Il();te.models=l.map($e),te.model_task_config=g,await jr(te),U(!1),_s({title:"保存成功",description:"模型配置已保存"}),await W()}catch(te){console.error("保存配置失败:",te),_s({title:"保存失败",description:te.message,variant:"destructive"})}finally{S(!1)}},Ps=(te,de)=>{De({}),Q(te||{model_identifier:"",name:"",api_provider:r[0]||"",price_in:0,price_out:0,temperature:null,max_tokens:null,force_stream_mode:!1,extra_params:{}}),ve(de),z(!0)},we=()=>{if(!M)return;const te={};if(M.name?.trim()||(te.name="请输入模型名称"),M.api_provider?.trim()||(te.api_provider="请选择 API 提供商"),M.model_identifier?.trim()||(te.model_identifier="请输入模型标识符"),Object.keys(te).length>0){De(te);return}De({});const de={model_identifier:M.model_identifier,name:M.name,api_provider:M.api_provider,price_in:M.price_in??0,price_out:M.price_out??0,force_stream_mode:M.force_stream_mode??!1,extra_params:M.extra_params??{}};M.temperature!=null&&(de.temperature=M.temperature),M.max_tokens!=null&&(de.max_tokens=M.max_tokens);let Ns,At=null;if(fe!==null?(At=l[fe].name,Ns=[...l],Ns[fe]=de):Ns=[...l,de],i(Ns),f(Ns.map(Ot=>Ot.name)),At&&At!==de.name&&g){const Ot=V=>V.map(pe=>pe===At?de.name:pe);j({...g,utils:{...g.utils,model_list:Ot(g.utils?.model_list||[])},utils_small:{...g.utils_small,model_list:Ot(g.utils_small?.model_list||[])},tool_use:{...g.tool_use,model_list:Ot(g.tool_use?.model_list||[])},replyer:{...g.replyer,model_list:Ot(g.replyer?.model_list||[])},planner:{...g.planner,model_list:Ot(g.planner?.model_list||[])},vlm:{...g.vlm,model_list:Ot(g.vlm?.model_list||[])},voice:{...g.voice,model_list:Ot(g.voice?.model_list||[])},embedding:{...g.embedding,model_list:Ot(g.embedding?.model_list||[])},lpmm_entity_extract:{...g.lpmm_entity_extract,model_list:Ot(g.lpmm_entity_extract?.model_list||[])},lpmm_rdf_build:{...g.lpmm_rdf_build,model_list:Ot(g.lpmm_rdf_build?.model_list||[])},lpmm_qa:{...g.lpmm_qa,model_list:Ot(g.lpmm_qa?.model_list||[])}})}z(!1),Q(null),ve(null)},Ss=te=>{if(!te&&M){const de={...M,price_in:M.price_in??0,price_out:M.price_out??0};Q(de)}z(te)},Ee=te=>{Ne(te),be(!0)},xs=()=>{if(je!==null){const te=l.filter((de,Ns)=>Ns!==je);i(te),f(te.map(de=>de.name)),_s({title:"删除成功",description:"模型已从列表中移除"})}be(!1),Ne(null)},bs=te=>{const de=new Set(K);de.has(te)?de.delete(te):de.add(te),re(de)},Mt=()=>{if(K.size===nt.length)re(new Set);else{const te=nt.map((de,Ns)=>l.findIndex(At=>At===nt[Ns]));re(new Set(te))}},Ys=()=>{if(K.size===0){_s({title:"提示",description:"请先选择要删除的模型",variant:"default"});return}ie(!0)},vt=()=>{const te=l.filter((de,Ns)=>!K.has(Ns));i(te),f(te.map(de=>de.name)),re(new Set),ie(!1),_s({title:"批量删除成功",description:`已删除 ${K.size} 个模型`})},Ks=(te,de,Ns)=>{g&&j({...g,[te]:{...g[te],[de]:Ns}})},nt=l.filter(te=>{if(!R)return!0;const de=R.toLowerCase();return te.name.toLowerCase().includes(de)||te.model_identifier.toLowerCase().includes(de)||te.api_provider.toLowerCase().includes(de)}),bl=Math.ceil(nt.length/_e),ha=nt.slice((xe-1)*_e,xe*_e),bt=()=>{const te=parseInt(Z);te>=1&&te<=bl&&(Ce(te),me(""))},Vt=te=>g?[g.utils?.model_list||[],g.utils_small?.model_list||[],g.tool_use?.model_list||[],g.replyer?.model_list||[],g.planner?.model_list||[],g.vlm?.model_list||[],g.voice?.model_list||[],g.embedding?.model_list||[],g.lpmm_entity_extract?.model_list||[],g.lpmm_rdf_build?.model_list||[],g.lpmm_qa?.model_list||[]].some(Ns=>Ns.includes(te)):!1;return v?e.jsx(Ze,{className:"h-full",children:e.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):e.jsx(Ze,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型管理与分配"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"添加模型并为模型分配功能"})]}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[e.jsxs(_,{onClick:Je,disabled:y||w||!O||F,size:"sm",variant:"outline",className:"flex-1 sm:flex-none sm:min-w-[120px]",children:[e.jsx(Tr,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),y?"保存中...":w?"自动保存中...":O?"保存配置":"已保存"]}),e.jsxs(ms,{children:[e.jsx(mt,{asChild:!0,children:e.jsxs(_,{disabled:y||w||F,size:"sm",className:"flex-1 sm:flex-none sm:min-w-[120px]",children:[e.jsx(kr,{className:"mr-2 h-4 w-4"}),F?"重启中...":O?"保存并重启":"重启麦麦"]})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认重启麦麦?"}),e.jsx(os,{asChild:!0,children:e.jsx("div",{children:e.jsx("p",{children:O?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"})})})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:O?Oe:I,children:O?"保存并重启":"确认重启"})]})]})]})]})]}),e.jsxs(ta,{children:[e.jsx(Ia,{className:"h-4 w-4"}),e.jsxs(aa,{children:["配置更新后需要",e.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),e.jsxs(ta,{className:"hidden lg:flex border-primary/30 bg-primary/5 cursor-pointer hover:bg-primary/10 transition-colors",onClick:E,children:[e.jsx(By,{className:"h-4 w-4 text-primary"}),e.jsxs(aa,{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(ka,{defaultValue:"models",className:"w-full",children:[e.jsxs(xa,{className:"grid w-full max-w-full sm:max-w-md grid-cols-2",children:[e.jsx(ts,{value:"models",children:"添加模型"}),e.jsx(ts,{value:"tasks","data-tour":"tasks-tab-trigger",children:"为模型分配功能"})]}),e.jsxs(Ms,{value:"models",className:"space-y-4 mt-0",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-2",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"配置可用的模型列表"}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[K.size>0&&e.jsxs(_,{onClick:Ys,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(We,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",K.size,")"]}),e.jsxs(_,{onClick:()=>Ps(null,null),size:"sm",variant:"outline",className:"w-full sm:w-auto","data-tour":"add-model-button",children:[e.jsx(ut,{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(Ft,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ne,{placeholder:"搜索模型名称、标识符或提供商...",value:R,onChange:te=>Y(te.target.value),className:"pl-9"})]}),R&&e.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",nt.length," 个结果"]})]}),e.jsx(_1,{paginatedModels:ha,allModels:l,onEdit:Ps,onDelete:Ee,isModelUsed:Vt,searchQuery:R}),e.jsx(S1,{paginatedModels:ha,allModels:l,filteredModels:nt,selectedModels:K,onEdit:Ps,onDelete:Ee,onToggleSelection:bs,onToggleSelectAll:Mt,isModelUsed:Vt,searchQuery:R}),e.jsx(T1,{page:xe,pageSize:_e,totalItems:nt.length,jumpToPage:Z,onPageChange:Ce,onPageSizeChange:Me,onJumpToPageChange:me,onJumpToPage:bt,onSelectionClear:()=>re(new Set)})]}),e.jsxs(Ms,{value:"tasks",className:"space-y-6 mt-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"为不同的任务配置使用的模型和参数"}),g&&e.jsxs("div",{className:"grid gap-4 sm:gap-6",children:[e.jsx(Da,{title:"组件模型 (utils)",description:"用于表情包、取名、关系、情绪变化等组件",taskConfig:g.utils,modelNames:h,onChange:(te,de)=>Ks("utils",te,de),dataTour:"task-model-select"}),e.jsx(Da,{title:"组件小模型 (utils_small)",description:"消耗量较大的组件,建议使用速度较快的小模型",taskConfig:g.utils_small,modelNames:h,onChange:(te,de)=>Ks("utils_small",te,de)}),e.jsx(Da,{title:"工具调用模型 (tool_use)",description:"需要使用支持工具调用的模型",taskConfig:g.tool_use,modelNames:h,onChange:(te,de)=>Ks("tool_use",te,de)}),e.jsx(Da,{title:"首要回复模型 (replyer)",description:"用于表达器和表达方式学习",taskConfig:g.replyer,modelNames:h,onChange:(te,de)=>Ks("replyer",te,de)}),e.jsx(Da,{title:"决策模型 (planner)",description:"负责决定麦麦该什么时候回复",taskConfig:g.planner,modelNames:h,onChange:(te,de)=>Ks("planner",te,de)}),e.jsx(Da,{title:"图像识别模型 (vlm)",description:"视觉语言模型",taskConfig:g.vlm,modelNames:h,onChange:(te,de)=>Ks("vlm",te,de),hideTemperature:!0}),e.jsx(Da,{title:"语音识别模型 (voice)",description:"语音转文字",taskConfig:g.voice,modelNames:h,onChange:(te,de)=>Ks("voice",te,de),hideTemperature:!0,hideMaxTokens:!0}),e.jsx(Da,{title:"嵌入模型 (embedding)",description:"用于向量化",taskConfig:g.embedding,modelNames:h,onChange:(te,de)=>Ks("embedding",te,de),hideTemperature:!0,hideMaxTokens:!0}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库模型"}),e.jsx(Da,{title:"实体提取模型 (lpmm_entity_extract)",description:"从文本中提取实体",taskConfig:g.lpmm_entity_extract,modelNames:h,onChange:(te,de)=>Ks("lpmm_entity_extract",te,de)}),e.jsx(Da,{title:"RDF 构建模型 (lpmm_rdf_build)",description:"构建知识图谱",taskConfig:g.lpmm_rdf_build,modelNames:h,onChange:(te,de)=>Ks("lpmm_rdf_build",te,de)}),e.jsx(Da,{title:"问答模型 (lpmm_qa)",description:"知识库问答",taskConfig:g.lpmm_qa,modelNames:h,onChange:(te,de)=>Ks("lpmm_qa",te,de)})]})]})]})]}),e.jsx(Gs,{open:G,onOpenChange:Ss,children:e.jsxs(Us,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto","data-tour":"model-dialog",preventOutsideClose:he,children:[e.jsxs(Bs,{children:[e.jsx(Hs,{children:fe!==null?"编辑模型":"添加模型"}),e.jsx(Ws,{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(C,{htmlFor:"model_name",className:ae.name?"text-destructive":"",children:"模型名称 *"}),e.jsx(ne,{id:"model_name",value:M?.name||"",onChange:te=>{Q(de=>de?{...de,name:te.target.value}:null),ae.name&&De(de=>({...de,name:void 0}))},placeholder:"例如: qwen3-30b",className:ae.name?"border-destructive focus-visible:ring-destructive":""}),ae.name?e.jsx("p",{className:"text-xs text-destructive",children:ae.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(C,{htmlFor:"api_provider",className:ae.api_provider?"text-destructive":"",children:"API 提供商 *"}),e.jsxs(Be,{value:M?.api_provider||"",onValueChange:te=>{Q(de=>de?{...de,api_provider:te}:null),lt(),ae.api_provider&&De(de=>({...de,api_provider:void 0}))},children:[e.jsx(Le,{id:"api_provider",className:ae.api_provider?"border-destructive focus-visible:ring-destructive":"",children:e.jsx(He,{placeholder:"选择提供商"})}),e.jsx(Ue,{children:r.map(te=>e.jsx(se,{value:te,children:te},te))})]}),ae.api_provider&&e.jsx("p",{className:"text-xs text-destructive",children:ae.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(C,{htmlFor:"model_identifier",className:ae.model_identifier?"text-destructive":"",children:"模型标识符 *"}),zt?.modelFetcher&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Qe,{variant:"secondary",className:"text-xs",children:zt.display_name}),e.jsx(_,{variant:"ghost",size:"sm",className:"h-6 px-2",onClick:()=>M?.api_provider&&Es(M.api_provider,!0),disabled:jt,children:jt?e.jsx(xt,{className:"h-3 w-3 animate-spin"}):e.jsx(qt,{className:"h-3 w-3"})})]})]}),zt?.modelFetcher?e.jsxs(Ya,{open:ke,onOpenChange:X,children:[e.jsx(Ka,{asChild:!0,children:e.jsxs(_,{variant:"outline",role:"combobox","aria-expanded":ke,className:"w-full justify-between font-normal",disabled:jt||!!Qs,children:[jt?e.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(xt,{className:"h-4 w-4 animate-spin"}),"正在获取模型列表..."]}):Qs?e.jsx("span",{className:"text-muted-foreground text-sm",children:"点击下方输入框手动填写"}):M?.model_identifier?e.jsx("span",{className:"truncate",children:M.model_identifier}):e.jsx("span",{className:"text-muted-foreground",children:"搜索或选择模型..."}),e.jsx(im,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(Ba,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:e.jsxs(go,{children:[e.jsx(jo,{placeholder:"搜索模型..."}),e.jsx(Ze,{className:"h-[300px]",children:e.jsxs(vo,{className:"max-h-none overflow-visible",children:[e.jsx(bo,{children:Qs?e.jsxs("div",{className:"py-4 px-2 text-center space-y-2",children:[e.jsx("p",{className:"text-sm text-destructive",children:Qs}),!Qs.includes("API Key")&&e.jsx(_,{variant:"link",size:"sm",onClick:()=>M?.api_provider&&Es(M.api_provider,!0),children:"重试"})]}):"未找到匹配的模型"}),e.jsx(yr,{heading:"可用模型",children:Ge.map(te=>e.jsxs(wr,{value:te.id,onSelect:()=>{Q(de=>de?{...de,model_identifier:te.id}:null),X(!1)},children:[e.jsx(sa,{className:`mr-2 h-4 w-4 ${M?.model_identifier===te.id?"opacity-100":"opacity-0"}`}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{children:te.id}),te.name!==te.id&&e.jsx("span",{className:"text-xs text-muted-foreground",children:te.name})]})]},te.id))}),e.jsx(yr,{heading:"手动输入",children:e.jsxs(wr,{value:"__manual_input__",onSelect:()=>{X(!1)},children:[e.jsx(pn,{className:"mr-2 h-4 w-4"}),"手动输入模型标识符..."]})})]})})]})})]}):e.jsx(ne,{id:"model_identifier",value:M?.model_identifier||"",onChange:te=>{Q(de=>de?{...de,model_identifier:te.target.value}:null),ae.model_identifier&&De(de=>({...de,model_identifier:void 0}))},placeholder:"Qwen/Qwen3-30B-A3B-Instruct-2507",className:ae.model_identifier?"border-destructive focus-visible:ring-destructive":""}),ae.model_identifier&&e.jsx("p",{className:"text-xs text-destructive",children:ae.model_identifier}),Qs&&zt?.modelFetcher&&!ae.model_identifier&&e.jsxs(ta,{variant:"destructive",className:"mt-2 py-2",children:[e.jsx(Ia,{className:"h-4 w-4"}),e.jsx(aa,{className:"text-xs",children:Qs})]}),zt?.modelFetcher&&e.jsx(ne,{value:M?.model_identifier||"",onChange:te=>{Q(de=>de?{...de,model_identifier:te.target.value}:null),ae.model_identifier&&De(de=>({...de,model_identifier:void 0}))},placeholder:"或手动输入模型标识符",className:`mt-2 ${ae.model_identifier?"border-destructive focus-visible:ring-destructive":""}`}),!ae.model_identifier&&e.jsx("p",{className:"text-xs text-muted-foreground",children:Qs?'请手动输入模型标识符,或前往"模型提供商配置"检查 API Key':zt?.modelFetcher?`已识别为 ${zt.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(C,{htmlFor:"price_in",children:"输入价格 (¥/M token)"}),e.jsx(ne,{id:"price_in",type:"number",step:"0.1",min:"0",value:M?.price_in??"",onChange:te=>{const de=te.target.value===""?null:parseFloat(te.target.value);Q(Ns=>Ns?{...Ns,price_in:de}:null)},placeholder:"默认: 0"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"price_out",children:"输出价格 (¥/M token)"}),e.jsx(ne,{id:"price_out",type:"number",step:"0.1",min:"0",value:M?.price_out??"",onChange:te=>{const de=te.target.value===""?null:parseFloat(te.target.value);Q(Ns=>Ns?{...Ns,price_out:de}:null)},placeholder:"默认: 0"})]})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{htmlFor:"enable_model_temperature",className:"cursor-pointer",children:"自定义模型温度"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后将覆盖「为模型分配功能」中的任务温度配置"})]}),e.jsx(Ve,{id:"enable_model_temperature",checked:M?.temperature!=null,onCheckedChange:te=>{Q(te?de=>de?{...de,temperature:.5}:null:de=>de?{...de,temperature:null}:null)}})]}),M?.temperature!=null&&e.jsxs("div",{className:"space-y-2 pt-2 border-t",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{className:"text-sm",children:"温度值"}),e.jsx("span",{className:"text-sm font-medium tabular-nums",children:M.temperature.toFixed(1)})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"0"}),e.jsx(Ca,{value:[M.temperature],onValueChange:te=>Q(de=>de?{...de,temperature:te[0]}:null),min:0,max:1,step:.1,className:"flex-1"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"1"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"较低的温度(0.1-0.3)产生更确定的输出,较高的温度(0.7-1.0)产生更多样化的输出"})]})]}),e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{htmlFor:"enable_model_max_tokens",className:"cursor-pointer",children:"自定义最大 Token"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后将覆盖「为模型分配功能」中的任务最大 Token 配置"})]}),e.jsx(Ve,{id:"enable_model_max_tokens",checked:M?.max_tokens!=null,onCheckedChange:te=>{Q(te?de=>de?{...de,max_tokens:2048}:null:de=>de?{...de,max_tokens:null}:null)}})]}),M?.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(C,{className:"text-sm",children:"最大 Token 数"}),e.jsx(ne,{type:"number",min:"1",max:"128000",value:M.max_tokens,onChange:te=>{const de=parseInt(te.target.value);!isNaN(de)&&de>=1&&Q(Ns=>Ns?{...Ns,max_tokens:de}: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(Ve,{id:"force_stream_mode",checked:M?.force_stream_mode||!1,onCheckedChange:te=>Q(de=>de?{...de,force_stream_mode:te}:null)}),e.jsx(C,{htmlFor:"force_stream_mode",className:"cursor-pointer",children:"强制流式输出模式"})]}),e.jsx(N1,{value:M?.extra_params||{},onChange:te=>Q(de=>de?{...de,extra_params:te}:null),placeholder:"添加额外参数(如 enable_thinking、top_p 等)..."})]}),e.jsxs(tt,{children:[e.jsx(_,{variant:"outline",onClick:()=>z(!1),"data-tour":"model-cancel-button",children:"取消"}),e.jsx(_,{onClick:we,"data-tour":"model-save-button",children:"保存"})]})]})}),e.jsx(ms,{open:ge,onOpenChange:be,children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:['确定要删除模型 "',je!==null?l[je]?.name:"",'" 吗? 此操作无法撤销。']})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:xs,children:"删除"})]})]})}),e.jsx(ms,{open:T,onOpenChange:ie,children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认批量删除"}),e.jsxs(os,{children:["确定要删除选中的 ",K.size," 个模型吗? 此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:vt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),k&&e.jsx(um,{onRestartComplete:Ke,onRestartFailed:$s})]})})}const _r=GN,Sr=FN,Cr=VN,No="/api/webui/config";async function O1(){const i=await(await Te(`${No}/adapter-config/path`)).json();return!i.success||!i.path?null:{path:i.path,lastModified:i.lastModified}}async function Mp(l){const r=await(await Te(`${No}/adapter-config/path`,{method:"POST",headers:Fs(),body:JSON.stringify({path:l})})).json();if(!r.success)throw new Error(r.message||"保存路径失败")}async function Ap(l){const r=await(await Te(`${No}/adapter-config?path=${encodeURIComponent(l)}`)).json();if(!r.success)throw new Error("读取配置文件失败");return r.content}async function Op(l,i){const o=await(await Te(`${No}/adapter-config`,{method:"POST",headers:Fs(),body:JSON.stringify({path:l,content:i})})).json();if(!o.success)throw new Error(o.message||"保存配置失败")}const ot={inner:{version:"0.1.2"},nickname:{nickname:""},napcat_server:{host:"localhost",port:8095,token:"",heartbeat_interval:30},maibot_server:{host:"localhost",port:8e3},chat:{group_list_type:"whitelist",group_list:[],private_list_type:"whitelist",private_list:[],ban_user_id:[],ban_qq_bot:!1,enable_poke:!0},voice:{use_tts:!1},debug:{level:"INFO"}},Iu={oneclick:{name:"一键包",description:"使用一键包部署的适配器配置",path:"../MaiBot-Napcat-Adapter/config.toml",icon:Ql},docker:{name:"Docker",description:"Docker Compose 部署的适配器配置",path:"/MaiMBot/adapters-config/config.toml",icon:Hy}};function D1(l,i){let r=l.slice(0,i).split(/\r\n|\n|\r/g);return[r.length,r.pop().length+1]}function R1(l,i,r){let o=l.split(/\r\n|\n|\r/g),u="",x=(Math.log10(i+1)|0)+1;for(let h=i-1;h<=i+1;h++){let f=o[h-1];f&&(u+=h.toString().padEnd(x," "),u+=": ",u+=f,u+=` `,h===i&&(u+=" ".repeat(x+r+2),u+=`^ -`))}return u}class gs extends Error{line;column;codeblock;constructor(i,r){const[o,u]=O1(r.toml,r.ptr),x=D1(r.toml,o,u);super(`Invalid TOML document: ${i} +`))}return u}class gs extends Error{line;column;codeblock;constructor(i,r){const[o,u]=D1(r.toml,r.ptr),x=R1(r.toml,o,u);super(`Invalid TOML document: ${i} -${x}`,r),this.line=o,this.column=u,this.codeblock=x}}function R1(l,i){let r=0;for(;l[i-++r]==="\\";);return--r&&r%2}function oo(l,i=0,r=l.length){let o=l.indexOf(` -`,i);return l[o-1]==="\r"&&o--,o<=r?o:-1}function mm(l,i){for(let r=i;r-1&&r!=="'"&&R1(l,i));return i>-1&&(i+=o.length,o.length>1&&(l[i]===r&&i++,l[i]===r&&i++)),i}let L1=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}:\d{2}(?:\.\d+)?)?(Z|[-+]\d{2}:\d{2})?$/i;class ci extends Date{#s=!1;#t=!1;#e=null;constructor(i){let r=!0,o=!0,u="Z";if(typeof i=="string"){let x=i.match(L1);x?(x[1]||(r=!1,i=`0000-01-01T${i}`),o=!!x[2],o&&i[10]===" "&&(i=i.replace(" ","T")),x[2]&&+x[2]>23?i="":(u=x[3]||null,i=i.toUpperCase(),!u&&o&&(i+="Z"))):i=""}super(i),isNaN(this.getTime())||(this.#s=r,this.#t=o,this.#e=u)}isDateTime(){return this.#s&&this.#t}isLocal(){return!this.#s||!this.#t||!this.#e}isDate(){return this.#s&&!this.#t}isTime(){return this.#t&&!this.#s}isValid(){return this.#s||this.#t}toISOString(){let i=super.toISOString();if(this.isDate())return i.slice(0,10);if(this.isTime())return i.slice(11,23);if(this.#e===null)return i.slice(0,-1);if(this.#e==="Z")return i;let r=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return r=this.#e[0]==="-"?r:-r,new Date(this.getTime()-r*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(i,r="Z"){let o=new ci(i);return o.#e=r,o}static wrapAsLocalDateTime(i){let r=new ci(i);return r.#e=null,r}static wrapAsLocalDate(i){let r=new ci(i);return r.#t=!1,r.#e=null,r}static wrapAsLocalTime(i){let r=new ci(i);return r.#s=!1,r.#e=null,r}}let U1=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,B1=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,H1=/^[+-]?0[0-9_]/,$1=/^[0-9a-f]{4,8}$/i,Rp={b:"\b",t:" ",n:` -`,f:"\f",r:"\r",'"':'"',"\\":"\\"};function uj(l,i=0,r=l.length){let o=l[i]==="'",u=l[i++]===l[i]&&l[i]===l[i+1];u&&(r-=2,l[i+=2]==="\r"&&i++,l[i]===` -`&&i++);let x=0,h,p="",g=i;for(;i-1&&(mm(l,x),u=u.slice(0,x));let h=u.trimEnd();if(!o){let p=u.indexOf(` -`,h.length);if(p>-1)throw new gs("newlines are not allowed in inline tables",{toml:l,ptr:i+p})}return[h,x]}function xm(l,i,r,o,u){if(o===0)throw new gs("document contains excessively nested structures. aborting.",{toml:l,ptr:i});let x=l[i];if(x==="["||x==="{"){let[g,v]=x==="["?I1(l,i,o,u):V1(l,i,o,u),j=r?Dp(l,v,",",r):v;if(v-j&&r==="}"){let N=oo(l,v,j);if(N>-1)throw new gs("newlines are not allowed in inline tables",{toml:l,ptr:N})}return[g,j]}let h;if(x==='"'||x==="'"){h=dj(l,i);let g=uj(l,i,h);if(r){if(h=pl(l,h,r!=="]"),l[h]&&l[h]!==","&&l[h]!==r&&l[h]!==` -`&&l[h]!=="\r")throw new gs("unexpected character encountered",{toml:l,ptr:h});h+=+(l[h]===",")}return[g,h]}h=Dp(l,i,",",r);let p=G1(l,i,h-+(l[h-1]===","),r==="]");if(!p[0])throw new gs("incomplete key-value declaration: no value specified",{toml:l,ptr:i});return r&&p[1]>-1&&(h=pl(l,i+p[1]),h+=+(l[h]===",")),[q1(p[0],l,i,u),h]}let F1=/^[a-zA-Z0-9-_]+[ \t]*$/;function sm(l,i,r="="){let o=i-1,u=[],x=l.indexOf(r,i);if(x<0)throw new gs("incomplete key-value: cannot find end of key",{toml:l,ptr:i});do{let h=l[i=++o];if(h!==" "&&h!==" ")if(h==='"'||h==="'"){if(h===l[i+1]&&h===l[i+2])throw new gs("multiline strings are not allowed in keys",{toml:l,ptr:i});let p=dj(l,i);if(p<0)throw new gs("unfinished string encountered",{toml:l,ptr:i});o=l.indexOf(".",p);let g=l.slice(p,o<0||o>x?x:o),v=oo(g);if(v>-1)throw new gs("newlines are not allowed in keys",{toml:l,ptr:i+o+v});if(g.trimStart())throw new gs("found extra tokens after the string part",{toml:l,ptr:p});if(xx?x:o);if(!F1.test(p))throw new gs("only letter, numbers, dashes and underscores are allowed in keys",{toml:l,ptr:i});u.push(p.trimEnd())}}while(o+1&&o-1&&r!=="'"&&L1(l,i));return i>-1&&(i+=o.length,o.length>1&&(l[i]===r&&i++,l[i]===r&&i++)),i}let U1=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}:\d{2}(?:\.\d+)?)?(Z|[-+]\d{2}:\d{2})?$/i;class ci extends Date{#s=!1;#t=!1;#e=null;constructor(i){let r=!0,o=!0,u="Z";if(typeof i=="string"){let x=i.match(U1);x?(x[1]||(r=!1,i=`0000-01-01T${i}`),o=!!x[2],o&&i[10]===" "&&(i=i.replace(" ","T")),x[2]&&+x[2]>23?i="":(u=x[3]||null,i=i.toUpperCase(),!u&&o&&(i+="Z"))):i=""}super(i),isNaN(this.getTime())||(this.#s=r,this.#t=o,this.#e=u)}isDateTime(){return this.#s&&this.#t}isLocal(){return!this.#s||!this.#t||!this.#e}isDate(){return this.#s&&!this.#t}isTime(){return this.#t&&!this.#s}isValid(){return this.#s||this.#t}toISOString(){let i=super.toISOString();if(this.isDate())return i.slice(0,10);if(this.isTime())return i.slice(11,23);if(this.#e===null)return i.slice(0,-1);if(this.#e==="Z")return i;let r=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return r=this.#e[0]==="-"?r:-r,new Date(this.getTime()-r*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(i,r="Z"){let o=new ci(i);return o.#e=r,o}static wrapAsLocalDateTime(i){let r=new ci(i);return r.#e=null,r}static wrapAsLocalDate(i){let r=new ci(i);return r.#t=!1,r.#e=null,r}static wrapAsLocalTime(i){let r=new ci(i);return r.#s=!1,r.#e=null,r}}let B1=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,H1=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,$1=/^[+-]?0[0-9_]/,q1=/^[0-9a-f]{4,8}$/i,Rp={b:"\b",t:" ",n:` +`,f:"\f",r:"\r",'"':'"',"\\":"\\"};function yj(l,i=0,r=l.length){let o=l[i]==="'",u=l[i++]===l[i]&&l[i]===l[i+1];u&&(r-=2,l[i+=2]==="\r"&&i++,l[i]===` +`&&i++);let x=0,h,f="",g=i;for(;i-1&&(xm(l,x),u=u.slice(0,x));let h=u.trimEnd();if(!o){let f=u.indexOf(` +`,h.length);if(f>-1)throw new gs("newlines are not allowed in inline tables",{toml:l,ptr:i+f})}return[h,x]}function hm(l,i,r,o,u){if(o===0)throw new gs("document contains excessively nested structures. aborting.",{toml:l,ptr:i});let x=l[i];if(x==="["||x==="{"){let[g,j]=x==="["?Q1(l,i,o,u):I1(l,i,o,u),v=r?Dp(l,j,",",r):j;if(j-v&&r==="}"){let N=uo(l,j,v);if(N>-1)throw new gs("newlines are not allowed in inline tables",{toml:l,ptr:N})}return[g,v]}let h;if(x==='"'||x==="'"){h=Nj(l,i);let g=yj(l,i,h);if(r){if(h=pl(l,h,r!=="]"),l[h]&&l[h]!==","&&l[h]!==r&&l[h]!==` +`&&l[h]!=="\r")throw new gs("unexpected character encountered",{toml:l,ptr:h});h+=+(l[h]===",")}return[g,h]}h=Dp(l,i,",",r);let f=F1(l,i,h-+(l[h-1]===","),r==="]");if(!f[0])throw new gs("incomplete key-value declaration: no value specified",{toml:l,ptr:i});return r&&f[1]>-1&&(h=pl(l,i+f[1]),h+=+(l[h]===",")),[G1(f[0],l,i,u),h]}let V1=/^[a-zA-Z0-9-_]+[ \t]*$/;function tm(l,i,r="="){let o=i-1,u=[],x=l.indexOf(r,i);if(x<0)throw new gs("incomplete key-value: cannot find end of key",{toml:l,ptr:i});do{let h=l[i=++o];if(h!==" "&&h!==" ")if(h==='"'||h==="'"){if(h===l[i+1]&&h===l[i+2])throw new gs("multiline strings are not allowed in keys",{toml:l,ptr:i});let f=Nj(l,i);if(f<0)throw new gs("unfinished string encountered",{toml:l,ptr:i});o=l.indexOf(".",f);let g=l.slice(f,o<0||o>x?x:o),j=uo(g);if(j>-1)throw new gs("newlines are not allowed in keys",{toml:l,ptr:i+o+j});if(g.trimStart())throw new gs("found extra tokens after the string part",{toml:l,ptr:f});if(xx?x:o);if(!V1.test(f))throw new gs("only letter, numbers, dashes and underscores are allowed in keys",{toml:l,ptr:i});u.push(f.trimEnd())}}while(o+1&&ou===""||u===null||u===void 0?x:u,r={inner:{version:i(l.inner.version,ot.inner.version)},nickname:{nickname:i(l.nickname.nickname,ot.nickname.nickname)},napcat_server:{host:i(l.napcat_server.host,ot.napcat_server.host),port:i(l.napcat_server.port||0,ot.napcat_server.port),token:i(l.napcat_server.token,ot.napcat_server.token),heartbeat_interval:i(l.napcat_server.heartbeat_interval||0,ot.napcat_server.heartbeat_interval)},maibot_server:{host:i(l.maibot_server.host,ot.maibot_server.host),port:i(l.maibot_server.port||0,ot.maibot_server.port)},chat:{group_list_type:i(l.chat.group_list_type,ot.chat.group_list_type),group_list:l.chat.group_list||[],private_list_type:i(l.chat.private_list_type,ot.chat.private_list_type),private_list:l.chat.private_list||[],ban_user_id:l.chat.ban_user_id||[],ban_qq_bot:l.chat.ban_qq_bot??ot.chat.ban_qq_bot,enable_poke:l.chat.enable_poke??ot.chat.enable_poke},voice:{use_tts:l.voice.use_tts??ot.voice.use_tts},debug:{level:i(l.debug.level,ot.debug.level)}};let o=P1(r);return o=Z1(o),o}catch(i){throw console.error("TOML 生成失败:",i),new Error(`无法生成 TOML 文件: ${i instanceof Error?i.message:"未知错误"}`)}}function Z1(l){const i=l.split(` +`:o}function Qu(l){try{const i=Y1(l);return{inner:{...ot.inner,...i.inner},nickname:{...ot.nickname,...i.nickname},napcat_server:{...ot.napcat_server,...i.napcat_server},maibot_server:{...ot.maibot_server,...i.maibot_server},chat:{...ot.chat,...i.chat},voice:{...ot.voice,...i.voice},debug:{...ot.debug,...i.debug}}}catch(i){throw console.error("TOML 解析失败:",i),new Error(`无法解析 TOML 文件: ${i instanceof Error?i.message:"未知错误"}`)}}function Yu(l){try{const i=(u,x)=>u===""||u===null||u===void 0?x:u,r={inner:{version:i(l.inner.version,ot.inner.version)},nickname:{nickname:i(l.nickname.nickname,ot.nickname.nickname)},napcat_server:{host:i(l.napcat_server.host,ot.napcat_server.host),port:i(l.napcat_server.port||0,ot.napcat_server.port),token:i(l.napcat_server.token,ot.napcat_server.token),heartbeat_interval:i(l.napcat_server.heartbeat_interval||0,ot.napcat_server.heartbeat_interval)},maibot_server:{host:i(l.maibot_server.host,ot.maibot_server.host),port:i(l.maibot_server.port||0,ot.maibot_server.port)},chat:{group_list_type:i(l.chat.group_list_type,ot.chat.group_list_type),group_list:l.chat.group_list||[],private_list_type:i(l.chat.private_list_type,ot.chat.private_list_type),private_list:l.chat.private_list||[],ban_user_id:l.chat.ban_user_id||[],ban_qq_bot:l.chat.ban_qq_bot??ot.chat.ban_qq_bot,enable_poke:l.chat.enable_poke??ot.chat.enable_poke},voice:{use_tts:l.voice.use_tts??ot.voice.use_tts},debug:{level:i(l.debug.level,ot.debug.level)}};let o=Z1(r);return o=W1(o),o}catch(i){throw console.error("TOML 生成失败:",i),new Error(`无法生成 TOML 文件: ${i instanceof Error?i.message:"未知错误"}`)}}function W1(l){const i=l.split(` `),r=[];for(let o=0;o"|?*\x00-\x1F]/.test(l)?{valid:!1,error:"路径包含非法字符"}:{valid:!0,error:""}}function W1(){const[l,i]=m.useState("upload"),[r,o]=m.useState(null),[u,x]=m.useState(""),[h,p]=m.useState(""),[g,v]=m.useState("oneclick"),[j,N]=m.useState(""),[y,S]=m.useState(!1),[w,R]=m.useState(!1),[O,U]=m.useState(!1),[G,L]=m.useState(!1),[T,F]=m.useState(null),[q,z]=m.useState(!1),M=m.useRef(null),{toast:Q}=Vs(),fe=m.useRef(null),ve=Z=>{if(p(Z),Z.trim()){const me=Yu(Z);N(me.error)}else N("")},ge=m.useCallback(async Z=>{const me=Vu[Z];R(!0);try{const ke=await Ap(me.path),X=Iu(ke);o(X),v(Z),p(me.path),await Mp(me.path),Q({title:"加载成功",description:`已从${me.name}预设加载配置`})}catch(ke){console.error("加载预设配置失败:",ke),Q({title:"加载失败",description:ke instanceof Error?ke.message:"无法读取预设配置文件",variant:"destructive"})}finally{R(!1)}},[Q]),be=m.useCallback(async Z=>{const me=Yu(Z);if(!me.valid){N(me.error),Q({title:"路径无效",description:me.error,variant:"destructive"});return}N(""),R(!0);try{const ke=await Ap(Z),X=Iu(ke);o(X),p(Z),await Mp(Z),Q({title:"加载成功",description:"已从配置文件加载"})}catch(ke){console.error("加载配置失败:",ke),Q({title:"加载失败",description:ke instanceof Error?ke.message:"无法读取配置文件",variant:"destructive"})}finally{R(!1)}},[Q]);m.useEffect(()=>{(async()=>{try{const me=await A1();if(me&&me.path){p(me.path);const ke=Object.entries(Vu).find(([,X])=>X.path===me.path);ke?(i("preset"),v(ke[0]),await ge(ke[0])):(i("path"),await be(me.path))}}catch(me){console.error("加载保存的路径失败:",me)}})()},[be,ge]);const je=m.useCallback(Z=>{l!=="path"&&l!=="preset"||!h||(fe.current&&clearTimeout(fe.current),fe.current=setTimeout(async()=>{S(!0);try{const me=Qu(Z);await Op(h,me),Q({title:"自动保存成功",description:"配置已保存到文件"})}catch(me){console.error("自动保存失败:",me),Q({title:"自动保存失败",description:me instanceof Error?me.message:"保存配置失败",variant:"destructive"})}finally{S(!1)}},1e3))},[l,h,Q]),Ne=async()=>{if(!r||!h)return;const Z=Yu(h);if(!Z.valid){Q({title:"保存失败",description:Z.error,variant:"destructive"});return}S(!0);try{const me=Qu(r);await Op(h,me),Q({title:"保存成功",description:"配置已保存到文件"})}catch(me){console.error("保存失败:",me),Q({title:"保存失败",description:me instanceof Error?me.message:"保存配置失败",variant:"destructive"})}finally{S(!1)}},D=async()=>{h&&await be(h)},Y=Z=>{if(Z!==l){if(r){F(Z),U(!0);return}K(Z)}},K=Z=>{o(null),x(""),N(""),i(Z),Z==="preset"&&ge("oneclick"),Q({title:"已切换模式",description:{upload:"现在可以上传配置文件",path:"现在可以指定配置文件路径",preset:"现在可以使用预设配置"}[Z]})},re=()=>{T&&(K(T),F(null)),U(!1)},k=()=>{if(r){L(!0);return}ne()},ne=()=>{p(""),o(null),N(""),Q({title:"已清空",description:"路径和配置已清空"})},xe=()=>{ne(),L(!1)},Ce=Z=>{const me=Z.target.files?.[0];if(!me)return;const ke=new FileReader;ke.onload=X=>{try{const ae=X.target?.result,De=Iu(ae);o(De),x(me.name),Q({title:"上传成功",description:`已加载配置文件:${me.name}`})}catch(ae){console.error("解析配置文件失败:",ae),Q({title:"解析失败",description:"配置文件格式错误,请检查文件内容",variant:"destructive"})}},ke.readAsText(me)},_e=()=>{if(!r)return;const Z=Qu(r),me=new Blob([Z],{type:"text/plain;charset=utf-8"}),ke=URL.createObjectURL(me),X=document.createElement("a");X.href=ke,X.download=u||"config.toml",document.body.appendChild(X),X.click(),document.body.removeChild(X),URL.revokeObjectURL(ke),Q({title:"下载成功",description:"配置文件已下载,请手动覆盖并重启适配器"})},Me=()=>{o(JSON.parse(JSON.stringify(ot))),x("config.toml"),Q({title:"已加载默认配置",description:"可以开始编辑配置"})};return e.jsx(Ze,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦适配器配置"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的 QQ 适配器的配置文件"})]})}),e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg border border-amber-500/50 bg-amber-500/10 text-amber-700 dark:text-amber-400",children:[e.jsx(Gt,{className:"h-4 w-4 mt-0.5 flex-shrink-0"}),e.jsx("p",{className:"text-sm",children:"适配器配置保存之后使用 WebUI 的重启功能适配器并不会重启,需要手动重启适配器。"})]}),e.jsx(_r,{open:q,onOpenChange:z,children:e.jsxs(Ve,{children:[e.jsx(as,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(ls,{children:"工作模式"}),e.jsx(st,{children:"选择配置文件的管理方式"})]}),e.jsx(Sr,{asChild:!0,children:e.jsxs(_,{variant:"ghost",size:"sm",className:"w-9 p-0",children:[e.jsx(Qa,{className:`h-4 w-4 transition-transform duration-200 ${q?"transform rotate-180":""}`}),e.jsx("span",{className:"sr-only",children:"切换"})]})})]})}),e.jsx(Cr,{children:e.jsxs(ps,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3 md:gap-4",children:[e.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${l==="preset"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>Y("preset"),children:e.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[e.jsx(Ql,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"预设模式"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"使用预设的部署配置"})]})]})}),e.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${l==="upload"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>Y("upload"),children:e.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[e.jsx(br,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"上传文件模式"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"上传配置文件,编辑后下载并手动覆盖"})]})]})}),e.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${l==="path"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>Y("path"),children:e.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[e.jsx(zy,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"指定路径模式"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"指定配置文件路径,自动加载和保存"})]})]})})]}),l==="preset"&&e.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[e.jsx(C,{className:"text-sm md:text-base",children:"选择部署方式"}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:Object.entries(Vu).map(([Z,me])=>{const ke=me.icon,X=g===Z;return e.jsx("div",{className:`border-2 rounded-lg p-3 cursor-pointer transition-all ${X?"border-primary bg-primary/5":"border-muted hover:border-primary/50"}`,onClick:()=>{v(Z),ge(Z)},children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(ke,{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:me.name}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:me.description}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 font-mono break-all",children:me.path})]})]})},Z)})})]}),l==="path"&&e.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"config-path",className:"text-sm md:text-base",children:"配置文件路径"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx(ie,{id:"config-path",value:h,onChange:Z=>ve(Z.target.value),placeholder:"例: C:\\Adapter\\config.toml",className:`text-sm ${j?"border-destructive":""}`}),j&&e.jsx("p",{className:"text-xs text-destructive",children:j})]}),e.jsx(_,{onClick:()=>be(h),disabled:w||!h||!!j,className:"w-full sm:w-auto",children:w?e.jsxs(e.Fragment,{children:[e.jsx(qt,{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(ta,{children:[e.jsx(Ia,{className:"h-4 w-4"}),e.jsx(aa,{children:l==="preset"?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"预设模式:"}),"选择预设的部署方式,配置会自动加载,修改后 1 秒自动保存",y&&" (正在保存...)"]}):l==="upload"?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"上传文件模式:"}),"上传配置文件 → 在线编辑 → 下载文件 → 手动覆盖并重启适配器"]}):e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"指定路径模式:"}),"指定配置文件路径后,配置会自动加载,修改后 1 秒自动保存",y&&" (正在保存...)"]})})]}),l==="upload"&&!r&&e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full",children:[e.jsx("input",{ref:M,type:"file",accept:".toml",className:"hidden",onChange:Ce}),e.jsxs(_,{onClick:()=>M.current?.click(),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(br,{className:"mr-2 h-4 w-4"}),"上传配置"]}),e.jsxs(_,{onClick:Me,size:"sm",className:"w-full sm:w-auto",children:[e.jsx(Ra,{className:"mr-2 h-4 w-4"}),"使用默认配置"]})]}),l==="upload"&&r&&e.jsx("div",{className:"flex gap-2",children:e.jsxs(_,{onClick:_e,size:"sm",className:"w-full sm:w-auto",children:[e.jsx(Ua,{className:"mr-2 h-4 w-4"}),"下载配置"]})}),(l==="preset"||l==="path")&&r&&e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs(_,{onClick:Ne,size:"sm",disabled:y||!!j,className:"w-full sm:w-auto",children:[e.jsx(Tr,{className:"mr-2 h-4 w-4"}),y?"保存中...":"立即保存"]}),e.jsxs(_,{onClick:D,size:"sm",variant:"outline",disabled:w,className:"w-full sm:w-auto",children:[e.jsx(qt,{className:`mr-2 h-4 w-4 ${w?"animate-spin":""}`}),"刷新"]}),l==="path"&&e.jsxs(_,{onClick:k,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(es,{className:"mr-2 h-4 w-4"}),"清空路径"]})]}),r?e.jsxs(ka,{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(xa,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5",children:[e.jsxs(ts,{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(ts,{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(ts,{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(ts,{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(ts,{value:"debug",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:"调试"})]})}),e.jsx(Ms,{value:"napcat",className:"space-y-4",children:e.jsx(e2,{config:r,onChange:Z=>{o(Z),je(Z)}})}),e.jsx(Ms,{value:"maibot",className:"space-y-4",children:e.jsx(s2,{config:r,onChange:Z=>{o(Z),je(Z)}})}),e.jsx(Ms,{value:"chat",className:"space-y-4",children:e.jsx(t2,{config:r,onChange:Z=>{o(Z),je(Z)}})}),e.jsx(Ms,{value:"voice",className:"space-y-4",children:e.jsx(a2,{config:r,onChange:Z=>{o(Z),je(Z)}})}),e.jsx(Ms,{value:"debug",className:"space-y-4",children:e.jsx(l2,{config:r,onChange:Z=>{o(Z),je(Z)}})})]}):e.jsx("div",{className:"rounded-lg border bg-card p-6 md:p-12",children:e.jsxs("div",{className:"text-center space-y-3 md:space-y-4",children:[e.jsx(Ra,{className:"h-12 w-12 md:h-16 md:w-16 mx-auto text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold",children:"尚未加载配置"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-2 px-4",children:l==="preset"?"请选择预设的部署方式":l==="upload"?"请上传现有配置文件,或使用默认配置开始编辑":"请指定配置文件路径并点击加载按钮"})]})]})}),e.jsx(ms,{open:O,onOpenChange:U,children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认切换模式"}),e.jsxs(os,{children:["切换模式将清空当前配置,确定要继续吗?",e.jsx("br",{}),e.jsx("span",{className:"text-destructive font-medium",children:"请确保已保存重要配置"})]})]}),e.jsxs(rs,{children:[e.jsx(us,{onClick:()=>{U(!1),F(null)},children:"取消"}),e.jsx(ds,{onClick:re,children:"确认切换"})]})]})}),e.jsx(ms,{open:G,onOpenChange:L,children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认清空路径"}),e.jsxs(os,{children:["清空路径将清除当前配置,确定要继续吗?",e.jsx("br",{}),e.jsx("span",{className:"text-muted-foreground text-sm",children:"此操作不会删除配置文件,只是清除界面中的配置"})]})]}),e.jsxs(rs,{children:[e.jsx(us,{onClick:()=>L(!1),children:"取消"}),e.jsx(ds,{onClick:xe,className:"bg-destructive hover:bg-destructive/90",children:"确认清空"})]})]})})]})})}function e2({config:l,onChange:i}){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(C,{htmlFor:"napcat-host",className:"text-sm md:text-base",children:"主机地址"}),e.jsx(ie,{id:"napcat-host",value:l.napcat_server.host,onChange:r=>i({...l,napcat_server:{...l.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(C,{htmlFor:"napcat-port",className:"text-sm md:text-base",children:"端口"}),e.jsx(ie,{id:"napcat-port",type:"number",value:l.napcat_server.port||"",onChange:r=>i({...l,napcat_server:{...l.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(C,{htmlFor:"napcat-token",className:"text-sm md:text-base",children:"访问令牌(Token)"}),e.jsx(ie,{id:"napcat-token",type:"password",value:l.napcat_server.token,onChange:r=>i({...l,napcat_server:{...l.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(C,{htmlFor:"napcat-heartbeat",className:"text-sm md:text-base",children:"心跳间隔(秒)"}),e.jsx(ie,{id:"napcat-heartbeat",type:"number",value:l.napcat_server.heartbeat_interval||"",onChange:r=>i({...l,napcat_server:{...l.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 s2({config:l,onChange:i}){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(C,{htmlFor:"maibot-host",className:"text-sm md:text-base",children:"主机地址"}),e.jsx(ie,{id:"maibot-host",value:l.maibot_server.host,onChange:r=>i({...l,maibot_server:{...l.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(C,{htmlFor:"maibot-port",className:"text-sm md:text-base",children:"端口"}),e.jsx(ie,{id:"maibot-port",type:"number",value:l.maibot_server.port||"",onChange:r=>i({...l,maibot_server:{...l.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 t2({config:l,onChange:i}){const r=x=>{const h={...l};x==="group"?h.chat.group_list=[...h.chat.group_list,0]:x==="private"?h.chat.private_list=[...h.chat.private_list,0]:h.chat.ban_user_id=[...h.chat.ban_user_id,0],i(h)},o=(x,h)=>{const p={...l};x==="group"?p.chat.group_list=p.chat.group_list.filter((g,v)=>v!==h):x==="private"?p.chat.private_list=p.chat.private_list.filter((g,v)=>v!==h):p.chat.ban_user_id=p.chat.ban_user_id.filter((g,v)=>v!==h),i(p)},u=(x,h,p)=>{const g={...l};x==="group"?g.chat.group_list[h]=p:x==="private"?g.chat.private_list[h]=p:g.chat.ban_user_id[h]=p,i(g)};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(C,{className:"text-sm md:text-base",children:"群组名单类型"}),e.jsxs(Be,{value:l.chat.group_list_type,onValueChange:x=>i({...l,chat:{...l.chat,group_list_type:x}}),children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),e.jsx(se,{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(C,{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(Ra,{className:"mr-1 h-4 w-4"}),"添加群号"]})]}),l.chat.group_list.map((x,h)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ie,{type:"number",value:x,onChange:p=>u("group",h,parseInt(p.target.value)||0),placeholder:"输入群号",className:"text-sm md:text-base"}),e.jsxs(ms,{children:[e.jsx(ut,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(es,{className:"h-4 w-4"})})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:["确定要删除群号 ",x," 吗?此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>o("group",h),children:"删除"})]})]})]})]},h)),l.chat.group_list.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无群组"})]})]}),e.jsxs("div",{className:"space-y-3 md:space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-sm md:text-base",children:"私聊名单类型"}),e.jsxs(Be,{value:l.chat.private_list_type,onValueChange:x=>i({...l,chat:{...l.chat,private_list_type:x}}),children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),e.jsx(se,{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(C,{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(Ra,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),l.chat.private_list.map((x,h)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ie,{type:"number",value:x,onChange:p=>u("private",h,parseInt(p.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),e.jsxs(ms,{children:[e.jsx(ut,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(es,{className:"h-4 w-4"})})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:["确定要删除用户 ",x," 吗?此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>o("private",h),children:"删除"})]})]})]})]},h)),l.chat.private_list.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无用户"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[e.jsxs("div",{children:[e.jsx(C,{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(Ra,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),l.chat.ban_user_id.map((x,h)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ie,{type:"number",value:x,onChange:p=>u("ban",h,parseInt(p.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),e.jsxs(ms,{children:[e.jsx(ut,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(es,{className:"h-4 w-4"})})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:["确定要从全局禁止名单中删除用户 ",x," 吗?此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>o("ban",h),children:"删除"})]})]})]})]},h)),l.chat.ban_user_id.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无禁止用户"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-sm md:text-base",children:"屏蔽QQ官方机器人"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否屏蔽来自QQ官方机器人的消息"})]}),e.jsx(Fe,{checked:l.chat.ban_qq_bot,onCheckedChange:x=>i({...l,chat:{...l.chat,ban_qq_bot:x}})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-sm md:text-base",children:"启用戳一戳功能"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否响应戳一戳消息"})]}),e.jsx(Fe,{checked:l.chat.enable_poke,onCheckedChange:x=>i({...l,chat:{...l.chat,enable_poke:x}})})]})]})]})})}function a2({config:l,onChange:i}){return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"发送语音设置"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-sm md:text-base",children:"使用 TTS 语音"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"请确保已配置 TTS 并有对应的适配器"})]}),e.jsx(Fe,{checked:l.voice.use_tts,onCheckedChange:r=>i({...l,voice:{use_tts:r}})})]})]})})}function l2({config:l,onChange:i}){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(C,{className:"text-sm md:text-base",children:"日志等级"}),e.jsxs(Be,{value:l.debug.level,onValueChange:r=>i({...l,debug:{level:r}}),children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"DEBUG",children:"DEBUG(调试)"}),e.jsx(se,{value:"INFO",children:"INFO(信息)"}),e.jsx(se,{value:"WARNING",children:"WARNING(警告)"}),e.jsx(se,{value:"ERROR",children:"ERROR(错误)"}),e.jsx(se,{value:"CRITICAL",children:"CRITICAL(严重)"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"设置适配器的日志输出等级"})]})})]})})}const n2=["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"],i2=/^(aria-|data-)/,xj=l=>Object.fromEntries(Object.entries(l).filter(([i])=>i2.test(i)||n2.includes(i)));function r2(l,i){const r=xj(l);return Object.keys(l).some(o=>!Object.hasOwn(r,o)&&l[o]!==i[o])}class c2 extends m.Component{container;plugin;componentDidMount(){this.installPlugin()}componentDidUpdate(i){if(i.uppy!==this.props.uppy)this.uninstallPlugin(i),this.installPlugin();else if(r2(this.props,i)){const{uppy:r,...o}={...this.props,target:this.container};this.plugin.setOptions(o)}}componentWillUnmount(){this.uninstallPlugin()}installPlugin(){const{uppy:i,...r}={id:"Dashboard",...this.props,inline:!0,target:this.container};i.use(m0,r),this.plugin=i.getPlugin(r.id)}uninstallPlugin(i=this.props){const{uppy:r}=i;r.removePlugin(this.plugin)}render(){return m.createElement("div",{className:"uppy-Container",ref:i=>{this.container=i},...xj(this.props)})}}function o2({src:l,alt:i="表情包",className:r,maxRetries:o=5,retryInterval:u=1500}){const[x,h]=m.useState("loading"),[p,g]=m.useState(0),[v,j]=m.useState(null),N=m.useCallback(async()=>{try{const y=await fetch(l,{credentials:"include"});if(y.status===202){h("generating"),p{g(R=>R+1)},u):h("error");return}if(!y.ok){h("error");return}const S=await y.blob(),w=URL.createObjectURL(S);j(w),h("loaded")}catch(y){console.error("加载缩略图失败:",y),h("error")}},[l,p,o,u]);return m.useEffect(()=>{h("loading"),g(0),j(null)},[l]),m.useEffect(()=>{N()},[N]),m.useEffect(()=>()=>{v&&URL.revokeObjectURL(v)},[v]),x==="loading"||x==="generating"?e.jsx(Vg,{className:H("w-full h-full",r)}):x==="error"||!v?e.jsx("div",{className:H("w-full h-full flex items-center justify-center bg-muted",r),children:e.jsx(Rg,{className:"h-8 w-8 text-muted-foreground"})}):e.jsx("img",{src:v,alt:i,className:H("w-full h-full object-contain",r)})}function hj({content:l,className:i=""}){return e.jsx("div",{className:`prose prose-sm dark:prose-invert max-w-none ${i}`,children:e.jsx(h0,{remarkPlugins:[p0,g0],rehypePlugins:[f0],components:{code({inline:r,className:o,children:u,...x}){return r?e.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-sm font-mono",...x,children:u}):e.jsx("code",{className:`${o} block bg-muted p-4 rounded-lg overflow-x-auto`,...x,children:u})},table({children:r,...o}){return e.jsx("div",{className:"overflow-x-auto",children:e.jsx("table",{className:"border-collapse border border-border",...o,children:r})})},th({children:r,...o}){return e.jsx("th",{className:"border border-border bg-muted px-4 py-2 text-left font-semibold",...o,children:r})},td({children:r,...o}){return e.jsx("td",{className:"border border-border px-4 py-2",...o,children:r})},a({children:r,...o}){return e.jsx("a",{className:"text-primary hover:underline",target:"_blank",rel:"noopener noreferrer",...o,children:r})},blockquote({children:r,...o}){return e.jsx("blockquote",{className:"border-l-4 border-primary pl-4 italic text-muted-foreground",...o,children:r})},h1({children:r,...o}){return e.jsx("h1",{className:"text-3xl font-bold mt-6 mb-4",...o,children:r})},h2({children:r,...o}){return e.jsx("h2",{className:"text-2xl font-bold mt-5 mb-3",...o,children:r})},h3({children:r,...o}){return e.jsx("h3",{className:"text-xl font-bold mt-4 mb-2",...o,children:r})},h4({children:r,...o}){return e.jsx("h4",{className:"text-lg font-semibold mt-3 mb-2",...o,children:r})},ul({children:r,...o}){return e.jsx("ul",{className:"list-disc list-inside space-y-1 my-2",...o,children:r})},ol({children:r,...o}){return e.jsx("ol",{className:"list-decimal list-inside space-y-1 my-2",...o,children:r})},p({children:r,...o}){return e.jsx("p",{className:"my-2 leading-relaxed",...o,children:r})},hr({...r}){return e.jsx("hr",{className:"my-4 border-border",...r})}},children:l})})}function d2({children:l,className:i}){return e.jsx(hj,{content:l,className:i})}const Ta="/api/webui/emoji";async function u2(l){const i=new URLSearchParams;l.page&&i.append("page",l.page.toString()),l.page_size&&i.append("page_size",l.page_size.toString()),l.search&&i.append("search",l.search),l.is_registered!==void 0&&i.append("is_registered",l.is_registered.toString()),l.is_banned!==void 0&&i.append("is_banned",l.is_banned.toString()),l.format&&i.append("format",l.format),l.sort_by&&i.append("sort_by",l.sort_by),l.sort_order&&i.append("sort_order",l.sort_order);const r=await Te(`${Ta}/list?${i}`,{});if(!r.ok)throw new Error(`获取表情包列表失败: ${r.statusText}`);return r.json()}async function m2(l){const i=await Te(`${Ta}/${l}`,{});if(!i.ok)throw new Error(`获取表情包详情失败: ${i.statusText}`);return i.json()}async function x2(l,i){const r=await Te(`${Ta}/${l}`,{method:"PATCH",body:JSON.stringify(i)});if(!r.ok)throw new Error(`更新表情包失败: ${r.statusText}`);return r.json()}async function h2(l){const i=await Te(`${Ta}/${l}`,{method:"DELETE"});if(!i.ok)throw new Error(`删除表情包失败: ${i.statusText}`);return i.json()}async function f2(){const l=await Te(`${Ta}/stats/summary`,{});if(!l.ok)throw new Error(`获取统计数据失败: ${l.statusText}`);return l.json()}async function p2(l){const i=await Te(`${Ta}/${l}/register`,{method:"POST"});if(!i.ok)throw new Error(`注册表情包失败: ${i.statusText}`);return i.json()}async function g2(l){const i=await Te(`${Ta}/${l}/ban`,{method:"POST"});if(!i.ok)throw new Error(`封禁表情包失败: ${i.statusText}`);return i.json()}function j2(l,i=!1){return i?`${Ta}/${l}/thumbnail?original=true`:`${Ta}/${l}/thumbnail`}function v2(l){return`${Ta}/${l}/thumbnail?original=true`}async function b2(l){const i=await Te(`${Ta}/batch/delete`,{method:"POST",body:JSON.stringify({emoji_ids:l})});if(!i.ok){const r=await i.json();throw new Error(r.detail||"批量删除失败")}return i.json()}function N2(){return`${Ta}/upload`}function y2(){const[l,i]=m.useState([]),[r,o]=m.useState(null),[u,x]=m.useState(!1),[h,p]=m.useState(1),[g,v]=m.useState(0),[j,N]=m.useState(20),[y,S]=m.useState("all"),[w,R]=m.useState("all"),[O,U]=m.useState("all"),[G,L]=m.useState("usage_count"),[T,F]=m.useState("desc"),[q,z]=m.useState(null),[M,Q]=m.useState(!1),[fe,ve]=m.useState(!1),[ge,be]=m.useState(!1),[je,Ne]=m.useState(new Set),[D,Y]=m.useState(!1),[K,re]=m.useState(""),[k,ne]=m.useState("medium"),[xe,Ce]=m.useState(!1),{toast:_e}=Vs(),Me=m.useCallback(async()=>{try{x(!0);const W=await u2({page:h,page_size:j,is_registered:y==="all"?void 0:y==="registered",is_banned:w==="all"?void 0:w==="banned",format:O==="all"?void 0:O,sort_by:G,sort_order:T});i(W.data),v(W.total)}catch(W){const Se=W instanceof Error?W.message:"加载表情包列表失败";_e({title:"错误",description:Se,variant:"destructive"})}finally{x(!1)}},[h,j,y,w,O,G,T,_e]),Z=async()=>{try{const W=await f2();o(W.data)}catch(W){console.error("加载统计数据失败:",W)}};m.useEffect(()=>{Me()},[Me]),m.useEffect(()=>{Z()},[]);const me=async W=>{try{const Se=await m2(W.id);z(Se.data),Q(!0)}catch(Se){const Ge=Se instanceof Error?Se.message:"加载详情失败";_e({title:"错误",description:Ge,variant:"destructive"})}},ke=W=>{z(W),ve(!0)},X=W=>{z(W),be(!0)},ae=async()=>{if(q)try{await h2(q.id),_e({title:"成功",description:"表情包已删除"}),be(!1),z(null),Me(),Z()}catch(W){const Se=W instanceof Error?W.message:"删除失败";_e({title:"错误",description:Se,variant:"destructive"})}},De=async W=>{try{await p2(W.id),_e({title:"成功",description:"表情包已注册"}),Me(),Z()}catch(Se){const Ge=Se instanceof Error?Se.message:"注册失败";_e({title:"错误",description:Ge,variant:"destructive"})}},_s=async W=>{try{await g2(W.id),_e({title:"成功",description:"表情包已封禁"}),Me(),Z()}catch(Se){const Ge=Se instanceof Error?Se.message:"封禁失败";_e({title:"错误",description:Ge,variant:"destructive"})}},E=W=>{const Se=new Set(je);Se.has(W)?Se.delete(W):Se.add(W),Ne(Se)},he=async()=>{try{const W=await b2(Array.from(je));_e({title:"批量删除完成",description:W.message}),Ne(new Set),Y(!1),Me(),Z()}catch(W){_e({title:"批量删除失败",description:W instanceof Error?W.message:"批量删除失败",variant:"destructive"})}},Xe=()=>{const W=parseInt(K),Se=Math.ceil(g/j);W>=1&&W<=Se?(p(W),re("")):_e({title:"无效的页码",description:`请输入1-${Se}之间的页码`,variant:"destructive"})},ye=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:()=>Ce(!0),className:"gap-2",children:[e.jsx(br,{className:"h-4 w-4"}),"上传表情包"]})]}),e.jsx(Ze,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[r&&e.jsxs("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[e.jsx(Ve,{children:e.jsxs(as,{className:"pb-2",children:[e.jsx(st,{children:"总数"}),e.jsx(ls,{className:"text-2xl",children:r.total})]})}),e.jsx(Ve,{children:e.jsxs(as,{className:"pb-2",children:[e.jsx(st,{children:"已注册"}),e.jsx(ls,{className:"text-2xl text-green-600",children:r.registered})]})}),e.jsx(Ve,{children:e.jsxs(as,{className:"pb-2",children:[e.jsx(st,{children:"已封禁"}),e.jsx(ls,{className:"text-2xl text-red-600",children:r.banned})]})}),e.jsx(Ve,{children:e.jsxs(as,{className:"pb-2",children:[e.jsx(st,{children:"未注册"}),e.jsx(ls,{className:"text-2xl text-gray-600",children:r.unregistered})]})})]}),e.jsxs(Ve,{children:[e.jsx(as,{children:e.jsxs(ls,{className:"flex items-center gap-2",children:[e.jsx(eo,{className:"h-5 w-5"}),"筛选和排序"]})}),e.jsxs(ps,{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(C,{children:"排序方式"}),e.jsxs(Be,{value:`${G}-${T}`,onValueChange:W=>{const[Se,Ge]=W.split("-");L(Se),F(Ge),p(1)},children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"usage_count-desc",children:"使用次数 (多→少)"}),e.jsx(se,{value:"usage_count-asc",children:"使用次数 (少→多)"}),e.jsx(se,{value:"register_time-desc",children:"注册时间 (新→旧)"}),e.jsx(se,{value:"register_time-asc",children:"注册时间 (旧→新)"}),e.jsx(se,{value:"record_time-desc",children:"记录时间 (新→旧)"}),e.jsx(se,{value:"record_time-asc",children:"记录时间 (旧→新)"}),e.jsx(se,{value:"last_used_time-desc",children:"最后使用 (新→旧)"}),e.jsx(se,{value:"last_used_time-asc",children:"最后使用 (旧→新)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:"注册状态"}),e.jsxs(Be,{value:y,onValueChange:W=>{S(W),p(1)},children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"all",children:"全部"}),e.jsx(se,{value:"registered",children:"已注册"}),e.jsx(se,{value:"unregistered",children:"未注册"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:"封禁状态"}),e.jsxs(Be,{value:w,onValueChange:W=>{R(W),p(1)},children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"all",children:"全部"}),e.jsx(se,{value:"banned",children:"已封禁"}),e.jsx(se,{value:"unbanned",children:"未封禁"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:"格式"}),e.jsxs(Be,{value:O,onValueChange:W=>{U(W),p(1)},children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"all",children:"全部"}),ye.map(W=>e.jsxs(se,{value:W,children:[W.toUpperCase()," (",r?.formats[W],")"]},W))]})]})]})]}),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:[je.size>0&&e.jsxs("span",{className:"text-sm text-muted-foreground",children:["已选择 ",je.size," 个表情包"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{className:"text-sm whitespace-nowrap",children:"卡片大小"}),e.jsxs(Be,{value:k,onValueChange:W=>ne(W),children:[e.jsx(Le,{className:"w-24",children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"small",children:"小"}),e.jsx(se,{value:"medium",children:"中"}),e.jsx(se,{value:"large",children:"大"})]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{htmlFor:"emoji-page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Be,{value:j.toString(),onValueChange:W=>{N(parseInt(W)),p(1),Ne(new Set)},children:[e.jsx(Le,{id:"emoji-page-size",className:"w-20",children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"20",children:"20"}),e.jsx(se,{value:"40",children:"40"}),e.jsx(se,{value:"60",children:"60"}),e.jsx(se,{value:"100",children:"100"})]})]}),je.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:()=>Y(!0),children:[e.jsx(es,{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:Me,disabled:u,children:[e.jsx(qt,{className:`h-4 w-4 mr-2 ${u?"animate-spin":""}`}),"刷新"]})})]})]}),e.jsxs(Ve,{children:[e.jsxs(as,{children:[e.jsx(ls,{children:"表情包列表"}),e.jsxs(st,{children:["共 ",g," 个表情包,当前第 ",h," 页"]})]}),e.jsxs(ps,{children:[l.length===0?e.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"暂无数据"}):e.jsx("div",{className:`grid gap-3 ${k==="small"?"grid-cols-3 sm:grid-cols-4 md:grid-cols-6 lg:grid-cols-8 xl:grid-cols-10":k==="medium"?"grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 xl:grid-cols-8":"grid-cols-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5"}`,children:l.map(W=>e.jsxs("div",{className:`group relative rounded-lg border bg-card overflow-hidden hover:ring-2 hover:ring-primary transition-all cursor-pointer ${je.has(W.id)?"ring-2 ring-primary bg-primary/5":""}`,onClick:()=>E(W.id),children:[e.jsx("div",{className:`absolute top-1 left-1 z-10 transition-opacity ${je.has(W.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 ${je.has(W.id)?"bg-primary border-primary text-primary-foreground":"bg-background/80 border-muted-foreground/50"}`,children:je.has(W.id)&&e.jsx(ma,{className:"h-3 w-3"})})}),e.jsxs("div",{className:"absolute top-1 right-1 z-10 flex flex-col gap-0.5",children:[W.is_registered&&e.jsx(Qe,{variant:"default",className:"bg-green-600 text-[10px] px-1 py-0",children:"已注册"}),W.is_banned&&e.jsx(Qe,{variant:"destructive",className:"text-[10px] px-1 py-0",children:"已封禁"})]}),e.jsx("div",{className:`aspect-square bg-muted flex items-center justify-center overflow-hidden ${k==="small"?"p-1":k==="medium"?"p-2":"p-3"}`,children:e.jsx(o2,{src:j2(W.id),alt:"表情包"})}),e.jsxs("div",{className:`border-t bg-card ${k==="small"?"p-1":"p-2"}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-1 text-xs text-muted-foreground mb-1",children:[e.jsx(Qe,{variant:"outline",className:"text-[10px] px-1 py-0",children:W.format.toUpperCase()}),e.jsxs("span",{className:"font-mono",children:[W.usage_count,"次"]})]}),e.jsxs("div",{className:`flex gap-1 justify-center opacity-0 group-hover:opacity-100 transition-opacity ${k==="small"?"flex-wrap":""}`,children:[e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Se=>{Se.stopPropagation(),ke(W)},title:"编辑",children:e.jsx(gn,{className:"h-3 w-3"})}),e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Se=>{Se.stopPropagation(),me(W)},title:"详情",children:e.jsx(Ia,{className:"h-3 w-3"})}),!W.is_registered&&e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6 text-green-600 hover:text-green-700",onClick:Se=>{Se.stopPropagation(),De(W)},title:"注册",children:e.jsx(ma,{className:"h-3 w-3"})}),!W.is_banned&&e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6 text-orange-600 hover:text-orange-700",onClick:Se=>{Se.stopPropagation(),_s(W)},title:"封禁",children:e.jsx(My,{className:"h-3 w-3"})}),e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6 text-red-600 hover:text-red-700",onClick:Se=>{Se.stopPropagation(),X(W)},title:"删除",children:e.jsx(es,{className:"h-3 w-3"})})]})]})]},W.id))}),g>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)*j+1," 到"," ",Math.min(h*j,g)," 条,共 ",g," 条"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>p(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(fi,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>p(W=>Math.max(1,W-1)),disabled:h===1,children:[e.jsx(jl,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ie,{type:"number",value:K,onChange:W=>re(W.target.value),onKeyDown:W=>W.key==="Enter"&&Xe(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(g/j)}),e.jsx(_,{variant:"outline",size:"sm",onClick:Xe,disabled:!K,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>p(W=>W+1),disabled:h>=Math.ceil(g/j),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Xa,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>p(Math.ceil(g/j)),disabled:h>=Math.ceil(g/j),className:"hidden sm:flex",children:e.jsx(pi,{className:"h-4 w-4"})})]})]})]})]}),e.jsx(w2,{emoji:q,open:M,onOpenChange:Q}),e.jsx(_2,{emoji:q,open:fe,onOpenChange:ve,onSuccess:()=>{Me(),Z()}}),e.jsx(S2,{open:xe,onOpenChange:Ce,onSuccess:()=>{Me(),Z()}})]})}),e.jsx(ms,{open:D,onOpenChange:Y,children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认批量删除"}),e.jsxs(os,{children:["你确定要删除选中的 ",je.size," 个表情包吗?此操作不可撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:he,children:"确认删除"})]})]})}),e.jsx(Gs,{open:ge,onOpenChange:be,children:e.jsxs(Us,{children:[e.jsxs(Bs,{children:[e.jsx(Hs,{children:"确认删除"}),e.jsx(Ws,{children:"确定要删除这个表情包吗?此操作无法撤销。"})]}),e.jsxs(tt,{children:[e.jsx(_,{variant:"outline",onClick:()=>be(!1),children:"取消"}),e.jsx(_,{variant:"destructive",onClick:ae,children:"删除"})]})]})})]})}function w2({emoji:l,open:i,onOpenChange:r}){if(!l)return null;const o=u=>u?new Date(u*1e3).toLocaleString("zh-CN"):"-";return e.jsx(Gs,{open:i,onOpenChange:r,children:e.jsxs(Us,{className:"max-w-2xl max-h-[90vh]",children:[e.jsx(Bs,{children:e.jsx(Hs,{children:"表情包详情"})}),e.jsx(Ze,{className:"max-h-[calc(90vh-8rem)] pr-4",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("div",{className:"w-32 h-32 bg-muted rounded-lg flex items-center justify-center overflow-hidden",children:e.jsx("img",{src:v2(l.id),alt:l.description||"表情包",className:"w-full h-full object-cover",onError:u=>{const x=u.target;x.style.display="none";const h=x.parentElement;h&&(h.innerHTML='')}})})}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"ID"}),e.jsx("div",{className:"mt-1 font-mono",children:l.id})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"格式"}),e.jsx("div",{className:"mt-1",children:e.jsx(Qe,{variant:"outline",children:l.format.toUpperCase()})})]})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"文件路径"}),e.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:l.full_path})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"哈希值"}),e.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:l.emoji_hash})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"描述"}),l.description?e.jsx("div",{className:"mt-1 rounded-lg border bg-muted/50 p-3",children:e.jsx(d2,{className:"prose-sm",children:l.description})}):e.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:"-"})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"情绪"}),e.jsx("div",{className:"mt-1",children:l.emotion?e.jsx("span",{className:"text-sm",children:l.emotion}):e.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"状态"}),e.jsxs("div",{className:"mt-2 flex gap-2",children:[l.is_registered&&e.jsx(Qe,{variant:"default",className:"bg-green-600",children:"已注册"}),l.is_banned&&e.jsx(Qe,{variant:"destructive",children:"已封禁"}),!l.is_registered&&!l.is_banned&&e.jsx(Qe,{variant:"outline",children:"未注册"})]})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"使用次数"}),e.jsx("div",{className:"mt-1 font-mono text-lg",children:l.usage_count})]})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"记录时间"}),e.jsx("div",{className:"mt-1 text-sm",children:o(l.record_time)})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"注册时间"}),e.jsx("div",{className:"mt-1 text-sm",children:o(l.register_time)})]})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"最后使用"}),e.jsx("div",{className:"mt-1 text-sm",children:o(l.last_used_time)})]})]})})]})})}function _2({emoji:l,open:i,onOpenChange:r,onSuccess:o}){const[u,x]=m.useState(""),[h,p]=m.useState(!1),[g,v]=m.useState(!1),[j,N]=m.useState(!1),{toast:y}=Vs();m.useEffect(()=>{l&&(x(l.emotion||""),p(l.is_registered),v(l.is_banned))},[l]);const S=async()=>{if(l)try{N(!0);const w=u.split(/[,,]/).map(R=>R.trim()).filter(Boolean).join(",");await x2(l.id,{emotion:w||void 0,is_registered:h,is_banned:g}),y({title:"成功",description:"表情包信息已更新"}),r(!1),o()}catch(w){const R=w instanceof Error?w.message:"保存失败";y({title:"错误",description:R,variant:"destructive"})}finally{N(!1)}};return l?e.jsx(Gs,{open:i,onOpenChange:r,children:e.jsxs(Us,{className:"max-w-2xl",children:[e.jsxs(Bs,{children:[e.jsx(Hs,{children:"编辑表情包"}),e.jsx(Ws,{children:"修改表情包的情绪和状态信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(C,{children:"情绪"}),e.jsx(Is,{value:u,onChange:w=>x(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(gt,{id:"is_registered",checked:h,onCheckedChange:w=>{w===!0?(p(!0),v(!1)):p(!1)}}),e.jsx(C,{htmlFor:"is_registered",className:"cursor-pointer",children:"已注册"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(gt,{id:"is_banned",checked:g,onCheckedChange:w=>{w===!0?(v(!0),p(!1)):v(!1)}}),e.jsx(C,{htmlFor:"is_banned",className:"cursor-pointer",children:"已封禁"})]})]})]}),e.jsxs(tt,{children:[e.jsx(_,{variant:"outline",onClick:()=>r(!1),children:"取消"}),e.jsx(_,{onClick:S,disabled:j,children:j?"保存中...":"保存"})]})]})}):null}function S2({open:l,onOpenChange:i,onSuccess:r}){const[o,u]=m.useState("select"),[x,h]=m.useState([]),[p,g]=m.useState(null),[v,j]=m.useState(!1),{toast:N}=Vs(),y=m.useMemo(()=>new x0({id:"emoji-uploader",autoProceed:!1,restrictions:{maxFileSize:10485760,allowedFileTypes:["image/jpeg","image/png","image/gif","image/webp"],maxNumberOfFiles:20},locale:{pluralize:()=>0,strings:{addMoreFiles:"添加更多文件",addingMoreFiles:"正在添加更多文件",allowedFileTypes:"允许的文件类型:%{types}",cancel:"取消",closeModal:"关闭",complete:"完成",connectedToInternet:"已连接到互联网",copyLink:"复制链接",copyLinkToClipboardFallback:"复制下方链接",copyLinkToClipboardSuccess:"链接已复制到剪贴板",dashboardTitle:"选择文件",dashboardWindowTitle:"文件选择窗口(按 ESC 关闭)",done:"完成",dropHereOr:"拖放文件到这里或 %{browse}",dropHint:"将文件拖放到此处",dropPasteFiles:"将文件拖放到这里或 %{browseFiles}",dropPasteFolders:"将文件拖放到这里或 %{browseFolders}",dropPasteBoth:"将文件拖放到这里,%{browseFiles} 或 %{browseFolders}",dropPasteImportFiles:"将文件拖放到这里,%{browseFiles} 或从以下位置导入:",dropPasteImportFolders:"将文件拖放到这里,%{browseFolders} 或从以下位置导入:",dropPasteImportBoth:"将文件拖放到这里,%{browseFiles},%{browseFolders} 或从以下位置导入:",editFile:"编辑文件",editing:"正在编辑 %{file}",emptyFolderAdded:"未从空文件夹添加文件",exceedsSize:"%{file} 超过了最大允许大小 %{size}",failedToUpload:"上传 %{file} 失败",fileSource:"文件来源:%{name}",filesUploadedOfTotal:{0:"已上传 %{complete} / %{smart_count} 个文件",1:"已上传 %{complete} / %{smart_count} 个文件"},filter:"筛选",finishEditingFile:"完成编辑文件",folderAdded:{0:"已从 %{folder} 添加 %{smart_count} 个文件",1:"已从 %{folder} 添加 %{smart_count} 个文件"},generatingThumbnails:"正在生成缩略图...",import:"导入",importFiles:"从以下位置导入文件:",importFrom:"从 %{name} 导入",loading:"加载中...",logOut:"登出",myDevice:"我的设备",noFilesFound:"这里没有文件或文件夹",noInternetConnection:"无网络连接",openFolderNamed:"打开文件夹 %{name}",pause:"暂停",pauseUpload:"暂停上传",paused:"已暂停",poweredBy:"技术支持:%{uppy}",processingXFiles:{0:"正在处理 %{smart_count} 个文件",1:"正在处理 %{smart_count} 个文件"},recording:"录制中",removeFile:"移除文件",resetFilter:"重置筛选",resume:"继续",resumeUpload:"继续上传",retry:"重试",retryUpload:"重试上传",save:"保存",saveChanges:"保存更改",selectFileNamed:"选择文件 %{name}",selectX:{0:"选择 %{smart_count}",1:"选择 %{smart_count}"},smile:"笑一个!",startRecording:"开始录制视频",stopRecording:"停止录制视频",takePicture:"拍照",timedOut:"上传已停滞 %{seconds} 秒,正在中止。",upload:"下一步",uploadComplete:"上传完成",uploadFailed:"上传失败",uploadPaused:"上传已暂停",uploadXFiles:{0:"下一步(%{smart_count} 个文件)",1:"下一步(%{smart_count} 个文件)"},uploadXNewFiles:{0:"下一步(+%{smart_count} 个文件)",1:"下一步(+%{smart_count} 个文件)"},uploading:"正在上传",uploadingXFiles:{0:"正在上传 %{smart_count} 个文件",1:"正在上传 %{smart_count} 个文件"},xFilesSelected:{0:"已选择 %{smart_count} 个文件",1:"已选择 %{smart_count} 个文件"},xMoreFilesAdded:{0:"又添加了 %{smart_count} 个文件",1:"又添加了 %{smart_count} 个文件"},xTimeLeft:"剩余 %{time}",youCanOnlyUploadFileTypes:"您只能上传:%{types}",youCanOnlyUploadX:{0:"您只能上传 %{smart_count} 个文件",1:"您只能上传 %{smart_count} 个文件"},youHaveToAtLeastSelectX:{0:"您至少需要选择 %{smart_count} 个文件",1:"您至少需要选择 %{smart_count} 个文件"},browseFiles:"浏览文件",browseFolders:"浏览文件夹",cancelUpload:"取消上传",addMore:"添加更多",back:"返回",editFileWithFilename:"编辑文件 %{file}"}}}),[]);m.useEffect(()=>{const q=()=>{const z=y.getFiles();if(z.length===0)return;const M=z.map(Q=>({id:Q.id,name:Q.name,previewUrl:Q.preview||URL.createObjectURL(Q.data),emotion:"",description:"",isRegistered:!0,file:Q.data}));h(M),z.length===1?(g(M[0].id),u("edit-single")):u("edit-multiple")};return y.on("upload",q),()=>{y.off("upload",q)}},[y]),m.useEffect(()=>{l||(y.cancelAll(),u("select"),h([]),g(null),j(!1))},[l,y]);const S=m.useCallback((q,z)=>{h(M=>M.map(Q=>Q.id===q?{...Q,...z}:Q))},[]),w=m.useCallback(q=>q.emotion.trim().length>0,[]),R=m.useMemo(()=>x.length>0&&x.every(w),[x,w]),O=m.useMemo(()=>x.find(q=>q.id===p)||null,[x,p]),U=m.useCallback(()=>{(o==="edit-single"||o==="edit-multiple")&&(u("select"),h([]),g(null))},[o]),G=m.useCallback(async()=>{if(!R){N({title:"请填写必填项",description:"每个表情包的情感标签都是必填的",variant:"destructive"});return}j(!0);const q=localStorage.getItem("access-token")||"";let z=0,M=0;try{for(const Q of x){const fe=new FormData;fe.append("file",Q.file),fe.append("emotion",Q.emotion),fe.append("description",Q.description),fe.append("is_registered",Q.isRegistered.toString());try{(await fetch(N2(),{method:"POST",headers:{Authorization:`Bearer ${q}`},body:fe})).ok?z++:M++}catch{M++}}M===0?(N({title:"上传成功",description:`成功上传 ${z} 个表情包`}),i(!1),r()):(N({title:"部分上传失败",description:`成功 ${z} 个,失败 ${M} 个`,variant:"destructive"}),r())}finally{j(!1)}},[R,x,N,i,r]),L=()=>e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"border rounded-lg overflow-hidden w-full",children:e.jsx(c2,{uppy:y,proudlyDisplayPoweredByUppy:!1,hideProgressDetails:!0,height:350,width:"100%",theme:"auto",note:"支持 JPG、PNG、GIF、WebP 格式,最多 20 个文件"})})}),T=()=>{const q=x[0];return q?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:U,children:[e.jsx(di,{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:q.previewUrl,alt:q.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:q.name})]}),e.jsxs("div",{className:"flex-1 space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(C,{htmlFor:"single-emotion",children:["情感标签 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ie,{id:"single-emotion",value:q.emotion,onChange:z=>S(q.id,{emotion:z.target.value}),placeholder:"多个标签用逗号分隔,如:开心,高兴",className:q.emotion.trim()?"":"border-destructive"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"用于情感匹配,多个标签用逗号分隔"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"single-description",children:"描述"}),e.jsx(ie,{id:"single-description",value:q.description,onChange:z=>S(q.id,{description:z.target.value}),placeholder:"输入表情包描述..."})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(gt,{id:"single-is-registered",checked:q.isRegistered,onCheckedChange:z=>S(q.id,{isRegistered:z===!0})}),e.jsx(C,{htmlFor:"single-is-registered",className:"cursor-pointer",children:"上传后立即注册(可被麦麦使用)"})]})]})]}),e.jsx(tt,{children:e.jsx(_,{onClick:G,disabled:!R||v,children:v?"上传中...":"上传"})})]}):null},F=()=>{const q=x.filter(w).length,z=x.length;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(_,{variant:"ghost",size:"sm",onClick:U,children:[e.jsx(di,{className:"h-4 w-4 mr-1"}),"返回"]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["编辑表情包信息(",q,"/",z," 已完成)"]})]}),e.jsx(Qe,{variant:R?"default":"secondary",children:R?e.jsxs(e.Fragment,{children:[e.jsx(sa,{className:"h-3 w-3 mr-1"}),"全部完成"]}):e.jsxs(e.Fragment,{children:[e.jsx(gl,{className:"h-3 w-3 mr-1"}),"未完成"]})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Ze,{className:"h-[350px] pr-2",children:e.jsx("div",{className:"space-y-2",children:x.map(M=>{const Q=w(M),fe=p===M.id;return e.jsxs("div",{onClick:()=>g(M.id),className:` +`)}function Ku(l){if(!l.trim())return{valid:!1,error:"路径不能为空"};if(!l.toLowerCase().endsWith(".toml"))return{valid:!1,error:"文件必须是 .toml 格式"};const i=/^([a-zA-Z]:\\|\\\\[^\\]+\\[^\\]+\\).+\.toml$/i,r=/^(\/|~\/).+\.toml$/i,o=/^(\.{1,2}[\\/]|[^:\\/]).+\.toml$/i,u=i.test(l),x=r.test(l),h=o.test(l);return!u&&!x&&!h?{valid:!1,error:"路径格式错误"}:/[<>"|?*\x00-\x1F]/.test(l)?{valid:!1,error:"路径包含非法字符"}:{valid:!0,error:""}}function e2(){const[l,i]=m.useState("upload"),[r,o]=m.useState(null),[u,x]=m.useState(""),[h,f]=m.useState(""),[g,j]=m.useState("oneclick"),[v,N]=m.useState(""),[y,S]=m.useState(!1),[w,L]=m.useState(!1),[O,U]=m.useState(!1),[F,A]=m.useState(!1),[k,$]=m.useState(null),[G,z]=m.useState(!1),M=m.useRef(null),{toast:Q}=Vs(),fe=m.useRef(null),ve=Z=>{if(f(Z),Z.trim()){const me=Ku(Z);N(me.error)}else N("")},ge=m.useCallback(async Z=>{const me=Iu[Z];L(!0);try{const ke=await Ap(me.path),X=Qu(ke);o(X),j(Z),f(me.path),await Mp(me.path),Q({title:"加载成功",description:`已从${me.name}预设加载配置`})}catch(ke){console.error("加载预设配置失败:",ke),Q({title:"加载失败",description:ke instanceof Error?ke.message:"无法读取预设配置文件",variant:"destructive"})}finally{L(!1)}},[Q]),be=m.useCallback(async Z=>{const me=Ku(Z);if(!me.valid){N(me.error),Q({title:"路径无效",description:me.error,variant:"destructive"});return}N(""),L(!0);try{const ke=await Ap(Z),X=Qu(ke);o(X),f(Z),await Mp(Z),Q({title:"加载成功",description:"已从配置文件加载"})}catch(ke){console.error("加载配置失败:",ke),Q({title:"加载失败",description:ke instanceof Error?ke.message:"无法读取配置文件",variant:"destructive"})}finally{L(!1)}},[Q]);m.useEffect(()=>{(async()=>{try{const me=await O1();if(me&&me.path){f(me.path);const ke=Object.entries(Iu).find(([,X])=>X.path===me.path);ke?(i("preset"),j(ke[0]),await ge(ke[0])):(i("path"),await be(me.path))}}catch(me){console.error("加载保存的路径失败:",me)}})()},[be,ge]);const je=m.useCallback(Z=>{l!=="path"&&l!=="preset"||!h||(fe.current&&clearTimeout(fe.current),fe.current=setTimeout(async()=>{S(!0);try{const me=Yu(Z);await Op(h,me),Q({title:"自动保存成功",description:"配置已保存到文件"})}catch(me){console.error("自动保存失败:",me),Q({title:"自动保存失败",description:me instanceof Error?me.message:"保存配置失败",variant:"destructive"})}finally{S(!1)}},1e3))},[l,h,Q]),Ne=async()=>{if(!r||!h)return;const Z=Ku(h);if(!Z.valid){Q({title:"保存失败",description:Z.error,variant:"destructive"});return}S(!0);try{const me=Yu(r);await Op(h,me),Q({title:"保存成功",description:"配置已保存到文件"})}catch(me){console.error("保存失败:",me),Q({title:"保存失败",description:me instanceof Error?me.message:"保存配置失败",variant:"destructive"})}finally{S(!1)}},R=async()=>{h&&await be(h)},Y=Z=>{if(Z!==l){if(r){$(Z),U(!0);return}K(Z)}},K=Z=>{o(null),x(""),N(""),i(Z),Z==="preset"&&ge("oneclick"),Q({title:"已切换模式",description:{upload:"现在可以上传配置文件",path:"现在可以指定配置文件路径",preset:"现在可以使用预设配置"}[Z]})},re=()=>{k&&(K(k),$(null)),U(!1)},T=()=>{if(r){A(!0);return}ie()},ie=()=>{f(""),o(null),N(""),Q({title:"已清空",description:"路径和配置已清空"})},xe=()=>{ie(),A(!1)},Ce=Z=>{const me=Z.target.files?.[0];if(!me)return;const ke=new FileReader;ke.onload=X=>{try{const ae=X.target?.result,De=Qu(ae);o(De),x(me.name),Q({title:"上传成功",description:`已加载配置文件:${me.name}`})}catch(ae){console.error("解析配置文件失败:",ae),Q({title:"解析失败",description:"配置文件格式错误,请检查文件内容",variant:"destructive"})}},ke.readAsText(me)},_e=()=>{if(!r)return;const Z=Yu(r),me=new Blob([Z],{type:"text/plain;charset=utf-8"}),ke=URL.createObjectURL(me),X=document.createElement("a");X.href=ke,X.download=u||"config.toml",document.body.appendChild(X),X.click(),document.body.removeChild(X),URL.revokeObjectURL(ke),Q({title:"下载成功",description:"配置文件已下载,请手动覆盖并重启适配器"})},Me=()=>{o(JSON.parse(JSON.stringify(ot))),x("config.toml"),Q({title:"已加载默认配置",description:"可以开始编辑配置"})};return e.jsx(Ze,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦适配器配置"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的 QQ 适配器的配置文件"})]})}),e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg border border-amber-500/50 bg-amber-500/10 text-amber-700 dark:text-amber-400",children:[e.jsx(Gt,{className:"h-4 w-4 mt-0.5 flex-shrink-0"}),e.jsx("p",{className:"text-sm",children:"适配器配置保存之后使用 WebUI 的重启功能适配器并不会重启,需要手动重启适配器。"})]}),e.jsx(_r,{open:G,onOpenChange:z,children:e.jsxs(Fe,{children:[e.jsx(as,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(ls,{children:"工作模式"}),e.jsx(st,{children:"选择配置文件的管理方式"})]}),e.jsx(Sr,{asChild:!0,children:e.jsxs(_,{variant:"ghost",size:"sm",className:"w-9 p-0",children:[e.jsx(Qa,{className:`h-4 w-4 transition-transform duration-200 ${G?"transform rotate-180":""}`}),e.jsx("span",{className:"sr-only",children:"切换"})]})})]})}),e.jsx(Cr,{children:e.jsxs(ps,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3 md:gap-4",children:[e.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${l==="preset"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>Y("preset"),children:e.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[e.jsx(Ql,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"预设模式"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"使用预设的部署配置"})]})]})}),e.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${l==="upload"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>Y("upload"),children:e.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[e.jsx(br,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"上传文件模式"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"上传配置文件,编辑后下载并手动覆盖"})]})]})}),e.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${l==="path"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>Y("path"),children:e.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[e.jsx($y,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"指定路径模式"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"指定配置文件路径,自动加载和保存"})]})]})})]}),l==="preset"&&e.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[e.jsx(C,{className:"text-sm md:text-base",children:"选择部署方式"}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:Object.entries(Iu).map(([Z,me])=>{const ke=me.icon,X=g===Z;return e.jsx("div",{className:`border-2 rounded-lg p-3 cursor-pointer transition-all ${X?"border-primary bg-primary/5":"border-muted hover:border-primary/50"}`,onClick:()=>{j(Z),ge(Z)},children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(ke,{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:me.name}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:me.description}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 font-mono break-all",children:me.path})]})]})},Z)})})]}),l==="path"&&e.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"config-path",className:"text-sm md:text-base",children:"配置文件路径"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx(ne,{id:"config-path",value:h,onChange:Z=>ve(Z.target.value),placeholder:"例: C:\\Adapter\\config.toml",className:`text-sm ${v?"border-destructive":""}`}),v&&e.jsx("p",{className:"text-xs text-destructive",children:v})]}),e.jsx(_,{onClick:()=>be(h),disabled:w||!h||!!v,className:"w-full sm:w-auto",children:w?e.jsxs(e.Fragment,{children:[e.jsx(qt,{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(ta,{children:[e.jsx(Ia,{className:"h-4 w-4"}),e.jsx(aa,{children:l==="preset"?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"预设模式:"}),"选择预设的部署方式,配置会自动加载,修改后 1 秒自动保存",y&&" (正在保存...)"]}):l==="upload"?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"上传文件模式:"}),"上传配置文件 → 在线编辑 → 下载文件 → 手动覆盖并重启适配器"]}):e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"指定路径模式:"}),"指定配置文件路径后,配置会自动加载,修改后 1 秒自动保存",y&&" (正在保存...)"]})})]}),l==="upload"&&!r&&e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full",children:[e.jsx("input",{ref:M,type:"file",accept:".toml",className:"hidden",onChange:Ce}),e.jsxs(_,{onClick:()=>M.current?.click(),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(br,{className:"mr-2 h-4 w-4"}),"上传配置"]}),e.jsxs(_,{onClick:Me,size:"sm",className:"w-full sm:w-auto",children:[e.jsx(Ra,{className:"mr-2 h-4 w-4"}),"使用默认配置"]})]}),l==="upload"&&r&&e.jsx("div",{className:"flex gap-2",children:e.jsxs(_,{onClick:_e,size:"sm",className:"w-full sm:w-auto",children:[e.jsx(Ua,{className:"mr-2 h-4 w-4"}),"下载配置"]})}),(l==="preset"||l==="path")&&r&&e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs(_,{onClick:Ne,size:"sm",disabled:y||!!v,className:"w-full sm:w-auto",children:[e.jsx(Tr,{className:"mr-2 h-4 w-4"}),y?"保存中...":"立即保存"]}),e.jsxs(_,{onClick:R,size:"sm",variant:"outline",disabled:w,className:"w-full sm:w-auto",children:[e.jsx(qt,{className:`mr-2 h-4 w-4 ${w?"animate-spin":""}`}),"刷新"]}),l==="path"&&e.jsxs(_,{onClick:T,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[e.jsx(We,{className:"mr-2 h-4 w-4"}),"清空路径"]})]}),r?e.jsxs(ka,{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(xa,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5",children:[e.jsxs(ts,{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(ts,{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(ts,{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(ts,{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(ts,{value:"debug",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:"调试"})]})}),e.jsx(Ms,{value:"napcat",className:"space-y-4",children:e.jsx(s2,{config:r,onChange:Z=>{o(Z),je(Z)}})}),e.jsx(Ms,{value:"maibot",className:"space-y-4",children:e.jsx(t2,{config:r,onChange:Z=>{o(Z),je(Z)}})}),e.jsx(Ms,{value:"chat",className:"space-y-4",children:e.jsx(a2,{config:r,onChange:Z=>{o(Z),je(Z)}})}),e.jsx(Ms,{value:"voice",className:"space-y-4",children:e.jsx(l2,{config:r,onChange:Z=>{o(Z),je(Z)}})}),e.jsx(Ms,{value:"debug",className:"space-y-4",children:e.jsx(n2,{config:r,onChange:Z=>{o(Z),je(Z)}})})]}):e.jsx("div",{className:"rounded-lg border bg-card p-6 md:p-12",children:e.jsxs("div",{className:"text-center space-y-3 md:space-y-4",children:[e.jsx(Ra,{className:"h-12 w-12 md:h-16 md:w-16 mx-auto text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold",children:"尚未加载配置"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-2 px-4",children:l==="preset"?"请选择预设的部署方式":l==="upload"?"请上传现有配置文件,或使用默认配置开始编辑":"请指定配置文件路径并点击加载按钮"})]})]})}),e.jsx(ms,{open:O,onOpenChange:U,children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认切换模式"}),e.jsxs(os,{children:["切换模式将清空当前配置,确定要继续吗?",e.jsx("br",{}),e.jsx("span",{className:"text-destructive font-medium",children:"请确保已保存重要配置"})]})]}),e.jsxs(rs,{children:[e.jsx(us,{onClick:()=>{U(!1),$(null)},children:"取消"}),e.jsx(ds,{onClick:re,children:"确认切换"})]})]})}),e.jsx(ms,{open:F,onOpenChange:A,children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认清空路径"}),e.jsxs(os,{children:["清空路径将清除当前配置,确定要继续吗?",e.jsx("br",{}),e.jsx("span",{className:"text-muted-foreground text-sm",children:"此操作不会删除配置文件,只是清除界面中的配置"})]})]}),e.jsxs(rs,{children:[e.jsx(us,{onClick:()=>A(!1),children:"取消"}),e.jsx(ds,{onClick:xe,className:"bg-destructive hover:bg-destructive/90",children:"确认清空"})]})]})})]})})}function s2({config:l,onChange:i}){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(C,{htmlFor:"napcat-host",className:"text-sm md:text-base",children:"主机地址"}),e.jsx(ne,{id:"napcat-host",value:l.napcat_server.host,onChange:r=>i({...l,napcat_server:{...l.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(C,{htmlFor:"napcat-port",className:"text-sm md:text-base",children:"端口"}),e.jsx(ne,{id:"napcat-port",type:"number",value:l.napcat_server.port||"",onChange:r=>i({...l,napcat_server:{...l.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(C,{htmlFor:"napcat-token",className:"text-sm md:text-base",children:"访问令牌(Token)"}),e.jsx(ne,{id:"napcat-token",type:"password",value:l.napcat_server.token,onChange:r=>i({...l,napcat_server:{...l.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(C,{htmlFor:"napcat-heartbeat",className:"text-sm md:text-base",children:"心跳间隔(秒)"}),e.jsx(ne,{id:"napcat-heartbeat",type:"number",value:l.napcat_server.heartbeat_interval||"",onChange:r=>i({...l,napcat_server:{...l.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 t2({config:l,onChange:i}){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(C,{htmlFor:"maibot-host",className:"text-sm md:text-base",children:"主机地址"}),e.jsx(ne,{id:"maibot-host",value:l.maibot_server.host,onChange:r=>i({...l,maibot_server:{...l.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(C,{htmlFor:"maibot-port",className:"text-sm md:text-base",children:"端口"}),e.jsx(ne,{id:"maibot-port",type:"number",value:l.maibot_server.port||"",onChange:r=>i({...l,maibot_server:{...l.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 a2({config:l,onChange:i}){const r=x=>{const h={...l};x==="group"?h.chat.group_list=[...h.chat.group_list,0]:x==="private"?h.chat.private_list=[...h.chat.private_list,0]:h.chat.ban_user_id=[...h.chat.ban_user_id,0],i(h)},o=(x,h)=>{const f={...l};x==="group"?f.chat.group_list=f.chat.group_list.filter((g,j)=>j!==h):x==="private"?f.chat.private_list=f.chat.private_list.filter((g,j)=>j!==h):f.chat.ban_user_id=f.chat.ban_user_id.filter((g,j)=>j!==h),i(f)},u=(x,h,f)=>{const g={...l};x==="group"?g.chat.group_list[h]=f:x==="private"?g.chat.private_list[h]=f:g.chat.ban_user_id[h]=f,i(g)};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(C,{className:"text-sm md:text-base",children:"群组名单类型"}),e.jsxs(Be,{value:l.chat.group_list_type,onValueChange:x=>i({...l,chat:{...l.chat,group_list_type:x}}),children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),e.jsx(se,{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(C,{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(Ra,{className:"mr-1 h-4 w-4"}),"添加群号"]})]}),l.chat.group_list.map((x,h)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{type:"number",value:x,onChange:f=>u("group",h,parseInt(f.target.value)||0),placeholder:"输入群号",className:"text-sm md:text-base"}),e.jsxs(ms,{children:[e.jsx(mt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(We,{className:"h-4 w-4"})})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:["确定要删除群号 ",x," 吗?此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>o("group",h),children:"删除"})]})]})]})]},h)),l.chat.group_list.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无群组"})]})]}),e.jsxs("div",{className:"space-y-3 md:space-y-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{className:"text-sm md:text-base",children:"私聊名单类型"}),e.jsxs(Be,{value:l.chat.private_list_type,onValueChange:x=>i({...l,chat:{...l.chat,private_list_type:x}}),children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),e.jsx(se,{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(C,{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(Ra,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),l.chat.private_list.map((x,h)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{type:"number",value:x,onChange:f=>u("private",h,parseInt(f.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),e.jsxs(ms,{children:[e.jsx(mt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(We,{className:"h-4 w-4"})})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:["确定要删除用户 ",x," 吗?此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>o("private",h),children:"删除"})]})]})]})]},h)),l.chat.private_list.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无用户"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[e.jsxs("div",{children:[e.jsx(C,{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(Ra,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),l.chat.ban_user_id.map((x,h)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{type:"number",value:x,onChange:f=>u("ban",h,parseInt(f.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),e.jsxs(ms,{children:[e.jsx(mt,{asChild:!0,children:e.jsx(_,{size:"icon",variant:"outline",children:e.jsx(We,{className:"h-4 w-4"})})}),e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:["确定要从全局禁止名单中删除用户 ",x," 吗?此操作无法撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>o("ban",h),children:"删除"})]})]})]})]},h)),l.chat.ban_user_id.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无禁止用户"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-sm md:text-base",children:"屏蔽QQ官方机器人"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否屏蔽来自QQ官方机器人的消息"})]}),e.jsx(Ve,{checked:l.chat.ban_qq_bot,onCheckedChange:x=>i({...l,chat:{...l.chat,ban_qq_bot:x}})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-sm md:text-base",children:"启用戳一戳功能"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否响应戳一戳消息"})]}),e.jsx(Ve,{checked:l.chat.enable_poke,onCheckedChange:x=>i({...l,chat:{...l.chat,enable_poke:x}})})]})]})]})})}function l2({config:l,onChange:i}){return e.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"发送语音设置"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-sm md:text-base",children:"使用 TTS 语音"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"请确保已配置 TTS 并有对应的适配器"})]}),e.jsx(Ve,{checked:l.voice.use_tts,onCheckedChange:r=>i({...l,voice:{use_tts:r}})})]})]})})}function n2({config:l,onChange:i}){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(C,{className:"text-sm md:text-base",children:"日志等级"}),e.jsxs(Be,{value:l.debug.level,onValueChange:r=>i({...l,debug:{level:r}}),children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"DEBUG",children:"DEBUG(调试)"}),e.jsx(se,{value:"INFO",children:"INFO(信息)"}),e.jsx(se,{value:"WARNING",children:"WARNING(警告)"}),e.jsx(se,{value:"ERROR",children:"ERROR(错误)"}),e.jsx(se,{value:"CRITICAL",children:"CRITICAL(严重)"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"设置适配器的日志输出等级"})]})})]})})}const i2=["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"],r2=/^(aria-|data-)/,_j=l=>Object.fromEntries(Object.entries(l).filter(([i])=>r2.test(i)||i2.includes(i)));function c2(l,i){const r=_j(l);return Object.keys(l).some(o=>!Object.hasOwn(r,o)&&l[o]!==i[o])}class o2 extends m.Component{container;plugin;componentDidMount(){this.installPlugin()}componentDidUpdate(i){if(i.uppy!==this.props.uppy)this.uninstallPlugin(i),this.installPlugin();else if(c2(this.props,i)){const{uppy:r,...o}={...this.props,target:this.container};this.plugin.setOptions(o)}}componentWillUnmount(){this.uninstallPlugin()}installPlugin(){const{uppy:i,...r}={id:"Dashboard",...this.props,inline:!0,target:this.container};i.use(x0,r),this.plugin=i.getPlugin(r.id)}uninstallPlugin(i=this.props){const{uppy:r}=i;r.removePlugin(this.plugin)}render(){return m.createElement("div",{className:"uppy-Container",ref:i=>{this.container=i},..._j(this.props)})}}function d2({src:l,alt:i="表情包",className:r,maxRetries:o=5,retryInterval:u=1500}){const[x,h]=m.useState("loading"),[f,g]=m.useState(0),[j,v]=m.useState(null),N=m.useCallback(async()=>{try{const y=await fetch(l,{credentials:"include"});if(y.status===202){h("generating"),f{g(L=>L+1)},u):h("error");return}if(!y.ok){h("error");return}const S=await y.blob(),w=URL.createObjectURL(S);v(w),h("loaded")}catch(y){console.error("加载缩略图失败:",y),h("error")}},[l,f,o,u]);return m.useEffect(()=>{h("loading"),g(0),v(null)},[l]),m.useEffect(()=>{N()},[N]),m.useEffect(()=>()=>{j&&URL.revokeObjectURL(j)},[j]),x==="loading"||x==="generating"?e.jsx(sj,{className:H("w-full h-full",r)}):x==="error"||!j?e.jsx("div",{className:H("w-full h-full flex items-center justify-center bg-muted",r),children:e.jsx(Lg,{className:"h-8 w-8 text-muted-foreground"})}):e.jsx("img",{src:j,alt:i,className:H("w-full h-full object-contain",r)})}function Sj({content:l,className:i=""}){return e.jsx("div",{className:`prose prose-sm dark:prose-invert max-w-none ${i}`,children:e.jsx(f0,{remarkPlugins:[g0,j0],rehypePlugins:[p0],components:{code({inline:r,className:o,children:u,...x}){return r?e.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-sm font-mono",...x,children:u}):e.jsx("code",{className:`${o} block bg-muted p-4 rounded-lg overflow-x-auto`,...x,children:u})},table({children:r,...o}){return e.jsx("div",{className:"overflow-x-auto",children:e.jsx("table",{className:"border-collapse border border-border",...o,children:r})})},th({children:r,...o}){return e.jsx("th",{className:"border border-border bg-muted px-4 py-2 text-left font-semibold",...o,children:r})},td({children:r,...o}){return e.jsx("td",{className:"border border-border px-4 py-2",...o,children:r})},a({children:r,...o}){return e.jsx("a",{className:"text-primary hover:underline",target:"_blank",rel:"noopener noreferrer",...o,children:r})},blockquote({children:r,...o}){return e.jsx("blockquote",{className:"border-l-4 border-primary pl-4 italic text-muted-foreground",...o,children:r})},h1({children:r,...o}){return e.jsx("h1",{className:"text-3xl font-bold mt-6 mb-4",...o,children:r})},h2({children:r,...o}){return e.jsx("h2",{className:"text-2xl font-bold mt-5 mb-3",...o,children:r})},h3({children:r,...o}){return e.jsx("h3",{className:"text-xl font-bold mt-4 mb-2",...o,children:r})},h4({children:r,...o}){return e.jsx("h4",{className:"text-lg font-semibold mt-3 mb-2",...o,children:r})},ul({children:r,...o}){return e.jsx("ul",{className:"list-disc list-inside space-y-1 my-2",...o,children:r})},ol({children:r,...o}){return e.jsx("ol",{className:"list-decimal list-inside space-y-1 my-2",...o,children:r})},p({children:r,...o}){return e.jsx("p",{className:"my-2 leading-relaxed",...o,children:r})},hr({...r}){return e.jsx("hr",{className:"my-4 border-border",...r})}},children:l})})}function u2({children:l,className:i}){return e.jsx(Sj,{content:l,className:i})}const Ta="/api/webui/emoji";async function m2(l){const i=new URLSearchParams;l.page&&i.append("page",l.page.toString()),l.page_size&&i.append("page_size",l.page_size.toString()),l.search&&i.append("search",l.search),l.is_registered!==void 0&&i.append("is_registered",l.is_registered.toString()),l.is_banned!==void 0&&i.append("is_banned",l.is_banned.toString()),l.format&&i.append("format",l.format),l.sort_by&&i.append("sort_by",l.sort_by),l.sort_order&&i.append("sort_order",l.sort_order);const r=await Te(`${Ta}/list?${i}`,{});if(!r.ok)throw new Error(`获取表情包列表失败: ${r.statusText}`);return r.json()}async function x2(l){const i=await Te(`${Ta}/${l}`,{});if(!i.ok)throw new Error(`获取表情包详情失败: ${i.statusText}`);return i.json()}async function h2(l,i){const r=await Te(`${Ta}/${l}`,{method:"PATCH",body:JSON.stringify(i)});if(!r.ok)throw new Error(`更新表情包失败: ${r.statusText}`);return r.json()}async function f2(l){const i=await Te(`${Ta}/${l}`,{method:"DELETE"});if(!i.ok)throw new Error(`删除表情包失败: ${i.statusText}`);return i.json()}async function p2(){const l=await Te(`${Ta}/stats/summary`,{});if(!l.ok)throw new Error(`获取统计数据失败: ${l.statusText}`);return l.json()}async function g2(l){const i=await Te(`${Ta}/${l}/register`,{method:"POST"});if(!i.ok)throw new Error(`注册表情包失败: ${i.statusText}`);return i.json()}async function j2(l){const i=await Te(`${Ta}/${l}/ban`,{method:"POST"});if(!i.ok)throw new Error(`封禁表情包失败: ${i.statusText}`);return i.json()}function v2(l,i=!1){return i?`${Ta}/${l}/thumbnail?original=true`:`${Ta}/${l}/thumbnail`}function b2(l){return`${Ta}/${l}/thumbnail?original=true`}async function N2(l){const i=await Te(`${Ta}/batch/delete`,{method:"POST",body:JSON.stringify({emoji_ids:l})});if(!i.ok){const r=await i.json();throw new Error(r.detail||"批量删除失败")}return i.json()}function y2(){return`${Ta}/upload`}function w2(){const[l,i]=m.useState([]),[r,o]=m.useState(null),[u,x]=m.useState(!1),[h,f]=m.useState(1),[g,j]=m.useState(0),[v,N]=m.useState(20),[y,S]=m.useState("all"),[w,L]=m.useState("all"),[O,U]=m.useState("all"),[F,A]=m.useState("usage_count"),[k,$]=m.useState("desc"),[G,z]=m.useState(null),[M,Q]=m.useState(!1),[fe,ve]=m.useState(!1),[ge,be]=m.useState(!1),[je,Ne]=m.useState(new Set),[R,Y]=m.useState(!1),[K,re]=m.useState(""),[T,ie]=m.useState("medium"),[xe,Ce]=m.useState(!1),{toast:_e}=Vs(),Me=m.useCallback(async()=>{try{x(!0);const W=await m2({page:h,page_size:v,is_registered:y==="all"?void 0:y==="registered",is_banned:w==="all"?void 0:w==="banned",format:O==="all"?void 0:O,sort_by:F,sort_order:k});i(W.data),j(W.total)}catch(W){const Se=W instanceof Error?W.message:"加载表情包列表失败";_e({title:"错误",description:Se,variant:"destructive"})}finally{x(!1)}},[h,v,y,w,O,F,k,_e]),Z=async()=>{try{const W=await p2();o(W.data)}catch(W){console.error("加载统计数据失败:",W)}};m.useEffect(()=>{Me()},[Me]),m.useEffect(()=>{Z()},[]);const me=async W=>{try{const Se=await x2(W.id);z(Se.data),Q(!0)}catch(Se){const Ge=Se instanceof Error?Se.message:"加载详情失败";_e({title:"错误",description:Ge,variant:"destructive"})}},ke=W=>{z(W),ve(!0)},X=W=>{z(W),be(!0)},ae=async()=>{if(G)try{await f2(G.id),_e({title:"成功",description:"表情包已删除"}),be(!1),z(null),Me(),Z()}catch(W){const Se=W instanceof Error?W.message:"删除失败";_e({title:"错误",description:Se,variant:"destructive"})}},De=async W=>{try{await g2(W.id),_e({title:"成功",description:"表情包已注册"}),Me(),Z()}catch(Se){const Ge=Se instanceof Error?Se.message:"注册失败";_e({title:"错误",description:Ge,variant:"destructive"})}},_s=async W=>{try{await j2(W.id),_e({title:"成功",description:"表情包已封禁"}),Me(),Z()}catch(Se){const Ge=Se instanceof Error?Se.message:"封禁失败";_e({title:"错误",description:Ge,variant:"destructive"})}},E=W=>{const Se=new Set(je);Se.has(W)?Se.delete(W):Se.add(W),Ne(Se)},he=async()=>{try{const W=await N2(Array.from(je));_e({title:"批量删除完成",description:W.message}),Ne(new Set),Y(!1),Me(),Z()}catch(W){_e({title:"批量删除失败",description:W instanceof Error?W.message:"批量删除失败",variant:"destructive"})}},Xe=()=>{const W=parseInt(K),Se=Math.ceil(g/v);W>=1&&W<=Se?(f(W),re("")):_e({title:"无效的页码",description:`请输入1-${Se}之间的页码`,variant:"destructive"})},ye=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:()=>Ce(!0),className:"gap-2",children:[e.jsx(br,{className:"h-4 w-4"}),"上传表情包"]})]}),e.jsx(Ze,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[r&&e.jsxs("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[e.jsx(Fe,{children:e.jsxs(as,{className:"pb-2",children:[e.jsx(st,{children:"总数"}),e.jsx(ls,{className:"text-2xl",children:r.total})]})}),e.jsx(Fe,{children:e.jsxs(as,{className:"pb-2",children:[e.jsx(st,{children:"已注册"}),e.jsx(ls,{className:"text-2xl text-green-600",children:r.registered})]})}),e.jsx(Fe,{children:e.jsxs(as,{className:"pb-2",children:[e.jsx(st,{children:"已封禁"}),e.jsx(ls,{className:"text-2xl text-red-600",children:r.banned})]})}),e.jsx(Fe,{children:e.jsxs(as,{className:"pb-2",children:[e.jsx(st,{children:"未注册"}),e.jsx(ls,{className:"text-2xl text-gray-600",children:r.unregistered})]})})]}),e.jsxs(Fe,{children:[e.jsx(as,{children:e.jsxs(ls,{className:"flex items-center gap-2",children:[e.jsx(eo,{className:"h-5 w-5"}),"筛选和排序"]})}),e.jsxs(ps,{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(C,{children:"排序方式"}),e.jsxs(Be,{value:`${F}-${k}`,onValueChange:W=>{const[Se,Ge]=W.split("-");A(Se),$(Ge),f(1)},children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"usage_count-desc",children:"使用次数 (多→少)"}),e.jsx(se,{value:"usage_count-asc",children:"使用次数 (少→多)"}),e.jsx(se,{value:"register_time-desc",children:"注册时间 (新→旧)"}),e.jsx(se,{value:"register_time-asc",children:"注册时间 (旧→新)"}),e.jsx(se,{value:"record_time-desc",children:"记录时间 (新→旧)"}),e.jsx(se,{value:"record_time-asc",children:"记录时间 (旧→新)"}),e.jsx(se,{value:"last_used_time-desc",children:"最后使用 (新→旧)"}),e.jsx(se,{value:"last_used_time-asc",children:"最后使用 (旧→新)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:"注册状态"}),e.jsxs(Be,{value:y,onValueChange:W=>{S(W),f(1)},children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"all",children:"全部"}),e.jsx(se,{value:"registered",children:"已注册"}),e.jsx(se,{value:"unregistered",children:"未注册"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:"封禁状态"}),e.jsxs(Be,{value:w,onValueChange:W=>{L(W),f(1)},children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"all",children:"全部"}),e.jsx(se,{value:"banned",children:"已封禁"}),e.jsx(se,{value:"unbanned",children:"未封禁"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:"格式"}),e.jsxs(Be,{value:O,onValueChange:W=>{U(W),f(1)},children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"all",children:"全部"}),ye.map(W=>e.jsxs(se,{value:W,children:[W.toUpperCase()," (",r?.formats[W],")"]},W))]})]})]})]}),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:[je.size>0&&e.jsxs("span",{className:"text-sm text-muted-foreground",children:["已选择 ",je.size," 个表情包"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{className:"text-sm whitespace-nowrap",children:"卡片大小"}),e.jsxs(Be,{value:T,onValueChange:W=>ie(W),children:[e.jsx(Le,{className:"w-24",children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"small",children:"小"}),e.jsx(se,{value:"medium",children:"中"}),e.jsx(se,{value:"large",children:"大"})]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{htmlFor:"emoji-page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Be,{value:v.toString(),onValueChange:W=>{N(parseInt(W)),f(1),Ne(new Set)},children:[e.jsx(Le,{id:"emoji-page-size",className:"w-20",children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"20",children:"20"}),e.jsx(se,{value:"40",children:"40"}),e.jsx(se,{value:"60",children:"60"}),e.jsx(se,{value:"100",children:"100"})]})]}),je.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:()=>Y(!0),children:[e.jsx(We,{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:Me,disabled:u,children:[e.jsx(qt,{className:`h-4 w-4 mr-2 ${u?"animate-spin":""}`}),"刷新"]})})]})]}),e.jsxs(Fe,{children:[e.jsxs(as,{children:[e.jsx(ls,{children:"表情包列表"}),e.jsxs(st,{children:["共 ",g," 个表情包,当前第 ",h," 页"]})]}),e.jsxs(ps,{children:[l.length===0?e.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"暂无数据"}):e.jsx("div",{className:`grid gap-3 ${T==="small"?"grid-cols-3 sm:grid-cols-4 md:grid-cols-6 lg:grid-cols-8 xl:grid-cols-10":T==="medium"?"grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 xl:grid-cols-8":"grid-cols-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5"}`,children:l.map(W=>e.jsxs("div",{className:`group relative rounded-lg border bg-card overflow-hidden hover:ring-2 hover:ring-primary transition-all cursor-pointer ${je.has(W.id)?"ring-2 ring-primary bg-primary/5":""}`,onClick:()=>E(W.id),children:[e.jsx("div",{className:`absolute top-1 left-1 z-10 transition-opacity ${je.has(W.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 ${je.has(W.id)?"bg-primary border-primary text-primary-foreground":"bg-background/80 border-muted-foreground/50"}`,children:je.has(W.id)&&e.jsx(ma,{className:"h-3 w-3"})})}),e.jsxs("div",{className:"absolute top-1 right-1 z-10 flex flex-col gap-0.5",children:[W.is_registered&&e.jsx(Qe,{variant:"default",className:"bg-green-600 text-[10px] px-1 py-0",children:"已注册"}),W.is_banned&&e.jsx(Qe,{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 ${T==="small"?"p-1":T==="medium"?"p-2":"p-3"}`,children:e.jsx(d2,{src:v2(W.id),alt:"表情包"})}),e.jsxs("div",{className:`border-t bg-card ${T==="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(Qe,{variant:"outline",className:"text-[10px] px-1 py-0",children:W.format.toUpperCase()}),e.jsxs("span",{className:"font-mono",children:[W.usage_count,"次"]})]}),e.jsxs("div",{className:`flex gap-1 justify-center opacity-0 group-hover:opacity-100 transition-opacity ${T==="small"?"flex-wrap":""}`,children:[e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Se=>{Se.stopPropagation(),ke(W)},title:"编辑",children:e.jsx(gn,{className:"h-3 w-3"})}),e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Se=>{Se.stopPropagation(),me(W)},title:"详情",children:e.jsx(Ia,{className:"h-3 w-3"})}),!W.is_registered&&e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6 text-green-600 hover:text-green-700",onClick:Se=>{Se.stopPropagation(),De(W)},title:"注册",children:e.jsx(ma,{className:"h-3 w-3"})}),!W.is_banned&&e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6 text-orange-600 hover:text-orange-700",onClick:Se=>{Se.stopPropagation(),_s(W)},title:"封禁",children:e.jsx(qy,{className:"h-3 w-3"})}),e.jsx(_,{variant:"ghost",size:"icon",className:"h-6 w-6 text-red-600 hover:text-red-700",onClick:Se=>{Se.stopPropagation(),X(W)},title:"删除",children:e.jsx(We,{className:"h-3 w-3"})})]})]})]},W.id))}),g>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)*v+1," 到"," ",Math.min(h*v,g)," 条,共 ",g," 条"]}),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(fi,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(W=>Math.max(1,W-1)),disabled:h===1,children:[e.jsx(jl,{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:K,onChange:W=>re(W.target.value),onKeyDown:W=>W.key==="Enter"&&Xe(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(g/v)}),e.jsx(_,{variant:"outline",size:"sm",onClick:Xe,disabled:!K,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(W=>W+1),disabled:h>=Math.ceil(g/v),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Xa,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(g/v)),disabled:h>=Math.ceil(g/v),className:"hidden sm:flex",children:e.jsx(pi,{className:"h-4 w-4"})})]})]})]})]}),e.jsx(_2,{emoji:G,open:M,onOpenChange:Q}),e.jsx(S2,{emoji:G,open:fe,onOpenChange:ve,onSuccess:()=>{Me(),Z()}}),e.jsx(C2,{open:xe,onOpenChange:Ce,onSuccess:()=>{Me(),Z()}})]})}),e.jsx(ms,{open:R,onOpenChange:Y,children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认批量删除"}),e.jsxs(os,{children:["你确定要删除选中的 ",je.size," 个表情包吗?此操作不可撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:he,children:"确认删除"})]})]})}),e.jsx(Gs,{open:ge,onOpenChange:be,children:e.jsxs(Us,{children:[e.jsxs(Bs,{children:[e.jsx(Hs,{children:"确认删除"}),e.jsx(Ws,{children:"确定要删除这个表情包吗?此操作无法撤销。"})]}),e.jsxs(tt,{children:[e.jsx(_,{variant:"outline",onClick:()=>be(!1),children:"取消"}),e.jsx(_,{variant:"destructive",onClick:ae,children:"删除"})]})]})})]})}function _2({emoji:l,open:i,onOpenChange:r}){if(!l)return null;const o=u=>u?new Date(u*1e3).toLocaleString("zh-CN"):"-";return e.jsx(Gs,{open:i,onOpenChange:r,children:e.jsxs(Us,{className:"max-w-2xl max-h-[90vh]",children:[e.jsx(Bs,{children:e.jsx(Hs,{children:"表情包详情"})}),e.jsx(Ze,{className:"max-h-[calc(90vh-8rem)] pr-4",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("div",{className:"w-32 h-32 bg-muted rounded-lg flex items-center justify-center overflow-hidden",children:e.jsx("img",{src:b2(l.id),alt:l.description||"表情包",className:"w-full h-full object-cover",onError:u=>{const x=u.target;x.style.display="none";const h=x.parentElement;h&&(h.innerHTML='')}})})}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"ID"}),e.jsx("div",{className:"mt-1 font-mono",children:l.id})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"格式"}),e.jsx("div",{className:"mt-1",children:e.jsx(Qe,{variant:"outline",children:l.format.toUpperCase()})})]})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"文件路径"}),e.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:l.full_path})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"哈希值"}),e.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:l.emoji_hash})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"描述"}),l.description?e.jsx("div",{className:"mt-1 rounded-lg border bg-muted/50 p-3",children:e.jsx(u2,{className:"prose-sm",children:l.description})}):e.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:"-"})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"情绪"}),e.jsx("div",{className:"mt-1",children:l.emotion?e.jsx("span",{className:"text-sm",children:l.emotion}):e.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"状态"}),e.jsxs("div",{className:"mt-2 flex gap-2",children:[l.is_registered&&e.jsx(Qe,{variant:"default",className:"bg-green-600",children:"已注册"}),l.is_banned&&e.jsx(Qe,{variant:"destructive",children:"已封禁"}),!l.is_registered&&!l.is_banned&&e.jsx(Qe,{variant:"outline",children:"未注册"})]})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"使用次数"}),e.jsx("div",{className:"mt-1 font-mono text-lg",children:l.usage_count})]})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"记录时间"}),e.jsx("div",{className:"mt-1 text-sm",children:o(l.record_time)})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"注册时间"}),e.jsx("div",{className:"mt-1 text-sm",children:o(l.register_time)})]})]}),e.jsxs("div",{children:[e.jsx(C,{className:"text-muted-foreground",children:"最后使用"}),e.jsx("div",{className:"mt-1 text-sm",children:o(l.last_used_time)})]})]})})]})})}function S2({emoji:l,open:i,onOpenChange:r,onSuccess:o}){const[u,x]=m.useState(""),[h,f]=m.useState(!1),[g,j]=m.useState(!1),[v,N]=m.useState(!1),{toast:y}=Vs();m.useEffect(()=>{l&&(x(l.emotion||""),f(l.is_registered),j(l.is_banned))},[l]);const S=async()=>{if(l)try{N(!0);const w=u.split(/[,,]/).map(L=>L.trim()).filter(Boolean).join(",");await h2(l.id,{emotion:w||void 0,is_registered:h,is_banned:g}),y({title:"成功",description:"表情包信息已更新"}),r(!1),o()}catch(w){const L=w instanceof Error?w.message:"保存失败";y({title:"错误",description:L,variant:"destructive"})}finally{N(!1)}};return l?e.jsx(Gs,{open:i,onOpenChange:r,children:e.jsxs(Us,{className:"max-w-2xl",children:[e.jsxs(Bs,{children:[e.jsx(Hs,{children:"编辑表情包"}),e.jsx(Ws,{children:"修改表情包的情绪和状态信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(C,{children:"情绪"}),e.jsx(Is,{value:u,onChange:w=>x(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(gt,{id:"is_registered",checked:h,onCheckedChange:w=>{w===!0?(f(!0),j(!1)):f(!1)}}),e.jsx(C,{htmlFor:"is_registered",className:"cursor-pointer",children:"已注册"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(gt,{id:"is_banned",checked:g,onCheckedChange:w=>{w===!0?(j(!0),f(!1)):j(!1)}}),e.jsx(C,{htmlFor:"is_banned",className:"cursor-pointer",children:"已封禁"})]})]})]}),e.jsxs(tt,{children:[e.jsx(_,{variant:"outline",onClick:()=>r(!1),children:"取消"}),e.jsx(_,{onClick:S,disabled:v,children:v?"保存中...":"保存"})]})]})}):null}function C2({open:l,onOpenChange:i,onSuccess:r}){const[o,u]=m.useState("select"),[x,h]=m.useState([]),[f,g]=m.useState(null),[j,v]=m.useState(!1),{toast:N}=Vs(),y=m.useMemo(()=>new h0({id:"emoji-uploader",autoProceed:!1,restrictions:{maxFileSize:10485760,allowedFileTypes:["image/jpeg","image/png","image/gif","image/webp"],maxNumberOfFiles:20},locale:{pluralize:()=>0,strings:{addMoreFiles:"添加更多文件",addingMoreFiles:"正在添加更多文件",allowedFileTypes:"允许的文件类型:%{types}",cancel:"取消",closeModal:"关闭",complete:"完成",connectedToInternet:"已连接到互联网",copyLink:"复制链接",copyLinkToClipboardFallback:"复制下方链接",copyLinkToClipboardSuccess:"链接已复制到剪贴板",dashboardTitle:"选择文件",dashboardWindowTitle:"文件选择窗口(按 ESC 关闭)",done:"完成",dropHereOr:"拖放文件到这里或 %{browse}",dropHint:"将文件拖放到此处",dropPasteFiles:"将文件拖放到这里或 %{browseFiles}",dropPasteFolders:"将文件拖放到这里或 %{browseFolders}",dropPasteBoth:"将文件拖放到这里,%{browseFiles} 或 %{browseFolders}",dropPasteImportFiles:"将文件拖放到这里,%{browseFiles} 或从以下位置导入:",dropPasteImportFolders:"将文件拖放到这里,%{browseFolders} 或从以下位置导入:",dropPasteImportBoth:"将文件拖放到这里,%{browseFiles},%{browseFolders} 或从以下位置导入:",editFile:"编辑文件",editing:"正在编辑 %{file}",emptyFolderAdded:"未从空文件夹添加文件",exceedsSize:"%{file} 超过了最大允许大小 %{size}",failedToUpload:"上传 %{file} 失败",fileSource:"文件来源:%{name}",filesUploadedOfTotal:{0:"已上传 %{complete} / %{smart_count} 个文件",1:"已上传 %{complete} / %{smart_count} 个文件"},filter:"筛选",finishEditingFile:"完成编辑文件",folderAdded:{0:"已从 %{folder} 添加 %{smart_count} 个文件",1:"已从 %{folder} 添加 %{smart_count} 个文件"},generatingThumbnails:"正在生成缩略图...",import:"导入",importFiles:"从以下位置导入文件:",importFrom:"从 %{name} 导入",loading:"加载中...",logOut:"登出",myDevice:"我的设备",noFilesFound:"这里没有文件或文件夹",noInternetConnection:"无网络连接",openFolderNamed:"打开文件夹 %{name}",pause:"暂停",pauseUpload:"暂停上传",paused:"已暂停",poweredBy:"技术支持:%{uppy}",processingXFiles:{0:"正在处理 %{smart_count} 个文件",1:"正在处理 %{smart_count} 个文件"},recording:"录制中",removeFile:"移除文件",resetFilter:"重置筛选",resume:"继续",resumeUpload:"继续上传",retry:"重试",retryUpload:"重试上传",save:"保存",saveChanges:"保存更改",selectFileNamed:"选择文件 %{name}",selectX:{0:"选择 %{smart_count}",1:"选择 %{smart_count}"},smile:"笑一个!",startRecording:"开始录制视频",stopRecording:"停止录制视频",takePicture:"拍照",timedOut:"上传已停滞 %{seconds} 秒,正在中止。",upload:"下一步",uploadComplete:"上传完成",uploadFailed:"上传失败",uploadPaused:"上传已暂停",uploadXFiles:{0:"下一步(%{smart_count} 个文件)",1:"下一步(%{smart_count} 个文件)"},uploadXNewFiles:{0:"下一步(+%{smart_count} 个文件)",1:"下一步(+%{smart_count} 个文件)"},uploading:"正在上传",uploadingXFiles:{0:"正在上传 %{smart_count} 个文件",1:"正在上传 %{smart_count} 个文件"},xFilesSelected:{0:"已选择 %{smart_count} 个文件",1:"已选择 %{smart_count} 个文件"},xMoreFilesAdded:{0:"又添加了 %{smart_count} 个文件",1:"又添加了 %{smart_count} 个文件"},xTimeLeft:"剩余 %{time}",youCanOnlyUploadFileTypes:"您只能上传:%{types}",youCanOnlyUploadX:{0:"您只能上传 %{smart_count} 个文件",1:"您只能上传 %{smart_count} 个文件"},youHaveToAtLeastSelectX:{0:"您至少需要选择 %{smart_count} 个文件",1:"您至少需要选择 %{smart_count} 个文件"},browseFiles:"浏览文件",browseFolders:"浏览文件夹",cancelUpload:"取消上传",addMore:"添加更多",back:"返回",editFileWithFilename:"编辑文件 %{file}"}}}),[]);m.useEffect(()=>{const G=()=>{const z=y.getFiles();if(z.length===0)return;const M=z.map(Q=>({id:Q.id,name:Q.name,previewUrl:Q.preview||URL.createObjectURL(Q.data),emotion:"",description:"",isRegistered:!0,file:Q.data}));h(M),z.length===1?(g(M[0].id),u("edit-single")):u("edit-multiple")};return y.on("upload",G),()=>{y.off("upload",G)}},[y]),m.useEffect(()=>{l||(y.cancelAll(),u("select"),h([]),g(null),v(!1))},[l,y]);const S=m.useCallback((G,z)=>{h(M=>M.map(Q=>Q.id===G?{...Q,...z}:Q))},[]),w=m.useCallback(G=>G.emotion.trim().length>0,[]),L=m.useMemo(()=>x.length>0&&x.every(w),[x,w]),O=m.useMemo(()=>x.find(G=>G.id===f)||null,[x,f]),U=m.useCallback(()=>{(o==="edit-single"||o==="edit-multiple")&&(u("select"),h([]),g(null))},[o]),F=m.useCallback(async()=>{if(!L){N({title:"请填写必填项",description:"每个表情包的情感标签都是必填的",variant:"destructive"});return}v(!0);const G=localStorage.getItem("access-token")||"";let z=0,M=0;try{for(const Q of x){const fe=new FormData;fe.append("file",Q.file),fe.append("emotion",Q.emotion),fe.append("description",Q.description),fe.append("is_registered",Q.isRegistered.toString());try{(await fetch(y2(),{method:"POST",headers:{Authorization:`Bearer ${G}`},body:fe})).ok?z++:M++}catch{M++}}M===0?(N({title:"上传成功",description:`成功上传 ${z} 个表情包`}),i(!1),r()):(N({title:"部分上传失败",description:`成功 ${z} 个,失败 ${M} 个`,variant:"destructive"}),r())}finally{v(!1)}},[L,x,N,i,r]),A=()=>e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"border rounded-lg overflow-hidden w-full",children:e.jsx(o2,{uppy:y,proudlyDisplayPoweredByUppy:!1,hideProgressDetails:!0,height:350,width:"100%",theme:"auto",note:"支持 JPG、PNG、GIF、WebP 格式,最多 20 个文件"})})}),k=()=>{const G=x[0];return G?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:U,children:[e.jsx(di,{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:G.previewUrl,alt:G.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:G.name})]}),e.jsxs("div",{className:"flex-1 space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(C,{htmlFor:"single-emotion",children:["情感标签 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ne,{id:"single-emotion",value:G.emotion,onChange:z=>S(G.id,{emotion:z.target.value}),placeholder:"多个标签用逗号分隔,如:开心,高兴",className:G.emotion.trim()?"":"border-destructive"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"用于情感匹配,多个标签用逗号分隔"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"single-description",children:"描述"}),e.jsx(ne,{id:"single-description",value:G.description,onChange:z=>S(G.id,{description:z.target.value}),placeholder:"输入表情包描述..."})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(gt,{id:"single-is-registered",checked:G.isRegistered,onCheckedChange:z=>S(G.id,{isRegistered:z===!0})}),e.jsx(C,{htmlFor:"single-is-registered",className:"cursor-pointer",children:"上传后立即注册(可被麦麦使用)"})]})]})]}),e.jsx(tt,{children:e.jsx(_,{onClick:F,disabled:!L||j,children:j?"上传中...":"上传"})})]}):null},$=()=>{const G=x.filter(w).length,z=x.length;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(_,{variant:"ghost",size:"sm",onClick:U,children:[e.jsx(di,{className:"h-4 w-4 mr-1"}),"返回"]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["编辑表情包信息(",G,"/",z," 已完成)"]})]}),e.jsx(Qe,{variant:L?"default":"secondary",children:L?e.jsxs(e.Fragment,{children:[e.jsx(sa,{className:"h-3 w-3 mr-1"}),"全部完成"]}):e.jsxs(e.Fragment,{children:[e.jsx(gl,{className:"h-3 w-3 mr-1"}),"未完成"]})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Ze,{className:"h-[350px] pr-2",children:e.jsx("div",{className:"space-y-2",children:x.map(M=>{const Q=w(M),fe=f===M.id;return e.jsxs("div",{onClick:()=>g(M.id),className:` flex items-center gap-3 p-3 rounded-lg border-2 cursor-pointer transition-all ${fe?"ring-2 ring-primary":""} ${Q?"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: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:"text-sm font-medium truncate",children:M.name}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:M.emotion||"未填写情感标签"})]}),Q?e.jsx(ma,{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"})]},M.id)})})}),e.jsx("div",{className:"border rounded-lg p-4",children:O?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:O.previewUrl,alt:O.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:O.name}),w(O)&&e.jsxs(Qe,{variant:"outline",className:"text-green-600 border-green-600",children:[e.jsx(sa,{className:"h-3 w-3 mr-1"}),"已完成"]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(C,{htmlFor:"multi-emotion",children:["情感标签 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ie,{id:"multi-emotion",value:O.emotion,onChange:M=>S(O.id,{emotion:M.target.value}),placeholder:"多个标签用逗号分隔,如:开心,高兴",className:O.emotion.trim()?"":"border-destructive"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"multi-description",children:"描述"}),e.jsx(ie,{id:"multi-description",value:O.description,onChange:M=>S(O.id,{description:M.target.value}),placeholder:"输入表情包描述..."})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(gt,{id:"multi-is-registered",checked:O.isRegistered,onCheckedChange:M=>S(O.id,{isRegistered:M===!0})}),e.jsx(C,{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(Rg,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"点击左侧卡片编辑"})]})})})]}),e.jsx(tt,{children:e.jsx(_,{onClick:G,disabled:!R||v,children:v?"上传中...":`上传全部 (${z})`})})]})};return e.jsx(Gs,{open:l,onOpenChange:i,children:e.jsxs(Us,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[e.jsxs(Bs,{children:[e.jsxs(Hs,{className:"flex items-center gap-2",children:[e.jsx(br,{className:"h-5 w-5"}),o==="select"&&"上传表情包 - 选择文件",o==="edit-single"&&"上传表情包 - 填写信息",o==="edit-multiple"&&"上传表情包 - 批量编辑"]}),e.jsxs(Ws,{children:[o==="select"&&"支持 JPG、PNG、GIF、WebP 格式,单个文件最大 10MB,可同时上传多个文件",o==="edit-single"&&"请填写表情包的情感标签(必填)和描述",o==="edit-multiple"&&"点击左侧卡片编辑每个表情包的信息,情感标签为必填项"]})]}),e.jsxs("div",{className:"overflow-y-auto pr-1",children:[o==="select"&&L(),o==="edit-single"&&T(),o==="edit-multiple"&&F()]})]})})}const Xl="/api/webui/expression";async function C2(){const l=await Te(`${Xl}/chats`,{});if(!l.ok){const i=await l.json();throw new Error(i.detail||"获取聊天列表失败")}return l.json()}async function k2(l){const i=new URLSearchParams;l.page&&i.append("page",l.page.toString()),l.page_size&&i.append("page_size",l.page_size.toString()),l.search&&i.append("search",l.search),l.chat_id&&i.append("chat_id",l.chat_id);const r=await Te(`${Xl}/list?${i}`,{});if(!r.ok){const o=await r.json();throw new Error(o.detail||"获取表达方式列表失败")}return r.json()}async function T2(l){const i=await Te(`${Xl}/${l}`,{});if(!i.ok){const r=await i.json();throw new Error(r.detail||"获取表达方式详情失败")}return i.json()}async function E2(l){const i=await Te(`${Xl}/`,{method:"POST",body:JSON.stringify(l)});if(!i.ok){const r=await i.json();throw new Error(r.detail||"创建表达方式失败")}return i.json()}async function z2(l,i){const r=await Te(`${Xl}/${l}`,{method:"PATCH",body:JSON.stringify(i)});if(!r.ok){const o=await r.json();throw new Error(o.detail||"更新表达方式失败")}return r.json()}async function M2(l){const i=await Te(`${Xl}/${l}`,{method:"DELETE"});if(!i.ok){const r=await i.json();throw new Error(r.detail||"删除表达方式失败")}return i.json()}async function A2(l){const i=await Te(`${Xl}/batch/delete`,{method:"POST",body:JSON.stringify({ids:l})});if(!i.ok){const r=await i.json();throw new Error(r.detail||"批量删除表达方式失败")}return i.json()}async function O2(){const l=await Te(`${Xl}/stats/summary`,{});if(!l.ok){const i=await l.json();throw new Error(i.detail||"获取统计数据失败")}return l.json()}function D2(){const[l,i]=m.useState([]),[r,o]=m.useState(!0),[u,x]=m.useState(0),[h,p]=m.useState(1),[g,v]=m.useState(20),[j,N]=m.useState(""),[y,S]=m.useState(null),[w,R]=m.useState(!1),[O,U]=m.useState(!1),[G,L]=m.useState(!1),[T,F]=m.useState(null),[q,z]=m.useState(new Set),[M,Q]=m.useState(!1),[fe,ve]=m.useState(""),[ge,be]=m.useState({total:0,recent_7days:0,chat_count:0,top_chats:{}}),[je,Ne]=m.useState([]),[D,Y]=m.useState(new Map),{toast:K}=Vs(),re=async()=>{try{o(!0);const ae=await k2({page:h,page_size:g,search:j||void 0});i(ae.data),x(ae.total)}catch(ae){K({title:"加载失败",description:ae instanceof Error?ae.message:"无法加载表达方式",variant:"destructive"})}finally{o(!1)}},k=async()=>{try{const ae=await O2();ae?.data&&be(ae.data)}catch(ae){console.error("加载统计数据失败:",ae)}},ne=async()=>{try{const ae=await C2();if(ae?.data){Ne(ae.data);const De=new Map;ae.data.forEach(_s=>{De.set(_s.chat_id,_s.chat_name)}),Y(De)}}catch(ae){console.error("加载聊天列表失败:",ae)}},xe=ae=>D.get(ae)||ae;m.useEffect(()=>{re(),k(),ne()},[h,g,j]);const Ce=async ae=>{try{const De=await T2(ae.id);S(De.data),R(!0)}catch(De){K({title:"加载详情失败",description:De instanceof Error?De.message:"无法加载表达方式详情",variant:"destructive"})}},_e=ae=>{S(ae),U(!0)},Me=async ae=>{try{await M2(ae.id),K({title:"删除成功",description:`已删除表达方式: ${ae.situation}`}),F(null),re(),k()}catch(De){K({title:"删除失败",description:De instanceof Error?De.message:"无法删除表达方式",variant:"destructive"})}},Z=ae=>{const De=new Set(q);De.has(ae)?De.delete(ae):De.add(ae),z(De)},me=()=>{q.size===l.length&&l.length>0?z(new Set):z(new Set(l.map(ae=>ae.id)))},ke=async()=>{try{await A2(Array.from(q)),K({title:"批量删除成功",description:`已删除 ${q.size} 个表达方式`}),z(new Set),Q(!1),re(),k()}catch(ae){K({title:"批量删除失败",description:ae instanceof Error?ae.message:"无法批量删除表达方式",variant:"destructive"})}},X=()=>{const ae=parseInt(fe),De=Math.ceil(u/g);ae>=1&&ae<=De?(p(ae),ve("")):K({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(Yl,{className:"h-8 w-8",strokeWidth:2}),"表达方式管理"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦的表达方式和话术模板"})]}),e.jsxs(_,{onClick:()=>L(!0),className:"gap-2",children:[e.jsx(ft,{className:"h-4 w-4"}),"新增表达方式"]})]})}),e.jsx(Ze,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"总数量"}),e.jsx("div",{className:"text-2xl font-bold mt-1",children:ge.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:ge.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:ge.chat_count})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx(C,{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(Ft,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(ie,{id:"search",placeholder:"搜索情境、风格或上下文...",value:j,onChange:ae=>N(ae.target.value),className:"pl-9"})]})}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[e.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:q.size>0&&e.jsxs("span",{children:["已选择 ",q.size," 个表达方式"]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Be,{value:g.toString(),onValueChange:ae=>{v(parseInt(ae)),p(1),z(new Set)},children:[e.jsx(Le,{id:"page-size",className:"w-20",children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"10",children:"10"}),e.jsx(se,{value:"20",children:"20"}),e.jsx(se,{value:"50",children:"50"}),e.jsx(se,{value:"100",children:"100"})]})]}),q.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>z(new Set),children:"取消选择"}),e.jsxs(_,{variant:"destructive",size:"sm",onClick:()=>Q(!0),children:[e.jsx(es,{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(jn,{children:[e.jsx(vn,{children:e.jsxs(pt,{children:[e.jsx(Pe,{className:"w-12",children:e.jsx(gt,{checked:q.size===l.length&&l.length>0,onCheckedChange:me})}),e.jsx(Pe,{children:"情境"}),e.jsx(Pe,{children:"风格"}),e.jsx(Pe,{children:"聊天"}),e.jsx(Pe,{className:"text-right",children:"操作"})]})}),e.jsx(bn,{children:r?e.jsx(pt,{children:e.jsx(Ie,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):l.length===0?e.jsx(pt,{children:e.jsx(Ie,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):l.map(ae=>e.jsxs(pt,{children:[e.jsx(Ie,{children:e.jsx(gt,{checked:q.has(ae.id),onCheckedChange:()=>Z(ae.id)})}),e.jsx(Ie,{className:"font-medium max-w-xs truncate",children:ae.situation}),e.jsx(Ie,{className:"max-w-xs truncate",children:ae.style}),e.jsx(Ie,{className:"max-w-[200px] truncate",title:xe(ae.chat_id),style:{wordBreak:"keep-all"},children:e.jsx("span",{className:"whitespace-nowrap overflow-hidden text-ellipsis block",children:xe(ae.chat_id)})}),e.jsx(Ie,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>_e(ae),children:[e.jsx(gn,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(_,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>Ce(ae),title:"查看详情",children:e.jsx(Qt,{className:"h-4 w-4"})}),e.jsxs(_,{size:"sm",onClick:()=>F(ae),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(es,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},ae.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3 p-4",children:r?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):l.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):l.map(ae=>e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(gt,{checked:q.has(ae.id),onCheckedChange:()=>Z(ae.id),className:"mt-1"}),e.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden space-y-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"情境"}),e.jsx("h3",{className:"font-semibold text-sm line-clamp-2 w-full break-all",title:ae.situation,children:ae.situation})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"风格"}),e.jsx("p",{className:"text-sm line-clamp-2 w-full break-all",title:ae.style,children:ae.style})]})]})]}),e.jsxs("div",{className:"text-sm",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"聊天"}),e.jsx("p",{className:"text-sm truncate",title:xe(ae.chat_id),style:{wordBreak:"keep-all"},children:xe(ae.chat_id)})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>_e(ae),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(gn,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>Ce(ae),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:e.jsx(Qt,{className:"h-3 w-3"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>F(ae),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[e.jsx(es,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},ae.id))}),u>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",u," 条记录,第 ",h," / ",Math.ceil(u/g)," 页"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>p(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(fi,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>p(h-1),disabled:h===1,children:[e.jsx(jl,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ie,{type:"number",value:fe,onChange:ae=>ve(ae.target.value),onKeyDown:ae=>ae.key==="Enter"&&X(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(u/g)}),e.jsx(_,{variant:"outline",size:"sm",onClick:X,disabled:!fe,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>p(h+1),disabled:h>=Math.ceil(u/g),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Xa,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>p(Math.ceil(u/g)),disabled:h>=Math.ceil(u/g),className:"hidden sm:flex",children:e.jsx(pi,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(R2,{expression:y,open:w,onOpenChange:R,chatNameMap:D}),e.jsx(L2,{open:G,onOpenChange:L,chatList:je,onSuccess:()=>{re(),k(),L(!1)}}),e.jsx(U2,{expression:y,open:O,onOpenChange:U,chatList:je,onSuccess:()=>{re(),k(),U(!1)}}),e.jsx(ms,{open:!!T,onOpenChange:()=>F(null),children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:['确定要删除表达方式 "',T?.situation,'" 吗? 此操作不可撤销。']})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>T&&Me(T),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(B2,{open:M,onOpenChange:Q,onConfirm:ke,count:q.size})]})}function R2({expression:l,open:i,onOpenChange:r,chatNameMap:o}){if(!l)return null;const u=h=>h?new Date(h*1e3).toLocaleString("zh-CN"):"-",x=h=>o.get(h)||h;return e.jsx(Gs,{open:i,onOpenChange:r,children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Bs,{children:[e.jsx(Hs,{children:"表达方式详情"}),e.jsx(Ws,{children:"查看表达方式的完整信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(ur,{label:"情境",value:l.situation}),e.jsx(ur,{label:"风格",value:l.style}),e.jsx(ur,{label:"聊天",value:x(l.chat_id)}),e.jsx(ur,{icon:mi,label:"记录ID",value:l.id.toString(),mono:!0})]}),e.jsx("div",{className:"grid grid-cols-2 gap-4",children:e.jsx(ur,{icon:oi,label:"创建时间",value:u(l.create_date)})})]}),e.jsx(tt,{children:e.jsx(_,{onClick:()=>r(!1),children:"关闭"})})]})})}function ur({icon:l,label:i,value:r,mono:o=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(C,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[l&&e.jsx(l,{className:"h-3 w-3"}),i]}),e.jsx("div",{className:H("text-sm",o&&"font-mono",!r&&"text-muted-foreground"),children:r||"-"})]})}function L2({open:l,onOpenChange:i,chatList:r,onSuccess:o}){const[u,x]=m.useState({situation:"",style:"",chat_id:""}),[h,p]=m.useState(!1),{toast:g}=Vs(),v=async()=>{if(!u.situation||!u.style||!u.chat_id){g({title:"验证失败",description:"请填写必填字段:情境、风格和聊天",variant:"destructive"});return}try{p(!0),await E2(u),g({title:"创建成功",description:"表达方式已创建"}),x({situation:"",style:"",chat_id:""}),o()}catch(j){g({title:"创建失败",description:j instanceof Error?j.message:"无法创建表达方式",variant:"destructive"})}finally{p(!1)}};return e.jsx(Gs,{open:l,onOpenChange:i,children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Bs,{children:[e.jsx(Hs,{children:"新增表达方式"}),e.jsx(Ws,{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(C,{htmlFor:"situation",children:["情境 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ie,{id:"situation",value:u.situation,onChange:j=>x({...u,situation:j.target.value}),placeholder:"描述使用场景"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(C,{htmlFor:"style",children:["风格 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ie,{id:"style",value:u.style,onChange:j=>x({...u,style:j.target.value}),placeholder:"描述表达风格"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(C,{htmlFor:"chat_id",children:["聊天 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs(Be,{value:u.chat_id,onValueChange:j=>x({...u,chat_id:j}),children:[e.jsx(Le,{children:e.jsx(He,{placeholder:"选择关联的聊天"})}),e.jsx(Ue,{children:r.map(j=>e.jsx(se,{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(tt,{children:[e.jsx(_,{variant:"outline",onClick:()=>i(!1),children:"取消"}),e.jsx(_,{onClick:v,disabled:h,children:h?"创建中...":"创建"})]})]})})}function U2({expression:l,open:i,onOpenChange:r,chatList:o,onSuccess:u}){const[x,h]=m.useState({}),[p,g]=m.useState(!1),{toast:v}=Vs();m.useEffect(()=>{l&&h({situation:l.situation,style:l.style,chat_id:l.chat_id})},[l]);const j=async()=>{if(l)try{g(!0),await z2(l.id,x),v({title:"保存成功",description:"表达方式已更新"}),u()}catch(N){v({title:"保存失败",description:N instanceof Error?N.message:"无法更新表达方式",variant:"destructive"})}finally{g(!1)}};return l?e.jsx(Gs,{open:i,onOpenChange:r,children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Bs,{children:[e.jsx(Hs,{children:"编辑表达方式"}),e.jsx(Ws,{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(C,{htmlFor:"edit_situation",children:"情境"}),e.jsx(ie,{id:"edit_situation",value:x.situation||"",onChange:N=>h({...x,situation:N.target.value}),placeholder:"描述使用场景"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"edit_style",children:"风格"}),e.jsx(ie,{id:"edit_style",value:x.style||"",onChange:N=>h({...x,style:N.target.value}),placeholder:"描述表达风格"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"edit_chat_id",children:"聊天"}),e.jsxs(Be,{value:x.chat_id||"",onValueChange:N=>h({...x,chat_id:N}),children:[e.jsx(Le,{children:e.jsx(He,{placeholder:"选择关联的聊天"})}),e.jsx(Ue,{children:o.map(N=>e.jsx(se,{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(tt,{children:[e.jsx(_,{variant:"outline",onClick:()=>r(!1),children:"取消"}),e.jsx(_,{onClick:j,disabled:p,children:p?"保存中...":"保存"})]})]})}):null}function B2({open:l,onOpenChange:i,onConfirm:r,count:o}){return e.jsx(ms,{open:l,onOpenChange:i,children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认批量删除"}),e.jsxs(os,{children:["您即将删除 ",o," 个表达方式,此操作无法撤销。确定要继续吗?"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:r,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})}const vl="/api/webui/jargon";async function H2(){const l=await Te(`${vl}/chats`,{});if(!l.ok){const i=await l.json();throw new Error(i.detail||"获取聊天列表失败")}return l.json()}async function $2(l){const i=new URLSearchParams;l.page&&i.append("page",l.page.toString()),l.page_size&&i.append("page_size",l.page_size.toString()),l.search&&i.append("search",l.search),l.chat_id&&i.append("chat_id",l.chat_id),l.is_jargon!==void 0&&l.is_jargon!==null&&i.append("is_jargon",l.is_jargon.toString()),l.is_global!==void 0&&i.append("is_global",l.is_global.toString());const r=await Te(`${vl}/list?${i}`,{});if(!r.ok){const o=await r.json();throw new Error(o.detail||"获取黑话列表失败")}return r.json()}async function q2(l){const i=await Te(`${vl}/${l}`,{});if(!i.ok){const r=await i.json();throw new Error(r.detail||"获取黑话详情失败")}return i.json()}async function G2(l){const i=await Te(`${vl}/`,{method:"POST",body:JSON.stringify(l)});if(!i.ok){const r=await i.json();throw new Error(r.detail||"创建黑话失败")}return i.json()}async function F2(l,i){const r=await Te(`${vl}/${l}`,{method:"PATCH",body:JSON.stringify(i)});if(!r.ok){const o=await r.json();throw new Error(o.detail||"更新黑话失败")}return r.json()}async function V2(l){const i=await Te(`${vl}/${l}`,{method:"DELETE"});if(!i.ok){const r=await i.json();throw new Error(r.detail||"删除黑话失败")}return i.json()}async function I2(l){const i=await Te(`${vl}/batch/delete`,{method:"POST",body:JSON.stringify({ids:l})});if(!i.ok){const r=await i.json();throw new Error(r.detail||"批量删除黑话失败")}return i.json()}async function Q2(){const l=await Te(`${vl}/stats/summary`,{});if(!l.ok){const i=await l.json();throw new Error(i.detail||"获取黑话统计失败")}return l.json()}async function Y2(l,i){const r=new URLSearchParams;l.forEach(u=>r.append("ids",u.toString())),r.append("is_jargon",i.toString());const o=await Te(`${vl}/batch/set-jargon?${r}`,{method:"POST"});if(!o.ok){const u=await o.json();throw new Error(u.detail||"批量设置黑话状态失败")}return o.json()}function K2(){const[l,i]=m.useState([]),[r,o]=m.useState(!0),[u,x]=m.useState(0),[h,p]=m.useState(1),[g,v]=m.useState(20),[j,N]=m.useState(""),[y,S]=m.useState("all"),[w,R]=m.useState("all"),[O,U]=m.useState(null),[G,L]=m.useState(!1),[T,F]=m.useState(!1),[q,z]=m.useState(!1),[M,Q]=m.useState(null),[fe,ve]=m.useState(new Set),[ge,be]=m.useState(!1),[je,Ne]=m.useState(""),[D,Y]=m.useState({total:0,confirmed_jargon:0,confirmed_not_jargon:0,pending:0,global_count:0,complete_count:0,chat_count:0,top_chats:{}}),[K,re]=m.useState([]),{toast:k}=Vs(),ne=async()=>{try{o(!0);const E=await $2({page:h,page_size:g,search:j||void 0,chat_id:y==="all"?void 0:y,is_jargon:w==="all"?void 0:w==="true"?!0:w==="false"?!1:void 0});i(E.data),x(E.total)}catch(E){k({title:"加载失败",description:E instanceof Error?E.message:"无法加载黑话列表",variant:"destructive"})}finally{o(!1)}},xe=async()=>{try{const E=await Q2();E?.data&&Y(E.data)}catch(E){console.error("加载统计数据失败:",E)}},Ce=async()=>{try{const E=await H2();E?.data&&re(E.data)}catch(E){console.error("加载聊天列表失败:",E)}};m.useEffect(()=>{ne(),xe(),Ce()},[h,g,j,y,w]);const _e=async E=>{try{const he=await q2(E.id);U(he.data),L(!0)}catch(he){k({title:"加载详情失败",description:he instanceof Error?he.message:"无法加载黑话详情",variant:"destructive"})}},Me=E=>{U(E),F(!0)},Z=async E=>{try{await V2(E.id),k({title:"删除成功",description:`已删除黑话: ${E.content}`}),Q(null),ne(),xe()}catch(he){k({title:"删除失败",description:he instanceof Error?he.message:"无法删除黑话",variant:"destructive"})}},me=E=>{const he=new Set(fe);he.has(E)?he.delete(E):he.add(E),ve(he)},ke=()=>{fe.size===l.length&&l.length>0?ve(new Set):ve(new Set(l.map(E=>E.id)))},X=async()=>{try{await I2(Array.from(fe)),k({title:"批量删除成功",description:`已删除 ${fe.size} 个黑话`}),ve(new Set),be(!1),ne(),xe()}catch(E){k({title:"批量删除失败",description:E instanceof Error?E.message:"无法批量删除黑话",variant:"destructive"})}},ae=async E=>{try{await Y2(Array.from(fe),E),k({title:"操作成功",description:`已将 ${fe.size} 个词条设为${E?"黑话":"非黑话"}`}),ve(new Set),ne(),xe()}catch(he){k({title:"操作失败",description:he instanceof Error?he.message:"批量设置失败",variant:"destructive"})}},De=()=>{const E=parseInt(je),he=Math.ceil(u/g);E>=1&&E<=he?(p(E),Ne("")):k({title:"无效的页码",description:`请输入1-${he}之间的页码`,variant:"destructive"})},_s=E=>E===!0?e.jsxs(Qe,{variant:"default",className:"bg-green-600 hover:bg-green-700",children:[e.jsx(sa,{className:"h-3 w-3 mr-1"}),"是黑话"]}):E===!1?e.jsxs(Qe,{variant:"secondary",children:[e.jsx(gl,{className:"h-3 w-3 mr-1"}),"非黑话"]}):e.jsxs(Qe,{variant:"outline",children:[e.jsx(Dg,{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(Ay,{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:()=>z(!0),className:"gap-2",children:[e.jsx(ft,{className:"h-4 w-4"}),"新增黑话"]})]})}),e.jsx(Ze,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 lg:grid-cols-7 gap-3",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"总数量"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1",children: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(C,{htmlFor:"search",children:"搜索"}),e.jsxs("div",{className:"relative",children:[e.jsx(Ft,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(ie,{id:"search",placeholder:"搜索内容、含义...",value:j,onChange:E=>N(E.target.value),className:"pl-9"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{children:"聊天筛选"}),e.jsxs(Be,{value:y,onValueChange:S,children:[e.jsx(Le,{children:e.jsx(He,{placeholder:"全部聊天"})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"all",children:"全部聊天"}),K.map(E=>e.jsx(se,{value:E.chat_id,children:E.chat_name},E.chat_id))]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{children:"状态筛选"}),e.jsxs(Be,{value:w,onValueChange:R,children:[e.jsx(Le,{children:e.jsx(He,{placeholder:"全部状态"})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"all",children:"全部状态"}),e.jsx(se,{value:"true",children:"是黑话"}),e.jsx(se,{value:"false",children:"非黑话"})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:"page-size",children:"每页显示"}),e.jsxs(Be,{value:g.toString(),onValueChange:E=>{v(parseInt(E)),p(1),ve(new Set)},children:[e.jsx(Le,{id:"page-size",children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"10",children:"10"}),e.jsx(se,{value:"20",children:"20"}),e.jsx(se,{value:"50",children:"50"}),e.jsx(se,{value:"100",children:"100"})]})]})]})]}),fe.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:["已选择 ",fe.size," 个"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>ae(!0),children:[e.jsx(sa,{className:"h-4 w-4 mr-1"}),"标记为黑话"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>ae(!1),children:[e.jsx(gl,{className:"h-4 w-4 mr-1"}),"标记为非黑话"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>ve(new Set),children:"取消选择"}),e.jsxs(_,{variant:"destructive",size:"sm",onClick:()=>be(!0),children:[e.jsx(es,{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(jn,{children:[e.jsx(vn,{children:e.jsxs(pt,{children:[e.jsx(Pe,{className:"w-12",children:e.jsx(gt,{checked:fe.size===l.length&&l.length>0,onCheckedChange:ke})}),e.jsx(Pe,{children:"内容"}),e.jsx(Pe,{children:"含义"}),e.jsx(Pe,{children:"聊天"}),e.jsx(Pe,{children:"状态"}),e.jsx(Pe,{className:"text-center",children:"次数"}),e.jsx(Pe,{className:"text-right",children:"操作"})]})}),e.jsx(bn,{children:r?e.jsx(pt,{children:e.jsx(Ie,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):l.length===0?e.jsx(pt,{children:e.jsx(Ie,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):l.map(E=>e.jsxs(pt,{children:[e.jsx(Ie,{children:e.jsx(gt,{checked:fe.has(E.id),onCheckedChange:()=>me(E.id)})}),e.jsx(Ie,{className:"font-medium max-w-[200px]",children:e.jsxs("div",{className:"flex items-center gap-2",children:[E.is_global&&e.jsx("span",{title:"全局黑话",children:e.jsx(Ju,{className:"h-4 w-4 text-blue-500 flex-shrink-0"})}),e.jsx("span",{className:"truncate",title:E.content,children:E.content})]})}),e.jsx(Ie,{className:"max-w-[200px] truncate",title:E.meaning||"",children:E.meaning||e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx(Ie,{className:"max-w-[150px] truncate",title:E.chat_name||E.chat_id,children:E.chat_name||E.chat_id}),e.jsx(Ie,{children:_s(E.is_jargon)}),e.jsx(Ie,{className:"text-center",children:E.count}),e.jsx(Ie,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>Me(E),children:[e.jsx(gn,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(_,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>_e(E),title:"查看详情",children:e.jsx(Qt,{className:"h-4 w-4"})}),e.jsxs(_,{size:"sm",onClick:()=>Q(E),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(es,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},E.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:"加载中..."}):l.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):l.map(E=>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(gt,{checked:fe.has(E.id),onCheckedChange:()=>me(E.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:[E.is_global&&e.jsx(Ju,{className:"h-4 w-4 text-blue-500 flex-shrink-0"}),e.jsx("h3",{className:"font-semibold text-sm break-all",children:E.content})]}),E.meaning&&e.jsx("p",{className:"text-sm text-muted-foreground break-all",children:E.meaning}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[_s(E.is_jargon),e.jsxs("span",{className:"text-muted-foreground",children:["次数: ",E.count]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground truncate",children:["聊天: ",E.chat_name||E.chat_id]})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>Me(E),className:"text-xs px-2 py-1 h-auto",children:[e.jsx(gn,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>_e(E),className:"text-xs px-2 py-1 h-auto",children:e.jsx(Qt,{className:"h-3 w-3"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>Q(E),className:"text-xs px-2 py-1 h-auto text-destructive hover:text-destructive",children:[e.jsx(es,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},E.id))}),u>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",u," 条记录,第 ",h," / ",Math.ceil(u/g)," 页"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>p(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(fi,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>p(h-1),disabled:h===1,children:[e.jsx(jl,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ie,{type:"number",value:je,onChange:E=>Ne(E.target.value),onKeyDown:E=>E.key==="Enter"&&De(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(u/g)}),e.jsx(_,{variant:"outline",size:"sm",onClick:De,disabled:!je,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>p(h+1),disabled:h>=Math.ceil(u/g),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Xa,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>p(Math.ceil(u/g)),disabled:h>=Math.ceil(u/g),className:"hidden sm:flex",children:e.jsx(pi,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(X2,{jargon:O,open:G,onOpenChange:L}),e.jsx(J2,{open:q,onOpenChange:z,chatList:K,onSuccess:()=>{ne(),xe(),z(!1)}}),e.jsx(P2,{jargon:O,open:T,onOpenChange:F,chatList:K,onSuccess:()=>{ne(),xe(),F(!1)}}),e.jsx(ms,{open:!!M,onOpenChange:()=>Q(null),children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:['确定要删除黑话 "',M?.content,'" 吗?此操作不可撤销。']})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>M&&Z(M),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(ms,{open:ge,onOpenChange:be,children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认批量删除"}),e.jsxs(os,{children:["您即将删除 ",fe.size," 个黑话,此操作无法撤销。确定要继续吗?"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:X,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})]})}function X2({jargon:l,open:i,onOpenChange:r}){return l?e.jsx(Gs,{open:i,onOpenChange:r,children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] grid grid-rows-[auto_1fr_auto] overflow-hidden",children:[e.jsxs(Bs,{children:[e.jsx(Hs,{children:"黑话详情"}),e.jsx(Ws,{children:"查看黑话的完整信息"})]}),e.jsx(Ze,{className:"h-full pr-4",children:e.jsxs("div",{className:"space-y-4 pb-2",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Ku,{icon:mi,label:"记录ID",value:l.id.toString(),mono:!0}),e.jsx(Ku,{label:"使用次数",value:l.count.toString()})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{className:"text-xs text-muted-foreground",children:"内容"}),e.jsx("div",{className:"text-sm p-2 bg-muted rounded break-all whitespace-pre-wrap",children:l.content})]}),l.raw_content&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{className:"text-xs text-muted-foreground",children:"原始内容"}),e.jsx("div",{className:"text-sm p-2 bg-muted rounded break-all",children:(()=>{try{const o=JSON.parse(l.raw_content);return Array.isArray(o)?o.map((u,x)=>e.jsxs("div",{children:[x>0&&e.jsx("hr",{className:"my-3 border-border"}),e.jsx("div",{className:"whitespace-pre-wrap",children:u})]},x)):e.jsx("div",{className:"whitespace-pre-wrap",children:l.raw_content})}catch{return e.jsx("div",{className:"whitespace-pre-wrap",children:l.raw_content})}})()})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{className:"text-xs text-muted-foreground",children:"含义"}),e.jsx("div",{className:"text-sm p-2 bg-muted rounded break-all",children:l.meaning?e.jsx(hj,{content:l.meaning}):"-"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Ku,{label:"聊天",value:l.chat_name||l.chat_id}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{className:"text-xs text-muted-foreground",children:"状态"}),e.jsxs("div",{className:"flex items-center gap-2",children:[l.is_jargon===!0&&e.jsx(Qe,{variant:"default",className:"bg-green-600",children:"是黑话"}),l.is_jargon===!1&&e.jsx(Qe,{variant:"secondary",children:"非黑话"}),l.is_jargon===null&&e.jsx(Qe,{variant:"outline",children:"未判定"}),l.is_global&&e.jsx(Qe,{variant:"outline",className:"border-blue-500 text-blue-500",children:"全局"}),l.is_complete&&e.jsx(Qe,{variant:"outline",className:"border-purple-500 text-purple-500",children:"推断完成"})]})]})]}),l.inference_with_context&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{className:"text-xs text-muted-foreground",children:"上下文推断结果"}),e.jsx("div",{className:"p-2 bg-muted rounded break-all whitespace-pre-wrap font-mono text-xs max-h-[200px] overflow-y-auto",children:l.inference_with_context})]}),l.inference_content_only&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{className:"text-xs text-muted-foreground",children:"纯词条推断结果"}),e.jsx("div",{className:"p-2 bg-muted rounded break-all whitespace-pre-wrap font-mono text-xs max-h-[200px] overflow-y-auto",children:l.inference_content_only})]})]})}),e.jsx(tt,{className:"flex-shrink-0",children:e.jsx(_,{onClick:()=>r(!1),children:"关闭"})})]})}):null}function Ku({icon:l,label:i,value:r,mono:o=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(C,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[l&&e.jsx(l,{className:"h-3 w-3"}),i]}),e.jsx("div",{className:H("text-sm",o&&"font-mono",!r&&"text-muted-foreground"),children:r||"-"})]})}function J2({open:l,onOpenChange:i,chatList:r,onSuccess:o}){const[u,x]=m.useState({content:"",meaning:"",chat_id:"",is_global:!1}),[h,p]=m.useState(!1),{toast:g}=Vs(),v=async()=>{if(!u.content||!u.chat_id){g({title:"验证失败",description:"请填写必填字段:内容和聊天",variant:"destructive"});return}try{p(!0),await G2(u),g({title:"创建成功",description:"黑话已创建"}),x({content:"",meaning:"",chat_id:"",is_global:!1}),o()}catch(j){g({title:"创建失败",description:j instanceof Error?j.message:"无法创建黑话",variant:"destructive"})}finally{p(!1)}};return e.jsx(Gs,{open:l,onOpenChange:i,children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Bs,{children:[e.jsx(Hs,{children:"新增黑话"}),e.jsx(Ws,{children:"创建新的黑话记录"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(C,{htmlFor:"content",children:["内容 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ie,{id:"content",value:u.content,onChange:j=>x({...u,content:j.target.value}),placeholder:"输入黑话内容"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"meaning",children:"含义"}),e.jsx(Is,{id:"meaning",value:u.meaning||"",onChange:j=>x({...u,meaning:j.target.value}),placeholder:"输入黑话含义(可选)",rows:3})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(C,{htmlFor:"chat_id",children:["聊天 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs(Be,{value:u.chat_id,onValueChange:j=>x({...u,chat_id:j}),children:[e.jsx(Le,{children:e.jsx(He,{placeholder:"选择关联的聊天"})}),e.jsx(Ue,{children:r.map(j=>e.jsx(se,{value:j.chat_id,children:j.chat_name},j.chat_id))})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Fe,{id:"is_global",checked:u.is_global,onCheckedChange:j=>x({...u,is_global:j})}),e.jsx(C,{htmlFor:"is_global",children:"设为全局黑话"})]})]}),e.jsxs(tt,{children:[e.jsx(_,{variant:"outline",onClick:()=>i(!1),children:"取消"}),e.jsx(_,{onClick:v,disabled:h,children:h?"创建中...":"创建"})]})]})})}function P2({jargon:l,open:i,onOpenChange:r,chatList:o,onSuccess:u}){const[x,h]=m.useState({}),[p,g]=m.useState(!1),{toast:v}=Vs();m.useEffect(()=>{l&&h({content:l.content,meaning:l.meaning||"",chat_id:l.stream_id||l.chat_id,is_global:l.is_global,is_jargon:l.is_jargon})},[l]);const j=async()=>{if(l)try{g(!0),await F2(l.id,x),v({title:"保存成功",description:"黑话已更新"}),u()}catch(N){v({title:"保存失败",description:N instanceof Error?N.message:"无法更新黑话",variant:"destructive"})}finally{g(!1)}};return l?e.jsx(Gs,{open:i,onOpenChange:r,children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Bs,{children:[e.jsx(Hs,{children:"编辑黑话"}),e.jsx(Ws,{children:"修改黑话的信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"edit_content",children:"内容"}),e.jsx(ie,{id:"edit_content",value:x.content||"",onChange:N=>h({...x,content:N.target.value}),placeholder:"输入黑话内容"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"edit_meaning",children:"含义"}),e.jsx(Is,{id:"edit_meaning",value:x.meaning||"",onChange:N=>h({...x,meaning:N.target.value}),placeholder:"输入黑话含义",rows:3})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"edit_chat_id",children:"聊天"}),e.jsxs(Be,{value:x.chat_id||"",onValueChange:N=>h({...x,chat_id:N}),children:[e.jsx(Le,{children:e.jsx(He,{placeholder:"选择关联的聊天"})}),e.jsx(Ue,{children:o.map(N=>e.jsx(se,{value:N.chat_id,children:N.chat_name},N.chat_id))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:"黑话状态"}),e.jsxs(Be,{value:x.is_jargon===null?"null":x.is_jargon?.toString()||"null",onValueChange:N=>h({...x,is_jargon:N==="null"?null:N==="true"}),children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"null",children:"未判定"}),e.jsx(se,{value:"true",children:"是黑话"}),e.jsx(se,{value:"false",children:"非黑话"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Fe,{id:"edit_is_global",checked:x.is_global,onCheckedChange:N=>h({...x,is_global:N})}),e.jsx(C,{htmlFor:"edit_is_global",children:"全局黑话"})]})]}),e.jsxs(tt,{children:[e.jsx(_,{variant:"outline",onClick:()=>r(!1),children:"取消"}),e.jsx(_,{onClick:j,disabled:p,children:p?"保存中...":"保存"})]})]})}):null}const ji="/api/webui/person";async function Z2(l){const i=new URLSearchParams;l.page&&i.append("page",l.page.toString()),l.page_size&&i.append("page_size",l.page_size.toString()),l.search&&i.append("search",l.search),l.is_known!==void 0&&i.append("is_known",l.is_known.toString()),l.platform&&i.append("platform",l.platform);const r=await Te(`${ji}/list?${i}`,{headers:Fs()});if(!r.ok){const o=await r.json();throw new Error(o.detail||"获取人物列表失败")}return r.json()}async function W2(l){const i=await Te(`${ji}/${l}`,{headers:Fs()});if(!i.ok){const r=await i.json();throw new Error(r.detail||"获取人物详情失败")}return i.json()}async function e_(l,i){const r=await Te(`${ji}/${l}`,{method:"PATCH",headers:Fs(),body:JSON.stringify(i)});if(!r.ok){const o=await r.json();throw new Error(o.detail||"更新人物信息失败")}return r.json()}async function s_(l){const i=await Te(`${ji}/${l}`,{method:"DELETE",headers:Fs()});if(!i.ok){const r=await i.json();throw new Error(r.detail||"删除人物信息失败")}return i.json()}async function t_(){const l=await Te(`${ji}/stats/summary`,{headers:Fs()});if(!l.ok){const i=await l.json();throw new Error(i.detail||"获取统计数据失败")}return l.json()}async function a_(l){const i=await Te(`${ji}/batch/delete`,{method:"POST",headers:Fs(),body:JSON.stringify({person_ids:l})});if(!i.ok){const r=await i.json();throw new Error(r.detail||"批量删除失败")}return i.json()}function l_(){const[l,i]=m.useState([]),[r,o]=m.useState(!0),[u,x]=m.useState(0),[h,p]=m.useState(1),[g,v]=m.useState(20),[j,N]=m.useState(""),[y,S]=m.useState(void 0),[w,R]=m.useState(void 0),[O,U]=m.useState(null),[G,L]=m.useState(!1),[T,F]=m.useState(!1),[q,z]=m.useState(null),[M,Q]=m.useState({total:0,known:0,unknown:0,platforms:{}}),[fe,ve]=m.useState(new Set),[ge,be]=m.useState(!1),[je,Ne]=m.useState(""),{toast:D}=Vs(),Y=async()=>{try{o(!0);const X=await Z2({page:h,page_size:g,search:j||void 0,is_known:y,platform:w});i(X.data),x(X.total)}catch(X){D({title:"加载失败",description:X instanceof Error?X.message:"无法加载人物信息",variant:"destructive"})}finally{o(!1)}},K=async()=>{try{const X=await t_();X?.data&&Q(X.data)}catch(X){console.error("加载统计数据失败:",X)}};m.useEffect(()=>{Y(),K()},[h,g,j,y,w]);const re=async X=>{try{const ae=await W2(X.person_id);U(ae.data),L(!0)}catch(ae){D({title:"加载详情失败",description:ae instanceof Error?ae.message:"无法加载人物详情",variant:"destructive"})}},k=X=>{U(X),F(!0)},ne=async X=>{try{await s_(X.person_id),D({title:"删除成功",description:`已删除人物信息: ${X.person_name||X.nickname||X.user_id}`}),z(null),Y(),K()}catch(ae){D({title:"删除失败",description:ae instanceof Error?ae.message:"无法删除人物信息",variant:"destructive"})}},xe=m.useMemo(()=>Object.keys(M.platforms),[M.platforms]),Ce=X=>{const ae=new Set(fe);ae.has(X)?ae.delete(X):ae.add(X),ve(ae)},_e=()=>{fe.size===l.length&&l.length>0?ve(new Set):ve(new Set(l.map(X=>X.person_id)))},Me=()=>{if(fe.size===0){D({title:"未选择任何人物",description:"请先选择要删除的人物",variant:"destructive"});return}be(!0)},Z=async()=>{try{const X=await a_(Array.from(fe));D({title:"批量删除完成",description:X.message}),ve(new Set),be(!1),Y(),K()}catch(X){D({title:"批量删除失败",description:X instanceof Error?X.message:"批量删除失败",variant:"destructive"})}},me=()=>{const X=parseInt(je),ae=Math.ceil(u/g);X>=1&&X<=ae?(p(X),Ne("")):D({title:"无效的页码",description:`请输入1-${ae}之间的页码`,variant:"destructive"})},ke=X=>X?new Date(X*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(Pu,{className:"h-8 w-8",strokeWidth:2}),"人物信息管理"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦认识的所有人物信息"})]})})}),e.jsx(Ze,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"总人数"}),e.jsx("div",{className:"text-2xl font-bold mt-1",children:M.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:M.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:M.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(C,{htmlFor:"search",children:"搜索"}),e.jsxs("div",{className:"relative mt-1.5",children:[e.jsx(Ft,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(ie,{id:"search",placeholder:"搜索名称、昵称或用户ID...",value:j,onChange:X=>N(X.target.value),className:"pl-9"})]})]}),e.jsxs("div",{children:[e.jsx(C,{htmlFor:"filter-known",children:"认识状态"}),e.jsxs(Be,{value:y===void 0?"all":y.toString(),onValueChange:X=>{S(X==="all"?void 0:X==="true"),p(1)},children:[e.jsx(Le,{id:"filter-known",className:"mt-1.5",children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"all",children:"全部"}),e.jsx(se,{value:"true",children:"已认识"}),e.jsx(se,{value:"false",children:"未认识"})]})]})]}),e.jsxs("div",{children:[e.jsx(C,{htmlFor:"filter-platform",children:"平台"}),e.jsxs(Be,{value:w||"all",onValueChange:X=>{R(X==="all"?void 0:X),p(1)},children:[e.jsx(Le,{id:"filter-platform",className:"mt-1.5",children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"all",children:"全部平台"}),xe.map(X=>e.jsxs(se,{value:X,children:[X," (",M.platforms[X],")"]},X))]})]})]})]}),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:fe.size>0&&e.jsxs("span",{children:["已选择 ",fe.size," 个人物"]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Be,{value:g.toString(),onValueChange:X=>{v(parseInt(X)),p(1),ve(new Set)},children:[e.jsx(Le,{id:"page-size",className:"w-20",children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"10",children:"10"}),e.jsx(se,{value:"20",children:"20"}),e.jsx(se,{value:"50",children:"50"}),e.jsx(se,{value:"100",children:"100"})]})]}),fe.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>ve(new Set),children:"取消选择"}),e.jsxs(_,{variant:"destructive",size:"sm",onClick:Me,children:[e.jsx(es,{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(jn,{children:[e.jsx(vn,{children:e.jsxs(pt,{children:[e.jsx(Pe,{className:"w-12",children:e.jsx(gt,{checked:l.length>0&&fe.size===l.length,onCheckedChange:_e,"aria-label":"全选"})}),e.jsx(Pe,{children:"状态"}),e.jsx(Pe,{children:"名称"}),e.jsx(Pe,{children:"昵称"}),e.jsx(Pe,{children:"平台"}),e.jsx(Pe,{children:"用户ID"}),e.jsx(Pe,{children:"最后更新"}),e.jsx(Pe,{className:"text-right",children:"操作"})]})}),e.jsx(bn,{children:r?e.jsx(pt,{children:e.jsx(Ie,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):l.length===0?e.jsx(pt,{children:e.jsx(Ie,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):l.map(X=>e.jsxs(pt,{children:[e.jsx(Ie,{children:e.jsx(gt,{checked:fe.has(X.person_id),onCheckedChange:()=>Ce(X.person_id),"aria-label":`选择 ${X.person_name||X.nickname||X.user_id}`})}),e.jsx(Ie,{children:e.jsx("div",{className:H("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",X.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:X.is_known?"已认识":"未认识"})}),e.jsx(Ie,{className:"font-medium",children:X.person_name||e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx(Ie,{children:X.nickname||"-"}),e.jsx(Ie,{children:X.platform}),e.jsx(Ie,{className:"font-mono text-sm",children:X.user_id}),e.jsx(Ie,{className:"text-sm text-muted-foreground",children:ke(X.last_know)}),e.jsx(Ie,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>re(X),children:[e.jsx(Qt,{className:"h-4 w-4 mr-1"}),"详情"]}),e.jsxs(_,{variant:"default",size:"sm",onClick:()=>k(X),children:[e.jsx(gn,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsxs(_,{size:"sm",onClick:()=>z(X),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(es,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},X.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:"加载中..."}):l.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):l.map(X=>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(gt,{checked:fe.has(X.person_id),onCheckedChange:()=>Ce(X.person_id),className:"mt-1"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:H("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium mb-2",X.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:X.is_known?"已认识":"未认识"}),e.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",children:X.person_name||e.jsx("span",{className:"text-muted-foreground",children:"未命名"})}),X.nickname&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-1 w-full break-all",children:["昵称: ",X.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:X.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:X.user_id,children:X.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:ke(X.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:()=>re(X),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(Qt,{className:"h-3 w-3 mr-1"}),"查看"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>k(X),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(gn,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>z(X),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[e.jsx(es,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},X.id))}),u>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",u," 条记录,第 ",h," / ",Math.ceil(u/g)," 页"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>p(1),disabled:h===1,className:"hidden sm:flex",children:e.jsx(fi,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>p(h-1),disabled:h===1,children:[e.jsx(jl,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ie,{type:"number",value:je,onChange:X=>Ne(X.target.value),onKeyDown:X=>X.key==="Enter"&&me(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(u/g)}),e.jsx(_,{variant:"outline",size:"sm",onClick:me,disabled:!je,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>p(h+1),disabled:h>=Math.ceil(u/g),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Xa,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>p(Math.ceil(u/g)),disabled:h>=Math.ceil(u/g),className:"hidden sm:flex",children:e.jsx(pi,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(n_,{person:O,open:G,onOpenChange:L}),e.jsx(i_,{person:O,open:T,onOpenChange:F,onSuccess:()=>{Y(),K(),F(!1)}}),e.jsx(ms,{open:!!q,onOpenChange:()=>z(null),children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:['确定要删除人物信息 "',q?.person_name||q?.nickname||q?.user_id,'" 吗? 此操作不可撤销。']})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>q&&ne(q),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(ms,{open:ge,onOpenChange:be,children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认批量删除"}),e.jsxs(os,{children:["确定要删除选中的 ",fe.size," 个人物信息吗? 此操作不可撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:Z,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})})]})}function n_({person:l,open:i,onOpenChange:r}){if(!l)return null;const o=u=>u?new Date(u*1e3).toLocaleString("zh-CN"):"-";return e.jsx(Gs,{open:i,onOpenChange:r,children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Bs,{children:[e.jsx(Hs,{children:"人物详情"}),e.jsxs(Ws,{children:["查看 ",l.person_name||l.nickname||l.user_id," 的完整信息"]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(hl,{icon:io,label:"人物名称",value:l.person_name}),e.jsx(hl,{icon:Yl,label:"昵称",value:l.nickname}),e.jsx(hl,{icon:mi,label:"用户ID",value:l.user_id,mono:!0}),e.jsx(hl,{icon:mi,label:"人物ID",value:l.person_id,mono:!0}),e.jsx(hl,{label:"平台",value:l.platform}),e.jsx(hl,{label:"状态",value:l.is_known?"已认识":"未认识"})]}),l.name_reason&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[e.jsx(C,{className:"text-xs text-muted-foreground",children:"名称设定原因"}),e.jsx("p",{className:"mt-1 text-sm",children:l.name_reason})]}),l.memory_points&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[e.jsx(C,{className:"text-xs text-muted-foreground",children:"个人印象"}),e.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:l.memory_points})]}),l.group_nick_name&&l.group_nick_name.length>0&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[e.jsx(C,{className:"text-xs text-muted-foreground",children:"群昵称"}),e.jsx("div",{className:"mt-2 space-y-1",children:l.group_nick_name.map((u,x)=>e.jsxs("div",{className:"text-sm flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:u.group_id}),e.jsx("span",{children:"→"}),e.jsx("span",{children:u.group_nick_name})]},x))})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx(hl,{icon:oi,label:"认识时间",value:o(l.know_times)}),e.jsx(hl,{icon:oi,label:"首次记录",value:o(l.know_since)}),e.jsx(hl,{icon:oi,label:"最后更新",value:o(l.last_know)})]})]}),e.jsx(tt,{children:e.jsx(_,{onClick:()=>r(!1),children:"关闭"})})]})})}function hl({icon:l,label:i,value:r,mono:o=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(C,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[l&&e.jsx(l,{className:"h-3 w-3"}),i]}),e.jsx("div",{className:H("text-sm",o&&"font-mono",!r&&"text-muted-foreground"),children:r||"-"})]})}function i_({person:l,open:i,onOpenChange:r,onSuccess:o}){const[u,x]=m.useState({}),[h,p]=m.useState(!1),{toast:g}=Vs();m.useEffect(()=>{l&&x({person_name:l.person_name||"",name_reason:l.name_reason||"",nickname:l.nickname||"",memory_points:l.memory_points||"",is_known:l.is_known})},[l]);const v=async()=>{if(l)try{p(!0),await e_(l.person_id,u),g({title:"保存成功",description:"人物信息已更新"}),o()}catch(j){g({title:"保存失败",description:j instanceof Error?j.message:"无法更新人物信息",variant:"destructive"})}finally{p(!1)}};return l?e.jsx(Gs,{open:i,onOpenChange:r,children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Bs,{children:[e.jsx(Hs,{children:"编辑人物信息"}),e.jsxs(Ws,{children:["修改 ",l.person_name||l.nickname||l.user_id," 的信息"]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"person_name",children:"人物名称"}),e.jsx(ie,{id:"person_name",value:u.person_name||"",onChange:j=>x({...u,person_name:j.target.value}),placeholder:"为这个人设置一个名称"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"nickname",children:"昵称"}),e.jsx(ie,{id:"nickname",value:u.nickname||"",onChange:j=>x({...u,nickname:j.target.value}),placeholder:"昵称"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"name_reason",children:"名称设定原因"}),e.jsx(Is,{id:"name_reason",value:u.name_reason||"",onChange:j=>x({...u,name_reason:j.target.value}),placeholder:"为什么这样称呼这个人?",rows:2})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"memory_points",children:"个人印象"}),e.jsx(Is,{id:"memory_points",value:u.memory_points||"",onChange:j=>x({...u,memory_points:j.target.value}),placeholder:"对这个人的印象和记忆点...",rows:4})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{children:[e.jsx(C,{htmlFor:"is_known",className:"text-base font-medium",children:"已认识"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"标记是否已经认识这个人"})]}),e.jsx(Fe,{id:"is_known",checked:u.is_known,onCheckedChange:j=>x({...u,is_known:j})})]})]}),e.jsxs(tt,{children:[e.jsx(_,{variant:"outline",onClick:()=>r(!1),children:"取消"}),e.jsx(_,{onClick:v,disabled:h,children:h?"保存中...":"保存"})]})]})}):null}var r_=j0();const Up=xN(r_),gm="/api/webui";async function c_(l=100,i="all"){const r=`${gm}/knowledge/graph?limit=${l}&node_type=${i}`,o=await fetch(r);if(!o.ok)throw new Error(`获取知识图谱失败: ${o.status}`);return o.json()}async function o_(){const l=await fetch(`${gm}/knowledge/stats`);if(!l.ok)throw new Error("获取知识图谱统计信息失败");return l.json()}async function d_(l){const i=await fetch(`${gm}/knowledge/search?query=${encodeURIComponent(l)}`);if(!i.ok)throw new Error("搜索知识节点失败");return i.json()}const fj=m.memo(({data:l})=>e.jsxs("div",{className:"px-4 py-2 shadow-md rounded-lg bg-gradient-to-br from-blue-500 to-blue-600 border-2 border-blue-700 min-w-[120px]",children:[e.jsx(ro,{type:"target",position:co.Top}),e.jsx("div",{className:"font-semibold text-white text-sm truncate max-w-[200px]",title:l.content,children:l.label}),e.jsx(ro,{type:"source",position:co.Bottom})]}));fj.displayName="EntityNode";const pj=m.memo(({data:l})=>e.jsxs("div",{className:"px-3 py-2 shadow-md rounded-md bg-gradient-to-br from-green-500 to-green-600 border-2 border-green-700 min-w-[100px]",children:[e.jsx(ro,{type:"target",position:co.Top}),e.jsx("div",{className:"font-medium text-white text-xs truncate max-w-[150px]",title:l.content,children:l.label}),e.jsx(ro,{type:"source",position:co.Bottom})]}));pj.displayName="ParagraphNode";const u_={entity:fj,paragraph:pj};function m_(l,i){const r=new Up.graphlib.Graph;r.setDefaultEdgeLabel(()=>({})),r.setGraph({rankdir:"TB",ranksep:100,nodesep:80});const o=[],u=[];return l.forEach(x=>{r.setNode(x.id,{width:150,height:50})}),i.forEach(x=>{r.setEdge(x.source,x.target)}),Up.layout(r),l.forEach(x=>{const h=r.node(x.id);o.push({id:x.id,type:x.type,position:{x:h.x-75,y:h.y-25},data:{label:x.content.slice(0,20)+(x.content.length>20?"...":""),content:x.content}})}),i.forEach((x,h)=>{const p={id:`edge-${h}`,source:x.source,target:x.target,animated:l.length<=200&&x.weight>5,style:{strokeWidth:Math.min(x.weight/2,5),opacity:.6}};x.weight>10&&l.length<100&&(p.label=`${x.weight.toFixed(0)}`),u.push(p)}),{nodes:o,edges:u}}function x_(){const l=Ea(),[i,r]=m.useState(!1),[o,u]=m.useState(null),[x,h]=m.useState(""),[p,g]=m.useState("all"),[v,j]=m.useState(50),[N,y]=m.useState("50"),[S,w]=m.useState(!1),[R,O]=m.useState(!0),[U,G]=m.useState(!1),[L,T]=m.useState(!1),[F,q,z]=v0([]),[M,Q,fe]=b0([]),[ve,ge]=m.useState(0),[be,je]=m.useState(null),[Ne,D]=m.useState(null),{toast:Y}=Vs(),K=m.useCallback(Z=>Z.type==="entity"?"#6366f1":Z.type==="paragraph"?"#10b981":"#6b7280",[]),re=m.useCallback(async(Z=!1)=>{try{if(!Z&&v>200){T(!0);return}r(!0);const[me,ke]=await Promise.all([c_(v,p),o_()]);if(u(ke),me.nodes.length===0){Y({title:"提示",description:"知识库为空,请先导入知识数据"}),q([]),Q([]);return}const{nodes:X,edges:ae}=m_(me.nodes,me.edges);q(X),Q(ae),ge(X.length),ke&&ke.total_nodes>v&&Y({title:"提示",description:`知识图谱包含 ${ke.total_nodes} 个节点,当前显示 ${X.length} 个`}),Y({title:"加载成功",description:`已加载 ${X.length} 个节点,${ae.length} 条边`})}catch(me){console.error("加载知识图谱失败:",me),Y({title:"加载失败",description:me instanceof Error?me.message:"未知错误",variant:"destructive"})}finally{r(!1)}},[v,p,Y]),k=m.useCallback(async()=>{if(!x.trim()){Y({title:"提示",description:"请输入搜索关键词"});return}try{const Z=await d_(x);if(Z.length===0){Y({title:"未找到",description:"没有找到匹配的节点"});return}const me=new Set(Z.map(ke=>ke.id));q(ke=>ke.map(X=>({...X,style:{...X.style,opacity:me.has(X.id)?1:.3,filter:me.has(X.id)?"brightness(1.2)":"brightness(0.8)"}}))),Y({title:"搜索完成",description:`找到 ${Z.length} 个匹配节点`})}catch(Z){console.error("搜索失败:",Z),Y({title:"搜索失败",description:Z instanceof Error?Z.message:"未知错误",variant:"destructive"})}},[x,Y]),ne=m.useCallback(()=>{q(Z=>Z.map(me=>({...me,style:{...me.style,opacity:1,filter:"brightness(1)"}})))},[]),xe=m.useCallback(()=>{O(!1),G(!0),re()},[re]),Ce=m.useCallback(()=>{T(!1),setTimeout(()=>{re(!0)},0)},[re]),_e=m.useCallback((Z,me)=>{F.find(X=>X.id===me.id)&&je({id:me.id,type:me.type,content:me.data.content})},[F]);m.useEffect(()=>{R||U&&re()},[v,p,R,U]);const Me=m.useCallback((Z,me)=>{const ke=F.find(De=>De.id===me.source),X=F.find(De=>De.id===me.target),ae=M.find(De=>De.id===me.id);ke&&X&&ae&&D({source:{id:ke.id,type:ke.type,content:ke.data.content},target:{id:X.id,type:X.type,content:X.data.content},edge:{source:me.source,target:me.target,weight:parseFloat(me.label||"0")}})},[F,M]);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:"可视化知识实体与关系网络"})]}),o&&e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.jsxs(Qe,{variant:"outline",className:"gap-1",children:[e.jsx(lo,{className:"h-3 w-3"}),"节点: ",o.total_nodes]}),e.jsxs(Qe,{variant:"outline",className:"gap-1",children:[e.jsx(Lg,{className:"h-3 w-3"}),"边: ",o.total_edges]}),e.jsxs(Qe,{variant:"outline",className:"gap-1",children:[e.jsx(Ia,{className:"h-3 w-3"}),"实体: ",o.entity_nodes]}),e.jsxs(Qe,{variant:"outline",className:"gap-1",children:[e.jsx(Ra,{className:"h-3 w-3"}),"段落: ",o.paragraph_nodes]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 mt-4",children:[e.jsxs("div",{className:"flex-1 flex gap-2",children:[e.jsx(ie,{placeholder:"搜索节点内容...",value:x,onChange:Z=>h(Z.target.value),onKeyDown:Z=>Z.key==="Enter"&&k(),className:"flex-1"}),e.jsx(_,{onClick:k,size:"sm",children:e.jsx(Ft,{className:"h-4 w-4"})}),e.jsx(_,{onClick:ne,variant:"outline",size:"sm",children:"重置"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(Be,{value:p,onValueChange:Z=>g(Z),children:[e.jsx(Le,{className:"w-[120px]",children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"all",children:"全部节点"}),e.jsx(se,{value:"entity",children:"仅实体"}),e.jsx(se,{value:"paragraph",children:"仅段落"})]})]}),e.jsxs(Be,{value:v===1e4?"all":S?"custom":v.toString(),onValueChange:Z=>{Z==="custom"?(w(!0),y(v.toString())):Z==="all"?(w(!1),j(1e4)):(w(!1),j(Number(Z)))},children:[e.jsx(Le,{className:"w-[120px]",children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"50",children:"50 节点"}),e.jsx(se,{value:"100",children:"100 节点"}),e.jsx(se,{value:"200",children:"200 节点"}),e.jsx(se,{value:"500",children:"500 节点"}),e.jsx(se,{value:"1000",children:"1000 节点"}),e.jsx(se,{value:"all",children:"全部 (最多10000)"}),e.jsx(se,{value:"custom",children:"自定义..."})]})]}),S&&e.jsx(ie,{type:"number",min:"50",value:N,onChange:Z=>y(Z.target.value),onBlur:()=>{const Z=parseInt(N);!isNaN(Z)&&Z>=50?j(Z):(y("50"),j(50))},onKeyDown:Z=>{if(Z.key==="Enter"){const me=parseInt(N);!isNaN(me)&&me>=50?j(me):(y("50"),j(50))}},placeholder:"最少50个",className:"w-[120px]"}),e.jsx(_,{onClick:()=>re(),variant:"outline",size:"sm",disabled:i,children:e.jsx(qt,{className:H("h-4 w-4",i&&"animate-spin")})})]})]})]}),e.jsx("div",{className:"flex-1 relative",children:i?e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(qt,{className:"h-8 w-8 animate-spin mx-auto mb-2 text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground",children:"加载知识图谱中..."})]})}):F.length===0?e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(lo,{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(N0,{nodes:F,edges:M,onNodesChange:z,onEdgesChange:fe,onNodeClick:_e,onEdgeClick:Me,nodeTypes:u_,fitView:!0,minZoom:.05,maxZoom:1.5,defaultViewport:{x:0,y:0,zoom:.5},elevateNodesOnSelect:ve<=500,nodesDraggable:ve<=1e3,attributionPosition:"bottom-left",children:[e.jsx(y0,{variant:w0.Dots,gap:12,size:1}),e.jsx(_0,{}),ve<=500&&e.jsx(S0,{nodeColor:K,nodeBorderRadius:8,pannable:!0,zoomable:!0}),e.jsxs(C0,{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:"段落节点"})]}),ve>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:"已禁用动画"}),ve>500&&e.jsx("div",{children:"已禁用缩略图"})]})]})]})]})}),e.jsx(Gs,{open:!!be,onOpenChange:Z=>!Z&&je(null),children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsx(Bs,{children:e.jsx(Hs,{children:"节点详情"})}),be&&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(Qe,{variant:be.type==="entity"?"default":"secondary",children:be.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:be.id})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"内容"}),e.jsx(Ze,{className:"mt-1 h-40 p-3 bg-muted rounded",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:be.content})})]})]})]})}),e.jsx(Gs,{open:!!Ne,onOpenChange:Z=>!Z&&D(null),children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[e.jsx(Bs,{children:e.jsx(Hs,{children:"边详情"})}),Ne&&e.jsx(Ze,{className:"flex-1 pr-4",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0 p-3 bg-blue-50 dark:bg-blue-950 rounded border-2 border-blue-200 dark:border-blue-800",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"源节点"}),e.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:Ne.source.content}),e.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[Ne.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:Ne.target.content}),e.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[Ne.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(Qe,{variant:"outline",className:"text-base font-mono",children:Ne.edge.weight.toFixed(4)})})]})]})})]})}),e.jsx(ms,{open:R,onOpenChange:O,children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"加载知识图谱"}),e.jsxs(os,{children:["知识图谱的动态展示会消耗较多系统资源。",e.jsx("br",{}),"确定要加载知识图谱吗?"]})]}),e.jsxs(rs,{children:[e.jsx(us,{onClick:()=>l({to:"/"}),children:"取消 (返回首页)"}),e.jsx(ds,{onClick:xe,children:"确认加载"})]})]})}),e.jsx(ms,{open:L,onOpenChange:T,children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"⚠️ 节点数量较多"}),e.jsx(os,{asChild:!0,children:e.jsxs("div",{children:[e.jsxs("p",{children:["您正在尝试加载 ",e.jsx("strong",{className:"text-orange-600",children:v>=1e4?"全部 (最多10000个)":v})," 个节点。"]}),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(rs,{children:[e.jsx(us,{onClick:()=>{T(!1),v>200&&(j(50),w(!1))},children:"取消"}),e.jsx(ds,{onClick:Ce,className:"bg-orange-600 hover:bg-orange-700",children:"我了解风险,继续加载"})]})]})})]})}function Bp({className:l,classNames:i,showOutsideDays:r=!0,captionLayout:o="label",buttonVariant:u="ghost",formatters:x,components:h,...p}){const g=Gg();return e.jsx(e0,{showOutsideDays:r,className:H("bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,l),captionLayout:o,formatters:{formatMonthDropdown:v=>v.toLocaleString("default",{month:"short"}),...x},classNames:{root:H("w-fit",g.root),months:H("relative flex flex-col gap-4 md:flex-row",g.months),month:H("flex w-full flex-col gap-4",g.month),nav:H("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",g.nav),button_previous:H(Nr({variant:u}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",g.button_previous),button_next:H(Nr({variant:u}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",g.button_next),month_caption:H("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",g.month_caption),dropdowns:H("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",g.dropdowns),dropdown_root:H("has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",g.dropdown_root),dropdown:H("bg-popover absolute inset-0 opacity-0",g.dropdown),caption_label:H("select-none font-medium",o==="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",g.caption_label),table:"w-full border-collapse",weekdays:H("flex",g.weekdays),weekday:H("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",g.weekday),week:H("mt-2 flex w-full",g.week),week_number_header:H("w-[--cell-size] select-none",g.week_number_header),week_number:H("text-muted-foreground select-none text-[0.8rem]",g.week_number),day:H("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",g.day),range_start:H("bg-accent rounded-l-md",g.range_start),range_middle:H("rounded-none",g.range_middle),range_end:H("bg-accent rounded-r-md",g.range_end),today:H("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",g.today),outside:H("text-muted-foreground aria-selected:text-muted-foreground",g.outside),disabled:H("text-muted-foreground opacity-50",g.disabled),hidden:H("invisible",g.hidden),...i},components:{Root:({className:v,rootRef:j,...N})=>e.jsx("div",{"data-slot":"calendar",ref:j,className:H(v),...N}),Chevron:({className:v,orientation:j,...N})=>j==="left"?e.jsx(jl,{className:H("size-4",v),...N}):j==="right"?e.jsx(Xa,{className:H("size-4",v),...N}):e.jsx(Qa,{className:H("size-4",v),...N}),DayButton:h_,WeekNumber:({children:v,...j})=>e.jsx("td",{...j,children:e.jsx("div",{className:"flex size-[--cell-size] items-center justify-center text-center",children:v})}),...h},...p})}function h_({className:l,day:i,modifiers:r,...o}){const u=Gg(),x=m.useRef(null);return m.useEffect(()=>{r.focused&&x.current?.focus()},[r.focused]),e.jsx(_,{ref:x,variant:"ghost",size:"icon","data-day":i.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:H("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70",u.day,l),...o})}const Jc={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 f_(){const[l,i]=m.useState([]),[r,o]=m.useState(""),[u,x]=m.useState("all"),[h,p]=m.useState("all"),[g,v]=m.useState(void 0),[j,N]=m.useState(void 0),[y,S]=m.useState(!0),[w,R]=m.useState(!1),[O,U]=m.useState("xs"),[G,L]=m.useState(4),[T,F]=m.useState(!1),q=m.useRef(null);m.useEffect(()=>{const k=hn.getAllLogs();i(k);const ne=hn.onLog(()=>{i(hn.getAllLogs())}),xe=hn.onConnectionChange(Ce=>{R(Ce)});return()=>{ne(),xe()}},[]);const z=m.useMemo(()=>{const k=new Set(l.map(ne=>ne.module).filter(ne=>ne&&ne.trim()!==""));return Array.from(k).sort()},[l]),M=k=>{switch(k){case"DEBUG":return"text-muted-foreground";case"INFO":return"text-blue-500 dark:text-blue-400";case"WARNING":return"text-yellow-600 dark:text-yellow-500";case"ERROR":return"text-red-600 dark:text-red-500";case"CRITICAL":return"text-red-700 dark:text-red-400 font-bold";default:return"text-foreground"}},Q=k=>{switch(k){case"DEBUG":return"bg-gray-800/30 dark:bg-gray-800/50";case"INFO":return"bg-blue-900/20 dark:bg-blue-500/20";case"WARNING":return"bg-yellow-900/20 dark:bg-yellow-500/20";case"ERROR":return"bg-red-900/20 dark:bg-red-500/20";case"CRITICAL":return"bg-red-900/30 dark:bg-red-600/30";default:return"bg-gray-800/20 dark:bg-gray-800/30"}},fe=()=>{window.location.reload()},ve=()=>{hn.clearLogs(),i([])},ge=()=>{const k=Ne.map(_e=>`${_e.timestamp} [${_e.level.padEnd(8)}] [${_e.module}] ${_e.message}`).join(` -`),ne=new Blob([k],{type:"text/plain;charset=utf-8"}),xe=URL.createObjectURL(ne),Ce=document.createElement("a");Ce.href=xe,Ce.download=`logs-${Mu(new Date,"yyyy-MM-dd-HHmmss")}.txt`,Ce.click(),URL.revokeObjectURL(xe)},be=()=>{S(!y)},je=()=>{v(void 0),N(void 0)},Ne=m.useMemo(()=>l.filter(k=>{const ne=r===""||k.message.toLowerCase().includes(r.toLowerCase())||k.module.toLowerCase().includes(r.toLowerCase()),xe=u==="all"||k.level===u,Ce=h==="all"||k.module===h;let _e=!0;if(g||j){const Me=new Date(k.timestamp);if(g){const Z=new Date(g);Z.setHours(0,0,0,0),_e=_e&&Me>=Z}if(j){const Z=new Date(j);Z.setHours(23,59,59,999),_e=_e&&Me<=Z}}return ne&&xe&&Ce&&_e}),[l,r,u,h,g,j]),D=Jc[O].rowHeight+G,Y=nN({count:Ne.length,getScrollElement:()=>q.current,estimateSize:()=>D,overscan:50}),K=m.useRef(!1),re=m.useRef(Ne.length);return m.useEffect(()=>{const k=q.current;if(!k)return;const ne=()=>{if(K.current)return;const{scrollTop:xe,scrollHeight:Ce,clientHeight:_e}=k,Me=Ce-xe-_e;Me>100&&y?S(!1):Me<50&&!y&&S(!0)};return k.addEventListener("scroll",ne,{passive:!0}),()=>k.removeEventListener("scroll",ne)},[y]),m.useEffect(()=>{const k=Ne.length>re.current;re.current=Ne.length,y&&Ne.length>0&&k&&(K.current=!0,Y.scrollToIndex(Ne.length-1,{align:"end",behavior:"auto"}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{K.current=!1})}))},[Ne.length,y,Y]),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:H("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(Ve,{className:"p-2 sm:p-3",children:e.jsx(_r,{open:T,onOpenChange:F,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(Ft,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),e.jsx(ie,{placeholder:"搜索日志...",value:r,onChange:k=>o(k.target.value),className:"pl-8 h-8 text-xs sm:text-sm"})]}),e.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[e.jsxs(_,{variant:y?"default":"outline",size:"sm",onClick:be,className:"h-8 px-2",title:y?"自动滚动":"已暂停",children:[y?e.jsx(Oy,{className:"h-3.5 w-3.5"}):e.jsx(Dy,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"ml-1 text-xs hidden sm:inline",children:y?"滚动":"暂停"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:ve,className:"h-8 px-2",title:"清空日志",children:[e.jsx(es,{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:ge,className:"h-8 px-2 hidden sm:flex",title:"导出日志",children:[e.jsx(Ua,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"ml-1 text-xs hidden lg:inline",children:"导出"})]}),e.jsx(Sr,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:"h-8 px-2",title:T?"收起筛选":"展开筛选",children:[e.jsx(eo,{className:"h-3.5 w-3.5"}),T?e.jsx(ui,{className:"h-3.5 w-3.5 ml-1"}):e.jsx(Qa,{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:[Ne.length," / ",l.length]}),e.jsx("span",{className:"ml-1",children:"条日志"})]}),e.jsxs(Cr,{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-2",children:[e.jsxs(Be,{value:u,onValueChange:x,children:[e.jsxs(Le,{className:"w-full sm:flex-1 h-8 text-xs",children:[e.jsx(eo,{className:"h-3.5 w-3.5 mr-1.5"}),e.jsx(He,{placeholder:"级别"})]}),e.jsxs(Ue,{children:[e.jsx(se,{value:"all",children:"全部级别"}),e.jsx(se,{value:"DEBUG",children:"DEBUG"}),e.jsx(se,{value:"INFO",children:"INFO"}),e.jsx(se,{value:"WARNING",children:"WARNING"}),e.jsx(se,{value:"ERROR",children:"ERROR"}),e.jsx(se,{value:"CRITICAL",children:"CRITICAL"})]})]}),e.jsxs(Be,{value:h,onValueChange:p,children:[e.jsxs(Le,{className:"w-full sm:flex-1 h-8 text-xs",children:[e.jsx(eo,{className:"h-3.5 w-3.5 mr-1.5"}),e.jsx(He,{placeholder:"模块"})]}),e.jsxs(Ue,{children:[e.jsx(se,{value:"all",children:"全部模块"}),z.map(k=>e.jsx(se,{value:k,children:k},k))]})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-2",children:[e.jsxs(Ya,{children:[e.jsx(Ka,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:H("w-full sm:flex-1 justify-start text-left font-normal h-8",!g&&"text-muted-foreground"),children:[e.jsx(mp,{className:"mr-1.5 h-3.5 w-3.5"}),e.jsx("span",{className:"text-xs",children:g?Mu(g,"PP",{locale:Kc}):"开始日期"})]})}),e.jsx(Ba,{className:"w-auto p-0",align:"start",children:e.jsx(Bp,{mode:"single",selected:g,onSelect:v,initialFocus:!0,locale:Kc})})]}),e.jsxs(Ya,{children:[e.jsx(Ka,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:H("w-full sm:flex-1 justify-start text-left font-normal h-8",!j&&"text-muted-foreground"),children:[e.jsx(mp,{className:"mr-1.5 h-3.5 w-3.5"}),e.jsx("span",{className:"text-xs",children:j?Mu(j,"PP",{locale:Kc}):"结束日期"})]})}),e.jsx(Ba,{className:"w-auto p-0",align:"start",children:e.jsx(Bp,{mode:"single",selected:j,onSelect:N,initialFocus:!0,locale:Kc})})]}),(g||j)&&e.jsxs(_,{variant:"outline",size:"sm",onClick:je,className:"w-full sm:w-auto h-8",children:[e.jsx(gl,{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(Ry,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"字号"})]}),e.jsx("div",{className:"flex gap-1",children:Object.keys(Jc).map(k=>e.jsx(_,{variant:O===k?"default":"outline",size:"sm",onClick:()=>U(k),className:"h-6 px-2 text-xs",children:Jc[k].label},k))})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-1 max-w-[200px]",children:[e.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:"行距"}),e.jsx(Ca,{value:[G],onValueChange:([k])=>L(k),min:0,max:12,step:2,className:"flex-1"}),e.jsxs("span",{className:"text-xs text-muted-foreground w-7",children:[G,"px"]})]}),e.jsxs("div",{className:"flex gap-2 sm:hidden",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:fe,className:"flex-1 h-8",children:[e.jsx(qt,{className:"h-3.5 w-3.5 mr-1"}),e.jsx("span",{className:"text-xs",children:"刷新"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:ge,className:"flex-1 h-8",children:[e.jsx(Ua,{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(Ve,{className:"bg-black dark:bg-gray-950 border-gray-800 dark:border-gray-900 h-full overflow-hidden",children:e.jsx("div",{ref:q,className:H("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:H("p-2 sm:p-3 font-mono relative",Jc[O].class),style:{height:`${Y.getTotalSize()}px`},children:Ne.length===0?e.jsx("div",{className:"text-gray-500 dark:text-gray-600 text-center py-8 text-xs sm:text-sm",children:"暂无日志数据"}):Y.getVirtualItems().map(k=>{const ne=Ne[k.index];return e.jsxs("div",{"data-index":k.index,ref:Y.measureElement,className:H("absolute top-0 left-0 w-full px-2 sm:px-3 rounded hover:bg-white/5 transition-colors",Q(ne.level)),style:{transform:`translateY(${k.start}px)`,paddingTop:`${G/2}px`,paddingBottom:`${G/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:ne.timestamp}),e.jsxs("span",{className:H("font-semibold text-[10px]",M(ne.level)),children:["[",ne.level,"]"]})]}),e.jsx("div",{className:"text-cyan-400 dark:text-cyan-500 truncate text-[10px]",children:ne.module}),e.jsx("div",{className:"text-gray-300 dark:text-gray-400 whitespace-pre-wrap break-words text-[10px]",children:ne.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:ne.timestamp}),e.jsxs("span",{className:H("flex-shrink-0 w-[65px] lg:w-[75px] font-semibold",M(ne.level)),children:["[",ne.level,"]"]}),e.jsx("span",{className:"text-cyan-400 dark:text-cyan-500 flex-shrink-0 w-[100px] lg:w-[130px] truncate",children:ne.module}),e.jsx("span",{className:"text-gray-300 dark:text-gray-400 flex-1 whitespace-pre-wrap break-words",children:ne.message})]})]},k.key)})})})})})]})}const p_="Mai-with-u",g_="plugin-repo",j_="main",v_="plugin_details.json";async function b_(){try{const l=await Te("/api/webui/plugins/fetch-raw",{method:"POST",body:JSON.stringify({owner:p_,repo:g_,branch:j_,file_path:v_})});if(!l.ok)throw new Error(`HTTP error! status: ${l.status}`);const i=await l.json();if(!i.success||!i.data)throw new Error(i.error||"获取插件列表失败");return JSON.parse(i.data).filter(u=>!u?.id||!u?.manifest?(console.warn("跳过无效插件数据:",u),!1):!u.manifest.name||!u.manifest.version?(console.warn("跳过缺少必需字段的插件:",u.id),!1):!0).map(u=>({id:u.id,manifest:{manifest_version:u.manifest.manifest_version||1,name:u.manifest.name,version:u.manifest.version,description:u.manifest.description||"",author:u.manifest.author||{name:"Unknown"},license:u.manifest.license||"Unknown",host_application:u.manifest.host_application||{min_version:"0.0.0"},homepage_url:u.manifest.homepage_url,repository_url:u.manifest.repository_url,keywords:u.manifest.keywords||[],categories:u.manifest.categories||[],default_locale:u.manifest.default_locale||"zh-CN",locales_path:u.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!1,published_at:new Date().toISOString(),updated_at:new Date().toISOString()}))}catch(l){throw console.error("Failed to fetch plugin list:",l),l}}async function N_(){try{const l=await Te("/api/webui/plugins/git-status");if(!l.ok)throw new Error(`HTTP error! status: ${l.status}`);return await l.json()}catch(l){return console.error("Failed to check Git status:",l),{installed:!1,error:"无法检测 Git 安装状态"}}}async function y_(){try{const l=await Te("/api/webui/plugins/version");if(!l.ok)throw new Error(`HTTP error! status: ${l.status}`);return await l.json()}catch(l){return console.error("Failed to get Maimai version:",l),{version:"0.0.0",version_major:0,version_minor:0,version_patch:0}}}function w_(l,i,r){const o=l.split(".").map(p=>parseInt(p)||0),u=o[0]||0,x=o[1]||0,h=o[2]||0;if(r.version_majorparseInt(N)||0),g=p[0]||0,v=p[1]||0,j=p[2]||0;if(r.version_major>g||r.version_major===g&&r.version_minor>v||r.version_major===g&&r.version_minor===v&&r.version_patch>j)return!1}return!0}function __(l,i){const r=window.location.protocol==="https:"?"wss:":"ws:",o=window.location.host,u=new WebSocket(`${r}//${o}/api/webui/ws/plugin-progress`);return u.onopen=()=>{console.log("Plugin progress WebSocket connected");const x=setInterval(()=>{u.readyState===WebSocket.OPEN?u.send("ping"):clearInterval(x)},3e4)},u.onmessage=x=>{try{if(x.data==="pong")return;const h=JSON.parse(x.data);l(h)}catch(h){console.error("Failed to parse progress data:",h)}},u.onerror=x=>{console.error("Plugin progress WebSocket error:",x),i?.(x)},u.onclose=()=>{console.log("Plugin progress WebSocket disconnected")},u}async function hr(){try{const l=await Te("/api/webui/plugins/installed",{headers:Fs()});if(!l.ok)throw new Error(`HTTP error! status: ${l.status}`);const i=await l.json();if(!i.success)throw new Error(i.message||"获取已安装插件列表失败");return i.plugins||[]}catch(l){return console.error("Failed to get installed plugins:",l),[]}}function Pc(l,i){return i.some(r=>r.id===l)}function Zc(l,i){const r=i.find(o=>o.id===l);if(r)return r.manifest?.version||r.version}async function S_(l,i,r="main"){const o=await Te("/api/webui/plugins/install",{method:"POST",body:JSON.stringify({plugin_id:l,repository_url:i,branch:r})});if(!o.ok){const u=await o.json();throw new Error(u.detail||"安装失败")}return await o.json()}async function C_(l){const i=await Te("/api/webui/plugins/uninstall",{method:"POST",body:JSON.stringify({plugin_id:l})});if(!i.ok){const r=await i.json();throw new Error(r.detail||"卸载失败")}return await i.json()}async function k_(l,i,r="main"){const o=await Te("/api/webui/plugins/update",{method:"POST",body:JSON.stringify({plugin_id:l,repository_url:i,branch:r})});if(!o.ok){const u=await o.json();throw new Error(u.detail||"更新失败")}return await o.json()}async function T_(l){const i=await Te(`/api/webui/plugins/config/${l}/schema`,{headers:Fs()});if(!i.ok){const o=await i.json();throw new Error(o.detail||"获取配置 Schema 失败")}const r=await i.json();if(!r.success)throw new Error(r.message||"获取配置 Schema 失败");return r.schema}async function E_(l){const i=await Te(`/api/webui/plugins/config/${l}`,{headers:Fs()});if(!i.ok){const o=await i.json();throw new Error(o.detail||"获取配置失败")}const r=await i.json();if(!r.success)throw new Error(r.message||"获取配置失败");return r.config}async function z_(l,i){const r=await Te(`/api/webui/plugins/config/${l}`,{method:"PUT",body:JSON.stringify({config:i})});if(!r.ok){const o=await r.json();throw new Error(o.detail||"保存配置失败")}return await r.json()}async function M_(l){const i=await Te(`/api/webui/plugins/config/${l}/reset`,{method:"POST",headers:Fs()});if(!i.ok){const r=await i.json();throw new Error(r.detail||"重置配置失败")}return await i.json()}async function A_(l){const i=await Te(`/api/webui/plugins/config/${l}/toggle`,{method:"POST",headers:Fs()});if(!i.ok){const r=await i.json();throw new Error(r.detail||"切换状态失败")}return await i.json()}const zr="https://maibot-plugin-stats.maibot-webui.workers.dev";async function gj(l){try{const i=await fetch(`${zr}/stats/${l}`);return i.ok?await i.json():(console.error("Failed to fetch plugin stats:",i.statusText),null)}catch(i){return console.error("Error fetching plugin stats:",i),null}}async function O_(l,i){try{const r=i||jm(),o=await fetch(`${zr}/stats/like`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:l,user_id:r})}),u=await o.json();return o.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:o.ok?{success:!0,...u}:{success:!1,error:u.error||"点赞失败"}}catch(r){return console.error("Error liking plugin:",r),{success:!1,error:"网络错误"}}}async function D_(l,i){try{const r=i||jm(),o=await fetch(`${zr}/stats/dislike`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:l,user_id:r})}),u=await o.json();return o.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:o.ok?{success:!0,...u}:{success:!1,error:u.error||"点踩失败"}}catch(r){return console.error("Error disliking plugin:",r),{success:!1,error:"网络错误"}}}async function R_(l,i,r,o){if(i<1||i>5)return{success:!1,error:"评分必须在 1-5 之间"};try{const u=o||jm(),x=await fetch(`${zr}/stats/rate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:l,rating:i,comment:r,user_id:u})}),h=await x.json();return x.status===429?{success:!1,error:"每天最多评分 3 次"}:x.ok?{success:!0,...h}:{success:!1,error:h.error||"评分失败"}}catch(u){return console.error("Error rating plugin:",u),{success:!1,error:"网络错误"}}}async function L_(l){try{const i=await fetch(`${zr}/stats/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:l})}),r=await i.json();return i.status===429?(console.warn("Download recording rate limited"),{success:!0}):i.ok?{success:!0,...r}:(console.error("Failed to record download:",r.error),{success:!1,error:r.error})}catch(i){return console.error("Error recording download:",i),{success:!1,error:"网络错误"}}}function U_(){const l=navigator,i=[navigator.userAgent,navigator.language,navigator.languages?.join(",")||"",navigator.platform,navigator.hardwareConcurrency||0,screen.width,screen.height,screen.colorDepth,screen.pixelDepth,new Date().getTimezoneOffset(),Intl.DateTimeFormat().resolvedOptions().timeZone,navigator.maxTouchPoints||0,l.deviceMemory||0].join("|");let r=0;for(let o=0;o{x(!0);const U=await gj(l);U&&o(U),x(!1)};m.useEffect(()=>{S()},[l]);const w=async()=>{const U=await O_(l);U.success?(y({title:"已点赞",description:"感谢你的支持!"}),S()):y({title:"点赞失败",description:U.error||"未知错误",variant:"destructive"})},R=async()=>{const U=await D_(l);U.success?(y({title:"已反馈",description:"感谢你的反馈!"}),S()):y({title:"操作失败",description:U.error||"未知错误",variant:"destructive"})},O=async()=>{if(h===0){y({title:"请选择评分",description:"至少选择 1 颗星",variant:"destructive"});return}const U=await R_(l,h,g||void 0);U.success?(y({title:"评分成功",description:"感谢你的评价!"}),N(!1),p(0),v(""),S()):y({title:"评分失败",description:U.error||"未知错误",variant:"destructive"})};return u?e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Ua,{className:"h-4 w-4"}),e.jsx("span",{children:"-"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(fl,{className:"h-4 w-4"}),e.jsx("span",{children:"-"})]})]}):r?i?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(Ua,{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(fl,{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(Ou,{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(Ua,{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(fl,{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(Ou,{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(xp,{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(Ou,{className:"h-4 w-4 mr-1"}),"点赞"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:R,children:[e.jsx(xp,{className:"h-4 w-4 mr-1"}),"点踩"]}),e.jsxs(Gs,{open:j,onOpenChange:N,children:[e.jsx(cm,{asChild:!0,children:e.jsxs(_,{variant:"default",size:"sm",children:[e.jsx(fl,{className:"h-4 w-4 mr-1"}),"评分"]})}),e.jsxs(Us,{children:[e.jsxs(Bs,{children:[e.jsx(Hs,{children:"为插件评分"}),e.jsx(Ws,{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(U=>e.jsx("button",{onClick:()=>p(U),className:"focus:outline-none",children:e.jsx(fl,{className:`h-8 w-8 transition-colors ${U<=h?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-300"}`})},U))}),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(Is,{value:g,onChange:U=>v(U.target.value),placeholder:"分享你的使用体验...",rows:4,maxLength:500}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1 text-right",children:[g.length," / 500"]})]})]}),e.jsxs(tt,{children:[e.jsx(_,{variant:"outline",onClick:()=>N(!1),children:"取消"}),e.jsx(_,{onClick:O,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((U,G)=>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(L=>e.jsx(fl,{className:`h-3 w-3 ${L<=U.rating?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},L))}),e.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(U.created_at).toLocaleDateString()})]}),U.comment&&e.jsx("p",{className:"text-sm text-muted-foreground",children:U.comment})]},G))})]})]}):null}const Hp={"Group Management":"群组管理","Entertainment & Interaction":"娱乐互动","Utility Tools":"实用工具","Content Generation":"内容生成",Multimedia:"多媒体","External Integration":"外部集成","Data Analysis & Insights":"数据分析与洞察",Other:"其他"};function H_(){const l=Ea(),[i,r]=m.useState(null),[o,u]=m.useState(""),[x,h]=m.useState("all"),[p,g]=m.useState("all"),[v,j]=m.useState(!0),[N,y]=m.useState([]),[S,w]=m.useState(!0),[R,O]=m.useState(null),[U,G]=m.useState(null),[L,T]=m.useState(null),[F,q]=m.useState(null),[,z]=m.useState([]),[M,Q]=m.useState({}),[fe,ve]=m.useState(!1),[ge,be]=m.useState(null),[je,Ne]=m.useState("main"),[D,Y]=m.useState(""),[K,re]=m.useState("preset"),[k,ne]=m.useState(!1),{toast:xe}=Vs(),Ce=async E=>{const he=E.map(async W=>{try{const Se=await gj(W.id);return{id:W.id,stats:Se}}catch(Se){return console.warn(`Failed to load stats for ${W.id}:`,Se),{id:W.id,stats:null}}}),Xe=await Promise.all(he),ye={};Xe.forEach(({id:W,stats:Se})=>{Se&&(ye[W]=Se)}),Q(ye)};m.useEffect(()=>{let E=null,he=!1;return(async()=>{if(E=__(ye=>{he||(T(ye),ye.stage==="success"?setTimeout(()=>{he||T(null)},2e3):ye.stage==="error"&&(w(!1),O(ye.error||"加载失败")))},ye=>{console.error("WebSocket error:",ye),he||xe({title:"WebSocket 连接失败",description:"无法实时显示加载进度",variant:"destructive"})}),await new Promise(ye=>{if(!E){ye();return}const W=()=>{E&&E.readyState===WebSocket.OPEN?(console.log("WebSocket connected, starting to load plugins"),ye()):E&&E.readyState===WebSocket.CLOSED?(console.warn("WebSocket closed before loading plugins"),ye()):setTimeout(W,100)};W()}),!he){const ye=await N_();G(ye),ye.installed||xe({title:"Git 未安装",description:ye.error||"请先安装 Git 才能使用插件安装功能",variant:"destructive"})}if(!he){const ye=await y_();q(ye)}if(!he)try{w(!0),O(null);const ye=await b_();if(!he){const W=await hr();z(W);const Se=ye.map(Ge=>{const jt=Pc(Ge.id,W),Qs=Zc(Ge.id,W);return{...Ge,installed:jt,installed_version:Qs}});for(const Ge of W)!Se.some(Qs=>Qs.id===Ge.id)&&Ge.manifest&&Se.push({id:Ge.id,manifest:{manifest_version:Ge.manifest.manifest_version||1,name:Ge.manifest.name,version:Ge.manifest.version,description:Ge.manifest.description||"",author:Ge.manifest.author,license:Ge.manifest.license||"Unknown",host_application:Ge.manifest.host_application,homepage_url:Ge.manifest.homepage_url,repository_url:Ge.manifest.repository_url,keywords:Ge.manifest.keywords||[],categories:Ge.manifest.categories||[],default_locale:Ge.manifest.default_locale||"zh-CN",locales_path:Ge.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!0,installed_version:Ge.manifest.version,published_at:new Date().toISOString(),updated_at:new Date().toISOString()});y(Se),Ce(Se)}}catch(ye){if(!he){const W=ye instanceof Error?ye.message:"加载插件列表失败";O(W),xe({title:"加载失败",description:W,variant:"destructive"})}}finally{he||w(!1)}})(),()=>{he=!0,E&&E.close()}},[xe]);const _e=E=>{if(!E.installed&&F&&!Me(E))return e.jsxs(Qe,{variant:"destructive",className:"gap-1",children:[e.jsx(Gt,{className:"h-3 w-3"}),"不兼容"]});if(E.installed){const he=E.installed_version?.trim(),Xe=E.manifest.version?.trim();if(he!==Xe){const ye=he?.split(".").map(Number)||[0,0,0],W=Xe?.split(".").map(Number)||[0,0,0];for(let Se=0;Se<3;Se++){if((W[Se]||0)>(ye[Se]||0))return e.jsxs(Qe,{variant:"outline",className:"gap-1 text-orange-600 border-orange-600",children:[e.jsx(Gt,{className:"h-3 w-3"}),"可更新"]});if((W[Se]||0)<(ye[Se]||0))break}}return e.jsxs(Qe,{variant:"default",className:"gap-1",children:[e.jsx(ma,{className:"h-3 w-3"}),"已安装"]})}return null},Me=E=>!F||!E.manifest?.host_application?!0:w_(E.manifest.host_application.min_version,E.manifest.host_application.max_version,F),Z=E=>{if(!E.installed||!E.installed_version||!E.manifest?.version)return!1;const he=E.installed_version.trim(),Xe=E.manifest.version.trim();if(he===Xe)return!1;const ye=he.split(".").map(Number),W=Xe.split(".").map(Number);for(let Se=0;Se<3;Se++){if((W[Se]||0)>(ye[Se]||0))return!0;if((W[Se]||0)<(ye[Se]||0))return!1}return!1},me=N.filter(E=>{if(!E.manifest)return console.warn("[过滤] 跳过无 manifest 的插件:",E.id),!1;const he=o===""||E.manifest.name?.toLowerCase().includes(o.toLowerCase())||E.manifest.description?.toLowerCase().includes(o.toLowerCase())||E.manifest.keywords&&E.manifest.keywords.some(Se=>Se.toLowerCase().includes(o.toLowerCase())),Xe=x==="all"||E.manifest.categories&&E.manifest.categories.includes(x);let ye=!0;p==="installed"?ye=E.installed===!0:p==="updates"&&(ye=E.installed===!0&&Z(E));const W=!v||!F||Me(E);return he&&Xe&&ye&&W}),ke=()=>{r(null)},X=E=>{if(!U?.installed){xe({title:"无法安装",description:"Git 未安装",variant:"destructive"});return}if(F&&!Me(E)){xe({title:"无法安装",description:"插件与当前麦麦版本不兼容",variant:"destructive"});return}be(E),Ne("main"),Y(""),re("preset"),ne(!1),ve(!0)},ae=async()=>{if(!ge)return;const E=K==="custom"?D:je;if(!E||E.trim()===""){xe({title:"分支名称不能为空",variant:"destructive"});return}try{ve(!1),await S_(ge.id,ge.manifest.repository_url||"",E),L_(ge.id).catch(Xe=>{console.warn("Failed to record download:",Xe)}),xe({title:"安装成功",description:`${ge.manifest.name} 已成功安装`});const he=await hr();z(he),y(Xe=>Xe.map(ye=>{if(ye.id===ge.id){const W=Pc(ye.id,he),Se=Zc(ye.id,he);return{...ye,installed:W,installed_version:Se}}return ye}))}catch(he){xe({title:"安装失败",description:he instanceof Error?he.message:"未知错误",variant:"destructive"})}finally{be(null)}},De=async E=>{try{await C_(E.id),xe({title:"卸载成功",description:`${E.manifest.name} 已成功卸载`});const he=await hr();z(he),y(Xe=>Xe.map(ye=>{if(ye.id===E.id){const W=Pc(ye.id,he),Se=Zc(ye.id,he);return{...ye,installed:W,installed_version:Se}}return ye}))}catch(he){xe({title:"卸载失败",description:he instanceof Error?he.message:"未知错误",variant:"destructive"})}},_s=async E=>{if(!U?.installed){xe({title:"无法更新",description:"Git 未安装",variant:"destructive"});return}try{const he=await k_(E.id,E.manifest.repository_url||"","main");xe({title:"更新成功",description:`${E.manifest.name} 已从 ${he.old_version} 更新到 ${he.new_version}`});const Xe=await hr();z(Xe),y(ye=>ye.map(W=>{if(W.id===E.id){const Se=Pc(W.id,Xe),Ge=Zc(W.id,Xe);return{...W,installed:Se,installed_version:Ge}}return W}))}catch(he){xe({title:"更新失败",description:he instanceof Error?he.message:"未知错误",variant:"destructive"})}};return e.jsx(Ze,{className:"h-full",children:e.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件市场"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"浏览和管理麦麦的插件"})]}),e.jsxs(_,{onClick:()=>l({to:"/plugin-mirrors"}),children:[e.jsx(Ly,{className:"h-4 w-4 mr-2"}),"配置镜像源"]})]}),U&&!U.installed&&e.jsxs(Ve,{className:"border-orange-600 bg-orange-50 dark:bg-orange-950/20",children:[e.jsx(as,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(La,{className:"h-5 w-5 text-orange-600"}),e.jsxs("div",{children:[e.jsx(ls,{className:"text-lg text-orange-900 dark:text-orange-100",children:"Git 未安装"}),e.jsx(st,{className:"text-orange-800 dark:text-orange-200",children:U.error||"请先安装 Git 才能使用插件安装功能"})]})]})}),e.jsx(ps,{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(Ve,{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(Ft,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ie,{placeholder:"搜索插件...",value:o,onChange:E=>u(E.target.value),className:"pl-9"})]}),e.jsxs(Be,{value:x,onValueChange:h,children:[e.jsx(Le,{className:"w-full sm:w-[200px]",children:e.jsx(He,{placeholder:"选择分类"})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"all",children:"全部分类"}),e.jsx(se,{value:"Group Management",children:"群组管理"}),e.jsx(se,{value:"Entertainment & Interaction",children:"娱乐互动"}),e.jsx(se,{value:"Utility Tools",children:"实用工具"}),e.jsx(se,{value:"Content Generation",children:"内容生成"}),e.jsx(se,{value:"Multimedia",children:"多媒体"}),e.jsx(se,{value:"External Integration",children:"外部集成"}),e.jsx(se,{value:"Data Analysis & Insights",children:"数据分析与洞察"}),e.jsx(se,{value:"Other",children:"其他"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(gt,{id:"compatible-only",checked:v,onCheckedChange:E=>j(E===!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(ka,{value:p,onValueChange:g,className:"w-full",children:e.jsxs(xa,{className:"grid w-full grid-cols-3",children:[e.jsxs(ts,{value:"all",children:["全部插件 (",N.filter(E=>{if(!E.manifest)return!1;const he=o===""||E.manifest.name?.toLowerCase().includes(o.toLowerCase())||E.manifest.description?.toLowerCase().includes(o.toLowerCase())||E.manifest.keywords&&E.manifest.keywords.some(W=>W.toLowerCase().includes(o.toLowerCase())),Xe=x==="all"||E.manifest.categories&&E.manifest.categories.includes(x),ye=!v||!F||Me(E);return he&&Xe&&ye}).length,")"]}),e.jsxs(ts,{value:"installed",children:["已安装 (",N.filter(E=>{if(!E.manifest)return!1;const he=o===""||E.manifest.name?.toLowerCase().includes(o.toLowerCase())||E.manifest.description?.toLowerCase().includes(o.toLowerCase())||E.manifest.keywords&&E.manifest.keywords.some(W=>W.toLowerCase().includes(o.toLowerCase())),Xe=x==="all"||E.manifest.categories&&E.manifest.categories.includes(x),ye=!v||!F||Me(E);return E.installed&&he&&Xe&&ye}).length,")"]}),e.jsxs(ts,{value:"updates",children:["可更新 (",N.filter(E=>{if(!E.manifest)return!1;const he=o===""||E.manifest.name?.toLowerCase().includes(o.toLowerCase())||E.manifest.description?.toLowerCase().includes(o.toLowerCase())||E.manifest.keywords&&E.manifest.keywords.some(W=>W.toLowerCase().includes(o.toLowerCase())),Xe=x==="all"||E.manifest.categories&&E.manifest.categories.includes(x),ye=!v||!F||Me(E);return E.installed&&Z(E)&&he&&Xe&&ye}).length,")"]})]})}),L&&L.stage==="loading"&&e.jsx(Ve,{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(mt,{className:"h-4 w-4 animate-spin"}),e.jsxs("span",{className:"text-sm font-medium",children:[L.operation==="fetch"&&"加载插件列表",L.operation==="install"&&`安装插件${L.plugin_id?`: ${L.plugin_id}`:""}`,L.operation==="uninstall"&&`卸载插件${L.plugin_id?`: ${L.plugin_id}`:""}`,L.operation==="update"&&`更新插件${L.plugin_id?`: ${L.plugin_id}`:""}`]})]}),e.jsxs("span",{className:"text-sm font-medium",children:[L.progress,"%"]})]}),e.jsx(gi,{value:L.progress,className:"h-2"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:L.message}),L.operation==="fetch"&&L.total_plugins>0&&e.jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["已加载 ",L.loaded_plugins," / ",L.total_plugins," 个插件"]})]})}),L&&L.stage==="error"&&L.error&&e.jsx(Ve,{className:"border-destructive bg-destructive/10",children:e.jsx(as,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(La,{className:"h-5 w-5 text-destructive"}),e.jsxs("div",{children:[e.jsx(ls,{className:"text-lg text-destructive",children:"加载失败"}),e.jsx(st,{className:"text-destructive/80",children:L.error})]})]})})}),S?e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(mt,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件列表中..."})]}):R?e.jsx(Ve,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(La,{className:"h-12 w-12 text-destructive mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:R}),e.jsx(_,{onClick:()=>window.location.reload(),children:"重新加载"})]})}):me.length===0?e.jsx(Ve,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Ft,{className:"h-12 w-12 text-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:o||x!=="all"?"尝试调整搜索条件或筛选器":"暂无可用插件"})]})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:me.map(E=>e.jsxs(Ve,{className:"flex flex-col hover:shadow-lg transition-shadow h-full",children:[e.jsxs(as,{children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx(ls,{className:"text-xl",children:E.manifest?.name||E.id}),e.jsxs("div",{className:"flex flex-col gap-1",children:[E.manifest?.categories&&E.manifest.categories[0]&&e.jsx(Qe,{variant:"secondary",className:"text-xs whitespace-nowrap",children:Hp[E.manifest.categories[0]]||E.manifest.categories[0]}),_e(E)]})]}),e.jsx(st,{className:"line-clamp-2",children:E.manifest?.description||"无描述"})]}),e.jsx(ps,{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(Ua,{className:"h-4 w-4"}),e.jsx("span",{children:(M[E.id]?.downloads??E.downloads??0).toLocaleString()})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(fl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),e.jsx("span",{children:(M[E.id]?.rating??E.rating??0).toFixed(1)})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[E.manifest?.keywords&&E.manifest.keywords.slice(0,3).map(he=>e.jsx(Qe,{variant:"outline",className:"text-xs",children:he},he)),E.manifest?.keywords&&E.manifest.keywords.length>3&&e.jsxs(Qe,{variant:"outline",className:"text-xs",children:["+",E.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",E.manifest?.version||"unknown"," · ",E.manifest?.author?.name||"Unknown"]}),E.manifest?.host_application&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{children:"支持:"}),e.jsxs("span",{className:"font-medium",children:[E.manifest.host_application.min_version,E.manifest.host_application.max_version?` - ${E.manifest.host_application.max_version}`:" - 最新版本"]})]})]})]})}),e.jsx(Fg,{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:()=>r(E),children:"查看详情"}),E.installed?Z(E)?e.jsxs(_,{size:"sm",disabled:!U?.installed,title:U?.installed?void 0:"Git 未安装",onClick:()=>_s(E),children:[e.jsx(qt,{className:"h-4 w-4 mr-1"}),"更新"]}):e.jsxs(_,{variant:"destructive",size:"sm",disabled:!U?.installed,title:U?.installed?void 0:"Git 未安装",onClick:()=>De(E),children:[e.jsx(es,{className:"h-4 w-4 mr-1"}),"卸载"]}):e.jsxs(_,{size:"sm",disabled:!U?.installed||L?.operation==="install"||F!==null&&!Me(E),title:U?.installed?F!==null&&!Me(E)?`不兼容当前版本 (需要 ${E.manifest?.host_application?.min_version||"未知"}${E.manifest?.host_application?.max_version?` - ${E.manifest.host_application.max_version}`:"+"},当前 ${F?.version})`:void 0:"Git 未安装",onClick:()=>X(E),children:[e.jsx(Ua,{className:"h-4 w-4 mr-1"}),L?.operation==="install"&&L?.plugin_id===E.id?"安装中...":"安装"]})]})})]},E.id))}),e.jsx(Gs,{open:i!==null,onOpenChange:ke,children:i&&i.manifest&&e.jsx(Us,{className:"max-w-2xl max-h-[80vh] p-0 flex flex-col",children:e.jsx(Ze,{className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-6",children:[e.jsx(Bs,{children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"space-y-2 flex-1",children:[e.jsx(Hs,{className:"text-2xl",children:i.manifest.name}),e.jsxs(Ws,{children:["作者: ",i.manifest.author?.name||"Unknown",i.manifest.author?.url&&e.jsx("a",{href:i.manifest.author.url,target:"_blank",rel:"noopener noreferrer",className:"ml-2 text-primary hover:underline",children:e.jsx(Wc,{className:"h-3 w-3 inline"})})]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[i.manifest.categories&&i.manifest.categories[0]&&e.jsx(Qe,{variant:"secondary",children:Hp[i.manifest.categories[0]]||i.manifest.categories[0]}),_e(i)]})]})}),e.jsxs("div",{className:"space-y-6",children:[e.jsx(B_,{pluginId:i.id}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"版本"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["v",i.manifest?.version||"unknown"]}),i.installed&&i.installed_version&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["已安装: v",i.installed_version]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"下载量"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:(M[i.id]?.downloads??i.downloads??0).toLocaleString()})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"评分"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(fl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[(M[i.id]?.rating??i.rating??0).toFixed(1)," (",M[i.id]?.rating_count??i.review_count??0,")"]})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"许可证"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:i.manifest.license||"Unknown"})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"支持版本"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[i.manifest.host_application?.min_version||"未知",i.manifest.host_application?.max_version?` - ${i.manifest.host_application.max_version}`:" - 最新版本"]})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium mb-2",children:"关键词"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:i.manifest.keywords&&i.manifest.keywords.map(E=>e.jsx(Qe,{variant:"outline",children:E},E))})]}),i.detailed_description&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium mb-2",children:"详细说明"}),e.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:i.detailed_description})]}),!i.detailed_description&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium mb-2",children:"说明"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:i.manifest.description||"无描述"})]}),e.jsxs("div",{className:"space-y-2",children:[i.manifest.homepage_url&&e.jsxs("div",{className:"text-sm",children:[e.jsx("span",{className:"font-medium",children:"主页: "}),e.jsx("a",{href:i.manifest.homepage_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:i.manifest.homepage_url})]}),i.manifest.repository_url&&e.jsxs("div",{className:"text-sm",children:[e.jsx("span",{className:"font-medium",children:"仓库: "}),e.jsx("a",{href:i.manifest.repository_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:i.manifest.repository_url})]})]})]}),e.jsxs(tt,{children:[i.manifest.homepage_url&&e.jsxs(_,{onClick:()=>window.open(i.manifest.homepage_url,"_blank"),children:[e.jsx(Wc,{className:"h-4 w-4 mr-2"}),"访问主页"]}),i.manifest.repository_url&&e.jsxs(_,{variant:"outline",onClick:()=>window.open(i.manifest.repository_url,"_blank"),children:[e.jsx(Wc,{className:"h-4 w-4 mr-2"}),"查看仓库"]})]})]})})})}),e.jsx(Gs,{open:fe,onOpenChange:ve,children:e.jsxs(Us,{children:[e.jsxs(Bs,{children:[e.jsx(Hs,{children:"安装插件"}),e.jsxs(Ws,{children:["安装 ",ge?.manifest.name]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["版本: ",ge?.manifest.version]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["作者: ",typeof ge?.manifest.author=="string"?ge.manifest.author:ge?.manifest.author?.name]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(gt,{id:"advanced-options",checked:k,onCheckedChange:E=>ne(E)}),e.jsx("label",{htmlFor:"advanced-options",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"高级选项"})]}),k&&e.jsx("div",{className:"space-y-4 p-4 border rounded-lg",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"分支选择"}),e.jsxs(ka,{value:K,onValueChange:E=>re(E),children:[e.jsxs(xa,{className:"grid w-full grid-cols-2",children:[e.jsx(ts,{value:"preset",className:"text-xs",children:"预设分支"}),e.jsx(ts,{value:"custom",className:"text-xs",children:"自定义分支"})]}),K==="preset"&&e.jsx("div",{className:"mt-3",children:e.jsxs(Be,{value:je,onValueChange:Ne,children:[e.jsx(Le,{children:e.jsx(He,{placeholder:"选择分支"})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"main",children:"main (默认)"}),e.jsx(se,{value:"master",children:"master"}),e.jsx(se,{value:"dev",children:"dev (开发版)"}),e.jsx(se,{value:"develop",children:"develop"}),e.jsx(se,{value:"beta",children:"beta (测试版)"}),e.jsx(se,{value:"stable",children:"stable (稳定版)"})]})]})}),K==="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:E=>Y(E.target.value)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"输入 Git 分支名称、标签或提交哈希"})]})]})]})}),!k&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"将从默认分支 (main) 安装插件"})]}),e.jsxs(tt,{children:[e.jsx(_,{variant:"outline",onClick:()=>ve(!1),children:"取消"}),e.jsxs(_,{onClick:ae,children:[e.jsx(Ua,{className:"h-4 w-4 mr-2"}),"安装"]})]})]})})]})})}function $_(){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(Ug,{className:"h-8 w-8",strokeWidth:2}),"模型分配预设市场"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"浏览和下载社区共享的模型分配预设配置"})]})})}),e.jsx(Ze,{className:"flex-1",children:e.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-12rem)]",children:e.jsxs(Ve,{className:"max-w-2xl w-full border-dashed",children:[e.jsxs(as,{className:"text-center",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx(Ql,{className:"h-16 w-16 text-muted-foreground"})}),e.jsx(ls,{className:"text-2xl",children:"功能开发中"}),e.jsx(st,{className:"text-base",children:"模型分配预设市场功能正在开发中,敬请期待!"})]}),e.jsx(ps,{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 q_({field:l,value:i,onChange:r}){const[o,u]=m.useState(!1);switch(l.ui_type){case"switch":return e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{children:l.label}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]}),e.jsx(Fe,{checked:!!i,onCheckedChange:r,disabled:l.disabled})]});case"number":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:l.label}),e.jsx(ie,{type:"number",value:i??l.default,onChange:x=>r(parseFloat(x.target.value)||0),min:l.min,max:l.max,step:l.step??1,placeholder:l.placeholder,disabled:l.disabled}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]});case"slider":return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{children:l.label}),e.jsx("span",{className:"text-sm text-muted-foreground",children:i??l.default})]}),e.jsx(Ca,{value:[i??l.default],onValueChange:x=>r(x[0]),min:l.min??0,max:l.max??100,step:l.step??1,disabled:l.disabled}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]});case"select":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:l.label}),e.jsxs(Be,{value:String(i??l.default),onValueChange:r,disabled:l.disabled,children:[e.jsx(Le,{children:e.jsx(He,{placeholder:l.placeholder??"请选择"})}),e.jsx(Ue,{children:l.choices?.map(x=>e.jsx(se,{value:String(x),children:String(x)},String(x)))})]}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]});case"textarea":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:l.label}),e.jsx(Is,{value:i??l.default,onChange:x=>r(x.target.value),placeholder:l.placeholder,rows:l.rows??3,disabled:l.disabled}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]});case"password":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:l.label}),e.jsxs("div",{className:"relative",children:[e.jsx(ie,{type:o?"text":"password",value:i??"",onChange:x=>r(x.target.value),placeholder:l.placeholder,disabled:l.disabled,className:"pr-10"}),e.jsx(_,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3",onClick:()=>u(!o),children:o?e.jsx(vr,{className:"h-4 w-4"}):e.jsx(Qt,{className:"h-4 w-4"})})]}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]});case"text":default:return e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:l.label}),e.jsx(ie,{type:"text",value:i??l.default??"",onChange:x=>r(x.target.value),placeholder:l.placeholder,maxLength:l.max_length,disabled:l.disabled}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]})}}function $p({section:l,config:i,onChange:r}){const[o,u]=m.useState(!l.collapsed),x=Object.entries(l.fields).filter(([,h])=>!h.hidden).sort(([,h],[,p])=>h.order-p.order);return e.jsx(_r,{open:o,onOpenChange:u,children:e.jsxs(Ve,{children:[e.jsx(Sr,{asChild:!0,children:e.jsxs(as,{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:[o?e.jsx(Qa,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(Xa,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(ls,{className:"text-lg",children:l.title})]}),e.jsxs(Qe,{variant:"secondary",className:"text-xs",children:[x.length," 项"]})]}),l.description&&e.jsx(st,{className:"ml-6",children:l.description})]})}),e.jsx(Cr,{children:e.jsx(ps,{className:"space-y-4 pt-0",children:x.map(([h,p])=>e.jsx(q_,{field:p,value:i[l.name]?.[h],onChange:g=>r(l.name,h,g),sectionName:l.name},h))})})]})})}function G_({plugin:l,onBack:i}){const{toast:r}=Vs(),[o,u]=m.useState(null),[x,h]=m.useState({}),[p,g]=m.useState({}),[v,j]=m.useState(!0),[N,y]=m.useState(!1),[S,w]=m.useState(!1),[R,O]=m.useState(!1),U=m.useCallback(async()=>{j(!0);try{const[M,Q]=await Promise.all([T_(l.id),E_(l.id)]);u(M),h(Q),g(JSON.parse(JSON.stringify(Q)))}catch(M){r({title:"加载配置失败",description:M instanceof Error?M.message:"未知错误",variant:"destructive"})}finally{j(!1)}},[l.id,r]);m.useEffect(()=>{U()},[U]),m.useEffect(()=>{w(JSON.stringify(x)!==JSON.stringify(p))},[x,p]);const G=(M,Q,fe)=>{h(ve=>({...ve,[M]:{...ve[M]||{},[Q]:fe}}))},L=async()=>{y(!0);try{await z_(l.id,x),g(JSON.parse(JSON.stringify(x))),r({title:"配置已保存",description:"更改将在插件重新加载后生效"})}catch(M){r({title:"保存失败",description:M instanceof Error?M.message:"未知错误",variant:"destructive"})}finally{y(!1)}},T=async()=>{try{await M_(l.id),r({title:"配置已重置",description:"下次加载插件时将使用默认配置"}),O(!1),U()}catch(M){r({title:"重置失败",description:M instanceof Error?M.message:"未知错误",variant:"destructive"})}},F=async()=>{try{const M=await A_(l.id);r({title:M.message,description:M.note}),U()}catch(M){r({title:"切换状态失败",description:M instanceof Error?M.message:"未知错误",variant:"destructive"})}};if(v)return e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx(mt,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(!o)return e.jsxs("div",{className:"flex flex-col items-center justify-center h-64 space-y-4",children:[e.jsx(Gt,{className:"h-12 w-12 text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground",children:"无法加载配置"}),e.jsxs(_,{onClick:i,variant:"outline",children:[e.jsx(di,{className:"h-4 w-4 mr-2"}),"返回"]})]});const q=Object.values(o.sections).sort((M,Q)=>M.order-Q.order),z=x.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:i,children:e.jsx(di,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:o.plugin_info.name||l.manifest.name}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx(Qe,{variant:z?"default":"secondary",children:z?"已启用":"已禁用"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["v",o.plugin_info.version||l.manifest.version]})]})]})]}),e.jsxs("div",{className:"flex gap-2 ml-10 sm:ml-0",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:F,children:[e.jsx(kr,{className:"h-4 w-4 mr-2"}),z?"禁用":"启用"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>O(!0),children:[e.jsx(ao,{className:"h-4 w-4 mr-2"}),"重置"]}),e.jsxs(_,{size:"sm",onClick:L,disabled:!S||N,children:[N?e.jsx(mt,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(Tr,{className:"h-4 w-4 mr-2"}),"保存"]})]})]}),S&&e.jsx(Ve,{className:"border-orange-200 bg-orange-50 dark:bg-orange-950/20 dark:border-orange-900",children:e.jsx(ps,{className:"py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ia,{className:"h-4 w-4 text-orange-600"}),e.jsx("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:"有未保存的更改"})]})})}),o.layout.type==="tabs"&&o.layout.tabs.length>0?e.jsxs(ka,{defaultValue:o.layout.tabs[0]?.id,children:[e.jsx(xa,{children:o.layout.tabs.map(M=>e.jsxs(ts,{value:M.id,children:[M.title,M.badge&&e.jsx(Qe,{variant:"secondary",className:"ml-2 text-xs",children:M.badge})]},M.id))}),o.layout.tabs.map(M=>e.jsx(Ms,{value:M.id,className:"space-y-4 mt-4",children:M.sections.map(Q=>{const fe=o.sections[Q];return fe?e.jsx($p,{section:fe,config:x,onChange:G},Q):null})},M.id))]}):e.jsx("div",{className:"space-y-4",children:q.map(M=>e.jsx($p,{section:M,config:x,onChange:G},M.name))}),e.jsx(Gs,{open:R,onOpenChange:O,children:e.jsxs(Us,{children:[e.jsxs(Bs,{children:[e.jsx(Hs,{children:"确认重置配置"}),e.jsx(Ws,{children:"这将删除当前配置文件,下次加载插件时将使用默认配置。此操作不可撤销。"})]}),e.jsxs(tt,{children:[e.jsx(_,{variant:"outline",onClick:()=>O(!1),children:"取消"}),e.jsx(_,{variant:"destructive",onClick:T,children:"确认重置"})]})]})})]})}function F_(){const{toast:l}=Vs(),[i,r]=m.useState([]),[o,u]=m.useState(!0),[x,h]=m.useState(""),[p,g]=m.useState(null),v=async()=>{u(!0);try{const S=await hr();r(S)}catch(S){l({title:"加载插件列表失败",description:S instanceof Error?S.message:"未知错误",variant:"destructive"})}finally{u(!1)}};m.useEffect(()=>{v()},[]);const j=i.filter(S=>{const w=x.toLowerCase();return S.id.toLowerCase().includes(w)||S.manifest.name.toLowerCase().includes(w)||S.manifest.description?.toLowerCase().includes(w)}),N=i.length,y=0;return p?e.jsx(Ze,{className:"h-full",children:e.jsx("div",{className:"p-4 sm:p-6",children:e.jsx(G_,{plugin:p,onBack:()=>g(null)})})}):e.jsx(Ze,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件配置"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理和配置已安装的插件"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:v,children:[e.jsx(qt,{className:`h-4 w-4 mr-2 ${o?"animate-spin":""}`}),"刷新"]})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-3",children:[e.jsxs(Ve,{children:[e.jsxs(as,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(ls,{className:"text-sm font-medium",children:"已安装插件"}),e.jsx(Ql,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(ps,{children:[e.jsx("div",{className:"text-2xl font-bold",children:i.length}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:o?"正在加载...":"个插件"})]})]}),e.jsxs(Ve,{children:[e.jsxs(as,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(ls,{className:"text-sm font-medium",children:"已启用"}),e.jsx(ma,{className:"h-4 w-4 text-green-600"})]}),e.jsxs(ps,{children:[e.jsx("div",{className:"text-2xl font-bold",children:N}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"运行中的插件"})]})]}),e.jsxs(Ve,{children:[e.jsxs(as,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(ls,{className:"text-sm font-medium",children:"已禁用"}),e.jsx(Gt,{className:"h-4 w-4 text-orange-600"})]}),e.jsxs(ps,{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(Ft,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ie,{placeholder:"搜索插件...",value:x,onChange:S=>h(S.target.value),className:"pl-9"})]}),e.jsxs(Ve,{children:[e.jsxs(as,{children:[e.jsx(ls,{children:"已安装的插件"}),e.jsx(st,{children:"点击插件查看和编辑配置"})]}),e.jsx(ps,{children:o?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(mt,{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(Ql,{className:"h-16 w-16 text-muted-foreground/50"}),e.jsxs("div",{className:"text-center space-y-2",children:[e.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:x?"没有找到匹配的插件":"暂无已安装的插件"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:x?"尝试其他搜索关键词":"前往插件市场安装插件"})]})]}):e.jsx("div",{className:"space-y-2",children:j.map(S=>e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg border hover:bg-muted/50 cursor-pointer transition-colors",onClick:()=>g(S),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(Ql,{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:S.manifest.name}),e.jsxs(Qe,{variant:"secondary",className:"text-xs flex-shrink-0",children:["v",S.manifest.version]})]}),e.jsx("p",{className:"text-sm text-muted-foreground truncate",children:S.manifest.description||"暂无描述"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(_,{variant:"ghost",size:"sm",children:e.jsx(hi,{className:"h-4 w-4"})}),e.jsx(Xa,{className:"h-4 w-4 text-muted-foreground"})]})]},S.id))})})]})]})})}function V_(){const l=Ea(),{toast:i}=Vs(),[r,o]=m.useState([]),[u,x]=m.useState(!0),[h,p]=m.useState(null),[g,v]=m.useState(null),[j,N]=m.useState(!1),[y,S]=m.useState(!1),[w,R]=m.useState({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),O=m.useCallback(async()=>{try{x(!0),p(null);const z=localStorage.getItem("access-token"),M=await fetch("/api/webui/plugins/mirrors",{headers:{Authorization:`Bearer ${z}`}});if(!M.ok)throw new Error("获取镜像源列表失败");const Q=await M.json();o(Q.mirrors||[])}catch(z){const M=z instanceof Error?z.message:"加载镜像源失败";p(M),i({title:"加载失败",description:M,variant:"destructive"})}finally{x(!1)}},[i]);m.useEffect(()=>{O()},[O]);const U=async()=>{try{const z=localStorage.getItem("access-token"),M=await fetch("/api/webui/plugins/mirrors",{method:"POST",headers:{Authorization:`Bearer ${z}`,"Content-Type":"application/json"},body:JSON.stringify(w)});if(!M.ok){const Q=await M.json();throw new Error(Q.detail||"添加镜像源失败")}i({title:"添加成功",description:"镜像源已添加"}),N(!1),R({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),O()}catch(z){i({title:"添加失败",description:z instanceof Error?z.message:"未知错误",variant:"destructive"})}},G=async()=>{if(g)try{const z=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${g.id}`,{method:"PUT",headers:{Authorization:`Bearer ${z}`,"Content-Type":"application/json"},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("更新镜像源失败");i({title:"更新成功",description:"镜像源已更新"}),S(!1),v(null),O()}catch(z){i({title:"更新失败",description:z instanceof Error?z.message:"未知错误",variant:"destructive"})}},L=async z=>{if(confirm("确定要删除这个镜像源吗?"))try{const M=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${z}`,{method:"DELETE",headers:{Authorization:`Bearer ${M}`}})).ok)throw new Error("删除镜像源失败");i({title:"删除成功",description:"镜像源已删除"}),O()}catch(M){i({title:"删除失败",description:M instanceof Error?M.message:"未知错误",variant:"destructive"})}},T=async z=>{try{const M=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${z.id}`,{method:"PUT",headers:{Authorization:`Bearer ${M}`,"Content-Type":"application/json"},body:JSON.stringify({enabled:!z.enabled})})).ok)throw new Error("更新状态失败");O()}catch(M){i({title:"更新失败",description:M instanceof Error?M.message:"未知错误",variant:"destructive"})}},F=z=>{v(z),R({id:z.id,name:z.name,raw_prefix:z.raw_prefix,clone_prefix:z.clone_prefix,enabled:z.enabled,priority:z.priority}),S(!0)},q=async(z,M)=>{const Q=M==="up"?z.priority-1:z.priority+1;if(!(Q<1))try{const fe=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${z.id}`,{method:"PUT",headers:{Authorization:`Bearer ${fe}`,"Content-Type":"application/json"},body:JSON.stringify({priority:Q})})).ok)throw new Error("更新优先级失败");O()}catch(fe){i({title:"更新失败",description:fe instanceof Error?fe.message:"未知错误",variant:"destructive"})}};return e.jsx(Ze,{className:"h-full",children:e.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>l({to:"/plugins"}),children:e.jsx(di,{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:()=>N(!0),children:[e.jsx(ft,{className:"h-4 w-4 mr-2"}),"添加镜像源"]})]}),u?e.jsx(Ve,{className:"p-6",children:e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(mt,{className:"h-8 w-8 animate-spin text-primary"})})}):h?e.jsx(Ve,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(La,{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:O,children:"重新加载"})]})}):e.jsxs(Ve,{children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs(jn,{children:[e.jsx(vn,{children:e.jsxs(pt,{children:[e.jsx(Pe,{children:"状态"}),e.jsx(Pe,{children:"名称"}),e.jsx(Pe,{children:"ID"}),e.jsx(Pe,{children:"优先级"}),e.jsx(Pe,{className:"text-right",children:"操作"})]})}),e.jsx(bn,{children:r.map(z=>e.jsxs(pt,{children:[e.jsx(Ie,{children:e.jsx(Fe,{checked:z.enabled,onCheckedChange:()=>T(z)})}),e.jsx(Ie,{children:e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:z.name}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Raw: ",z.raw_prefix]})]})}),e.jsx(Ie,{children:e.jsx(Qe,{variant:"outline",children:z.id})}),e.jsx(Ie,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-mono",children:z.priority}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(_,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>q(z,"up"),disabled:z.priority===1,children:e.jsx(ui,{className:"h-3 w-3"})}),e.jsx(_,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>q(z,"down"),children:e.jsx(Qa,{className:"h-3 w-3"})})]})]})}),e.jsx(Ie,{className:"text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>F(z),children:e.jsx(pn,{className:"h-4 w-4"})}),e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>L(z.id),children:e.jsx(es,{className:"h-4 w-4 text-destructive"})})]})})]},z.id))})]})}),e.jsx("div",{className:"md:hidden p-4 space-y-4",children:r.map(z=>e.jsx(Ve,{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:z.name}),z.enabled&&e.jsx(Qe,{variant:"default",className:"text-xs",children:"启用"})]}),e.jsx(Qe,{variant:"outline",className:"mt-1 text-xs",children:z.id})]}),e.jsx(Fe,{checked:z.enabled,onCheckedChange:()=>T(z)})]}),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:z.raw_prefix})]}),e.jsxs("div",{className:"text-muted-foreground",children:[e.jsx("span",{className:"font-medium",children:"优先级: "}),e.jsx("span",{className:"font-mono",children:z.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:()=>F(z),children:[e.jsx(pn,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>q(z,"up"),disabled:z.priority===1,children:e.jsx(ui,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>q(z,"down"),children:e.jsx(Qa,{className:"h-4 w-4"})}),e.jsx(_,{variant:"destructive",size:"sm",onClick:()=>L(z.id),children:e.jsx(es,{className:"h-4 w-4"})})]})]})},z.id))})]}),e.jsx(Gs,{open:j,onOpenChange:N,children:e.jsxs(Us,{className:"max-w-lg",children:[e.jsxs(Bs,{children:[e.jsx(Hs,{children:"添加镜像源"}),e.jsx(Ws,{children:"添加新的 Git 镜像源配置"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"add-id",children:"镜像源 ID *"}),e.jsx(ie,{id:"add-id",placeholder:"例如: my-mirror",value:w.id,onChange:z=>R({...w,id:z.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"add-name",children:"名称 *"}),e.jsx(ie,{id:"add-name",placeholder:"例如: 我的镜像源",value:w.name,onChange:z=>R({...w,name:z.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"add-raw",children:"Raw 文件前缀 *"}),e.jsx(ie,{id:"add-raw",placeholder:"https://example.com/raw",value:w.raw_prefix,onChange:z=>R({...w,raw_prefix:z.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"add-clone",children:"克隆前缀 *"}),e.jsx(ie,{id:"add-clone",placeholder:"https://example.com/clone",value:w.clone_prefix,onChange:z=>R({...w,clone_prefix:z.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"add-priority",children:"优先级"}),e.jsx(ie,{id:"add-priority",type:"number",min:"1",value:w.priority,onChange:z=>R({...w,priority:parseInt(z.target.value)||1})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Fe,{id:"add-enabled",checked:w.enabled,onCheckedChange:z=>R({...w,enabled:z})}),e.jsx(C,{htmlFor:"add-enabled",children:"启用此镜像源"})]})]}),e.jsxs(tt,{children:[e.jsx(_,{variant:"outline",onClick:()=>N(!1),children:"取消"}),e.jsx(_,{onClick:U,children:"添加"})]})]})}),e.jsx(Gs,{open:y,onOpenChange:S,children:e.jsxs(Us,{className:"max-w-lg",children:[e.jsxs(Bs,{children:[e.jsx(Hs,{children:"编辑镜像源"}),e.jsx(Ws,{children:"修改镜像源配置"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:"镜像源 ID"}),e.jsx(ie,{value:w.id,disabled:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"edit-name",children:"名称 *"}),e.jsx(ie,{id:"edit-name",value:w.name,onChange:z=>R({...w,name:z.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"edit-raw",children:"Raw 文件前缀 *"}),e.jsx(ie,{id:"edit-raw",value:w.raw_prefix,onChange:z=>R({...w,raw_prefix:z.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"edit-clone",children:"克隆前缀 *"}),e.jsx(ie,{id:"edit-clone",value:w.clone_prefix,onChange:z=>R({...w,clone_prefix:z.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"edit-priority",children:"优先级"}),e.jsx(ie,{id:"edit-priority",type:"number",min:"1",value:w.priority,onChange:z=>R({...w,priority:parseInt(z.target.value)||1})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Fe,{id:"edit-enabled",checked:w.enabled,onCheckedChange:z=>R({...w,enabled:z})}),e.jsx(C,{htmlFor:"edit-enabled",children:"启用此镜像源"})]})]}),e.jsxs(tt,{children:[e.jsx(_,{variant:"outline",onClick:()=>S(!1),children:"取消"}),e.jsx(_,{onClick:G,children:"保存"})]})]})})]})})}const fr=m.forwardRef(({className:l,...i},r)=>e.jsx(ng,{ref:r,className:H("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",l),...i}));fr.displayName=ng.displayName;const I_=m.forwardRef(({className:l,...i},r)=>e.jsx(ig,{ref:r,className:H("aspect-square h-full w-full",l),...i}));I_.displayName=ig.displayName;const pr=m.forwardRef(({className:l,...i},r)=>e.jsx(rg,{ref:r,className:H("flex h-full w-full items-center justify-center rounded-full bg-muted",l),...i}));pr.displayName=rg.displayName;function Q_(){return"webui_"+Math.random().toString(36).substr(2,9)+"_"+Date.now().toString(36)}function Y_(){const l="maibot_webui_user_id";let i=localStorage.getItem(l);return i||(i=Q_(),localStorage.setItem(l,i)),i}function K_(){return localStorage.getItem("maibot_webui_user_name")||"WebUI用户"}function X_(l){localStorage.setItem("maibot_webui_user_name",l)}const jj="maibot_webui_virtual_tabs";function J_(){try{const l=localStorage.getItem(jj);if(l)return JSON.parse(l)}catch(l){console.error("[Chat] 加载虚拟标签页失败:",l)}return[]}function qp(l){try{localStorage.setItem(jj,JSON.stringify(l))}catch(i){console.error("[Chat] 保存虚拟标签页失败:",i)}}function P_({segment:l}){switch(l.type){case"text":return e.jsx("span",{className:"whitespace-pre-wrap",children:String(l.data)});case"image":case"emoji":return e.jsx("img",{src:String(l.data),alt:l.type==="emoji"?"表情包":"图片",className:H("rounded-lg max-w-full",l.type==="emoji"?"max-h-32":"max-h-64"),loading:"lazy",onError:i=>{const r=i.target;r.style.display="none",r.parentElement?.insertAdjacentHTML("beforeend",`[${l.type==="emoji"?"表情包":"图片"}加载失败]`)}});case"voice":return e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("audio",{controls:!0,src:String(l.data),className:"max-w-[200px] h-8",children:"您的浏览器不支持音频播放"})});case"video":return e.jsx("video",{controls:!0,src:String(l.data),className:"rounded-lg max-w-full max-h-64",children:"您的浏览器不支持视频播放"});case"face":return e.jsxs("span",{className:"text-muted-foreground",children:["[表情:",String(l.data),"]"]});case"music":return e.jsx("span",{className:"text-muted-foreground",children:"[音乐分享]"});case"file":return e.jsxs("span",{className:"text-muted-foreground",children:["[文件: ",String(l.data),"]"]});case"reply":return e.jsx("span",{className:"text-muted-foreground text-xs",children:"[回复消息]"});case"forward":return e.jsx("span",{className:"text-muted-foreground",children:"[转发消息]"});case"unknown":default:return e.jsxs("span",{className:"text-muted-foreground",children:["[",l.original_type||"未知消息","]"]})}}function Z_({message:l,isBot:i}){return l.message_type==="rich"&&l.segments&&l.segments.length>0?e.jsx("div",{className:"flex flex-col gap-2",children:l.segments.map((r,o)=>e.jsx(P_,{segment:r},o))}):e.jsx("span",{className:"whitespace-pre-wrap",children:l.content})}function W_(){const l={id:"webui-default",type:"webui",label:"WebUI",messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}},i=()=>{const $e=J_().map(Oe=>{const Ke=Oe.virtualConfig;return!Ke.groupId&&Ke.platform&&Ke.userId&&(Ke.groupId=`webui_virtual_group_${Ke.platform}_${Ke.userId}`),{id:Oe.id,type:"virtual",label:Oe.label,virtualConfig:Ke,messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}}});return[l,...$e]},[r,o]=m.useState(i),[u,x]=m.useState("webui-default"),h=r.find(I=>I.id===u)||r[0],[p,g]=m.useState(""),[v,j]=m.useState(!1),[N,y]=m.useState(!0),[S,w]=m.useState(K_()),[R,O]=m.useState(!1),[U,G]=m.useState(""),[L,T]=m.useState(!1),[F,q]=m.useState([]),[z,M]=m.useState([]),[Q,fe]=m.useState(!1),[ve,ge]=m.useState(!1),[be,je]=m.useState(""),[Ne,D]=m.useState({platform:"",personId:"",userId:"",userName:"",groupName:"",groupId:""}),Y=m.useRef(Y_()),K=m.useRef(new Map),re=m.useRef(null),k=m.useRef(new Map),ne=m.useRef(0),xe=m.useRef(new Map),{toast:Ce}=Vs(),_e=I=>(ne.current+=1,`${I}-${Date.now()}-${ne.current}-${Math.random().toString(36).substr(2,9)}`),Me=m.useCallback((I,$e)=>{o(Oe=>Oe.map(Ke=>Ke.id===I?{...Ke,...$e}:Ke))},[]),Z=m.useCallback((I,$e)=>{o(Oe=>Oe.map(Ke=>Ke.id===I?{...Ke,messages:[...Ke.messages,$e]}:Ke))},[]),me=m.useCallback(()=>{re.current?.scrollIntoView({behavior:"smooth"})},[]);m.useEffect(()=>{me()},[h?.messages,me]);const ke=m.useCallback(async()=>{fe(!0);try{const I=await Te("/api/chat/platforms");if(console.log("[Chat] 平台列表响应:",I.status,I.headers.get("content-type")),I.ok){const $e=I.headers.get("content-type");if($e&&$e.includes("application/json")){const Oe=await I.json();console.log("[Chat] 平台列表数据:",Oe),q(Oe.platforms||[])}else{const Oe=await I.text();console.error("[Chat] 获取平台列表失败: 非 JSON 响应:",Oe.substring(0,200)),Ce({title:"连接失败",description:"无法连接到后端服务,请确保 MaiBot 已启动",variant:"destructive"})}}else console.error("[Chat] 获取平台列表失败: HTTP",I.status),Ce({title:"获取平台失败",description:`服务器返回错误: ${I.status}`,variant:"destructive"})}catch(I){console.error("[Chat] 获取平台列表失败:",I),Ce({title:"网络错误",description:"无法连接到后端服务",variant:"destructive"})}finally{fe(!1)}},[Ce]),X=m.useCallback(async(I,$e)=>{ge(!0);try{const Oe=new URLSearchParams;I&&Oe.append("platform",I),$e&&Oe.append("search",$e),Oe.append("limit","50");const Ke=await Te(`/api/chat/persons?${Oe.toString()}`);if(Ke.ok){const $s=Ke.headers.get("content-type");if($s&&$s.includes("application/json")){const Je=await Ke.json();M(Je.persons||[])}else console.error("[Chat] 获取用户列表失败: 后端返回非 JSON 响应")}}catch(Oe){console.error("[Chat] 获取用户列表失败:",Oe)}finally{ge(!1)}},[]);m.useEffect(()=>{Ne.platform&&X(Ne.platform,be)},[Ne.platform,be,X]);const ae=m.useCallback(async(I,$e)=>{y(!0);try{const Oe=new URLSearchParams;Oe.append("user_id",Y.current),Oe.append("limit","50"),$e&&Oe.append("group_id",$e);const Ke=`/api/chat/history?${Oe.toString()}`;console.log("[Chat] 正在加载历史消息:",Ke);const $s=await Te(Ke);if($s.ok){const Je=await $s.text();try{const Ps=JSON.parse(Je);if(Ps.messages&&Ps.messages.length>0){const we=Ps.messages.map(Ee=>({id:Ee.id,type:Ee.type,content:Ee.content,timestamp:Ee.timestamp,sender:{name:Ee.sender_name||(Ee.is_bot?"麦麦":"WebUI用户"),user_id:Ee.user_id,is_bot:Ee.is_bot}}));Me(I,{messages:we});const Ss=xe.current.get(I)||new Set;we.forEach(Ee=>{if(Ee.type==="bot"){const xs=`bot-${Ee.content}-${Math.floor(Ee.timestamp*1e3)}`;Ss.add(xs)}}),xe.current.set(I,Ss)}}catch(Ps){console.error("[Chat] JSON 解析失败:",Ps)}}}catch(Oe){console.error("[Chat] 加载历史消息失败:",Oe)}finally{y(!1)}},[Me]),De=m.useCallback((I,$e,Oe)=>{const Ke=K.current.get(I);if(Ke?.readyState===WebSocket.OPEN||Ke?.readyState===WebSocket.CONNECTING){console.log(`[Tab ${I}] WebSocket 已存在,跳过连接`);return}j(!0);const $s=window.location.protocol==="https:"?"wss:":"ws:",Je=new URLSearchParams;$e==="virtual"&&Oe?(Je.append("user_id",Oe.userId),Je.append("user_name",Oe.userName),Je.append("platform",Oe.platform),Je.append("person_id",Oe.personId),Je.append("group_name",Oe.groupName||"WebUI虚拟群聊"),Oe.groupId&&Je.append("group_id",Oe.groupId)):(Je.append("user_id",Y.current),Je.append("user_name",S));const Ps=`${$s}//${window.location.host}/api/chat/ws?${Je.toString()}`;console.log(`[Tab ${I}] 正在连接 WebSocket:`,Ps);try{const we=new WebSocket(Ps);K.current.set(I,we),we.onopen=()=>{Me(I,{isConnected:!0}),j(!1),console.log(`[Tab ${I}] WebSocket 已连接`)},we.onmessage=Ss=>{try{const Ee=JSON.parse(Ss.data);switch(Ee.type){case"session_info":Me(I,{sessionInfo:{session_id:Ee.session_id,user_id:Ee.user_id,user_name:Ee.user_name,bot_name:Ee.bot_name}});break;case"system":Z(I,{id:_e("sys"),type:"system",content:Ee.content||"",timestamp:Ee.timestamp||Date.now()/1e3});break;case"user_message":{const xs=Ee.sender?.user_id,bs=$e==="virtual"&&Oe?Oe.userId:Y.current;console.log(`[Tab ${I}] 收到 user_message, sender: ${xs}, current: ${bs}`);const Mt=xs?xs.replace(/^webui_user_/,""):"",Ys=bs?bs.replace(/^webui_user_/,""):"";if(Mt&&Ys&&Mt===Ys){console.log(`[Tab ${I}] 跳过自己的消息(user_id 匹配)`);break}const vt=xe.current.get(I)||new Set,Ks=`user-${Ee.content}-${Math.floor((Ee.timestamp||0)*1e3)}`;if(vt.has(Ks)){console.log(`[Tab ${I}] 跳过自己的消息(内容去重)`);break}if(vt.add(Ks),xe.current.set(I,vt),vt.size>100){const nt=vt.values().next().value;nt&&vt.delete(nt)}Z(I,{id:Ee.message_id||_e("user"),type:"user",content:Ee.content||"",timestamp:Ee.timestamp||Date.now()/1e3,sender:Ee.sender});break}case"bot_message":{Me(I,{isTyping:!1});const xs=xe.current.get(I)||new Set,bs=`bot-${Ee.content}-${Math.floor((Ee.timestamp||0)*1e3)}`;if(xs.has(bs))break;if(xs.add(bs),xe.current.set(I,xs),xs.size>100){const Mt=xs.values().next().value;Mt&&xs.delete(Mt)}o(Mt=>Mt.map(Ys=>{if(Ys.id!==I)return Ys;const vt=Ys.messages.filter(nt=>nt.type!=="thinking"),Ks={id:_e("bot"),type:"bot",content:Ee.content||"",message_type:Ee.message_type==="rich"?"rich":"text",segments:Ee.segments,timestamp:Ee.timestamp||Date.now()/1e3,sender:Ee.sender};return{...Ys,messages:[...vt,Ks]}}));break}case"typing":Me(I,{isTyping:Ee.is_typing||!1});break;case"error":o(xs=>xs.map(bs=>{if(bs.id!==I)return bs;const Mt=bs.messages.filter(Ys=>Ys.type!=="thinking");return{...bs,messages:[...Mt,{id:_e("error"),type:"error",content:Ee.content||"发生错误",timestamp:Ee.timestamp||Date.now()/1e3}]}})),Ce({title:"错误",description:Ee.content,variant:"destructive"});break;case"pong":break;case"history":{const xs=Ee.messages||[];if(xs.length>0){const bs=xe.current.get(I)||new Set,Mt=xs.map(Ys=>{const vt=Ys.is_bot||!1,Ks=Ys.id||_e(vt?"bot":"user"),nt=`${vt?"bot":"user"}-${Ys.content}-${Math.floor(Ys.timestamp*1e3)}`;return bs.add(nt),{id:Ks,type:vt?"bot":"user",content:Ys.content,timestamp:Ys.timestamp,sender:{name:Ys.sender_name||(vt?"麦麦":"用户"),user_id:Ys.sender_id,is_bot:vt}}});xe.current.set(I,bs),Me(I,{messages:Mt}),console.log(`[Tab ${I}] 已加载 ${Mt.length} 条历史消息`)}break}default:console.log("未知消息类型:",Ee.type)}}catch(Ee){console.error("解析消息失败:",Ee)}},we.onclose=()=>{Me(I,{isConnected:!1}),j(!1),K.current.delete(I),console.log(`[Tab ${I}] WebSocket 已断开`);const Ss=k.current.get(I);Ss&&clearTimeout(Ss);const Ee=window.setTimeout(()=>{if(!_s.current){const xs=r.find(bs=>bs.id===I);xs&&De(I,xs.type,xs.virtualConfig)}},5e3);k.current.set(I,Ee)},we.onerror=Ss=>{console.error(`[Tab ${I}] WebSocket 错误:`,Ss),j(!1)}}catch(we){console.error(`[Tab ${I}] 创建 WebSocket 失败:`,we),j(!1)}},[S,Me,Z,Ce,r]),_s=m.useRef(!1);m.useEffect(()=>{_s.current=!1;const I=K.current,$e=k.current,Oe=xe.current;ae("webui-default");const Ke=setTimeout(()=>{_s.current||(De("webui-default","webui"),r.forEach(Je=>{Je.type==="virtual"&&Je.virtualConfig&&(Oe.set(Je.id,new Set),setTimeout(()=>{_s.current||De(Je.id,"virtual",Je.virtualConfig)},200))}))},100),$s=setInterval(()=>{I.forEach(Je=>{Je.readyState===WebSocket.OPEN&&Je.send(JSON.stringify({type:"ping"}))})},3e4);return()=>{_s.current=!0,clearTimeout(Ke),clearInterval($s),$e.forEach(Je=>{clearTimeout(Je)}),$e.clear(),I.forEach(Je=>{Je.close()}),I.clear()}},[]);const E=m.useCallback(()=>{const I=K.current.get(u);if(!p.trim()||!I||I.readyState!==WebSocket.OPEN)return;const $e=h?.type==="virtual"&&h.virtualConfig?.userName||S,Oe=p.trim(),Ke=Date.now()/1e3;I.send(JSON.stringify({type:"message",content:Oe,user_name:$e}));const $s=xe.current.get(u)||new Set,Je=`user-${Oe}-${Math.floor(Ke*1e3)}`;if($s.add(Je),xe.current.set(u,$s),$s.size>100){const Ss=$s.values().next().value;Ss&&$s.delete(Ss)}const Ps={id:_e("user"),type:"user",content:Oe,timestamp:Ke,sender:{name:$e,is_bot:!1}};Z(u,Ps);const we={id:_e("thinking"),type:"thinking",content:"",timestamp:Ke+.001,sender:{name:h?.sessionInfo.bot_name||"麦麦",is_bot:!0}};Z(u,we),g("")},[p,S,u,h,Z]),he=I=>{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),E())},Xe=()=>{G(S),O(!0)},ye=()=>{const I=U.trim()||"WebUI用户";w(I),X_(I),O(!1);const $e=K.current.get(u);$e?.readyState===WebSocket.OPEN&&$e.send(JSON.stringify({type:"update_nickname",user_name:I}))},W=()=>{G(""),O(!1)},Se=I=>new Date(I*1e3).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}),Ge=()=>{const I=K.current.get(u);I&&(I.close(),K.current.delete(u)),De(u,h?.type||"webui",h?.virtualConfig)},jt=()=>{D({platform:"",personId:"",userId:"",userName:"",groupName:"",groupId:""}),je(""),ke(),T(!0)},Qs=()=>{if(!Ne.platform||!Ne.personId){Ce({title:"配置不完整",description:"请选择平台和用户",variant:"destructive"});return}const I=`webui_virtual_group_${Ne.platform}_${Ne.userId}`,$e=`virtual-${Ne.platform}-${Ne.userId}-${Date.now()}`,Oe=Ne.userName||Ne.userId,Ke={id:$e,type:"virtual",label:Oe,virtualConfig:{...Ne,groupId:I},messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}};o($s=>{const Je=[...$s,Ke],Ps=Je.filter(we=>we.type==="virtual"&&we.virtualConfig).map(we=>({id:we.id,label:we.label,virtualConfig:we.virtualConfig,createdAt:Date.now()}));return qp(Ps),Je}),x($e),T(!1),xe.current.set($e,new Set),setTimeout(()=>{De($e,"virtual",Ne)},100),Ce({title:"虚拟身份标签页",description:`已创建 ${Oe} 的对话`})},zt=(I,$e)=>{if($e?.stopPropagation(),I==="webui-default")return;const Oe=K.current.get(I);Oe&&(Oe.close(),K.current.delete(I));const Ke=k.current.get(I);Ke&&(clearTimeout(Ke),k.current.delete(I)),xe.current.delete(I),o($s=>{const Je=$s.filter(we=>we.id!==I),Ps=Je.filter(we=>we.type==="virtual"&&we.virtualConfig).map(we=>({id:we.id,label:we.label,virtualConfig:we.virtualConfig,createdAt:Date.now()}));return qp(Ps),Je}),u===I&&x("webui-default")},Es=I=>{x(I)},lt=I=>{D($e=>({...$e,personId:I.person_id,userId:I.user_id,userName:I.nickname||I.person_name}))};return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(Gs,{open:L,onOpenChange:T,children:e.jsxs(Us,{className:"sm:max-w-[500px] max-h-[85vh] overflow-hidden flex flex-col",children:[e.jsxs(Bs,{children:[e.jsxs(Hs,{className:"flex items-center gap-2",children:[e.jsx(Du,{className:"h-5 w-5"}),"新建虚拟身份对话"]}),e.jsx(Ws,{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(C,{className:"flex items-center gap-2",children:[e.jsx(Ju,{className:"h-4 w-4"}),"选择平台"]}),e.jsxs(Be,{value:Ne.platform,onValueChange:I=>{D($e=>({...$e,platform:I,personId:"",userId:"",userName:""})),M([])},children:[e.jsx(Le,{disabled:Q,children:e.jsx(He,{placeholder:Q?"加载中...":"选择平台"})}),e.jsx(Ue,{children:F.map(I=>e.jsxs(se,{value:I.platform,children:[I.platform," (",I.count," 人)"]},I.platform))})]})]}),Ne.platform&&e.jsxs("div",{className:"space-y-2 flex-1 overflow-hidden flex flex-col",children:[e.jsxs(C,{className:"flex items-center gap-2",children:[e.jsx(Pu,{className:"h-4 w-4"}),"选择用户"]}),e.jsxs("div",{className:"relative",children:[e.jsx(Ft,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ie,{placeholder:"搜索用户名...",value:be,onChange:I=>je(I.target.value),className:"pl-9"})]}),e.jsx(Ze,{className:"h-[250px] border rounded-md",children:e.jsx("div",{className:"p-2",children:ve?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(mt,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):z.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground",children:[e.jsx(Pu,{className:"h-8 w-8 mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"没有找到用户"})]}):e.jsx("div",{className:"space-y-1",children:z.map(I=>e.jsxs("button",{onClick:()=>lt(I),className:H("w-full flex items-center gap-3 p-2 rounded-md text-left transition-colors",Ne.personId===I.person_id?"bg-primary text-primary-foreground":"hover:bg-muted"),children:[e.jsx(fr,{className:"h-8 w-8 shrink-0",children:e.jsx(pr,{className:H("text-xs",Ne.personId===I.person_id?"bg-primary-foreground/20":"bg-muted"),children:(I.nickname||I.person_name||"?").charAt(0)})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-medium truncate",children:I.nickname||I.person_name}),e.jsxs("div",{className:H("text-xs truncate",Ne.personId===I.person_id?"text-primary-foreground/70":"text-muted-foreground"),children:["ID: ",I.user_id,I.is_known&&" · 已认识"]})]})]},I.person_id))})})})]}),Ne.personId&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:"虚拟群名(可选)"}),e.jsx(ie,{placeholder:"WebUI虚拟群聊",value:Ne.groupName,onChange:I=>D($e=>({...$e,groupName:I.target.value}))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦会认为这是一个名为此名称的群聊"})]})]}),e.jsxs(tt,{className:"gap-2 sm:gap-0",children:[e.jsx(_,{variant:"outline",onClick:()=>T(!1),children:"取消"}),e.jsx(_,{onClick:Qs,disabled:!Ne.platform||!Ne.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(I=>e.jsxs("div",{className:H("flex items-center gap-1.5 px-3 py-1.5 rounded-md text-sm whitespace-nowrap transition-colors cursor-pointer","hover:bg-muted",u===I.id?"bg-background shadow-sm border":"text-muted-foreground"),onClick:()=>Es(I.id),children:[I.type==="webui"?e.jsx(Yl,{className:"h-3.5 w-3.5"}):e.jsx(Du,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"max-w-[100px] truncate",children:I.label}),e.jsx("span",{className:H("w-1.5 h-1.5 rounded-full",I.isConnected?"bg-green-500":"bg-muted-foreground/50")}),I.id!=="webui-default"&&e.jsx("span",{onClick:$e=>zt(I.id,$e),className:"ml-0.5 p-0.5 rounded hover:bg-muted-foreground/20 cursor-pointer",role:"button",tabIndex:0,onKeyDown:$e=>{($e.key==="Enter"||$e.key===" ")&&($e.preventDefault(),zt(I.id,$e))},children:e.jsx(gl,{className:"h-3 w-3"})})]},I.id)),e.jsx("button",{onClick:jt,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(ft,{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(fr,{className:"h-8 w-8 sm:h-10 sm:w-10 shrink-0",children:e.jsx(pr,{className:"bg-primary/10 text-primary",children:e.jsx(mr,{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(Uy,{className:"h-3 w-3 text-green-500"}),e.jsx("span",{className:"text-green-600 dark:text-green-400",children:"已连接"})]}):v?e.jsxs(e.Fragment,{children:[e.jsx(mt,{className:"h-3 w-3 animate-spin"}),e.jsx("span",{children:"连接中..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(By,{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:[N&&e.jsx(mt,{className:"h-4 w-4 animate-spin text-muted-foreground"}),e.jsx(_,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:Ge,disabled:v,title:"重新连接",children:e.jsx(qt,{className:H("h-4 w-4",v&&"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(Du,{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(io,{className:"h-3 w-3"}),e.jsx("span",{children:"当前身份:"}),R?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ie,{value:U,onChange:I=>G(I.target.value),onKeyDown:I=>{I.key==="Enter"&&ye(),I.key==="Escape"&&W()},className:"h-7 w-32",placeholder:"输入昵称",autoFocus:!0}),e.jsx(_,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:ye,children:"保存"}),e.jsx(_,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:W,children:"取消"})]}):e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"font-medium text-foreground",children:S}),e.jsx(_,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:Xe,title:"修改昵称",children:e.jsx(Hy,{className:"h-3 w-3"})})]})]})})]})}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(Ze,{className:"h-full",children:e.jsxs("div",{className:"p-3 sm:p-4 max-w-4xl mx-auto space-y-3 sm:space-y-4",children:[h?.messages.length===0&&!N&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[e.jsx(mr,{className:"h-12 w-12 mb-4 opacity-50"}),e.jsxs("p",{className:"text-sm",children:["开始与 ",h?.sessionInfo.bot_name||"麦麦"," 对话吧!"]})]}),h?.messages.map(I=>e.jsxs("div",{className:H("flex gap-2 sm:gap-3",I.type==="user"&&"flex-row-reverse",I.type==="system"&&"justify-center",I.type==="error"&&"justify-center"),children:[I.type==="system"&&e.jsx("div",{className:"text-xs text-muted-foreground bg-muted/50 px-3 py-1 rounded-full max-w-[90%]",children:I.content}),I.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:I.content}),I.type==="thinking"&&e.jsxs(e.Fragment,{children:[e.jsx(fr,{className:"h-7 w-7 sm:h-8 sm:w-8 shrink-0",children:e.jsx(pr,{className:"bg-primary/10 text-primary",children:e.jsx(mr,{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:I.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:"思考中..."})]})})]})]}),(I.type==="user"||I.type==="bot")&&e.jsxs(e.Fragment,{children:[e.jsx(fr,{className:"h-7 w-7 sm:h-8 sm:w-8 shrink-0",children:e.jsx(pr,{className:H("text-xs",I.type==="bot"?"bg-primary/10 text-primary":"bg-secondary text-secondary-foreground"),children:I.type==="bot"?e.jsx(mr,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"}):e.jsx(io,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"})})}),e.jsxs("div",{className:H("flex flex-col gap-1 max-w-[75%] sm:max-w-[70%]",I.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:I.sender?.name||(I.type==="bot"?h?.sessionInfo.bot_name:S)}),e.jsx("span",{children:Se(I.timestamp)})]}),e.jsx("div",{className:H("rounded-2xl px-3 py-2 text-sm break-words",I.type==="bot"?"bg-muted rounded-tl-sm":"bg-primary text-primary-foreground rounded-tr-sm"),children:e.jsx(Z_,{message:I,isBot:I.type==="bot"})})]})]})]},I.id)),e.jsx("div",{ref:re})]})})}),e.jsx("div",{className:"shrink-0 border-t bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:e.jsx("div",{className:"p-3 sm:p-4 max-w-4xl mx-auto",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ie,{value:p,onChange:I=>g(I.target.value),onKeyDown:he,placeholder:h?.isConnected?"输入消息...":"等待连接...",disabled:!h?.isConnected,className:"flex-1 h-10 sm:h-10"}),e.jsx(_,{onClick:E,disabled:!h?.isConnected||!p.trim(),size:"icon",className:"h-10 w-10 shrink-0",children:e.jsx($y,{className:"h-4 w-4"})})]})})})]})}var vm="Radio",[eS,vj]=yg(vm),[sS,tS]=eS(vm),bj=m.forwardRef((l,i)=>{const{__scopeRadio:r,name:o,checked:u=!1,required:x,disabled:h,value:p="on",onCheck:g,form:v,...j}=l,[N,y]=m.useState(null),S=tm(i,O=>y(O)),w=m.useRef(!1),R=N?v||!!N.closest("form"):!0;return e.jsxs(sS,{scope:r,checked:u,disabled:h,children:[e.jsx(uo.button,{type:"button",role:"radio","aria-checked":u,"data-state":_j(u),"data-disabled":h?"":void 0,disabled:h,value:p,...j,ref:S,onClick:Xu(l.onClick,O=>{u||g?.(),R&&(w.current=O.isPropagationStopped(),w.current||O.stopPropagation())})}),R&&e.jsx(wj,{control:N,bubbles:!w.current,name:o,value:p,checked:u,required:x,disabled:h,form:v,style:{transform:"translateX(-100%)"}})]})});bj.displayName=vm;var Nj="RadioIndicator",yj=m.forwardRef((l,i)=>{const{__scopeRadio:r,forceMount:o,...u}=l,x=tS(Nj,r);return e.jsx(ny,{present:o||x.checked,children:e.jsx(uo.span,{"data-state":_j(x.checked),"data-disabled":x.disabled?"":void 0,...u,ref:i})})});yj.displayName=Nj;var aS="RadioBubbleInput",wj=m.forwardRef(({__scopeRadio:l,control:i,checked:r,bubbles:o=!0,...u},x)=>{const h=m.useRef(null),p=tm(h,x),g=iy(r),v=ry(i);return m.useEffect(()=>{const j=h.current;if(!j)return;const N=window.HTMLInputElement.prototype,S=Object.getOwnPropertyDescriptor(N,"checked").set;if(g!==r&&S){const w=new Event("click",{bubbles:o});S.call(j,r),j.dispatchEvent(w)}},[g,r,o]),e.jsx(uo.input,{type:"radio","aria-hidden":!0,defaultChecked:r,...u,tabIndex:-1,ref:p,style:{...u.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});wj.displayName=aS;function _j(l){return l?"checked":"unchecked"}var lS=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],No="RadioGroup",[nS]=yg(No,[cg,vj]),Sj=cg(),Cj=vj(),[iS,rS]=nS(No),kj=m.forwardRef((l,i)=>{const{__scopeRadioGroup:r,name:o,defaultValue:u,value:x,required:h=!1,disabled:p=!1,orientation:g,dir:v,loop:j=!0,onValueChange:N,...y}=l,S=Sj(r),w=ay(v),[R,O]=ly({prop:x,defaultProp:u??null,onChange:N,caller:No});return e.jsx(iS,{scope:r,name:o,required:h,disabled:p,value:R,onValueChange:O,children:e.jsx(DN,{asChild:!0,...S,orientation:g,dir:w,loop:j,children:e.jsx(uo.div,{role:"radiogroup","aria-required":h,"aria-orientation":g,"data-disabled":p?"":void 0,dir:w,...y,ref:i})})})});kj.displayName=No;var Tj="RadioGroupItem",Ej=m.forwardRef((l,i)=>{const{__scopeRadioGroup:r,disabled:o,...u}=l,x=rS(Tj,r),h=x.disabled||o,p=Sj(r),g=Cj(r),v=m.useRef(null),j=tm(i,v),N=x.value===u.value,y=m.useRef(!1);return m.useEffect(()=>{const S=R=>{lS.includes(R.key)&&(y.current=!0)},w=()=>y.current=!1;return document.addEventListener("keydown",S),document.addEventListener("keyup",w),()=>{document.removeEventListener("keydown",S),document.removeEventListener("keyup",w)}},[]),e.jsx(RN,{asChild:!0,...p,focusable:!h,active:N,children:e.jsx(bj,{disabled:h,required:x.required,checked:N,...g,...u,name:x.name,ref:j,onCheck:()=>x.onValueChange(u.value),onKeyDown:Xu(S=>{S.key==="Enter"&&S.preventDefault()}),onFocus:Xu(u.onFocus,()=>{y.current&&v.current?.click()})})})});Ej.displayName=Tj;var cS="RadioGroupIndicator",zj=m.forwardRef((l,i)=>{const{__scopeRadioGroup:r,...o}=l,u=Cj(r);return e.jsx(yj,{...u,...o,ref:i})});zj.displayName=cS;var Mj=kj,Aj=Ej,oS=zj;const Oj=m.forwardRef(({className:l,...i},r)=>e.jsx(Mj,{className:H("grid gap-2",l),...i,ref:r}));Oj.displayName=Mj.displayName;const Dj=m.forwardRef(({className:l,...i},r)=>e.jsx(Aj,{ref:r,className:H("aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",l),...i,children:e.jsx(oS,{className:"flex items-center justify-center",children:e.jsx(qy,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Dj.displayName=Aj.displayName;function dS({question:l,value:i,onChange:r,error:o,disabled:u=!1}){const[x,h]=m.useState(null),p=u||l.readOnly,g=()=>{switch(l.type){case"single":return e.jsx(Oj,{value:i||"",onValueChange:r,disabled:p,className:"space-y-2",children:l.options?.map(v=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Dj,{value:v.value,id:`${l.id}-${v.id}`}),e.jsx(C,{htmlFor:`${l.id}-${v.id}`,className:"cursor-pointer font-normal",children:v.label})]},v.id))});case"multiple":{const v=i||[];return e.jsxs("div",{className:"space-y-2",children:[l.options?.map(j=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(gt,{id:`${l.id}-${j.id}`,checked:v.includes(j.value),disabled:p||l.maxSelections!==void 0&&v.length>=l.maxSelections&&!v.includes(j.value),onCheckedChange:N=>{r(N?[...v,j.value]:v.filter(y=>y!==j.value))}}),e.jsx(C,{htmlFor:`${l.id}-${j.id}`,className:"cursor-pointer font-normal",children:j.label})]},j.id)),l.maxSelections&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["最多选择 ",l.maxSelections," 项"]})]})}case"text":return e.jsx(ie,{value:i||"",onChange:v=>r(v.target.value),placeholder:l.placeholder||"请输入...",disabled:p,readOnly:l.readOnly,maxLength:l.maxLength,className:H(l.readOnly&&"bg-muted cursor-not-allowed")});case"textarea":return e.jsxs("div",{className:"space-y-1",children:[e.jsx(Is,{value:i||"",onChange:v=>r(v.target.value),placeholder:l.placeholder||"请输入...",disabled:p,readOnly:l.readOnly,maxLength:l.maxLength,rows:4,className:H(l.readOnly&&"bg-muted cursor-not-allowed")}),l.maxLength&&e.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[(i||"").length," / ",l.maxLength]})]});case"rating":{const v=i||0,j=x!==null?x:v;return e.jsxs("div",{className:"flex items-center gap-1",children:[[1,2,3,4,5].map(N=>e.jsx("button",{type:"button",disabled:p,className:H("p-1 transition-colors focus:outline-none focus:ring-2 focus:ring-ring rounded",p&&"cursor-not-allowed opacity-50"),onMouseEnter:()=>!p&&h(N),onMouseLeave:()=>h(null),onClick:()=>!p&&r(N),children:e.jsx(fl,{className:H("h-6 w-6 transition-colors",N<=j?"fill-yellow-400 text-yellow-400":"text-muted-foreground")})},N)),v>0&&e.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:[v," / 5"]})]})}case"scale":{const v=l.min??1,j=l.max??10,N=l.step??1,y=i??v;return e.jsxs("div",{className:"space-y-4",children:[e.jsx(Ca,{value:[y],onValueChange:([S])=>r(S),min:v,max:j,step:N,disabled:p}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:l.minLabel||v}),e.jsx("span",{className:"font-medium text-foreground",children:y}),e.jsx("span",{children:l.maxLabel||j})]})]})}case"dropdown":return e.jsxs(Be,{value:i||"",onValueChange:r,disabled:p,children:[e.jsx(Le,{children:e.jsx(He,{placeholder:l.placeholder||"请选择..."})}),e.jsx(Ue,{children:l.options?.map(v=>e.jsx(se,{value:v.value,children:v.label},v.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(C,{className:"text-base font-medium",children:[l.title,l.required&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),l.description&&e.jsx("p",{className:"text-sm text-muted-foreground",children:l.description})]}),g(),o&&e.jsx("p",{className:"text-sm text-destructive",children:o})]})}const Rj="https://maibot-plugin-stats.maibot-webui.workers.dev";function Lj(){const l="maibot_user_id";let i=localStorage.getItem(l);if(!i){const r=Math.random().toString(36).substring(2,10),o=Date.now().toString(36),u=Math.random().toString(36).substring(2,10);i=`fp_${r}_${o}_${u}`,localStorage.setItem(l,i)}return i}async function uS(l,i,r,o){try{const u=o?.userId||Lj(),x={surveyId:l,surveyVersion:i,userId:u,answers:r,submittedAt:new Date().toISOString(),allowMultiple:o?.allowMultiple,metadata:{userAgent:navigator.userAgent,language:navigator.language}},h=await fetch(`${Rj}/survey/submit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(x)}),p=await h.json();return h.status===429?{success:!1,error:"提交过于频繁,请稍后再试"}:h.status===409?{success:!1,error:p.error||"你已经提交过这份问卷了"}:h.ok?{success:!0,submissionId:p.submissionId,message:p.message}:{success:!1,error:p.error||"提交失败"}}catch(u){return console.error("Error submitting survey:",u),{success:!1,error:"网络错误"}}}async function mS(l,i){try{const r=i||Lj(),o=new URLSearchParams({user_id:r,survey_id:l}),u=await fetch(`${Rj}/survey/check?${o}`);return u.ok?{success:!0,hasSubmitted:(await u.json()).hasSubmitted}:{success:!1,error:(await u.json()).error||"检查失败"}}catch(r){return console.error("Error checking submission:",r),{success:!1,error:"网络错误"}}}function Uj({config:l,initialAnswers:i,onSubmitSuccess:r,onSubmitError:o,showProgress:u=!0,paginateQuestions:x=!1,className:h}){const p=m.useCallback(()=>!i||i.length===0?{}:i.reduce((K,re)=>(K[re.questionId]=re.value,K),{}),[i]),[g,v]=m.useState(()=>p()),[j,N]=m.useState({}),[y,S]=m.useState(0),[w,R]=m.useState(!1),[O,U]=m.useState(!1),[G,L]=m.useState(null),[T,F]=m.useState(null),[q,z]=m.useState(!1),[M,Q]=m.useState(!0);m.useEffect(()=>{i&&i.length>0&&v(K=>({...K,...p()}))},[i,p]),m.useEffect(()=>{(async()=>{if(!l.settings?.allowMultiple){const re=await mS(l.id);re.success&&re.hasSubmitted&&z(!0)}Q(!1)})()},[l.id,l.settings?.allowMultiple]);const fe=m.useCallback(()=>{const K=new Date;return!(l.settings?.startTime&&new Date(l.settings.startTime)>K||l.settings?.endTime&&new Date(l.settings.endTime){const re=g[K.id];return re==null?!1:Array.isArray(re)?re.length>0:typeof re=="string"?re.trim()!=="":!0}).length,ge=ve/l.questions.length*100,be=m.useCallback((K,re)=>{v(k=>({...k,[K]:re})),N(k=>{const ne={...k};return delete ne[K],ne})},[]),je=m.useCallback(()=>{const K={};for(const re of l.questions){if(re.required){const k=g[re.id];if(k==null){K[re.id]="此题为必填项";continue}if(Array.isArray(k)&&k.length===0){K[re.id]="请至少选择一项";continue}if(typeof k=="string"&&k.trim()===""){K[re.id]="此题为必填项";continue}}re.minLength&&typeof g[re.id]=="string"&&g[re.id].length{if(!je()){if(x){const K=l.questions.findIndex(re=>j[re.id]);K>=0&&S(K)}return}R(!0),L(null);try{const K=l.questions.filter(k=>g[k.id]!==void 0).map(k=>({questionId:k.id,value:g[k.id]})),re=await uS(l.id,l.version,K,{allowMultiple:l.settings?.allowMultiple});if(re.success&&re.submissionId)U(!0),F(re.submissionId),r?.(re.submissionId);else{const k=re.error||"提交失败";L(k),o?.(k)}}catch(K){const re=K instanceof Error?K.message:"提交失败";L(re),o?.(re)}finally{R(!1)}},[je,x,l,g,j,r,o]),D=m.useCallback(K=>{K>=0&&Ke.jsxs("div",{className:H("p-4 rounded-lg border bg-card",j[K.id]?"border-destructive bg-destructive/5":"border-border"),children:[x&&e.jsxs("div",{className:"text-xs text-muted-foreground mb-2",children:["问题 ",y+1," / ",l.questions.length]}),!x&&e.jsxs("div",{className:"text-xs text-muted-foreground mb-2",children:[re+1,"."]}),e.jsx(dS,{question:K,value:g[K.id],onChange:k=>be(K.id,k),error:j[K.id],disabled:w})]},K.id)),G&&e.jsxs(ta,{variant:"destructive",children:[e.jsx(Gt,{className:"h-4 w-4"}),e.jsx(aa,{children:G})]}),e.jsx("div",{className:"flex justify-between items-center py-4",children:x?e.jsxs(e.Fragment,{children:[e.jsxs(_,{variant:"outline",onClick:()=>D(y-1),disabled:y===0||w,children:[e.jsx(jl,{className:"h-4 w-4 mr-1"}),"上一题"]}),y===l.questions.length-1?e.jsxs(_,{onClick:Ne,disabled:w,children:[w&&e.jsx(mt,{className:"h-4 w-4 mr-2 animate-spin"}),"提交问卷"]}):e.jsxs(_,{onClick:()=>D(y+1),disabled:w,children:["下一题",e.jsx(Xa,{className:"h-4 w-4 ml-1"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:Object.keys(j).length>0&&e.jsxs("span",{className:"text-destructive",children:["还有 ",Object.keys(j).length," 个必填项未完成"]})}),e.jsxs(_,{onClick:Ne,disabled:w,size:"lg",children:[w&&e.jsx(mt,{className:"h-4 w-4 mr-2 animate-spin"}),"提交问卷"]})]})})]})})]})}const xS={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:"感谢你的反馈!你的意见对我们非常重要,我们会认真考虑每一条建议。"}},hS={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 fS(){const[l,i]=m.useState(null),[r,o]=m.useState(!0);m.useEffect(()=>{const p=JSON.parse(JSON.stringify(xS));i(p),o(!1)},[]);const u=m.useMemo(()=>[{questionId:"webui_version",value:`v${xo}`}],[]),x=m.useCallback(p=>{console.log("WebUI Survey submitted:",p)},[]),h=m.useCallback(p=>{console.error("WebUI Survey submission error:",p)},[]);return r?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx(mt,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):l?e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsxs("div",{className:"mb-4 sm:mb-6 shrink-0",children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(Bg,{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(Uj,{config:l,initialAnswers:u,showProgress:!0,paginateQuestions:!1,onSubmitSuccess:x,onSubmitError:h})})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-4",children:[e.jsxs(ta,{variant:"destructive",className:"max-w-md",children:[e.jsx(Gt,{className:"h-4 w-4"}),e.jsx(aa,{children:"无法加载问卷配置"})]}),e.jsx(_,{variant:"outline",onClick:()=>window.location.reload(),children:"重试"})]})}function pS(){const[l,i]=m.useState(null),[r,o]=m.useState(!0),[u,x]=m.useState("未知版本");m.useEffect(()=>{(async()=>{try{const N=await ej();x(N.version||"未知版本")}catch(N){console.error("Failed to get MaiBot version:",N),x("获取失败")}const j=JSON.parse(JSON.stringify(hS));i(j),o(!1)})()},[]);const h=m.useMemo(()=>[{questionId:"maibot_version",value:u}],[u]),p=m.useCallback(v=>{console.log("MaiBot Survey submitted:",v)},[]),g=m.useCallback(v=>{console.error("MaiBot Survey submission error:",v)},[]);return r?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx(mt,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):l?e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsxs("div",{className:"mb-4 sm:mb-6 shrink-0",children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(Bg,{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(Uj,{config:l,initialAnswers:h,showProgress:!0,paginateQuestions:!1,onSubmitSuccess:p,onSubmitError:g})})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-4",children:[e.jsxs(ta,{variant:"destructive",className:"max-w-md",children:[e.jsx(Gt,{className:"h-4 w-4"}),e.jsx(aa,{children:"无法加载问卷配置"})]}),e.jsx(_,{variant:"outline",onClick:()=>window.location.reload(),children:"重试"})]})}function gS(){const l=Ea(),[i,r]=m.useState(!0);return m.useEffect(()=>{let o=!1;return(async()=>{try{const x=await om();!o&&!x&&l({to:"/auth"})}catch{o||l({to:"/auth"})}finally{o||r(!1)}})(),()=>{o=!0}},[l]),{checking:i}}async function jS(){return await om()}const vS=xi("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"}}),Bj=m.forwardRef(({className:l,size:i,abbrTitle:r,children:o,...u},x)=>e.jsx("kbd",{className:H(vS({size:i,className:l})),ref:x,...u,children:r?e.jsx("abbr",{title:r,children:o}):o}));Bj.displayName="Kbd";const bS=[{icon:mo,title:"首页",description:"查看仪表板概览",path:"/",category:"概览"},{icon:Ra,title:"麦麦主程序配置",description:"配置麦麦的核心设置",path:"/config/bot",category:"配置"},{icon:Hg,title:"麦麦模型提供商配置",description:"配置模型提供商",path:"/config/modelProvider",category:"配置"},{icon:$g,title:"麦麦模型配置",description:"配置模型参数",path:"/config/model",category:"配置"},{icon:am,title:"表情包管理",description:"管理麦麦的表情包",path:"/resource/emoji",category:"资源"},{icon:Yl,title:"表达方式管理",description:"管理麦麦的表达方式",path:"/resource/expression",category:"资源"},{icon:qg,title:"人物信息管理",description:"管理人物信息",path:"/resource/person",category:"资源"},{icon:mi,title:"黑话管理",description:"管理麦麦学习到的黑话和俚语",path:"/resource/jargon",category:"资源"},{icon:Gy,title:"统计信息",description:"查看使用统计",path:"/statistics",category:"监控"},{icon:Ql,title:"插件市场",description:"浏览和安装插件",path:"/plugins",category:"扩展"},{icon:lm,title:"日志查看器",description:"查看系统日志",path:"/logs",category:"监控"},{icon:hi,title:"系统设置",description:"配置系统参数",path:"/settings",category:"系统"}];function NS({open:l,onOpenChange:i}){const[r,o]=m.useState(""),[u,x]=m.useState(0),h=Ea(),p=bS.filter(j=>j.title.toLowerCase().includes(r.toLowerCase())||j.description.toLowerCase().includes(r.toLowerCase())||j.category.toLowerCase().includes(r.toLowerCase()));m.useEffect(()=>{l&&(o(""),x(0))},[l]);const g=m.useCallback(j=>{h({to:j}),i(!1)},[h,i]),v=m.useCallback(j=>{j.key==="ArrowDown"?(j.preventDefault(),x(N=>(N+1)%p.length)):j.key==="ArrowUp"?(j.preventDefault(),x(N=>(N-1+p.length)%p.length)):j.key==="Enter"&&p[u]&&(j.preventDefault(),g(p[u].path))},[p,u,g]);return e.jsx(Gs,{open:l,onOpenChange:i,children:e.jsxs(Us,{className:"max-w-2xl p-0 gap-0",children:[e.jsxs(Bs,{className:"px-4 pt-4 pb-0",children:[e.jsx(Hs,{className:"sr-only",children:"搜索"}),e.jsxs("div",{className:"relative",children:[e.jsx(Ft,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground"}),e.jsx(ie,{value:r,onChange:j=>{o(j.target.value),x(0)},onKeyDown:v,placeholder:"搜索页面...",className:"h-12 pl-11 text-base border-0 focus-visible:ring-0 shadow-none",autoFocus:!0})]})]}),e.jsx("div",{className:"border-t",children:e.jsx(Ze,{className:"h-[400px]",children:p.length>0?e.jsx("div",{className:"p-2",children:p.map((j,N)=>{const y=j.icon;return e.jsxs("button",{onClick:()=>g(j.path),onMouseEnter:()=>x(N),className:H("w-full flex items-center gap-3 px-3 py-2.5 rounded-md text-left transition-colors",N===u?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:[e.jsx(y,{className:"h-5 w-5 flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium text-sm",children:j.title}),e.jsx("div",{className:"text-xs text-muted-foreground truncate",children:j.description})]}),e.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1 bg-muted rounded",children:j.category})]},j.path)})}):e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(Ft,{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"}),"关闭"]})]})})]})})}const yS=oy,wS=dy,_S=uy,Hj=m.forwardRef(({className:l,sideOffset:i=4,...r},o)=>e.jsx(cy,{children:e.jsx(wg,{ref:o,sideOffset:i,className:H("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",l),...r})}));Hj.displayName=wg.displayName;function SS({children:l}){const{checking:i}=gS(),[r,o]=m.useState(!0),[u,x]=m.useState(!1),[h,p]=m.useState(!1),{theme:g,setTheme:v}=im(),j=iN();if(m.useEffect(()=>{const R=O=>{(O.metaKey||O.ctrlKey)&&O.key==="k"&&(O.preventDefault(),p(!0))};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[]),i)return e.jsx("div",{className:"flex h-screen items-center justify-center bg-background",children:e.jsx("div",{className:"text-muted-foreground",children:"正在验证登录状态..."})});const N=[{title:"概览",items:[{icon:mo,label:"首页",path:"/"}]},{title:"麦麦配置编辑",items:[{icon:Ra,label:"麦麦主程序配置",path:"/config/bot"},{icon:Hg,label:"AI模型厂商配置",path:"/config/modelProvider",tourId:"sidebar-model-provider"},{icon:$g,label:"模型管理与分配",path:"/config/model",tourId:"sidebar-model-management"},{icon:hp,label:"麦麦适配器配置",path:"/config/adapter"}]},{title:"麦麦资源管理",items:[{icon:am,label:"表情包管理",path:"/resource/emoji"},{icon:Yl,label:"表达方式管理",path:"/resource/expression"},{icon:mi,label:"黑话管理",path:"/resource/jargon"},{icon:qg,label:"人物信息管理",path:"/resource/person"},{icon:Lg,label:"知识库图谱可视化",path:"/resource/knowledge-graph"}]},{title:"扩展与监控",items:[{icon:Ql,label:"插件市场",path:"/plugins"},{icon:Ug,label:"模型分配预设市场",path:"/model-presets"},{icon:hp,label:"插件配置",path:"/plugin-config"},{icon:lm,label:"日志查看器",path:"/logs"},{icon:Yl,label:"本地聊天室",path:"/chat"}]},{title:"系统",items:[{icon:hi,label:"系统设置",path:"/settings"}]}],S=g==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":g,w=async()=>{await uw()};return e.jsx(yS,{delayDuration:300,children:e.jsxs("div",{className:"flex h-screen overflow-hidden",children:[e.jsxs("aside",{className:H("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",u?"translate-x-0":"-translate-x-full lg:translate-x-0"),children:[e.jsx("div",{className:"flex h-16 items-center border-b px-4",children:e.jsxs("div",{className:H("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:H("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:X0()})]}),!r&&e.jsx("span",{className:"hidden lg:block font-bold text-primary-gradient text-2xl",children:"M"})]})}),e.jsx(Ze,{className:H("flex-1 overflow-x-hidden",!r&&"lg:w-16"),children:e.jsx("nav",{className:H("p-4",!r&&"lg:p-2 lg:w-16"),children:e.jsx("ul",{className:H("space-y-6",!r&&"lg:space-y-3 lg:w-full"),children:N.map((R,O)=>e.jsxs("li",{children:[e.jsx("div",{className:H("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:R.title})}),!r&&O>0&&e.jsx("div",{className:"hidden lg:block mb-2 border-t border-border"}),e.jsx("ul",{className:"space-y-1",children:R.items.map(U=>{const G=j({to:U.path}),L=U.icon,T=e.jsxs(e.Fragment,{children:[G&&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:H("flex items-center transition-all duration-300",r?"gap-3":"gap-3 lg:gap-0"),children:[e.jsx(L,{className:H("h-5 w-5 flex-shrink-0",G&&"text-primary"),strokeWidth:2,fill:"none"}),e.jsx("span",{className:H("text-sm font-medium whitespace-nowrap transition-all duration-300",G&&"font-semibold",r?"opacity-100 max-w-[200px]":"opacity-100 max-w-[200px] lg:opacity-0 lg:max-w-0 lg:overflow-hidden"),children:U.label})]})]});return e.jsx("li",{className:"relative",children:e.jsxs(wS,{children:[e.jsx(_S,{asChild:!0,children:e.jsx(li,{to:U.path,"data-tour":U.tourId,className:H("relative flex items-center rounded-lg py-2 transition-all duration-300","hover:bg-accent hover:text-accent-foreground",G?"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:()=>x(!1),children:T})}),!r&&e.jsx(Hj,{side:"right",className:"hidden lg:block",children:e.jsx("p",{children:U.label})})]})},U.path)})})]},R.title))})})})]}),u&&e.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 lg:hidden",onClick:()=>x(!1)}),e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[e.jsxs("header",{className:"flex h-16 items-center justify-between border-b bg-card/80 backdrop-blur-md px-4 sticky top-0 z-10",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("button",{onClick:()=>x(!u),className:"rounded-lg p-2 hover:bg-accent lg:hidden",children:e.jsx(Fy,{className:"h-5 w-5"})}),e.jsx("button",{onClick:()=>o(!r),className:"hidden rounded-lg p-2 hover:bg-accent lg:block",title:r?"收起侧边栏":"展开侧边栏",children:e.jsx(jl,{className:H("h-5 w-5 transition-transform",!r&&"rotate-180")})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>p(!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(Ft,{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(Bj,{size:"sm",className:"absolute right-2 top-1/2 -translate-y-1/2",children:[e.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),e.jsx(NS,{open:h,onOpenChange:p}),e.jsxs(_,{variant:"ghost",size:"sm",onClick:()=>window.open("https://docs.mai-mai.org","_blank"),className:"gap-2",title:"查看麦麦文档",children:[e.jsx(Vy,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"麦麦文档"})]}),e.jsx("button",{onClick:R=>{V0(S==="dark"?"light":"dark",v,R)},className:"rounded-lg p-2 hover:bg-accent",title:S==="dark"?"切换到浅色模式":"切换到深色模式",children:S==="dark"?e.jsx(Mg,{className:"h-5 w-5"}):e.jsx(Ag,{className:"h-5 w-5"})}),e.jsx("div",{className:"h-6 w-px bg-border"}),e.jsxs(_,{variant:"ghost",size:"sm",onClick:w,className:"gap-2",title:"登出系统",children:[e.jsx(Iy,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"登出"})]})]})]}),e.jsx("main",{className:"flex-1 overflow-hidden bg-background",children:l})]})]})})}function CS(l){const i=l.split(` -`).slice(1),r=[];for(const o of i){const u=o.trim();if(!u.startsWith("at "))continue;const x=u.match(/at\s+(?:(.+?)\s+\()?(.+?):(\d+):(\d+)\)?$/);x?r.push({functionName:x[1]||"",fileName:x[2],lineNumber:x[3],columnNumber:x[4],raw:u}):r.push({functionName:"",fileName:"",lineNumber:"",columnNumber:"",raw:u})}return r}function kS({error:l,errorInfo:i}){const[r,o]=m.useState(!0),[u,x]=m.useState(!1),[h,p]=m.useState(!1),g=l.stack?CS(l.stack):[],v=async()=>{const j=` + `,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: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:"text-sm font-medium truncate",children:M.name}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:M.emotion||"未填写情感标签"})]}),Q?e.jsx(ma,{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"})]},M.id)})})}),e.jsx("div",{className:"border rounded-lg p-4",children:O?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:O.previewUrl,alt:O.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:O.name}),w(O)&&e.jsxs(Qe,{variant:"outline",className:"text-green-600 border-green-600",children:[e.jsx(sa,{className:"h-3 w-3 mr-1"}),"已完成"]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(C,{htmlFor:"multi-emotion",children:["情感标签 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ne,{id:"multi-emotion",value:O.emotion,onChange:M=>S(O.id,{emotion:M.target.value}),placeholder:"多个标签用逗号分隔,如:开心,高兴",className:O.emotion.trim()?"":"border-destructive"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"multi-description",children:"描述"}),e.jsx(ne,{id:"multi-description",value:O.description,onChange:M=>S(O.id,{description:M.target.value}),placeholder:"输入表情包描述..."})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(gt,{id:"multi-is-registered",checked:O.isRegistered,onCheckedChange:M=>S(O.id,{isRegistered:M===!0})}),e.jsx(C,{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(Lg,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"点击左侧卡片编辑"})]})})})]}),e.jsx(tt,{children:e.jsx(_,{onClick:F,disabled:!L||j,children:j?"上传中...":`上传全部 (${z})`})})]})};return e.jsx(Gs,{open:l,onOpenChange:i,children:e.jsxs(Us,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[e.jsxs(Bs,{children:[e.jsxs(Hs,{className:"flex items-center gap-2",children:[e.jsx(br,{className:"h-5 w-5"}),o==="select"&&"上传表情包 - 选择文件",o==="edit-single"&&"上传表情包 - 填写信息",o==="edit-multiple"&&"上传表情包 - 批量编辑"]}),e.jsxs(Ws,{children:[o==="select"&&"支持 JPG、PNG、GIF、WebP 格式,单个文件最大 10MB,可同时上传多个文件",o==="edit-single"&&"请填写表情包的情感标签(必填)和描述",o==="edit-multiple"&&"点击左侧卡片编辑每个表情包的信息,情感标签为必填项"]})]}),e.jsxs("div",{className:"overflow-y-auto pr-1",children:[o==="select"&&A(),o==="edit-single"&&k(),o==="edit-multiple"&&$()]})]})})}const Xl="/api/webui/expression";async function k2(){const l=await Te(`${Xl}/chats`,{});if(!l.ok){const i=await l.json();throw new Error(i.detail||"获取聊天列表失败")}return l.json()}async function T2(l){const i=new URLSearchParams;l.page&&i.append("page",l.page.toString()),l.page_size&&i.append("page_size",l.page_size.toString()),l.search&&i.append("search",l.search),l.chat_id&&i.append("chat_id",l.chat_id);const r=await Te(`${Xl}/list?${i}`,{});if(!r.ok){const o=await r.json();throw new Error(o.detail||"获取表达方式列表失败")}return r.json()}async function E2(l){const i=await Te(`${Xl}/${l}`,{});if(!i.ok){const r=await i.json();throw new Error(r.detail||"获取表达方式详情失败")}return i.json()}async function z2(l){const i=await Te(`${Xl}/`,{method:"POST",body:JSON.stringify(l)});if(!i.ok){const r=await i.json();throw new Error(r.detail||"创建表达方式失败")}return i.json()}async function M2(l,i){const r=await Te(`${Xl}/${l}`,{method:"PATCH",body:JSON.stringify(i)});if(!r.ok){const o=await r.json();throw new Error(o.detail||"更新表达方式失败")}return r.json()}async function A2(l){const i=await Te(`${Xl}/${l}`,{method:"DELETE"});if(!i.ok){const r=await i.json();throw new Error(r.detail||"删除表达方式失败")}return i.json()}async function O2(l){const i=await Te(`${Xl}/batch/delete`,{method:"POST",body:JSON.stringify({ids:l})});if(!i.ok){const r=await i.json();throw new Error(r.detail||"批量删除表达方式失败")}return i.json()}async function D2(){const l=await Te(`${Xl}/stats/summary`,{});if(!l.ok){const i=await l.json();throw new Error(i.detail||"获取统计数据失败")}return l.json()}function R2(){const[l,i]=m.useState([]),[r,o]=m.useState(!0),[u,x]=m.useState(0),[h,f]=m.useState(1),[g,j]=m.useState(20),[v,N]=m.useState(""),[y,S]=m.useState(null),[w,L]=m.useState(!1),[O,U]=m.useState(!1),[F,A]=m.useState(!1),[k,$]=m.useState(null),[G,z]=m.useState(new Set),[M,Q]=m.useState(!1),[fe,ve]=m.useState(""),[ge,be]=m.useState({total:0,recent_7days:0,chat_count:0,top_chats:{}}),[je,Ne]=m.useState([]),[R,Y]=m.useState(new Map),{toast:K}=Vs(),re=async()=>{try{o(!0);const ae=await T2({page:h,page_size:g,search:v||void 0});i(ae.data),x(ae.total)}catch(ae){K({title:"加载失败",description:ae instanceof Error?ae.message:"无法加载表达方式",variant:"destructive"})}finally{o(!1)}},T=async()=>{try{const ae=await D2();ae?.data&&be(ae.data)}catch(ae){console.error("加载统计数据失败:",ae)}},ie=async()=>{try{const ae=await k2();if(ae?.data){Ne(ae.data);const De=new Map;ae.data.forEach(_s=>{De.set(_s.chat_id,_s.chat_name)}),Y(De)}}catch(ae){console.error("加载聊天列表失败:",ae)}},xe=ae=>R.get(ae)||ae;m.useEffect(()=>{re(),T(),ie()},[h,g,v]);const Ce=async ae=>{try{const De=await E2(ae.id);S(De.data),L(!0)}catch(De){K({title:"加载详情失败",description:De instanceof Error?De.message:"无法加载表达方式详情",variant:"destructive"})}},_e=ae=>{S(ae),U(!0)},Me=async ae=>{try{await A2(ae.id),K({title:"删除成功",description:`已删除表达方式: ${ae.situation}`}),$(null),re(),T()}catch(De){K({title:"删除失败",description:De instanceof Error?De.message:"无法删除表达方式",variant:"destructive"})}},Z=ae=>{const De=new Set(G);De.has(ae)?De.delete(ae):De.add(ae),z(De)},me=()=>{G.size===l.length&&l.length>0?z(new Set):z(new Set(l.map(ae=>ae.id)))},ke=async()=>{try{await O2(Array.from(G)),K({title:"批量删除成功",description:`已删除 ${G.size} 个表达方式`}),z(new Set),Q(!1),re(),T()}catch(ae){K({title:"批量删除失败",description:ae instanceof Error?ae.message:"无法批量删除表达方式",variant:"destructive"})}},X=()=>{const ae=parseInt(fe),De=Math.ceil(u/g);ae>=1&&ae<=De?(f(ae),ve("")):K({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(Yl,{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:()=>A(!0),className:"gap-2",children:[e.jsx(ut,{className:"h-4 w-4"}),"新增表达方式"]})]})}),e.jsx(Ze,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"总数量"}),e.jsx("div",{className:"text-2xl font-bold mt-1",children:ge.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:ge.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:ge.chat_count})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx(C,{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(Ft,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(ne,{id:"search",placeholder:"搜索情境、风格或上下文...",value:v,onChange:ae=>N(ae.target.value),className:"pl-9"})]})}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[e.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:G.size>0&&e.jsxs("span",{children:["已选择 ",G.size," 个表达方式"]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Be,{value:g.toString(),onValueChange:ae=>{j(parseInt(ae)),f(1),z(new Set)},children:[e.jsx(Le,{id:"page-size",className:"w-20",children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"10",children:"10"}),e.jsx(se,{value:"20",children:"20"}),e.jsx(se,{value:"50",children:"50"}),e.jsx(se,{value:"100",children:"100"})]})]}),G.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>z(new Set),children:"取消选择"}),e.jsxs(_,{variant:"destructive",size:"sm",onClick:()=>Q(!0),children:[e.jsx(We,{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(jn,{children:[e.jsx(vn,{children:e.jsxs(pt,{children:[e.jsx(Pe,{className:"w-12",children:e.jsx(gt,{checked:G.size===l.length&&l.length>0,onCheckedChange:me})}),e.jsx(Pe,{children:"情境"}),e.jsx(Pe,{children:"风格"}),e.jsx(Pe,{children:"聊天"}),e.jsx(Pe,{className:"text-right",children:"操作"})]})}),e.jsx(bn,{children:r?e.jsx(pt,{children:e.jsx(Ie,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):l.length===0?e.jsx(pt,{children:e.jsx(Ie,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):l.map(ae=>e.jsxs(pt,{children:[e.jsx(Ie,{children:e.jsx(gt,{checked:G.has(ae.id),onCheckedChange:()=>Z(ae.id)})}),e.jsx(Ie,{className:"font-medium max-w-xs truncate",children:ae.situation}),e.jsx(Ie,{className:"max-w-xs truncate",children:ae.style}),e.jsx(Ie,{className:"max-w-[200px] truncate",title:xe(ae.chat_id),style:{wordBreak:"keep-all"},children:e.jsx("span",{className:"whitespace-nowrap overflow-hidden text-ellipsis block",children:xe(ae.chat_id)})}),e.jsx(Ie,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>_e(ae),children:[e.jsx(gn,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(_,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>Ce(ae),title:"查看详情",children:e.jsx(Qt,{className:"h-4 w-4"})}),e.jsxs(_,{size:"sm",onClick:()=>$(ae),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(We,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},ae.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3 p-4",children:r?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):l.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):l.map(ae=>e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(gt,{checked:G.has(ae.id),onCheckedChange:()=>Z(ae.id),className:"mt-1"}),e.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden space-y-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"情境"}),e.jsx("h3",{className:"font-semibold text-sm line-clamp-2 w-full break-all",title:ae.situation,children:ae.situation})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"风格"}),e.jsx("p",{className:"text-sm line-clamp-2 w-full break-all",title:ae.style,children:ae.style})]})]})]}),e.jsxs("div",{className:"text-sm",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"聊天"}),e.jsx("p",{className:"text-sm truncate",title:xe(ae.chat_id),style:{wordBreak:"keep-all"},children:xe(ae.chat_id)})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>_e(ae),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(gn,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>Ce(ae),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:e.jsx(Qt,{className:"h-3 w-3"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>$(ae),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[e.jsx(We,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},ae.id))}),u>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",u," 条记录,第 ",h," / ",Math.ceil(u/g)," 页"]}),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(fi,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h-1),disabled:h===1,children:[e.jsx(jl,{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:fe,onChange:ae=>ve(ae.target.value),onKeyDown:ae=>ae.key==="Enter"&&X(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(u/g)}),e.jsx(_,{variant:"outline",size:"sm",onClick:X,disabled:!fe,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h+1),disabled:h>=Math.ceil(u/g),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Xa,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(u/g)),disabled:h>=Math.ceil(u/g),className:"hidden sm:flex",children:e.jsx(pi,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(L2,{expression:y,open:w,onOpenChange:L,chatNameMap:R}),e.jsx(U2,{open:F,onOpenChange:A,chatList:je,onSuccess:()=>{re(),T(),A(!1)}}),e.jsx(B2,{expression:y,open:O,onOpenChange:U,chatList:je,onSuccess:()=>{re(),T(),U(!1)}}),e.jsx(ms,{open:!!k,onOpenChange:()=>$(null),children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:['确定要删除表达方式 "',k?.situation,'" 吗? 此操作不可撤销。']})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>k&&Me(k),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(H2,{open:M,onOpenChange:Q,onConfirm:ke,count:G.size})]})}function L2({expression:l,open:i,onOpenChange:r,chatNameMap:o}){if(!l)return null;const u=h=>h?new Date(h*1e3).toLocaleString("zh-CN"):"-",x=h=>o.get(h)||h;return e.jsx(Gs,{open:i,onOpenChange:r,children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Bs,{children:[e.jsx(Hs,{children:"表达方式详情"}),e.jsx(Ws,{children:"查看表达方式的完整信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(ur,{label:"情境",value:l.situation}),e.jsx(ur,{label:"风格",value:l.style}),e.jsx(ur,{label:"聊天",value:x(l.chat_id)}),e.jsx(ur,{icon:mi,label:"记录ID",value:l.id.toString(),mono:!0})]}),e.jsx("div",{className:"grid grid-cols-2 gap-4",children:e.jsx(ur,{icon:oi,label:"创建时间",value:u(l.create_date)})})]}),e.jsx(tt,{children:e.jsx(_,{onClick:()=>r(!1),children:"关闭"})})]})})}function ur({icon:l,label:i,value:r,mono:o=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(C,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[l&&e.jsx(l,{className:"h-3 w-3"}),i]}),e.jsx("div",{className:H("text-sm",o&&"font-mono",!r&&"text-muted-foreground"),children:r||"-"})]})}function U2({open:l,onOpenChange:i,chatList:r,onSuccess:o}){const[u,x]=m.useState({situation:"",style:"",chat_id:""}),[h,f]=m.useState(!1),{toast:g}=Vs(),j=async()=>{if(!u.situation||!u.style||!u.chat_id){g({title:"验证失败",description:"请填写必填字段:情境、风格和聊天",variant:"destructive"});return}try{f(!0),await z2(u),g({title:"创建成功",description:"表达方式已创建"}),x({situation:"",style:"",chat_id:""}),o()}catch(v){g({title:"创建失败",description:v instanceof Error?v.message:"无法创建表达方式",variant:"destructive"})}finally{f(!1)}};return e.jsx(Gs,{open:l,onOpenChange:i,children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Bs,{children:[e.jsx(Hs,{children:"新增表达方式"}),e.jsx(Ws,{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(C,{htmlFor:"situation",children:["情境 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ne,{id:"situation",value:u.situation,onChange:v=>x({...u,situation:v.target.value}),placeholder:"描述使用场景"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(C,{htmlFor:"style",children:["风格 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ne,{id:"style",value:u.style,onChange:v=>x({...u,style:v.target.value}),placeholder:"描述表达风格"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(C,{htmlFor:"chat_id",children:["聊天 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs(Be,{value:u.chat_id,onValueChange:v=>x({...u,chat_id:v}),children:[e.jsx(Le,{children:e.jsx(He,{placeholder:"选择关联的聊天"})}),e.jsx(Ue,{children:r.map(v=>e.jsx(se,{value:v.chat_id,children:e.jsxs("span",{className:"truncate",style:{wordBreak:"keep-all"},children:[v.chat_name,v.is_group&&e.jsx("span",{className:"text-muted-foreground ml-1",children:"(群聊)"})]})},v.chat_id))})]})]})]}),e.jsxs(tt,{children:[e.jsx(_,{variant:"outline",onClick:()=>i(!1),children:"取消"}),e.jsx(_,{onClick:j,disabled:h,children:h?"创建中...":"创建"})]})]})})}function B2({expression:l,open:i,onOpenChange:r,chatList:o,onSuccess:u}){const[x,h]=m.useState({}),[f,g]=m.useState(!1),{toast:j}=Vs();m.useEffect(()=>{l&&h({situation:l.situation,style:l.style,chat_id:l.chat_id})},[l]);const v=async()=>{if(l)try{g(!0),await M2(l.id,x),j({title:"保存成功",description:"表达方式已更新"}),u()}catch(N){j({title:"保存失败",description:N instanceof Error?N.message:"无法更新表达方式",variant:"destructive"})}finally{g(!1)}};return l?e.jsx(Gs,{open:i,onOpenChange:r,children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Bs,{children:[e.jsx(Hs,{children:"编辑表达方式"}),e.jsx(Ws,{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(C,{htmlFor:"edit_situation",children:"情境"}),e.jsx(ne,{id:"edit_situation",value:x.situation||"",onChange:N=>h({...x,situation:N.target.value}),placeholder:"描述使用场景"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"edit_style",children:"风格"}),e.jsx(ne,{id:"edit_style",value:x.style||"",onChange:N=>h({...x,style:N.target.value}),placeholder:"描述表达风格"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"edit_chat_id",children:"聊天"}),e.jsxs(Be,{value:x.chat_id||"",onValueChange:N=>h({...x,chat_id:N}),children:[e.jsx(Le,{children:e.jsx(He,{placeholder:"选择关联的聊天"})}),e.jsx(Ue,{children:o.map(N=>e.jsx(se,{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(tt,{children:[e.jsx(_,{variant:"outline",onClick:()=>r(!1),children:"取消"}),e.jsx(_,{onClick:v,disabled:f,children:f?"保存中...":"保存"})]})]})}):null}function H2({open:l,onOpenChange:i,onConfirm:r,count:o}){return e.jsx(ms,{open:l,onOpenChange:i,children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认批量删除"}),e.jsxs(os,{children:["您即将删除 ",o," 个表达方式,此操作无法撤销。确定要继续吗?"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:r,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})}const vl="/api/webui/jargon";async function $2(){const l=await Te(`${vl}/chats`,{});if(!l.ok){const i=await l.json();throw new Error(i.detail||"获取聊天列表失败")}return l.json()}async function q2(l){const i=new URLSearchParams;l.page&&i.append("page",l.page.toString()),l.page_size&&i.append("page_size",l.page_size.toString()),l.search&&i.append("search",l.search),l.chat_id&&i.append("chat_id",l.chat_id),l.is_jargon!==void 0&&l.is_jargon!==null&&i.append("is_jargon",l.is_jargon.toString()),l.is_global!==void 0&&i.append("is_global",l.is_global.toString());const r=await Te(`${vl}/list?${i}`,{});if(!r.ok){const o=await r.json();throw new Error(o.detail||"获取黑话列表失败")}return r.json()}async function G2(l){const i=await Te(`${vl}/${l}`,{});if(!i.ok){const r=await i.json();throw new Error(r.detail||"获取黑话详情失败")}return i.json()}async function F2(l){const i=await Te(`${vl}/`,{method:"POST",body:JSON.stringify(l)});if(!i.ok){const r=await i.json();throw new Error(r.detail||"创建黑话失败")}return i.json()}async function V2(l,i){const r=await Te(`${vl}/${l}`,{method:"PATCH",body:JSON.stringify(i)});if(!r.ok){const o=await r.json();throw new Error(o.detail||"更新黑话失败")}return r.json()}async function I2(l){const i=await Te(`${vl}/${l}`,{method:"DELETE"});if(!i.ok){const r=await i.json();throw new Error(r.detail||"删除黑话失败")}return i.json()}async function Q2(l){const i=await Te(`${vl}/batch/delete`,{method:"POST",body:JSON.stringify({ids:l})});if(!i.ok){const r=await i.json();throw new Error(r.detail||"批量删除黑话失败")}return i.json()}async function Y2(){const l=await Te(`${vl}/stats/summary`,{});if(!l.ok){const i=await l.json();throw new Error(i.detail||"获取黑话统计失败")}return l.json()}async function K2(l,i){const r=new URLSearchParams;l.forEach(u=>r.append("ids",u.toString())),r.append("is_jargon",i.toString());const o=await Te(`${vl}/batch/set-jargon?${r}`,{method:"POST"});if(!o.ok){const u=await o.json();throw new Error(u.detail||"批量设置黑话状态失败")}return o.json()}function X2(){const[l,i]=m.useState([]),[r,o]=m.useState(!0),[u,x]=m.useState(0),[h,f]=m.useState(1),[g,j]=m.useState(20),[v,N]=m.useState(""),[y,S]=m.useState("all"),[w,L]=m.useState("all"),[O,U]=m.useState(null),[F,A]=m.useState(!1),[k,$]=m.useState(!1),[G,z]=m.useState(!1),[M,Q]=m.useState(null),[fe,ve]=m.useState(new Set),[ge,be]=m.useState(!1),[je,Ne]=m.useState(""),[R,Y]=m.useState({total:0,confirmed_jargon:0,confirmed_not_jargon:0,pending:0,global_count:0,complete_count:0,chat_count:0,top_chats:{}}),[K,re]=m.useState([]),{toast:T}=Vs(),ie=async()=>{try{o(!0);const E=await q2({page:h,page_size:g,search:v||void 0,chat_id:y==="all"?void 0:y,is_jargon:w==="all"?void 0:w==="true"?!0:w==="false"?!1:void 0});i(E.data),x(E.total)}catch(E){T({title:"加载失败",description:E instanceof Error?E.message:"无法加载黑话列表",variant:"destructive"})}finally{o(!1)}},xe=async()=>{try{const E=await Y2();E?.data&&Y(E.data)}catch(E){console.error("加载统计数据失败:",E)}},Ce=async()=>{try{const E=await $2();E?.data&&re(E.data)}catch(E){console.error("加载聊天列表失败:",E)}};m.useEffect(()=>{ie(),xe(),Ce()},[h,g,v,y,w]);const _e=async E=>{try{const he=await G2(E.id);U(he.data),A(!0)}catch(he){T({title:"加载详情失败",description:he instanceof Error?he.message:"无法加载黑话详情",variant:"destructive"})}},Me=E=>{U(E),$(!0)},Z=async E=>{try{await I2(E.id),T({title:"删除成功",description:`已删除黑话: ${E.content}`}),Q(null),ie(),xe()}catch(he){T({title:"删除失败",description:he instanceof Error?he.message:"无法删除黑话",variant:"destructive"})}},me=E=>{const he=new Set(fe);he.has(E)?he.delete(E):he.add(E),ve(he)},ke=()=>{fe.size===l.length&&l.length>0?ve(new Set):ve(new Set(l.map(E=>E.id)))},X=async()=>{try{await Q2(Array.from(fe)),T({title:"批量删除成功",description:`已删除 ${fe.size} 个黑话`}),ve(new Set),be(!1),ie(),xe()}catch(E){T({title:"批量删除失败",description:E instanceof Error?E.message:"无法批量删除黑话",variant:"destructive"})}},ae=async E=>{try{await K2(Array.from(fe),E),T({title:"操作成功",description:`已将 ${fe.size} 个词条设为${E?"黑话":"非黑话"}`}),ve(new Set),ie(),xe()}catch(he){T({title:"操作失败",description:he instanceof Error?he.message:"批量设置失败",variant:"destructive"})}},De=()=>{const E=parseInt(je),he=Math.ceil(u/g);E>=1&&E<=he?(f(E),Ne("")):T({title:"无效的页码",description:`请输入1-${he}之间的页码`,variant:"destructive"})},_s=E=>E===!0?e.jsxs(Qe,{variant:"default",className:"bg-green-600 hover:bg-green-700",children:[e.jsx(sa,{className:"h-3 w-3 mr-1"}),"是黑话"]}):E===!1?e.jsxs(Qe,{variant:"secondary",children:[e.jsx(gl,{className:"h-3 w-3 mr-1"}),"非黑话"]}):e.jsxs(Qe,{variant:"outline",children:[e.jsx(Dg,{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(Gy,{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:()=>z(!0),className:"gap-2",children:[e.jsx(ut,{className:"h-4 w-4"}),"新增黑话"]})]})}),e.jsx(Ze,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 lg:grid-cols-7 gap-3",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"总数量"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1",children:R.total})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"已确认黑话"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-green-600",children:R.confirmed_jargon})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"确认非黑话"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-gray-500",children:R.confirmed_not_jargon})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"待判定"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-yellow-600",children:R.pending})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"全局黑话"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-blue-600",children:R.global_count})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"推断完成"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1 text-purple-600",children:R.complete_count})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:[e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground",children:"关联聊天数"}),e.jsx("div",{className:"text-xl sm:text-2xl font-bold mt-1",children:R.chat_count})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:"search",children:"搜索"}),e.jsxs("div",{className:"relative",children:[e.jsx(Ft,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(ne,{id:"search",placeholder:"搜索内容、含义...",value:v,onChange:E=>N(E.target.value),className:"pl-9"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{children:"聊天筛选"}),e.jsxs(Be,{value:y,onValueChange:S,children:[e.jsx(Le,{children:e.jsx(He,{placeholder:"全部聊天"})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"all",children:"全部聊天"}),K.map(E=>e.jsx(se,{value:E.chat_id,children:E.chat_name},E.chat_id))]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{children:"状态筛选"}),e.jsxs(Be,{value:w,onValueChange:L,children:[e.jsx(Le,{children:e.jsx(He,{placeholder:"全部状态"})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"all",children:"全部状态"}),e.jsx(se,{value:"true",children:"是黑话"}),e.jsx(se,{value:"false",children:"非黑话"})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:"page-size",children:"每页显示"}),e.jsxs(Be,{value:g.toString(),onValueChange:E=>{j(parseInt(E)),f(1),ve(new Set)},children:[e.jsx(Le,{id:"page-size",children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"10",children:"10"}),e.jsx(se,{value:"20",children:"20"}),e.jsx(se,{value:"50",children:"50"}),e.jsx(se,{value:"100",children:"100"})]})]})]})]}),fe.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:["已选择 ",fe.size," 个"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>ae(!0),children:[e.jsx(sa,{className:"h-4 w-4 mr-1"}),"标记为黑话"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>ae(!1),children:[e.jsx(gl,{className:"h-4 w-4 mr-1"}),"标记为非黑话"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>ve(new Set),children:"取消选择"}),e.jsxs(_,{variant:"destructive",size:"sm",onClick:()=>be(!0),children:[e.jsx(We,{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(jn,{children:[e.jsx(vn,{children:e.jsxs(pt,{children:[e.jsx(Pe,{className:"w-12",children:e.jsx(gt,{checked:fe.size===l.length&&l.length>0,onCheckedChange:ke})}),e.jsx(Pe,{children:"内容"}),e.jsx(Pe,{children:"含义"}),e.jsx(Pe,{children:"聊天"}),e.jsx(Pe,{children:"状态"}),e.jsx(Pe,{className:"text-center",children:"次数"}),e.jsx(Pe,{className:"text-right",children:"操作"})]})}),e.jsx(bn,{children:r?e.jsx(pt,{children:e.jsx(Ie,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):l.length===0?e.jsx(pt,{children:e.jsx(Ie,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):l.map(E=>e.jsxs(pt,{children:[e.jsx(Ie,{children:e.jsx(gt,{checked:fe.has(E.id),onCheckedChange:()=>me(E.id)})}),e.jsx(Ie,{className:"font-medium max-w-[200px]",children:e.jsxs("div",{className:"flex items-center gap-2",children:[E.is_global&&e.jsx("span",{title:"全局黑话",children:e.jsx(Pu,{className:"h-4 w-4 text-blue-500 flex-shrink-0"})}),e.jsx("span",{className:"truncate",title:E.content,children:E.content})]})}),e.jsx(Ie,{className:"max-w-[200px] truncate",title:E.meaning||"",children:E.meaning||e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx(Ie,{className:"max-w-[150px] truncate",title:E.chat_name||E.chat_id,children:E.chat_name||E.chat_id}),e.jsx(Ie,{children:_s(E.is_jargon)}),e.jsx(Ie,{className:"text-center",children:E.count}),e.jsx(Ie,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>Me(E),children:[e.jsx(gn,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(_,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>_e(E),title:"查看详情",children:e.jsx(Qt,{className:"h-4 w-4"})}),e.jsxs(_,{size:"sm",onClick:()=>Q(E),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(We,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},E.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:"加载中..."}):l.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):l.map(E=>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(gt,{checked:fe.has(E.id),onCheckedChange:()=>me(E.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:[E.is_global&&e.jsx(Pu,{className:"h-4 w-4 text-blue-500 flex-shrink-0"}),e.jsx("h3",{className:"font-semibold text-sm break-all",children:E.content})]}),E.meaning&&e.jsx("p",{className:"text-sm text-muted-foreground break-all",children:E.meaning}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[_s(E.is_jargon),e.jsxs("span",{className:"text-muted-foreground",children:["次数: ",E.count]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground truncate",children:["聊天: ",E.chat_name||E.chat_id]})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>Me(E),className:"text-xs px-2 py-1 h-auto",children:[e.jsx(gn,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>_e(E),className:"text-xs px-2 py-1 h-auto",children:e.jsx(Qt,{className:"h-3 w-3"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>Q(E),className:"text-xs px-2 py-1 h-auto text-destructive hover:text-destructive",children:[e.jsx(We,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},E.id))}),u>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",u," 条记录,第 ",h," / ",Math.ceil(u/g)," 页"]}),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(fi,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h-1),disabled:h===1,children:[e.jsx(jl,{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:je,onChange:E=>Ne(E.target.value),onKeyDown:E=>E.key==="Enter"&&De(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(u/g)}),e.jsx(_,{variant:"outline",size:"sm",onClick:De,disabled:!je,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h+1),disabled:h>=Math.ceil(u/g),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Xa,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(u/g)),disabled:h>=Math.ceil(u/g),className:"hidden sm:flex",children:e.jsx(pi,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(J2,{jargon:O,open:F,onOpenChange:A}),e.jsx(P2,{open:G,onOpenChange:z,chatList:K,onSuccess:()=>{ie(),xe(),z(!1)}}),e.jsx(Z2,{jargon:O,open:k,onOpenChange:$,chatList:K,onSuccess:()=>{ie(),xe(),$(!1)}}),e.jsx(ms,{open:!!M,onOpenChange:()=>Q(null),children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:['确定要删除黑话 "',M?.content,'" 吗?此操作不可撤销。']})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>M&&Z(M),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(ms,{open:ge,onOpenChange:be,children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认批量删除"}),e.jsxs(os,{children:["您即将删除 ",fe.size," 个黑话,此操作无法撤销。确定要继续吗?"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:X,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})]})}function J2({jargon:l,open:i,onOpenChange:r}){return l?e.jsx(Gs,{open:i,onOpenChange:r,children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] grid grid-rows-[auto_1fr_auto] overflow-hidden",children:[e.jsxs(Bs,{children:[e.jsx(Hs,{children:"黑话详情"}),e.jsx(Ws,{children:"查看黑话的完整信息"})]}),e.jsx(Ze,{className:"h-full pr-4",children:e.jsxs("div",{className:"space-y-4 pb-2",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Xu,{icon:mi,label:"记录ID",value:l.id.toString(),mono:!0}),e.jsx(Xu,{label:"使用次数",value:l.count.toString()})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{className:"text-xs text-muted-foreground",children:"内容"}),e.jsx("div",{className:"text-sm p-2 bg-muted rounded break-all whitespace-pre-wrap",children:l.content})]}),l.raw_content&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{className:"text-xs text-muted-foreground",children:"原始内容"}),e.jsx("div",{className:"text-sm p-2 bg-muted rounded break-all",children:(()=>{try{const o=JSON.parse(l.raw_content);return Array.isArray(o)?o.map((u,x)=>e.jsxs("div",{children:[x>0&&e.jsx("hr",{className:"my-3 border-border"}),e.jsx("div",{className:"whitespace-pre-wrap",children:u})]},x)):e.jsx("div",{className:"whitespace-pre-wrap",children:l.raw_content})}catch{return e.jsx("div",{className:"whitespace-pre-wrap",children:l.raw_content})}})()})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{className:"text-xs text-muted-foreground",children:"含义"}),e.jsx("div",{className:"text-sm p-2 bg-muted rounded break-all",children:l.meaning?e.jsx(Sj,{content:l.meaning}):"-"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(Xu,{label:"聊天",value:l.chat_name||l.chat_id}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{className:"text-xs text-muted-foreground",children:"状态"}),e.jsxs("div",{className:"flex items-center gap-2",children:[l.is_jargon===!0&&e.jsx(Qe,{variant:"default",className:"bg-green-600",children:"是黑话"}),l.is_jargon===!1&&e.jsx(Qe,{variant:"secondary",children:"非黑话"}),l.is_jargon===null&&e.jsx(Qe,{variant:"outline",children:"未判定"}),l.is_global&&e.jsx(Qe,{variant:"outline",className:"border-blue-500 text-blue-500",children:"全局"}),l.is_complete&&e.jsx(Qe,{variant:"outline",className:"border-purple-500 text-purple-500",children:"推断完成"})]})]})]}),l.inference_with_context&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{className:"text-xs text-muted-foreground",children:"上下文推断结果"}),e.jsx("div",{className:"p-2 bg-muted rounded break-all whitespace-pre-wrap font-mono text-xs max-h-[200px] overflow-y-auto",children:l.inference_with_context})]}),l.inference_content_only&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{className:"text-xs text-muted-foreground",children:"纯词条推断结果"}),e.jsx("div",{className:"p-2 bg-muted rounded break-all whitespace-pre-wrap font-mono text-xs max-h-[200px] overflow-y-auto",children:l.inference_content_only})]})]})}),e.jsx(tt,{className:"flex-shrink-0",children:e.jsx(_,{onClick:()=>r(!1),children:"关闭"})})]})}):null}function Xu({icon:l,label:i,value:r,mono:o=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(C,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[l&&e.jsx(l,{className:"h-3 w-3"}),i]}),e.jsx("div",{className:H("text-sm",o&&"font-mono",!r&&"text-muted-foreground"),children:r||"-"})]})}function P2({open:l,onOpenChange:i,chatList:r,onSuccess:o}){const[u,x]=m.useState({content:"",meaning:"",chat_id:"",is_global:!1}),[h,f]=m.useState(!1),{toast:g}=Vs(),j=async()=>{if(!u.content||!u.chat_id){g({title:"验证失败",description:"请填写必填字段:内容和聊天",variant:"destructive"});return}try{f(!0),await F2(u),g({title:"创建成功",description:"黑话已创建"}),x({content:"",meaning:"",chat_id:"",is_global:!1}),o()}catch(v){g({title:"创建失败",description:v instanceof Error?v.message:"无法创建黑话",variant:"destructive"})}finally{f(!1)}};return e.jsx(Gs,{open:l,onOpenChange:i,children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Bs,{children:[e.jsx(Hs,{children:"新增黑话"}),e.jsx(Ws,{children:"创建新的黑话记录"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(C,{htmlFor:"content",children:["内容 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ne,{id:"content",value:u.content,onChange:v=>x({...u,content:v.target.value}),placeholder:"输入黑话内容"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"meaning",children:"含义"}),e.jsx(Is,{id:"meaning",value:u.meaning||"",onChange:v=>x({...u,meaning:v.target.value}),placeholder:"输入黑话含义(可选)",rows:3})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(C,{htmlFor:"chat_id",children:["聊天 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs(Be,{value:u.chat_id,onValueChange:v=>x({...u,chat_id:v}),children:[e.jsx(Le,{children:e.jsx(He,{placeholder:"选择关联的聊天"})}),e.jsx(Ue,{children:r.map(v=>e.jsx(se,{value:v.chat_id,children:v.chat_name},v.chat_id))})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ve,{id:"is_global",checked:u.is_global,onCheckedChange:v=>x({...u,is_global:v})}),e.jsx(C,{htmlFor:"is_global",children:"设为全局黑话"})]})]}),e.jsxs(tt,{children:[e.jsx(_,{variant:"outline",onClick:()=>i(!1),children:"取消"}),e.jsx(_,{onClick:j,disabled:h,children:h?"创建中...":"创建"})]})]})})}function Z2({jargon:l,open:i,onOpenChange:r,chatList:o,onSuccess:u}){const[x,h]=m.useState({}),[f,g]=m.useState(!1),{toast:j}=Vs();m.useEffect(()=>{l&&h({content:l.content,meaning:l.meaning||"",chat_id:l.stream_id||l.chat_id,is_global:l.is_global,is_jargon:l.is_jargon})},[l]);const v=async()=>{if(l)try{g(!0),await V2(l.id,x),j({title:"保存成功",description:"黑话已更新"}),u()}catch(N){j({title:"保存失败",description:N instanceof Error?N.message:"无法更新黑话",variant:"destructive"})}finally{g(!1)}};return l?e.jsx(Gs,{open:i,onOpenChange:r,children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Bs,{children:[e.jsx(Hs,{children:"编辑黑话"}),e.jsx(Ws,{children:"修改黑话的信息"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"edit_content",children:"内容"}),e.jsx(ne,{id:"edit_content",value:x.content||"",onChange:N=>h({...x,content:N.target.value}),placeholder:"输入黑话内容"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"edit_meaning",children:"含义"}),e.jsx(Is,{id:"edit_meaning",value:x.meaning||"",onChange:N=>h({...x,meaning:N.target.value}),placeholder:"输入黑话含义",rows:3})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"edit_chat_id",children:"聊天"}),e.jsxs(Be,{value:x.chat_id||"",onValueChange:N=>h({...x,chat_id:N}),children:[e.jsx(Le,{children:e.jsx(He,{placeholder:"选择关联的聊天"})}),e.jsx(Ue,{children:o.map(N=>e.jsx(se,{value:N.chat_id,children:N.chat_name},N.chat_id))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:"黑话状态"}),e.jsxs(Be,{value:x.is_jargon===null?"null":x.is_jargon?.toString()||"null",onValueChange:N=>h({...x,is_jargon:N==="null"?null:N==="true"}),children:[e.jsx(Le,{children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"null",children:"未判定"}),e.jsx(se,{value:"true",children:"是黑话"}),e.jsx(se,{value:"false",children:"非黑话"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ve,{id:"edit_is_global",checked:x.is_global,onCheckedChange:N=>h({...x,is_global:N})}),e.jsx(C,{htmlFor:"edit_is_global",children:"全局黑话"})]})]}),e.jsxs(tt,{children:[e.jsx(_,{variant:"outline",onClick:()=>r(!1),children:"取消"}),e.jsx(_,{onClick:v,disabled:f,children:f?"保存中...":"保存"})]})]})}):null}const ji="/api/webui/person";async function W2(l){const i=new URLSearchParams;l.page&&i.append("page",l.page.toString()),l.page_size&&i.append("page_size",l.page_size.toString()),l.search&&i.append("search",l.search),l.is_known!==void 0&&i.append("is_known",l.is_known.toString()),l.platform&&i.append("platform",l.platform);const r=await Te(`${ji}/list?${i}`,{headers:Fs()});if(!r.ok){const o=await r.json();throw new Error(o.detail||"获取人物列表失败")}return r.json()}async function e_(l){const i=await Te(`${ji}/${l}`,{headers:Fs()});if(!i.ok){const r=await i.json();throw new Error(r.detail||"获取人物详情失败")}return i.json()}async function s_(l,i){const r=await Te(`${ji}/${l}`,{method:"PATCH",headers:Fs(),body:JSON.stringify(i)});if(!r.ok){const o=await r.json();throw new Error(o.detail||"更新人物信息失败")}return r.json()}async function t_(l){const i=await Te(`${ji}/${l}`,{method:"DELETE",headers:Fs()});if(!i.ok){const r=await i.json();throw new Error(r.detail||"删除人物信息失败")}return i.json()}async function a_(){const l=await Te(`${ji}/stats/summary`,{headers:Fs()});if(!l.ok){const i=await l.json();throw new Error(i.detail||"获取统计数据失败")}return l.json()}async function l_(l){const i=await Te(`${ji}/batch/delete`,{method:"POST",headers:Fs(),body:JSON.stringify({person_ids:l})});if(!i.ok){const r=await i.json();throw new Error(r.detail||"批量删除失败")}return i.json()}function n_(){const[l,i]=m.useState([]),[r,o]=m.useState(!0),[u,x]=m.useState(0),[h,f]=m.useState(1),[g,j]=m.useState(20),[v,N]=m.useState(""),[y,S]=m.useState(void 0),[w,L]=m.useState(void 0),[O,U]=m.useState(null),[F,A]=m.useState(!1),[k,$]=m.useState(!1),[G,z]=m.useState(null),[M,Q]=m.useState({total:0,known:0,unknown:0,platforms:{}}),[fe,ve]=m.useState(new Set),[ge,be]=m.useState(!1),[je,Ne]=m.useState(""),{toast:R}=Vs(),Y=async()=>{try{o(!0);const X=await W2({page:h,page_size:g,search:v||void 0,is_known:y,platform:w});i(X.data),x(X.total)}catch(X){R({title:"加载失败",description:X instanceof Error?X.message:"无法加载人物信息",variant:"destructive"})}finally{o(!1)}},K=async()=>{try{const X=await a_();X?.data&&Q(X.data)}catch(X){console.error("加载统计数据失败:",X)}};m.useEffect(()=>{Y(),K()},[h,g,v,y,w]);const re=async X=>{try{const ae=await e_(X.person_id);U(ae.data),A(!0)}catch(ae){R({title:"加载详情失败",description:ae instanceof Error?ae.message:"无法加载人物详情",variant:"destructive"})}},T=X=>{U(X),$(!0)},ie=async X=>{try{await t_(X.person_id),R({title:"删除成功",description:`已删除人物信息: ${X.person_name||X.nickname||X.user_id}`}),z(null),Y(),K()}catch(ae){R({title:"删除失败",description:ae instanceof Error?ae.message:"无法删除人物信息",variant:"destructive"})}},xe=m.useMemo(()=>Object.keys(M.platforms),[M.platforms]),Ce=X=>{const ae=new Set(fe);ae.has(X)?ae.delete(X):ae.add(X),ve(ae)},_e=()=>{fe.size===l.length&&l.length>0?ve(new Set):ve(new Set(l.map(X=>X.person_id)))},Me=()=>{if(fe.size===0){R({title:"未选择任何人物",description:"请先选择要删除的人物",variant:"destructive"});return}be(!0)},Z=async()=>{try{const X=await l_(Array.from(fe));R({title:"批量删除完成",description:X.message}),ve(new Set),be(!1),Y(),K()}catch(X){R({title:"批量删除失败",description:X instanceof Error?X.message:"批量删除失败",variant:"destructive"})}},me=()=>{const X=parseInt(je),ae=Math.ceil(u/g);X>=1&&X<=ae?(f(X),Ne("")):R({title:"无效的页码",description:`请输入1-${ae}之间的页码`,variant:"destructive"})},ke=X=>X?new Date(X*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(Zu,{className:"h-8 w-8",strokeWidth:2}),"人物信息管理"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦认识的所有人物信息"})]})})}),e.jsx(Ze,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"总人数"}),e.jsx("div",{className:"text-2xl font-bold mt-1",children:M.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:M.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:M.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(C,{htmlFor:"search",children:"搜索"}),e.jsxs("div",{className:"relative mt-1.5",children:[e.jsx(Ft,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(ne,{id:"search",placeholder:"搜索名称、昵称或用户ID...",value:v,onChange:X=>N(X.target.value),className:"pl-9"})]})]}),e.jsxs("div",{children:[e.jsx(C,{htmlFor:"filter-known",children:"认识状态"}),e.jsxs(Be,{value:y===void 0?"all":y.toString(),onValueChange:X=>{S(X==="all"?void 0:X==="true"),f(1)},children:[e.jsx(Le,{id:"filter-known",className:"mt-1.5",children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"all",children:"全部"}),e.jsx(se,{value:"true",children:"已认识"}),e.jsx(se,{value:"false",children:"未认识"})]})]})]}),e.jsxs("div",{children:[e.jsx(C,{htmlFor:"filter-platform",children:"平台"}),e.jsxs(Be,{value:w||"all",onValueChange:X=>{L(X==="all"?void 0:X),f(1)},children:[e.jsx(Le,{id:"filter-platform",className:"mt-1.5",children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"all",children:"全部平台"}),xe.map(X=>e.jsxs(se,{value:X,children:[X," (",M.platforms[X],")"]},X))]})]})]})]}),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:fe.size>0&&e.jsxs("span",{children:["已选择 ",fe.size," 个人物"]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(Be,{value:g.toString(),onValueChange:X=>{j(parseInt(X)),f(1),ve(new Set)},children:[e.jsx(Le,{id:"page-size",className:"w-20",children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"10",children:"10"}),e.jsx(se,{value:"20",children:"20"}),e.jsx(se,{value:"50",children:"50"}),e.jsx(se,{value:"100",children:"100"})]})]}),fe.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(_,{variant:"outline",size:"sm",onClick:()=>ve(new Set),children:"取消选择"}),e.jsxs(_,{variant:"destructive",size:"sm",onClick:Me,children:[e.jsx(We,{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(jn,{children:[e.jsx(vn,{children:e.jsxs(pt,{children:[e.jsx(Pe,{className:"w-12",children:e.jsx(gt,{checked:l.length>0&&fe.size===l.length,onCheckedChange:_e,"aria-label":"全选"})}),e.jsx(Pe,{children:"状态"}),e.jsx(Pe,{children:"名称"}),e.jsx(Pe,{children:"昵称"}),e.jsx(Pe,{children:"平台"}),e.jsx(Pe,{children:"用户ID"}),e.jsx(Pe,{children:"最后更新"}),e.jsx(Pe,{className:"text-right",children:"操作"})]})}),e.jsx(bn,{children:r?e.jsx(pt,{children:e.jsx(Ie,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):l.length===0?e.jsx(pt,{children:e.jsx(Ie,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):l.map(X=>e.jsxs(pt,{children:[e.jsx(Ie,{children:e.jsx(gt,{checked:fe.has(X.person_id),onCheckedChange:()=>Ce(X.person_id),"aria-label":`选择 ${X.person_name||X.nickname||X.user_id}`})}),e.jsx(Ie,{children:e.jsx("div",{className:H("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",X.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:X.is_known?"已认识":"未认识"})}),e.jsx(Ie,{className:"font-medium",children:X.person_name||e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx(Ie,{children:X.nickname||"-"}),e.jsx(Ie,{children:X.platform}),e.jsx(Ie,{className:"font-mono text-sm",children:X.user_id}),e.jsx(Ie,{className:"text-sm text-muted-foreground",children:ke(X.last_know)}),e.jsx(Ie,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(_,{variant:"default",size:"sm",onClick:()=>re(X),children:[e.jsx(Qt,{className:"h-4 w-4 mr-1"}),"详情"]}),e.jsxs(_,{variant:"default",size:"sm",onClick:()=>T(X),children:[e.jsx(gn,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsxs(_,{size:"sm",onClick:()=>z(X),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(We,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},X.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:"加载中..."}):l.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):l.map(X=>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(gt,{checked:fe.has(X.person_id),onCheckedChange:()=>Ce(X.person_id),className:"mt-1"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:H("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium mb-2",X.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:X.is_known?"已认识":"未认识"}),e.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",children:X.person_name||e.jsx("span",{className:"text-muted-foreground",children:"未命名"})}),X.nickname&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-1 w-full break-all",children:["昵称: ",X.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:X.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:X.user_id,children:X.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:ke(X.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:()=>re(X),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(Qt,{className:"h-3 w-3 mr-1"}),"查看"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>T(X),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(gn,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>z(X),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[e.jsx(We,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},X.id))}),u>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",u," 条记录,第 ",h," / ",Math.ceil(u/g)," 页"]}),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(fi,{className:"h-4 w-4"})}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h-1),disabled:h===1,children:[e.jsx(jl,{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:je,onChange:X=>Ne(X.target.value),onKeyDown:X=>X.key==="Enter"&&me(),placeholder:h.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(u/g)}),e.jsx(_,{variant:"outline",size:"sm",onClick:me,disabled:!je,className:"h-8",children:"跳转"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>f(h+1),disabled:h>=Math.ceil(u/g),children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(Xa,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>f(Math.ceil(u/g)),disabled:h>=Math.ceil(u/g),className:"hidden sm:flex",children:e.jsx(pi,{className:"h-4 w-4"})})]})]})]})]})}),e.jsx(i_,{person:O,open:F,onOpenChange:A}),e.jsx(r_,{person:O,open:k,onOpenChange:$,onSuccess:()=>{Y(),K(),$(!1)}}),e.jsx(ms,{open:!!G,onOpenChange:()=>z(null),children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认删除"}),e.jsxs(os,{children:['确定要删除人物信息 "',G?.person_name||G?.nickname||G?.user_id,'" 吗? 此操作不可撤销。']})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:()=>G&&ie(G),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),e.jsx(ms,{open:ge,onOpenChange:be,children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"确认批量删除"}),e.jsxs(os,{children:["确定要删除选中的 ",fe.size," 个人物信息吗? 此操作不可撤销。"]})]}),e.jsxs(rs,{children:[e.jsx(us,{children:"取消"}),e.jsx(ds,{onClick:Z,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})})]})}function i_({person:l,open:i,onOpenChange:r}){if(!l)return null;const o=u=>u?new Date(u*1e3).toLocaleString("zh-CN"):"-";return e.jsx(Gs,{open:i,onOpenChange:r,children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Bs,{children:[e.jsx(Hs,{children:"人物详情"}),e.jsxs(Ws,{children:["查看 ",l.person_name||l.nickname||l.user_id," 的完整信息"]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(hl,{icon:io,label:"人物名称",value:l.person_name}),e.jsx(hl,{icon:Yl,label:"昵称",value:l.nickname}),e.jsx(hl,{icon:mi,label:"用户ID",value:l.user_id,mono:!0}),e.jsx(hl,{icon:mi,label:"人物ID",value:l.person_id,mono:!0}),e.jsx(hl,{label:"平台",value:l.platform}),e.jsx(hl,{label:"状态",value:l.is_known?"已认识":"未认识"})]}),l.name_reason&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[e.jsx(C,{className:"text-xs text-muted-foreground",children:"名称设定原因"}),e.jsx("p",{className:"mt-1 text-sm",children:l.name_reason})]}),l.memory_points&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[e.jsx(C,{className:"text-xs text-muted-foreground",children:"个人印象"}),e.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:l.memory_points})]}),l.group_nick_name&&l.group_nick_name.length>0&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[e.jsx(C,{className:"text-xs text-muted-foreground",children:"群昵称"}),e.jsx("div",{className:"mt-2 space-y-1",children:l.group_nick_name.map((u,x)=>e.jsxs("div",{className:"text-sm flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:u.group_id}),e.jsx("span",{children:"→"}),e.jsx("span",{children:u.group_nick_name})]},x))})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx(hl,{icon:oi,label:"认识时间",value:o(l.know_times)}),e.jsx(hl,{icon:oi,label:"首次记录",value:o(l.know_since)}),e.jsx(hl,{icon:oi,label:"最后更新",value:o(l.last_know)})]})]}),e.jsx(tt,{children:e.jsx(_,{onClick:()=>r(!1),children:"关闭"})})]})})}function hl({icon:l,label:i,value:r,mono:o=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(C,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[l&&e.jsx(l,{className:"h-3 w-3"}),i]}),e.jsx("div",{className:H("text-sm",o&&"font-mono",!r&&"text-muted-foreground"),children:r||"-"})]})}function r_({person:l,open:i,onOpenChange:r,onSuccess:o}){const[u,x]=m.useState({}),[h,f]=m.useState(!1),{toast:g}=Vs();m.useEffect(()=>{l&&x({person_name:l.person_name||"",name_reason:l.name_reason||"",nickname:l.nickname||"",memory_points:l.memory_points||"",is_known:l.is_known})},[l]);const j=async()=>{if(l)try{f(!0),await s_(l.person_id,u),g({title:"保存成功",description:"人物信息已更新"}),o()}catch(v){g({title:"保存失败",description:v instanceof Error?v.message:"无法更新人物信息",variant:"destructive"})}finally{f(!1)}};return l?e.jsx(Gs,{open:i,onOpenChange:r,children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Bs,{children:[e.jsx(Hs,{children:"编辑人物信息"}),e.jsxs(Ws,{children:["修改 ",l.person_name||l.nickname||l.user_id," 的信息"]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"person_name",children:"人物名称"}),e.jsx(ne,{id:"person_name",value:u.person_name||"",onChange:v=>x({...u,person_name:v.target.value}),placeholder:"为这个人设置一个名称"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"nickname",children:"昵称"}),e.jsx(ne,{id:"nickname",value:u.nickname||"",onChange:v=>x({...u,nickname:v.target.value}),placeholder:"昵称"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"name_reason",children:"名称设定原因"}),e.jsx(Is,{id:"name_reason",value:u.name_reason||"",onChange:v=>x({...u,name_reason:v.target.value}),placeholder:"为什么这样称呼这个人?",rows:2})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"memory_points",children:"个人印象"}),e.jsx(Is,{id:"memory_points",value:u.memory_points||"",onChange:v=>x({...u,memory_points:v.target.value}),placeholder:"对这个人的印象和记忆点...",rows:4})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{children:[e.jsx(C,{htmlFor:"is_known",className:"text-base font-medium",children:"已认识"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"标记是否已经认识这个人"})]}),e.jsx(Ve,{id:"is_known",checked:u.is_known,onCheckedChange:v=>x({...u,is_known:v})})]})]}),e.jsxs(tt,{children:[e.jsx(_,{variant:"outline",onClick:()=>r(!1),children:"取消"}),e.jsx(_,{onClick:j,disabled:h,children:h?"保存中...":"保存"})]})]})}):null}var c_=v0();const Up=_N(c_),jm="/api/webui";async function o_(l=100,i="all"){const r=`${jm}/knowledge/graph?limit=${l}&node_type=${i}`,o=await fetch(r);if(!o.ok)throw new Error(`获取知识图谱失败: ${o.status}`);return o.json()}async function d_(){const l=await fetch(`${jm}/knowledge/stats`);if(!l.ok)throw new Error("获取知识图谱统计信息失败");return l.json()}async function u_(l){const i=await fetch(`${jm}/knowledge/search?query=${encodeURIComponent(l)}`);if(!i.ok)throw new Error("搜索知识节点失败");return i.json()}const Cj=m.memo(({data:l})=>e.jsxs("div",{className:"px-4 py-2 shadow-md rounded-lg bg-gradient-to-br from-blue-500 to-blue-600 border-2 border-blue-700 min-w-[120px]",children:[e.jsx(co,{type:"target",position:oo.Top}),e.jsx("div",{className:"font-semibold text-white text-sm truncate max-w-[200px]",title:l.content,children:l.label}),e.jsx(co,{type:"source",position:oo.Bottom})]}));Cj.displayName="EntityNode";const kj=m.memo(({data:l})=>e.jsxs("div",{className:"px-3 py-2 shadow-md rounded-md bg-gradient-to-br from-green-500 to-green-600 border-2 border-green-700 min-w-[100px]",children:[e.jsx(co,{type:"target",position:oo.Top}),e.jsx("div",{className:"font-medium text-white text-xs truncate max-w-[150px]",title:l.content,children:l.label}),e.jsx(co,{type:"source",position:oo.Bottom})]}));kj.displayName="ParagraphNode";const m_={entity:Cj,paragraph:kj};function x_(l,i){const r=new Up.graphlib.Graph;r.setDefaultEdgeLabel(()=>({})),r.setGraph({rankdir:"TB",ranksep:100,nodesep:80});const o=[],u=[];return l.forEach(x=>{r.setNode(x.id,{width:150,height:50})}),i.forEach(x=>{r.setEdge(x.source,x.target)}),Up.layout(r),l.forEach(x=>{const h=r.node(x.id);o.push({id:x.id,type:x.type,position:{x:h.x-75,y:h.y-25},data:{label:x.content.slice(0,20)+(x.content.length>20?"...":""),content:x.content}})}),i.forEach((x,h)=>{const f={id:`edge-${h}`,source:x.source,target:x.target,animated:l.length<=200&&x.weight>5,style:{strokeWidth:Math.min(x.weight/2,5),opacity:.6}};x.weight>10&&l.length<100&&(f.label=`${x.weight.toFixed(0)}`),u.push(f)}),{nodes:o,edges:u}}function h_(){const l=Ea(),[i,r]=m.useState(!1),[o,u]=m.useState(null),[x,h]=m.useState(""),[f,g]=m.useState("all"),[j,v]=m.useState(50),[N,y]=m.useState("50"),[S,w]=m.useState(!1),[L,O]=m.useState(!0),[U,F]=m.useState(!1),[A,k]=m.useState(!1),[$,G,z]=b0([]),[M,Q,fe]=N0([]),[ve,ge]=m.useState(0),[be,je]=m.useState(null),[Ne,R]=m.useState(null),{toast:Y}=Vs(),K=m.useCallback(Z=>Z.type==="entity"?"#6366f1":Z.type==="paragraph"?"#10b981":"#6b7280",[]),re=m.useCallback(async(Z=!1)=>{try{if(!Z&&j>200){k(!0);return}r(!0);const[me,ke]=await Promise.all([o_(j,f),d_()]);if(u(ke),me.nodes.length===0){Y({title:"提示",description:"知识库为空,请先导入知识数据"}),G([]),Q([]);return}const{nodes:X,edges:ae}=x_(me.nodes,me.edges);G(X),Q(ae),ge(X.length),ke&&ke.total_nodes>j&&Y({title:"提示",description:`知识图谱包含 ${ke.total_nodes} 个节点,当前显示 ${X.length} 个`}),Y({title:"加载成功",description:`已加载 ${X.length} 个节点,${ae.length} 条边`})}catch(me){console.error("加载知识图谱失败:",me),Y({title:"加载失败",description:me instanceof Error?me.message:"未知错误",variant:"destructive"})}finally{r(!1)}},[j,f,Y]),T=m.useCallback(async()=>{if(!x.trim()){Y({title:"提示",description:"请输入搜索关键词"});return}try{const Z=await u_(x);if(Z.length===0){Y({title:"未找到",description:"没有找到匹配的节点"});return}const me=new Set(Z.map(ke=>ke.id));G(ke=>ke.map(X=>({...X,style:{...X.style,opacity:me.has(X.id)?1:.3,filter:me.has(X.id)?"brightness(1.2)":"brightness(0.8)"}}))),Y({title:"搜索完成",description:`找到 ${Z.length} 个匹配节点`})}catch(Z){console.error("搜索失败:",Z),Y({title:"搜索失败",description:Z instanceof Error?Z.message:"未知错误",variant:"destructive"})}},[x,Y]),ie=m.useCallback(()=>{G(Z=>Z.map(me=>({...me,style:{...me.style,opacity:1,filter:"brightness(1)"}})))},[]),xe=m.useCallback(()=>{O(!1),F(!0),re()},[re]),Ce=m.useCallback(()=>{k(!1),setTimeout(()=>{re(!0)},0)},[re]),_e=m.useCallback((Z,me)=>{$.find(X=>X.id===me.id)&&je({id:me.id,type:me.type,content:me.data.content})},[$]);m.useEffect(()=>{L||U&&re()},[j,f,L,U]);const Me=m.useCallback((Z,me)=>{const ke=$.find(De=>De.id===me.source),X=$.find(De=>De.id===me.target),ae=M.find(De=>De.id===me.id);ke&&X&&ae&&R({source:{id:ke.id,type:ke.type,content:ke.data.content},target:{id:X.id,type:X.type,content:X.data.content},edge:{source:me.source,target:me.target,weight:parseFloat(me.label||"0")}})},[$,M]);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:"可视化知识实体与关系网络"})]}),o&&e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.jsxs(Qe,{variant:"outline",className:"gap-1",children:[e.jsx(lo,{className:"h-3 w-3"}),"节点: ",o.total_nodes]}),e.jsxs(Qe,{variant:"outline",className:"gap-1",children:[e.jsx(Ug,{className:"h-3 w-3"}),"边: ",o.total_edges]}),e.jsxs(Qe,{variant:"outline",className:"gap-1",children:[e.jsx(Ia,{className:"h-3 w-3"}),"实体: ",o.entity_nodes]}),e.jsxs(Qe,{variant:"outline",className:"gap-1",children:[e.jsx(Ra,{className:"h-3 w-3"}),"段落: ",o.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:x,onChange:Z=>h(Z.target.value),onKeyDown:Z=>Z.key==="Enter"&&T(),className:"flex-1"}),e.jsx(_,{onClick:T,size:"sm",children:e.jsx(Ft,{className:"h-4 w-4"})}),e.jsx(_,{onClick:ie,variant:"outline",size:"sm",children:"重置"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(Be,{value:f,onValueChange:Z=>g(Z),children:[e.jsx(Le,{className:"w-[120px]",children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"all",children:"全部节点"}),e.jsx(se,{value:"entity",children:"仅实体"}),e.jsx(se,{value:"paragraph",children:"仅段落"})]})]}),e.jsxs(Be,{value:j===1e4?"all":S?"custom":j.toString(),onValueChange:Z=>{Z==="custom"?(w(!0),y(j.toString())):Z==="all"?(w(!1),v(1e4)):(w(!1),v(Number(Z)))},children:[e.jsx(Le,{className:"w-[120px]",children:e.jsx(He,{})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"50",children:"50 节点"}),e.jsx(se,{value:"100",children:"100 节点"}),e.jsx(se,{value:"200",children:"200 节点"}),e.jsx(se,{value:"500",children:"500 节点"}),e.jsx(se,{value:"1000",children:"1000 节点"}),e.jsx(se,{value:"all",children:"全部 (最多10000)"}),e.jsx(se,{value:"custom",children:"自定义..."})]})]}),S&&e.jsx(ne,{type:"number",min:"50",value:N,onChange:Z=>y(Z.target.value),onBlur:()=>{const Z=parseInt(N);!isNaN(Z)&&Z>=50?v(Z):(y("50"),v(50))},onKeyDown:Z=>{if(Z.key==="Enter"){const me=parseInt(N);!isNaN(me)&&me>=50?v(me):(y("50"),v(50))}},placeholder:"最少50个",className:"w-[120px]"}),e.jsx(_,{onClick:()=>re(),variant:"outline",size:"sm",disabled:i,children:e.jsx(qt,{className:H("h-4 w-4",i&&"animate-spin")})})]})]})]}),e.jsx("div",{className:"flex-1 relative",children:i?e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(qt,{className:"h-8 w-8 animate-spin mx-auto mb-2 text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground",children:"加载知识图谱中..."})]})}):$.length===0?e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(lo,{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(y0,{nodes:$,edges:M,onNodesChange:z,onEdgesChange:fe,onNodeClick:_e,onEdgeClick:Me,nodeTypes:m_,fitView:!0,minZoom:.05,maxZoom:1.5,defaultViewport:{x:0,y:0,zoom:.5},elevateNodesOnSelect:ve<=500,nodesDraggable:ve<=1e3,attributionPosition:"bottom-left",children:[e.jsx(w0,{variant:_0.Dots,gap:12,size:1}),e.jsx(S0,{}),ve<=500&&e.jsx(C0,{nodeColor:K,nodeBorderRadius:8,pannable:!0,zoomable:!0}),e.jsxs(k0,{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:"段落节点"})]}),ve>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:"已禁用动画"}),ve>500&&e.jsx("div",{children:"已禁用缩略图"})]})]})]})]})}),e.jsx(Gs,{open:!!be,onOpenChange:Z=>!Z&&je(null),children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsx(Bs,{children:e.jsx(Hs,{children:"节点详情"})}),be&&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(Qe,{variant:be.type==="entity"?"default":"secondary",children:be.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:be.id})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"内容"}),e.jsx(Ze,{className:"mt-1 h-40 p-3 bg-muted rounded",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:be.content})})]})]})]})}),e.jsx(Gs,{open:!!Ne,onOpenChange:Z=>!Z&&R(null),children:e.jsxs(Us,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[e.jsx(Bs,{children:e.jsx(Hs,{children:"边详情"})}),Ne&&e.jsx(Ze,{className:"flex-1 pr-4",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0 p-3 bg-blue-50 dark:bg-blue-950 rounded border-2 border-blue-200 dark:border-blue-800",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"源节点"}),e.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:Ne.source.content}),e.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[Ne.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:Ne.target.content}),e.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[Ne.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(Qe,{variant:"outline",className:"text-base font-mono",children:Ne.edge.weight.toFixed(4)})})]})]})})]})}),e.jsx(ms,{open:L,onOpenChange:O,children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"加载知识图谱"}),e.jsxs(os,{children:["知识图谱的动态展示会消耗较多系统资源。",e.jsx("br",{}),"确定要加载知识图谱吗?"]})]}),e.jsxs(rs,{children:[e.jsx(us,{onClick:()=>l({to:"/"}),children:"取消 (返回首页)"}),e.jsx(ds,{onClick:xe,children:"确认加载"})]})]})}),e.jsx(ms,{open:A,onOpenChange:k,children:e.jsxs(ns,{children:[e.jsxs(is,{children:[e.jsx(cs,{children:"⚠️ 节点数量较多"}),e.jsx(os,{asChild:!0,children:e.jsxs("div",{children:[e.jsxs("p",{children:["您正在尝试加载 ",e.jsx("strong",{className:"text-orange-600",children:j>=1e4?"全部 (最多10000个)":j})," 个节点。"]}),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(rs,{children:[e.jsx(us,{onClick:()=>{k(!1),j>200&&(v(50),w(!1))},children:"取消"}),e.jsx(ds,{onClick:Ce,className:"bg-orange-600 hover:bg-orange-700",children:"我了解风险,继续加载"})]})]})})]})}function Bp({className:l,classNames:i,showOutsideDays:r=!0,captionLayout:o="label",buttonVariant:u="ghost",formatters:x,components:h,...f}){const g=Fg();return e.jsx(d0,{showOutsideDays:r,className:H("bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,l),captionLayout:o,formatters:{formatMonthDropdown:j=>j.toLocaleString("default",{month:"short"}),...x},classNames:{root:H("w-fit",g.root),months:H("relative flex flex-col gap-4 md:flex-row",g.months),month:H("flex w-full flex-col gap-4",g.month),nav:H("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",g.nav),button_previous:H(Nr({variant:u}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",g.button_previous),button_next:H(Nr({variant:u}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",g.button_next),month_caption:H("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",g.month_caption),dropdowns:H("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",g.dropdowns),dropdown_root:H("has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",g.dropdown_root),dropdown:H("bg-popover absolute inset-0 opacity-0",g.dropdown),caption_label:H("select-none font-medium",o==="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",g.caption_label),table:"w-full border-collapse",weekdays:H("flex",g.weekdays),weekday:H("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",g.weekday),week:H("mt-2 flex w-full",g.week),week_number_header:H("w-[--cell-size] select-none",g.week_number_header),week_number:H("text-muted-foreground select-none text-[0.8rem]",g.week_number),day:H("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",g.day),range_start:H("bg-accent rounded-l-md",g.range_start),range_middle:H("rounded-none",g.range_middle),range_end:H("bg-accent rounded-r-md",g.range_end),today:H("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",g.today),outside:H("text-muted-foreground aria-selected:text-muted-foreground",g.outside),disabled:H("text-muted-foreground opacity-50",g.disabled),hidden:H("invisible",g.hidden),...i},components:{Root:({className:j,rootRef:v,...N})=>e.jsx("div",{"data-slot":"calendar",ref:v,className:H(j),...N}),Chevron:({className:j,orientation:v,...N})=>v==="left"?e.jsx(jl,{className:H("size-4",j),...N}):v==="right"?e.jsx(Xa,{className:H("size-4",j),...N}):e.jsx(Qa,{className:H("size-4",j),...N}),DayButton:f_,WeekNumber:({children:j,...v})=>e.jsx("td",{...v,children:e.jsx("div",{className:"flex size-[--cell-size] items-center justify-center text-center",children:j})}),...h},...f})}function f_({className:l,day:i,modifiers:r,...o}){const u=Fg(),x=m.useRef(null);return m.useEffect(()=>{r.focused&&x.current?.focus()},[r.focused]),e.jsx(_,{ref:x,variant:"ghost",size:"icon","data-day":i.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:H("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70",u.day,l),...o})}const Jc={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 p_(){const[l,i]=m.useState([]),[r,o]=m.useState(""),[u,x]=m.useState("all"),[h,f]=m.useState("all"),[g,j]=m.useState(void 0),[v,N]=m.useState(void 0),[y,S]=m.useState(!0),[w,L]=m.useState(!1),[O,U]=m.useState("xs"),[F,A]=m.useState(4),[k,$]=m.useState(!1),G=m.useRef(null);m.useEffect(()=>{const T=hn.getAllLogs();i(T);const ie=hn.onLog(()=>{i(hn.getAllLogs())}),xe=hn.onConnectionChange(Ce=>{L(Ce)});return()=>{ie(),xe()}},[]);const z=m.useMemo(()=>{const T=new Set(l.map(ie=>ie.module).filter(ie=>ie&&ie.trim()!==""));return Array.from(T).sort()},[l]),M=T=>{switch(T){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"}},Q=T=>{switch(T){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"}},fe=()=>{window.location.reload()},ve=()=>{hn.clearLogs(),i([])},ge=()=>{const T=Ne.map(_e=>`${_e.timestamp} [${_e.level.padEnd(8)}] [${_e.module}] ${_e.message}`).join(` +`),ie=new Blob([T],{type:"text/plain;charset=utf-8"}),xe=URL.createObjectURL(ie),Ce=document.createElement("a");Ce.href=xe,Ce.download=`logs-${Au(new Date,"yyyy-MM-dd-HHmmss")}.txt`,Ce.click(),URL.revokeObjectURL(xe)},be=()=>{S(!y)},je=()=>{j(void 0),N(void 0)},Ne=m.useMemo(()=>l.filter(T=>{const ie=r===""||T.message.toLowerCase().includes(r.toLowerCase())||T.module.toLowerCase().includes(r.toLowerCase()),xe=u==="all"||T.level===u,Ce=h==="all"||T.module===h;let _e=!0;if(g||v){const Me=new Date(T.timestamp);if(g){const Z=new Date(g);Z.setHours(0,0,0,0),_e=_e&&Me>=Z}if(v){const Z=new Date(v);Z.setHours(23,59,59,999),_e=_e&&Me<=Z}}return ie&&xe&&Ce&&_e}),[l,r,u,h,g,v]),R=Jc[O].rowHeight+F,Y=pN({count:Ne.length,getScrollElement:()=>G.current,estimateSize:()=>R,overscan:50}),K=m.useRef(!1),re=m.useRef(Ne.length);return m.useEffect(()=>{const T=G.current;if(!T)return;const ie=()=>{if(K.current)return;const{scrollTop:xe,scrollHeight:Ce,clientHeight:_e}=T,Me=Ce-xe-_e;Me>100&&y?S(!1):Me<50&&!y&&S(!0)};return T.addEventListener("scroll",ie,{passive:!0}),()=>T.removeEventListener("scroll",ie)},[y]),m.useEffect(()=>{const T=Ne.length>re.current;re.current=Ne.length,y&&Ne.length>0&&T&&(K.current=!0,Y.scrollToIndex(Ne.length-1,{align:"end",behavior:"auto"}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{K.current=!1})}))},[Ne.length,y,Y]),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:H("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(Fe,{className:"p-2 sm:p-3",children:e.jsx(_r,{open:k,onOpenChange:$,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(Ft,{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:T=>o(T.target.value),className:"pl-8 h-8 text-xs sm:text-sm"})]}),e.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[e.jsxs(_,{variant:y?"default":"outline",size:"sm",onClick:be,className:"h-8 px-2",title:y?"自动滚动":"已暂停",children:[y?e.jsx(Fy,{className:"h-3.5 w-3.5"}):e.jsx(Vy,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"ml-1 text-xs hidden sm:inline",children:y?"滚动":"暂停"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:ve,className:"h-8 px-2",title:"清空日志",children:[e.jsx(We,{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:ge,className:"h-8 px-2 hidden sm:flex",title:"导出日志",children:[e.jsx(Ua,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"ml-1 text-xs hidden lg:inline",children:"导出"})]}),e.jsx(Sr,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:"h-8 px-2",title:k?"收起筛选":"展开筛选",children:[e.jsx(eo,{className:"h-3.5 w-3.5"}),k?e.jsx(ui,{className:"h-3.5 w-3.5 ml-1"}):e.jsx(Qa,{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:[Ne.length," / ",l.length]}),e.jsx("span",{className:"ml-1",children:"条日志"})]}),e.jsxs(Cr,{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-2",children:[e.jsxs(Be,{value:u,onValueChange:x,children:[e.jsxs(Le,{className:"w-full sm:flex-1 h-8 text-xs",children:[e.jsx(eo,{className:"h-3.5 w-3.5 mr-1.5"}),e.jsx(He,{placeholder:"级别"})]}),e.jsxs(Ue,{children:[e.jsx(se,{value:"all",children:"全部级别"}),e.jsx(se,{value:"DEBUG",children:"DEBUG"}),e.jsx(se,{value:"INFO",children:"INFO"}),e.jsx(se,{value:"WARNING",children:"WARNING"}),e.jsx(se,{value:"ERROR",children:"ERROR"}),e.jsx(se,{value:"CRITICAL",children:"CRITICAL"})]})]}),e.jsxs(Be,{value:h,onValueChange:f,children:[e.jsxs(Le,{className:"w-full sm:flex-1 h-8 text-xs",children:[e.jsx(eo,{className:"h-3.5 w-3.5 mr-1.5"}),e.jsx(He,{placeholder:"模块"})]}),e.jsxs(Ue,{children:[e.jsx(se,{value:"all",children:"全部模块"}),z.map(T=>e.jsx(se,{value:T,children:T},T))]})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-2",children:[e.jsxs(Ya,{children:[e.jsx(Ka,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:H("w-full sm:flex-1 justify-start text-left font-normal h-8",!g&&"text-muted-foreground"),children:[e.jsx(xp,{className:"mr-1.5 h-3.5 w-3.5"}),e.jsx("span",{className:"text-xs",children:g?Au(g,"PP",{locale:Kc}):"开始日期"})]})}),e.jsx(Ba,{className:"w-auto p-0",align:"start",children:e.jsx(Bp,{mode:"single",selected:g,onSelect:j,initialFocus:!0,locale:Kc})})]}),e.jsxs(Ya,{children:[e.jsx(Ka,{asChild:!0,children:e.jsxs(_,{variant:"outline",size:"sm",className:H("w-full sm:flex-1 justify-start text-left font-normal h-8",!v&&"text-muted-foreground"),children:[e.jsx(xp,{className:"mr-1.5 h-3.5 w-3.5"}),e.jsx("span",{className:"text-xs",children:v?Au(v,"PP",{locale:Kc}):"结束日期"})]})}),e.jsx(Ba,{className:"w-auto p-0",align:"start",children:e.jsx(Bp,{mode:"single",selected:v,onSelect:N,initialFocus:!0,locale:Kc})})]}),(g||v)&&e.jsxs(_,{variant:"outline",size:"sm",onClick:je,className:"w-full sm:w-auto h-8",children:[e.jsx(gl,{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(Iy,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"字号"})]}),e.jsx("div",{className:"flex gap-1",children:Object.keys(Jc).map(T=>e.jsx(_,{variant:O===T?"default":"outline",size:"sm",onClick:()=>U(T),className:"h-6 px-2 text-xs",children:Jc[T].label},T))})]}),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(Ca,{value:[F],onValueChange:([T])=>A(T),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:fe,className:"flex-1 h-8",children:[e.jsx(qt,{className:"h-3.5 w-3.5 mr-1"}),e.jsx("span",{className:"text-xs",children:"刷新"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:ge,className:"flex-1 h-8",children:[e.jsx(Ua,{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(Fe,{className:"bg-black dark:bg-gray-950 border-gray-800 dark:border-gray-900 h-full overflow-hidden",children:e.jsx("div",{ref:G,className:H("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:H("p-2 sm:p-3 font-mono relative",Jc[O].class),style:{height:`${Y.getTotalSize()}px`},children:Ne.length===0?e.jsx("div",{className:"text-gray-500 dark:text-gray-600 text-center py-8 text-xs sm:text-sm",children:"暂无日志数据"}):Y.getVirtualItems().map(T=>{const ie=Ne[T.index];return e.jsxs("div",{"data-index":T.index,ref:Y.measureElement,className:H("absolute top-0 left-0 w-full px-2 sm:px-3 rounded hover:bg-white/5 transition-colors",Q(ie.level)),style:{transform:`translateY(${T.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:ie.timestamp}),e.jsxs("span",{className:H("font-semibold text-[10px]",M(ie.level)),children:["[",ie.level,"]"]})]}),e.jsx("div",{className:"text-cyan-400 dark:text-cyan-500 truncate text-[10px]",children:ie.module}),e.jsx("div",{className:"text-gray-300 dark:text-gray-400 whitespace-pre-wrap break-words text-[10px]",children:ie.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:ie.timestamp}),e.jsxs("span",{className:H("flex-shrink-0 w-[65px] lg:w-[75px] font-semibold",M(ie.level)),children:["[",ie.level,"]"]}),e.jsx("span",{className:"text-cyan-400 dark:text-cyan-500 flex-shrink-0 w-[100px] lg:w-[130px] truncate",children:ie.module}),e.jsx("span",{className:"text-gray-300 dark:text-gray-400 flex-1 whitespace-pre-wrap break-words",children:ie.message})]})]},T.key)})})})})})]})}const g_="Mai-with-u",j_="plugin-repo",v_="main",b_="plugin_details.json";async function N_(){try{const l=await Te("/api/webui/plugins/fetch-raw",{method:"POST",body:JSON.stringify({owner:g_,repo:j_,branch:v_,file_path:b_})});if(!l.ok)throw new Error(`HTTP error! status: ${l.status}`);const i=await l.json();if(!i.success||!i.data)throw new Error(i.error||"获取插件列表失败");return JSON.parse(i.data).filter(u=>!u?.id||!u?.manifest?(console.warn("跳过无效插件数据:",u),!1):!u.manifest.name||!u.manifest.version?(console.warn("跳过缺少必需字段的插件:",u.id),!1):!0).map(u=>({id:u.id,manifest:{manifest_version:u.manifest.manifest_version||1,name:u.manifest.name,version:u.manifest.version,description:u.manifest.description||"",author:u.manifest.author||{name:"Unknown"},license:u.manifest.license||"Unknown",host_application:u.manifest.host_application||{min_version:"0.0.0"},homepage_url:u.manifest.homepage_url,repository_url:u.manifest.repository_url,keywords:u.manifest.keywords||[],categories:u.manifest.categories||[],default_locale:u.manifest.default_locale||"zh-CN",locales_path:u.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!1,published_at:new Date().toISOString(),updated_at:new Date().toISOString()}))}catch(l){throw console.error("Failed to fetch plugin list:",l),l}}async function y_(){try{const l=await Te("/api/webui/plugins/git-status");if(!l.ok)throw new Error(`HTTP error! status: ${l.status}`);return await l.json()}catch(l){return console.error("Failed to check Git status:",l),{installed:!1,error:"无法检测 Git 安装状态"}}}async function w_(){try{const l=await Te("/api/webui/plugins/version");if(!l.ok)throw new Error(`HTTP error! status: ${l.status}`);return await l.json()}catch(l){return console.error("Failed to get Maimai version:",l),{version:"0.0.0",version_major:0,version_minor:0,version_patch:0}}}function __(l,i,r){const o=l.split(".").map(f=>parseInt(f)||0),u=o[0]||0,x=o[1]||0,h=o[2]||0;if(r.version_majorparseInt(N)||0),g=f[0]||0,j=f[1]||0,v=f[2]||0;if(r.version_major>g||r.version_major===g&&r.version_minor>j||r.version_major===g&&r.version_minor===j&&r.version_patch>v)return!1}return!0}function S_(l,i){const r=window.location.protocol==="https:"?"wss:":"ws:",o=window.location.host,u=new WebSocket(`${r}//${o}/api/webui/ws/plugin-progress`);return u.onopen=()=>{console.log("Plugin progress WebSocket connected");const x=setInterval(()=>{u.readyState===WebSocket.OPEN?u.send("ping"):clearInterval(x)},3e4)},u.onmessage=x=>{try{if(x.data==="pong")return;const h=JSON.parse(x.data);l(h)}catch(h){console.error("Failed to parse progress data:",h)}},u.onerror=x=>{console.error("Plugin progress WebSocket error:",x),i?.(x)},u.onclose=()=>{console.log("Plugin progress WebSocket disconnected")},u}async function hr(){try{const l=await Te("/api/webui/plugins/installed",{headers:Fs()});if(!l.ok)throw new Error(`HTTP error! status: ${l.status}`);const i=await l.json();if(!i.success)throw new Error(i.message||"获取已安装插件列表失败");return i.plugins||[]}catch(l){return console.error("Failed to get installed plugins:",l),[]}}function Pc(l,i){return i.some(r=>r.id===l)}function Zc(l,i){const r=i.find(o=>o.id===l);if(r)return r.manifest?.version||r.version}async function C_(l,i,r="main"){const o=await Te("/api/webui/plugins/install",{method:"POST",body:JSON.stringify({plugin_id:l,repository_url:i,branch:r})});if(!o.ok){const u=await o.json();throw new Error(u.detail||"安装失败")}return await o.json()}async function k_(l){const i=await Te("/api/webui/plugins/uninstall",{method:"POST",body:JSON.stringify({plugin_id:l})});if(!i.ok){const r=await i.json();throw new Error(r.detail||"卸载失败")}return await i.json()}async function T_(l,i,r="main"){const o=await Te("/api/webui/plugins/update",{method:"POST",body:JSON.stringify({plugin_id:l,repository_url:i,branch:r})});if(!o.ok){const u=await o.json();throw new Error(u.detail||"更新失败")}return await o.json()}async function E_(l){const i=await Te(`/api/webui/plugins/config/${l}/schema`,{headers:Fs()});if(!i.ok){const o=await i.json();throw new Error(o.detail||"获取配置 Schema 失败")}const r=await i.json();if(!r.success)throw new Error(r.message||"获取配置 Schema 失败");return r.schema}async function z_(l){const i=await Te(`/api/webui/plugins/config/${l}`,{headers:Fs()});if(!i.ok){const o=await i.json();throw new Error(o.detail||"获取配置失败")}const r=await i.json();if(!r.success)throw new Error(r.message||"获取配置失败");return r.config}async function M_(l,i){const r=await Te(`/api/webui/plugins/config/${l}`,{method:"PUT",body:JSON.stringify({config:i})});if(!r.ok){const o=await r.json();throw new Error(o.detail||"保存配置失败")}return await r.json()}async function A_(l){const i=await Te(`/api/webui/plugins/config/${l}/reset`,{method:"POST",headers:Fs()});if(!i.ok){const r=await i.json();throw new Error(r.detail||"重置配置失败")}return await i.json()}async function O_(l){const i=await Te(`/api/webui/plugins/config/${l}/toggle`,{method:"POST",headers:Fs()});if(!i.ok){const r=await i.json();throw new Error(r.detail||"切换状态失败")}return await i.json()}const zr="https://maibot-plugin-stats.maibot-webui.workers.dev";async function Tj(l){try{const i=await fetch(`${zr}/stats/${l}`);return i.ok?await i.json():(console.error("Failed to fetch plugin stats:",i.statusText),null)}catch(i){return console.error("Error fetching plugin stats:",i),null}}async function D_(l,i){try{const r=i||vm(),o=await fetch(`${zr}/stats/like`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:l,user_id:r})}),u=await o.json();return o.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:o.ok?{success:!0,...u}:{success:!1,error:u.error||"点赞失败"}}catch(r){return console.error("Error liking plugin:",r),{success:!1,error:"网络错误"}}}async function R_(l,i){try{const r=i||vm(),o=await fetch(`${zr}/stats/dislike`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:l,user_id:r})}),u=await o.json();return o.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:o.ok?{success:!0,...u}:{success:!1,error:u.error||"点踩失败"}}catch(r){return console.error("Error disliking plugin:",r),{success:!1,error:"网络错误"}}}async function L_(l,i,r,o){if(i<1||i>5)return{success:!1,error:"评分必须在 1-5 之间"};try{const u=o||vm(),x=await fetch(`${zr}/stats/rate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:l,rating:i,comment:r,user_id:u})}),h=await x.json();return x.status===429?{success:!1,error:"每天最多评分 3 次"}:x.ok?{success:!0,...h}:{success:!1,error:h.error||"评分失败"}}catch(u){return console.error("Error rating plugin:",u),{success:!1,error:"网络错误"}}}async function U_(l){try{const i=await fetch(`${zr}/stats/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:l})}),r=await i.json();return i.status===429?(console.warn("Download recording rate limited"),{success:!0}):i.ok?{success:!0,...r}:(console.error("Failed to record download:",r.error),{success:!1,error:r.error})}catch(i){return console.error("Error recording download:",i),{success:!1,error:"网络错误"}}}function B_(){const l=navigator,i=[navigator.userAgent,navigator.language,navigator.languages?.join(",")||"",navigator.platform,navigator.hardwareConcurrency||0,screen.width,screen.height,screen.colorDepth,screen.pixelDepth,new Date().getTimezoneOffset(),Intl.DateTimeFormat().resolvedOptions().timeZone,navigator.maxTouchPoints||0,l.deviceMemory||0].join("|");let r=0;for(let o=0;o{x(!0);const U=await Tj(l);U&&o(U),x(!1)};m.useEffect(()=>{S()},[l]);const w=async()=>{const U=await D_(l);U.success?(y({title:"已点赞",description:"感谢你的支持!"}),S()):y({title:"点赞失败",description:U.error||"未知错误",variant:"destructive"})},L=async()=>{const U=await R_(l);U.success?(y({title:"已反馈",description:"感谢你的反馈!"}),S()):y({title:"操作失败",description:U.error||"未知错误",variant:"destructive"})},O=async()=>{if(h===0){y({title:"请选择评分",description:"至少选择 1 颗星",variant:"destructive"});return}const U=await L_(l,h,g||void 0);U.success?(y({title:"评分成功",description:"感谢你的评价!"}),N(!1),f(0),j(""),S()):y({title:"评分失败",description:U.error||"未知错误",variant:"destructive"})};return u?e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Ua,{className:"h-4 w-4"}),e.jsx("span",{children:"-"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(fl,{className:"h-4 w-4"}),e.jsx("span",{children:"-"})]})]}):r?i?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(Ua,{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(fl,{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(Du,{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(Ua,{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(fl,{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(Du,{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(hp,{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(Du,{className:"h-4 w-4 mr-1"}),"点赞"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:L,children:[e.jsx(hp,{className:"h-4 w-4 mr-1"}),"点踩"]}),e.jsxs(Gs,{open:v,onOpenChange:N,children:[e.jsx(om,{asChild:!0,children:e.jsxs(_,{variant:"default",size:"sm",children:[e.jsx(fl,{className:"h-4 w-4 mr-1"}),"评分"]})}),e.jsxs(Us,{children:[e.jsxs(Bs,{children:[e.jsx(Hs,{children:"为插件评分"}),e.jsx(Ws,{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(U=>e.jsx("button",{onClick:()=>f(U),className:"focus:outline-none",children:e.jsx(fl,{className:`h-8 w-8 transition-colors ${U<=h?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-300"}`})},U))}),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(Is,{value:g,onChange:U=>j(U.target.value),placeholder:"分享你的使用体验...",rows:4,maxLength:500}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1 text-right",children:[g.length," / 500"]})]})]}),e.jsxs(tt,{children:[e.jsx(_,{variant:"outline",onClick:()=>N(!1),children:"取消"}),e.jsx(_,{onClick:O,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((U,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(A=>e.jsx(fl,{className:`h-3 w-3 ${A<=U.rating?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},A))}),e.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(U.created_at).toLocaleDateString()})]}),U.comment&&e.jsx("p",{className:"text-sm text-muted-foreground",children:U.comment})]},F))})]})]}):null}const Hp={"Group Management":"群组管理","Entertainment & Interaction":"娱乐互动","Utility Tools":"实用工具","Content Generation":"内容生成",Multimedia:"多媒体","External Integration":"外部集成","Data Analysis & Insights":"数据分析与洞察",Other:"其他"};function $_(){const l=Ea(),[i,r]=m.useState(null),[o,u]=m.useState(""),[x,h]=m.useState("all"),[f,g]=m.useState("all"),[j,v]=m.useState(!0),[N,y]=m.useState([]),[S,w]=m.useState(!0),[L,O]=m.useState(null),[U,F]=m.useState(null),[A,k]=m.useState(null),[$,G]=m.useState(null),[,z]=m.useState([]),[M,Q]=m.useState({}),[fe,ve]=m.useState(!1),[ge,be]=m.useState(null),[je,Ne]=m.useState("main"),[R,Y]=m.useState(""),[K,re]=m.useState("preset"),[T,ie]=m.useState(!1),{toast:xe}=Vs(),Ce=async E=>{const he=E.map(async W=>{try{const Se=await Tj(W.id);return{id:W.id,stats:Se}}catch(Se){return console.warn(`Failed to load stats for ${W.id}:`,Se),{id:W.id,stats:null}}}),Xe=await Promise.all(he),ye={};Xe.forEach(({id:W,stats:Se})=>{Se&&(ye[W]=Se)}),Q(ye)};m.useEffect(()=>{let E=null,he=!1;return(async()=>{if(E=S_(ye=>{he||(k(ye),ye.stage==="success"?setTimeout(()=>{he||k(null)},2e3):ye.stage==="error"&&(w(!1),O(ye.error||"加载失败")))},ye=>{console.error("WebSocket error:",ye),he||xe({title:"WebSocket 连接失败",description:"无法实时显示加载进度",variant:"destructive"})}),await new Promise(ye=>{if(!E){ye();return}const W=()=>{E&&E.readyState===WebSocket.OPEN?(console.log("WebSocket connected, starting to load plugins"),ye()):E&&E.readyState===WebSocket.CLOSED?(console.warn("WebSocket closed before loading plugins"),ye()):setTimeout(W,100)};W()}),!he){const ye=await y_();F(ye),ye.installed||xe({title:"Git 未安装",description:ye.error||"请先安装 Git 才能使用插件安装功能",variant:"destructive"})}if(!he){const ye=await w_();G(ye)}if(!he)try{w(!0),O(null);const ye=await N_();if(!he){const W=await hr();z(W);const Se=ye.map(Ge=>{const jt=Pc(Ge.id,W),Qs=Zc(Ge.id,W);return{...Ge,installed:jt,installed_version:Qs}});for(const Ge of W)!Se.some(Qs=>Qs.id===Ge.id)&&Ge.manifest&&Se.push({id:Ge.id,manifest:{manifest_version:Ge.manifest.manifest_version||1,name:Ge.manifest.name,version:Ge.manifest.version,description:Ge.manifest.description||"",author:Ge.manifest.author,license:Ge.manifest.license||"Unknown",host_application:Ge.manifest.host_application,homepage_url:Ge.manifest.homepage_url,repository_url:Ge.manifest.repository_url,keywords:Ge.manifest.keywords||[],categories:Ge.manifest.categories||[],default_locale:Ge.manifest.default_locale||"zh-CN",locales_path:Ge.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!0,installed_version:Ge.manifest.version,published_at:new Date().toISOString(),updated_at:new Date().toISOString()});y(Se),Ce(Se)}}catch(ye){if(!he){const W=ye instanceof Error?ye.message:"加载插件列表失败";O(W),xe({title:"加载失败",description:W,variant:"destructive"})}}finally{he||w(!1)}})(),()=>{he=!0,E&&E.close()}},[xe]);const _e=E=>{if(!E.installed&&$&&!Me(E))return e.jsxs(Qe,{variant:"destructive",className:"gap-1",children:[e.jsx(Gt,{className:"h-3 w-3"}),"不兼容"]});if(E.installed){const he=E.installed_version?.trim(),Xe=E.manifest.version?.trim();if(he!==Xe){const ye=he?.split(".").map(Number)||[0,0,0],W=Xe?.split(".").map(Number)||[0,0,0];for(let Se=0;Se<3;Se++){if((W[Se]||0)>(ye[Se]||0))return e.jsxs(Qe,{variant:"outline",className:"gap-1 text-orange-600 border-orange-600",children:[e.jsx(Gt,{className:"h-3 w-3"}),"可更新"]});if((W[Se]||0)<(ye[Se]||0))break}}return e.jsxs(Qe,{variant:"default",className:"gap-1",children:[e.jsx(ma,{className:"h-3 w-3"}),"已安装"]})}return null},Me=E=>!$||!E.manifest?.host_application?!0:__(E.manifest.host_application.min_version,E.manifest.host_application.max_version,$),Z=E=>{if(!E.installed||!E.installed_version||!E.manifest?.version)return!1;const he=E.installed_version.trim(),Xe=E.manifest.version.trim();if(he===Xe)return!1;const ye=he.split(".").map(Number),W=Xe.split(".").map(Number);for(let Se=0;Se<3;Se++){if((W[Se]||0)>(ye[Se]||0))return!0;if((W[Se]||0)<(ye[Se]||0))return!1}return!1},me=N.filter(E=>{if(!E.manifest)return console.warn("[过滤] 跳过无 manifest 的插件:",E.id),!1;const he=o===""||E.manifest.name?.toLowerCase().includes(o.toLowerCase())||E.manifest.description?.toLowerCase().includes(o.toLowerCase())||E.manifest.keywords&&E.manifest.keywords.some(Se=>Se.toLowerCase().includes(o.toLowerCase())),Xe=x==="all"||E.manifest.categories&&E.manifest.categories.includes(x);let ye=!0;f==="installed"?ye=E.installed===!0:f==="updates"&&(ye=E.installed===!0&&Z(E));const W=!j||!$||Me(E);return he&&Xe&&ye&&W}),ke=()=>{r(null)},X=E=>{if(!U?.installed){xe({title:"无法安装",description:"Git 未安装",variant:"destructive"});return}if($&&!Me(E)){xe({title:"无法安装",description:"插件与当前麦麦版本不兼容",variant:"destructive"});return}be(E),Ne("main"),Y(""),re("preset"),ie(!1),ve(!0)},ae=async()=>{if(!ge)return;const E=K==="custom"?R:je;if(!E||E.trim()===""){xe({title:"分支名称不能为空",variant:"destructive"});return}try{ve(!1),await C_(ge.id,ge.manifest.repository_url||"",E),U_(ge.id).catch(Xe=>{console.warn("Failed to record download:",Xe)}),xe({title:"安装成功",description:`${ge.manifest.name} 已成功安装`});const he=await hr();z(he),y(Xe=>Xe.map(ye=>{if(ye.id===ge.id){const W=Pc(ye.id,he),Se=Zc(ye.id,he);return{...ye,installed:W,installed_version:Se}}return ye}))}catch(he){xe({title:"安装失败",description:he instanceof Error?he.message:"未知错误",variant:"destructive"})}finally{be(null)}},De=async E=>{try{await k_(E.id),xe({title:"卸载成功",description:`${E.manifest.name} 已成功卸载`});const he=await hr();z(he),y(Xe=>Xe.map(ye=>{if(ye.id===E.id){const W=Pc(ye.id,he),Se=Zc(ye.id,he);return{...ye,installed:W,installed_version:Se}}return ye}))}catch(he){xe({title:"卸载失败",description:he instanceof Error?he.message:"未知错误",variant:"destructive"})}},_s=async E=>{if(!U?.installed){xe({title:"无法更新",description:"Git 未安装",variant:"destructive"});return}try{const he=await T_(E.id,E.manifest.repository_url||"","main");xe({title:"更新成功",description:`${E.manifest.name} 已从 ${he.old_version} 更新到 ${he.new_version}`});const Xe=await hr();z(Xe),y(ye=>ye.map(W=>{if(W.id===E.id){const Se=Pc(W.id,Xe),Ge=Zc(W.id,Xe);return{...W,installed:Se,installed_version:Ge}}return W}))}catch(he){xe({title:"更新失败",description:he instanceof Error?he.message:"未知错误",variant:"destructive"})}};return e.jsx(Ze,{className:"h-full",children:e.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件市场"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"浏览和管理麦麦的插件"})]}),e.jsxs(_,{onClick:()=>l({to:"/plugin-mirrors"}),children:[e.jsx(Qy,{className:"h-4 w-4 mr-2"}),"配置镜像源"]})]}),U&&!U.installed&&e.jsxs(Fe,{className:"border-orange-600 bg-orange-50 dark:bg-orange-950/20",children:[e.jsx(as,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(La,{className:"h-5 w-5 text-orange-600"}),e.jsxs("div",{children:[e.jsx(ls,{className:"text-lg text-orange-900 dark:text-orange-100",children:"Git 未安装"}),e.jsx(st,{className:"text-orange-800 dark:text-orange-200",children:U.error||"请先安装 Git 才能使用插件安装功能"})]})]})}),e.jsx(ps,{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(Fe,{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(Ft,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ne,{placeholder:"搜索插件...",value:o,onChange:E=>u(E.target.value),className:"pl-9"})]}),e.jsxs(Be,{value:x,onValueChange:h,children:[e.jsx(Le,{className:"w-full sm:w-[200px]",children:e.jsx(He,{placeholder:"选择分类"})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"all",children:"全部分类"}),e.jsx(se,{value:"Group Management",children:"群组管理"}),e.jsx(se,{value:"Entertainment & Interaction",children:"娱乐互动"}),e.jsx(se,{value:"Utility Tools",children:"实用工具"}),e.jsx(se,{value:"Content Generation",children:"内容生成"}),e.jsx(se,{value:"Multimedia",children:"多媒体"}),e.jsx(se,{value:"External Integration",children:"外部集成"}),e.jsx(se,{value:"Data Analysis & Insights",children:"数据分析与洞察"}),e.jsx(se,{value:"Other",children:"其他"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(gt,{id:"compatible-only",checked:j,onCheckedChange:E=>v(E===!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(ka,{value:f,onValueChange:g,className:"w-full",children:e.jsxs(xa,{className:"grid w-full grid-cols-3",children:[e.jsxs(ts,{value:"all",children:["全部插件 (",N.filter(E=>{if(!E.manifest)return!1;const he=o===""||E.manifest.name?.toLowerCase().includes(o.toLowerCase())||E.manifest.description?.toLowerCase().includes(o.toLowerCase())||E.manifest.keywords&&E.manifest.keywords.some(W=>W.toLowerCase().includes(o.toLowerCase())),Xe=x==="all"||E.manifest.categories&&E.manifest.categories.includes(x),ye=!j||!$||Me(E);return he&&Xe&&ye}).length,")"]}),e.jsxs(ts,{value:"installed",children:["已安装 (",N.filter(E=>{if(!E.manifest)return!1;const he=o===""||E.manifest.name?.toLowerCase().includes(o.toLowerCase())||E.manifest.description?.toLowerCase().includes(o.toLowerCase())||E.manifest.keywords&&E.manifest.keywords.some(W=>W.toLowerCase().includes(o.toLowerCase())),Xe=x==="all"||E.manifest.categories&&E.manifest.categories.includes(x),ye=!j||!$||Me(E);return E.installed&&he&&Xe&&ye}).length,")"]}),e.jsxs(ts,{value:"updates",children:["可更新 (",N.filter(E=>{if(!E.manifest)return!1;const he=o===""||E.manifest.name?.toLowerCase().includes(o.toLowerCase())||E.manifest.description?.toLowerCase().includes(o.toLowerCase())||E.manifest.keywords&&E.manifest.keywords.some(W=>W.toLowerCase().includes(o.toLowerCase())),Xe=x==="all"||E.manifest.categories&&E.manifest.categories.includes(x),ye=!j||!$||Me(E);return E.installed&&Z(E)&&he&&Xe&&ye}).length,")"]})]})}),A&&A.stage==="loading"&&e.jsx(Fe,{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(xt,{className:"h-4 w-4 animate-spin"}),e.jsxs("span",{className:"text-sm font-medium",children:[A.operation==="fetch"&&"加载插件列表",A.operation==="install"&&`安装插件${A.plugin_id?`: ${A.plugin_id}`:""}`,A.operation==="uninstall"&&`卸载插件${A.plugin_id?`: ${A.plugin_id}`:""}`,A.operation==="update"&&`更新插件${A.plugin_id?`: ${A.plugin_id}`:""}`]})]}),e.jsxs("span",{className:"text-sm font-medium",children:[A.progress,"%"]})]}),e.jsx(gi,{value:A.progress,className:"h-2"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:A.message}),A.operation==="fetch"&&A.total_plugins>0&&e.jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["已加载 ",A.loaded_plugins," / ",A.total_plugins," 个插件"]})]})}),A&&A.stage==="error"&&A.error&&e.jsx(Fe,{className:"border-destructive bg-destructive/10",children:e.jsx(as,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(La,{className:"h-5 w-5 text-destructive"}),e.jsxs("div",{children:[e.jsx(ls,{className:"text-lg text-destructive",children:"加载失败"}),e.jsx(st,{className:"text-destructive/80",children:A.error})]})]})})}),S?e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(xt,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件列表中..."})]}):L?e.jsx(Fe,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(La,{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:L}),e.jsx(_,{onClick:()=>window.location.reload(),children:"重新加载"})]})}):me.length===0?e.jsx(Fe,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Ft,{className:"h-12 w-12 text-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:o||x!=="all"?"尝试调整搜索条件或筛选器":"暂无可用插件"})]})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:me.map(E=>e.jsxs(Fe,{className:"flex flex-col hover:shadow-lg transition-shadow h-full",children:[e.jsxs(as,{children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx(ls,{className:"text-xl",children:E.manifest?.name||E.id}),e.jsxs("div",{className:"flex flex-col gap-1",children:[E.manifest?.categories&&E.manifest.categories[0]&&e.jsx(Qe,{variant:"secondary",className:"text-xs whitespace-nowrap",children:Hp[E.manifest.categories[0]]||E.manifest.categories[0]}),_e(E)]})]}),e.jsx(st,{className:"line-clamp-2",children:E.manifest?.description||"无描述"})]}),e.jsx(ps,{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(Ua,{className:"h-4 w-4"}),e.jsx("span",{children:(M[E.id]?.downloads??E.downloads??0).toLocaleString()})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(fl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),e.jsx("span",{children:(M[E.id]?.rating??E.rating??0).toFixed(1)})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[E.manifest?.keywords&&E.manifest.keywords.slice(0,3).map(he=>e.jsx(Qe,{variant:"outline",className:"text-xs",children:he},he)),E.manifest?.keywords&&E.manifest.keywords.length>3&&e.jsxs(Qe,{variant:"outline",className:"text-xs",children:["+",E.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",E.manifest?.version||"unknown"," · ",E.manifest?.author?.name||"Unknown"]}),E.manifest?.host_application&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{children:"支持:"}),e.jsxs("span",{className:"font-medium",children:[E.manifest.host_application.min_version,E.manifest.host_application.max_version?` - ${E.manifest.host_application.max_version}`:" - 最新版本"]})]})]})]})}),e.jsx(ej,{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:()=>r(E),children:"查看详情"}),E.installed?Z(E)?e.jsxs(_,{size:"sm",disabled:!U?.installed,title:U?.installed?void 0:"Git 未安装",onClick:()=>_s(E),children:[e.jsx(qt,{className:"h-4 w-4 mr-1"}),"更新"]}):e.jsxs(_,{variant:"destructive",size:"sm",disabled:!U?.installed,title:U?.installed?void 0:"Git 未安装",onClick:()=>De(E),children:[e.jsx(We,{className:"h-4 w-4 mr-1"}),"卸载"]}):e.jsxs(_,{size:"sm",disabled:!U?.installed||A?.operation==="install"||$!==null&&!Me(E),title:U?.installed?$!==null&&!Me(E)?`不兼容当前版本 (需要 ${E.manifest?.host_application?.min_version||"未知"}${E.manifest?.host_application?.max_version?` - ${E.manifest.host_application.max_version}`:"+"},当前 ${$?.version})`:void 0:"Git 未安装",onClick:()=>X(E),children:[e.jsx(Ua,{className:"h-4 w-4 mr-1"}),A?.operation==="install"&&A?.plugin_id===E.id?"安装中...":"安装"]})]})})]},E.id))}),e.jsx(Gs,{open:i!==null,onOpenChange:ke,children:i&&i.manifest&&e.jsx(Us,{className:"max-w-2xl max-h-[80vh] p-0 flex flex-col",children:e.jsx(Ze,{className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-6",children:[e.jsx(Bs,{children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"space-y-2 flex-1",children:[e.jsx(Hs,{className:"text-2xl",children:i.manifest.name}),e.jsxs(Ws,{children:["作者: ",i.manifest.author?.name||"Unknown",i.manifest.author?.url&&e.jsx("a",{href:i.manifest.author.url,target:"_blank",rel:"noopener noreferrer",className:"ml-2 text-primary hover:underline",children:e.jsx(Wc,{className:"h-3 w-3 inline"})})]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[i.manifest.categories&&i.manifest.categories[0]&&e.jsx(Qe,{variant:"secondary",children:Hp[i.manifest.categories[0]]||i.manifest.categories[0]}),_e(i)]})]})}),e.jsxs("div",{className:"space-y-6",children:[e.jsx(H_,{pluginId:i.id}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"版本"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["v",i.manifest?.version||"unknown"]}),i.installed&&i.installed_version&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["已安装: v",i.installed_version]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"下载量"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:(M[i.id]?.downloads??i.downloads??0).toLocaleString()})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"评分"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(fl,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[(M[i.id]?.rating??i.rating??0).toFixed(1)," (",M[i.id]?.rating_count??i.review_count??0,")"]})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"许可证"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:i.manifest.license||"Unknown"})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"支持版本"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[i.manifest.host_application?.min_version||"未知",i.manifest.host_application?.max_version?` - ${i.manifest.host_application.max_version}`:" - 最新版本"]})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium mb-2",children:"关键词"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:i.manifest.keywords&&i.manifest.keywords.map(E=>e.jsx(Qe,{variant:"outline",children:E},E))})]}),i.detailed_description&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium mb-2",children:"详细说明"}),e.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:i.detailed_description})]}),!i.detailed_description&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium mb-2",children:"说明"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:i.manifest.description||"无描述"})]}),e.jsxs("div",{className:"space-y-2",children:[i.manifest.homepage_url&&e.jsxs("div",{className:"text-sm",children:[e.jsx("span",{className:"font-medium",children:"主页: "}),e.jsx("a",{href:i.manifest.homepage_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:i.manifest.homepage_url})]}),i.manifest.repository_url&&e.jsxs("div",{className:"text-sm",children:[e.jsx("span",{className:"font-medium",children:"仓库: "}),e.jsx("a",{href:i.manifest.repository_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:i.manifest.repository_url})]})]})]}),e.jsxs(tt,{children:[i.manifest.homepage_url&&e.jsxs(_,{onClick:()=>window.open(i.manifest.homepage_url,"_blank"),children:[e.jsx(Wc,{className:"h-4 w-4 mr-2"}),"访问主页"]}),i.manifest.repository_url&&e.jsxs(_,{variant:"outline",onClick:()=>window.open(i.manifest.repository_url,"_blank"),children:[e.jsx(Wc,{className:"h-4 w-4 mr-2"}),"查看仓库"]})]})]})})})}),e.jsx(Gs,{open:fe,onOpenChange:ve,children:e.jsxs(Us,{children:[e.jsxs(Bs,{children:[e.jsx(Hs,{children:"安装插件"}),e.jsxs(Ws,{children:["安装 ",ge?.manifest.name]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["版本: ",ge?.manifest.version]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["作者: ",typeof ge?.manifest.author=="string"?ge.manifest.author:ge?.manifest.author?.name]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(gt,{id:"advanced-options",checked:T,onCheckedChange:E=>ie(E)}),e.jsx("label",{htmlFor:"advanced-options",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"高级选项"})]}),T&&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(ka,{value:K,onValueChange:E=>re(E),children:[e.jsxs(xa,{className:"grid w-full grid-cols-2",children:[e.jsx(ts,{value:"preset",className:"text-xs",children:"预设分支"}),e.jsx(ts,{value:"custom",className:"text-xs",children:"自定义分支"})]}),K==="preset"&&e.jsx("div",{className:"mt-3",children:e.jsxs(Be,{value:je,onValueChange:Ne,children:[e.jsx(Le,{children:e.jsx(He,{placeholder:"选择分支"})}),e.jsxs(Ue,{children:[e.jsx(se,{value:"main",children:"main (默认)"}),e.jsx(se,{value:"master",children:"master"}),e.jsx(se,{value:"dev",children:"dev (开发版)"}),e.jsx(se,{value:"develop",children:"develop"}),e.jsx(se,{value:"beta",children:"beta (测试版)"}),e.jsx(se,{value:"stable",children:"stable (稳定版)"})]})]})}),K==="custom"&&e.jsxs("div",{className:"space-y-2 mt-3",children:[e.jsx("input",{type:"text",className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",placeholder:"输入分支名称,例如: feature/new-feature",value:R,onChange:E=>Y(E.target.value)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"输入 Git 分支名称、标签或提交哈希"})]})]})]})}),!T&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"将从默认分支 (main) 安装插件"})]}),e.jsxs(tt,{children:[e.jsx(_,{variant:"outline",onClick:()=>ve(!1),children:"取消"}),e.jsxs(_,{onClick:ae,children:[e.jsx(Ua,{className:"h-4 w-4 mr-2"}),"安装"]})]})]})})]})})}function q_(){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(Bg,{className:"h-8 w-8",strokeWidth:2}),"模型分配预设市场"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"浏览和下载社区共享的模型分配预设配置"})]})})}),e.jsx(Ze,{className:"flex-1",children:e.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-12rem)]",children:e.jsxs(Fe,{className:"max-w-2xl w-full border-dashed",children:[e.jsxs(as,{className:"text-center",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx(Ql,{className:"h-16 w-16 text-muted-foreground"})}),e.jsx(ls,{className:"text-2xl",children:"功能开发中"}),e.jsx(st,{className:"text-base",children:"模型分配预设市场功能正在开发中,敬请期待!"})]}),e.jsx(ps,{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 G_({id:l,index:i,itemType:r,itemFields:o,value:u,onChange:x,onRemove:h,disabled:f,canRemove:g,placeholder:j}){const{attributes:v,listeners:N,setNodeRef:y,transform:S,transition:w,isDragging:L}=Zg({id:l,disabled:f}),O={transform:Wg.Transform.toString(S),transition:w};return e.jsxs("div",{ref:y,style:O,className:H("flex items-start gap-2 group",L&&"opacity-50 z-50"),children:[e.jsx("button",{type:"button",className:H("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"),...v,...N,children:e.jsx(Rg,{className:"h-4 w-4"})}),e.jsx("div",{className:"flex-1 min-w-0",children:r==="object"&&o?e.jsx(F_,{value:u,onChange:x,fields:o,disabled:f}):r==="number"?e.jsx(ne,{type:"number",value:u??"",onChange:U=>x(parseFloat(U.target.value)||0),placeholder:j??`第 ${i+1} 项`,disabled:f,className:"font-mono"}):e.jsx(ne,{type:"text",value:u??"",onChange:U=>x(U.target.value),placeholder:j??`第 ${i+1} 项`,disabled:f})}),e.jsx(_,{type:"button",variant:"ghost",size:"icon",onClick:h,disabled:f||!g,className:H("flex-shrink-0 text-muted-foreground hover:text-destructive","opacity-0 group-hover:opacity-100 focus:opacity-100 transition-opacity"),children:e.jsx(We,{className:"h-4 w-4"})})]})}function F_({value:l,onChange:i,fields:r,disabled:o}){const u=m.useCallback((x,h)=>{i({...l,[x]:h})},[l,i]);return e.jsx(Fe,{className:"p-3 space-y-2 bg-muted/30",children:Object.entries(r).map(([x,h])=>e.jsxs("div",{className:"space-y-1",children:[e.jsx(C,{className:"text-xs text-muted-foreground",children:h.label??x}),h.type==="number"?e.jsx(ne,{type:"number",value:l?.[x]??h.default??"",onChange:f=>u(x,parseFloat(f.target.value)||0),placeholder:h.placeholder,disabled:o,className:"h-8 text-sm"}):e.jsx(ne,{type:"text",value:l?.[x]??h.default??"",onChange:f=>u(x,f.target.value),placeholder:h.placeholder,disabled:o,className:"h-8 text-sm"})]},x))})}function V_({value:l,onChange:i,itemType:r="string",itemFields:o,minItems:u,maxItems:x,disabled:h,placeholder:f}){const g=m.useMemo(()=>Array.isArray(l)?l:typeof l=="string"&&l.trim()?l.split(",").map(A=>A.trim()):[],[l]),[j]=m.useState(()=>new Map),v=m.useCallback(A=>(j.has(A)||j.set(A,`item-${Date.now()}-${A}-${Math.random().toString(36).slice(2)}`),j.get(A)),[j]),N=m.useMemo(()=>{const A=[];for(let k=0;k{const{active:k,over:$}=A;if($&&k.id!==$.id){const G=N.indexOf(k.id),z=N.indexOf($.id),M=Kg(g,G,z);i(M)}},[g,N,i]),w=m.useCallback(()=>{if(x!=null&&g.length>=x)return;let A;r==="object"&&o?A=Object.fromEntries(Object.entries(o).map(([k,$])=>[k,$.default??""])):r==="number"?A=0:A="",i([...g,A])},[g,x,r,o,i]),L=m.useCallback((A,k)=>{const $=[...g];$[A]=k,i($)},[g,i]),O=m.useCallback(A=>{if(u!=null&&g.length<=u)return;const k=g.filter(($,G)=>G!==A);j.delete(A),i(k)},[g,u,j,i]),U=x==null||g.lengthu;return e.jsxs("div",{className:"space-y-2",children:[g.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(Gt,{className:"h-4 w-4"}),e.jsx("span",{children:"暂无数据,点击下方按钮添加"})]}):e.jsx(Ig,{sensors:y,collisionDetection:Qg,onDragEnd:S,children:e.jsx(Yg,{items:N,strategy:m0,children:e.jsx("div",{className:"space-y-2",children:g.map((A,k)=>e.jsx(G_,{id:N[k],index:k,itemType:r,itemFields:o,value:A,onChange:$=>L(k,$),onRemove:()=>O(k),disabled:h,canRemove:F,placeholder:f},N[k]))})})}),e.jsxs(_,{type:"button",variant:"outline",size:"sm",onClick:w,disabled:h||!U,className:"w-full",children:[e.jsx(ut,{className:"h-4 w-4 mr-1"}),"添加项目",x!==void 0&&e.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(",g.length,"/",x,")"]})]}),(u!=null||x!=null)&&(u!==null||x!==null)&&e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:u!=null&&x!=null?`允许 ${u} - ${x} 项`:u!=null?`至少 ${u} 项`:`最多 ${x} 项`})]})}function I_({field:l,value:i,onChange:r}){const[o,u]=m.useState(!1);switch(l.ui_type){case"switch":return e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(C,{children:l.label}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]}),e.jsx(Ve,{checked:!!i,onCheckedChange:r,disabled:l.disabled})]});case"number":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:l.label}),e.jsx(ne,{type:"number",value:i??l.default,onChange:x=>r(parseFloat(x.target.value)||0),min:l.min,max:l.max,step:l.step??1,placeholder:l.placeholder,disabled:l.disabled}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]});case"slider":return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{children:l.label}),e.jsx("span",{className:"text-sm text-muted-foreground",children:i??l.default})]}),e.jsx(Ca,{value:[i??l.default],onValueChange:x=>r(x[0]),min:l.min??0,max:l.max??100,step:l.step??1,disabled:l.disabled}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]});case"select":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:l.label}),e.jsxs(Be,{value:String(i??l.default),onValueChange:r,disabled:l.disabled,children:[e.jsx(Le,{children:e.jsx(He,{placeholder:l.placeholder??"请选择"})}),e.jsx(Ue,{children:l.choices?.map(x=>e.jsx(se,{value:String(x),children:String(x)},String(x)))})]}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]});case"textarea":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:l.label}),e.jsx(Is,{value:i??l.default,onChange:x=>r(x.target.value),placeholder:l.placeholder,rows:l.rows??3,disabled:l.disabled}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]});case"password":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:l.label}),e.jsxs("div",{className:"relative",children:[e.jsx(ne,{type:o?"text":"password",value:i??"",onChange:x=>r(x.target.value),placeholder:l.placeholder,disabled:l.disabled,className:"pr-10"}),e.jsx(_,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3",onClick:()=>u(!o),children:o?e.jsx(vr,{className:"h-4 w-4"}):e.jsx(Qt,{className:"h-4 w-4"})})]}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]});case"list":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:l.label}),e.jsx(V_,{value:Array.isArray(i)?i:[],onChange:x=>r(x),itemType:l.item_type??"string",itemFields:l.item_fields,minItems:l.min_items,maxItems:l.max_items,disabled:l.disabled,placeholder:l.placeholder}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]});case"text":default:return e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:l.label}),e.jsx(ne,{type:"text",value:i??l.default??"",onChange:x=>r(x.target.value),placeholder:l.placeholder,maxLength:l.max_length,disabled:l.disabled}),l.hint&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l.hint})]})}}function $p({section:l,config:i,onChange:r}){const[o,u]=m.useState(!l.collapsed),x=Object.entries(l.fields).filter(([,h])=>!h.hidden).sort(([,h],[,f])=>h.order-f.order);return e.jsx(_r,{open:o,onOpenChange:u,children:e.jsxs(Fe,{children:[e.jsx(Sr,{asChild:!0,children:e.jsxs(as,{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:[o?e.jsx(Qa,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(Xa,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(ls,{className:"text-lg",children:l.title})]}),e.jsxs(Qe,{variant:"secondary",className:"text-xs",children:[x.length," 项"]})]}),l.description&&e.jsx(st,{className:"ml-6",children:l.description})]})}),e.jsx(Cr,{children:e.jsx(ps,{className:"space-y-4 pt-0",children:x.map(([h,f])=>e.jsx(I_,{field:f,value:i[l.name]?.[h],onChange:g=>r(l.name,h,g),sectionName:l.name},h))})})]})})}function Q_({plugin:l,onBack:i}){const{toast:r}=Vs(),[o,u]=m.useState(null),[x,h]=m.useState({}),[f,g]=m.useState({}),[j,v]=m.useState(!0),[N,y]=m.useState(!1),[S,w]=m.useState(!1),[L,O]=m.useState(!1),U=m.useCallback(async()=>{v(!0);try{const[M,Q]=await Promise.all([E_(l.id),z_(l.id)]);u(M),h(Q),g(JSON.parse(JSON.stringify(Q)))}catch(M){r({title:"加载配置失败",description:M instanceof Error?M.message:"未知错误",variant:"destructive"})}finally{v(!1)}},[l.id,r]);m.useEffect(()=>{U()},[U]),m.useEffect(()=>{w(JSON.stringify(x)!==JSON.stringify(f))},[x,f]);const F=(M,Q,fe)=>{h(ve=>({...ve,[M]:{...ve[M]||{},[Q]:fe}}))},A=async()=>{y(!0);try{await M_(l.id,x),g(JSON.parse(JSON.stringify(x))),r({title:"配置已保存",description:"更改将在插件重新加载后生效"})}catch(M){r({title:"保存失败",description:M instanceof Error?M.message:"未知错误",variant:"destructive"})}finally{y(!1)}},k=async()=>{try{await A_(l.id),r({title:"配置已重置",description:"下次加载插件时将使用默认配置"}),O(!1),U()}catch(M){r({title:"重置失败",description:M instanceof Error?M.message:"未知错误",variant:"destructive"})}},$=async()=>{try{const M=await O_(l.id);r({title:M.message,description:M.note}),U()}catch(M){r({title:"切换状态失败",description:M instanceof Error?M.message:"未知错误",variant:"destructive"})}};if(j)return e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx(xt,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(!o)return e.jsxs("div",{className:"flex flex-col items-center justify-center h-64 space-y-4",children:[e.jsx(Gt,{className:"h-12 w-12 text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground",children:"无法加载配置"}),e.jsxs(_,{onClick:i,variant:"outline",children:[e.jsx(di,{className:"h-4 w-4 mr-2"}),"返回"]})]});const G=Object.values(o.sections).sort((M,Q)=>M.order-Q.order),z=x.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:i,children:e.jsx(di,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:o.plugin_info.name||l.manifest.name}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx(Qe,{variant:z?"default":"secondary",children:z?"已启用":"已禁用"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["v",o.plugin_info.version||l.manifest.version]})]})]})]}),e.jsxs("div",{className:"flex gap-2 ml-10 sm:ml-0",children:[e.jsxs(_,{variant:"outline",size:"sm",onClick:$,children:[e.jsx(kr,{className:"h-4 w-4 mr-2"}),z?"禁用":"启用"]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>O(!0),children:[e.jsx(ao,{className:"h-4 w-4 mr-2"}),"重置"]}),e.jsxs(_,{size:"sm",onClick:A,disabled:!S||N,children:[N?e.jsx(xt,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(Tr,{className:"h-4 w-4 mr-2"}),"保存"]})]})]}),S&&e.jsx(Fe,{className:"border-orange-200 bg-orange-50 dark:bg-orange-950/20 dark:border-orange-900",children:e.jsx(ps,{className:"py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ia,{className:"h-4 w-4 text-orange-600"}),e.jsx("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:"有未保存的更改"})]})})}),o.layout.type==="tabs"&&o.layout.tabs.length>0?e.jsxs(ka,{defaultValue:o.layout.tabs[0]?.id,children:[e.jsx(xa,{children:o.layout.tabs.map(M=>e.jsxs(ts,{value:M.id,children:[M.title,M.badge&&e.jsx(Qe,{variant:"secondary",className:"ml-2 text-xs",children:M.badge})]},M.id))}),o.layout.tabs.map(M=>e.jsx(Ms,{value:M.id,className:"space-y-4 mt-4",children:M.sections.map(Q=>{const fe=o.sections[Q];return fe?e.jsx($p,{section:fe,config:x,onChange:F},Q):null})},M.id))]}):e.jsx("div",{className:"space-y-4",children:G.map(M=>e.jsx($p,{section:M,config:x,onChange:F},M.name))}),e.jsx(Gs,{open:L,onOpenChange:O,children:e.jsxs(Us,{children:[e.jsxs(Bs,{children:[e.jsx(Hs,{children:"确认重置配置"}),e.jsx(Ws,{children:"这将删除当前配置文件,下次加载插件时将使用默认配置。此操作不可撤销。"})]}),e.jsxs(tt,{children:[e.jsx(_,{variant:"outline",onClick:()=>O(!1),children:"取消"}),e.jsx(_,{variant:"destructive",onClick:k,children:"确认重置"})]})]})})]})}function Y_(){const{toast:l}=Vs(),[i,r]=m.useState([]),[o,u]=m.useState(!0),[x,h]=m.useState(""),[f,g]=m.useState(null),j=async()=>{u(!0);try{const S=await hr();r(S)}catch(S){l({title:"加载插件列表失败",description:S instanceof Error?S.message:"未知错误",variant:"destructive"})}finally{u(!1)}};m.useEffect(()=>{j()},[]);const v=i.filter(S=>{const w=x.toLowerCase();return S.id.toLowerCase().includes(w)||S.manifest.name.toLowerCase().includes(w)||S.manifest.description?.toLowerCase().includes(w)}),N=i.length,y=0;return f?e.jsx(Ze,{className:"h-full",children:e.jsx("div",{className:"p-4 sm:p-6",children:e.jsx(Q_,{plugin:f,onBack:()=>g(null)})})}):e.jsx(Ze,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件配置"}),e.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理和配置已安装的插件"})]}),e.jsxs(_,{variant:"outline",size:"sm",onClick:j,children:[e.jsx(qt,{className:`h-4 w-4 mr-2 ${o?"animate-spin":""}`}),"刷新"]})]}),e.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-3",children:[e.jsxs(Fe,{children:[e.jsxs(as,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(ls,{className:"text-sm font-medium",children:"已安装插件"}),e.jsx(Ql,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(ps,{children:[e.jsx("div",{className:"text-2xl font-bold",children:i.length}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:o?"正在加载...":"个插件"})]})]}),e.jsxs(Fe,{children:[e.jsxs(as,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(ls,{className:"text-sm font-medium",children:"已启用"}),e.jsx(ma,{className:"h-4 w-4 text-green-600"})]}),e.jsxs(ps,{children:[e.jsx("div",{className:"text-2xl font-bold",children:N}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"运行中的插件"})]})]}),e.jsxs(Fe,{children:[e.jsxs(as,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(ls,{className:"text-sm font-medium",children:"已禁用"}),e.jsx(Gt,{className:"h-4 w-4 text-orange-600"})]}),e.jsxs(ps,{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(Ft,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ne,{placeholder:"搜索插件...",value:x,onChange:S=>h(S.target.value),className:"pl-9"})]}),e.jsxs(Fe,{children:[e.jsxs(as,{children:[e.jsx(ls,{children:"已安装的插件"}),e.jsx(st,{children:"点击插件查看和编辑配置"})]}),e.jsx(ps,{children:o?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(xt,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):v.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-4",children:[e.jsx(Ql,{className:"h-16 w-16 text-muted-foreground/50"}),e.jsxs("div",{className:"text-center space-y-2",children:[e.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:x?"没有找到匹配的插件":"暂无已安装的插件"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:x?"尝试其他搜索关键词":"前往插件市场安装插件"})]})]}):e.jsx("div",{className:"space-y-2",children:v.map(S=>e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg border hover:bg-muted/50 cursor-pointer transition-colors",onClick:()=>g(S),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(Ql,{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:S.manifest.name}),e.jsxs(Qe,{variant:"secondary",className:"text-xs flex-shrink-0",children:["v",S.manifest.version]})]}),e.jsx("p",{className:"text-sm text-muted-foreground truncate",children:S.manifest.description||"暂无描述"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(_,{variant:"ghost",size:"sm",children:e.jsx(hi,{className:"h-4 w-4"})}),e.jsx(Xa,{className:"h-4 w-4 text-muted-foreground"})]})]},S.id))})})]})]})})}function K_(){const l=Ea(),{toast:i}=Vs(),[r,o]=m.useState([]),[u,x]=m.useState(!0),[h,f]=m.useState(null),[g,j]=m.useState(null),[v,N]=m.useState(!1),[y,S]=m.useState(!1),[w,L]=m.useState({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),O=m.useCallback(async()=>{try{x(!0),f(null);const z=localStorage.getItem("access-token"),M=await fetch("/api/webui/plugins/mirrors",{headers:{Authorization:`Bearer ${z}`}});if(!M.ok)throw new Error("获取镜像源列表失败");const Q=await M.json();o(Q.mirrors||[])}catch(z){const M=z instanceof Error?z.message:"加载镜像源失败";f(M),i({title:"加载失败",description:M,variant:"destructive"})}finally{x(!1)}},[i]);m.useEffect(()=>{O()},[O]);const U=async()=>{try{const z=localStorage.getItem("access-token"),M=await fetch("/api/webui/plugins/mirrors",{method:"POST",headers:{Authorization:`Bearer ${z}`,"Content-Type":"application/json"},body:JSON.stringify(w)});if(!M.ok){const Q=await M.json();throw new Error(Q.detail||"添加镜像源失败")}i({title:"添加成功",description:"镜像源已添加"}),N(!1),L({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),O()}catch(z){i({title:"添加失败",description:z instanceof Error?z.message:"未知错误",variant:"destructive"})}},F=async()=>{if(g)try{const z=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${g.id}`,{method:"PUT",headers:{Authorization:`Bearer ${z}`,"Content-Type":"application/json"},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("更新镜像源失败");i({title:"更新成功",description:"镜像源已更新"}),S(!1),j(null),O()}catch(z){i({title:"更新失败",description:z instanceof Error?z.message:"未知错误",variant:"destructive"})}},A=async z=>{if(confirm("确定要删除这个镜像源吗?"))try{const M=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${z}`,{method:"DELETE",headers:{Authorization:`Bearer ${M}`}})).ok)throw new Error("删除镜像源失败");i({title:"删除成功",description:"镜像源已删除"}),O()}catch(M){i({title:"删除失败",description:M instanceof Error?M.message:"未知错误",variant:"destructive"})}},k=async z=>{try{const M=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${z.id}`,{method:"PUT",headers:{Authorization:`Bearer ${M}`,"Content-Type":"application/json"},body:JSON.stringify({enabled:!z.enabled})})).ok)throw new Error("更新状态失败");O()}catch(M){i({title:"更新失败",description:M instanceof Error?M.message:"未知错误",variant:"destructive"})}},$=z=>{j(z),L({id:z.id,name:z.name,raw_prefix:z.raw_prefix,clone_prefix:z.clone_prefix,enabled:z.enabled,priority:z.priority}),S(!0)},G=async(z,M)=>{const Q=M==="up"?z.priority-1:z.priority+1;if(!(Q<1))try{const fe=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${z.id}`,{method:"PUT",headers:{Authorization:`Bearer ${fe}`,"Content-Type":"application/json"},body:JSON.stringify({priority:Q})})).ok)throw new Error("更新优先级失败");O()}catch(fe){i({title:"更新失败",description:fe instanceof Error?fe.message:"未知错误",variant:"destructive"})}};return e.jsx(Ze,{className:"h-full",children:e.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>l({to:"/plugins"}),children:e.jsx(di,{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:()=>N(!0),children:[e.jsx(ut,{className:"h-4 w-4 mr-2"}),"添加镜像源"]})]}),u?e.jsx(Fe,{className:"p-6",children:e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(xt,{className:"h-8 w-8 animate-spin text-primary"})})}):h?e.jsx(Fe,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(La,{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:O,children:"重新加载"})]})}):e.jsxs(Fe,{children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs(jn,{children:[e.jsx(vn,{children:e.jsxs(pt,{children:[e.jsx(Pe,{children:"状态"}),e.jsx(Pe,{children:"名称"}),e.jsx(Pe,{children:"ID"}),e.jsx(Pe,{children:"优先级"}),e.jsx(Pe,{className:"text-right",children:"操作"})]})}),e.jsx(bn,{children:r.map(z=>e.jsxs(pt,{children:[e.jsx(Ie,{children:e.jsx(Ve,{checked:z.enabled,onCheckedChange:()=>k(z)})}),e.jsx(Ie,{children:e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:z.name}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Raw: ",z.raw_prefix]})]})}),e.jsx(Ie,{children:e.jsx(Qe,{variant:"outline",children:z.id})}),e.jsx(Ie,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-mono",children:z.priority}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(_,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>G(z,"up"),disabled:z.priority===1,children:e.jsx(ui,{className:"h-3 w-3"})}),e.jsx(_,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>G(z,"down"),children:e.jsx(Qa,{className:"h-3 w-3"})})]})]})}),e.jsx(Ie,{className:"text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>$(z),children:e.jsx(pn,{className:"h-4 w-4"})}),e.jsx(_,{variant:"ghost",size:"icon",onClick:()=>A(z.id),children:e.jsx(We,{className:"h-4 w-4 text-destructive"})})]})})]},z.id))})]})}),e.jsx("div",{className:"md:hidden p-4 space-y-4",children:r.map(z=>e.jsx(Fe,{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:z.name}),z.enabled&&e.jsx(Qe,{variant:"default",className:"text-xs",children:"启用"})]}),e.jsx(Qe,{variant:"outline",className:"mt-1 text-xs",children:z.id})]}),e.jsx(Ve,{checked:z.enabled,onCheckedChange:()=>k(z)})]}),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:z.raw_prefix})]}),e.jsxs("div",{className:"text-muted-foreground",children:[e.jsx("span",{className:"font-medium",children:"优先级: "}),e.jsx("span",{className:"font-mono",children:z.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:()=>$(z),children:[e.jsx(pn,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>G(z,"up"),disabled:z.priority===1,children:e.jsx(ui,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",size:"sm",onClick:()=>G(z,"down"),children:e.jsx(Qa,{className:"h-4 w-4"})}),e.jsx(_,{variant:"destructive",size:"sm",onClick:()=>A(z.id),children:e.jsx(We,{className:"h-4 w-4"})})]})]})},z.id))})]}),e.jsx(Gs,{open:v,onOpenChange:N,children:e.jsxs(Us,{className:"max-w-lg",children:[e.jsxs(Bs,{children:[e.jsx(Hs,{children:"添加镜像源"}),e.jsx(Ws,{children:"添加新的 Git 镜像源配置"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"add-id",children:"镜像源 ID *"}),e.jsx(ne,{id:"add-id",placeholder:"例如: my-mirror",value:w.id,onChange:z=>L({...w,id:z.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"add-name",children:"名称 *"}),e.jsx(ne,{id:"add-name",placeholder:"例如: 我的镜像源",value:w.name,onChange:z=>L({...w,name:z.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"add-raw",children:"Raw 文件前缀 *"}),e.jsx(ne,{id:"add-raw",placeholder:"https://example.com/raw",value:w.raw_prefix,onChange:z=>L({...w,raw_prefix:z.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"add-clone",children:"克隆前缀 *"}),e.jsx(ne,{id:"add-clone",placeholder:"https://example.com/clone",value:w.clone_prefix,onChange:z=>L({...w,clone_prefix:z.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"add-priority",children:"优先级"}),e.jsx(ne,{id:"add-priority",type:"number",min:"1",value:w.priority,onChange:z=>L({...w,priority:parseInt(z.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(Ve,{id:"add-enabled",checked:w.enabled,onCheckedChange:z=>L({...w,enabled:z})}),e.jsx(C,{htmlFor:"add-enabled",children:"启用此镜像源"})]})]}),e.jsxs(tt,{children:[e.jsx(_,{variant:"outline",onClick:()=>N(!1),children:"取消"}),e.jsx(_,{onClick:U,children:"添加"})]})]})}),e.jsx(Gs,{open:y,onOpenChange:S,children:e.jsxs(Us,{className:"max-w-lg",children:[e.jsxs(Bs,{children:[e.jsx(Hs,{children:"编辑镜像源"}),e.jsx(Ws,{children:"修改镜像源配置"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:"镜像源 ID"}),e.jsx(ne,{value:w.id,disabled:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"edit-name",children:"名称 *"}),e.jsx(ne,{id:"edit-name",value:w.name,onChange:z=>L({...w,name:z.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"edit-raw",children:"Raw 文件前缀 *"}),e.jsx(ne,{id:"edit-raw",value:w.raw_prefix,onChange:z=>L({...w,raw_prefix:z.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"edit-clone",children:"克隆前缀 *"}),e.jsx(ne,{id:"edit-clone",value:w.clone_prefix,onChange:z=>L({...w,clone_prefix:z.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"edit-priority",children:"优先级"}),e.jsx(ne,{id:"edit-priority",type:"number",min:"1",value:w.priority,onChange:z=>L({...w,priority:parseInt(z.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(Ve,{id:"edit-enabled",checked:w.enabled,onCheckedChange:z=>L({...w,enabled:z})}),e.jsx(C,{htmlFor:"edit-enabled",children:"启用此镜像源"})]})]}),e.jsxs(tt,{children:[e.jsx(_,{variant:"outline",onClick:()=>S(!1),children:"取消"}),e.jsx(_,{onClick:F,children:"保存"})]})]})})]})})}const fr=m.forwardRef(({className:l,...i},r)=>e.jsx(ng,{ref:r,className:H("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",l),...i}));fr.displayName=ng.displayName;const X_=m.forwardRef(({className:l,...i},r)=>e.jsx(ig,{ref:r,className:H("aspect-square h-full w-full",l),...i}));X_.displayName=ig.displayName;const pr=m.forwardRef(({className:l,...i},r)=>e.jsx(rg,{ref:r,className:H("flex h-full w-full items-center justify-center rounded-full bg-muted",l),...i}));pr.displayName=rg.displayName;function J_(){return"webui_"+Math.random().toString(36).substr(2,9)+"_"+Date.now().toString(36)}function P_(){const l="maibot_webui_user_id";let i=localStorage.getItem(l);return i||(i=J_(),localStorage.setItem(l,i)),i}function Z_(){return localStorage.getItem("maibot_webui_user_name")||"WebUI用户"}function W_(l){localStorage.setItem("maibot_webui_user_name",l)}const Ej="maibot_webui_virtual_tabs";function eS(){try{const l=localStorage.getItem(Ej);if(l)return JSON.parse(l)}catch(l){console.error("[Chat] 加载虚拟标签页失败:",l)}return[]}function qp(l){try{localStorage.setItem(Ej,JSON.stringify(l))}catch(i){console.error("[Chat] 保存虚拟标签页失败:",i)}}function sS({segment:l}){switch(l.type){case"text":return e.jsx("span",{className:"whitespace-pre-wrap",children:String(l.data)});case"image":case"emoji":return e.jsx("img",{src:String(l.data),alt:l.type==="emoji"?"表情包":"图片",className:H("rounded-lg max-w-full",l.type==="emoji"?"max-h-32":"max-h-64"),loading:"lazy",onError:i=>{const r=i.target;r.style.display="none",r.parentElement?.insertAdjacentHTML("beforeend",`[${l.type==="emoji"?"表情包":"图片"}加载失败]`)}});case"voice":return e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("audio",{controls:!0,src:String(l.data),className:"max-w-[200px] h-8",children:"您的浏览器不支持音频播放"})});case"video":return e.jsx("video",{controls:!0,src:String(l.data),className:"rounded-lg max-w-full max-h-64",children:"您的浏览器不支持视频播放"});case"face":return e.jsxs("span",{className:"text-muted-foreground",children:["[表情:",String(l.data),"]"]});case"music":return e.jsx("span",{className:"text-muted-foreground",children:"[音乐分享]"});case"file":return e.jsxs("span",{className:"text-muted-foreground",children:["[文件: ",String(l.data),"]"]});case"reply":return e.jsx("span",{className:"text-muted-foreground text-xs",children:"[回复消息]"});case"forward":return e.jsx("span",{className:"text-muted-foreground",children:"[转发消息]"});case"unknown":default:return e.jsxs("span",{className:"text-muted-foreground",children:["[",l.original_type||"未知消息","]"]})}}function tS({message:l,isBot:i}){return l.message_type==="rich"&&l.segments&&l.segments.length>0?e.jsx("div",{className:"flex flex-col gap-2",children:l.segments.map((r,o)=>e.jsx(sS,{segment:r},o))}):e.jsx("span",{className:"whitespace-pre-wrap",children:l.content})}function aS(){const l={id:"webui-default",type:"webui",label:"WebUI",messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}},i=()=>{const $e=eS().map(Oe=>{const Ke=Oe.virtualConfig;return!Ke.groupId&&Ke.platform&&Ke.userId&&(Ke.groupId=`webui_virtual_group_${Ke.platform}_${Ke.userId}`),{id:Oe.id,type:"virtual",label:Oe.label,virtualConfig:Ke,messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}}});return[l,...$e]},[r,o]=m.useState(i),[u,x]=m.useState("webui-default"),h=r.find(I=>I.id===u)||r[0],[f,g]=m.useState(""),[j,v]=m.useState(!1),[N,y]=m.useState(!0),[S,w]=m.useState(Z_()),[L,O]=m.useState(!1),[U,F]=m.useState(""),[A,k]=m.useState(!1),[$,G]=m.useState([]),[z,M]=m.useState([]),[Q,fe]=m.useState(!1),[ve,ge]=m.useState(!1),[be,je]=m.useState(""),[Ne,R]=m.useState({platform:"",personId:"",userId:"",userName:"",groupName:"",groupId:""}),Y=m.useRef(P_()),K=m.useRef(new Map),re=m.useRef(null),T=m.useRef(new Map),ie=m.useRef(0),xe=m.useRef(new Map),{toast:Ce}=Vs(),_e=I=>(ie.current+=1,`${I}-${Date.now()}-${ie.current}-${Math.random().toString(36).substr(2,9)}`),Me=m.useCallback((I,$e)=>{o(Oe=>Oe.map(Ke=>Ke.id===I?{...Ke,...$e}:Ke))},[]),Z=m.useCallback((I,$e)=>{o(Oe=>Oe.map(Ke=>Ke.id===I?{...Ke,messages:[...Ke.messages,$e]}:Ke))},[]),me=m.useCallback(()=>{re.current?.scrollIntoView({behavior:"smooth"})},[]);m.useEffect(()=>{me()},[h?.messages,me]);const ke=m.useCallback(async()=>{fe(!0);try{const I=await Te("/api/chat/platforms");if(console.log("[Chat] 平台列表响应:",I.status,I.headers.get("content-type")),I.ok){const $e=I.headers.get("content-type");if($e&&$e.includes("application/json")){const Oe=await I.json();console.log("[Chat] 平台列表数据:",Oe),G(Oe.platforms||[])}else{const Oe=await I.text();console.error("[Chat] 获取平台列表失败: 非 JSON 响应:",Oe.substring(0,200)),Ce({title:"连接失败",description:"无法连接到后端服务,请确保 MaiBot 已启动",variant:"destructive"})}}else console.error("[Chat] 获取平台列表失败: HTTP",I.status),Ce({title:"获取平台失败",description:`服务器返回错误: ${I.status}`,variant:"destructive"})}catch(I){console.error("[Chat] 获取平台列表失败:",I),Ce({title:"网络错误",description:"无法连接到后端服务",variant:"destructive"})}finally{fe(!1)}},[Ce]),X=m.useCallback(async(I,$e)=>{ge(!0);try{const Oe=new URLSearchParams;I&&Oe.append("platform",I),$e&&Oe.append("search",$e),Oe.append("limit","50");const Ke=await Te(`/api/chat/persons?${Oe.toString()}`);if(Ke.ok){const $s=Ke.headers.get("content-type");if($s&&$s.includes("application/json")){const Je=await Ke.json();M(Je.persons||[])}else console.error("[Chat] 获取用户列表失败: 后端返回非 JSON 响应")}}catch(Oe){console.error("[Chat] 获取用户列表失败:",Oe)}finally{ge(!1)}},[]);m.useEffect(()=>{Ne.platform&&X(Ne.platform,be)},[Ne.platform,be,X]);const ae=m.useCallback(async(I,$e)=>{y(!0);try{const Oe=new URLSearchParams;Oe.append("user_id",Y.current),Oe.append("limit","50"),$e&&Oe.append("group_id",$e);const Ke=`/api/chat/history?${Oe.toString()}`;console.log("[Chat] 正在加载历史消息:",Ke);const $s=await Te(Ke);if($s.ok){const Je=await $s.text();try{const Ps=JSON.parse(Je);if(Ps.messages&&Ps.messages.length>0){const we=Ps.messages.map(Ee=>({id:Ee.id,type:Ee.type,content:Ee.content,timestamp:Ee.timestamp,sender:{name:Ee.sender_name||(Ee.is_bot?"麦麦":"WebUI用户"),user_id:Ee.user_id,is_bot:Ee.is_bot}}));Me(I,{messages:we});const Ss=xe.current.get(I)||new Set;we.forEach(Ee=>{if(Ee.type==="bot"){const xs=`bot-${Ee.content}-${Math.floor(Ee.timestamp*1e3)}`;Ss.add(xs)}}),xe.current.set(I,Ss)}}catch(Ps){console.error("[Chat] JSON 解析失败:",Ps)}}}catch(Oe){console.error("[Chat] 加载历史消息失败:",Oe)}finally{y(!1)}},[Me]),De=m.useCallback((I,$e,Oe)=>{const Ke=K.current.get(I);if(Ke?.readyState===WebSocket.OPEN||Ke?.readyState===WebSocket.CONNECTING){console.log(`[Tab ${I}] WebSocket 已存在,跳过连接`);return}v(!0);const $s=window.location.protocol==="https:"?"wss:":"ws:",Je=new URLSearchParams;$e==="virtual"&&Oe?(Je.append("user_id",Oe.userId),Je.append("user_name",Oe.userName),Je.append("platform",Oe.platform),Je.append("person_id",Oe.personId),Je.append("group_name",Oe.groupName||"WebUI虚拟群聊"),Oe.groupId&&Je.append("group_id",Oe.groupId)):(Je.append("user_id",Y.current),Je.append("user_name",S));const Ps=`${$s}//${window.location.host}/api/chat/ws?${Je.toString()}`;console.log(`[Tab ${I}] 正在连接 WebSocket:`,Ps);try{const we=new WebSocket(Ps);K.current.set(I,we),we.onopen=()=>{Me(I,{isConnected:!0}),v(!1),console.log(`[Tab ${I}] WebSocket 已连接`)},we.onmessage=Ss=>{try{const Ee=JSON.parse(Ss.data);switch(Ee.type){case"session_info":Me(I,{sessionInfo:{session_id:Ee.session_id,user_id:Ee.user_id,user_name:Ee.user_name,bot_name:Ee.bot_name}});break;case"system":Z(I,{id:_e("sys"),type:"system",content:Ee.content||"",timestamp:Ee.timestamp||Date.now()/1e3});break;case"user_message":{const xs=Ee.sender?.user_id,bs=$e==="virtual"&&Oe?Oe.userId:Y.current;console.log(`[Tab ${I}] 收到 user_message, sender: ${xs}, current: ${bs}`);const Mt=xs?xs.replace(/^webui_user_/,""):"",Ys=bs?bs.replace(/^webui_user_/,""):"";if(Mt&&Ys&&Mt===Ys){console.log(`[Tab ${I}] 跳过自己的消息(user_id 匹配)`);break}const vt=xe.current.get(I)||new Set,Ks=`user-${Ee.content}-${Math.floor((Ee.timestamp||0)*1e3)}`;if(vt.has(Ks)){console.log(`[Tab ${I}] 跳过自己的消息(内容去重)`);break}if(vt.add(Ks),xe.current.set(I,vt),vt.size>100){const nt=vt.values().next().value;nt&&vt.delete(nt)}Z(I,{id:Ee.message_id||_e("user"),type:"user",content:Ee.content||"",timestamp:Ee.timestamp||Date.now()/1e3,sender:Ee.sender});break}case"bot_message":{Me(I,{isTyping:!1});const xs=xe.current.get(I)||new Set,bs=`bot-${Ee.content}-${Math.floor((Ee.timestamp||0)*1e3)}`;if(xs.has(bs))break;if(xs.add(bs),xe.current.set(I,xs),xs.size>100){const Mt=xs.values().next().value;Mt&&xs.delete(Mt)}o(Mt=>Mt.map(Ys=>{if(Ys.id!==I)return Ys;const vt=Ys.messages.filter(nt=>nt.type!=="thinking"),Ks={id:_e("bot"),type:"bot",content:Ee.content||"",message_type:Ee.message_type==="rich"?"rich":"text",segments:Ee.segments,timestamp:Ee.timestamp||Date.now()/1e3,sender:Ee.sender};return{...Ys,messages:[...vt,Ks]}}));break}case"typing":Me(I,{isTyping:Ee.is_typing||!1});break;case"error":o(xs=>xs.map(bs=>{if(bs.id!==I)return bs;const Mt=bs.messages.filter(Ys=>Ys.type!=="thinking");return{...bs,messages:[...Mt,{id:_e("error"),type:"error",content:Ee.content||"发生错误",timestamp:Ee.timestamp||Date.now()/1e3}]}})),Ce({title:"错误",description:Ee.content,variant:"destructive"});break;case"pong":break;case"history":{const xs=Ee.messages||[];if(xs.length>0){const bs=xe.current.get(I)||new Set,Mt=xs.map(Ys=>{const vt=Ys.is_bot||!1,Ks=Ys.id||_e(vt?"bot":"user"),nt=`${vt?"bot":"user"}-${Ys.content}-${Math.floor(Ys.timestamp*1e3)}`;return bs.add(nt),{id:Ks,type:vt?"bot":"user",content:Ys.content,timestamp:Ys.timestamp,sender:{name:Ys.sender_name||(vt?"麦麦":"用户"),user_id:Ys.sender_id,is_bot:vt}}});xe.current.set(I,bs),Me(I,{messages:Mt}),console.log(`[Tab ${I}] 已加载 ${Mt.length} 条历史消息`)}break}default:console.log("未知消息类型:",Ee.type)}}catch(Ee){console.error("解析消息失败:",Ee)}},we.onclose=()=>{Me(I,{isConnected:!1}),v(!1),K.current.delete(I),console.log(`[Tab ${I}] WebSocket 已断开`);const Ss=T.current.get(I);Ss&&clearTimeout(Ss);const Ee=window.setTimeout(()=>{if(!_s.current){const xs=r.find(bs=>bs.id===I);xs&&De(I,xs.type,xs.virtualConfig)}},5e3);T.current.set(I,Ee)},we.onerror=Ss=>{console.error(`[Tab ${I}] WebSocket 错误:`,Ss),v(!1)}}catch(we){console.error(`[Tab ${I}] 创建 WebSocket 失败:`,we),v(!1)}},[S,Me,Z,Ce,r]),_s=m.useRef(!1);m.useEffect(()=>{_s.current=!1;const I=K.current,$e=T.current,Oe=xe.current;ae("webui-default");const Ke=setTimeout(()=>{_s.current||(De("webui-default","webui"),r.forEach(Je=>{Je.type==="virtual"&&Je.virtualConfig&&(Oe.set(Je.id,new Set),setTimeout(()=>{_s.current||De(Je.id,"virtual",Je.virtualConfig)},200))}))},100),$s=setInterval(()=>{I.forEach(Je=>{Je.readyState===WebSocket.OPEN&&Je.send(JSON.stringify({type:"ping"}))})},3e4);return()=>{_s.current=!0,clearTimeout(Ke),clearInterval($s),$e.forEach(Je=>{clearTimeout(Je)}),$e.clear(),I.forEach(Je=>{Je.close()}),I.clear()}},[]);const E=m.useCallback(()=>{const I=K.current.get(u);if(!f.trim()||!I||I.readyState!==WebSocket.OPEN)return;const $e=h?.type==="virtual"&&h.virtualConfig?.userName||S,Oe=f.trim(),Ke=Date.now()/1e3;I.send(JSON.stringify({type:"message",content:Oe,user_name:$e}));const $s=xe.current.get(u)||new Set,Je=`user-${Oe}-${Math.floor(Ke*1e3)}`;if($s.add(Je),xe.current.set(u,$s),$s.size>100){const Ss=$s.values().next().value;Ss&&$s.delete(Ss)}const Ps={id:_e("user"),type:"user",content:Oe,timestamp:Ke,sender:{name:$e,is_bot:!1}};Z(u,Ps);const we={id:_e("thinking"),type:"thinking",content:"",timestamp:Ke+.001,sender:{name:h?.sessionInfo.bot_name||"麦麦",is_bot:!0}};Z(u,we),g("")},[f,S,u,h,Z]),he=I=>{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),E())},Xe=()=>{F(S),O(!0)},ye=()=>{const I=U.trim()||"WebUI用户";w(I),W_(I),O(!1);const $e=K.current.get(u);$e?.readyState===WebSocket.OPEN&&$e.send(JSON.stringify({type:"update_nickname",user_name:I}))},W=()=>{F(""),O(!1)},Se=I=>new Date(I*1e3).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}),Ge=()=>{const I=K.current.get(u);I&&(I.close(),K.current.delete(u)),De(u,h?.type||"webui",h?.virtualConfig)},jt=()=>{R({platform:"",personId:"",userId:"",userName:"",groupName:"",groupId:""}),je(""),ke(),k(!0)},Qs=()=>{if(!Ne.platform||!Ne.personId){Ce({title:"配置不完整",description:"请选择平台和用户",variant:"destructive"});return}const I=`webui_virtual_group_${Ne.platform}_${Ne.userId}`,$e=`virtual-${Ne.platform}-${Ne.userId}-${Date.now()}`,Oe=Ne.userName||Ne.userId,Ke={id:$e,type:"virtual",label:Oe,virtualConfig:{...Ne,groupId:I},messages:[],isConnected:!1,isTyping:!1,sessionInfo:{}};o($s=>{const Je=[...$s,Ke],Ps=Je.filter(we=>we.type==="virtual"&&we.virtualConfig).map(we=>({id:we.id,label:we.label,virtualConfig:we.virtualConfig,createdAt:Date.now()}));return qp(Ps),Je}),x($e),k(!1),xe.current.set($e,new Set),setTimeout(()=>{De($e,"virtual",Ne)},100),Ce({title:"虚拟身份标签页",description:`已创建 ${Oe} 的对话`})},zt=(I,$e)=>{if($e?.stopPropagation(),I==="webui-default")return;const Oe=K.current.get(I);Oe&&(Oe.close(),K.current.delete(I));const Ke=T.current.get(I);Ke&&(clearTimeout(Ke),T.current.delete(I)),xe.current.delete(I),o($s=>{const Je=$s.filter(we=>we.id!==I),Ps=Je.filter(we=>we.type==="virtual"&&we.virtualConfig).map(we=>({id:we.id,label:we.label,virtualConfig:we.virtualConfig,createdAt:Date.now()}));return qp(Ps),Je}),u===I&&x("webui-default")},Es=I=>{x(I)},lt=I=>{R($e=>({...$e,personId:I.person_id,userId:I.user_id,userName:I.nickname||I.person_name}))};return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(Gs,{open:A,onOpenChange:k,children:e.jsxs(Us,{className:"sm:max-w-[500px] max-h-[85vh] overflow-hidden flex flex-col",children:[e.jsxs(Bs,{children:[e.jsxs(Hs,{className:"flex items-center gap-2",children:[e.jsx(Ru,{className:"h-5 w-5"}),"新建虚拟身份对话"]}),e.jsx(Ws,{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(C,{className:"flex items-center gap-2",children:[e.jsx(Pu,{className:"h-4 w-4"}),"选择平台"]}),e.jsxs(Be,{value:Ne.platform,onValueChange:I=>{R($e=>({...$e,platform:I,personId:"",userId:"",userName:""})),M([])},children:[e.jsx(Le,{disabled:Q,children:e.jsx(He,{placeholder:Q?"加载中...":"选择平台"})}),e.jsx(Ue,{children:$.map(I=>e.jsxs(se,{value:I.platform,children:[I.platform," (",I.count," 人)"]},I.platform))})]})]}),Ne.platform&&e.jsxs("div",{className:"space-y-2 flex-1 overflow-hidden flex flex-col",children:[e.jsxs(C,{className:"flex items-center gap-2",children:[e.jsx(Zu,{className:"h-4 w-4"}),"选择用户"]}),e.jsxs("div",{className:"relative",children:[e.jsx(Ft,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ne,{placeholder:"搜索用户名...",value:be,onChange:I=>je(I.target.value),className:"pl-9"})]}),e.jsx(Ze,{className:"h-[250px] border rounded-md",children:e.jsx("div",{className:"p-2",children:ve?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(xt,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):z.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground",children:[e.jsx(Zu,{className:"h-8 w-8 mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"没有找到用户"})]}):e.jsx("div",{className:"space-y-1",children:z.map(I=>e.jsxs("button",{onClick:()=>lt(I),className:H("w-full flex items-center gap-3 p-2 rounded-md text-left transition-colors",Ne.personId===I.person_id?"bg-primary text-primary-foreground":"hover:bg-muted"),children:[e.jsx(fr,{className:"h-8 w-8 shrink-0",children:e.jsx(pr,{className:H("text-xs",Ne.personId===I.person_id?"bg-primary-foreground/20":"bg-muted"),children:(I.nickname||I.person_name||"?").charAt(0)})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-medium truncate",children:I.nickname||I.person_name}),e.jsxs("div",{className:H("text-xs truncate",Ne.personId===I.person_id?"text-primary-foreground/70":"text-muted-foreground"),children:["ID: ",I.user_id,I.is_known&&" · 已认识"]})]})]},I.person_id))})})})]}),Ne.personId&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:"虚拟群名(可选)"}),e.jsx(ne,{placeholder:"WebUI虚拟群聊",value:Ne.groupName,onChange:I=>R($e=>({...$e,groupName:I.target.value}))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦会认为这是一个名为此名称的群聊"})]})]}),e.jsxs(tt,{className:"gap-2 sm:gap-0",children:[e.jsx(_,{variant:"outline",onClick:()=>k(!1),children:"取消"}),e.jsx(_,{onClick:Qs,disabled:!Ne.platform||!Ne.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(I=>e.jsxs("div",{className:H("flex items-center gap-1.5 px-3 py-1.5 rounded-md text-sm whitespace-nowrap transition-colors cursor-pointer","hover:bg-muted",u===I.id?"bg-background shadow-sm border":"text-muted-foreground"),onClick:()=>Es(I.id),children:[I.type==="webui"?e.jsx(Yl,{className:"h-3.5 w-3.5"}):e.jsx(Ru,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"max-w-[100px] truncate",children:I.label}),e.jsx("span",{className:H("w-1.5 h-1.5 rounded-full",I.isConnected?"bg-green-500":"bg-muted-foreground/50")}),I.id!=="webui-default"&&e.jsx("span",{onClick:$e=>zt(I.id,$e),className:"ml-0.5 p-0.5 rounded hover:bg-muted-foreground/20 cursor-pointer",role:"button",tabIndex:0,onKeyDown:$e=>{($e.key==="Enter"||$e.key===" ")&&($e.preventDefault(),zt(I.id,$e))},children:e.jsx(gl,{className:"h-3 w-3"})})]},I.id)),e.jsx("button",{onClick:jt,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(ut,{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(fr,{className:"h-8 w-8 sm:h-10 sm:w-10 shrink-0",children:e.jsx(pr,{className:"bg-primary/10 text-primary",children:e.jsx(mr,{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(Yy,{className:"h-3 w-3 text-green-500"}),e.jsx("span",{className:"text-green-600 dark:text-green-400",children:"已连接"})]}):j?e.jsxs(e.Fragment,{children:[e.jsx(xt,{className:"h-3 w-3 animate-spin"}),e.jsx("span",{children:"连接中..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ky,{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:[N&&e.jsx(xt,{className:"h-4 w-4 animate-spin text-muted-foreground"}),e.jsx(_,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:Ge,disabled:j,title:"重新连接",children:e.jsx(qt,{className:H("h-4 w-4",j&&"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(Ru,{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(io,{className:"h-3 w-3"}),e.jsx("span",{children:"当前身份:"}),L?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{value:U,onChange:I=>F(I.target.value),onKeyDown:I=>{I.key==="Enter"&&ye(),I.key==="Escape"&&W()},className:"h-7 w-32",placeholder:"输入昵称",autoFocus:!0}),e.jsx(_,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:ye,children:"保存"}),e.jsx(_,{size:"sm",variant:"ghost",className:"h-7 px-2",onClick:W,children:"取消"})]}):e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"font-medium text-foreground",children:S}),e.jsx(_,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:Xe,title:"修改昵称",children:e.jsx(Xy,{className:"h-3 w-3"})})]})]})})]})}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(Ze,{className:"h-full",children:e.jsxs("div",{className:"p-3 sm:p-4 max-w-4xl mx-auto space-y-3 sm:space-y-4",children:[h?.messages.length===0&&!N&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[e.jsx(mr,{className:"h-12 w-12 mb-4 opacity-50"}),e.jsxs("p",{className:"text-sm",children:["开始与 ",h?.sessionInfo.bot_name||"麦麦"," 对话吧!"]})]}),h?.messages.map(I=>e.jsxs("div",{className:H("flex gap-2 sm:gap-3",I.type==="user"&&"flex-row-reverse",I.type==="system"&&"justify-center",I.type==="error"&&"justify-center"),children:[I.type==="system"&&e.jsx("div",{className:"text-xs text-muted-foreground bg-muted/50 px-3 py-1 rounded-full max-w-[90%]",children:I.content}),I.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:I.content}),I.type==="thinking"&&e.jsxs(e.Fragment,{children:[e.jsx(fr,{className:"h-7 w-7 sm:h-8 sm:w-8 shrink-0",children:e.jsx(pr,{className:"bg-primary/10 text-primary",children:e.jsx(mr,{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:I.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:"思考中..."})]})})]})]}),(I.type==="user"||I.type==="bot")&&e.jsxs(e.Fragment,{children:[e.jsx(fr,{className:"h-7 w-7 sm:h-8 sm:w-8 shrink-0",children:e.jsx(pr,{className:H("text-xs",I.type==="bot"?"bg-primary/10 text-primary":"bg-secondary text-secondary-foreground"),children:I.type==="bot"?e.jsx(mr,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"}):e.jsx(io,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"})})}),e.jsxs("div",{className:H("flex flex-col gap-1 max-w-[75%] sm:max-w-[70%]",I.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:I.sender?.name||(I.type==="bot"?h?.sessionInfo.bot_name:S)}),e.jsx("span",{children:Se(I.timestamp)})]}),e.jsx("div",{className:H("rounded-2xl px-3 py-2 text-sm break-words",I.type==="bot"?"bg-muted rounded-tl-sm":"bg-primary text-primary-foreground rounded-tr-sm"),children:e.jsx(tS,{message:I,isBot:I.type==="bot"})})]})]})]},I.id)),e.jsx("div",{ref:re})]})})}),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:I=>g(I.target.value),onKeyDown:he,placeholder:h?.isConnected?"输入消息...":"等待连接...",disabled:!h?.isConnected,className:"flex-1 h-10 sm:h-10"}),e.jsx(_,{onClick:E,disabled:!h?.isConnected||!f.trim(),size:"icon",className:"h-10 w-10 shrink-0",children:e.jsx(Jy,{className:"h-4 w-4"})})]})})})]})}var bm="Radio",[lS,zj]=yg(bm),[nS,iS]=lS(bm),Mj=m.forwardRef((l,i)=>{const{__scopeRadio:r,name:o,checked:u=!1,required:x,disabled:h,value:f="on",onCheck:g,form:j,...v}=l,[N,y]=m.useState(null),S=am(i,O=>y(O)),w=m.useRef(!1),L=N?j||!!N.closest("form"):!0;return e.jsxs(nS,{scope:r,checked:u,disabled:h,children:[e.jsx(mo.button,{type:"button",role:"radio","aria-checked":u,"data-state":Rj(u),"data-disabled":h?"":void 0,disabled:h,value:f,...v,ref:S,onClick:Ju(l.onClick,O=>{u||g?.(),L&&(w.current=O.isPropagationStopped(),w.current||O.stopPropagation())})}),L&&e.jsx(Dj,{control:N,bubbles:!w.current,name:o,value:f,checked:u,required:x,disabled:h,form:j,style:{transform:"translateX(-100%)"}})]})});Mj.displayName=bm;var Aj="RadioIndicator",Oj=m.forwardRef((l,i)=>{const{__scopeRadio:r,forceMount:o,...u}=l,x=iS(Aj,r);return e.jsx(py,{present:o||x.checked,children:e.jsx(mo.span,{"data-state":Rj(x.checked),"data-disabled":x.disabled?"":void 0,...u,ref:i})})});Oj.displayName=Aj;var rS="RadioBubbleInput",Dj=m.forwardRef(({__scopeRadio:l,control:i,checked:r,bubbles:o=!0,...u},x)=>{const h=m.useRef(null),f=am(h,x),g=gy(r),j=jy(i);return m.useEffect(()=>{const v=h.current;if(!v)return;const N=window.HTMLInputElement.prototype,S=Object.getOwnPropertyDescriptor(N,"checked").set;if(g!==r&&S){const w=new Event("click",{bubbles:o});S.call(v,r),v.dispatchEvent(w)}},[g,r,o]),e.jsx(mo.input,{type:"radio","aria-hidden":!0,defaultChecked:r,...u,tabIndex:-1,ref:f,style:{...u.style,...j,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Dj.displayName=rS;function Rj(l){return l?"checked":"unchecked"}var cS=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],yo="RadioGroup",[oS]=yg(yo,[cg,zj]),Lj=cg(),Uj=zj(),[dS,uS]=oS(yo),Bj=m.forwardRef((l,i)=>{const{__scopeRadioGroup:r,name:o,defaultValue:u,value:x,required:h=!1,disabled:f=!1,orientation:g,dir:j,loop:v=!0,onValueChange:N,...y}=l,S=Lj(r),w=hy(j),[L,O]=fy({prop:x,defaultProp:u??null,onChange:N,caller:yo});return e.jsx(dS,{scope:r,name:o,required:h,disabled:f,value:L,onValueChange:O,children:e.jsx(IN,{asChild:!0,...S,orientation:g,dir:w,loop:v,children:e.jsx(mo.div,{role:"radiogroup","aria-required":h,"aria-orientation":g,"data-disabled":f?"":void 0,dir:w,...y,ref:i})})})});Bj.displayName=yo;var Hj="RadioGroupItem",$j=m.forwardRef((l,i)=>{const{__scopeRadioGroup:r,disabled:o,...u}=l,x=uS(Hj,r),h=x.disabled||o,f=Lj(r),g=Uj(r),j=m.useRef(null),v=am(i,j),N=x.value===u.value,y=m.useRef(!1);return m.useEffect(()=>{const S=L=>{cS.includes(L.key)&&(y.current=!0)},w=()=>y.current=!1;return document.addEventListener("keydown",S),document.addEventListener("keyup",w),()=>{document.removeEventListener("keydown",S),document.removeEventListener("keyup",w)}},[]),e.jsx(QN,{asChild:!0,...f,focusable:!h,active:N,children:e.jsx(Mj,{disabled:h,required:x.required,checked:N,...g,...u,name:x.name,ref:v,onCheck:()=>x.onValueChange(u.value),onKeyDown:Ju(S=>{S.key==="Enter"&&S.preventDefault()}),onFocus:Ju(u.onFocus,()=>{y.current&&j.current?.click()})})})});$j.displayName=Hj;var mS="RadioGroupIndicator",qj=m.forwardRef((l,i)=>{const{__scopeRadioGroup:r,...o}=l,u=Uj(r);return e.jsx(Oj,{...u,...o,ref:i})});qj.displayName=mS;var Gj=Bj,Fj=$j,xS=qj;const Vj=m.forwardRef(({className:l,...i},r)=>e.jsx(Gj,{className:H("grid gap-2",l),...i,ref:r}));Vj.displayName=Gj.displayName;const Ij=m.forwardRef(({className:l,...i},r)=>e.jsx(Fj,{ref:r,className:H("aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",l),...i,children:e.jsx(xS,{className:"flex items-center justify-center",children:e.jsx(Py,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Ij.displayName=Fj.displayName;function hS({question:l,value:i,onChange:r,error:o,disabled:u=!1}){const[x,h]=m.useState(null),f=u||l.readOnly,g=()=>{switch(l.type){case"single":return e.jsx(Vj,{value:i||"",onValueChange:r,disabled:f,className:"space-y-2",children:l.options?.map(j=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ij,{value:j.value,id:`${l.id}-${j.id}`}),e.jsx(C,{htmlFor:`${l.id}-${j.id}`,className:"cursor-pointer font-normal",children:j.label})]},j.id))});case"multiple":{const j=i||[];return e.jsxs("div",{className:"space-y-2",children:[l.options?.map(v=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(gt,{id:`${l.id}-${v.id}`,checked:j.includes(v.value),disabled:f||l.maxSelections!==void 0&&j.length>=l.maxSelections&&!j.includes(v.value),onCheckedChange:N=>{r(N?[...j,v.value]:j.filter(y=>y!==v.value))}}),e.jsx(C,{htmlFor:`${l.id}-${v.id}`,className:"cursor-pointer font-normal",children:v.label})]},v.id)),l.maxSelections&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["最多选择 ",l.maxSelections," 项"]})]})}case"text":return e.jsx(ne,{value:i||"",onChange:j=>r(j.target.value),placeholder:l.placeholder||"请输入...",disabled:f,readOnly:l.readOnly,maxLength:l.maxLength,className:H(l.readOnly&&"bg-muted cursor-not-allowed")});case"textarea":return e.jsxs("div",{className:"space-y-1",children:[e.jsx(Is,{value:i||"",onChange:j=>r(j.target.value),placeholder:l.placeholder||"请输入...",disabled:f,readOnly:l.readOnly,maxLength:l.maxLength,rows:4,className:H(l.readOnly&&"bg-muted cursor-not-allowed")}),l.maxLength&&e.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[(i||"").length," / ",l.maxLength]})]});case"rating":{const j=i||0,v=x!==null?x:j;return e.jsxs("div",{className:"flex items-center gap-1",children:[[1,2,3,4,5].map(N=>e.jsx("button",{type:"button",disabled:f,className:H("p-1 transition-colors focus:outline-none focus:ring-2 focus:ring-ring rounded",f&&"cursor-not-allowed opacity-50"),onMouseEnter:()=>!f&&h(N),onMouseLeave:()=>h(null),onClick:()=>!f&&r(N),children:e.jsx(fl,{className:H("h-6 w-6 transition-colors",N<=v?"fill-yellow-400 text-yellow-400":"text-muted-foreground")})},N)),j>0&&e.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:[j," / 5"]})]})}case"scale":{const j=l.min??1,v=l.max??10,N=l.step??1,y=i??j;return e.jsxs("div",{className:"space-y-4",children:[e.jsx(Ca,{value:[y],onValueChange:([S])=>r(S),min:j,max:v,step:N,disabled:f}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:l.minLabel||j}),e.jsx("span",{className:"font-medium text-foreground",children:y}),e.jsx("span",{children:l.maxLabel||v})]})]})}case"dropdown":return e.jsxs(Be,{value:i||"",onValueChange:r,disabled:f,children:[e.jsx(Le,{children:e.jsx(He,{placeholder:l.placeholder||"请选择..."})}),e.jsx(Ue,{children:l.options?.map(j=>e.jsx(se,{value:j.value,children:j.label},j.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(C,{className:"text-base font-medium",children:[l.title,l.required&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),l.description&&e.jsx("p",{className:"text-sm text-muted-foreground",children:l.description})]}),g(),o&&e.jsx("p",{className:"text-sm text-destructive",children:o})]})}const Qj="https://maibot-plugin-stats.maibot-webui.workers.dev";function Yj(){const l="maibot_user_id";let i=localStorage.getItem(l);if(!i){const r=Math.random().toString(36).substring(2,10),o=Date.now().toString(36),u=Math.random().toString(36).substring(2,10);i=`fp_${r}_${o}_${u}`,localStorage.setItem(l,i)}return i}async function fS(l,i,r,o){try{const u=o?.userId||Yj(),x={surveyId:l,surveyVersion:i,userId:u,answers:r,submittedAt:new Date().toISOString(),allowMultiple:o?.allowMultiple,metadata:{userAgent:navigator.userAgent,language:navigator.language}},h=await fetch(`${Qj}/survey/submit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(x)}),f=await h.json();return h.status===429?{success:!1,error:"提交过于频繁,请稍后再试"}:h.status===409?{success:!1,error:f.error||"你已经提交过这份问卷了"}:h.ok?{success:!0,submissionId:f.submissionId,message:f.message}:{success:!1,error:f.error||"提交失败"}}catch(u){return console.error("Error submitting survey:",u),{success:!1,error:"网络错误"}}}async function pS(l,i){try{const r=i||Yj(),o=new URLSearchParams({user_id:r,survey_id:l}),u=await fetch(`${Qj}/survey/check?${o}`);return u.ok?{success:!0,hasSubmitted:(await u.json()).hasSubmitted}:{success:!1,error:(await u.json()).error||"检查失败"}}catch(r){return console.error("Error checking submission:",r),{success:!1,error:"网络错误"}}}function Kj({config:l,initialAnswers:i,onSubmitSuccess:r,onSubmitError:o,showProgress:u=!0,paginateQuestions:x=!1,className:h}){const f=m.useCallback(()=>!i||i.length===0?{}:i.reduce((K,re)=>(K[re.questionId]=re.value,K),{}),[i]),[g,j]=m.useState(()=>f()),[v,N]=m.useState({}),[y,S]=m.useState(0),[w,L]=m.useState(!1),[O,U]=m.useState(!1),[F,A]=m.useState(null),[k,$]=m.useState(null),[G,z]=m.useState(!1),[M,Q]=m.useState(!0);m.useEffect(()=>{i&&i.length>0&&j(K=>({...K,...f()}))},[i,f]),m.useEffect(()=>{(async()=>{if(!l.settings?.allowMultiple){const re=await pS(l.id);re.success&&re.hasSubmitted&&z(!0)}Q(!1)})()},[l.id,l.settings?.allowMultiple]);const fe=m.useCallback(()=>{const K=new Date;return!(l.settings?.startTime&&new Date(l.settings.startTime)>K||l.settings?.endTime&&new Date(l.settings.endTime){const re=g[K.id];return re==null?!1:Array.isArray(re)?re.length>0:typeof re=="string"?re.trim()!=="":!0}).length,ge=ve/l.questions.length*100,be=m.useCallback((K,re)=>{j(T=>({...T,[K]:re})),N(T=>{const ie={...T};return delete ie[K],ie})},[]),je=m.useCallback(()=>{const K={};for(const re of l.questions){if(re.required){const T=g[re.id];if(T==null){K[re.id]="此题为必填项";continue}if(Array.isArray(T)&&T.length===0){K[re.id]="请至少选择一项";continue}if(typeof T=="string"&&T.trim()===""){K[re.id]="此题为必填项";continue}}re.minLength&&typeof g[re.id]=="string"&&g[re.id].length{if(!je()){if(x){const K=l.questions.findIndex(re=>v[re.id]);K>=0&&S(K)}return}L(!0),A(null);try{const K=l.questions.filter(T=>g[T.id]!==void 0).map(T=>({questionId:T.id,value:g[T.id]})),re=await fS(l.id,l.version,K,{allowMultiple:l.settings?.allowMultiple});if(re.success&&re.submissionId)U(!0),$(re.submissionId),r?.(re.submissionId);else{const T=re.error||"提交失败";A(T),o?.(T)}}catch(K){const re=K instanceof Error?K.message:"提交失败";A(re),o?.(re)}finally{L(!1)}},[je,x,l,g,v,r,o]),R=m.useCallback(K=>{K>=0&&Ke.jsxs("div",{className:H("p-4 rounded-lg border bg-card",v[K.id]?"border-destructive bg-destructive/5":"border-border"),children:[x&&e.jsxs("div",{className:"text-xs text-muted-foreground mb-2",children:["问题 ",y+1," / ",l.questions.length]}),!x&&e.jsxs("div",{className:"text-xs text-muted-foreground mb-2",children:[re+1,"."]}),e.jsx(hS,{question:K,value:g[K.id],onChange:T=>be(K.id,T),error:v[K.id],disabled:w})]},K.id)),F&&e.jsxs(ta,{variant:"destructive",children:[e.jsx(Gt,{className:"h-4 w-4"}),e.jsx(aa,{children:F})]}),e.jsx("div",{className:"flex justify-between items-center py-4",children:x?e.jsxs(e.Fragment,{children:[e.jsxs(_,{variant:"outline",onClick:()=>R(y-1),disabled:y===0||w,children:[e.jsx(jl,{className:"h-4 w-4 mr-1"}),"上一题"]}),y===l.questions.length-1?e.jsxs(_,{onClick:Ne,disabled:w,children:[w&&e.jsx(xt,{className:"h-4 w-4 mr-2 animate-spin"}),"提交问卷"]}):e.jsxs(_,{onClick:()=>R(y+1),disabled:w,children:["下一题",e.jsx(Xa,{className:"h-4 w-4 ml-1"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:Object.keys(v).length>0&&e.jsxs("span",{className:"text-destructive",children:["还有 ",Object.keys(v).length," 个必填项未完成"]})}),e.jsxs(_,{onClick:Ne,disabled:w,size:"lg",children:[w&&e.jsx(xt,{className:"h-4 w-4 mr-2 animate-spin"}),"提交问卷"]})]})})]})})]})}const gS={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:"感谢你的反馈!你的意见对我们非常重要,我们会认真考虑每一条建议。"}},jS={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 vS(){const[l,i]=m.useState(null),[r,o]=m.useState(!0);m.useEffect(()=>{const f=JSON.parse(JSON.stringify(gS));i(f),o(!1)},[]);const u=m.useMemo(()=>[{questionId:"webui_version",value:`v${ho}`}],[]),x=m.useCallback(f=>{console.log("WebUI Survey submitted:",f)},[]),h=m.useCallback(f=>{console.error("WebUI Survey submission error:",f)},[]);return r?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx(xt,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):l?e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsxs("div",{className:"mb-4 sm:mb-6 shrink-0",children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(Hg,{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(Kj,{config:l,initialAnswers:u,showProgress:!0,paginateQuestions:!1,onSubmitSuccess:x,onSubmitError:h})})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-4",children:[e.jsxs(ta,{variant:"destructive",className:"max-w-md",children:[e.jsx(Gt,{className:"h-4 w-4"}),e.jsx(aa,{children:"无法加载问卷配置"})]}),e.jsx(_,{variant:"outline",onClick:()=>window.location.reload(),children:"重试"})]})}function bS(){const[l,i]=m.useState(null),[r,o]=m.useState(!0),[u,x]=m.useState("未知版本");m.useEffect(()=>{(async()=>{try{const N=await uj();x(N.version||"未知版本")}catch(N){console.error("Failed to get MaiBot version:",N),x("获取失败")}const v=JSON.parse(JSON.stringify(jS));i(v),o(!1)})()},[]);const h=m.useMemo(()=>[{questionId:"maibot_version",value:u}],[u]),f=m.useCallback(j=>{console.log("MaiBot Survey submitted:",j)},[]),g=m.useCallback(j=>{console.error("MaiBot Survey submission error:",j)},[]);return r?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx(xt,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):l?e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsxs("div",{className:"mb-4 sm:mb-6 shrink-0",children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(Hg,{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(Kj,{config:l,initialAnswers:h,showProgress:!0,paginateQuestions:!1,onSubmitSuccess:f,onSubmitError:g})})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-4",children:[e.jsxs(ta,{variant:"destructive",className:"max-w-md",children:[e.jsx(Gt,{className:"h-4 w-4"}),e.jsx(aa,{children:"无法加载问卷配置"})]}),e.jsx(_,{variant:"outline",onClick:()=>window.location.reload(),children:"重试"})]})}function NS(){const l=Ea(),[i,r]=m.useState(!0);return m.useEffect(()=>{let o=!1;return(async()=>{try{const x=await dm();!o&&!x&&l({to:"/auth"})}catch{o||l({to:"/auth"})}finally{o||r(!1)}})(),()=>{o=!0}},[l]),{checking:i}}async function yS(){return await dm()}const wS=xi("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"}}),Xj=m.forwardRef(({className:l,size:i,abbrTitle:r,children:o,...u},x)=>e.jsx("kbd",{className:H(wS({size:i,className:l})),ref:x,...u,children:r?e.jsx("abbr",{title:r,children:o}):o}));Xj.displayName="Kbd";const _S=[{icon:xo,title:"首页",description:"查看仪表板概览",path:"/",category:"概览"},{icon:Ra,title:"麦麦主程序配置",description:"配置麦麦的核心设置",path:"/config/bot",category:"配置"},{icon:$g,title:"麦麦模型提供商配置",description:"配置模型提供商",path:"/config/modelProvider",category:"配置"},{icon:qg,title:"麦麦模型配置",description:"配置模型参数",path:"/config/model",category:"配置"},{icon:lm,title:"表情包管理",description:"管理麦麦的表情包",path:"/resource/emoji",category:"资源"},{icon:Yl,title:"表达方式管理",description:"管理麦麦的表达方式",path:"/resource/expression",category:"资源"},{icon:Gg,title:"人物信息管理",description:"管理人物信息",path:"/resource/person",category:"资源"},{icon:mi,title:"黑话管理",description:"管理麦麦学习到的黑话和俚语",path:"/resource/jargon",category:"资源"},{icon:Zy,title:"统计信息",description:"查看使用统计",path:"/statistics",category:"监控"},{icon:Ql,title:"插件市场",description:"浏览和安装插件",path:"/plugins",category:"扩展"},{icon:nm,title:"日志查看器",description:"查看系统日志",path:"/logs",category:"监控"},{icon:hi,title:"系统设置",description:"配置系统参数",path:"/settings",category:"系统"}];function SS({open:l,onOpenChange:i}){const[r,o]=m.useState(""),[u,x]=m.useState(0),h=Ea(),f=_S.filter(v=>v.title.toLowerCase().includes(r.toLowerCase())||v.description.toLowerCase().includes(r.toLowerCase())||v.category.toLowerCase().includes(r.toLowerCase()));m.useEffect(()=>{l&&(o(""),x(0))},[l]);const g=m.useCallback(v=>{h({to:v}),i(!1)},[h,i]),j=m.useCallback(v=>{v.key==="ArrowDown"?(v.preventDefault(),x(N=>(N+1)%f.length)):v.key==="ArrowUp"?(v.preventDefault(),x(N=>(N-1+f.length)%f.length)):v.key==="Enter"&&f[u]&&(v.preventDefault(),g(f[u].path))},[f,u,g]);return e.jsx(Gs,{open:l,onOpenChange:i,children:e.jsxs(Us,{className:"max-w-2xl p-0 gap-0",children:[e.jsxs(Bs,{className:"px-4 pt-4 pb-0",children:[e.jsx(Hs,{className:"sr-only",children:"搜索"}),e.jsxs("div",{className:"relative",children:[e.jsx(Ft,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground"}),e.jsx(ne,{value:r,onChange:v=>{o(v.target.value),x(0)},onKeyDown:j,placeholder:"搜索页面...",className:"h-12 pl-11 text-base border-0 focus-visible:ring-0 shadow-none",autoFocus:!0})]})]}),e.jsx("div",{className:"border-t",children:e.jsx(Ze,{className:"h-[400px]",children:f.length>0?e.jsx("div",{className:"p-2",children:f.map((v,N)=>{const y=v.icon;return e.jsxs("button",{onClick:()=>g(v.path),onMouseEnter:()=>x(N),className:H("w-full flex items-center gap-3 px-3 py-2.5 rounded-md text-left transition-colors",N===u?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:[e.jsx(y,{className:"h-5 w-5 flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium text-sm",children:v.title}),e.jsx("div",{className:"text-xs text-muted-foreground truncate",children:v.description})]}),e.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1 bg-muted rounded",children:v.category})]},v.path)})}):e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(Ft,{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"}),"关闭"]})]})})]})})}const CS=by,kS=Ny,TS=yy,Jj=m.forwardRef(({className:l,sideOffset:i=4,...r},o)=>e.jsx(vy,{children:e.jsx(wg,{ref:o,sideOffset:i,className:H("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",l),...r})}));Jj.displayName=wg.displayName;function ES({children:l}){const{checking:i}=NS(),[r,o]=m.useState(!0),[u,x]=m.useState(!1),[h,f]=m.useState(!1),{theme:g,setTheme:j}=rm(),v=gN();if(m.useEffect(()=>{const L=O=>{(O.metaKey||O.ctrlKey)&&O.key==="k"&&(O.preventDefault(),f(!0))};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[]),i)return e.jsx("div",{className:"flex h-screen items-center justify-center bg-background",children:e.jsx("div",{className:"text-muted-foreground",children:"正在验证登录状态..."})});const N=[{title:"概览",items:[{icon:xo,label:"首页",path:"/"}]},{title:"麦麦配置编辑",items:[{icon:Ra,label:"麦麦主程序配置",path:"/config/bot"},{icon:$g,label:"AI模型厂商配置",path:"/config/modelProvider",tourId:"sidebar-model-provider"},{icon:qg,label:"模型管理与分配",path:"/config/model",tourId:"sidebar-model-management"},{icon:fp,label:"麦麦适配器配置",path:"/config/adapter"}]},{title:"麦麦资源管理",items:[{icon:lm,label:"表情包管理",path:"/resource/emoji"},{icon:Yl,label:"表达方式管理",path:"/resource/expression"},{icon:mi,label:"黑话管理",path:"/resource/jargon"},{icon:Gg,label:"人物信息管理",path:"/resource/person"},{icon:Ug,label:"知识库图谱可视化",path:"/resource/knowledge-graph"}]},{title:"扩展与监控",items:[{icon:Ql,label:"插件市场",path:"/plugins"},{icon:Bg,label:"模型分配预设市场",path:"/model-presets"},{icon:fp,label:"插件配置",path:"/plugin-config"},{icon:nm,label:"日志查看器",path:"/logs"},{icon:Yl,label:"本地聊天室",path:"/chat"}]},{title:"系统",items:[{icon:hi,label:"系统设置",path:"/settings"}]}],S=g==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":g,w=async()=>{await mw()};return e.jsx(CS,{delayDuration:300,children:e.jsxs("div",{className:"flex h-screen overflow-hidden",children:[e.jsxs("aside",{className:H("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",u?"translate-x-0":"-translate-x-full lg:translate-x-0"),children:[e.jsx("div",{className:"flex h-16 items-center border-b px-4",children:e.jsxs("div",{className:H("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:H("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:J0()})]}),!r&&e.jsx("span",{className:"hidden lg:block font-bold text-primary-gradient text-2xl",children:"M"})]})}),e.jsx(Ze,{className:H("flex-1 overflow-x-hidden",!r&&"lg:w-16"),children:e.jsx("nav",{className:H("p-4",!r&&"lg:p-2 lg:w-16"),children:e.jsx("ul",{className:H("space-y-6",!r&&"lg:space-y-3 lg:w-full"),children:N.map((L,O)=>e.jsxs("li",{children:[e.jsx("div",{className:H("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:L.title})}),!r&&O>0&&e.jsx("div",{className:"hidden lg:block mb-2 border-t border-border"}),e.jsx("ul",{className:"space-y-1",children:L.items.map(U=>{const F=v({to:U.path}),A=U.icon,k=e.jsxs(e.Fragment,{children:[F&&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:H("flex items-center transition-all duration-300",r?"gap-3":"gap-3 lg:gap-0"),children:[e.jsx(A,{className:H("h-5 w-5 flex-shrink-0",F&&"text-primary"),strokeWidth:2,fill:"none"}),e.jsx("span",{className:H("text-sm font-medium whitespace-nowrap transition-all duration-300",F&&"font-semibold",r?"opacity-100 max-w-[200px]":"opacity-100 max-w-[200px] lg:opacity-0 lg:max-w-0 lg:overflow-hidden"),children:U.label})]})]});return e.jsx("li",{className:"relative",children:e.jsxs(kS,{children:[e.jsx(TS,{asChild:!0,children:e.jsx(li,{to:U.path,"data-tour":U.tourId,className:H("relative flex items-center rounded-lg py-2 transition-all duration-300","hover:bg-accent hover:text-accent-foreground",F?"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:()=>x(!1),children:k})}),!r&&e.jsx(Jj,{side:"right",className:"hidden lg:block",children:e.jsx("p",{children:U.label})})]})},U.path)})})]},L.title))})})})]}),u&&e.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 lg:hidden",onClick:()=>x(!1)}),e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[e.jsxs("header",{className:"flex h-16 items-center justify-between border-b bg-card/80 backdrop-blur-md px-4 sticky top-0 z-10",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("button",{onClick:()=>x(!u),className:"rounded-lg p-2 hover:bg-accent lg:hidden",children:e.jsx(Wy,{className:"h-5 w-5"})}),e.jsx("button",{onClick:()=>o(!r),className:"hidden rounded-lg p-2 hover:bg-accent lg:block",title:r?"收起侧边栏":"展开侧边栏",children:e.jsx(jl,{className:H("h-5 w-5 transition-transform",!r&&"rotate-180")})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>f(!0),className:"relative hidden md:flex items-center w-64 h-9 pl-9 pr-16 bg-background/50 border rounded-md hover:bg-accent/50 transition-colors text-left",children:[e.jsx(Ft,{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(Xj,{size:"sm",className:"absolute right-2 top-1/2 -translate-y-1/2",children:[e.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),e.jsx(SS,{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(e0,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"麦麦文档"})]}),e.jsx("button",{onClick:L=>{I0(S==="dark"?"light":"dark",j,L)},className:"rounded-lg p-2 hover:bg-accent",title:S==="dark"?"切换到浅色模式":"切换到深色模式",children:S==="dark"?e.jsx(Mg,{className:"h-5 w-5"}):e.jsx(Ag,{className:"h-5 w-5"})}),e.jsx("div",{className:"h-6 w-px bg-border"}),e.jsxs(_,{variant:"ghost",size:"sm",onClick:w,className:"gap-2",title:"登出系统",children:[e.jsx(s0,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"登出"})]})]})]}),e.jsx("main",{className:"flex-1 overflow-hidden bg-background",children:l})]})]})})}function zS(l){const i=l.split(` +`).slice(1),r=[];for(const o of i){const u=o.trim();if(!u.startsWith("at "))continue;const x=u.match(/at\s+(?:(.+?)\s+\()?(.+?):(\d+):(\d+)\)?$/);x?r.push({functionName:x[1]||"",fileName:x[2],lineNumber:x[3],columnNumber:x[4],raw:u}):r.push({functionName:"",fileName:"",lineNumber:"",columnNumber:"",raw:u})}return r}function MS({error:l,errorInfo:i}){const[r,o]=m.useState(!0),[u,x]=m.useState(!1),[h,f]=m.useState(!1),g=l.stack?zS(l.stack):[],j=async()=>{const v=` Error: ${l.name} Message: ${l.message} @@ -83,4 +83,4 @@ ${i?.componentStack||"No component stack available"} URL: ${window.location.href} User Agent: ${navigator.userAgent} Time: ${new Date().toISOString()} - `.trim();try{await navigator.clipboard.writeText(j),p(!0),setTimeout(()=>p(!1),2e3)}catch(N){console.error("Failed to copy:",N)}};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs(ta,{variant:"destructive",className:"border-red-500/50 bg-red-500/10",children:[e.jsx(La,{className:"h-4 w-4"}),e.jsxs(aa,{className:"font-mono text-sm",children:[e.jsxs("span",{className:"font-semibold",children:[l.name,":"]})," ",l.message]})]}),g.length>0&&e.jsxs(_r,{open:r,onOpenChange:o,children:[e.jsx(Sr,{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(Qy,{className:"h-4 w-4"}),"Stack Trace (",g.length," frames)"]}),r?e.jsx(ui,{className:"h-4 w-4"}):e.jsx(Qa,{className:"h-4 w-4"})]})}),e.jsx(Cr,{children:e.jsx(Ze,{className:"h-[280px] rounded-md border bg-muted/30",children:e.jsx("div",{className:"p-3 space-y-1",children:g.map((j,N)=>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:[N+1,"."]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"text-primary font-medium",children:j.functionName}),j.fileName&&e.jsxs("div",{className:"text-muted-foreground mt-0.5 break-all",children:[j.fileName,j.lineNumber&&e.jsxs("span",{className:"text-yellow-600 dark:text-yellow-400",children:[":",j.lineNumber,":",j.columnNumber]})]})]})]})},N))})})})]}),i?.componentStack&&e.jsxs(_r,{open:u,onOpenChange:x,children:[e.jsx(Sr,{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(La,{className:"h-4 w-4"}),"Component Stack"]}),u?e.jsx(ui,{className:"h-4 w-4"}):e.jsx(Qa,{className:"h-4 w-4"})]})}),e.jsx(Cr,{children:e.jsx(Ze,{className:"h-[200px] rounded-md border bg-muted/30",children:e.jsx("pre",{className:"p-3 font-mono text-xs whitespace-pre-wrap text-muted-foreground",children:i.componentStack})})})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:v,className:"w-full",children:h?e.jsxs(e.Fragment,{children:[e.jsx(sa,{className:"mr-2 h-4 w-4 text-green-500"}),"已复制到剪贴板"]}):e.jsxs(e.Fragment,{children:[e.jsx(no,{className:"mr-2 h-4 w-4"}),"复制错误信息"]})})]})}function $j({error:l,errorInfo:i}){const r=()=>{window.location.href="/"},o=()=>{window.location.reload()};return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:e.jsxs(Ve,{className:"w-full max-w-2xl shadow-lg",children:[e.jsxs(as,{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(La,{className:"h-8 w-8 text-red-600 dark:text-red-400"})}),e.jsx(ls,{className:"text-2xl font-bold",children:"页面出现了问题"}),e.jsx(st,{className:"text-base mt-2",children:"应用程序遇到了意外错误。您可以尝试刷新页面或返回首页。"})]}),e.jsxs(ps,{className:"space-y-4",children:[e.jsx(kS,{error:l,errorInfo:i}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 pt-2",children:[e.jsxs(_,{onClick:o,className:"flex-1",children:[e.jsx(qt,{className:"mr-2 h-4 w-4"}),"刷新页面"]}),e.jsxs(_,{onClick:r,variant:"outline",className:"flex-1",children:[e.jsx(mo,{className:"mr-2 h-4 w-4"}),"返回首页"]})]}),e.jsx("p",{className:"text-xs text-center text-muted-foreground pt-2",children:"如果问题持续存在,请将错误信息复制并反馈给开发者"})]})]})})}class TS extends m.Component{constructor(i){super(i),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(i){return{hasError:!0,error:i}}componentDidCatch(i,r){console.error("ErrorBoundary caught an error:",i,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($j,{error:this.state.error,errorInfo:this.state.errorInfo}):this.props.children}}function qj({error:l}){return e.jsx($j,{error:l,errorInfo:null})}const Mr=rN({component:()=>e.jsxs(e.Fragment,{children:[e.jsx(Gp,{}),!1]}),beforeLoad:()=>{if(window.location.pathname==="/"&&!jS())throw oN({to:"/auth"})}}),ES=at({getParentRoute:()=>Mr,path:"/auth",component:mw}),zS=at({getParentRoute:()=>Mr,path:"/setup",component:Tw}),St=at({getParentRoute:()=>Mr,id:"protected",component:()=>e.jsx(SS,{children:e.jsx(Gp,{})}),errorComponent:({error:l})=>e.jsx(qj,{error:l})}),MS=at({getParentRoute:()=>St,path:"/",component:G0}),AS=at({getParentRoute:()=>St,path:"/config/bot",component:n1}),OS=at({getParentRoute:()=>St,path:"/config/modelProvider",component:p1}),DS=at({getParentRoute:()=>St,path:"/config/model",component:M1}),RS=at({getParentRoute:()=>St,path:"/config/adapter",component:W1}),LS=at({getParentRoute:()=>St,path:"/resource/emoji",component:y2}),US=at({getParentRoute:()=>St,path:"/resource/expression",component:D2}),BS=at({getParentRoute:()=>St,path:"/resource/person",component:l_}),HS=at({getParentRoute:()=>St,path:"/resource/jargon",component:K2}),$S=at({getParentRoute:()=>St,path:"/resource/knowledge-graph",component:x_}),qS=at({getParentRoute:()=>St,path:"/logs",component:f_}),GS=at({getParentRoute:()=>St,path:"/chat",component:W_}),FS=at({getParentRoute:()=>St,path:"/plugins",component:H_}),VS=at({getParentRoute:()=>St,path:"/model-presets",component:$_}),IS=at({getParentRoute:()=>St,path:"/plugin-config",component:F_}),QS=at({getParentRoute:()=>St,path:"/plugin-mirrors",component:V_}),YS=at({getParentRoute:()=>St,path:"/settings",component:nw}),KS=at({getParentRoute:()=>St,path:"/survey/webui-feedback",component:fS}),XS=at({getParentRoute:()=>St,path:"/survey/maibot-feedback",component:pS}),JS=at({getParentRoute:()=>Mr,path:"*",component:sj}),PS=Mr.addChildren([ES,zS,St.addChildren([MS,AS,OS,DS,RS,LS,US,HS,BS,$S,FS,VS,IS,QS,qS,GS,YS,KS,XS]),JS]),ZS=cN({routeTree:PS,defaultNotFoundComponent:sj,defaultErrorComponent:({error:l})=>e.jsx(qj,{error:l})});function WS({children:l,defaultTheme:i="system",storageKey:r="ui-theme",...o}){const[u,x]=m.useState(()=>localStorage.getItem(r)||i);m.useEffect(()=>{const p=window.document.documentElement;if(p.classList.remove("light","dark"),u==="system"){const g=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";p.classList.add(g);return}p.classList.add(u)},[u]),m.useEffect(()=>{const p=localStorage.getItem("accent-color");if(p){const g=document.documentElement,j={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%)"}}[p];j&&(g.style.setProperty("--primary",j.hsl),j.gradient?(g.style.setProperty("--primary-gradient",j.gradient),g.classList.add("has-gradient")):(g.style.removeProperty("--primary-gradient"),g.classList.remove("has-gradient")))}},[]);const h={theme:u,setTheme:p=>{localStorage.setItem(r,p),x(p)}};return e.jsx(Kg.Provider,{...o,value:h,children:l})}function e4({children:l,defaultEnabled:i=!0,defaultWavesEnabled:r=!0,storageKey:o="enable-animations",wavesStorageKey:u="enable-waves-background"}){const[x,h]=m.useState(()=>{const j=localStorage.getItem(o);return j!==null?j==="true":i}),[p,g]=m.useState(()=>{const j=localStorage.getItem(u);return j!==null?j==="true":r});m.useEffect(()=>{const j=document.documentElement;x?j.classList.remove("no-animations"):j.classList.add("no-animations"),localStorage.setItem(o,String(x))},[x,o]),m.useEffect(()=>{localStorage.setItem(u,String(p))},[p,u]);const v={enableAnimations:x,setEnableAnimations:h,enableWavesBackground:p,setEnableWavesBackground:g};return e.jsx(Xg.Provider,{value:v,children:l})}const s4=my,Gj=m.forwardRef(({className:l,...i},r)=>e.jsx(_g,{ref:r,className:H("fixed bottom-0 right-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:max-w-[420px] gap-2",l),...i}));Gj.displayName=_g.displayName;const t4=xi("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-slide-in-from-right data-[state=open]:animate-fade-in data-[state=closed]:animate-slide-out-to-right data-[state=closed]:animate-fade-out data-[swipe=end]:animate-slide-out-to-right",{variants:{variant:{default:"border bg-primary/5 text-foreground backdrop-blur-sm",destructive:"destructive group border-destructive bg-destructive/10 text-destructive-foreground backdrop-blur-sm"}},defaultVariants:{variant:"default"}}),Fj=m.forwardRef(({className:l,variant:i,...r},o)=>e.jsx(Sg,{ref:o,className:H(t4({variant:i}),l),...r}));Fj.displayName=Sg.displayName;const a4=m.forwardRef(({className:l,...i},r)=>e.jsx(Cg,{ref:r,className:H("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",l),...i}));a4.displayName=Cg.displayName;const Vj=m.forwardRef(({className:l,...i},r)=>e.jsx(kg,{ref:r,className:H("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",l),"toast-close":"",...i,children:e.jsx(gl,{className:"h-4 w-4"})}));Vj.displayName=kg.displayName;const Ij=m.forwardRef(({className:l,...i},r)=>e.jsx(Tg,{ref:r,className:H("text-sm font-semibold [&+div]:text-xs",l),...i}));Ij.displayName=Tg.displayName;const Qj=m.forwardRef(({className:l,...i},r)=>e.jsx(Eg,{ref:r,className:H("text-sm opacity-90",l),...i}));Qj.displayName=Eg.displayName;function l4(){const{toasts:l}=Vs();return e.jsxs(s4,{children:[l.map(function({id:i,title:r,description:o,action:u,...x}){return e.jsxs(Fj,{...x,children:[e.jsxs("div",{className:"grid gap-1",children:[r&&e.jsx(Ij,{children:r}),o&&e.jsx(Qj,{children:o})]}),u,e.jsx(Vj,{})]},i)}),e.jsx(Gj,{})]})}M0.createRoot(document.getElementById("root")).render(e.jsx(m.StrictMode,{children:e.jsx(TS,{children:e.jsx(WS,{defaultTheme:"system",children:e.jsx(e4,{children:e.jsxs(d1,{children:[e.jsx(dN,{router:ZS}),e.jsx(x1,{}),e.jsx(l4,{})]})})})})})); + `.trim();try{await navigator.clipboard.writeText(v),f(!0),setTimeout(()=>f(!1),2e3)}catch(N){console.error("Failed to copy:",N)}};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs(ta,{variant:"destructive",className:"border-red-500/50 bg-red-500/10",children:[e.jsx(La,{className:"h-4 w-4"}),e.jsxs(aa,{className:"font-mono text-sm",children:[e.jsxs("span",{className:"font-semibold",children:[l.name,":"]})," ",l.message]})]}),g.length>0&&e.jsxs(_r,{open:r,onOpenChange:o,children:[e.jsx(Sr,{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(t0,{className:"h-4 w-4"}),"Stack Trace (",g.length," frames)"]}),r?e.jsx(ui,{className:"h-4 w-4"}):e.jsx(Qa,{className:"h-4 w-4"})]})}),e.jsx(Cr,{children:e.jsx(Ze,{className:"h-[280px] rounded-md border bg-muted/30",children:e.jsx("div",{className:"p-3 space-y-1",children:g.map((v,N)=>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:[N+1,"."]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"text-primary font-medium",children:v.functionName}),v.fileName&&e.jsxs("div",{className:"text-muted-foreground mt-0.5 break-all",children:[v.fileName,v.lineNumber&&e.jsxs("span",{className:"text-yellow-600 dark:text-yellow-400",children:[":",v.lineNumber,":",v.columnNumber]})]})]})]})},N))})})})]}),i?.componentStack&&e.jsxs(_r,{open:u,onOpenChange:x,children:[e.jsx(Sr,{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(La,{className:"h-4 w-4"}),"Component Stack"]}),u?e.jsx(ui,{className:"h-4 w-4"}):e.jsx(Qa,{className:"h-4 w-4"})]})}),e.jsx(Cr,{children:e.jsx(Ze,{className:"h-[200px] rounded-md border bg-muted/30",children:e.jsx("pre",{className:"p-3 font-mono text-xs whitespace-pre-wrap text-muted-foreground",children:i.componentStack})})})]}),e.jsx(_,{variant:"outline",size:"sm",onClick:j,className:"w-full",children:h?e.jsxs(e.Fragment,{children:[e.jsx(sa,{className:"mr-2 h-4 w-4 text-green-500"}),"已复制到剪贴板"]}):e.jsxs(e.Fragment,{children:[e.jsx(no,{className:"mr-2 h-4 w-4"}),"复制错误信息"]})})]})}function Pj({error:l,errorInfo:i}){const r=()=>{window.location.href="/"},o=()=>{window.location.reload()};return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:e.jsxs(Fe,{className:"w-full max-w-2xl shadow-lg",children:[e.jsxs(as,{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(La,{className:"h-8 w-8 text-red-600 dark:text-red-400"})}),e.jsx(ls,{className:"text-2xl font-bold",children:"页面出现了问题"}),e.jsx(st,{className:"text-base mt-2",children:"应用程序遇到了意外错误。您可以尝试刷新页面或返回首页。"})]}),e.jsxs(ps,{className:"space-y-4",children:[e.jsx(MS,{error:l,errorInfo:i}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 pt-2",children:[e.jsxs(_,{onClick:o,className:"flex-1",children:[e.jsx(qt,{className:"mr-2 h-4 w-4"}),"刷新页面"]}),e.jsxs(_,{onClick:r,variant:"outline",className:"flex-1",children:[e.jsx(xo,{className:"mr-2 h-4 w-4"}),"返回首页"]})]}),e.jsx("p",{className:"text-xs text-center text-muted-foreground pt-2",children:"如果问题持续存在,请将错误信息复制并反馈给开发者"})]})]})})}class AS extends m.Component{constructor(i){super(i),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(i){return{hasError:!0,error:i}}componentDidCatch(i,r){console.error("ErrorBoundary caught an error:",i,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(Pj,{error:this.state.error,errorInfo:this.state.errorInfo}):this.props.children}}function Zj({error:l}){return e.jsx(Pj,{error:l,errorInfo:null})}const Mr=jN({component:()=>e.jsxs(e.Fragment,{children:[e.jsx(Gp,{}),!1]}),beforeLoad:()=>{if(window.location.pathname==="/"&&!yS())throw bN({to:"/auth"})}}),OS=at({getParentRoute:()=>Mr,path:"/auth",component:xw}),DS=at({getParentRoute:()=>Mr,path:"/setup",component:Ew}),St=at({getParentRoute:()=>Mr,id:"protected",component:()=>e.jsx(ES,{children:e.jsx(Gp,{})}),errorComponent:({error:l})=>e.jsx(Zj,{error:l})}),RS=at({getParentRoute:()=>St,path:"/",component:F0}),LS=at({getParentRoute:()=>St,path:"/config/bot",component:i1}),US=at({getParentRoute:()=>St,path:"/config/modelProvider",component:g1}),BS=at({getParentRoute:()=>St,path:"/config/model",component:A1}),HS=at({getParentRoute:()=>St,path:"/config/adapter",component:e2}),$S=at({getParentRoute:()=>St,path:"/resource/emoji",component:w2}),qS=at({getParentRoute:()=>St,path:"/resource/expression",component:R2}),GS=at({getParentRoute:()=>St,path:"/resource/person",component:n_}),FS=at({getParentRoute:()=>St,path:"/resource/jargon",component:X2}),VS=at({getParentRoute:()=>St,path:"/resource/knowledge-graph",component:h_}),IS=at({getParentRoute:()=>St,path:"/logs",component:p_}),QS=at({getParentRoute:()=>St,path:"/chat",component:aS}),YS=at({getParentRoute:()=>St,path:"/plugins",component:$_}),KS=at({getParentRoute:()=>St,path:"/model-presets",component:q_}),XS=at({getParentRoute:()=>St,path:"/plugin-config",component:Y_}),JS=at({getParentRoute:()=>St,path:"/plugin-mirrors",component:K_}),PS=at({getParentRoute:()=>St,path:"/settings",component:iw}),ZS=at({getParentRoute:()=>St,path:"/survey/webui-feedback",component:vS}),WS=at({getParentRoute:()=>St,path:"/survey/maibot-feedback",component:bS}),e4=at({getParentRoute:()=>Mr,path:"*",component:mj}),s4=Mr.addChildren([OS,DS,St.addChildren([RS,LS,US,BS,HS,$S,qS,FS,GS,VS,YS,KS,XS,JS,IS,QS,PS,ZS,WS]),e4]),t4=vN({routeTree:s4,defaultNotFoundComponent:mj,defaultErrorComponent:({error:l})=>e.jsx(Zj,{error:l})});function a4({children:l,defaultTheme:i="system",storageKey:r="ui-theme",...o}){const[u,x]=m.useState(()=>localStorage.getItem(r)||i);m.useEffect(()=>{const f=window.document.documentElement;if(f.classList.remove("light","dark"),u==="system"){const g=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";f.classList.add(g);return}f.classList.add(u)},[u]),m.useEffect(()=>{const f=localStorage.getItem("accent-color");if(f){const g=document.documentElement,v={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];v&&(g.style.setProperty("--primary",v.hsl),v.gradient?(g.style.setProperty("--primary-gradient",v.gradient),g.classList.add("has-gradient")):(g.style.removeProperty("--primary-gradient"),g.classList.remove("has-gradient")))}},[]);const h={theme:u,setTheme:f=>{localStorage.setItem(r,f),x(f)}};return e.jsx(nj.Provider,{...o,value:h,children:l})}function l4({children:l,defaultEnabled:i=!0,defaultWavesEnabled:r=!0,storageKey:o="enable-animations",wavesStorageKey:u="enable-waves-background"}){const[x,h]=m.useState(()=>{const v=localStorage.getItem(o);return v!==null?v==="true":i}),[f,g]=m.useState(()=>{const v=localStorage.getItem(u);return v!==null?v==="true":r});m.useEffect(()=>{const v=document.documentElement;x?v.classList.remove("no-animations"):v.classList.add("no-animations"),localStorage.setItem(o,String(x))},[x,o]),m.useEffect(()=>{localStorage.setItem(u,String(f))},[f,u]);const j={enableAnimations:x,setEnableAnimations:h,enableWavesBackground:f,setEnableWavesBackground:g};return e.jsx(ij.Provider,{value:j,children:l})}const n4=wy,Wj=m.forwardRef(({className:l,...i},r)=>e.jsx(_g,{ref:r,className:H("fixed bottom-0 right-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:max-w-[420px] gap-2",l),...i}));Wj.displayName=_g.displayName;const i4=xi("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-slide-in-from-right data-[state=open]:animate-fade-in data-[state=closed]:animate-slide-out-to-right data-[state=closed]:animate-fade-out data-[swipe=end]:animate-slide-out-to-right",{variants:{variant:{default:"border bg-primary/5 text-foreground backdrop-blur-sm",destructive:"destructive group border-destructive bg-destructive/10 text-destructive-foreground backdrop-blur-sm"}},defaultVariants:{variant:"default"}}),ev=m.forwardRef(({className:l,variant:i,...r},o)=>e.jsx(Sg,{ref:o,className:H(i4({variant:i}),l),...r}));ev.displayName=Sg.displayName;const r4=m.forwardRef(({className:l,...i},r)=>e.jsx(Cg,{ref:r,className:H("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",l),...i}));r4.displayName=Cg.displayName;const sv=m.forwardRef(({className:l,...i},r)=>e.jsx(kg,{ref:r,className:H("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",l),"toast-close":"",...i,children:e.jsx(gl,{className:"h-4 w-4"})}));sv.displayName=kg.displayName;const tv=m.forwardRef(({className:l,...i},r)=>e.jsx(Tg,{ref:r,className:H("text-sm font-semibold [&+div]:text-xs",l),...i}));tv.displayName=Tg.displayName;const av=m.forwardRef(({className:l,...i},r)=>e.jsx(Eg,{ref:r,className:H("text-sm opacity-90",l),...i}));av.displayName=Eg.displayName;function c4(){const{toasts:l}=Vs();return e.jsxs(n4,{children:[l.map(function({id:i,title:r,description:o,action:u,...x}){return e.jsxs(ev,{...x,children:[e.jsxs("div",{className:"grid gap-1",children:[r&&e.jsx(tv,{children:r}),o&&e.jsx(av,{children:o})]}),u,e.jsx(sv,{})]},i)}),e.jsx(Wj,{})]})}A0.createRoot(document.getElementById("root")).render(e.jsx(m.StrictMode,{children:e.jsx(AS,{children:e.jsx(a4,{defaultTheme:"system",children:e.jsx(l4,{children:e.jsxs(u1,{children:[e.jsx(NN,{router:t4}),e.jsx(h1,{}),e.jsx(c4,{})]})})})})})); diff --git a/webui/dist/assets/index-Bn-Lwe3B.css b/webui/dist/assets/index-Bn-Lwe3B.css deleted file mode 100644 index f3db5dd5..00000000 --- a/webui/dist/assets/index-Bn-Lwe3B.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: 222.2 47.4% 11.2%;--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}.invisible{visibility:hidden}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.bottom-0{bottom:0}.bottom-1\/4{bottom:25%}.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\/4{right:25%}.right-2{right:.5rem}.right-4{right:1rem}.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-4{top:1rem}.top-\[50\%\]{top:50%}.z-10{z-index:10}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.order-1{order:1}.order-2{order:2}.col-span-2{grid-column:span 2 / span 2}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.-mx-4{margin-left:-1rem;margin-right:-1rem}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-0\.5{margin-top:.125rem;margin-bottom:.125rem}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-3{margin-top:.75rem;margin-bottom:.75rem}.my-4{margin-top:1rem;margin-bottom:1rem}.-mt-1{margin-top:-.25rem}.-mt-2{margin-top:-.5rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-0\.5{margin-left:.125rem}.ml-1{margin-left:.25rem}.ml-10{margin-left:2.5rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.ml-6{margin-left:1.5rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-1\.5{margin-right:.375rem}.mr-2{margin-right:.5rem}.mt-0{margin-top:0}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-12{margin-top:3rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-auto{aspect-ratio:auto}.aspect-square{aspect-ratio:1 / 1}.aspect-video{aspect-ratio:16 / 9}.size-4{width:1rem;height:1rem}.size-\[--cell-size\]{width:var(--cell-size);height:var(--cell-size)}.h-0\.5{height:.125rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-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-\[--cell-size\]{height:var(--cell-size)}.h-\[1\.25rem\]{height:1.25rem}.h-\[140px\]{height:140px}.h-\[1px\]{height:1px}.h-\[200px\]{height:200px}.h-\[250px\]{height:250px}.h-\[280px\]{height:280px}.h-\[300px\]{height:300px}.h-\[350px\]{height:350px}.h-\[400px\]{height:400px}.h-\[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-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-32{max-height:8rem}.max-h-64{max-height:16rem}.max-h-\[--radix-context-menu-content-available-height\]{max-height:var(--radix-context-menu-content-available-height)}.max-h-\[--radix-select-content-available-height\]{max-height:var(--radix-select-content-available-height)}.max-h-\[200px\]{max-height:200px}.max-h-\[300px\]{max-height:300px}.max-h-\[60vh\]{max-height:60vh}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[calc\(90vh-120px\)\]{max-height:calc(90vh - 120px)}.max-h-\[calc\(90vh-8rem\)\]{max-height:calc(90vh - 8rem)}.max-h-full{max-height:100%}.max-h-none{max-height:none}.max-h-screen{max-height:100vh}.min-h-0{min-height:0px}.min-h-10{min-height:2.5rem}.min-h-\[100px\]{min-height:100px}.min-h-\[140px\]{min-height:140px}.min-h-\[300px\]{min-height:300px}.min-h-\[400px\]{min-height:400px}.min-h-\[60px\]{min-height:60px}.min-h-screen{min-height:100vh}.w-0{width:0px}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-24{width:6rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.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-\[1px\]{width:1px}.w-\[65px\]{width:65px}.w-\[95vw\]{width:95vw}.w-auto{width:auto}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-\[--cell-size\]{min-width:var(--cell-size)}.min-w-\[100px\]{min-width:100px}.min-w-\[120px\]{min-width:120px}.min-w-\[80px\]{min-width:80px}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.min-w-full{min-width:100%}.max-w-2xl{max-width:42rem}.max-w-32{max-width:8rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-\[100px\]{max-width:100px}.max-w-\[150px\]{max-width:150px}.max-w-\[200px\]{max-width:200px}.max-w-\[60px\]{max-width:60px}.max-w-\[75\%\]{max-width:75%}.max-w-\[90\%\]{max-width:90%}.max-w-\[95vw\]{max-width:95vw}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-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-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-\[-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-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@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 pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-move{cursor:move}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.select-all{-webkit-user-select:all;-moz-user-select:all;user-select:all}.resize-y{resize:vertical}.resize{resize:both}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-\[1fr_1fr_90px_32px\]{grid-template-columns:1fr 1fr 90px 32px}.grid-rows-\[auto_1fr_auto\]{grid-template-rows:auto 1fr auto}.flex-row{flex-direction:row}.flex-row-reverse{flex-direction:row-reverse}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.place-content-center{place-content:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.items-stretch{align-items:stretch}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-\[2px\]{border-radius:2px}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-none{border-radius:0}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-l-md{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.rounded-r-full{border-top-right-radius:9999px;border-bottom-right-radius:9999px}.rounded-r-md{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.rounded-tl-sm{border-top-left-radius:calc(var(--radius) - 4px)}.rounded-tr-sm{border-top-right-radius:calc(var(--radius) - 4px)}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-4{border-width:4px}.border-\[1\.5px\]{border-width:1.5px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-l-4{border-left-width:4px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[--color-border\]{border-color:var(--color-border)}.border-amber-200{--tw-border-opacity: 1;border-color:rgb(253 230 138 / var(--tw-border-opacity, 1))}.border-amber-500\/50{border-color:#f59e0b80}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-blue-700{--tw-border-opacity: 1;border-color:rgb(29 78 216 / var(--tw-border-opacity, 1))}.border-border{border-color:hsl(var(--border))}.border-border\/50{border-color:hsl(var(--border) / .5)}.border-current{border-color:currentColor}.border-gray-800{--tw-border-opacity: 1;border-color:rgb(31 41 55 / var(--tw-border-opacity, 1))}.border-green-200{--tw-border-opacity: 1;border-color:rgb(187 247 208 / var(--tw-border-opacity, 1))}.border-green-300{--tw-border-opacity: 1;border-color:rgb(134 239 172 / var(--tw-border-opacity, 1))}.border-green-500{--tw-border-opacity: 1;border-color:rgb(34 197 94 / var(--tw-border-opacity, 1))}.border-green-600{--tw-border-opacity: 1;border-color:rgb(22 163 74 / var(--tw-border-opacity, 1))}.border-green-700{--tw-border-opacity: 1;border-color:rgb(21 128 61 / var(--tw-border-opacity, 1))}.border-input{border-color:hsl(var(--input))}.border-muted{border-color:hsl(var(--muted))}.border-muted-foreground\/30{border-color:hsl(var(--muted-foreground) / .3)}.border-muted-foreground\/50{border-color:hsl(var(--muted-foreground) / .5)}.border-orange-200{--tw-border-opacity: 1;border-color:rgb(254 215 170 / var(--tw-border-opacity, 1))}.border-orange-600{--tw-border-opacity: 1;border-color:rgb(234 88 12 / var(--tw-border-opacity, 1))}.border-primary{border-color:hsl(var(--primary))}.border-primary\/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-300{--tw-border-opacity: 1;border-color:rgb(252 165 165 / var(--tw-border-opacity, 1))}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-red-500\/50{border-color:#ef444480}.border-transparent{border-color:transparent}.border-yellow-200{--tw-border-opacity: 1;border-color:rgb(254 240 138 / var(--tw-border-opacity, 1))}.border-yellow-500\/50{border-color:#eab30880}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\[--color-bg\]{background-color:var(--color-bg)}.bg-accent{background-color:hsl(var(--accent))}.bg-amber-50{--tw-bg-opacity: 1;background-color:rgb(255 251 235 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-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\/80{background-color:hsl(var(--card) / .8)}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.bg-gray-800\/20{background-color:#1f293733}.bg-gray-800\/30{background-color:#1f29374d}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-600{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity, 1))}.bg-muted{background-color:hsl(var(--muted))}.bg-muted-foreground\/50{background-color:hsl(var(--muted-foreground) / .5)}.bg-muted\/20{background-color:hsl(var(--muted) / .2)}.bg-muted\/30{background-color:hsl(var(--muted) / .3)}.bg-muted\/50{background-color:hsl(var(--muted) / .5)}.bg-muted\/60{background-color:hsl(var(--muted) / .6)}.bg-orange-50{--tw-bg-opacity: 1;background-color:rgb(255 247 237 / var(--tw-bg-opacity, 1))}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-600{--tw-bg-opacity: 1;background-color:rgb(234 88 12 / var(--tw-bg-opacity, 1))}.bg-pink-500{--tw-bg-opacity: 1;background-color:rgb(236 72 153 / var(--tw-bg-opacity, 1))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary-foreground\/20{background-color:hsl(var(--primary-foreground) / .2)}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-primary\/20{background-color:hsl(var(--primary) / .2)}.bg-primary\/5{background-color:hsl(var(--primary) / .05)}.bg-primary\/60{background-color:hsl(var(--primary) / .6)}.bg-purple-100{--tw-bg-opacity: 1;background-color:rgb(243 232 255 / var(--tw-bg-opacity, 1))}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-red-900\/20{background-color:#7f1d1d33}.bg-red-900\/30{background-color:#7f1d1d4d}.bg-secondary{background-color:hsl(var(--secondary))}.bg-secondary\/5{background-color:hsl(var(--secondary) / .05)}.bg-slate-200{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity, 1))}.bg-slate-300{--tw-bg-opacity: 1;background-color:rgb(203 213 225 / var(--tw-bg-opacity, 1))}.bg-slate-400{--tw-bg-opacity: 1;background-color:rgb(148 163 184 / var(--tw-bg-opacity, 1))}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-200{--tw-bg-opacity: 1;background-color:rgb(254 240 138 / var(--tw-bg-opacity, 1))}.bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/5{background-color:#eab3080d}.bg-yellow-900\/20{background-color:#713f1233}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-green-500{--tw-gradient-from: #22c55e var(--tw-gradient-from-position);--tw-gradient-to: rgb(34 197 94 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-500{--tw-gradient-from: #6366f1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(99 102 241 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-orange-500{--tw-gradient-from: #f97316 var(--tw-gradient-from-position);--tw-gradient-to: rgb(249 115 22 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-primary\/5{--tw-gradient-from: hsl(var(--primary) / .05) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--primary) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-purple-500{--tw-gradient-from: #a855f7 var(--tw-gradient-from-position);--tw-gradient-to: rgb(168 85 247 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-red-500{--tw-gradient-from: #ef4444 var(--tw-gradient-from-position);--tw-gradient-to: rgb(239 68 68 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-200{--tw-gradient-from: #e2e8f0 var(--tw-gradient-from-position);--tw-gradient-to: rgb(226 232 240 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-300{--tw-gradient-from: #cbd5e1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(203 213 225 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-400{--tw-gradient-from: #94a3b8 var(--tw-gradient-from-position);--tw-gradient-to: rgb(148 163 184 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-background{--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), hsl(var(--background)) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-blue-600{--tw-gradient-to: #2563eb var(--tw-gradient-to-position)}.to-cyan-500{--tw-gradient-to: #06b6d4 var(--tw-gradient-to-position)}.to-emerald-500{--tw-gradient-to: #10b981 var(--tw-gradient-to-position)}.to-green-600{--tw-gradient-to: #16a34a var(--tw-gradient-to-position)}.to-orange-500{--tw-gradient-to: #f97316 var(--tw-gradient-to-position)}.to-pink-500{--tw-gradient-to: #ec4899 var(--tw-gradient-to-position)}.to-primary\/10{--tw-gradient-to: hsl(var(--primary) / .1) var(--tw-gradient-to-position)}.to-purple-500{--tw-gradient-to: #a855f7 var(--tw-gradient-to-position)}.to-secondary\/5{--tw-gradient-to: hsl(var(--secondary) / .05) var(--tw-gradient-to-position)}.to-slate-700{--tw-gradient-to: #334155 var(--tw-gradient-to-position)}.to-slate-800{--tw-gradient-to: #1e293b var(--tw-gradient-to-position)}.to-slate-900{--tw-gradient-to: #0f172a var(--tw-gradient-to-position)}.fill-current{fill:currentColor}.fill-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-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}.pl-10{padding-left:2.5rem}.pl-11{padding-left:2.75rem}.pl-2{padding-left:.5rem}.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-4{padding-right:1rem}.pr-6{padding-right:1.5rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.pt-8{padding-top:2rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[0\.8rem\]{font-size:.8rem}.text-\[10px\]{font-size:10px}.text-\[150px\]{font-size:150px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-black{font-weight:900}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.tracking-tight{letter-spacing:-.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-amber-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-900{--tw-text-opacity: 1;color:rgb(120 53 15 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.text-blue-900{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity, 1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/50{color:hsl(var(--foreground) / .5)}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-muted-foreground\/50{color:hsl(var(--muted-foreground) / .5)}.text-muted-foreground\/60{color:hsl(var(--muted-foreground) / .6)}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity, 1))}.text-orange-800{--tw-text-opacity: 1;color:rgb(154 52 18 / var(--tw-text-opacity, 1))}.text-orange-900{--tw-text-opacity: 1;color:rgb(124 45 18 / var(--tw-text-opacity, 1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-primary-foreground\/70{color:hsl(var(--primary-foreground) / .7)}.text-primary\/10{color:hsl(var(--primary) / .1)}.text-primary\/30{color:hsl(var(--primary) / .3)}.text-primary\/60{color:hsl(var(--primary) / .6)}.text-purple-500{--tw-text-opacity: 1;color:rgb(168 85 247 / var(--tw-text-opacity, 1))}.text-purple-600{--tw-text-opacity: 1;color:rgb(147 51 234 / var(--tw-text-opacity, 1))}.text-purple-700{--tw-text-opacity: 1;color:rgb(126 34 206 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.text-yellow-900{--tw-text-opacity: 1;color:rgb(113 63 18 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.opacity-90{opacity:.9}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-primary{--tw-ring-color: hsl(var(--primary))}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.blur-3xl{--tw-blur: blur(64px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur: blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.text-primary-gradient{color:hsl(var(--primary))}.has-gradient .text-primary-gradient{background:var(--primary-gradient);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;color:transparent}.\[--cell-size\:2rem\]{--cell-size: 2rem}.no-animations *,.no-animations *:before,.no-animations *:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}.no-animations *:hover{transition-duration:.01ms!important}::view-transition-old(root),::view-transition-new(root){animation:none;mix-blend-mode:normal}::view-transition-old(root){z-index:1}::view-transition-new(root){z-index:999}.__floater{z-index:99999!important;pointer-events:auto!important}.react-joyride__overlay,.react-joyride__spotlight{z-index:99998!important}.react-joyride__tooltip{pointer-events:auto!important}#tour-portal-container *{pointer-events:auto}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.file\:text-foreground::file-selector-button{color:hsl(var(--foreground))}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.hover\:border-muted-foreground\/50:hover{border-color:hsl(var(--muted-foreground) / .5)}.hover\:border-primary\/50:hover{border-color:hsl(var(--primary) / .5)}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-accent\/50:hover{background-color:hsl(var(--accent) / .5)}.hover\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-green-700:hover{--tw-bg-opacity: 1;background-color:rgb(21 128 61 / var(--tw-bg-opacity, 1))}.hover\:bg-muted:hover{background-color:hsl(var(--muted))}.hover\:bg-muted-foreground\/20:hover{background-color:hsl(var(--muted-foreground) / .2)}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-orange-700:hover{--tw-bg-opacity: 1;background-color:rgb(194 65 12 / var(--tw-bg-opacity, 1))}.hover\:bg-primary\/10:hover{background-color:hsl(var(--primary) / .1)}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-secondary\/90:hover{background-color:hsl(var(--secondary) / .9)}.hover\:bg-transparent:hover{background-color:transparent}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-green-700:hover{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.hover\:text-orange-700:hover{--tw-text-opacity: 1;color:rgb(194 65 12 / var(--tw-text-opacity, 1))}.hover\:text-primary\/80:hover{color:hsl(var(--primary) / .8)}.hover\:text-red-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\: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\:ring-2:hover{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.hover\:ring-primary:hover{--tw-ring-color: hsl(var(--primary))}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-gray-100:focus{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-0:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-red-500:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity, 1))}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--background))}.active\:cursor-grabbing:active{cursor:grabbing}.active\:border-primary\/70:active{border-color:hsl(var(--primary) / .7)}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group[open] .group-open\:rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:opacity-100{opacity:1}.group.destructive .group-\[\.destructive\]\:border-muted\/40{border-color:hsl(var(--muted) / .4)}.group.destructive .group-\[\.destructive\]\:text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover{--tw-text-opacity: 1;color:rgb(254 242 242 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(248 113 113 / var(--tw-ring-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-offset-red-600:focus{--tw-ring-offset-color: #dc2626}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.aria-selected\:text-muted-foreground[aria-selected=true]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked],.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe=end]{--tw-translate-x: var(--radix-toast-swipe-end-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe=move]{--tw-translate-x: var(--radix-toast-swipe-move-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes fade-out{0%{opacity:1}to{opacity:0}}.data-\[state\=closed\]\:animate-fade-out[data-state=closed]{animation:fade-out .15s ease-in}.data-\[state\=closed\]\:animate-slide-out-to-right[data-state=closed]{animation:slide-out-to-right .2s ease-in}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.data-\[state\=open\]\:animate-fade-in[data-state=open]{animation:fade-in .2s ease-out}@keyframes slide-in-from-right{0%{transform:translate(100%)}to{transform:translate(0)}}.data-\[state\=open\]\:animate-slide-in-from-right[data-state=open]{animation:slide-in-from-right .3s ease-out}@keyframes slide-out-to-right{0%{transform:translate(0)}to{transform:translate(100%)}}.data-\[swipe\=end\]\:animate-slide-out-to-right[data-swipe=end]{animation:slide-out-to-right .2s ease-in}.data-\[range-end\=true\]\:rounded-md[data-range-end=true]{border-radius:calc(var(--radius) - 2px)}.data-\[range-middle\=true\]\:rounded-none[data-range-middle=true]{border-radius:0}.data-\[range-start\=true\]\:rounded-md[data-range-start=true]{border-radius:calc(var(--radius) - 2px)}.data-\[selected\=true\]\:rounded-none[data-selected=true]{border-radius:0}.data-\[range-end\=true\]\:bg-primary[data-range-end=true]{background-color:hsl(var(--primary))}.data-\[range-middle\=true\]\:bg-accent[data-range-middle=true]{background-color:hsl(var(--accent))}.data-\[range-start\=true\]\:bg-primary[data-range-start=true],.data-\[selected-single\=true\]\:bg-primary[data-selected-single=true]{background-color:hsl(var(--primary))}.data-\[selected\=true\]\:bg-accent[data-selected=true]{background-color:hsl(var(--accent))}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:hsl(var(--muted))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[placeholder\]\:text-muted-foreground[data-placeholder]{color:hsl(var(--muted-foreground))}.data-\[range-end\=true\]\:text-primary-foreground[data-range-end=true]{color:hsl(var(--primary-foreground))}.data-\[range-middle\=true\]\:text-accent-foreground[data-range-middle=true]{color:hsl(var(--accent-foreground))}.data-\[range-start\=true\]\:text-primary-foreground[data-range-start=true],.data-\[selected-single\=true\]\:text-primary-foreground[data-selected-single=true]{color:hsl(var(--primary-foreground))}.data-\[selected\=true\]\:text-accent-foreground[data-selected=true]{color:hsl(var(--accent-foreground))}.data-\[state\=active\]\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\[state\=open\]\:text-accent-foreground[data-state=open]{color:hsl(var(--accent-foreground))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:opacity-50[data-disabled=true],.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[state\=active\]\:shadow-sm[data-state=active]{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}.data-\[state\=active\]\:duration-300[data-state=active]{transition-duration:.3s}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:relative{position:relative}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:z-10{z-index:10}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:border-ring{border-color:hsl(var(--ring))}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-\[3px\]{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-ring\/50{--tw-ring-color: hsl(var(--ring) / .5)}@supports (backdrop-filter: var(--tw)){.supports-\[backdrop-filter\]\:bg-background\/60{background-color:hsl(var(--background) / .6)}}.dark\:border-amber-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(146 64 14 / var(--tw-border-opacity, 1))}.dark\:border-blue-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 64 175 / var(--tw-border-opacity, 1))}.dark\:border-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-orange-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(124 45 18 / var(--tw-border-opacity, 1))}.dark\:border-yellow-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(113 63 18 / var(--tw-border-opacity, 1))}.dark\:bg-amber-950\/30:is(.dark *){background-color:#451a034d}.dark\:bg-blue-500\/20:is(.dark *){background-color:#3b82f633}.dark\:bg-blue-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 58 138 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-900\/30:is(.dark *){background-color:#1e3a8a4d}.dark\:bg-blue-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(23 37 84 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-950\/20:is(.dark *){background-color:#17255433}.dark\:bg-blue-950\/30:is(.dark *){background-color:#1725544d}.dark\:bg-gray-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-800\/30:is(.dark *){background-color:#1f29374d}.dark\:bg-gray-800\/50:is(.dark *){background-color:#1f293780}.dark\:bg-gray-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(3 7 18 / var(--tw-bg-opacity, 1))}.dark\:bg-green-900\/30:is(.dark *){background-color:#14532d4d}.dark\:bg-green-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(5 46 22 / var(--tw-bg-opacity, 1))}.dark\:bg-green-950\/20:is(.dark *){background-color:#052e1633}.dark\:bg-orange-950\/20:is(.dark *){background-color:#43140733}.dark\:bg-purple-900\/30:is(.dark *){background-color:#581c874d}.dark\:bg-red-500\/20:is(.dark *){background-color:#ef444433}.dark\:bg-red-600\/30:is(.dark *){background-color:#dc26264d}.dark\:bg-red-900\/30:is(.dark *){background-color:#7f1d1d4d}.dark\:bg-red-950\/50:is(.dark *){background-color:#450a0a80}.dark\:bg-yellow-500\/20:is(.dark *){background-color:#eab30833}.dark\:bg-yellow-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(113 63 18 / var(--tw-bg-opacity, 1))}.dark\:bg-yellow-950\/30:is(.dark *){background-color:#4220064d}.dark\:text-amber-100:is(.dark *){--tw-text-opacity: 1;color:rgb(254 243 199 / var(--tw-text-opacity, 1))}.dark\:text-amber-400:is(.dark *){--tw-text-opacity: 1;color:rgb(251 191 36 / 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-400:is(.dark *){--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.dark\:text-orange-100:is(.dark *){--tw-text-opacity: 1;color:rgb(255 237 213 / var(--tw-text-opacity, 1))}.dark\:text-orange-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 215 170 / var(--tw-text-opacity, 1))}.dark\:text-purple-400:is(.dark *){--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.dark\:text-red-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\:focus\:bg-gray-800:focus:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}@media(min-width:640px){.sm\:right-2{right:.5rem}.sm\:right-3{right:.75rem}.sm\:top-2{top:.5rem}.sm\:top-3{top:.75rem}.sm\:order-1{order:1}.sm\:order-2{order:2}.sm\:col-span-2{grid-column:span 2 / span 2}.sm\:mx-0{margin-left:0;margin-right:0}.sm\:mb-3{margin-bottom:.75rem}.sm\:mb-4{margin-bottom:1rem}.sm\:mb-6{margin-bottom:1.5rem}.sm\:ml-0{margin-left:0}.sm\:ml-1{margin-left:.25rem}.sm\:mr-1{margin-right:.25rem}.sm\:mt-0{margin-top:0}.sm\:mt-2{margin-top:.5rem}.sm\:mt-3{margin-top:.75rem}.sm\:mt-6{margin-top:1.5rem}.sm\:block{display:block}.sm\:inline{display:inline}.sm\:flex{display:flex}.sm\:grid{display:grid}.sm\:hidden{display:none}.sm\:h-10{height:2.5rem}.sm\:h-12{height:3rem}.sm\:h-2{height:.5rem}.sm\:h-2\.5{height:.625rem}.sm\:h-24{height:6rem}.sm\:h-4{height:1rem}.sm\:h-5{height:1.25rem}.sm\:h-8{height:2rem}.sm\:h-9{height:2.25rem}.sm\:h-\[300px\]{height:300px}.sm\:h-\[400px\]{height:400px}.sm\:h-\[500px\]{height:500px}.sm\:h-\[calc\(100vh-280px\)\]{height:calc(100vh - 280px)}.sm\:w-10{width:2.5rem}.sm\:w-2{width:.5rem}.sm\:w-2\.5{width:.625rem}.sm\:w-24{width:6rem}.sm\:w-28{width:7rem}.sm\:w-4{width:1rem}.sm\:w-5{width:1.25rem}.sm\:w-8{width:2rem}.sm\:w-80{width:20rem}.sm\:w-96{width:24rem}.sm\:w-\[200px\]{width:200px}.sm\:w-\[500px\]{width:500px}.sm\:w-auto{width:auto}.sm\:w-full{width:100%}.sm\:min-w-\[120px\]{min-width:120px}.sm\:max-w-2xl{max-width:42rem}.sm\:max-w-\[420px\]{max-width:420px}.sm\:max-w-\[500px\]{max-width:500px}.sm\:max-w-\[70\%\]{max-width:70%}.sm\:max-w-\[900px\]{max-width:900px}.sm\:max-w-md{max-width:28rem}.sm\:max-w-sm{max-width:24rem}.sm\:flex-1{flex:1 1 0%}.sm\:flex-none{flex:none}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.sm\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-start{align-items:flex-start}.sm\:items-center{align-items:center}.sm\:justify-end{justify-content:flex-end}.sm\:justify-between{justify-content:space-between}.sm\:gap-0{gap:0px}.sm\:gap-1{gap:.25rem}.sm\:gap-2{gap:.5rem}.sm\:gap-3{gap:.75rem}.sm\:gap-4{gap:1rem}.sm\:gap-6{gap:1.5rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.sm\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.sm\:space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.sm\:space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.sm\:space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:p-3{padding:.75rem}.sm\:p-4{padding:1rem}.sm\:p-6{padding:1.5rem}.sm\:px-0{padding-left:0;padding-right:0}.sm\:px-3{padding-left:.75rem;padding-right:.75rem}.sm\:px-4{padding-left:1rem;padding-right:1rem}.sm\:py-2{padding-top:.5rem;padding-bottom:.5rem}.sm\:pb-3{padding-bottom:.75rem}.sm\:text-left{text-align:left}.sm\:text-right{text-align:right}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-3xl{font-size:1.875rem;line-height:2.25rem}.sm\:text-\[200px\]{font-size:200px}.sm\:text-base{font-size:1rem;line-height:1.5rem}.sm\:text-lg{font-size:1.125rem;line-height:1.75rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:text-xl{font-size:1.25rem;line-height:1.75rem}.sm\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:768px){.md\:top-4{top:1rem}.md\:mb-4{margin-bottom:1rem}.md\:mb-6{margin-bottom:1.5rem}.md\:mb-8{margin-bottom:2rem}.md\:mt-8{margin-top:2rem}.md\:block{display:block}.md\:inline{display:inline}.md\:flex{display:flex}.md\:hidden{display:none}.md\:h-16{height:4rem}.md\:h-4{height:1rem}.md\:h-5{height:1.25rem}.md\:h-8{height:2rem}.md\:h-96{height:24rem}.md\:h-\[500px\]{height:500px}.md\:min-h-\[400px\]{min-height:400px}.md\:w-16{width:4rem}.md\:w-4{width:1rem}.md\:w-5{width:1.25rem}.md\:w-8{width:2rem}.md\:w-96{width:24rem}.md\:max-w-none{max-width:none}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:gap-2{gap:.5rem}.md\:gap-3{gap:.75rem}.md\:gap-4{gap:1rem}.md\:gap-6{gap:1.5rem}.md\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.md\:space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.md\:whitespace-normal{white-space:normal}.md\:p-12{padding:3rem}.md\:p-4{padding:1rem}.md\:p-6{padding:1.5rem}.md\:p-8{padding:2rem}.md\:text-2xl{font-size:1.5rem;line-height:2rem}.md\:text-3xl{font-size:1.875rem;line-height:2.25rem}.md\:text-base{font-size:1rem;line-height:1.5rem}.md\:text-lg{font-size:1.125rem;line-height:1.75rem}.md\:text-sm{font-size:.875rem;line-height:1.25rem}.md\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:1024px){.lg\:invisible{visibility:hidden}.lg\:relative{position:relative}.lg\:z-0{z-index:0}.lg\:col-span-1{grid-column:span 1 / span 1}.lg\: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-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\:grid-cols-9{grid-template-columns:repeat(9,minmax(0,1fr))}.lg\:justify-center{justify-content:center}.lg\:gap-0{gap:0px}.lg\:space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.lg\:overflow-hidden{overflow:hidden}.lg\:p-2{padding:.5rem}.lg\:p-4{padding:1rem}.lg\:px-0{padding-left:0;padding-right:0}.lg\:px-4{padding-left:1rem;padding-right:1rem}.lg\:pb-4{padding-bottom:1rem}.lg\:text-2xl{font-size:1.5rem;line-height:2rem}.lg\:opacity-0{opacity:0}}@media(min-width:1280px){.xl\:grid-cols-10{grid-template-columns:repeat(10,minmax(0,1fr))}.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.xl\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}}.\[\&\+div\]\:text-xs+div{font-size:.75rem;line-height:1rem}.\[\&\:\:-webkit-scrollbar-thumb\:hover\]\:bg-border\/80::-webkit-scrollbar-thumb:hover{background-color:hsl(var(--border) / .8)}.\[\&\:\:-webkit-scrollbar-thumb\]\:rounded-full::-webkit-scrollbar-thumb{border-radius:9999px}.\[\&\:\:-webkit-scrollbar-thumb\]\:bg-border::-webkit-scrollbar-thumb{background-color:hsl(var(--border))}.\[\&\:\:-webkit-scrollbar-track\]\:bg-transparent::-webkit-scrollbar-track{background-color:transparent}.\[\&\:\:-webkit-scrollbar\]\:w-2\.5::-webkit-scrollbar{width:.625rem}.\[\&\:first-child\[data-selected\=true\]_button\]\:rounded-l-md:first-child[data-selected=true] button{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\:last-child\[data-selected\=true\]_button\]\:rounded-r-md:last-child[data-selected=true] button{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\>\[role\=checkbox\]\]\:translate-y-\[2px\]>[role=checkbox]{--tw-translate-y: 2px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>span\]\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\[\&\>span\]\:text-xs>span{font-size:.75rem;line-height:1rem}.\[\&\>span\]\:opacity-70>span{opacity:.7}.\[\&\>svg\+div\]\:translate-y-\[-3px\]>svg+div{--tw-translate-y: -3px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>svg\]\:absolute>svg{position:absolute}.\[\&\>svg\]\:left-4>svg{left:1rem}.\[\&\>svg\]\:top-4>svg{top:1rem}.\[\&\>svg\]\:size-3\.5>svg{width:.875rem;height:.875rem}.\[\&\>svg\]\:h-2\.5>svg{height:.625rem}.\[\&\>svg\]\:h-3>svg{height:.75rem}.\[\&\>svg\]\:w-2\.5>svg{width:.625rem}.\[\&\>svg\]\:w-3>svg{width:.75rem}.\[\&\>svg\]\:text-foreground>svg{color:hsl(var(--foreground))}.\[\&\>svg\]\:text-muted-foreground>svg{color:hsl(var(--muted-foreground))}.\[\&\>svg\~\*\]\:pl-7>svg~*{padding-left:1.75rem}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&_\.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}.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)}@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}.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 e11c10e9..590e502a 100644 --- a/webui/dist/index.html +++ b/webui/dist/index.html @@ -7,7 +7,7 @@ MaiBot Dashboard - + @@ -17,11 +17,11 @@ - + - +